00001 #if !defined(_XMLUTILS_HPP) 00002 #define _XMLUTILS_HPP 00003 //============================================================================= 00004 // 00005 // XDFLengine library 00006 // 00007 //----------------------------------------------------------------------------- 00008 // UTILS.HPP 00009 //----------------------------------------------------------------------------- 00015 //_____________________________________________________________________________ 00016 // 00017 // Copyright (C) 2003 Guillaume Baurand. All Rights Reserved. 00018 // 00019 // This file is part of the XDFLengine project. 00020 // 00021 // The XDFLengine is free software; you can redistribute it and/or modify 00022 // it under the terms of the GNU General Public License as published by 00023 // the Free Software Foundation; either version 2 of the License, or 00024 // (at your option) any later version. 00025 // 00026 // This program is distributed in the hope that it will be useful, 00027 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00028 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00029 // GNU General Public License for more details. 00030 // 00031 // You should have received a copy of the GNU General Public License 00032 // along with this program; if not, write to the Free Software 00033 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00034 // USA. 00035 // 00036 // For more information, 00037 // contact : guillaume@baurand.net 00038 // or visit : http://xdflengine.sourceforge.net 00039 // 00040 //============================================================================= 00041 00042 // Xerces 00043 #include <xercesc/util/PlatformUtils.hpp> 00044 #include <xercesc/util/XMLUniDefs.hpp> 00045 #include <xercesc/util/XMLString.hpp> 00046 #include <xercesc/util/TransService.hpp> 00047 #include <xercesc/util/TranscodingException.hpp> 00048 # include "xercesc/util/XercesDefs.hpp" 00049 # include "xercesc/sax/InputSource.hpp" 00050 # include "xercesc/sax2/Attributes.hpp" 00051 # include "xercesc/sax2/ContentHandler.hpp" 00052 # include "xercesc/sax/ErrorHandler.hpp" 00053 00054 00055 # include "config/commonincs.hpp" 00056 00057 XERCES_CPP_NAMESPACE_USE; 00058 00059 BEGIN_XDFLENGINE_NS 00060 00061 00062 00063 00064 // XML STRING 00065 00066 //_____________________________________________________________________ 00067 // XSTR 00068 //--------------------------------------------------------------------- 00072 //_____________________________________________________________________ 00073 XDFLENGINE_EXPORT char* XSTR ( const XMLCh* totrans, char* p_pszBuffer = 0); 00074 00075 //_____________________________________________________________________ 00076 // XSTR 00077 //--------------------------------------------------------------------- 00078 XDFLENGINE_EXPORT char* XSTR(XMLTranscoder* fXCoder, const XMLCh* const toFormat, const unsigned int count , char* p_pszBuffer=0); 00079 00080 00081 00082 //_____________________________________________________________________ 00083 // XSTR 00084 //--------------------------------------------------------------------- 00085 XDFLENGINE_EXPORT char* XSTR(XMLTranscoder* fXCoder, const XMLCh* const toFormat , char* p_pszBuffer=0); 00086 00087 00088 //_____________________________________________________________________ 00089 // STRX 00090 //--------------------------------------------------------------------- 00094 //_____________________________________________________________________ 00095 XDFLENGINE_EXPORT XMLCh* STRX ( const char* totrans); 00096 00097 00098 //_____________________________________________________________________ 00099 // STRX 00100 //--------------------------------------------------------------------- 00101 XDFLENGINE_EXPORT char* correctAttrValue(const char* src); 00102 00103 // SAX PARSING 00104 00105 //_____________________________________________________________________ 00106 // SAX_PARSEXML 00107 //--------------------------------------------------------------------- 00112 //_____________________________________________________________________ 00113 XDFLENGINE_EXPORT void SAX_parseXML ( InputSource* p_pXMLDOM_inputSrc ,ContentHandler* p_pXMLSAX_handlers, ErrorHandler* p_pErrHandler); 00114 00115 //_____________________________________________________________________ 00116 // SAX_GETATTRVALUE 00117 //--------------------------------------------------------------------- 00122 //_____________________________________________________________________ 00123 XDFLENGINE_EXPORT char* SAX_getAttrValue(const Attributes& p_attrs,const char * p_pzName, const char* p_pszDefValue = "",char* p_pzBuffer=0); 00124 00125 // STRING PROCESSING 00126 00127 //_____________________________________________________________________ 00128 // UPPERIZE 00129 //--------------------------------------------------------------------- 00132 //_____________________________________________________________________ 00133 XDFLENGINE_EXPORT void upperize ( char* cTxt); 00134 00135 //_____________________________________________________________________ 00136 // LOWERIZE 00137 //--------------------------------------------------------------------- 00140 //_____________________________________________________________________ 00141 XDFLENGINE_EXPORT void lowerize ( char* cTxt); 00142 00143 //_____________________________________________________________________ 00144 // GETTIMESTRING 00145 //--------------------------------------------------------------------- 00152 //_____________________________________________________________________ 00153 XDFLENGINE_EXPORT char* getTimeString(const char* p_cExpression); 00154 00155 00156 // CHAR BUFFER FUNCTION 00157 00158 //_____________________________________________________________________ 00159 // ALLOCCHARBUFFER 00160 //--------------------------------------------------------------------- 00161 XDFLENGINE_EXPORT char* allocCharBuffer(unsigned int p_uiSize); 00162 00163 //_____________________________________________________________________ 00164 // RELEASECHARBUFFER 00165 //--------------------------------------------------------------------- 00166 XDFLENGINE_EXPORT char* releaseCharBuffer(char* p_pszBuffer); 00167 00168 //_____________________________________________________________________ 00169 // COPYCHARBUFFER 00170 //--------------------------------------------------------------------- 00171 XDFLENGINE_EXPORT char* copyCharBuffer(const char* p_pszBuffer); 00172 00173 //_____________________________________________________________________ 00174 // TRIMCHARBUFFER 00175 //--------------------------------------------------------------------- 00176 XDFLENGINE_EXPORT char* trimCharBuffer( const char* p_pszToTrim); 00177 00178 //_____________________________________________________________________ 00179 // IMPORTCHARBUFFER 00180 //--------------------------------------------------------------------- 00181 XDFLENGINE_EXPORT char* importCharBuffer( char* p_pszOldBuffer, const char* p_pszNewBuffer); 00182 00183 //_____________________________________________________________________ 00184 // EXPORTCHARBUFFER 00185 //--------------------------------------------------------------------- 00186 XDFLENGINE_EXPORT const char* exportCharBuffer( char* l_pszBuffer); 00187 00188 //_____________________________________________________________________ 00189 // CONCATCHARBUFFER 00190 //--------------------------------------------------------------------- 00191 XDFLENGINE_EXPORT char* concatCharBuffer( char* p_pszBaseBuffer, const char* p_pszToAdd, unsigned int p_uiGrowSize = 255); 00192 00193 //_____________________________________________________________________ 00194 // REPLACEINCHARBUFFER 00195 //--------------------------------------------------------------------- 00196 XDFLENGINE_EXPORT char* replaceInCharBuffer(const char* src, const char *srch, const char *rpl); 00197 00198 00199 00200 END_XDFLENGINE_NS 00201 00202 00203 00204 #endif 00205