String
// Dynamically sized string using PO2B memory.
class RVAPI String
{
public:
// Get number of characters in string.
uint GetLen() const;
// Check if string ignores case during comparisons.
bool IsIgnoreCase() const;
// Implicitly convert this string object to a native C string.
operator wcstr () const;
// Assign native [string] to this string.
String &operator = (wcstr string);
// Assign [other] string to this string.
String &operator = (const String &other) { return *this = (wcstr)other; }
// Append [string] to this string.
String &operator += (wcstr string);
// Check if this string is less than [string]. Respects [ignoreCase].
bool operator < (wcstr string) const { return Compare(*this, string, IsIgnoreCase()) < 0; }
// Check if this string is less than or equal to [string]. Respects [ignoreCase]
bool operator <= (wcstr string) const { return Compare(*this, string, IsIgnoreCase()) <= 0; }
// Check if this string is equal to [string]. Respects [ignoreCase]
bool operator == (wcstr string) const { return Compare(*this, string, IsIgnoreCase()) == 0; }
// Check if this string is not equal to [string]. Respects [ignoreCase]
bool operator != (wcstr string) const { return Compare(*this, string, IsIgnoreCase()) != 0; }
// Check if this string is greater than or equal to [string]. Respects [ignoreCase]
bool operator >= (wcstr string) const { return Compare(*this, string, IsIgnoreCase()) >= 0; }
// Check if this string is greater than [string]. Respects [ignoreCase]
bool operator > (wcstr string) const { return Compare(*this, string, IsIgnoreCase()) > 0; }
// Compare [stringA] to [stringB]. Returns -1 if less than, 0 if equal to or 1 if greater than. Respects [ignoreCase].
static int Compare(wcstr stringA, wcstr stringB, bool ignoreCase = true);
// Assign [string] to this string. [string] can contain printf style format specifiers.
// Pass list of arguments [...] to match the format specifiers if any.
String &Format(uint reserve, wcstr string, ...);
// Same as Format() except arguments are passed as a stdlib va_list.
String &FormatArgs(uint reserve, wcstr string, va_list args);
// Clear string contents.
String &Clear();
// Internal.
void *operator () () const { return (void *)wobj; };
// Copy constructor.
String(const String &string);
// Constructor to create an empty string buffer for storing and manipulating a string.
// Set [incr] to the estimated maximum characters. [ignoreCase] affects comparisons.
String(uint incr = 128, int ignoreCase = true);
// Constructor to create a string object intialized with [string]. [ignoreCase] affects comparisons.
String(wcstr string, int ignoreCase = true);
// Destructor.
~String();
private:
byte wobj[32];
};