#include <cascade/util/CascadeString.h>
Inheritance diagram for CascadeString:
Public Types | |
typedef bool(* | LanguageEnumProc )(const CascadeString &lang, const CascadeString &friendlyLang, void *pClientData) |
Public Member Functions | |
CascadeString () | |
CascadeString (const CascadeString &string) | |
CascadeString (const char *pString) | |
virtual | ~CascadeString () |
bool | LoadString (const char *pResourceID) |
u32 | GetLength () const |
u32 | GetTerminatedLength () const |
u32 | CountChars () const |
CascadeUnicodeChar | ReadOneUnicodeChar (u32 &ioToken) const |
CascadeUnicodeChar | ReadNthUnicodeChar (u32 inIdx) const |
void | AppendUnicodeChar (CascadeUnicodeChar inCh) |
bool | IsEmpty () const |
void | Empty () |
bool | TrimAllocation () |
void | Truncate (u32 nNewLength) |
u32 | TruncateToByteLen (u32 nNewByteLength, bool bBreakOnChar=true) |
bool | IsEqual (const char *pString, bool bCaseSensitive=true) const |
s32 | Compare (const char *pString, bool bCaseSensitive=true, bool bIgnoreDiacritical=false, u32 nLen=0xFFFFFFFF) const |
s32 | CompareNBytes (const char *pString, u32 nBytes) const |
*this is greater than pString and 0 if they are equal. | |
bool | Contains (const char *pString, bool bCaseSensitive=true, bool bIgnoreDiacriticals=false) const |
*this is greater than pString and 0 if they are equal. | |
bool | ContainsBytes (const char *pString) const |
void | ToLower (bool bStripDiacriticals=false) |
void | ToUpper (bool bStripDiacriticals=false) |
void | StripDiacriticals () |
operator const char * () const | |
const CascadeString & | operator= (const char *pString) |
const CascadeString & | operator= (const CascadeString &string) |
const CascadeString & | operator+= (const char *pString) |
const CascadeString & | operator+= (char ch) |
char | operator[] (u32 nIndex) |
Static Public Member Functions | |
static bool | SetSystemLanguage (const char *pLanguage) |
Sets the default system-wide natural language to pLang. | |
static bool | GetSystemLanguage (char *pLanguageToSet, u32 nBuffLen) |
Fills pLanguageToSet with the value of the default system-wide natural language. | |
static bool | EnumerateStringResourceLanguages (class CascadeStream &stream, LanguageEnumProc callback, void *pClientData) |
static bool | LoadStringResources (class CascadeStream &stream, const char *pLang=NULL, bool bClearFirst=true) |
static void | ClearStringResources () |
static bool | AddStringResource (const CascadeString &resourceID, const CascadeString &string) |
static bool | RemoveStringResource (const CascadeString &resourceID) |
static CascadeUnicodeChar | UnicodeCharToUpper (CascadeUnicodeChar inChar) |
static CascadeUnicodeChar | UnicodeCharToLower (CascadeUnicodeChar inChar) |
static CascadeUnicodeChar | UnicodeCharStripDiacritical (CascadeUnicodeChar inChar) |
static bool | UnicodeCharIsAlpha (CascadeUnicodeChar inChar) |
static bool | UnicodeCharIsDigit (CascadeUnicodeChar inChar) |
CascadeString provides easy to use object-based string operations, including copy, append, truncate, comparison. Memory management when copying, appending, etc. is handled automatically.
|
|
|
default constructor Creates an empty string |
|
copy constructor Initializes this string as a copy of the supplied CascadeString object
|
|
parameterized constructor Initializes the string with a copy of the char* passed in as an argument.
|
|
destructor Frees any memory allocated for this string |
|
programatically adds a string resource Programatically adds a string resource
|
|
appends 32-bit Unicode character to the string (in UTF-8 format) Appends the supplied 32-bit Unicode character to the string as UTF-8
|
|
clears the set of loaded string resources Clears the set of loaded string resources.
|
|
compare this string with another Compares the supplied ASCII or UTF-8 c string or CascadeString with this one, optionally ignoring case and/or diacritical, and optionally limiting the length of the comparison.
|
|
*this is greater than pString and 0 if they are equal. compare this string with another, with a length limit Compares the supplied c string or CascadeString with this one, optionally ignoring case. Only the first nBytes bytes are compared. Unlike Compare(), this function is not UTF-8 aware, and does not obey the localizable sort order string. Use this where rapid comparison of ASCII strings is needed (it is basically strncmp). Pass 0xFFFFFFFF in nBytes to compare whole strings like strcmp.
|
|
*this is greater than pString and 0 if they are equal. test for containment Tests to see if the supplied c string or CascadeString is contained within this one, optionally ignoring case and optionally ignoring diacritical marks.
|
|
test for containment Tests to see if the supplied c string or CascadeString is contained within this one, in byte-wise fashion (no UTF-8 or case consideration);
|
|
returns the number of utf-8 characters in the string returns the number of utf-8 characters in the string
|
|
empties the string |
|
enumerates languages in a string resource file Enumerates the languages in a string resource file. In your callback, lang is the language specifier (for use in LoadStringResources) and friendlyLang is the localized name of the language for display to the end user. Return false in your enumeration callback to stop enumeration. Returns true if no errors and enumeration not stopped. |
|
returns the length of the string
Returns the length of the string (like
|
|
Fills pLanguageToSet with the value of the default system-wide natural language.
|
|
returns the length of the string, with terminator Returns the length of the string, including terminating null
|
|
determines whether or not the string is empty |
|
tests two strings for equality IsEqual tests two strings for equality, optional ignoring case.
|
|
loads a resource string into this CascadeString Loads this CascadeString with a copy of the resource string identified by the resource string ID passed in. Your program must call LoadStringResources() before using LoadString().
|
|
loads a set of string resources Loads a set of string resources from a stream. The stream must provide data in the Roku string resource file format. Strings for the default language (English) are loaded unless specified explicitly with the pLang parameter. When bClearFirst is true, the current set of string resources is cleared before loading. When bClearFirst is false, multiple subsequent calls to LoadStringResources() [on different resource files] will have the following effect:
|
|
the magic casting operator operator const char *() const is a casting operator that turns a CascadeString into a const char * This casting operator always returns a non-null value so if this->GetLength() == 0, then the casting operator will return a non-null empty string.
|
|
append operator Appends the supplied character to this string |
|
append operator Appends the supplied char* to this string |
|
assignment operator Makes this string a copy of the supplied string |
|
assignment operator Makes this string a copy of the supplied char* |
|
array index operator Returns the character at index nIndex in the string. If the index is out of range, returns \'\0\'
|
|
returns the nth 32-bit Unicode character from the string Returns the nth 32-bit Unicode character from the string. For higher-performance iteration from the start of the string, see ReadOneUnicodeChar().
|
|
returns a single 32-bit Unicode character from the string Returns a single 32-bit Unicode character from the string. Token parameter allows getting subsequent characters
|
|
programatically removes a string resource Programatically removes a string resource
|
|
Sets the default system-wide natural language to pLang.
|
|
remove diacritical markings from this string Removes diacritical markings from the characters in the string. Useful for comparisons or the like. Shares the limitations of UnicodeCharStripDiacritical |
|
make this string lowercase Makes this string lowercase. Useful for comparisons, etc.
|
|
make this string uppercase Makes this string uppercase. Useful for comparisons, etc.
|
|
trims the allocated memory associated with this CascadeString Causes the memory allocated for the string to be reallocated to exactly fit the current string.
|
|
truncate to length Truncate the string to the supplied length, leaving the result null-terminated. If the string is already shorter than this length, this has no effect.
|
|
truncate to length Truncate the string to the supplied length in bytes (not including the null terminator), leaving the result null-terminated. The bBreakOnChar argument determines whether the function will look for a UTF-8 character boundary on which to break. If your string is ASCII or UTF-8, you should pass true. If you're using another encoding, pass false and be aware that the truncation may happen in the middle of a multi-byte sequence. If the string is already shorter than this length, this has no effect. Example usage: you need to copy a string into a fixed 64-byte field in a struct. Call myString.TruncateToByteLen( 63 ) to trim it to fit, including the NULL.
|
|
tests Unicode character for alpha Tests Unicode character for alpha. Valid only for Latin-1
|
|
tests Unicode character for representing a numeric digit Tests Unicode character for representing a numeric digit . Valid only for Latin-1
|
|
removes diacritical mark from input character Removes diacritical mark from input character. If the supplied character is within the Latin-1 character set, and is a character with a diacritical (e.g. e with an acute accent) then the corresponding un-accented character is returned. Characters that do not have unaccented versions are returned unmodified.
|
|
converts a Unicode character to lower case Converts a Unicode character to lower case. In the current revision, this is valid for characters witin the Latin-1 character set ONLY.
|
|
converts a Unicode character to upper case Converts a Unicode character to upper case. In the current revision, this is valid for characters witin the Latin-1 character set ONLY.
|