15#ifndef CPL_STRING_H_INCLUDED
16#define CPL_STRING_H_INCLUDED
55void CPL_DLL CPL_STDCALL
CSLDestroy(
char **papszStrList);
57char CPL_DLL **
CSLMerge(
char **papszOrig,
66 const char *pszDelimiter,
70#define CSLT_HONOURSTRINGS 0x0001
72#define CSLT_ALLOWEMPTYTOKENS 0x0002
74#define CSLT_PRESERVEQUOTES 0x0004
76#define CSLT_PRESERVEESCAPES 0x0008
78#define CSLT_STRIPLEADSPACES 0x0010
80#define CSLT_STRIPENDSPACES 0x0020
84char CPL_DLL **
CSLLoad2(
const char *pszFname,
int nMaxLines,
int nMaxCols,
94CSLRemoveStrings(
char **papszStrList,
int nFirstLineToDelete,
int nNumToRemove,
98 const char *pszTarget);
100 const char *pszNeedle);
115 bool *pbUnitSpecified);
119 char **ppszKey,
char chSep);
122 const char *pszName);
125 const char *pszDefault);
127 const char *pszName);
128char CPL_DLL **
CSLAddNameValue(
char **papszStrList,
const char *pszName,
130char CPL_DLL **
CSLSetNameValue(
char **papszStrList,
const char *pszName,
133 const char *pszSeparator);
138#define CPLES_BackslashQuotable 0
149#define CPLES_XML_BUT_QUOTES 5
151#define CPLES_CSV_FORCE_QUOTING 6
182size_t CPL_DLL
CPLStrlcpy(
char *pszDest,
const char *pszSrc,
size_t nDestSize);
183size_t CPL_DLL
CPLStrlcat(
char *pszDest,
const char *pszSrc,
size_t nDestSize);
184size_t CPL_DLL
CPLStrnlen(
const char *pszStr,
size_t nMaxLen);
195#if defined(ALIAS_CPLSNPRINTF_AS_SNPRINTF)
196#define CPLsnprintf snprintf
204#if defined(GDAL_COMPILATION) && !defined(DONT_DEPRECATE_SPRINTF)
224char CPL_DLL **CSLAppendPrintf(
char **papszStrList,
234#define CPL_ENC_LOCALE ""
236#define CPL_ENC_UTF8 "UTF-8"
238#define CPL_ENC_UTF16 "UTF-16"
240#define CPL_ENC_UCS2 "UCS-2"
242#define CPL_ENC_UCS4 "UCS-4"
244#define CPL_ENC_ASCII "ASCII"
246#define CPL_ENC_ISO8859_1 "ISO-8859-1"
250void CPL_DLL CPLClearRecodeWarningFlags(
void);
252char CPL_DLL *
CPLRecode(
const char *pszSource,
const char *pszSrcEncoding,
253 const char *pszDstEncoding)
261int CPL_DLL
CPLIsUTF8(
const char *pabyData,
int nLen);
262bool CPL_DLL
CPLIsASCII(
const char *pabyData,
size_t nLen);
269 CPL_WARN_DEPRECATED(
"Use CPLStrlenUTF8Ex() instead")
273int CPL_DLL
CPLCanRecode(
const char *pszTestStr,
const char *pszSrcEncoding,
277#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
290#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
309#define CPLSTRING_CLASS_DLL
310#define CPLSTRING_METHOD_DLL CPL_DLL
313#define CPLSTRING_CLASS_DLL CPL_DLL
314#define CPLSTRING_METHOD_DLL
319 class CPLSTRING_CLASS_DLL
CPLString :
public std::string
340 CPLString(
const char *pszStr,
size_t n) : std::string(pszStr, n)
345 operator const char *(void)
const
353 return std::string::operator[](i);
359 return std::string::operator[](i);
365 return std::string::operator[](
366 static_cast<std::string::size_type
>(i));
372 return std::string::operator[](
373 static_cast<std::string::size_type
>(i));
387 if (pszValue ==
nullptr)
405 FormatC(
double dfValue, const
char *pszFormat =
nullptr);
407 CPLSTRING_METHOD_DLL
CPLString &Recode(const
char *pszSrcEncoding,
408 const
char *pszDstEncoding);
409 CPLSTRING_METHOD_DLL
CPLString &replaceAll(const std::
string &osBefore,
410 const std::
string &osAfter);
411 CPLSTRING_METHOD_DLL
CPLString &replaceAll(const std::
string &osBefore,
413 CPLSTRING_METHOD_DLL
CPLString &replaceAll(
char chBefore,
414 const std::
string &osAfter);
415 CPLSTRING_METHOD_DLL
CPLString &replaceAll(
char chBefore,
char chAfter);
418 CPLSTRING_METHOD_DLL
size_t ifind(const std::
string &str,
419 size_t pos = 0) const;
420 CPLSTRING_METHOD_DLL
size_t ifind(const
char *s,
size_t pos = 0) const;
421 CPLSTRING_METHOD_DLL
CPLString &toupper(
void);
422 CPLSTRING_METHOD_DLL
CPLString &tolower(
void);
424 CPLSTRING_METHOD_DLL
bool endsWith(const std::
string &osStr) const;
426 CPLSTRING_METHOD_DLL
CPLString URLEncode() const;
429 operator
void *(
void) = delete;
432#undef CPLSTRING_CLASS_DLL
433#undef CPLSTRING_METHOD_DLL
446 const
char *pszValue);
453 class CPL_DLL CPLStringList
455 char **papszList =
nullptr;
456 mutable int nCount = 0;
457 mutable int nAllocation = 0;
458 bool bOwnList =
false;
459 bool bIsSorted =
false;
461 bool MakeOurOwnCopy();
462 bool EnsureAllocation(
int nMaxLength);
463 int FindSortedInsertionPoint(
const char *pszLine);
467 explicit CPLStringList(
char **papszList,
int bTakeOwnership = TRUE);
469 explicit CPLStringList(
const std::vector<std::string> &aosList);
470 explicit CPLStringList(std::initializer_list<const char *> oInitList);
471 CPLStringList(
const CPLStringList &oOther);
472 CPLStringList(CPLStringList &&oOther);
477 CPLStringList &
Clear();
515 CPLStringList &
InsertString(
int nInsertAtLineNo,
const char *pszNewLine)
540 int FindName(
const char *pszName)
const;
541 bool FetchBool(
const char *pszKey,
bool bDefault)
const;
543 int FetchBoolean(
const char *pszKey,
int bDefault)
const;
544 const char *FetchNameValue(
const char *pszKey)
const;
545 const char *FetchNameValueDef(
const char *pszKey,
546 const char *pszDefault)
const;
547 CPLStringList &AddNameValue(
const char *pszKey,
const char *pszValue);
548 CPLStringList &SetNameValue(
const char *pszKey,
const char *pszValue);
550 CPLStringList &Assign(
char **papszListIn,
int bTakeOwnership = TRUE);
555 return Assign(papszListIn, TRUE);
563 CPLStringList &
operator=(CPLStringList &&oOther);
571 return (*
this)[
static_cast<int>(i)];
575 const char *operator[](
int i)
const;
580 return (*
this)[
static_cast<int>(i)];
596 inline const char *
back()
const
598 return papszList[
size() - 1];
604 return papszList ? &papszList[0] :
nullptr;
608 const char *
const *
end()
const
610 return papszList ? &papszList[
size()] :
nullptr;
636 operator char **(void)
648 operator std::vector<std::string>(
void)
const
650 return std::vector<std::string>{
begin(),
end()};
654 operator void *(void) =
delete;
657#ifdef GDAL_COMPILATION
661#include <string_view>
665 struct CPL_DLL CSLDestroyReleaser
667 void operator()(
char **papszStr)
const
669 CSLDestroy(papszStr);
676 using CSLUniquePtr = std::unique_ptr<char *, CSLDestroyReleaser>;
680 using CPLCharUniquePtr = std::unique_ptr<char, VSIFreeReleaser>;
688 template <
class StringType>
689 inline bool starts_with(
const StringType &str,
const char *prefix)
691 const size_t prefixLen = strlen(prefix);
692 return str.size() >= prefixLen &&
693 str.compare(0, prefixLen, prefix, prefixLen) == 0;
697 template <
class StringType>
698 inline bool starts_with(
const StringType &str,
const std::string &prefix)
700 return str.size() >= prefix.size() &&
701 str.compare(0, prefix.size(), prefix) == 0;
705 template <
class StringType>
706 inline bool starts_with(
const StringType &str, std::string_view prefix)
708 return str.size() >= prefix.size() &&
709 str.compare(0, prefix.size(), prefix) == 0;
713 template <
class StringType>
714 inline bool ends_with(
const StringType &str,
const char *suffix)
716 const size_t suffixLen = strlen(suffix);
717 return str.size() >= suffixLen &&
718 str.compare(str.size() - suffixLen, suffixLen, suffix,
723 template <
class StringType>
724 inline bool ends_with(
const StringType &str,
const std::string &suffix)
726 return str.size() >= suffix.size() &&
727 str.compare(str.size() - suffix.size(), suffix.size(), suffix) ==
732 template <
class StringType>
733 inline bool ends_with(
const StringType &str, std::string_view suffix)
735 return str.size() >= suffix.size() &&
736 str.compare(str.size() - suffix.size(), suffix.size(), suffix) ==
741 struct CPL_DLL CSLIterator
743 using iterator_category = std::input_iterator_tag;
744 using difference_type = std::ptrdiff_t;
745 using value_type =
const char *;
746 using pointer = value_type *;
747 using reference = value_type &;
750 bool m_bAtEnd =
false;
752 inline const char *operator*()
const
757 inline CSLIterator &operator++()
764 bool operator==(
const CSLIterator &other)
const;
766 inline bool operator!=(
const CSLIterator &other)
const
768 return !(operator==(other));
778 struct CPL_DLL CSLIteratorWrapper
782 inline explicit CSLIteratorWrapper(
CSLConstList papszList)
783 : m_papszList(papszList)
788 inline CSLIterator
begin()
const
790 return {m_papszList,
false};
794 inline CSLIterator
end()
const
796 return {m_papszList,
true};
807 inline CSLIteratorWrapper Iterate(
CSLConstList papszList)
809 return CSLIteratorWrapper{papszList};
813 inline CSLIteratorWrapper Iterate(
const CPLStringList &aosList)
815 return Iterate(aosList.
List());
821 inline CSLIteratorWrapper Iterate(
char **) =
delete;
827 struct CPL_DLL CSLNameValueIterator
829 using iterator_category = std::input_iterator_tag;
830 using difference_type = std::ptrdiff_t;
831 using value_type = std::pair<const char *, const char *>;
832 using pointer = value_type *;
833 using reference = value_type &;
836 bool m_bReturnNullKeyIfNotNameValue =
false;
837 std::string m_osKey{};
839 value_type operator*();
841 inline CSLNameValueIterator &operator++()
848 inline bool operator==(
const CSLNameValueIterator &other)
const
850 return m_papszList == other.m_papszList;
853 inline bool operator!=(
const CSLNameValueIterator &other)
const
855 return !(operator==(other));
872 struct CPL_DLL CSLNameValueIteratorWrapper
876 inline explicit CSLNameValueIteratorWrapper(
877 CSLConstList papszList,
bool bReturnNullKeyIfNotNameValue)
878 : m_papszList(papszList),
879 m_bReturnNullKeyIfNotNameValue(bReturnNullKeyIfNotNameValue)
884 inline CSLNameValueIterator
begin()
const
886 return {m_papszList, m_bReturnNullKeyIfNotNameValue};
890 CSLNameValueIterator
end()
const;
894 const bool m_bReturnNullKeyIfNotNameValue;
913 inline CSLNameValueIteratorWrapper
915 bool bReturnNullKeyIfNotNameValue =
false)
917 return CSLNameValueIteratorWrapper{papszList,
918 bReturnNullKeyIfNotNameValue};
922 inline CSLNameValueIteratorWrapper
923 IterateNameValue(
const CPLStringList &aosList,
924 bool bReturnNullKeyIfNotNameValue =
false)
926 return IterateNameValue(aosList.
List(), bReturnNullKeyIfNotNameValue);
932 inline CSLIteratorWrapper IterateNameValue(
char **,
bool =
false) =
delete;
937 inline std::vector<std::string> ToVector(
CSLConstList papszList)
942 inline std::vector<std::string> ToVector(
char **) =
delete;
String list class designed around our use of C "char**" string lists.
Definition cpl_string.h:454
CPLStringList & Assign(char **papszListIn, int bTakeOwnership=TRUE)
Assign a list of strings.
Definition cplstringlist.cpp:272
const char * operator[](size_t i) const
Return string at specified index.
Definition cpl_string.h:578
const char * operator[](const char *pszKey) const
Return value corresponding to pszKey, or nullptr.
Definition cpl_string.h:584
int IsSorted() const
Returns whether the list is sorted.
Definition cpl_string.h:630
bool empty() const
Return whether the list is empty.
Definition cpl_string.h:494
const char *const * end() const
end() implementation
Definition cpl_string.h:608
CPLStringList & operator=(CSLConstList papszListIn)
Assignment operator.
void push_back(const std::string &osStr)
Add a string to the list.
Definition cpl_string.h:510
CPLStringList & InsertString(int nInsertAtLineNo, const char *pszNewLine)
Insert into the list at identified location.
Definition cpl_string.h:515
char ** List()
Return list.
Definition cpl_string.h:614
void clear()
Clear the list.
Definition cpl_string.h:480
void push_back(const char *pszNewString)
Add a string to the list.
Definition cpl_string.h:504
int Count() const
Definition cplstringlist.cpp:299
CPLStringList & operator=(char **papszListIn)
Assignment operator.
Definition cpl_string.h:553
CPLStringList & InsertStringDirectly(int nInsertAtLineNo, char *pszNewLine)
Insert into the list at identified location.
Definition cplstringlist.cpp:919
char * operator[](int i)
Return string at specified index.
Definition cplstringlist.cpp:608
char * operator[](size_t i)
Return string at specified index.
Definition cpl_string.h:569
const char * FetchNameValue(const char *pszKey) const
Fetch value associated with this key name.
Definition cplstringlist.cpp:843
int size() const
Return size of list.
Definition cpl_string.h:486
CSLConstList List() const
Return list.
Definition cpl_string.h:620
const char * front() const
Return first element.
Definition cpl_string.h:590
CPLStringList & Clear()
Clear the string list.
Definition cplstringlist.cpp:241
const char *const * begin() const
begin() implementation
Definition cpl_string.h:602
int FindString(const char *pszTarget) const
Return index of pszTarget in the list, or -1.
Definition cpl_string.h:528
const char * back() const
Return last element.
Definition cpl_string.h:596
static const CPLStringList BoundToConstList(CSLConstList papszList)
Return a CPLStringList that wraps the passed list.
Definition cplstringlist.cpp:158
int PartialFindString(const char *pszNeedle) const
Return index of pszTarget in the list (using partial search), or -1.
Definition cpl_string.h:535
CPLStringList & AddString(const char *pszNewString)
Add a string to the list.
Definition cplstringlist.cpp:445
Convenient string class based on std::string.
Definition cpl_string.h:320
void Clear()
Clear the string.
Definition cpl_string.h:377
CPLString(void)
Constructor.
Definition cpl_string.h:323
const char & operator[](std::string::size_type i) const
Return character at specified index.
Definition cpl_string.h:357
CPLString(const std::string &oStr)
Constructor.
Definition cpl_string.h:329
void Seize(char *pszValue)
Assign specified string and take ownership of it (assumed to be allocated with CPLMalloc()).
Definition cpl_string.h:385
char & operator[](int i)
Return character at specified index.
Definition cpl_string.h:363
const char & operator[](int i) const
Return character at specified index.
Definition cpl_string.h:370
char & operator[](std::string::size_type i)
Return character at specified index.
Definition cpl_string.h:351
CPLString(const char *pszStr, size_t n)
Constructor.
Definition cpl_string.h:340
CPLString(const char *pszStr)
Constructor.
Definition cpl_string.h:335
Various convenience functions for CPL.
#define CPLFree
Alias of VSIFree().
Definition cpl_conv.h:90
CPL error handling services.
CPLErr
Error category.
Definition cpl_error.h:37
#define CPL_SCAN_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have scanf() formatting.
Definition cpl_port.h:846
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:289
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:285
#define CPL_FORMAT_STRING(arg)
Macro into which to wrap the format argument of a printf-like function.
Definition cpl_port.h:860
#define CPL_RETURNS_NONNULL
Qualifier for a function that does not return NULL.
Definition cpl_port.h:908
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
Tag a function to have printf() formatting.
Definition cpl_port.h:844
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1087
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition cpl_port.h:870
#define CPL_SCANF_FORMAT_STRING(arg)
Macro into which to wrap the format argument of a sscanf-like function.
Definition cpl_port.h:862
unsigned char GByte
Unsigned byte type.
Definition cpl_port.h:175
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:205
int CSLFindStringCaseSensitive(CSLConstList papszList, const char *pszTarget)
Find a string within a string list(case sensitive).
Definition cpl_string.cpp:687
int CPLvsnprintf(char *str, size_t size, const char *fmt, va_list args)
vsnprintf() wrapper that is not sensitive to LC_NUMERIC settings.
Definition cpl_string.cpp:1128
char * CPLEscapeString(const char *pszString, int nLength, int nScheme)
Apply escaping to string to preserve special characters.
Definition cpl_string.cpp:2215
char * CPLBinaryToHex(int nBytes, const GByte *pabyData)
Binary to hexadecimal translation.
Definition cpl_string.cpp:2789
std::string CPLRemoveSQLComments(const std::string &osInput)
Remove SQL comments from a string.
Definition cpl_string.cpp:3181
char ** CSLTokenizeStringComplex(const char *pszString, const char *pszDelimiter, int bHonourStrings, int bAllowEmptyTokens)
Obsolete tokenizing api.
Definition cpl_string.cpp:750
int CPLprintf(const char *fmt,...)
sprintf() wrapper that is not sensitive to LC_NUMERIC settings.
Definition cpl_string.cpp:1400
int CPLBase64DecodeInPlace(GByte *pszBase64)
Decode base64 string "pszBase64" (null terminated) in place.
Definition cpl_base64.cpp:90
char ** CSLAddNameValue(char **papszStrList, const char *pszName, const char *pszValue)
Add a new entry to a StringList of "Name=Value" pairs, ("Name:Value" pairs are also supported for bac...
Definition cpl_string.cpp:2016
size_t CPLStrlenUTF8Ex(const char *pszUTF8Str)
Return the number of UTF-8 characters of a nul-terminated string.
Definition cpl_recode.cpp:1198
CPLString CPLQuotedSQLIdentifier(const char *pszIdent)
Return a CPLString of the SQL quoted identifier.
Definition cplstring.cpp:571
CPLString CPLOPrintf(const char *pszFormat,...)
Return a CPLString with the content of sprintf().
Definition cplstring.cpp:539
size_t CPLStrlcat(char *pszDest, const char *pszSrc, size_t nDestSize)
Appends a source string to a destination buffer.
Definition cpl_string.cpp:3080
int CSLPrint(CSLConstList papszStrList, FILE *fpOut)
Print a StringList to fpOut.
Definition cpl_string.cpp:445
char * CPLForceToASCII(const char *pabyData, int nLen, char chReplacementChar)
Return a new string that is made only of ASCII characters.
Definition cpl_recode.cpp:296
char ** CSLTokenizeString2(const char *pszString, const char *pszDelimiter, int nCSLTFlags)
Tokenize a string.
Definition cpl_string.cpp:817
CPLString CPLURLGetValue(const char *pszURL, const char *pszKey)
Return the value matching a key from a key=value pair in a URL.
Definition cplstring.cpp:458
size_t CPLStrlcpy(char *pszDest, const char *pszSrc, size_t nDestSize)
Copy source string to a destination buffer.
Definition cpl_string.cpp:3024
const char * CSLFetchNameValue(CSLConstList papszStrList, const char *pszName)
In a StringList of "Name=Value" pairs, look for the first value associated with the specified name.
Definition cpl_string.cpp:1678
char * CPLRecodeFromWChar(const wchar_t *pwszSource, const char *pszSrcEncoding, const char *pszDstEncoding)
Convert wchar_t string to UTF-8.
Definition cpl_recode.cpp:163
int CPLsnprintf(char *str, size_t size, const char *fmt,...)
snprintf() wrapper that is not sensitive to LC_NUMERIC settings.
Definition cpl_string.cpp:1347
bool CPLIsASCII(const char *pabyData, size_t nLen)
Test if a string is encoded as ASCII.
Definition cpl_recode.cpp:260
CPLValueType
Type of value.
Definition cpl_string.h:171
@ CPL_VALUE_INTEGER
Integer.
Definition cpl_string.h:174
@ CPL_VALUE_STRING
String.
Definition cpl_string.h:172
@ CPL_VALUE_REAL
Real number.
Definition cpl_string.h:173
void CSLDestroy(char **papszStrList)
Free string list.
Definition cpl_string.cpp:185
bool CPLFetchBool(CSLConstList papszStrList, const char *pszKey, bool bDefault)
Check for boolean key value.
Definition cpl_string.cpp:1607
int CSLFindName(CSLConstList papszStrList, const char *pszName)
Find StringList entry with given key name.
Definition cpl_string.cpp:1710
CPLErr CPLParseMemorySize(const char *pszValue, GIntBig *pnValue, bool *pbUnitSpecified)
Parse a memory size from a string.
Definition cpl_string.cpp:1751
const char * CPLParseNameValueSep(const char *pszNameValue, char **ppszKey, char chSep)
Parse NAME<Sep>VALUE string into name and value components.
Definition cpl_string.cpp:1933
int CPLTolower(int c)
Converts a (ASCII) uppercase character to lowercase.
Definition cpl_string.cpp:3167
int CPLCanRecode(const char *pszTestStr, const char *pszSrcEncoding, const char *pszDstEncoding)
Checks if it is possible to recode a string from one encoding to another.
Definition cpl_recode.cpp:1226
const char * CSLGetField(CSLConstList, int)
Fetches the indicated field, being careful not to crash if the field doesn't exist within this string...
Definition cpl_string.cpp:158
int CSLFindString(CSLConstList papszList, const char *pszTarget)
Find a string within a string list (case insensitive).
Definition cpl_string.cpp:654
int CSLSave(CSLConstList papszStrList, const char *pszFname)
Write a StringList to a text file.
Definition cpl_string.cpp:396
bool CPLTestBool(const char *pszValue)
Test what boolean value contained in the string.
Definition cpl_string.cpp:1535
char ** CSLParseCommandLine(const char *pszCommandLine)
Tokenize command line arguments in a list of strings.
Definition cpl_string.cpp:3137
const char * CSLFetchNameValueDef(CSLConstList papszStrList, const char *pszName, const char *pszDefault)
Same as CSLFetchNameValue() but return pszDefault in case of no match.
Definition cpl_string.cpp:1651
int CSLCount(CSLConstList papszStrList)
Return number of items in a string list.
Definition cpl_string.cpp:132
char ** CSLAddString(char **papszStrList, const char *pszNewString)
Append a string to a StringList and return a pointer to the modified StringList.
Definition cpl_string.cpp:68
size_t CPLStrnlen(const char *pszStr, size_t nMaxLen)
Returns the length of a NUL terminated string by reading at most the specified number of bytes.
Definition cpl_string.cpp:3114
char * CPLUTF8ForceToASCII(const char *pszStr, char chReplacementChar)
Return a new string that is made only of ASCII characters.
Definition cpl_recode.cpp:347
char ** CSLInsertString(char **papszStrList, int nInsertAtLineNo, const char *pszNewLine)
Insert a string at a given line number inside a StringList.
Definition cpl_string.cpp:546
void CSLSetNameValueSeparator(char **papszStrList, const char *pszSeparator)
Replace the default separator (":" or "=") with the passed separator in the given name/value list.
Definition cpl_string.cpp:2136
int CPLIsUTF8(const char *pabyData, int nLen)
Test if a string is encoded as UTF-8.
Definition cpl_recode_stub.cpp:500
int CSLPartialFindString(CSLConstList papszHaystack, const char *pszNeedle)
Find a substring within a string list.
Definition cpl_string.cpp:719
char ** CSLTokenizeString(const char *pszString)
Tokenizes a string and returns a StringList with one string for each token.
Definition cpl_string.cpp:740
char ** CSLFetchNameValueMultiple(CSLConstList papszStrList, const char *pszName)
In a StringList of "Name=Value" pairs, look for all the values with the specified name.
Definition cpl_string.cpp:1981
CPLValueType CPLGetValueType(const char *pszValue)
Detect the type of the value contained in a string, whether it is a real, an integer or a string Lead...
Definition cpl_string.cpp:2889
char ** CSLSetNameValue(char **papszStrList, const char *pszName, const char *pszValue)
Assign value to name in StringList.
Definition cpl_string.cpp:2055
char ** CSLRemoveStrings(char **papszStrList, int nFirstLineToDelete, int nNumToRemove, char ***ppapszRetStrings)
Remove strings inside a StringList.
Definition cpl_string.cpp:572
char ** CSLLoad(const char *pszFname)
Load a text file into a string list.
Definition cpl_string.cpp:381
char * CPLRecode(const char *pszSource, const char *pszSrcEncoding, const char *pszDstEncoding)
Convert a string from a source encoding to a destination encoding.
Definition cpl_recode.cpp:79
char ** CSLLoad2(const char *pszFname, int nMaxLines, int nMaxCols, CSLConstList papszOptions)
Load a text file into a string list.
Definition cpl_string.cpp:305
CPLString CPLURLAddKVP(const char *pszURL, const char *pszKey, const char *pszValue)
Return a new URL with a new key=value pair.
Definition cplstring.cpp:490
int CSLFetchBoolean(CSLConstList papszStrList, const char *pszKey, int bDefault)
DEPRECATED.
Definition cpl_string.cpp:1640
int CPLStrlenUTF8(const char *pszUTF8Str)
Return the number of UTF-8 characters of a nul-terminated string.
Definition cpl_recode.cpp:1164
char ** CSLInsertStrings(char **papszStrList, int nInsertAtLineNo, CSLConstList papszNewLines)
Copies the contents of a StringList inside another StringList before the specified line.
Definition cpl_string.cpp:481
CPLString CPLOvPrintf(const char *pszFormat, va_list args)
Return a CPLString with the content of vsprintf().
Definition cplstring.cpp:558
char ** CSLDuplicate(CSLConstList papszStrList)
Clone a string list.
Definition cpl_string.cpp:213
const char * CPLParseNameValue(const char *pszNameValue, char **ppszKey)
Parse NAME=VALUE string into name and value components.
Definition cpl_string.cpp:1886
int CSLTestBoolean(const char *pszValue)
Test what boolean value contained in the string.
Definition cpl_string.cpp:1560
int CPLToupper(int c)
Converts a (ASCII) lowercase character to uppercase.
Definition cpl_string.cpp:3152
GByte * CPLHexToBinary(const char *pszHex, int *pnBytes)
Hexadecimal to binary translation.
Definition cpl_string.cpp:2850
char ** CSLMerge(char **papszOrig, CSLConstList papszOverride)
Merge two lists.
Definition cpl_string.cpp:258
char ** CSLAddStringMayFail(char **papszStrList, const char *pszNewString)
Same as CSLAddString() but may return NULL in case of (memory) failure.
Definition cpl_string.cpp:77
int CPLEncodingCharSize(const char *pszEncoding)
Return bytes per character for encoding.
Definition cpl_recode.cpp:1118
char * CPLUnescapeString(const char *pszString, int *pnLength, int nScheme)
Unescape a string.
Definition cpl_string.cpp:2565
char * CPLBase64Encode(int nBytes, const GByte *pabyData)
Base64 encode a buffer.
Definition cpl_base64.cpp:196
int CPLTestBoolean(const char *pszValue)
Test what boolean value contained in the string.
Definition cpl_string.cpp:1582
wchar_t * CPLRecodeToWChar(const char *pszSource, const char *pszSrcEncoding, const char *pszDstEncoding)
Convert UTF-8 string to a wchar_t string.
Definition cpl_recode.cpp:219
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition ogrsf_frmts.h:470
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition ogrsf_frmts.h:478