|
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 |
| void | Clear () |
| void | Seize (char *pszValue) |
| CPLSTRING_METHOD_DLL CPLString & | Printf (const char *pszFormat,...) |
| CPLSTRING_METHOD_DLL CPLString & | vPrintf (const char *pszFormat, va_list args) |
| CPLSTRING_METHOD_DLL CPLString & | FormatC (double dfValue, const char *pszFormat=nullptr) |
| CPLSTRING_METHOD_DLL CPLString & | Trim () |
| CPLSTRING_METHOD_DLL CPLString & | Recode (const char *pszSrcEncoding, const char *pszDstEncoding) |
| CPLSTRING_METHOD_DLL CPLString & | replaceAll (const std::string &osBefore, const std::string &osAfter) |
| CPLSTRING_METHOD_DLL CPLString & | replaceAll (const std::string &osBefore, char chAfter) |
| CPLSTRING_METHOD_DLL CPLString & | replaceAll (char chBefore, const std::string &osAfter) |
| CPLSTRING_METHOD_DLL CPLString & | replaceAll (char chBefore, char chAfter) |
| CPLSTRING_METHOD_DLL size_t | ifind (const std::string &str, size_t pos=0) const |
| CPLSTRING_METHOD_DLL size_t | ifind (const char *s, size_t pos=0) const |
| CPLSTRING_METHOD_DLL CPLString & | toupper (void) |
| CPLSTRING_METHOD_DLL CPLString & | tolower (void) |
| CPLSTRING_METHOD_DLL bool | endsWith (const std::string &osStr) const |
Convenient string class based on std::string.
|
inline |
Constructor
|
inline |
Constructor
|
inline |
Constructor
|
inline |
Constructor
|
inline |
Clear the string
| bool CPLString::endsWith | ( | const std::string & | osStr | ) | const |
Returns whether the string ends with another string
| osStr | other string. |
| CPLString & CPLString::FormatC | ( | double | dfValue, |
| const char * | pszFormat = nullptr |
||
| ) |
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()
Referenced by CPLGenerateTempFilename(), CPLQuotedSQLIdentifier(), OGRSimpleCurve::exportToWkt(), CPLODBCSession::Failed(), CPLODBCStatement::GetTypeName(), GOA2GetAuthorizationURL(), GOA2GetRefreshToken(), OGRSpatialReference::importFromEPSGA(), OGRSpatialReference::SetAuthority(), and OGRSpatialReference::SetTOWGS84().
| 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(), and VSIFPrintfL().
1.8.14.