00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 #ifndef _CPL_STRING_H_INCLUDED
00098 #define _CPL_STRING_H_INCLUDED
00099
00100 #include "cpl_vsi.h"
00101 #include "cpl_error.h"
00102 #include "cpl_conv.h"
00103
00122 CPL_C_START
00123
00124 char CPL_DLL **CSLAddString(char **papszStrList, const char *pszNewString);
00125 int CPL_DLL CSLCount(char **papszStrList);
00126 const char CPL_DLL *CSLGetField( char **, int );
00127 void CPL_DLL CPL_STDCALL CSLDestroy(char **papszStrList);
00128 char CPL_DLL **CSLDuplicate(char **papszStrList);
00129
00130 char CPL_DLL **CSLTokenizeString(const char *pszString );
00131 char CPL_DLL **CSLTokenizeStringComplex(const char *pszString,
00132 const char *pszDelimiter,
00133 int bHonourStrings, int bAllowEmptyTokens );
00134 char CPL_DLL **CSLTokenizeString2( const char *pszString,
00135 const char *pszDelimeter,
00136 int nCSLTFlags );
00137
00138 #define CSLT_HONOURSTRINGS 0x0001
00139 #define CSLT_ALLOWEMPTYTOKENS 0x0002
00140 #define CSLT_PRESERVEQUOTES 0x0004
00141 #define CSLT_PRESERVEESCAPES 0x0008
00142
00143 int CPL_DLL CSLPrint(char **papszStrList, FILE *fpOut);
00144 char CPL_DLL **CSLLoad(const char *pszFname);
00145 int CPL_DLL CSLSave(char **papszStrList, const char *pszFname);
00146
00147 char CPL_DLL **CSLInsertStrings(char **papszStrList, int nInsertAtLineNo,
00148 char **papszNewLines);
00149 char CPL_DLL **CSLInsertString(char **papszStrList, int nInsertAtLineNo,
00150 char *pszNewLine);
00151 char CPL_DLL **CSLRemoveStrings(char **papszStrList, int nFirstLineToDelete,
00152 int nNumToRemove, char ***ppapszRetStrings);
00153 int CPL_DLL CSLFindString( char **, const char * );
00154 int CPL_DLL CSLTestBoolean( const char *pszValue );
00155 int CPL_DLL CSLFetchBoolean( char **papszStrList, const char *pszKey,
00156 int bDefault );
00157
00158 const char CPL_DLL *CPLSPrintf(char *fmt, ...);
00159 char CPL_DLL **CSLAppendPrintf(char **papszStrList, char *fmt, ...);
00160
00161 const char CPL_DLL *
00162 CPLParseNameValue(const char *pszNameValue, char **ppszKey );
00163 const char CPL_DLL *
00164 CSLFetchNameValue(char **papszStrList, const char *pszName);
00165 char CPL_DLL **
00166 CSLFetchNameValueMultiple(char **papszStrList, const char *pszName);
00167 char CPL_DLL **
00168 CSLAddNameValue(char **papszStrList,
00169 const char *pszName, const char *pszValue);
00170 char CPL_DLL **
00171 CSLSetNameValue(char **papszStrList,
00172 const char *pszName, const char *pszValue);
00173 void CPL_DLL CSLSetNameValueSeparator( char ** papszStrList,
00174 const char *pszSeparator );
00175
00176 #define CPLES_BackslashQuotable 0
00177 #define CPLES_XML 1
00178 #define CPLES_URL 2
00179 #define CPLES_SQL 3
00180 #define CPLES_CSV 4
00181
00182 char CPL_DLL *CPLEscapeString( const char *pszString, int nLength,
00183 int nScheme );
00184 char CPL_DLL *CPLUnescapeString( const char *pszString, int *pnLength,
00185 int nScheme );
00186
00187 char CPL_DLL *CPLBinaryToHex( int nBytes, const GByte *pabyData );
00188 GByte CPL_DLL *CPLHexToBinary( const char *pszHex, int *pnBytes );
00189
00190 CPL_C_END
00191
00192
00193
00194
00195
00196 #ifdef __cplusplus
00197
00198 #include <string>
00199
00200 using std::string;
00201
00202 class CPL_DLL CPLString : public string
00203 {
00204 public:
00205 CPLString(void) {}
00206 CPLString( const std::string &oStr ) : string( oStr ) {}
00207 CPLString( const char *pszStr ) : string( pszStr ) {}
00208
00209 operator const char* (void) const { return c_str(); }
00210
00211 CPLString &Printf( const char *pszFormat, ... );
00212 CPLString &vPrintf( const char *pszFormat, va_list args );
00213 };
00214
00215 #endif
00216
00217 #endif