#include <fstring.h>
Public Types | |
enum | CompareMode { kCaseSensitive, kCaseInsensitive } |
Public Member Functions | |
ConstString (const char8 *str) | |
Assign from string of type char8. | |
ConstString (const char16 *str) | |
Assign from string of type char16. | |
ConstString (const ConstString &str, int32 offset=0) | |
Copy constructor. | |
ConstString (const FVariant &var) | |
Assign a string from FVariant. | |
ConstString () | |
virtual | ~ConstString () |
Destructor. | |
virtual int32 | length () const |
Return length of string. | |
bool | isEmpty () const |
Return true if sting is empty. | |
operator const char8 * () const | |
Returns pointer to string of type char8 (no modification allowed). | |
operator const char16 * () const | |
Returns pointer to string of type char16(no modification allowed). | |
char | operator[] (short idx) const |
Returns character at 'idx'. | |
char | operator[] (long idx) const |
char | operator[] (int idx) const |
char | operator[] (unsigned short idx) const |
char | operator[] (unsigned long idx) const |
char | operator[] (unsigned int idx) const |
virtual const char8 * | text8 () const |
Returns pointer to string of type char8. | |
virtual const char16 * | text16 () const |
Returns pointer to string of type char16. | |
virtual const char * | text () const |
Returns pointer to string of type tchar. | |
virtual const void * | ptr () const |
Returns pointer to string of type void. | |
virtual char8 | getChar8 (uint32 index) const |
Returns character of type char16 at 'index'. | |
virtual char16 | getChar16 (uint32 index) const |
Returns character of type char8 at 'index'. | |
char | getChar (uint32 index) const |
Returns character of type tchar at 'index'. | |
bool | testChar8 (uint32 index, char8 c) const |
Returns true if character is equal at position 'index'. | |
bool | testChar16 (uint32 index, char16 c) const |
bool | testChar (uint32 index, char8 c) const |
bool | testChar (uint32 index, char16 c) const |
bool | extract (String &result, uint32 idx, int32 n=-1) const |
Get n characters long substring starting at index (n=-1: until end). | |
int32 | copyTo8 (char8 *str, uint32 idx=0, int32 n=-1) const |
int32 | copyTo16 (char16 *str, uint32 idx=0, int32 n=-1) const |
int32 | copyTo (char *str, uint32 idx=0, int32 n=-1) const |
void | copyTo (IStringResult *result) const |
Copies whole member string. | |
void | copyTo (IString &string) const |
Copies whole member string. | |
uint32 | hash (uint32 tsize) const |
int32 | compareAt (uint32 index, const ConstString &str, int32 n=-1, CompareMode m=kCaseSensitive) const |
Compare n characters of str with n characters of this starting at index (return: see above). | |
int32 | compare (const ConstString &str, int32 n, CompareMode m=kCaseSensitive) const |
Compare n characters of str with n characters of this (return: see above). | |
int32 | compare (const ConstString &str, CompareMode m=kCaseSensitive) const |
Compare all characters of str with this (return: see above). | |
int32 | naturalCompare (const ConstString &str, CompareMode mode=kCaseSensitive) const |
bool | startsWith (const ConstString &str, CompareMode m=kCaseSensitive) const |
Check if this starts with str. | |
bool | endsWith (const ConstString &str, CompareMode m=kCaseSensitive) const |
Check if this ends with str. | |
bool | contains (const ConstString &str, CompareMode m=kCaseSensitive) const |
Check if this contains str. | |
int32 | findLast (const ConstString &str, int32 n=-1, CompareMode m=kCaseSensitive) const |
Find last occurrence of n characters of str in this (n=-1: all). | |
int32 | findLast (char8 c, CompareMode m=kCaseSensitive) const |
int32 | findLast (char16 c, CompareMode m=kCaseSensitive) const |
int32 | countOccurences (char8 c, uint32 startIndex, CompareMode=kCaseSensitive) const |
Counts occurences of c within this starting at index. | |
int32 | countOccurences (char16 c, uint32 startIndex, CompareMode=kCaseSensitive) const |
int32 | getFirstDifferent (const ConstString &str, CompareMode=kCaseSensitive) const |
Returns position of first different character. | |
bool | isDigit (uint32 index) const |
Returns true if character at position is a digit. | |
bool | scanFloat (double &value, uint32 offset=0, bool scanToEnd=true) const |
Converts string to double value starting at offset. | |
bool | scanInt64 (int64 &value, uint32 offset=0, bool scanToEnd=true) const |
Converts string to int64 value starting at offset. | |
bool | scanUInt64 (uint64 &value, uint32 offset=0, bool scanToEnd=true) const |
Converts string to uint64 value starting at offset. | |
bool | scanInt32 (int32 &value, uint32 offset=0, bool scanToEnd=true) const |
Converts string to int32 value starting at offset. | |
bool | scanUInt32 (uint32 &value, uint32 offset=0, bool scanToEnd=true) const |
Converts string to uint32 value starting at offset. | |
bool | scanHex (uint8 &value, uint32 offset=0, bool scanToEnd=true) const |
Converts string to hex/uint8 value starting at offset. | |
int32 | getTrailingNumberIndex (uint32 width=0) const |
Returns start index of trailing number. | |
int64 | getTrailingNumber (int64 fallback=0) const |
Returns result of scanInt64 or the fallback. | |
int64 | getNumber () const |
Returns result of scanInt64. | |
void | toVariant (FVariant &var) const |
bool | isWideString () const |
Returns true if string is wide. | |
bool | isAsciiString () const |
Checks if all characters in string are in ascii range. | |
bool | isNormalized (UnicodeNormalization=kUnicodeNormC) |
On PC only kUnicodeNormC is working. | |
Find first occurrence of n characters of str in this (n=-1: all) ending at endIndex (endIndex = -1: all) | |
int32 | findFirst (const ConstString &str, int32 n=-1, CompareMode m=kCaseSensitive, int32 endIndex=-1) const |
int32 | findFirst (char8 c, CompareMode m=kCaseSensitive, int32 endIndex=-1) const |
int32 | findFirst (char16 c, CompareMode m=kCaseSensitive, int32 endIndex=-1) const |
Find next occurrence of n characters of str starting at startIndex in this (n=-1: all) ending at endIndex (endIndex = -1: all) | |
int32 | findNext (int32 startIndex, const ConstString &str, int32 n=-1, CompareMode=kCaseSensitive, int32 endIndex=-1) const |
int32 | findNext (int32 startIndex, char8 c, CompareMode=kCaseSensitive, int32 endIndex=-1) const |
int32 | findNext (int32 startIndex, char16 c, CompareMode=kCaseSensitive, int32 endIndex=-1) const |
Find previous occurrence of n characters of str starting at startIndex in this (n=-1: all) | |
int32 | findPrev (int32 startIndex, const ConstString &str, int32 n=-1, CompareMode=kCaseSensitive) const |
int32 | findPrev (int32 startIndex, char8 c, CompareMode=kCaseSensitive) const |
int32 | findPrev (int32 startIndex, char16 c, CompareMode=kCaseSensitive) const |
Static Public Member Functions | |
static bool | isCharSpace (char8 character) |
Returns true if character is a space. | |
static bool | isCharSpace (char16 character) |
static bool | isCharAlpha (char8 character) |
Returns true if character is an alphabetic character. | |
static bool | isCharAlpha (char16 character) |
static bool | isCharAlphaNum (char8 character) |
Returns true if character is an alphanumeric character. | |
static bool | isCharAlphaNum (char16 character) |
static bool | isCharDigit (char8 character) |
Returns true if character is a number. | |
static bool | isCharDigit (char16 character) |
static bool | isCharAscii (char8 character) |
Returns true if character is in ASCII range. | |
static bool | isCharAscii (char16 character) |
Returns true if character is in ASCII range. | |
static bool | isCharUpper (char8 character) |
static bool | isCharUpper (char16 character) |
static bool | isCharLower (char8 character) |
static bool | isCharLower (char16 character) |
static bool | scanInt64_8 (const char8 *text, int64 &value, bool scanToEnd=true) |
Converts string of type char8 to int64 value. | |
static bool | scanInt64_16 (const char16 *text, int64 &value, bool scanToEnd=true) |
Converts string of type char16 to int64 value. | |
static bool | scanInt64 (const char *text, int64 &value, bool scanToEnd=true) |
Converts string of type tchar to int64 value. | |
static bool | scanUInt64_8 (const char8 *text, uint64 &value, bool scanToEnd=true) |
Converts string of type char8 to uint64 value. | |
static bool | scanUInt64_16 (const char16 *text, uint64 &value, bool scanToEnd=true) |
Converts string of type char16 to uint64 value. | |
static bool | scanUInt64 (const char *text, uint64 &value, bool scanToEnd=true) |
Converts string of type tchar to uint64 value. | |
static bool | scanInt32_8 (const char8 *text, int32 &value, bool scanToEnd=true) |
Converts string of type char8 to int32 value. | |
static bool | scanInt32_16 (const char16 *text, int32 &value, bool scanToEnd=true) |
Converts string of type char16 to int32 value. | |
static bool | scanInt32 (const char *text, int32 &value, bool scanToEnd=true) |
Converts string of type tchar to int32 value. | |
static bool | scanUInt32_8 (const char8 *text, uint32 &value, bool scanToEnd=true) |
Converts string of type char8 to int32 value. | |
static bool | scanUInt32_16 (const char16 *text, uint32 &value, bool scanToEnd=true) |
Converts string of type char16 to int32 value. | |
static bool | scanUInt32 (const char *text, uint32 &value, bool scanToEnd=true) |
Converts string of type tchar to int32 value. | |
static bool | scanHex_8 (const char8 *text, uint8 &value, bool scanToEnd=true) |
Converts string of type char8 to hex/unit8 value. | |
static bool | scanHex_16 (const char16 *text, uint8 &value, bool scanToEnd=true) |
Converts string of type char16 to hex/unit8 value. | |
static bool | scanHex (const char *text, uint8 &value, bool scanToEnd=true) |
Converts string of type tchar to hex/unit8 value. | |
static char8 | toLower (char8 c) |
Converts to lower case. | |
static char8 | toUpper (char8 c) |
Converts to upper case. | |
static char16 | toLower (char16 c) |
static char16 | toUpper (char16 c) |
static int32 | multiByteToWideString (char16 *dest, const char8 *source, int32 wcharCount, uint32 sourceCodePage=kCP_Default) |
If dest is zero, this returns the maximum number of bytes needed to convert source. | |
static int32 | wideStringToMultiByte (char8 *dest, const char16 *source, int32 char8Count, uint32 destCodePage=kCP_Default) |
If dest is zero, this returns the maximum number of bytes needed to convert source. | |
Protected Attributes | |
union { | |
void * buffer | |
char8 * buffer8 | |
char16 * buffer16 | |
}; | |
uint32 | len: 30 |
uint32 | isWide: 1 |
Invariant String.
A base class which provides methods to work with its member string. Neither of the operations allows modifying the member string and that is why all operation are declared as const.
There are operations for access, comparison, find, numbers and conversion.
Almost all operations exist in three versions for char8, char16 and the polymorphic type tchar. The type tchar can either be char8 or char16 depending on whether UNICODE is activated or not.
enum CompareMode |
ConstString | ( | const char8 * | str | ) |
Assign from string of type char8.
ConstString | ( | const char16 * | str | ) |
Assign from string of type char16.
ConstString | ( | const ConstString & | str, | |
int32 | offset = 0 | |||
) |
Copy constructor.
ConstString | ( | const FVariant & | var | ) |
Assign a string from FVariant.
ConstString | ( | ) |
virtual ~ConstString | ( | ) | [inline, virtual] |
Destructor.
virtual int32 length | ( | ) | const [inline, virtual] |
Return length of string.
bool isEmpty | ( | ) | const [inline] |
Return true if sting is empty.
operator const char8 * | ( | ) | const [inline] |
Returns pointer to string of type char8 (no modification allowed).
operator const char16 * | ( | ) | const [inline] |
Returns pointer to string of type char16(no modification allowed).
char operator[] | ( | short | idx | ) | const [inline] |
Returns character at 'idx'.
char operator[] | ( | long | idx | ) | const [inline] |
char operator[] | ( | int | idx | ) | const [inline] |
char operator[] | ( | unsigned short | idx | ) | const [inline] |
char operator[] | ( | unsigned long | idx | ) | const [inline] |
char operator[] | ( | unsigned int | idx | ) | const [inline] |
const char8 * text8 | ( | ) | const [inline, virtual] |
Returns pointer to string of type char8.
Reimplemented in String.
const char16 * text16 | ( | ) | const [inline, virtual] |
Returns pointer to string of type char16.
Reimplemented in String.
const char * text | ( | ) | const [inline, virtual] |
Returns pointer to string of type tchar.
virtual const void* ptr | ( | ) | const [inline, virtual] |
Returns pointer to string of type void.
char8 getChar8 | ( | uint32 | index | ) | const [inline, virtual] |
Returns character of type char16 at 'index'.
Reimplemented in String.
char16 getChar16 | ( | uint32 | index | ) | const [inline, virtual] |
Returns character of type char8 at 'index'.
Reimplemented in String.
char getChar | ( | uint32 | index | ) | const [inline] |
Returns character of type tchar at 'index'.
bool testChar8 | ( | uint32 | index, | |
char8 | c | |||
) | const |
Returns true if character is equal at position 'index'.
bool testChar16 | ( | uint32 | index, | |
char16 | c | |||
) | const |
bool testChar | ( | uint32 | index, | |
char8 | c | |||
) | const [inline] |
bool testChar | ( | uint32 | index, | |
char16 | c | |||
) | const [inline] |
bool extract | ( | String & | result, | |
uint32 | idx, | |||
int32 | n = -1 | |||
) | const |
Get n characters long substring starting at index (n=-1: until end).
int32 copyTo8 | ( | char8 * | str, | |
uint32 | idx = 0 , |
|||
int32 | n = -1 | |||
) | const |
int32 copyTo16 | ( | char16 * | str, | |
uint32 | idx = 0 , |
|||
int32 | n = -1 | |||
) | const |
int32 copyTo | ( | char * | str, | |
uint32 | idx = 0 , |
|||
int32 | n = -1 | |||
) | const |
void copyTo | ( | IStringResult * | result | ) | const |
Copies whole member string.
void copyTo | ( | IString & | string | ) | const |
Copies whole member string.
uint32 hash | ( | uint32 | tsize | ) | const [inline] |
int32 compareAt | ( | uint32 | index, | |
const ConstString & | str, | |||
int32 | n = -1 , |
|||
CompareMode | m = kCaseSensitive | |||
) | const |
Compare n characters of str with n characters of this starting at index (return: see above).
int32 compare | ( | const ConstString & | str, | |
int32 | n, | |||
CompareMode | m = kCaseSensitive | |||
) | const |
Compare n characters of str with n characters of this (return: see above).
int32 compare | ( | const ConstString & | str, | |
CompareMode | m = kCaseSensitive | |||
) | const |
Compare all characters of str with this (return: see above).
Steinberg::int32 naturalCompare | ( | const ConstString & | str, | |
CompareMode | mode = kCaseSensitive | |||
) | const |
bool startsWith | ( | const ConstString & | str, | |
CompareMode | m = kCaseSensitive | |||
) | const |
Check if this starts with str.
bool endsWith | ( | const ConstString & | str, | |
CompareMode | m = kCaseSensitive | |||
) | const |
Check if this ends with str.
bool contains | ( | const ConstString & | str, | |
CompareMode | m = kCaseSensitive | |||
) | const |
Check if this contains str.
bool isCharSpace | ( | char8 | character | ) | [static] |
Returns true if character is a space.
bool isCharSpace | ( | char16 | character | ) | [static] |
Returns true if character is a space.
bool isCharAlpha | ( | char8 | character | ) | [static] |
Returns true if character is an alphabetic character.
bool isCharAlpha | ( | char16 | character | ) | [static] |
Returns true if character is an alphabetic character.
bool isCharAlphaNum | ( | char8 | character | ) | [static] |
Returns true if character is an alphanumeric character.
bool isCharAlphaNum | ( | char16 | character | ) | [static] |
Returns true if character is an alphanumeric character.
bool isCharDigit | ( | char8 | character | ) | [static] |
Returns true if character is a number.
bool isCharDigit | ( | char16 | character | ) | [static] |
Returns true if character is a number.
bool isCharAscii | ( | char8 | character | ) | [static] |
Returns true if character is in ASCII range.
bool isCharAscii | ( | char16 | character | ) | [static] |
Returns true if character is in ASCII range.
bool isCharUpper | ( | char8 | character | ) | [static] |
bool isCharUpper | ( | char16 | character | ) | [static] |
bool isCharLower | ( | char8 | character | ) | [static] |
bool isCharLower | ( | char16 | character | ) | [static] |
int32 findFirst | ( | const ConstString & | str, | |
int32 | n = -1 , |
|||
CompareMode | m = kCaseSensitive , |
|||
int32 | endIndex = -1 | |||
) | const [inline] |
int32 findFirst | ( | char8 | c, | |
CompareMode | m = kCaseSensitive , |
|||
int32 | endIndex = -1 | |||
) | const [inline] |
int32 findFirst | ( | char16 | c, | |
CompareMode | m = kCaseSensitive , |
|||
int32 | endIndex = -1 | |||
) | const [inline] |
int32 findNext | ( | int32 | startIndex, | |
const ConstString & | str, | |||
int32 | n = -1 , |
|||
CompareMode | mode = kCaseSensitive , |
|||
int32 | endIndex = -1 | |||
) | const |
int32 findNext | ( | int32 | startIndex, | |
char8 | c, | |||
CompareMode | mode = kCaseSensitive , |
|||
int32 | endIndex = -1 | |||
) | const |
int32 findNext | ( | int32 | startIndex, | |
char16 | c, | |||
CompareMode | mode = kCaseSensitive , |
|||
int32 | endIndex = -1 | |||
) | const |
int32 findPrev | ( | int32 | startIndex, | |
const ConstString & | str, | |||
int32 | n = -1 , |
|||
CompareMode | mode = kCaseSensitive | |||
) | const |
int32 findPrev | ( | int32 | startIndex, | |
char8 | c, | |||
CompareMode | mode = kCaseSensitive | |||
) | const |
int32 findPrev | ( | int32 | startIndex, | |
char16 | c, | |||
CompareMode | mode = kCaseSensitive | |||
) | const |
int32 findLast | ( | const ConstString & | str, | |
int32 | n = -1 , |
|||
CompareMode | m = kCaseSensitive | |||
) | const [inline] |
Find last occurrence of n characters of str in this (n=-1: all).
int32 findLast | ( | char8 | c, | |
CompareMode | m = kCaseSensitive | |||
) | const [inline] |
int32 findLast | ( | char16 | c, | |
CompareMode | m = kCaseSensitive | |||
) | const [inline] |
int32 countOccurences | ( | char8 | c, | |
uint32 | startIndex, | |||
CompareMode | mode = kCaseSensitive | |||
) | const |
Counts occurences of c within this starting at index.
int32 countOccurences | ( | char16 | c, | |
uint32 | startIndex, | |||
CompareMode | mode = kCaseSensitive | |||
) | const |
int32 getFirstDifferent | ( | const ConstString & | str, | |
CompareMode | mode = kCaseSensitive | |||
) | const |
Returns position of first different character.
bool isDigit | ( | uint32 | index | ) | const |
Returns true if character at position is a digit.
bool scanFloat | ( | double & | value, | |
uint32 | offset = 0 , |
|||
bool | scanToEnd = true | |||
) | const |
Converts string to double value starting at offset.
bool scanInt64 | ( | int64 & | value, | |
uint32 | offset = 0 , |
|||
bool | scanToEnd = true | |||
) | const |
Converts string to int64 value starting at offset.
bool scanUInt64 | ( | uint64 & | value, | |
uint32 | offset = 0 , |
|||
bool | scanToEnd = true | |||
) | const |
Converts string to uint64 value starting at offset.
bool scanInt32 | ( | int32 & | value, | |
uint32 | offset = 0 , |
|||
bool | scanToEnd = true | |||
) | const |
Converts string to int32 value starting at offset.
bool scanUInt32 | ( | uint32 & | value, | |
uint32 | offset = 0 , |
|||
bool | scanToEnd = true | |||
) | const |
Converts string to uint32 value starting at offset.
bool scanHex | ( | uint8 & | value, | |
uint32 | offset = 0 , |
|||
bool | scanToEnd = true | |||
) | const |
Converts string to hex/uint8 value starting at offset.
int32 getTrailingNumberIndex | ( | uint32 | width = 0 |
) | const |
Returns start index of trailing number.
int64 getTrailingNumber | ( | int64 | fallback = 0 |
) | const |
Returns result of scanInt64 or the fallback.
int64 getNumber | ( | ) | const [inline] |
Returns result of scanInt64.
bool scanInt64_8 | ( | const char8 * | text, | |
int64 & | value, | |||
bool | scanToEnd = true | |||
) | [static] |
Converts string of type char8 to int64 value.
bool scanInt64_16 | ( | const char16 * | text, | |
int64 & | value, | |||
bool | scanToEnd = true | |||
) | [static] |
Converts string of type char16 to int64 value.
bool scanInt64 | ( | const char * | text, | |
int64 & | value, | |||
bool | scanToEnd = true | |||
) | [static] |
Converts string of type tchar to int64 value.
bool scanUInt64_8 | ( | const char8 * | text, | |
uint64 & | value, | |||
bool | scanToEnd = true | |||
) | [static] |
Converts string of type char8 to uint64 value.
bool scanUInt64_16 | ( | const char16 * | text, | |
uint64 & | value, | |||
bool | scanToEnd = true | |||
) | [static] |
Converts string of type char16 to uint64 value.
bool scanUInt64 | ( | const char * | text, | |
uint64 & | value, | |||
bool | scanToEnd = true | |||
) | [static] |
Converts string of type tchar to uint64 value.
bool scanInt32_8 | ( | const char8 * | text, | |
int32 & | value, | |||
bool | scanToEnd = true | |||
) | [inline, static] |
Converts string of type char8 to int32 value.
bool scanInt32_16 | ( | const char16 * | text, | |
int32 & | value, | |||
bool | scanToEnd = true | |||
) | [inline, static] |
Converts string of type char16 to int32 value.
bool scanInt32 | ( | const char * | text, | |
int32 & | value, | |||
bool | scanToEnd = true | |||
) | [inline, static] |
Converts string of type tchar to int32 value.
bool scanUInt32_8 | ( | const char8 * | text, | |
uint32 & | value, | |||
bool | scanToEnd = true | |||
) | [inline, static] |
Converts string of type char8 to int32 value.
bool scanUInt32_16 | ( | const char16 * | text, | |
uint32 & | value, | |||
bool | scanToEnd = true | |||
) | [inline, static] |
Converts string of type char16 to int32 value.
bool scanUInt32 | ( | const char * | text, | |
uint32 & | value, | |||
bool | scanToEnd = true | |||
) | [inline, static] |
Converts string of type tchar to int32 value.
bool scanHex_8 | ( | const char8 * | text, | |
uint8 & | value, | |||
bool | scanToEnd = true | |||
) | [static] |
Converts string of type char8 to hex/unit8 value.
bool scanHex_16 | ( | const char16 * | text, | |
uint8 & | value, | |||
bool | scanToEnd = true | |||
) | [static] |
Converts string of type char16 to hex/unit8 value.
bool scanHex | ( | const char * | text, | |
uint8 & | value, | |||
bool | scanToEnd = true | |||
) | [static] |
Converts string of type tchar to hex/unit8 value.
void toVariant | ( | FVariant & | var | ) | const |
Reimplemented in String.
char8 toLower | ( | char8 | c | ) | [static] |
Converts to lower case.
char8 toUpper | ( | char8 | c | ) | [static] |
Converts to upper case.
char16 toLower | ( | char16 | c | ) | [static] |
char16 toUpper | ( | char16 | c | ) | [static] |
int32 multiByteToWideString | ( | char16 * | dest, | |
const char8 * | source, | |||
int32 | wcharCount, | |||
uint32 | sourceCodePage = kCP_Default | |||
) | [static] |
If dest is zero, this returns the maximum number of bytes needed to convert source.
int32 wideStringToMultiByte | ( | char8 * | dest, | |
const char16 * | source, | |||
int32 | char8Count, | |||
uint32 | destCodePage = kCP_Default | |||
) | [static] |
If dest is zero, this returns the maximum number of bytes needed to convert source.
bool isWideString | ( | ) | const [inline] |
Returns true if string is wide.
Reimplemented in StringObject.
bool isAsciiString | ( | ) | const |
Checks if all characters in string are in ascii range.
bool isNormalized | ( | UnicodeNormalization | n = kUnicodeNormC |
) |
On PC only kUnicodeNormC is working.
void* buffer |
char8* buffer8 |
char16* buffer16 |
union { ... } [protected] |
uint32 len [protected] |
uint32 isWide [protected] |