Isle
|
Mindscape custom string class for managing dynamic C-strings within the game engine. More...
#include <mxstring.h>
Public Member Functions | |
MxString () | |
Default constructor which creates an empty string. More... | |
MxString (const MxString &p_str) | |
Copy constructor. More... | |
MxString (const char *p_str) | |
Constructs MxString from a C-style string. More... | |
MxString (const char *p_str, MxU16 p_maxlen) | |
Constructs MxString from a C-style string with maximum length. More... | |
~MxString () override | |
Destructor. More... | |
void | Reverse () |
Reverses the contents of the string in-place. More... | |
void | ToUpperCase () |
Converts the string contents to uppercase in-place. More... | |
void | ToLowerCase () |
Converts the string contents to lowercase in-place. More... | |
MxString & | operator= (const MxString &p_str) |
Assignment operator from another MxString. More... | |
const MxString & | operator= (const char *p_str) |
Assignment operator from a null-terminated C-string. More... | |
MxString | operator+ (const MxString &p_str) const |
Concatenation operator for two MxString instances. More... | |
MxString | operator+ (const char *p_str) const |
Concatenation operator for MxString and a C-string. More... | |
MxString & | operator+= (const char *p_str) |
Append a C-string to this MxString. More... | |
char * | GetData () const |
Returns a pointer to the internal character buffer. More... | |
const MxU16 | GetLength () const |
Returns the length of the string (number of characters, not including null terminator). More... | |
MxBool | Equal (const MxString &p_str) const |
Compares this string to another for equality. More... | |
MxS8 | Compare (const MxString &p_str) const |
Performs lexicographical comparison to another string. More... | |
![]() | |
MxCore () | |
[AI] Constructs a new MxCore object and assigns it a unique id. More... | |
virtual | ~MxCore () |
[AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More... | |
virtual MxLong | Notify (MxParam &p_param) |
[AI] Virtual callback notification mechanism. More... | |
virtual MxResult | Tickle () |
[AI] Called by tickle managers to allow the object to update itself. More... | |
virtual const char * | ClassName () const |
[AI] Returns the runtime class name of this object. More... | |
virtual MxBool | IsA (const char *p_name) const |
[AI] Checks whether this object's class type or parents match the given name. More... | |
MxU32 | GetId () |
[AI] Gets the unique (per-process) id assigned to this object instance. More... | |
Static Public Member Functions | |
static void | CharSwap (char *p_a, char *p_b) |
Utility to swap the values of two characters. More... | |
Mindscape custom string class for managing dynamic C-strings within the game engine.
[AI]
Provides operations like construction from C-strings or other MxString instances, mutation utilities (reverse, uppercase, lowercase), and concatenation and comparison. Handles dynamic memory for string contents. [AI]
Definition at line 14 of file mxstring.h.
MxString::MxString | ( | ) |
Default constructor which creates an empty string.
[AI]
Allocates memory for a null-terminated string of zero length. [AI]
Definition at line 12 of file mxstring.cpp.
MxString::MxString | ( | const MxString & | p_str | ) |
Copy constructor.
[AI]
p_str | Reference to another MxString to copy. [AI] |
Definition at line 22 of file mxstring.cpp.
MxString::MxString | ( | const char * | p_str | ) |
Constructs MxString from a C-style string.
[AI]
p_str | Null-terminated input string. [AI] |
Definition at line 31 of file mxstring.cpp.
MxString::MxString | ( | const char * | p_str, |
MxU16 | p_maxlen | ||
) |
Constructs MxString from a C-style string with maximum length.
[AI]
p_str | Null-terminated input string. [AI] |
p_maxlen | Maximum number of characters to copy. [AI] |
If the input string is longer than p_maxlen, only the first p_maxlen characters are used. [AI]
Definition at line 46 of file mxstring.cpp.
|
override |
Destructor.
[AI]
Releases allocated memory for string buffer. [AI]
Definition at line 70 of file mxstring.cpp.
|
static |
Utility to swap the values of two characters.
[AI]
p_a | Pointer to first character. [AI] |
p_b | Pointer to second character. [AI] |
Used internally for string reversal. [AI]
Definition at line 182 of file mxstring.cpp.
Performs lexicographical comparison to another string.
[AI]
p_str | String to compare against. [AI] |
Definition at line 129 of file mxstring.h.
Compares this string to another for equality.
[AI]
p_str | String to compare against. [AI] |
TRUE | if the contents are exactly equal, FALSE otherwise ([AI], returns MxBool). [AI] |
Definition at line 122 of file mxstring.h.
|
inline |
Returns a pointer to the internal character buffer.
[AI]
The returned pointer is owned by MxString and should not be freed by the caller. [AI]
Definition at line 110 of file mxstring.h.
|
inline |
Returns the length of the string (number of characters, not including null terminator).
[AI]
Definition at line 115 of file mxstring.h.
MxString MxString::operator+ | ( | const char * | p_str | ) | const |
Concatenation operator for MxString and a C-string.
[AI]
p_str | C-style string to append to this instance. [AI] |
Returns a new MxString containing the concatenation result. [AI]
Definition at line 149 of file mxstring.cpp.
Concatenation operator for two MxString instances.
[AI]
p_str | Input string to concatenate. [AI] |
Returns a new MxString containing the concatenation result. [AI]
Definition at line 131 of file mxstring.cpp.
MxString & MxString::operator+= | ( | const char * | p_str | ) |
Append a C-string to this MxString.
[AI]
p_str | C-style null-terminated string to append. [AI] |
Adjusts the internal buffer and length. [AI]
Definition at line 166 of file mxstring.cpp.
const MxString & MxString::operator= | ( | const char * | p_str | ) |
Assignment operator from a null-terminated C-string.
[AI]
p_str | Source C-string to copy from. [AI] |
Allocates a new buffer and copies the input string. Handles self-assignment check. [AI]
Definition at line 118 of file mxstring.cpp.
Assignment operator from another MxString.
[AI]
p_str | Source MxString to copy from. [AI] |
Allocates a new buffer and copies the string data. Handles self-assignment check. [AI]
Definition at line 104 of file mxstring.cpp.
void MxString::Reverse | ( | ) |
void MxString::ToLowerCase | ( | ) |
Converts the string contents to lowercase in-place.
[AI]
Definition at line 97 of file mxstring.cpp.
void MxString::ToUpperCase | ( | ) |
Converts the string contents to uppercase in-place.
[AI]
Definition at line 90 of file mxstring.cpp.