Drag[en]gine Game Engine  1.0
decString Class Reference

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. More...

#include <decString.h>

Public Member Functions

Constructors and Destructors
 decString ()
 
 decString (const char *string)
 
 decString (const decString &string)
 
 decString (const decString &string1, const decString &string2)
 
 decString (const decString &string1, const char *string2)
 
 ~decString ()
 

Management

bool IsEmpty () const
 
void Empty ()
 
int GetLength () const
 
int GetAt (int position) const
 
void SetAt (int position, int character)
 
void Set (const decString &string)
 
void Set (const char *string)
 
void Set (int character, int count)
 
void SetValue (char value)
 
void SetValue (unsigned char value)
 
void SetValue (short value)
 
void SetValue (unsigned short value)
 
void SetValue (int value)
 
void SetValue (unsigned int value)
 
void SetValue (float value)
 
void SetValue (double value)
 
void Format (const char *format,...)
 
void FormatUsing (const char *format, va_list args)
 
void Append (const decString &string)
 
void Append (const char *string)
 
void AppendCharacter (char character)
 
void AppendCharacter (unsigned char character)
 
void AppendCharacter (int character)
 
void AppendValue (char value)
 
void AppendValue (unsigned char value)
 
void AppendValue (short value)
 
void AppendValue (unsigned short value)
 
void AppendValue (int value)
 
void AppendValue (unsigned int value)
 
void AppendValue (float value)
 
void AppendValue (double value)
 
void AppendFormat (const char *format,...)
 
void AppendFormatUsing (const char *format, va_list args)
 
int Find (int character) const
 
int Find (int character, int start) const
 
int Find (int character, int start, int end) const
 
int Find (const char *characters) const
 
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
 
int FindReverse (int character, int start) const
 
int FindReverse (int character, int start, int end) const
 
int FindReverse (const char *characters) const
 
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
 
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
 
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
 
decString GetRight (int count) const
 
decString GetMiddle (int start) const
 
decString GetMiddle (int start, int end) const
 
void Reverse ()
 
decString GetReversed () const
 
decStringList Split (int character) const
 
decStringList Split (const char *characters) const
 
decStringList Split (const decString &characters) const
 
void Replace (int replaceCharacter, int withCharacter)
 
void Replace (const char *replaceCharacters, int withCharacter)
 
void Replace (const decString &replaceCharacters, int withCharacter)
 
void ReplaceString (const char *replaceString, const char *withString)
 
void ReplaceString (const decString &replaceString, const decString &withString)
 
decString GetReplaced (int replaceCharacter, int withCharacter) const
 
decString GetReplaced (const char *replaceCharacters, int withCharacter) const
 
decString GetReplaced (const decString &replaceCharacters, int withCharacter) const
 
decString GetReplacedString (const char *replaceString, const char *withString) const
 
decString GetReplacedString (const decString &replaceString, const decString &withString) const
 
void TrimLeft ()
 
decString GetTrimmedLeft () const
 
void TrimRight ()
 
decString GetTrimmedRight () const
 
void Trim ()
 
decString GetTrimmed () const
 
void ToLower ()
 
decString GetLower () const
 
void ToUpper ()
 
decString GetUpper () const
 
int ToInt () const
 
long long ToLong () const
 
float ToFloat () const
 
double ToDouble () const
 
const char * GetString () const
 
bool Equals (const decString &string) const
 
bool Equals (const char *string) const
 
bool EqualsInsensitive (const decString &string) const
 
bool EqualsInsensitive (const char *string) const
 
int Compare (const decString &string) const
 
int Compare (const char *string) const
 
int CompareInsensitive (const decString &string) const
 
int CompareInsensitive (const char *string) const
 
bool MatchesPattern (const decString &pattern) const
 
bool MatchesPattern (const char *pattern) const
 
unsigned int Hash () const
 Calculate string hash. More...
 
char operator[] (int position) const
 
char & operator[] (int position)
 
bool operator! () const
 
bool operator== (const decString &string) const
 
bool operator== (const char *string) const
 
bool operator!= (const decString &string) const
 
bool operator!= (const char *string) const
 
bool operator< (const decString &string) const
 
