#include<kstring.h>Definition at line97of filekstring.h.
Padding | |
| enum | PaddingType |
| Padding types.More... | |
| KString | Pad(PaddingTypepPadding, size_t pLen, char pCar= ' ') const |
| Add padding characters. | |
| KString | UnPad(PaddingTypepPadding) const |
| Remove padding characters. | |
Constructors and Destructor | |
| staticKString* | Create() |
| Create an instance. | |
| staticKString* | Create(KString*pString) |
| Create an instance if not already allocated ( is null ). | |
| staticKString* | DestroyIfEmpty(KString*pString) |
| Destroy the allocated space if empty. | |
| staticKString* | StringOrEmpty(KString*pString) |
| Return the passed pString if it is not empty, or a local static emptyKStringwill be returned. | |
| void | Destroy() |
| Destroy an allocated version of the string. | |
Memory Pool Management | |
| static KMemoryAllocator * | AllocatorGet() |
| Get new memory allocator. | |
| static void | AllocatorPurge() |
| Purge memory allocator. | |
| static void | AllocatorRelease() |
| Release memory allocator. | |
Constructors and Destructor | |
| KString() | |
| Default constructor. | |
| KString(constKString&pStr) | |
| Copy constructor. | |
| KString(const char *pStr) | |
| String constructor. | |
| KString(char pChar, size_t pNbRepeat=1) | |
| Character constructor. | |
| KString(const char *pCharPtr, size_t pLength) | |
| String constructor with maximum length. | |
| KString(const int pValue) | |
| Int constructor. | |
| KString(const float pValue) | |
| Float constructor. | |
| KString(const double pValue) | |
| Double constructor. | |
| ~KString() | |
| Destructor. | |
Instance Validation. | |
| bool | IsOK() const |
Returntrueif string is valid. | |
| KString& | Invalidate() |
| Invalidate string. | |
| size_t | GetLen() const |
| Get string length like "C" strlen(). | |
| bool | IsEmpty() const |
Returntrueif string is of length 0. | |
| KString& | Empty() |
| Discard the content of the object. | |
Buffer Access | |
| char& | operator[](int pIndex) |
| Access by reference. | |
| char | operator[](int pIndex) const |
| Access by copy. | |
| operator const char *() const | |
| Cast operator. | |
| char * | Buffer() |
| Non-const buffer access. | |
| const char * | Buffer() const |
| const buffer access. | |
Assignment Operators | |
| constKString& | operator=(constKString&pStr) |
| KStringassignment operator. | |
| constKString& | operator=(char pChar) |
| Character assignment operator. | |
| constKString& | operator=(const char *pStr) |
| String assignment operator. | |
| constKString& | operator=(int pValue) |
| Int assignment operator. | |
| constKString& | operator=(float pValue) |
| Float assignment operator. | |
| constKString& | operator=(double pValue) |
| Double assignment operator. | |
| constKString& | Copy(size_t pLen, const char *pStr) |
| String assignment function with maximum length. | |
| void | Swap(KString&pStr) |
| Swap the contents of twoKStringobjects; no allocation is performed. | |
Append and Concatenation | |
| constKString& | Append(const char *pStr) |
| Append as "C" strcat(). | |
| constKString& | AppendN(const char *pStr, size_t pLength) |
| Append as "C" strncat(). | |
| constKString& | operator+=(constKString&pKStr) |
| KStringappend. | |
| constKString& | operator+=(char pChar) |
| Character append. | |
| constKString& | operator+=(const char *pStr) |
| String append. | |
| constKString& | operator+=(int pValue) |
| Int append. | |
| constKString& | operator+=(float pValue) |
| Float append. | |
| KFBX_DLLKString | operator+(constKString&pKStr1, constKString&pKStr2) |
| KStringconcatenation. | |
| KFBX_DLLKString | operator+(constKString&pKStr, char pChar) |
| Character concatenation. | |
| KFBX_DLLKString | operator+(constKString&pKStr, const char *pStr) |
| String concatenation. | |
| KFBX_DLLKString | operator+(constKString&pKStr, int pValue) |
| Int concatenation. | |
| KFBX_DLLKString | operator+(constKString&pKStr, float pValue) |
| Float concatenation. | |
String Comparison | |
| int | Compare(const char *pStr) const |
| Compare as "C" strcmp(). | |
| int | CompareNoCase(const char *pStr) const |
| Compare as "C" stricmp(). | |
| bool | operator==(constKString&pStr) const |
| Equality operator. | |
| bool | operator!=(constKString&pStr) const |
| Inequality operator. | |
| bool | operator<(constKString&pStr) const |
| Inferior to operator. | |
| bool | operator<=(constKString&pStr) const |
| Inferior or equal to operator. | |
| bool | operator>=(constKString&pStr) const |
| Superior or equal to operator. | |
| bool | operator>(constKString&pStr) const |
| Superior to operator. | |
| bool | operator==(const char *pStr) const |
| Equality operator. | |
| bool | operator!=(const char *pStr) const |
| Inequality operator. | |
| bool | operator<(const char *pStr) const |
| Inferior to operator. | |
| bool | operator<=(const char *pStr) const |
| Inferior or equal to operator. | |
| bool | operator>=(const char *pStr) const |
| Superior or equal to operator. | |
| bool | operator>(const char *pStr) const |
| Superior to operator. | |
Substring Extraction | |
| KString | Mid(size_t pFirst, size_t pCount) const |
| Extract middle string for a given length. | |
| KString | Mid(size_t pFirst) const |
| Extract middle string up to the end. | |
| KString | Left(size_t pCount) const |
| Extract left string. | |
| KString | Right(size_t pCount) const |
| Extract right string. | |
Conversion | |
| KString | Upper() const |
| Uppercase conversion. | |
| KString | Lower() const |
| Lowercase conversion. | |
| KString | Reverse() const |
| Reverse conversion. | |
| KString | ConvertToUnix() const |
| Convert to Unix, changes \r\n characters for a single \n. | |
| KString | ConvertToWindows() const |
| Convert to Windows, changes \n character for both \r\n. | |
Search | |
| int | Find(char pChar, size_t pStartPosition=0) const |
| Look for a single character match, like "C" strchr(). | |
| int | Find(const char *pStrSub, size_t pStartPosition=0) const |
| Look for a substring match, like "C" strstr(). | |
| int | ReverseFind(char pChar) const |
| Look for a single character match, like "C" strrchr(). | |
| int | FindOneOf(const char *pStrCharSet, size_t pStartPosition=0) const |
| Look for a single character match, like "C" strpbrk(). | |
| bool | FindAndReplace(const char *pFind, const char *pReplaceBy, size_t pStartPosition=0) |
| Replace a substring. | |
| bool | ReplaceAll(char pFind, char pReplaceBy) |
| Replace a character. | |
Token Extraction | |
| int | GetTokenCount(const char *pSpans) const |
| Get number of tokens. | |
| KString | GetToken(int pTokenIndex, const char *pSpans) const |
| Get token at given index. | |
| enumPaddingType |
| KString | ( | ) |
Default constructor.
| KString | ( | char | pChar, | |
| size_t | pNbRepeat=1 | |||
| ) |
| KString | ( | const char * | pCharPtr, | |
| size_t | pLength | |||
| ) |
String constructor with maximum length.
| pCharPtr | The string used to constructKString. | |
| pLength | Maximum length. |
| KString | ( | const int | pValue | ) |
Int constructor.
| pValue | The int value used to constructKString. |
| KString | ( | const float | pValue | ) |
Float constructor.
| pValue | The float value used to constructKString. |
| KString | ( | const double | pValue | ) |
Double constructor.
| pValue | The double value used to constructKString. |
| ~KString | ( | ) |
Destructor.
| staticKString* Create | ( | ) | [static] |
Create an instance.
| void Destroy | ( | ) |
Destroy an allocated version of the string.
Destroy the allocated space if empty.
| pString | KStringto be destroied if empty. |
Return the passed pString if it is not empty, or a local static emptyKStringwill be returned.
| pString | If pString is not empty, pString will be returned, or a local static empty string will be returned. |
| bool IsOK | ( | ) | const[inline] |
| KString&Invalidate | ( | ) |
Invalidate string.
| size_t GetLen | ( | ) | const[inline] |
Get string length like "C" strlen().
Get the length of this string.
Definition at line659of filekstring.h.
Referenced byIsEmpty(), andStripQuotationMarks().
| bool IsEmpty | ( | ) | const[inline] |
| KString&Empty | ( | ) |
Discard the content of the object.
| char&operator[] | ( | int | pIndex | ) |
Access by reference.
| pIndex | The index. |
| char operator[] | ( | int | pIndex | ) | const |
Access by copy.
| pIndex | The index. |
| operator const char * | ( | ) | const[inline] |
| char * Buffer | ( | ) | [inline] |
| const char * Buffer | ( | ) | const[inline] |
| constKString&operator= | ( | char | pChar | ) |
Character assignment operator.
| pChar | The character to be assigned. |
| constKString&operator= | ( | const char * | pStr | ) |
String assignment operator.
| pStr | The string to be assigned. |
| constKString&operator= | ( | int | pValue | ) |
Int assignment operator.
| pValue | The int value to be assigned. |
| constKString&operator= | ( | float | pValue | ) |
Float assignment operator.
| pValue | The float value to be assigned. |
| constKString&operator= | ( | double | pValue | ) |
Double assignment operator.
| pValue | The double value to be assigned. |
| constKString&Copy | ( | size_t | pLen, | |
| const char * | pStr | |||
| ) |
String assignment function with maximum length.
| pLen | Maximum length. | |
| pStr | The string to be assigned. |
| void Swap | ( | KString& | pStr | ) |
| constKString&Append | ( | const char * | pStr | ) |
Append as "C" strcat().
| pStr | The string to be appended. |
| constKString&AppendN | ( | const char * | pStr, | |
| size_t | pLength | |||
| ) |
Append as "C" strncat().
| pStr | The string to be appended. | |
| pLength | The length of chars to be appended. |
| constKString&operator+= | ( | char | pChar | ) |
Character append.
| pChar | The character to be appended. |
| constKString&operator+= | ( | const char * | pStr | ) |
String append.
| pStr | The string to be appended. |
| constKString&operator+= | ( | int | pValue | ) |
Int append.
| pValue | The int value to be appended. |
| constKString&operator+= | ( | float | pValue | ) |
Float append.
| pValue | The float value to be appended. |
| int Compare | ( | const char * | pStr | ) | const |
Compare as "C" strcmp().
| pStr | The string to be compared. |
| int CompareNoCase | ( | const char * | pStr | ) | const |
Compare as "C" stricmp().
| pStr | The string to be compared. |
| bool operator== | ( | constKString& | pStr | ) | const |
Equality operator.
| pStr | TheKStringto be compared. |
| bool operator!= | ( | constKString& | pStr | ) | const |
Inequality operator.
| pStr | TheKStringto be compared. |
| bool operator< | ( | constKString& | pStr | ) | const |
Inferior to operator.
| pStr | TheKStringto be compared. |
| bool operator<= | ( | constKString& | pStr | ) | const |
Inferior or equal to operator.
| pStr | TheKStringto be compared. |
| bool operator>= | ( | constKString& | pStr | ) | const |
Superior or equal to operator.
| pStr | TheKStringto be compared. |
| bool operator> | ( | constKString& | pStr | ) | const |
Superior to operator.
| pStr | TheKStringto be compared. |
| bool operator== | ( | const char * | pStr | ) | const |
Equality operator.
| pStr | The string to be compared. |
| bool operator!= | ( | const char * | pStr | ) | const |
Inequality operator.
| pStr | The string to be compared. |
| bool operator< | ( | const char * | pStr | ) | const |
Inferior to operator.
| pStr | The string to be compared. |
| bool operator<= | ( | const char * | pStr | ) | const |
Inferior or equal to operator.
| pStr | The string to be compared. |
| bool operator>= | ( | const char * | pStr | ) | const |
Superior or equal to operator.
| pStr | The string to be compared. |
| bool operator> | ( | const char * | pStr | ) | const |
Superior to operator.
| pStr | The string to be compared. |
| KStringMid | ( | size_t | pFirst, | |
| size_t | pCount | |||
| ) | const |
Extract middle string for a given length.
| pFirst | The start index ofKStringto be extracted. | |
| pCount | The length of sub-string to be extracted. |
Referenced byRemoveChar(), andStripQuotationMarks().
| KStringMid | ( | size_t | pFirst | ) | const |
Extract middle string up to the end.
| pFirst | The start index ofKStringto be extracted. |
| KStringLeft | ( | size_t | pCount | ) | const |
Extract left string.
| pCount | The length of sub-string to be extracted. |
Referenced byRemoveChar().
| KStringRight | ( | size_t | pCount | ) | const |
Extract right string.
| pCount | The length of sub-string to be extracted. |
| KStringPad | ( | PaddingType | pPadding, | |
| size_t | pLen, | |||
| char | pCar=' ' | |||
| ) | const |
Add padding characters.
| pPadding | The padding type. | |
| pLen | The length limit ofKStringafter padding. | |
| pCar | The character to be padded. |
| KStringUnPad | ( | PaddingType | pPadding | ) | const |
Remove padding characters.
| pPadding | The padding type. |
| KStringUpper | ( | ) | const |
Uppercase conversion.
| KStringLower | ( | ) | const |
Lowercase conversion.
| KStringReverse | ( | ) | const |
Reverse conversion.
| KStringConvertToUnix | ( | ) | const |
Convert to Unix, changes \r\n characters for a single \n.
| KStringConvertToWindows | ( | ) | const |
Convert to Windows, changes \n character for both \r\n.
| int Find | ( | char | pChar, | |
| size_t | pStartPosition=0 | |||
| ) | const |
Look for a single character match, like "C" strchr().
| pChar | The character to look for. | |
| pStartPosition | Start position to look for. |
| int Find | ( | const char * | pStrSub, | |
| size_t | pStartPosition=0 | |||
| ) | const |
Look for a substring match, like "C" strstr().
| pStrSub | The substring to look for. | |
| pStartPosition | Start position to look for. |
| int ReverseFind | ( | char | pChar | ) | const |
Look for a single character match, like "C" strrchr().
| pChar | The character to look for. |
Referenced byRemoveChar().
| int FindOneOf | ( | const char * | pStrCharSet, | |
| size_t | pStartPosition=0 | |||
| ) | const |
Look for a single character match, like "C" strpbrk().
| pStrCharSet | The character set. | |
| pStartPosition | The start position. |
| bool FindAndReplace | ( | const char * | pFind, | |
| const char * | pReplaceBy, | |||
| size_t | pStartPosition=0 | |||
| ) |
Replace a substring.
| pFind | The substring to look for. | |
| pReplaceBy | The string to replace by. | |
| pStartPosition | The start position. |
trueif substring found and replaced.| bool ReplaceAll | ( | char | pFind, | |
| char | pReplaceBy | |||
| ) |
Replace a character.
| pFind | The character to look for. | |
| pReplaceBy | The character to replace by. |
trueif character found and replaced.| int GetTokenCount | ( | const char * | pSpans | ) | const |
Get number of tokens.
| pSpans | The span |
| KStringGetToken | ( | int | pTokenIndex, | |
| const char * | pSpans | |||
| ) | const |
Get token at given index.
| pTokenIndex | The token index. | |
| pSpans | The span |
| static KMemoryAllocator* AllocatorGet | ( | ) | [static] |
Get new memory allocator.
| static void AllocatorPurge | ( | ) | [static] |
Purge memory allocator.
| static void AllocatorRelease | ( | ) | [static] |
Release memory allocator.
Character concatenation.
| pKStr | TheKStringbe be concatenated. | |
| pChar | The character to be concatenated. |
String concatenation.
| pKStr | TheKStringbe be concatenated. | |
| pStr | The string to be concatenated. |
Int concatenation.
| pKStr | TheKStringbe be concatenated. | |
| pValue | The int value be be concatenated. |