Gel2D - The free/open source game creation suite

Public Member Functions | Related Functions
gel::GelString Class Reference

ASCII string. More...

#include <gelString.h>

List of all members.

Public Member Functions

 GelString ()
 Default constructor.
 GelString (GelChar ch)
 GelChar constructor.
 GelString (const GelString &string)
 GelString constructor.
 GelString (const char *str)
 C string constructor.
 ~GelString ()
 Destructor.
void append (const GelString &str)
 Appends a GelString to this string.
void append (const char *str)
 Appends an 8-bit C string to this string.
void append (GelChar ch)
 Appends a GelChar to this string.
void append (char ch)
 Appends an 8-bit character to this string.
void prepend (const GelString &str)
 Prepends a GelString to this string.
void prepend (const char *str)
 Prepends an 8-bit C string to this string.
void prepend (GelChar ch)
 Prepends a GelChar to this string.
void prepend (char ch)
 Prepends an 8-bit character to this string.
void insert (const GelString &str, int pos)
 Inserts a GelString into this string.
void insert (GelChar ch, int pos)
 Inserts a GelChar into this string.
void clear ()
 Clears the contents of the string.
void resize (int size)
 Resizes the string's length.
void remove (int pos, int num)
 Removes a section of the string.
void remove (const GelString &str)
 Removes every occurence of a string.
void remove (GelChar ch)
 Removes every occurence of a character.
void replace (GelChar before, GelChar after)
 Replaces every occurence of a character with another character.
void replace (const GelString &before, const GelString &after)
 Replaces every occurence of a string with another string.
void truncate (int pos)
 Truncates the string at a given position.
int findFirst (const GelString &str) const
 Finds the first occurence of a given string.
int findFirst (GelChar ch) const
 Finds the first occurence of a given character.
int findLast (const GelString &str) const
 Finds the last occurence of a given string.
int findLast (GelChar ch) const
 Finds the last occurence of a given character.
int findNext (const GelString &str, int pos) const
 Finds the next occurence of a given string.
int findNext (GelChar ch, int pos) const
 Finds the next occurence of a given character.
int count (const GelString &str) const
 Counts the number of occurences of a given string.
int count (GelChar ch) const
 Counts the number of occurences of a given character.
int compare (const GelString &str) const
 Compares a string with this string.
void makeLower ()
 Makes all letters in the string lowercase.
void makeUpper ()
 Makes all letters in the string uppercase.
GelString subString (int start, int length) const
 Returns a section of this string.
GelCString toAscii () const
 Converts the GelString to an 8-bit C string.
void fromAscii (const char *str)
 Converts an 8-bit C string to a GelString.
int getLength () const
 Gets the number of characters in the string.
GelChargetData ()
 Gets a pointer to the string data.
const GelChargetData () const
 Gets a pointer to the string data.
GelStringoperator= (GelChar ch)
 Assigns a GelChar to this string.
GelStringoperator= (const GelString &s)
 Assigns a GelString to this string.
GelStringoperator= (const char *s)
 Assigns an 8-bit C string to this string.
GelStringoperator+= (const GelString &s)
 Appends a GelString to this string.
GelStringoperator+= (const char *s)
 Appends an 8-bit C string to this string.
GelStringoperator+= (GelChar c)
 Appends a GelChar to this string.
GelStringoperator+= (char c)
 Appends an 8-bit character to this string.
GelString operator+ (GelChar ch) const
 Concatenates a GelChar and this string.
GelString operator+ (const GelString &s) const
 Concatenates two GelStrings.
GelString operator+ (const char *s) const
 Concatenates an 8-bit C string and this string.
GelCharoperator[] (int i)
 Gets a reference to the character at the specified index.
const GelCharoperator[] (int i) const
 Gets a reference to the character at the specified index.

Related Functions

(Note that these are not member functions.)

GelString operator+ (GelChar ch, const GelString &s)
 Concatenates a GelChar and a GelString.
GelString operator+ (const char *s1, const GelString &s2)
 Concatenates an 8-bit C string and a GelString.

Detailed Description

ASCII string.


Constructor & Destructor Documentation

gel::GelString::GelString ( )

Default constructor.

gel::GelString::GelString ( GelChar  ch)

GelChar constructor.

gel::GelString::GelString ( const GelString string)

GelString constructor.

gel::GelString::GelString ( const char *  str)

C string constructor.

Parameters:
str: An 8-bit C string.
gel::GelString::~GelString ( ) [inline]

Destructor.


Member Function Documentation

void gel::GelString::append ( const GelString str)

Appends a GelString to this string.

See also:
operator+=()
void gel::GelString::append ( const char *  str)

Appends an 8-bit C string to this string.

void gel::GelString::append ( GelChar  ch)

Appends a GelChar to this string.

void gel::GelString::append ( char  ch)

Appends an 8-bit character to this string.

void gel::GelString::prepend ( const GelString str)

Prepends a GelString to this string.

See also:
operator+=()
void gel::GelString::prepend ( const char *  str)

Prepends an 8-bit C string to this string.

void gel::GelString::prepend ( GelChar  ch)

Prepends a GelChar to this string.

void gel::GelString::prepend ( char  ch)

Prepends an 8-bit character to this string.

void gel::GelString::insert ( const GelString str,
int  pos 
)

Inserts a GelString into this string.

void gel::GelString::insert ( GelChar  ch,
int  pos 
)

Inserts a GelChar into this string.

void gel::GelString::clear ( )

Clears the contents of the string.