bool operator< (const char *string) const
 
bool operator<= (const decString &string) const
 
bool operator<= (const char *string) const
 
bool operator> (const decString &string) const
 
bool operator> (const char *string) const
 
bool operator>= (const decString &string) const
 
bool operator>= (const char *string) const
 
decString operator+ (const decString &string) const
 
decString operator+ (const char *string) const
 
decStringoperator= (const decString &string)
 
decStringoperator= (const char *string)
 
decStringoperator+= (const decString &string)
 
decStringoperator+= (const char *string)
 
 operator const char * () const
 
static bool StringMatchesPattern (const char *string, const char *pattern)
 
static unsigned int Hash (const char *string)
 Calculate string hash. More...
 

Detailed Description

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.

Author
Pl├╝ss Roland
Version
1.0
Date
2010

Constructor & Destructor Documentation

◆ decString() [1/5]

decString::decString ( )

Creates a new empty string.

◆ decString() [2/5]

decString::decString ( const char *  string)

Creates a new string.

◆ decString() [3/5]

decString::decString ( const decString string)

Creates a new string being the copy of another string.

◆ decString() [4/5]

decString::decString ( const decString string1,
const decString string2 
)

Creates a new string being the concatenation of two other strings.

◆ decString() [5/5]

decString::decString ( const decString string1,
const char *  string2 
)

Creates a new string being the concatenation of two other strings.

◆ ~decString()

decString::~decString ( )

Cleans up the string.

Member Function Documentation

◆ Append() [1/2]

void decString::Append ( const decString string)

Appends a string.

◆ Append() [2/2]

void decString::Append ( const char *  string)

Appends a string.

◆ AppendCharacter() [1/3]

void decString::AppendCharacter ( char  character)

Appends a character.

◆ AppendCharacter() [2/3]

void decString::AppendCharacter ( unsigned char  character)

◆ AppendCharacter() [3/3]

void decString::AppendCharacter ( int  character)

◆ AppendFormat()

void decString::AppendFormat ( const char *  format,
  ... 
)

Appends a formatted string using printf style formatting.

◆ AppendFormatUsing()

void decString::AppendFormatUsing ( const char *  format,
va_list  args 
)

Appends a formatted string using printf style formatting.

◆ AppendValue() [1/8]

void decString::AppendValue ( char  value)

Appends a char value.

◆ AppendValue() [2/8]

void decString::AppendValue ( unsigned char  value)

Appends an unsigned char value.

◆ AppendValue() [3/8]

void decString::AppendValue ( short  value)

Appends a short value.

◆ AppendValue() [4/8]

void decString::AppendValue ( unsigned short  value)

Appends an unsigned short value.

◆ AppendValue() [5/8]

void decString::AppendValue ( int  value)

Appends a signed integer value.

◆ AppendValue() [6/8]

void decString::AppendValue ( unsigned int  value)

Appends an unsigned integer value.

◆ AppendValue() [7/8]

void decString::AppendValue ( float  value)

Appends a float value.

◆ AppendValue() [8/8]

void decString::AppendValue ( double  value)

Appends a double value.

◆ Compare() [1/2]

int decString::Compare ( const decString string) const

Compares the string to another string case sensitive returns -1(less), 0(equal) or 1(greater).

◆ Compare() [2/2]

int decString::Compare ( const char *  string) const

Compares the string to another string case sensitive returns -1(less), 0(equal) or 1(greater).

◆ CompareInsensitive() [1/2]

int decString::CompareInsensitive ( const decString string) const

Compares the string to another string case insensitive returns -1(less), 0(equal) or 1(greater).

◆ CompareInsensitive() [2/2]

int decString::CompareInsensitive ( const char *  string) const

Compares the string to another string case insensitive returns -1(less), 0(equal) or 1(greater).

◆ Empty()

void decString::Empty ( )

Sets the string to the empty string.

◆ Equals() [1/2]

bool decString::Equals ( const decString string) const

Determines if the string equals another string case sensitive.

◆ Equals() [2/2]

bool decString::Equals ( const char *  string) const

Determines if the string equals another string case sensitive.

◆ EqualsInsensitive() [1/2]

bool decString::EqualsInsensitive ( const decString string) const

