OGR
|
Convenient string class based on std::string. More...
#include <cpl_string.h>
Public Member Functions | |
CPLString (void) | |
CPLString (const std::string &oStr) | |
CPLString (const char *pszStr) | |
CPLString (const char *pszStr, size_t n) | |
operator const char * (void) const | |
char & | operator[] (std::string::size_type i) |
const char & | operator[] (std::string::size_type i) const |
char & | operator[] (int i) |
const char & | operator[] (int i) const |
const char & | back () const |
char & | back () |
void | Clear () |
void | Seize (char *pszValue) |
CPLString & | Printf (const char *pszFormat,...) |
CPLString & | vPrintf (const char *pszFormat, va_list args) |
CPLString & | FormatC (double dfValue, const char *pszFormat=NULL) |
CPLString & | Trim () |
CPLString & | Recode (const char *pszSrcEncoding, const char *pszDstEncoding) |
CPLString & | replaceAll (const std::string &osBefore, const std::string &osAfter) |
CPLString & | replaceAll (const std::string &osBefore, char chAfter) |
CPLString & | replaceAll (char chBefore, const std::string &osAfter) |
CPLString & | replaceAll (char chBefore, char chAfter) |
size_t | ifind (const std::string &str, size_t pos=0) const |
size_t | ifind (const char *s, size_t pos=0) const |
CPLString & | toupper (void) |
CPLString & | tolower (void) |
Convenient string class based on std::string.
|
inline |
Constructor
|
inline |
Constructor
|
inline |
Constructor
|
inline |
Constructor
|
inline |
Return last character (undefined behaviour if string is empty)
Referenced by CPLURLAddKVP().
|
inline |
Return last character (undefined behaviour if string is empty)
|
inline |
Clear the string
CPLString & CPLString::FormatC | ( | double | dfValue, |
const char * | pszFormat = NULL |
||
) |
Format double in C locale.
The passed value is formatted using the C locale (period as decimal separator) and appended to the target CPLString.
dfValue | the value to format. |
pszFormat | the sprintf() style format to use or omit for default. Note that this format string should only include one substitution argument and it must be for a double (f or g). |
References CPLsnprintf().
size_t CPLString::ifind | ( | const std::string & | str, |
size_t | pos = 0 |
||
) | const |
Case insensitive find() alternative.
str | substring to find. |
pos | offset in the string at which the search starts. |
Referenced by CPLURLAddKVP(), and CPLURLGetValue().
size_t CPLString::ifind | ( | const char * | s, |
size_t | nPos = 0 |
||
) | const |
|
inline |
Return string as zero terminated character array
|
inline |
Return character at specified index
|
inline |
Return character at specified index
|
inline |
Return character at specified index
|
inline |
Return character at specified index
CPLString & CPLString::Printf | ( | const char * | pszFormat, |
... | |||
) |
Assign the content of the string using sprintf()
References vPrintf().
Referenced by CPLGenerateTempFilename(), OGRSimpleCurve::exportToWkt(), CPLODBCStatement::GetTypeName(), GOA2GetAccessToken(), GOA2GetAuthorizationURL(), GOA2GetRefreshToken(), and OGRSpatialReference::SetVertCS().
CPLString & CPLString::Recode | ( | const char * | pszSrcEncoding, |
const char * | pszDstEncoding | ||
) |
Recode the string
References CPL_ENC_UTF8, CPLFree, and CPLRecode().
CPLString & CPLString::replaceAll | ( | const std::string & | osBefore, |
const std::string & | osAfter | ||
) |
Replace all occurrences of osBefore with osAfter.
Referenced by replaceAll().
CPLString & CPLString::replaceAll | ( | const std::string & | osBefore, |
char | chAfter | ||
) |
Replace all occurrences of osBefore with chAfter.
References replaceAll().
CPLString & CPLString::replaceAll | ( | char | chBefore, |
const std::string & | osAfter | ||
) |
Replace all occurrences of chBefore with osAfter.
References replaceAll().
CPLString & CPLString::replaceAll | ( | char | chBefore, |
char | chAfter | ||
) |
Replace all occurrences of chBefore with chAfter.
References replaceAll().
|
inline |
Assign specified string and take ownership of it (assumed to be allocated with CPLMalloc()). NULL can be safely passed to clear the string.
References CPLFree.
Referenced by GOA2GetAuthorizationURL(), and GOA2GetRefreshToken().
CPLString & CPLString::toupper | ( | void | ) |
Convert to upper case in place.
CPLString & CPLString::Trim | ( | ) |
Trim white space.
Trims white space off the let and right of the string. White space is any of a space, a tab, a newline ('\n') or a carriage control ('\r').
CPLString & CPLString::vPrintf | ( | const char * | pszFormat, |
va_list | args | ||
) |
Assign the content of the string using vsprintf()
References CPLError(), CPLMalloc(), and CPLvsnprintf().
Referenced by CPLOPrintf(), CPLOvPrintf(), CPLVASPrintf(), CSLAppendPrintf(), Printf(), and VSIFPrintfL().