OGR
cpl_string.h
Go to the documentation of this file.
1 /**********************************************************************
2  * $Id: cpl_string.h c7b8420914709a42da0c491963bfa89a4b9df3d5 2019-03-23 16:03:44 +0100 Even Rouault $
3  *
4  * Name: cpl_string.h
5  * Project: CPL - Common Portability Library
6  * Purpose: String and StringList functions.
7  * Author: Daniel Morissette, dmorissette@mapgears.com
8  *
9  **********************************************************************
10  * Copyright (c) 1998, Daniel Morissette
11  * Copyright (c) 2008-2014, Even Rouault <even dot rouault at mines-paris dot org>
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included
21  * in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  ****************************************************************************/
31 
32 #ifndef CPL_STRING_H_INCLUDED
33 #define CPL_STRING_H_INCLUDED
34 
35 #include "cpl_error.h"
36 #include "cpl_conv.h"
37 #include "cpl_vsi.h"
38 
62 
63 char CPL_DLL **CSLAddString(char **papszStrList,
64  const char *pszNewString) CPL_WARN_UNUSED_RESULT;
65 char CPL_DLL **CSLAddStringMayFail(
66  char **papszStrList, const char *pszNewString) CPL_WARN_UNUSED_RESULT;
67 int CPL_DLL CSLCount(CSLConstList papszStrList);
68 const char CPL_DLL *CSLGetField( CSLConstList, int );
69 void CPL_DLL CPL_STDCALL CSLDestroy(char **papszStrList);
70 char CPL_DLL **CSLDuplicate(CSLConstList papszStrList) CPL_WARN_UNUSED_RESULT;
71 char CPL_DLL **CSLMerge( char **papszOrig,
72  CSLConstList papszOverride ) CPL_WARN_UNUSED_RESULT;
73 
74 char CPL_DLL **CSLTokenizeString(const char *pszString ) CPL_WARN_UNUSED_RESULT;
75 char CPL_DLL **CSLTokenizeStringComplex(
76  const char *pszString, const char *pszDelimiter, int bHonourStrings,
77  int bAllowEmptyTokens ) CPL_WARN_UNUSED_RESULT;
78 char CPL_DLL **CSLTokenizeString2( const char *pszString,
79  const char *pszDelimiter,
80  int nCSLTFlags ) CPL_WARN_UNUSED_RESULT;
81 
83 #define CSLT_HONOURSTRINGS 0x0001
84 
85 #define CSLT_ALLOWEMPTYTOKENS 0x0002
86 
87 #define CSLT_PRESERVEQUOTES 0x0004
88 
89 #define CSLT_PRESERVEESCAPES 0x0008
90 
91 #define CSLT_STRIPLEADSPACES 0x0010
92 
93 #define CSLT_STRIPENDSPACES 0x0020
94 
95 int CPL_DLL CSLPrint(CSLConstList papszStrList, FILE *fpOut);
96 char CPL_DLL **CSLLoad(const char *pszFname) CPL_WARN_UNUSED_RESULT;
97 char CPL_DLL **CSLLoad2(
98  const char *pszFname, int nMaxLines, int nMaxCols,
100 int CPL_DLL CSLSave(CSLConstList papszStrList, const char *pszFname);
101 
102 char CPL_DLL **CSLInsertStrings(char **papszStrList, int nInsertAtLineNo,
103  CSLConstList papszNewLines) CPL_WARN_UNUSED_RESULT;
104 char CPL_DLL **CSLInsertString(char **papszStrList, int nInsertAtLineNo,
105  const char *pszNewLine) CPL_WARN_UNUSED_RESULT;
106 char CPL_DLL **CSLRemoveStrings(
107  char **papszStrList, int nFirstLineToDelete,
108  int nNumToRemove, char ***ppapszRetStrings) CPL_WARN_UNUSED_RESULT;
109 int CPL_DLL CSLFindString( CSLConstList papszList, const char *pszTarget );
110 int CPL_DLL CSLFindStringCaseSensitive( CSLConstList papszList,
111  const char *pszTarget );
112 int CPL_DLL CSLPartialFindString( CSLConstList papszHaystack,
113  const char *pszNeedle );
114 int CPL_DLL CSLFindName(CSLConstList papszStrList, const char *pszName);
115 int CPL_DLL CSLFetchBoolean( CSLConstList papszStrList, const char *pszKey,
116  int bDefault );
117 
118 /* TODO: Deprecate CSLTestBoolean. Remove in GDAL 3.x. */
119 int CPL_DLL CSLTestBoolean( const char *pszValue );
120 /* Do not use CPLTestBoolean in C++ code. Use CPLTestBool. */
121 int CPL_DLL CPLTestBoolean( const char *pszValue );
122 
123 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
124 #ifdef DO_NOT_USE_DEBUG_BOOL
125 #define CPLTestBool(x) CPL_TO_BOOL(CPLTestBoolean(x))
126 #define CPLFetchBool(list,key,default) \
127  CPL_TO_BOOL(CSLFetchBoolean(list,key,default))
128 #else /* DO_NOT_USE_DEBUG_BOOL */
129 /* Prefer these for C++ code. */
130 #ifdef DEBUG_BOOL
131 extern "C++" {
132 #endif
133 bool CPL_DLL CPLTestBool( const char *pszValue );
134 bool CPL_DLL CPLFetchBool( CSLConstList papszStrList, const char *pszKey,
135  bool bDefault );
136 #ifdef DEBUG_BOOL
137 }
138 #endif
139 #endif
140 #endif /* __cplusplus */
141 
142 const char CPL_DLL *
143  CPLParseNameValue( const char *pszNameValue, char **ppszKey );
144 
145 const char CPL_DLL *
146  CSLFetchNameValue( CSLConstList papszStrList, const char *pszName);
147 const char CPL_DLL *
148  CSLFetchNameValueDef( CSLConstList papszStrList,
149  const char *pszName,
150  const char *pszDefault );
151 char CPL_DLL **
152  CSLFetchNameValueMultiple(CSLConstList papszStrList, const char *pszName);
153 char CPL_DLL **
154  CSLAddNameValue(char **papszStrList,
155  const char *pszName,
156  const char *pszValue) CPL_WARN_UNUSED_RESULT;
157 char CPL_DLL **
158  CSLSetNameValue(char **papszStrList,
159  const char *pszName,
160  const char *pszValue) CPL_WARN_UNUSED_RESULT;
161 void CPL_DLL CSLSetNameValueSeparator( char ** papszStrList,
162  const char *pszSeparator );
163 
164 char CPL_DLL ** CSLParseCommandLine(const char* pszCommandLine);
165 
167 #define CPLES_BackslashQuotable 0
168 
169 #define CPLES_XML 1
170 
171 #define CPLES_URL 2
172 
173 #define CPLES_SQL 3
174 
175 #define CPLES_CSV 4
176 
177 #define CPLES_XML_BUT_QUOTES 5
178 
179 #define CPLES_CSV_FORCE_QUOTING 6
180 
181 #define CPLES_SQLI 7
182 
183 char CPL_DLL *CPLEscapeString( const char *pszString, int nLength,
184  int nScheme ) CPL_WARN_UNUSED_RESULT;
185 char CPL_DLL *CPLUnescapeString( const char *pszString, int *pnLength,
186  int nScheme ) CPL_WARN_UNUSED_RESULT;
187 
188 char CPL_DLL *CPLBinaryToHex( int nBytes,
189  const GByte *pabyData ) CPL_WARN_UNUSED_RESULT;
190 GByte CPL_DLL *CPLHexToBinary( const char *pszHex,
191  int *pnBytes ) CPL_WARN_UNUSED_RESULT;
192 
193 char CPL_DLL *CPLBase64Encode( int nBytes,
194  const GByte *pabyData ) CPL_WARN_UNUSED_RESULT;
195 int CPL_DLL CPLBase64DecodeInPlace( GByte* pszBase64 ) CPL_WARN_UNUSED_RESULT;
196 
198 typedef enum
199 {
203 } CPLValueType;
204 
205 CPLValueType CPL_DLL CPLGetValueType(const char* pszValue);
206 
207 size_t CPL_DLL CPLStrlcpy(char* pszDest, const char* pszSrc, size_t nDestSize);
208 size_t CPL_DLL CPLStrlcat(char* pszDest, const char* pszSrc, size_t nDestSize);
209 size_t CPL_DLL CPLStrnlen(const char *pszStr, size_t nMaxLen);
210 
211 /* -------------------------------------------------------------------- */
212 /* Locale independent formatting functions. */
213 /* -------------------------------------------------------------------- */
214 int CPL_DLL CPLvsnprintf( char *str, size_t size,
215  CPL_FORMAT_STRING(const char* fmt),
216  va_list args )
217  CPL_PRINT_FUNC_FORMAT(3, 0 );
218 
219 /* ALIAS_CPLSNPRINTF_AS_SNPRINTF might be defined to enable GCC 7 */
220 /* -Wformat-truncation= warnings, but shouldn't be set for normal use */
221 #if defined(ALIAS_CPLSNPRINTF_AS_SNPRINTF)
222 #define CPLsnprintf snprintf
223 #else
224 int CPL_DLL CPLsnprintf( char *str, size_t size,
225  CPL_FORMAT_STRING(const char* fmt), ... )
226  CPL_PRINT_FUNC_FORMAT(3, 4);
227 #endif
228 
230 #if defined(GDAL_COMPILATION) && !defined(DONT_DEPRECATE_SPRINTF)
231 int CPL_DLL CPLsprintf( char *str, CPL_FORMAT_STRING(const char* fmt), ... )
233  CPL_WARN_DEPRECATED("Use CPLsnprintf instead");
234 #else
235 int CPL_DLL CPLsprintf( char *str, CPL_FORMAT_STRING(const char* fmt), ... )
236  CPL_PRINT_FUNC_FORMAT(2, 3);
237 #endif
238 
239 int CPL_DLL CPLprintf( CPL_FORMAT_STRING(const char* fmt), ... )
240  CPL_PRINT_FUNC_FORMAT(1, 2);
241 
242 /* For some reason Doxygen_Suppress is needed to avoid warning. Not sure why */
244 /* caution: only works with limited number of formats */
245 int CPL_DLL CPLsscanf( const char* str,
246  CPL_SCANF_FORMAT_STRING(const char* fmt), ... )
247  CPL_SCAN_FUNC_FORMAT(2, 3);
250 const char CPL_DLL *CPLSPrintf( CPL_FORMAT_STRING(const char *fmt), ... )
252 char CPL_DLL **CSLAppendPrintf( char **papszStrList,
253  CPL_FORMAT_STRING(const char *fmt), ... )
255 int CPL_DLL CPLVASPrintf( char **buf,
256  CPL_FORMAT_STRING(const char *fmt), va_list args )
257  CPL_PRINT_FUNC_FORMAT(2, 0);
258 
259 /* -------------------------------------------------------------------- */
260 /* RFC 23 character set conversion/recoding API (cpl_recode.cpp). */
261 /* -------------------------------------------------------------------- */
263 #define CPL_ENC_LOCALE ""
264 
265 #define CPL_ENC_UTF8 "UTF-8"
266 
267 #define CPL_ENC_UTF16 "UTF-16"
268 
269 #define CPL_ENC_UCS2 "UCS-2"
270 
271 #define CPL_ENC_UCS4 "UCS-4"
272 
273 #define CPL_ENC_ASCII "ASCII"
274 
275 #define CPL_ENC_ISO8859_1 "ISO-8859-1"
276 
277 int CPL_DLL CPLEncodingCharSize( const char *pszEncoding );
279 void CPL_DLL CPLClearRecodeWarningFlags( void );
281 char CPL_DLL *CPLRecode(
282  const char *pszSource, const char *pszSrcEncoding,
283  const char *pszDstEncoding ) CPL_WARN_UNUSED_RESULT CPL_RETURNS_NONNULL;
284 char CPL_DLL *CPLRecodeFromWChar(
285  const wchar_t *pwszSource, const char *pszSrcEncoding,
286  const char *pszDstEncoding ) CPL_WARN_UNUSED_RESULT;
287 wchar_t CPL_DLL *CPLRecodeToWChar(
288  const char *pszSource, const char *pszSrcEncoding,
289  const char *pszDstEncoding ) CPL_WARN_UNUSED_RESULT;
290 int CPL_DLL CPLIsUTF8( const char* pabyData, int nLen );
291 char CPL_DLL *CPLForceToASCII(
292  const char* pabyData, int nLen,
293  char chReplacementChar ) CPL_WARN_UNUSED_RESULT;
294 int CPL_DLL CPLStrlenUTF8( const char *pszUTF8Str );
295 CPL_C_END
296 
297 /************************************************************************/
298 /* CPLString */
299 /************************************************************************/
300 
301 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
302 
303 extern "C++"
304 {
305 #ifndef DOXYGEN_SKIP
306 #include <string>
307 #endif
308 
309 // VC++ implicitly applies __declspec(dllexport) to template base classes
310 // of classes marked with __declspec(dllexport).
311 // Hence, if marked with CPL_DLL, VC++ would export symbols for the specialization
312 // of std::basic_string<char>, since it is a base class of CPLString.
313 // As a result, if an application linked both gdal.dll and a static library that
314 // (implicitly) instantiates std::string (almost all do!), then the linker would
315 // emit an error concerning duplicate symbols for std::string.
316 // The least intrusive solution is to not mark the whole class with
317 // __declspec(dllexport) for VC++, but only its non-inline methods.
318 #ifdef _MSC_VER
319 # define CPLSTRING_CLASS_DLL
320 # define CPLSTRING_METHOD_DLL CPL_DLL
321 #else
322 
323 # define CPLSTRING_CLASS_DLL CPL_DLL
324 # define CPLSTRING_METHOD_DLL
325 
326 #endif
327 
329 class CPLSTRING_CLASS_DLL CPLString : public std::string
330 {
331 public:
332 
334  CPLString(void) {}
336  // cppcheck-suppress noExplicitConstructor
337  CPLString( const std::string &oStr ) : std::string( oStr ) {}
339  // cppcheck-suppress noExplicitConstructor
340  CPLString( const char *pszStr ) : std::string( pszStr ) {}
342  CPLString( const char *pszStr, size_t n ) : std::string( pszStr, n ) {}
343 
345  operator const char* (void) const { return c_str(); }
346 
348  char& operator[](std::string::size_type i)
349  {
350  return std::string::operator[](i);
351  }
352 
354  const char& operator[](std::string::size_type i) const
355  {
356  return std::string::operator[](i);
357  }
358 
360  char& operator[](int i)
361  {
362  return std::string::operator[](
363  static_cast<std::string::size_type>(i));
364  }
365 
367  const char& operator[](int i) const
368  {
369  return std::string::operator[](
370  static_cast<std::string::size_type>(i));
371  }
372 
374  void Clear() { resize(0); }
375 
379  void Seize( char *pszValue )
380  {
381  if (pszValue == nullptr )
382  Clear();
383  else
384  {
385  *this = pszValue;
386  CPLFree(pszValue);
387  }
388  }
389 
390  /* There seems to be a bug in the way the compiler count indices...
391  * Should be CPL_PRINT_FUNC_FORMAT (1, 2) */
392  CPLSTRING_METHOD_DLL CPLString &Printf(
393  CPL_FORMAT_STRING(const char *pszFormat), ... )
394  CPL_PRINT_FUNC_FORMAT (2, 3);
395  CPLSTRING_METHOD_DLL CPLString &vPrintf(
396  CPL_FORMAT_STRING(const char *pszFormat), va_list args )
397  CPL_PRINT_FUNC_FORMAT(2, 0);
398  CPLSTRING_METHOD_DLL CPLString &FormatC( double dfValue, const char *pszFormat = nullptr );
399  CPLSTRING_METHOD_DLL CPLString &Trim();
400  CPLSTRING_METHOD_DLL CPLString &Recode( const char *pszSrcEncoding, const char *pszDstEncoding );
401  CPLSTRING_METHOD_DLL CPLString &replaceAll(
402  const std::string &osBefore, const std::string& osAfter );
403  CPLSTRING_METHOD_DLL CPLString &replaceAll( const std::string &osBefore, char chAfter );
404  CPLSTRING_METHOD_DLL CPLString &replaceAll( char chBefore, const std::string &osAfter );
405  CPLSTRING_METHOD_DLL CPLString &replaceAll( char chBefore, char chAfter );
406 
407  /* case insensitive find alternates */
408  CPLSTRING_METHOD_DLL size_t ifind( const std::string & str, size_t pos = 0 ) const;
409  CPLSTRING_METHOD_DLL size_t ifind( const char * s, size_t pos = 0 ) const;
410  CPLSTRING_METHOD_DLL CPLString &toupper( void );
411  CPLSTRING_METHOD_DLL CPLString &tolower( void );
412 
413  CPLSTRING_METHOD_DLL bool endsWith( const std::string& osStr ) const;
414 };
415 
416 #undef CPLSTRING_CLASS_DLL
417 #undef CPLSTRING_METHOD_DLL
418 
419 CPLString CPL_DLL CPLOPrintf(CPL_FORMAT_STRING(const char *pszFormat), ... )
420  CPL_PRINT_FUNC_FORMAT (1, 2);
421 CPLString CPL_DLL CPLOvPrintf(
422  CPL_FORMAT_STRING(const char *pszFormat), va_list args)
423  CPL_PRINT_FUNC_FORMAT (1, 0);
424 CPLString CPL_DLL CPLQuotedSQLIdentifier(const char *pszIdent);
425 
426 /* -------------------------------------------------------------------- */
427 /* URL processing functions, here since they depend on CPLString. */
428 /* -------------------------------------------------------------------- */
429 CPLString CPL_DLL CPLURLGetValue(const char* pszURL, const char* pszKey);
430 CPLString CPL_DLL CPLURLAddKVP(const char* pszURL, const char* pszKey,
431  const char* pszValue);
432 
433 /************************************************************************/
434 /* CPLStringList */
435 /************************************************************************/
436 
438 class CPL_DLL CPLStringList
439 {
440  char **papszList = nullptr;
441  mutable int nCount = 0;
442  mutable int nAllocation = 0;
443  bool bOwnList = false;
444  bool bIsSorted = false;
445 
446  void MakeOurOwnCopy();
447  void EnsureAllocation( int nMaxLength );
448  int FindSortedInsertionPoint( const char *pszLine );
449 
450  public:
451  CPLStringList();
452  explicit CPLStringList( char **papszList, int bTakeOwnership=TRUE );
453  explicit CPLStringList( CSLConstList papszList );
454  CPLStringList( const CPLStringList& oOther );
455  ~CPLStringList();
456 
457  CPLStringList &Clear();
458 
460  int size() const { return Count(); }
461  int Count() const;
462 
464  bool empty() const { return Count() == 0; }
465 
466  CPLStringList &AddString( const char *pszNewString );
467  CPLStringList &AddStringDirectly( char *pszNewString );
468 
469  CPLStringList &InsertString( int nInsertAtLineNo, const char *pszNewLine )
470  { return InsertStringDirectly( nInsertAtLineNo, CPLStrdup(pszNewLine) ); }
471  CPLStringList &InsertStringDirectly( int nInsertAtLineNo, char *pszNewLine);
472 
473  // CPLStringList &InsertStrings( int nInsertAtLineNo, char **papszNewLines );
474  // CPLStringList &RemoveStrings( int nFirstLineToDelete, int nNumToRemove=1 );
475 
477  int FindString( const char *pszTarget ) const
478  { return CSLFindString( papszList, pszTarget ); }
480  int PartialFindString( const char *pszNeedle ) const
481  { return CSLPartialFindString( papszList, pszNeedle ); }
482 
483  int FindName( const char *pszName ) const;
484  bool FetchBool( const char *pszKey, bool bDefault ) const;
485  // Deprecated.
486  int FetchBoolean( const char *pszKey, int bDefault ) const;
487  const char *FetchNameValue( const char *pszKey ) const;
488  const char *FetchNameValueDef(
489  const char *pszKey, const char *pszDefault ) const;
490  CPLStringList &AddNameValue( const char *pszKey, const char *pszValue );
491  CPLStringList &SetNameValue( const char *pszKey, const char *pszValue );
492 
493  CPLStringList &Assign( char **papszListIn, int bTakeOwnership=TRUE );
495  CPLStringList &operator=(char **papszListIn) {
496  return Assign( papszListIn, TRUE ); }
498  CPLStringList &operator=(const CPLStringList& oOther);
500  CPLStringList &operator=(CSLConstList papszListIn);
501 
503  char * operator[](int i);
505  char * operator[](size_t i) { return (*this)[static_cast<int>(i)]; }
507  const char * operator[](int i) const;
509  const char * operator[](size_t i) const {
510  return (*this)[static_cast<int>(i)]; }
512  const char * operator[](const char* pszKey) const {
513  return FetchNameValue(pszKey); }
514 
516  char** List() { return papszList; }
518  CSLConstList List() const { return papszList; }
519  char **StealList();
520 
521  CPLStringList &Sort();
523  int IsSorted() const { return bIsSorted; }
524 
526  operator char**(void) { return List(); }
528  operator CSLConstList(void) const { return List(); }
529 };
530 
531 #ifdef GDAL_COMPILATION
532 
533 #include <memory>
534 
536 struct CPL_DLL CSLDestroyReleaser
537 {
538  void operator()(char** papszStr) const { CSLDestroy(papszStr); }
539 };
543 using CSLUniquePtr = std::unique_ptr< char*, CSLDestroyReleaser>;
544 
546 struct CPL_DLL CPLFreeReleaser
547 {
548  void operator()(void* p) const { CPLFree(p); }
549 };
553 using CPLCharUniquePtr = std::unique_ptr<char, CPLFreeReleaser>;
554 
555 #endif
556 
557 } // extern "C++"
558 
559 #endif /* def __cplusplus && !CPL_SUPRESS_CPLUSPLUS */
560 
561 #endif /* CPL_STRING_H_INCLUDED */
CSLLoad2
char ** CSLLoad2(const char *pszFname, int nMaxLines, int nMaxCols, CSLConstList papszOptions)
Definition: cpl_string.cpp:316
CPLStringList::operator=
CPLStringList & operator=(char **papszListIn)
Definition: cpl_string.h:495
CPL_PRINT_FUNC_FORMAT
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Definition: cpl_port.h:914
CPLRecodeFromWChar
char * CPLRecodeFromWChar(const wchar_t *pwszSource, const char *pszSrcEncoding, const char *pszDstEncoding)
Definition: cpl_recode.cpp:149
CSLInsertString
char ** CSLInsertString(char **papszStrList, int nInsertAtLineNo, const char *pszNewLine)
Definition: cpl_string.cpp:562
CPLReadLineL
const char * CPLReadLineL(VSILFILE *)
Definition: cpl_conv.cpp:630
CSLTokenizeString2
char ** CSLTokenizeString2(const char *pszString, const char *pszDelimiter, int nCSLTFlags)
Definition: cpl_string.cpp:836
CSLFindStringCaseSensitive
int CSLFindStringCaseSensitive(CSLConstList papszList, const char *pszTarget)
Definition: cpl_string.cpp:704
GByte
unsigned char GByte
Definition: cpl_port.h:215
CPLString::CPLString
CPLString(const char *pszStr, size_t n)
Definition: cpl_string.h:342
CPLES_CSV
#define CPLES_CSV
Definition: cpl_string.h:175
CPLES_XML_BUT_QUOTES
#define CPLES_XML_BUT_QUOTES
Definition: cpl_string.h:177
cpl_error.h
CPLURLAddKVP
CPLString CPLURLAddKVP(const char *pszURL, const char *pszKey, const char *pszValue)
Definition: cplstring.cpp:455
CSLMerge
char ** CSLMerge(char **papszOrig, CSLConstList papszOverride)
Merge two lists.
Definition: cpl_string.cpp:268
CPLIsUTF8
int CPLIsUTF8(const char *pabyData, int nLen)
Definition: cpl_recode.cpp:251
CPLEscapeString
char * CPLEscapeString(const char *pszString, int nLength, int nScheme)
Definition: cpl_string.cpp:2036
CSLLoad
char ** CSLLoad(const char *pszFname)
Definition: cpl_string.cpp:397
CSLT_PRESERVEESCAPES
#define CSLT_PRESERVEESCAPES
Definition: cpl_string.h:89
CPLOvPrintf
CPLString CPLOvPrintf(const char *pszFormat, va_list args)
Definition: cplstring.cpp:524
CPLStringList::InsertString
CPLStringList & InsertString(int nInsertAtLineNo, const char *pszNewLine)
Insert into the list at identified location.
Definition: cpl_string.h:469
VSI_REALLOC_VERBOSE
#define VSI_REALLOC_VERBOSE(pOldPtr, nNewSize)
Definition: cpl_vsi.h:288
CPLStrlcat
size_t CPLStrlcat(char *pszDest, const char *pszSrc, size_t nDestSize)
Definition: cpl_string.cpp:2761
CSLT_PRESERVEQUOTES
#define CSLT_PRESERVEQUOTES
Definition: cpl_string.h:87
CPLStringList
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:438
CPLCalloc
void * CPLCalloc(size_t, size_t)
Definition: cpl_conv.cpp:138
CSLFindName
int CSLFindName(CSLConstList papszStrList, const char *pszName)
Definition: cpl_string.cpp:1708
VSIRealloc
void * VSIRealloc(void *, size_t)
Definition: cpl_vsisimple.cpp:681
CPLGetValueType
CPLValueType CPLGetValueType(const char *pszValue)
Definition: cpl_string.cpp:2572
CSLT_HONOURSTRINGS
#define CSLT_HONOURSTRINGS
Definition: cpl_string.h:83
cpl_vsi.h
CSLFetchNameValueDef
const char * CSLFetchNameValueDef(CSLConstList papszStrList, const char *pszName, const char *pszDefault)
Definition: cpl_string.cpp:1646
CSLSetNameValue
char ** CSLSetNameValue(char **papszStrList, const char *pszName, const char *pszValue)
Definition: cpl_string.cpp:1877
CPLsnprintf
int CPLsnprintf(char *str, size_t size, const char *fmt,...)
Definition: cpl_string.cpp:1337
CPLES_SQLI
#define CPLES_SQLI
Definition: cpl_string.h:181
CSLAppendPrintf
char ** CSLAppendPrintf(char **papszStrList, const char *fmt,...)
Definition: cpl_string.cpp:1029
CSLCount
int CSLCount(CSLConstList papszStrList)
Definition: cpl_string.cpp:147
CPLStringList::List
CSLConstList List() const
Definition: cpl_string.h:518
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:329
CPLStringList::size
int size() const
Definition: cpl_string.h:460
CPLFetchBool
bool CPLFetchBool(CSLConstList papszStrList, const char *pszKey, bool bDefault)
Definition: cpl_string.cpp:1600
CPL_VALUE_STRING
@ CPL_VALUE_STRING
Definition: cpl_string.h:200
CSLPartialFindString
int CSLPartialFindString(CSLConstList papszHaystack, const char *pszNeedle)
Definition: cpl_string.cpp:737
CPLRealloc
void * CPLRealloc(void *, size_t)
Definition: cpl_conv.cpp:225
CPLStringList::FindString
int FindString(const char *pszTarget) const
Definition: cpl_string.h:477
CPLString::CPLString
CPLString(const std::string &oStr)
Definition: cpl_string.h:337
EQUAL
#define EQUAL(a, b)
Definition: cpl_port.h:569
VSIFCloseL
int VSIFCloseL(VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
Close file.
Definition: cpl_vsil.cpp:1472
CPLES_BackslashQuotable
#define CPLES_BackslashQuotable
Definition: cpl_string.h:167
CPLStringList::AddString
CPLStringList & AddString(const char *pszNewString)
Definition: cplstringlist.cpp:333
CPLES_XML
#define CPLES_XML
Definition: cpl_string.h:169
CSLGetField
const char * CSLGetField(CSLConstList, int)
Definition: cpl_string.cpp:173
CPLString::operator[]
const char & operator[](std::string::size_type i) const
Definition: cpl_string.h:354
CPLAssert
#define CPLAssert(expr)
Definition: cpl_error.h:186
CPL_C_START
#define CPL_C_START
Definition: cpl_port.h:337
CSLTestBoolean
int CSLTestBoolean(const char *pszValue)
Definition: cpl_string.cpp:1553
CPLES_SQL
#define CPLES_SQL
Definition: cpl_string.h:173
VSIFEofL
int VSIFEofL(VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
Test for end of file.
Definition: cpl_vsil.cpp:1850
CPLRecodeToWChar
wchar_t * CPLRecodeToWChar(const char *pszSource, const char *pszSrcEncoding, const char *pszDstEncoding)
Definition: cpl_recode.cpp:208
CPLE_OutOfMemory
#define CPLE_OutOfMemory
Definition: cpl_error.h:101
CSLInsertStrings
char ** CSLInsertStrings(char **papszStrList, int nInsertAtLineNo, CSLConstList papszNewLines)
Definition: cpl_string.cpp:497
CPLTestBool
bool CPLTestBool(const char *pszValue)
Definition: cpl_string.cpp:1526
CPLString::operator[]
char & operator[](int i)
Definition: cpl_string.h:360
CPLprintf
int CPLprintf(const char *fmt,...)
Definition: cpl_string.cpp:1393
CPLString::Seize
void Seize(char *pszValue)
Definition: cpl_string.h:379
CPLString::operator[]
const char & operator[](int i) const
Definition: cpl_string.h:367
CSLConstList
char ** CSLConstList
Definition: cpl_port.h:1194
CPLES_URL
#define CPLES_URL
Definition: cpl_string.h:171
GUIntBig
unsigned long long GUIntBig
Definition: cpl_port.h:251
CPLVASPrintf
int CPLVASPrintf(char **buf, const char *fmt, va_list args)
Definition: cpl_string.cpp:1048
CPLE_OpenFailed
#define CPLE_OpenFailed
Definition: cpl_error.h:105
CPLStringList::operator[]
char * operator[](size_t i)
Definition: cpl_string.h:505
CPLES_CSV_FORCE_QUOTING
#define CPLES_CSV_FORCE_QUOTING
Definition: cpl_string.h:179
CPL_ENC_UTF8
#define CPL_ENC_UTF8
Definition: cpl_string.h:265
CPLBase64Encode
char * CPLBase64Encode(int nBytes, const GByte *pabyData)
Definition: cpl_base64.cpp:199
CPLStrlcpy
size_t CPLStrlcpy(char *pszDest, const char *pszSrc, size_t nDestSize)
Definition: cpl_string.cpp:2704
CPLStringList::empty
bool empty() const
Definition: cpl_string.h:464
CPLString::operator[]
char & operator[](std::string::size_type i)
Definition: cpl_string.h:348
CPL_SCAN_FUNC_FORMAT
#define CPL_SCAN_FUNC_FORMAT(format_idx, arg_idx)
Definition: cpl_port.h:916
CPLURLGetValue
CPLString CPLURLGetValue(const char *pszURL, const char *pszKey)
Definition: cplstring.cpp:422
CPL_C_END
#define CPL_C_END
Definition: cpl_port.h:339
CSLPrint
int CSLPrint(CSLConstList papszStrList, FILE *fpOut)
Definition: cpl_string.cpp:461
CPLDebug
void CPLDebug(const char *, const char *,...)
Definition: cpl_error.cpp:602
VSI_STRDUP_VERBOSE
#define VSI_STRDUP_VERBOSE(pszStr)
Definition: cpl_vsi.h:293
CPLMalloc
void * CPLMalloc(size_t)
Definition: cpl_conv.cpp:168
CPLStringList::List
char ** List()
Definition: cpl_string.h:516
CSLFindString
int CSLFindString(CSLConstList papszList, const char *pszTarget)
Definition: cpl_string.cpp:670
cpl_conv.h
CPL_VALUE_INTEGER
@ CPL_VALUE_INTEGER
Definition: cpl_string.h:202
cpl_string.h
CPLErrorReset
void CPLErrorReset(void)
Definition: cpl_error.cpp:729
VSI_CALLOC_VERBOSE
#define VSI_CALLOC_VERBOSE(nCount, nSize)
Definition: cpl_vsi.h:283
CPLRecode
char * CPLRecode(const char *pszSource, const char *pszSrcEncoding, const char *pszDstEncoding)
Definition: cpl_recode.cpp:81
CPLvsnprintf
int CPLvsnprintf(char *str, size_t size, const char *fmt, va_list args)
Definition: cpl_string.cpp:1140
CPLSPrintf
const char * CPLSPrintf(const char *fmt,...)
Definition: cpl_string.cpp:977
CPLStringList::IsSorted
int IsSorted() const
Definition: cpl_string.h:523
CPLStringList::Assign
CPLStringList & Assign(char **papszListIn, int bTakeOwnership=TRUE)
Definition: cplstringlist.cpp:191
CSLAddNameValue
char ** CSLAddNameValue(char **papszStrList, const char *pszName, const char *pszValue)
Definition: cpl_string.cpp:1838
CSLAddStringMayFail
char ** CSLAddStringMayFail(char **papszStrList, const char *pszNewString)
Definition: cpl_string.cpp:92
CPLStrlenUTF8
int CPLStrlenUTF8(const char *pszUTF8Str)
Definition: cpl_recode.cpp:363
CPLError
void CPLError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt,...)
Definition: cpl_error.cpp:308
CPLStringList::operator[]
const char * operator[](size_t i) const
Definition: cpl_string.h:509
CPLParseNameValue
const char * CPLParseNameValue(const char *pszNameValue, char **ppszKey)
Definition: cpl_string.cpp:1754
VSIFree
void VSIFree(void *)
Definition: cpl_vsisimple.cpp:827
CSLTokenizeStringComplex
char ** CSLTokenizeStringComplex(const char *pszString, const char *pszDelimiter, int bHonourStrings, int bAllowEmptyTokens)
Definition: cpl_string.cpp:769
CPLE_NotSupported
#define CPLE_NotSupported
Definition: cpl_error.h:109
CPLUnescapeString
char * CPLUnescapeString(const char *pszString, int *pnLength, int nScheme)
Definition: cpl_string.cpp:2248
CPLEncodingCharSize
int CPLEncodingCharSize(const char *pszEncoding)
Definition: cpl_recode.cpp:318
end
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Definition: ogrsf_frmts.h:292
CPLStrnlen
size_t CPLStrnlen(const char *pszStr, size_t nMaxLen)
Definition: cpl_string.cpp:2796
CSLSave
int CSLSave(CSLConstList papszStrList, const char *pszFname)
Definition: cpl_string.cpp:412
CSLDuplicate
char ** CSLDuplicate(CSLConstList papszStrList)
Definition: cpl_string.cpp:228
CPLStringList::PartialFindString
int PartialFindString(const char *pszNeedle) const
Definition: cpl_string.h:480
CPL_SCANF_FORMAT_STRING
#define CPL_SCANF_FORMAT_STRING(arg)
Definition: cpl_port.h:931
CSLDestroy
void CSLDestroy(char **papszStrList)
Definition: cpl_string.cpp:200
GIntBig
long long GIntBig
Definition: cpl_port.h:248
CPLString::vPrintf
CPLSTRING_METHOD_DLL CPLString & vPrintf(const char *pszFormat, va_list args)
Definition: cplstring.cpp:76
CPLStringList::Count
int Count() const
Definition: cplstringlist.cpp:218
CPL_VALUE_REAL
@ CPL_VALUE_REAL
Definition: cpl_string.h:201
CPLValueType
CPLValueType
Definition: cpl_string.h:198
CPL_WARN_UNUSED_RESULT
#define CPL_WARN_UNUSED_RESULT
Definition: cpl_port.h:939
CPL_FORMAT_STRING
#define CPL_FORMAT_STRING(arg)
Definition: cpl_port.h:929
CPLString::CPLString
CPLString(const char *pszStr)
Definition: cpl_string.h:340
cpl_port.h
CSLTokenizeString
char ** CSLTokenizeString(const char *pszString)
Definition: cpl_string.cpp:759
EQUALN
#define EQUALN(a, b, n)
Definition: cpl_port.h:567
CPLStringList::StealList
char ** StealList()
Definition: cplstringlist.cpp:489
CSLSetNameValueSeparator
void CSLSetNameValueSeparator(char **papszStrList, const char *pszSeparator)
Definition: cpl_string.cpp:1957
CPLForceToASCII
char * CPLForceToASCII(const char *pabyData, int nLen, char chReplacementChar)
Definition: cpl_recode.cpp:276
CSLFetchNameValueMultiple
char ** CSLFetchNameValueMultiple(CSLConstList papszStrList, const char *pszName)
Definition: cpl_string.cpp:1801
VSIFOpenL
VSILFILE * VSIFOpenL(const char *, const char *)
Open file.
Definition: cpl_vsil.cpp:997
CPLTestBoolean
int CPLTestBoolean(const char *pszValue)
Definition: cpl_string.cpp:1575
CSLFetchNameValue
const char * CSLFetchNameValue(CSLConstList papszStrList, const char *pszName)
Definition: cpl_string.cpp:1674
CSLRemoveStrings
char ** CSLRemoveStrings(char **papszStrList, int nFirstLineToDelete, int nNumToRemove, char ***ppapszRetStrings)
Definition: cpl_string.cpp:588
CSLAddString
char ** CSLAddString(char **papszStrList, const char *pszNewString)
Definition: cpl_string.cpp:83
CPLString::Clear
void Clear()
Definition: cpl_string.h:374
CPLOPrintf
CPLString CPLOPrintf(const char *pszFormat,...)
Definition: cplstring.cpp:505
CPLStrdup
char * CPLStrdup(const char *)
Definition: cpl_conv.cpp:293
CPLAtof
double CPLAtof(const char *)
Definition: cpl_strtod.cpp:117
CPLBinaryToHex
char * CPLBinaryToHex(int nBytes, const GByte *pabyData)
Definition: cpl_string.cpp:2475
CPLReadLine2L
const char * CPLReadLine2L(VSILFILE *, int, CSLConstList)
Definition: cpl_conv.cpp:652
CPLString::CPLString
CPLString(void)
Definition: cpl_string.h:334
CPLStringList::operator[]
const char * operator[](const char *pszKey) const
Definition: cpl_string.h:512
CSLT_ALLOWEMPTYTOKENS
#define CSLT_ALLOWEMPTYTOKENS
Definition: cpl_string.h:85
CSLParseCommandLine
char ** CSLParseCommandLine(const char *pszCommandLine)
Definition: cpl_string.cpp:2820
CPLE_FileIO
#define CPLE_FileIO
Definition: cpl_error.h:103
CPLBase64DecodeInPlace
int CPLBase64DecodeInPlace(GByte *pszBase64)
Definition: cpl_base64.cpp:93
CSLFetchBoolean
int CSLFetchBoolean(CSLConstList papszStrList, const char *pszKey, int bDefault)
Definition: cpl_string.cpp:1635
CSLT_STRIPENDSPACES
#define CSLT_STRIPENDSPACES
Definition: cpl_string.h:93
CPLQuotedSQLIdentifier
CPLString CPLQuotedSQLIdentifier(const char *pszIdent)
Definition: cplstring.cpp:537
CPLFree
#define CPLFree
Definition: cpl_conv.h:81
CSLT_STRIPLEADSPACES
#define CSLT_STRIPLEADSPACES
Definition: cpl_string.h:91
CPL_RETURNS_NONNULL
#define CPL_RETURNS_NONNULL
Definition: cpl_port.h:972
CPLHexToBinary
GByte * CPLHexToBinary(const char *pszHex, int *pnBytes)
Definition: cpl_string.cpp:2533
VSIFPrintfL
int VSIFPrintfL(VSILFILE *, const char *,...) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
Formatted write to file.
Definition: cpl_vsil.cpp:1918
CPLStrtod
double CPLStrtod(const char *, char **)
Definition: cpl_strtod.cpp:321
VSILFILE
FILE VSILFILE
Definition: cpl_vsi.h:156
STARTS_WITH_CI
#define STARTS_WITH_CI(a, b)
Definition: cpl_port.h:580
CPLE_AppDefined
#define CPLE_AppDefined
Definition: cpl_error.h:99

Generated for GDAL by doxygen 1.8.17.