Determines if the string equals another string case insensitive.

◆ EqualsInsensitive() [2/2]

bool decString::EqualsInsensitive ( const char *  string) const

Determines if the string equals another string case insensitive.

◆ Find() [1/9]

int decString::Find ( int  character) const

Retrieve index of first occurance of a character or -1 if not found. Negative start or end is measured from the string end.

◆ Find() [2/9]

int decString::Find ( int  character,
int  start 
) const

◆ Find() [3/9]

int decString::Find ( int  character,
int  start,
int  end 
) const

◆ Find() [4/9]

int decString::Find ( const char *  characters) const

Retrieve 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.

◆ Find() [5/9]

int decString::Find ( const char *  characters,
int  start 
) const

◆ Find() [6/9]

int decString::Find ( const char *  characters,
int  start,
int  end 
) const

◆ Find() [7/9]

int decString::Find ( const decString characters) const

◆ Find() [8/9]

int decString::Find ( const decString characters,
int  start 
) const

◆ Find() [9/9]

int decString::Find ( const decString characters,
int  start,
int  end 
) const

◆ FindReverse() [1/9]

int decString::FindReverse ( int  character) const

Retrieve index of last occurance of a character or -1 if not found. Negative start or end is measured from the string end.

◆ FindReverse() [2/9]

int decString::FindReverse ( int  character,
int  start 
) const

◆ FindReverse() [3/9]

int decString::FindReverse ( int  character,
int  start,
int  end 
) const

◆ FindReverse() [4/9]

int decString::FindReverse ( const char *  characters) const

Retrieve 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.

◆ FindReverse() [5/9]

int decString::FindReverse ( const char *  characters,
int  start 
) const

◆ FindReverse() [6/9]

int decString::FindReverse ( const char *  characters,
int  start,
int  end 
) const

◆ FindReverse() [7/9]

int decString::FindReverse ( const decString characters) const

◆ FindReverse() [8/9]

int decString::FindReverse ( const decString characters,
int  start 
) const

◆ FindReverse() [9/9]

int decString::FindReverse ( const decString characters,
int  start,
int  end 
) const

◆ FindString() [1/6]

int decString::FindString ( const char *  string) const

Retrieve index of first occurance of a string or -1 if not found. Negative start or end is measured from the string end.

◆ FindString() [2/6]

int decString::FindString ( const char *  string,
int  start 
) const

◆ FindString() [3/6]

int decString::FindString ( const char *  string,
int  start,
int  end 
) const

◆ FindString() [4/6]

int decString::FindString ( const decString string) const

◆ FindString() [5/6]

int decString::FindString ( const decString string,
int  start 
) const

◆ FindString() [6/6]

int decString::FindString ( const decString string,
int  start,
int  end 
) const

◆ FindStringReverse() [1/6]

int decString::FindStringReverse ( const char *  string) const

Retrieve 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.

◆ FindStringReverse() [2/6]

int decString::FindStringReverse ( const char *  string,
int  start 
) const

◆ FindStringReverse() [3/6]

int decString::FindStringReverse ( const char *  string,
int  start,
int  end 
) const

◆ FindStringReverse() [4/6]

int decString::FindStringReverse ( const decString string) const

◆ FindStringReverse() [5/6]

int decString::FindStringReverse ( const decString string,
int  start 
) const

◆ FindStringReverse() [6/6]

int decString::FindStringReverse ( const decString string,
int  start,
int  end 
) const

◆ Format()

void decString::Format ( const char *  format,
  ... 
)

Formats a string using printf style formatting.

◆ FormatUsing()

void decString::FormatUsing ( const char *  format,
va_list  args 
)

Formats a string using printf style formatting.

◆ GetAt()

int decString::GetAt ( int  position) const

Retrieves the character at the given position.

◆ GetLeft()

decString decString::GetLeft ( int  count) const

Retrieves the first number of characters.

◆ GetLength()

int decString::GetLength ( ) const

Retrieves the number of characters.

◆ GetLower()

decString decString::GetLower ( ) const

Retrieves string with all characters converted to lower case.

◆ GetMiddle() [1/2]

decString decString::GetMiddle ( int  start) const

