WoopsiUI::WoopsiString Class Reference
#include <woopsistring.h>
List of all members.
Detailed Description
Yet another string class. Where possible, the string avoids allocating memory each time the string grows or shrinks. This means that the string may consume more memory than the number of chars would seem to dictate if the object previously contained a large string that has subsequently been truncated. It also means that increasing the length of such a string is a cheaper operation as memory does not need to allocated and copied.
Additionally, the string increases its array size by _growAmount every time it needs to allocate extra memory, potentially reducing the number of reallocs needed.
Constructor & Destructor Documentation
WoopsiString::WoopsiString |
( |
|
) |
|
Constructor to create a blank object.
WoopsiString::WoopsiString |
( |
const char * |
text |
) |
|
Constructor to create a string from a char array.
- Parameters:
-
| text | Pointer to a char array to use as the basis of the string. |
WoopsiString::WoopsiString |
( |
const char |
letter |
) |
|
Constructor to create a string from a single character.
- Parameters:
-
| letter | Single character to use as the basis of the string. |
WoopsiUI::WoopsiString::WoopsiString |
( |
const WoopsiString & |
string |
) |
[inline] |
Copy constructor.
- Parameters:
-
virtual WoopsiUI::WoopsiString::~WoopsiString |
( |
|
) |
[inline, virtual] |
Member Function Documentation
void WoopsiString::allocateMemory |
( |
u32 |
chars, |
|
|
bool |
preserve | |
|
) |
| | [protected, virtual] |
Allocate memory for the string.
- Parameters:
-
| chars | Number of chars to allocate. |
| preserve | If true, the data in the existing memory will be preserved if new memory must be allocated |
void WoopsiString::append |
( |
const char |
text |
) |
[virtual] |
Append text to the end of the string.
- Parameters:
-
Reimplemented in WoopsiUI::Text.
void WoopsiString::append |
( |
const char * |
text |
) |
[virtual] |
Append text to the end of the string.
- Parameters:
-
Reimplemented in WoopsiUI::Text.
virtual u32 WoopsiUI::WoopsiString::getAllocatedSize |
( |
|
) |
[inline, protected, virtual] |
Get the amount of allocated memory.
- Returns:
- The number of chars allocated in RAM.
virtual const char* WoopsiUI::WoopsiString::getCharArray |
( |
|
) |
const [inline, virtual] |
Returns a pointer to the raw char array data.
- Returns:
- Pointer to the char array.
virtual const char WoopsiUI::WoopsiString::getCharAt |
( |
u32 |
index |
) |
[inline, virtual] |
Get the character at the specified index.
- Parameters:
-
| index | The index of the character to retrieve. |
- Returns:
- The character at the specified index.
virtual const u32 WoopsiUI::WoopsiString::getLength |
( |
|
) |
const [inline, virtual] |
Get the length of the string in characters.
- Returns:
- The length of the string.
virtual bool WoopsiUI::WoopsiString::hasData |
( |
|
) |
const [inline, protected, virtual] |
Check if we've got any string data stored or not.
- Returns:
- True if the string contains any data; false if no data has yet been supplied.
void WoopsiString::insert |
( |
const char |
text, |
|
|
const u32 |
index | |
|
) |
| | [virtual] |
Insert text at the specified character index.
- Parameters:
-
| text | Char to insert |
| index | The index at which to insert the char. |
Reimplemented in WoopsiUI::Text.
void WoopsiString::insert |
( |
const char * |
text, |
|
|
const u32 |
index | |
|
) |
| | [virtual] |
Insert text at the specified character index.
- Parameters:
-
| text | The text to insert. |
| index | The index at which to insert the text. |
Reimplemented in WoopsiUI::Text.
char& WoopsiUI::WoopsiString::operator[] |
( |
const u32 |
index |
) |
const [inline] |
Overload the [] operator to allow array-style access.
- Parameters:
-
| index | The index to retrieve. |
- Returns:
- The char at the specified index.
void WoopsiString::remove |
( |
const u32 |
startIndex, |
|
|
const u32 |
count | |
|
) |
| | [virtual] |
Remove specified number of characters from the string from the start index onwards.
- Parameters:
-
| startIndex | Index to remove from. |
| count | Number of characters to remove. |
Reimplemented in WoopsiUI::Text.
void WoopsiString::remove |
( |
const u32 |
startIndex |
) |
[virtual] |
Remove all characters from the string from the start index onwards.
- Parameters:
-
| startIndex | Index to remove from. |
Reimplemented in WoopsiUI::Text.
void WoopsiString::setText |
( |
const char |
text |
) |
[virtual] |
Set the text in the string.
- Parameters:
-
| text | Character to to use as the new data for this string. |
Reimplemented in WoopsiUI::Text.
void WoopsiString::setText |
( |
const char * |
text |
) |
[virtual] |
Set the text in the string.
- Parameters:
-
| text | Char array to use as the new data for this string. |
Reimplemented in WoopsiUI::Text.
Member Data Documentation
The documentation for this class was generated from the following files:
- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/woopsistring.h
- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/woopsistring.cpp