Drag[en]gine Game Engine
1.21
|
Mutable String. More...
#include <decString.h>
Public Member Functions | |
Constructors and Destructors | |
decString () | |
Create new empty string. More... | |
decString (const char *string) | |
Create new string. More... | |
decString (const decString &string) | |
Create new string being the copy of another string. More... | |
decString (const decString &string1, const decString &string2) | |
Create new string being the concatenation of two other strings. More... | |
decString (const decString &string1, const char *string2) | |
Create new string being the concatenation of two other strings. More... | |
~decString () | |
Clean up string. More... | |
Management | |
bool | IsEmpty () const |
String is empty. More... | |
void | Empty () |
Set string to the empty string. More... | |
int | GetLength () const |
Number of characters. More... | |
int | GetAt (int position) const |
Character at the given position. More... | |
void | SetAt (int position, int character) |
Set character at the given position. More... | |
void | Set (const decString &string) |
Set string from another string. More... | |
void | Set (const char *string) |
Set string from another string. More... | |
void | Set (int character, int count) |
Set string to a run of characters. More... | |
void | SetValue (char value) |
Set string to a char value. More... | |
void | SetValue (unsigned char value) |
Set string to an unsigned char value. More... | |
void | SetValue (short value) |
Set string to a short value. More... | |
void | SetValue (unsigned short value) |
Set string to an unsigned short value. More... | |
void | SetValue (int value) |
Set string to a signed integer value. More... | |
void | SetValue (unsigned int value) |
Set string to an unsigned integer value. More... | |
void | SetValue (float value) |
Set string to a float value. More... | |
void | SetValue (double value) |
Set string to a double value. More... | |
void | Format (const char *format,...) |
Format string using printf style formatting. More... | |
void | FormatUsing (const char *format, va_list args) |
Formats a string using printf style formatting. More... | |
void | Append (const decString &string) |
Appends a string. More... | |
void | Append (const char *string) |
Appends a string. More... | |
void | AppendCharacter (char character) |
Appends a character. More... | |
void | AppendCharacter (unsigned char character) |
void | AppendCharacter (int character) |
void | AppendValue (char value) |
Appends a char value. More... | |
void | AppendValue (unsigned char value) |
Appends an unsigned char value. More... | |
void | AppendValue (short value) |
Appends a short value. More... | |
void | AppendValue (unsigned short value) |
Appends an unsigned short value. More... | |
void | AppendValue (int value) |
Appends a signed integer value. More... | |
void | AppendValue (unsigned int value) |
Appends an unsigned integer value. More... | |
void | AppendValue (float value) |
Appends a float value. More... | |
void | AppendValue (double value) |
Appends a double value. More... | |
void | AppendFormat (const char *format,...) |
Append formatted string using printf style formatting. More... | |
void | AppendFormatUsing (const char *format, va_list args) |
Appends a formatted string using printf style formatting. More... | |
int | Find (int character) const |
Index of first occurance of a character or -1 if not found. More... | |
int | Find (int character, int start) const |
int | Find (int character, int start, int end) const |
int | Find (const char *characters) const |
Index of first occurance of any charatcer in a list of characters or -1 if not found. More... | |
int | Find (const char *characters, int start) const |
int | Find (const char *characters, int start, int end) const |
int | Find (const decString &characters) const |
int | Find (const decString &characters, int start) const |
int | Find (const decString &characters, int start, int end) const |
int | FindReverse (int character) const |
Index of last occurance of a character or -1 if not found. More... | |
int | FindReverse (int character, int start) const |
int | FindReverse (int character, int start, int end) const |
int | FindReverse (const char *characters) const |
Index of last occurance of any character in a list of characters or -1 if not found. More... | |
int | FindReverse (const char *characters, int start) const |
int | FindReverse (const char *characters, int start, int end) const |
int | FindReverse (const decString &characters) const |
int | FindReverse (const decString &characters, int start) const |
int | FindReverse (const decString &characters, int start, int end) const |
int | FindString (const char *string) const |
Index of first occurance of a string or -1 if not found. More... | |
int | FindString (const char *string, int start) const |
int | FindString (const char *string, int start, int end) const |
int | FindString (const decString &string) const |
int | FindString (const decString &string, int start) const |
int | FindString (const decString &string, int start, int end) const |
int | FindStringReverse (const char *string) const |
Index of first occurance of a character from the end to the start or -1 if not found. More... | |
int | FindStringReverse (const char *string, int start) const |
int | FindStringReverse (const char *string, int start, int end) const |
int | FindStringReverse (const decString &string) const |
int | FindStringReverse (const decString &string, int start) const |
int | FindStringReverse (const decString &string, int start, int end) const |
decString | GetLeft (int count) const |
First number of characters. More... | |
decString | GetRight (int count) const |
Last number of characters. More... | |
decString | GetMiddle (int start) const |
Retrieves a sub string. Negative start or end is measured from the string end. More... | |
decString | GetMiddle (int start, int end) const |
void | Reverse () |
Reverse string. More... | |
decString | GetReversed () const |
Retrieve reversed string. More... | |
decStringList | Split (int character) const |
Split string. More... | |
decStringList | Split (const char *characters) const |
Split string on multiple characters. More... | |
decStringList | Split (const decString &characters) const |
void | Replace (int replaceCharacter, int withCharacter) |
Replace all occurances of a character. More... | |
void | Replace (const char *replaceCharacters, int withCharacter) |
Replace all occurances of any character in a list of characters. More... | |
void | Replace (const decString &replaceCharacters, int withCharacter) |
void | ReplaceString (const char *replaceString, const char *withString) |
Replace all occurances of a string. More... | |
void | ReplaceString (const decString &replaceString, const decString &withString) |
decString | GetReplaced (int replaceCharacter, int withCharacter) const |
Retrieves string with all occurances of a character replaced. More... | |
decString | GetReplaced (const char *replaceCharacters, int withCharacter) const |
Retrieves string with all occurances of any character of a list of characters replaced. More... | |
decString | GetReplaced (const decString &replaceCharacters, int withCharacter) const |
decString | GetReplacedString (const char *replaceString, const char *withString) const |
Retrieves string with all occurances of a string replaced. More... | |
decString | GetReplacedString (const decString &replaceString, const decString &withString) const |
void | TrimLeft () |
Removes whitespaces from the beginning. More... | |
decString | GetTrimmedLeft () const |
Retrieves a string with whitespaces removed from the beginning. More... | |
void | TrimRight () |
Removes whitespaces from the end. More... | |
decString | GetTrimmedRight () const |
Retrieves a string with whitespaces removed from the end. More... | |
void | Trim () |
Remove whitespaces from the beginning and end. More... | |
decString | GetTrimmed () const |
Retrieves a string with whitespaces removed from the beginning and end. More... | |
void | ToLower () |
Converts all characters to lower case. More... | |
decString | GetLower () const |
Retrieves string with all characters converted to lower case. More... | |
void | ToUpper () |
Converts all character to upper case. More... | |
decString | GetUpper () const |
Retrieves string with all characters converted to upper case. More... | |
int | ToInt () const |
Retrieves integer value. More... | |
long long | ToLong () const |
Long int value. More... | |
float | ToFloat () const |
Retrieves float value. More... | |
double | ToDouble () const |
Retrieves double value. More... | |
int | ToIntValid () const |
Integer value throwing exception if not valid. More... | |
long long | ToLongValid () const |
Long int value throwing exception if not valid. More... | |
float | ToFloatValid () const |
Float value throwing exception if not valid. More... | |
double | ToDoubleValid () const |
Double value throwing exception if not valid. More... | |
const char * | GetString () const |
Pointer to the text. More... | |
bool | Equals (const decString &string) const |
String equals another string case sensitive. More... | |
bool | Equals (const char *string) const |
String equals another string case sensitive. More... | |
bool | EqualsInsensitive (const decString &string) const |
String equals another string case insensitive. More... | |
bool | EqualsInsensitive (const char *string) const |
String equals another string case insensitive. More... | |
int | Compare (const decString &string) const |
Compares the string to another string case sensitive returns -1(less), 0(equal) or 1(greater). More... | |
int | Compare (const char *string) const |
Compares the string to another string case sensitive returns -1(less), 0(equal) or 1(greater). More... | |
int | CompareInsensitive (const decString &string) const |
Compares the string to another string case insensitive returns -1(less), 0(equal) or 1(greater). More... | |
int | CompareInsensitive (const char *string) const |
Compares the string to another string case insensitive returns -1(less), 0(equal) or 1(greater). More... | |
bool | BeginsWith (const decString &string) const |
Begins with string. More... | |
bool | BeginsWith (const char *string) const |
Begins with string. More... | |
bool | BeginsWithInsensitive (const decString &string) const |
Begins with string. More... | |
bool | BeginsWithInsensitive (const char *string) const |
Begins with string. More... | |
bool | EndsWith (const decString &string) const |
Ends with string. More... | |
bool | EndsWith (const char *string) const |
Ends with string. More... | |
bool | EndsWithInsensitive (const decString &string) const |
Ends with string. More... | |
bool | EndsWithInsensitive (const char *string) const |
Ends with string. More... | |
bool | MatchesPattern (const decString &pattern) const |
Determines if this string matches a given pattern. More... | |
bool | MatchesPattern (const char *pattern) const |
Determines if this string matches a given pattern. More... | |
unsigned int | Hash () const |
Calculate string hash. More... | |
char | operator[] (int position) const |
Retrieves a character. More... | |
char & | operator[] (int position) |
Sets a character. More... | |
bool | operator! () const |
String is empty. More... | |
bool | operator== (const decString &string) const |
String equals another string case sensitive. More... | |
bool | operator== (const char *string) const |
String equals another string case sensitive. More... | |
bool | operator!= (const decString &string) const |
String equals another string case sensitive. More... | |
bool | operator!= (const char *string) const |
String equals another string case sensitive. More... | |
bool | operator< (const decString &string) const |
String is lexographically less than another string case sensitive. More... | |
bool | operator< (const char *string) const |
String is lexographically less than another string case sensitive. More... | |
bool | operator<= (const decString &string) const |
String is lexographically less than or equal to another string case sensitive. More... | |
bool | operator<= (const char *string) const |
String is lexographically less than or equal to another string case sensitive. More... | |
bool | operator> (const decString &string) const |
String is lexographically greater than another string case sensitive. More... | |
bool | operator> (const char *string) const |
String is lexographically greater than another string case sensitive. More... | |
bool | operator>= (const decString &string) const |
String is lexographically greater than or equal to another string case sensitive. More... | |
bool | operator>= (const char *string) const |
String is lexographically greater than or equal to another string case sensitive. More... | |
decString | operator+ (const decString &string) const |
Returns a new string being the concatenation of this string and another string. More... | |
decString | operator+ (const char *string) const |
Returns a new string being the concatenation of this string and another string. More... | |
decString & | operator= (const decString &string) |
Set string to another string. More... | |
decString & | operator= (const char *string) |
Set string to another string. More... | |
decString & | operator+= (const decString &string) |
Appends a string to this string. More... | |
decString & | operator+= (const char *string) |
Appends a string to this string. More... | |
operator const char * () const | |
Character pointer. More... | |
static bool | StringMatchesPattern (const char *string, const char *pattern) |
Determines if a string matches a given pattern. More... | |
static unsigned int | Hash (const char *string) |
Calculate string hash. More... | |
Mutable String.
Stores a 0 terminated, mutable, ASCII character string. This class is designed for storing short strings without large overhead. For this only the string pointer is stored. All operations required to know the length of the string have to calculate it whenever needed. Therefore if you need to do text operations on a larger string use the StringBuffer class instead which stores a string length and can handle 0 characters inside the string.
decString::decString | ( | ) |
Create new empty string.
decString::decString | ( | const char * | string | ) |
Create new string.
decString::decString | ( | const decString & | string | ) |
Create new string being the copy of another string.
Create new string being the concatenation of two other strings.
decString::decString | ( | const decString & | string1, |
const char * | string2 | ||
) |
Create new string being the concatenation of two other strings.
decString::~decString | ( | ) |
Clean up string.
void decString::Append | ( | const char * | string | ) |
Appends a string.
void decString::Append | ( | const decString & | string | ) |
Appends a string.
void decString::AppendCharacter | ( | char | character | ) |
Appends a character.
void decString::AppendCharacter | ( | int | character | ) |
void decString::AppendCharacter | ( | unsigned char | character | ) |
void decString::AppendFormat | ( | const char * | format, |
... | |||
) |
Append formatted string using printf style formatting.
void decString::AppendFormatUsing | ( | const char * | format, |
va_list | args | ||
) |
Appends a formatted string using printf style formatting.
void decString::AppendValue | ( | char | value | ) |
Appends a char value.
void decString::AppendValue | ( | double | value | ) |
Appends a double value.
void decString::AppendValue | ( | float | value | ) |
Appends a float value.
void decString::AppendValue | ( | int | value | ) |
Appends a signed integer value.
void decString::AppendValue | ( | short | value | ) |
Appends a short value.
void decString::AppendValue | ( | unsigned char | value | ) |
Appends an unsigned char value.
void decString::AppendValue | ( | unsigned int | value | ) |
Appends an unsigned integer value.
void decString::AppendValue | ( | unsigned short | value | ) |
Appends an unsigned short value.
bool decString::BeginsWith | ( | const char * | string | ) | const |
Begins with string.
bool decString::BeginsWith | ( | const decString & | string | ) | const |
Begins with string.
bool decString::BeginsWithInsensitive | ( | const char * | string | ) | const |
Begins with string.
bool decString::BeginsWithInsensitive | ( | const decString & | string | ) | const |
Begins with string.
int decString::Compare | ( | const char * | string | ) | const |
Compares the string to another string case sensitive returns -1(less), 0(equal) or 1(greater).
int decString::Compare | ( | const decString & | string | ) | const |
Compares the string to another string case sensitive returns -1(less), 0(equal) or 1(greater).
int decString::CompareInsensitive | ( | const char * | string | ) | const |
Compares the string to another string case insensitive returns -1(less), 0(equal) or 1(greater).
int decString::CompareInsensitive | ( | const decString & | string | ) | const |
Compares the string to another string case insensitive returns -1(less), 0(equal) or 1(greater).
void decString::Empty | ( | ) |
Set string to the empty string.
bool decString::EndsWith | ( | const char * | string | ) | const |
Ends with string.
bool decString::EndsWith | ( | const decString & | string | ) | const |
Ends with string.
bool decString::EndsWithInsensitive | ( | const char * | string | ) | const |
Ends with string.
bool decString::EndsWithInsensitive | ( | const decString & | string | ) | const |
Ends with string.
bool decString::Equals | ( | const char * | string | ) | const |
String equals another string case sensitive.
bool decString::Equals | ( | const decString & | string | ) | const |
String equals another string case sensitive.
bool decString::EqualsInsensitive | ( | const char * | string | ) | const |
String equals another string case insensitive.
bool decString::EqualsInsensitive | ( | const decString & | string | ) | const |
String equals another string case insensitive.
int decString::Find | ( | const char * | characters | ) | const |
Index of first occurance of any charatcer in a list of characters or -1 if not found.
Negative start or end is measured from the string end.
int decString::Find | ( | const char * | characters, |
int | start | ||
) | const |
int decString::Find | ( | const char * | characters, |
int | start, | ||
int | end | ||
) | const |
int decString::Find | ( | const decString & | characters | ) | const |
int decString::Find | ( | const decString & | characters, |
int | start | ||
) | const |
int decString::Find | ( | const decString & | characters, |
int | start, | ||
int | end | ||
) | const |
int decString::Find | ( | int | character | ) | const |
Index of first occurance of a character or -1 if not found.
Negative start or end is measured from the string end.
int decString::Find | ( | int | character, |
int | start | ||
) | const |
int decString::Find | ( | int | character, |
int | start, | ||
int | end | ||
) | const |
int decString::FindReverse | ( | const char * | characters | ) | const |
Index of last occurance of any character in a list of characters or -1 if not found.
Negative start or end is measured from the string end.
int decString::FindReverse | ( | const char * | characters, |
int | start | ||
) | const |
int decString::FindReverse | ( | const char * | characters, |
int | start, | ||
int | end | ||
) | const |
int decString::FindReverse | ( | const decString & | characters | ) | const |
int decString::FindReverse | ( | const decString & | characters, |
int | start | ||
) | const |
int decString::FindReverse | ( | const decString & | characters, |
int | start, | ||
int | end | ||
) | const |
int decString::FindReverse | ( | int | character | ) | const |
Index of last occurance of a character or -1 if not found.
Negative start or end is measured from the string end.
int decString::FindReverse | ( | int | character, |
int | start | ||
) | const |
int decString::FindReverse | ( | int | character, |
int | start, | ||
int | end | ||
) | const |
int decString::FindString | ( | const char * | string | ) | const |
Index of first occurance of a string or -1 if not found.
Negative start or end is measured from the string end.
int decString::FindString | ( | const char * | string, |
int | start | ||
) | const |
int decString::FindString | ( | const char * | string, |
int | start, | ||
int | end | ||
) | const |
int decString::FindString | ( | const decString & | string | ) | const |
int decString::FindString | ( | const decString & | string, |
int | start | ||
) | const |
int decString::FindString | ( | const decString & | string, |
int | start, | ||
int | end | ||
) | const |
int decString::FindStringReverse | ( | const char * | string | ) | const |
Index of first occurance of a character from the end to the start or -1 if not found.
Negative start or end is measured from the string end.
int decString::FindStringReverse | ( | const char * | string, |
int | start | ||
) | const |
int decString::FindStringReverse | ( | const char * | string, |
int | start, | ||
int | end | ||
) | const |
int decString::FindStringReverse | ( | const decString & | string | ) | const |
int decString::FindStringReverse | ( | const decString & | string, |
int | start | ||
) | const |
int decString::FindStringReverse | ( | const decString & | string, |
int | start, | ||
int | end | ||
) | const |
void decString::Format | ( | const char * | format, |
... | |||
) |
Format string using printf style formatting.
void decString::FormatUsing | ( | const char * | format, |
va_list | args | ||
) |
Formats a string using printf style formatting.
int decString::GetAt | ( | int | position | ) | const |
Character at the given position.
decString decString::GetLeft | ( | int | count | ) | const |
First number of characters.
int decString::GetLength | ( | ) | const |
Number of characters.
decString decString::GetLower | ( | ) | const |
Retrieves string with all characters converted to lower case.
decString decString::GetMiddle | ( | int | start | ) | const |
Retrieves a sub string. Negative start or end is measured from the string end.
decString decString::GetMiddle | ( | int | start, |
int | end | ||
) | const |
decString decString::GetReplaced | ( | const char * | replaceCharacters, |
int | withCharacter | ||
) | const |
Retrieves string with all occurances of any character of a list of characters replaced.
decString decString::GetReplaced | ( | int | replaceCharacter, |
int | withCharacter | ||
) | const |
Retrieves string with all occurances of a character replaced.
decString decString::GetReplacedString | ( | const char * | replaceString, |
const char * | withString | ||
) | const |
Retrieves string with all occurances of a string replaced.
decString decString::GetReplacedString | ( | const decString & | replaceString, |
const decString & | withString | ||
) | const |
decString decString::GetReversed | ( | ) | const |
Retrieve reversed string.
decString decString::GetRight | ( | int | count | ) | const |
Last number of characters.
const char* decString::GetString | ( | ) | const |
Pointer to the text.
decString decString::GetTrimmed | ( | ) | const |
Retrieves a string with whitespaces removed from the beginning and end.
decString decString::GetTrimmedLeft | ( | ) | const |
Retrieves a string with whitespaces removed from the beginning.
decString decString::GetTrimmedRight | ( | ) | const |
Retrieves a string with whitespaces removed from the end.
decString decString::GetUpper | ( | ) | const |
Retrieves string with all characters converted to upper case.
unsigned int decString::Hash | ( | ) | const |
Calculate string hash.
|
static |
Calculate string hash.
bool decString::IsEmpty | ( | ) | const |
String is empty.
bool decString::MatchesPattern | ( | const char * | pattern | ) | const |
Determines if this string matches a given pattern.
bool decString::MatchesPattern | ( | const decString & | pattern | ) | const |
Determines if this string matches a given pattern.
decString::operator const char * | ( | ) | const |
Character pointer.
bool decString::operator! | ( | ) | const |
String is empty.
bool decString::operator!= | ( | const char * | string | ) | const |
String equals another string case sensitive.
bool decString::operator!= | ( | const decString & | string | ) | const |
String equals another string case sensitive.
decString decString::operator+ | ( | const char * | string | ) | const |
Returns a new string being the concatenation of this string and another string.
Returns a new string being the concatenation of this string and another string.
decString& decString::operator+= | ( | const char * | string | ) |
Appends a string to this string.
bool decString::operator< | ( | const char * | string | ) | const |
String is lexographically less than another string case sensitive.
bool decString::operator< | ( | const decString & | string | ) | const |
String is lexographically less than another string case sensitive.
bool decString::operator<= | ( | const char * | string | ) | const |
String is lexographically less than or equal to another string case sensitive.
bool decString::operator<= | ( | const decString & | string | ) | const |
String is lexographically less than or equal to another string case sensitive.
decString& decString::operator= | ( | const char * | string | ) |
Set string to another string.
bool decString::operator== | ( | const char * | string | ) | const |
String equals another string case sensitive.
bool decString::operator== | ( | const decString & | string | ) | const |
String equals another string case sensitive.
bool decString::operator> | ( | const char * | string | ) | const |
String is lexographically greater than another string case sensitive.
bool decString::operator> | ( | const decString & | string | ) | const |
String is lexographically greater than another string case sensitive.
bool decString::operator>= | ( | const char * | string | ) | const |
String is lexographically greater than or equal to another string case sensitive.
bool decString::operator>= | ( | const decString & | string | ) | const |
String is lexographically greater than or equal to another string case sensitive.
char& decString::operator[] | ( | int | position | ) |
Sets a character.
char decString::operator[] | ( | int | position | ) | const |
Retrieves a character.
void decString::Replace | ( | const char * | replaceCharacters, |
int | withCharacter | ||
) |
Replace all occurances of any character in a list of characters.
void decString::Replace | ( | const decString & | replaceCharacters, |
int | withCharacter | ||
) |
void decString::Replace | ( | int | replaceCharacter, |
int | withCharacter | ||
) |
Replace all occurances of a character.
void decString::ReplaceString | ( | const char * | replaceString, |
const char * | withString | ||
) |
Replace all occurances of a string.
void decString::Reverse | ( | ) |
Reverse string.
void decString::Set | ( | const char * | string | ) |
Set string from another string.
void decString::Set | ( | const decString & | string | ) |
Set string from another string.
void decString::Set | ( | int | character, |
int | count | ||
) |
Set string to a run of characters.
void decString::SetAt | ( | int | position, |
int | character | ||
) |
Set character at the given position.
void decString::SetValue | ( | char | value | ) |
Set string to a char value.
void decString::SetValue | ( | double | value | ) |
Set string to a double value.
void decString::SetValue | ( | float | value | ) |
Set string to a float value.
void decString::SetValue | ( | int | value | ) |
Set string to a signed integer value.
void decString::SetValue | ( | short | value | ) |
Set string to a short value.
void decString::SetValue | ( | unsigned char | value | ) |
Set string to an unsigned char value.
void decString::SetValue | ( | unsigned int | value | ) |
Set string to an unsigned integer value.
void decString::SetValue | ( | unsigned short | value | ) |
Set string to an unsigned short value.
decStringList decString::Split | ( | const char * | characters | ) | const |
Split string on multiple characters.
decStringList decString::Split | ( | const decString & | characters | ) | const |
decStringList decString::Split | ( | int | character | ) | const |
Split string.
|
static |
Determines if a string matches a given pattern.
double decString::ToDouble | ( | ) | const |
Retrieves double value.
double decString::ToDoubleValid | ( | ) | const |
Double value throwing exception if not valid.
float decString::ToFloat | ( | ) | const |
Retrieves float value.
float decString::ToFloatValid | ( | ) | const |
Float value throwing exception if not valid.
int decString::ToInt | ( | ) | const |
Retrieves integer value.
int decString::ToIntValid | ( | ) | const |
Integer value throwing exception if not valid.
long long decString::ToLong | ( | ) | const |
Long int value.
long long decString::ToLongValid | ( | ) | const |
Long int value throwing exception if not valid.
void decString::ToLower | ( | ) |
Converts all characters to lower case.
void decString::ToUpper | ( | ) |
Converts all character to upper case.
void decString::Trim | ( | ) |
Remove whitespaces from the beginning and end.
void decString::TrimLeft | ( | ) |
Removes whitespaces from the beginning.
void decString::TrimRight | ( | ) |
Removes whitespaces from the end.