Retrieves a sub string. Negative start or end is measured from the string end.

◆ GetMiddle() [2/2]

decString decString::GetMiddle ( int  start,
int  end 
) const

◆ GetReplaced() [1/3]

decString decString::GetReplaced ( int  replaceCharacter,
int  withCharacter 
) const

Retrieves string with all occurances of a character replaced.

◆ GetReplaced() [2/3]

decString decString::GetReplaced ( const char *  replaceCharacters,
int  withCharacter 
) const

Retrieves string with all occurances of any character of a list of characters replaced.

◆ GetReplaced() [3/3]

decString decString::GetReplaced ( const decString replaceCharacters,
int  withCharacter 
) const

◆ GetReplacedString() [1/2]

decString decString::GetReplacedString ( const char *  replaceString,
const char *  withString 
) const

Retrieves string with all occurances of a string replaced.

◆ GetReplacedString() [2/2]

decString decString::GetReplacedString ( const decString replaceString,
const decString withString 
) const

◆ GetReversed()

decString decString::GetReversed ( ) const

Retrieve reversed string.

◆ GetRight()

decString decString::GetRight ( int  count) const

Retrieves the last number of characters.

◆ GetString()

const char* decString::GetString ( ) const

Retrieves the pointer to the text.

◆ GetTrimmed()

decString decString::GetTrimmed ( ) const

Retrieves a string with whitespaces removed from the beginning and end.

◆ GetTrimmedLeft()

decString decString::GetTrimmedLeft ( ) const

Retrieves a string with whitespaces removed from the beginning.

◆ GetTrimmedRight()

decString decString::GetTrimmedRight ( ) const

Retrieves a string with whitespaces removed from the end.

◆ GetUpper()

decString decString::GetUpper ( ) const

Retrieves string with all characters converted to upper case.

◆ Hash() [1/2]

unsigned int decString::Hash ( ) const

Calculate string hash.

◆ Hash() [2/2]

static unsigned int decString::Hash ( const char *  string)
static

Calculate string hash.

◆ IsEmpty()

bool decString::IsEmpty ( ) const

Determines if the string is empty.

◆ MatchesPattern() [1/2]

bool decString::MatchesPattern ( const decString pattern) const

Determines if this string matches a given pattern.

◆ MatchesPattern() [2/2]

bool decString::MatchesPattern ( const char *  pattern) const

Determines if this string matches a given pattern.

◆ operator const char *()

decString::operator const char * ( ) const

Retrieves the character pointer.

◆ operator!()

bool decString::operator! ( ) const

Determines if the string is empty.

◆ operator!=() [1/2]

bool decString::operator!= ( const decString string) const

Determines if the string equals another string case sensitive.

◆ operator!=() [2/2]

bool decString::operator!= ( const char *  string) const

Determines if the string equals another string case sensitive.

◆ operator+() [1/2]

decString decString::operator+ ( const decString string) const

Returns a new string being the concatenation of this string and another string.

◆ operator+() [2/2]

decString decString::operator+ ( const char *  string) const

Returns a new string being the concatenation of this string and another string.

◆ operator+=() [1/2]

decString& decString::operator+= ( const decString string)

Appends a string to this string.

◆ operator+=() [2/2]

decString& decString::operator+= ( const char *  string)

Appends a string to this string.

◆ operator<() [1/2]

bool decString::operator< ( const decString string) const

Determines if the string is lexographically less than another string case sensitive.

◆ operator<() [2/2]

bool decString::operator< ( const char *  string) const

Determines if the string is lexographically less than another string case sensitive.

◆ operator<=() [1/2]

bool decString::operator<= ( const decString string) const

Determines if the string is lexographically less than or equal to another string case sensitive.

◆ operator<=() [2/2]

bool decString::operator<= ( const char *  string) const

Determines if the string is lexographically less than or equal to another string case sensitive.

◆ operator=() [1/2]

decString& decString::operator= ( const decString string)

Sets the string to another string.

◆ operator=() [2/2]

decString& decString::operator= ( const char *  string)

Sets the string to another string.

◆ operator==() [1/2]

bool decString::operator== ( const decString string) const

Determines if the string equals another string case sensitive.