void gel::GelString::resize ( int  size)

Resizes the string's length.

Parameters:
size: The new length of the string.
void gel::GelString::remove ( int  pos,
int  num 
)

Removes a section of the string.

Parameters:
pos: The position to start removing characters.
num: The number of characters to remove.
void gel::GelString::remove ( const GelString str)

Removes every occurence of a string.

Parameters:
str: The string to remove from this string.
void gel::GelString::remove ( GelChar  ch)

Removes every occurence of a character.

Parameters:
ch: The character to remove from the string.
void gel::GelString::replace ( GelChar  before,
GelChar  after 
)

Replaces every occurence of a character with another character.

void gel::GelString::replace ( const GelString before,
const GelString after 
)

Replaces every occurence of a string with another string.

Warning:
This function does not work properly! Do not use it.
void gel::GelString::truncate ( int  pos)

Truncates the string at a given position.

Parameters:
pos: The position relative to the start of the string to truncate.
int gel::GelString::findFirst ( const GelString str) const

Finds the first occurence of a given string.

If the string cannot be found in this string, the function will return -1.

Parameters:
str: The string to search for.
Returns:
The index of the first occurence of str.
int gel::GelString::findFirst ( GelChar  ch) const

Finds the first occurence of a given character.

If the character cannot be found in this string, the function will return -1.

Parameters:
ch: The character to search for.
Returns:
The index of the first occurence of ch.
int gel::GelString::findLast ( const GelString str) const

Finds the last occurence of a given string.

If the string cannot be found in this string, the function will return -1.

Parameters:
str: The string to search for.
Returns:
The index of the last occurence of str.
int gel::GelString::findLast ( GelChar  ch) const

Finds the last occurence of a given character.

If the character cannot be found in this string, the function will return -1.

Parameters:
ch: The character to search for.
Returns:
The index of the last occurence of ch.
int gel::GelString::findNext ( const GelString str,
int  pos 
) const

Finds the next occurence of a given string.

If the string cannot be found in this string, the function will return -1.

Parameters:
str: The string to search for.
pos: The position to start searching.
Returns:
The index of the last occurence of str.
int gel::GelString::findNext ( GelChar  ch,
int  pos 
) const

Finds the next occurence of a given character.

If the character cannot be found in this string, the function will return -1.

Parameters:
ch: The character to search for.
pos: The position to start searching.
Returns:
The index of the last occurence of ch.
int gel::GelString::count ( const GelString str) const

Counts the number of occurences of a given string.

Parameters:
str: The string to search for.
Returns:
The number of times str occures in this string.
int gel::GelString::count ( GelChar  ch) const

Counts the number of occurences of a given character.

Parameters:
ch: The character to search for.
Returns:
The number of times ch occures in this string.
int gel::GelString::compare ( const GelString str) const

Compares a string with this string.

Parameters:
str: The string to compare with this string.
Returns:
A number less than, equal to, or greater than 0 if this string is less than, equal to, or greater than the other string, respectively.
void gel::GelString::makeLower ( )

Makes all letters in the string lowercase.

void gel::GelString::makeUpper ( )

Makes all letters in the string uppercase.

GelString gel::GelString::subString ( int  start,
int  length 
) const

Returns a section of this string.

Parameters:
start: The position to start sectioning.
length: The number of characters to copy.
GelCString gel::GelString::toAscii ( ) const

Converts the GelString to an 8-bit C string.

Returns:
GelCString containing the ASCII string.
void gel::GelString::fromAscii ( const char *  str)

Converts an 8-bit C string to a GelString.

int gel::GelString::getLength ( ) const [inline]

Gets the number of characters in the string.

Returns:
The length of the string.
GelChar* gel::GelString::getData ( ) [inline]

Gets a pointer to the string data.

Returns:
A pointer to the GelChar array.
const GelChar* gel::GelString::getData ( ) const [inline]

Gets a pointer to the string data.

This is an overloaded function.

GelString& gel::GelString::operator= ( GelChar  ch)

Assigns a GelChar to this string.

GelString& gel::GelString::operator= ( const GelString s)

Assigns a GelString to this string.

GelString& gel::GelString::operator= ( const char *  s)

Assigns an 8-bit C string to this string.

GelString& gel::GelString::operator+= ( const GelString s) [inline]

Appends a GelString to this string.

See also:
append()
GelString& gel::GelString::operator+= ( const char *  s) [inline]

Appends an 8-bit C string to this string.

GelString& gel::GelString::operator+= ( GelChar  c) [inline]

Appends a GelChar to this string.

GelString& gel::GelString::operator+= ( char  c) [inline]

Appends an 8-bit character to this string.

GelString gel::GelString::operator+ ( GelChar  ch) const [inline]

Concatenates a GelChar and this string.

GelString gel::GelString::operator+ ( const GelString s) const [inline]

Concatenates two GelStrings.

GelString gel::GelString::operator+ ( const char *  s) const [inline]

Concatenates an 8-bit C string and this string.

GelChar& gel::GelString::operator[] ( int  i) [inline]

Gets a reference to the character at the specified index.

const GelChar& gel::GelString::operator[] ( int  i) const [inline]

Gets a reference to the character at the specified index.

This is an overloaded function.


Friends And Related Function Documentation

GelString operator+ ( GelChar  ch,
const GelString s 
) [related]

Concatenates a GelChar and a GelString.

GelString operator+ ( const char *  s1,
const GelString s2 
) [related]

Concatenates an 8-bit C string and a GelString.


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