◆ operator==() [2/2]

bool decString::operator== ( const char *  string) const

Determines if the string equals another string case sensitive.

◆ operator>() [1/2]

bool decString::operator> ( const decString string) const

Determines if the string is lexographically greater than another string case sensitive.

◆ operator>() [2/2]

bool decString::operator> ( const char *  string) const

Determines if the string is lexographically greater than another string case sensitive.

◆ operator>=() [1/2]

bool decString::operator>= ( const decString string) const

Determines if the string is lexographically greater than or equal to another string case sensitive.

◆ operator>=() [2/2]

bool decString::operator>= ( const char *  string) const

Determines if the string is lexographically greater than or equal to another string case sensitive.

◆ operator[]() [1/2]

char decString::operator[] ( int  position) const

Retrieves a character.

◆ operator[]() [2/2]

char& decString::operator[] ( int  position)

Sets a character.

◆ Replace() [1/3]

void decString::Replace ( int  replaceCharacter,
int  withCharacter 
)

Replace all occurances of a character.

◆ Replace() [2/3]

void decString::Replace ( const char *  replaceCharacters,
int  withCharacter 
)

Replace all occurances of any character in a list of characters.

◆ Replace() [3/3]

void decString::Replace ( const decString replaceCharacters,
int  withCharacter 
)

◆ ReplaceString() [1/2]

void decString::ReplaceString ( const char *  replaceString,
const char *  withString 
)

Replace all occurances of a string.

◆ ReplaceString() [2/2]

void decString::ReplaceString ( const decString replaceString,
const decString withString 
)

◆ Reverse()

void decString::Reverse ( )

Reverse string.

◆ Set() [1/3]

void decString::Set ( const decString string)

Sets the string from another string.

◆ Set() [2/3]

void decString::Set ( const char *  string)

Sets the string from another string.

◆ Set() [3/3]

void decString::Set ( int  character,
int  count 
)

Sets the string to a run of characters.

◆ SetAt()

void decString::SetAt ( int  position,
int  character 
)

Sets the character at the given position.

◆ SetValue() [1/8]

void decString::SetValue ( char  value)

Set string to a char value.

◆ SetValue() [2/8]

void decString::SetValue ( unsigned char  value)

Set string to an unsigned char value.

◆ SetValue() [3/8]

void decString::SetValue ( short  value)

Set string to a short value.

◆ SetValue() [4/8]

void decString::SetValue ( unsigned short  value)

Set string to an unsigned short value.

◆ SetValue() [5/8]

void decString::SetValue ( int  value)

Set string to a signed integer value.

◆ SetValue() [6/8]

void decString::SetValue ( unsigned int  value)

Set string to an unsigned integer value.

◆ SetValue() [7/8]

void decString::SetValue ( float  value)

Set string to a float value.

◆ SetValue() [8/8]

void decString::SetValue ( double  value)

Set string to a double value.

◆ Split() [1/3]

decStringList decString::Split ( int  character) const

Split string.

◆ Split() [2/3]

decStringList decString::Split ( const char *  characters) const

Split string on multiple characters.

◆ Split() [3/3]

decStringList decString::Split ( const decString characters) const

◆ StringMatchesPattern()

static bool decString::StringMatchesPattern ( const char *  string,
const char *  pattern 
)
static

Determines if a string matches a given pattern.

◆ ToDouble()

double decString::ToDouble ( ) const

Retrieves double value.

◆ ToFloat()

float decString::ToFloat ( ) const

Retrieves float value.

◆ ToInt()

int decString::ToInt ( ) const

Retrieves integer value.

◆ ToLong()

long long decString::ToLong ( ) const

Retrieves the long int value.

◆ ToLower()

void decString::ToLower ( )

Converts all characters to lower case.

◆ ToUpper()

void decString::ToUpper ( )

Converts all character to upper case.

◆ Trim()

void decString::Trim ( )

Remove whitespaces from the beginning and end.

◆ TrimLeft()

void decString::TrimLeft ( )

Removes whitespaces from the beginning.

◆ TrimRight()

void decString::TrimRight ( )

Removes whitespaces from the end.


The documentation for this class was generated from the following file: