String::StrFormat
An internal support class for ToString().
Public Attributes
Public Functions
char *
formatAppend(const char * format, va_list args)
Detailed Description
An internal support class for ToString().
StrFormat manages the formatting of arbitrary length strings. The class starts with a default internal fixed size buffer and moves to dynamic allocation from the heap when that is exceeded. Constructing the class on the stack will result in its most efficient use. This class is meant to be used as a helper class, and not for the permanent storage of string data.
char* indexString(U32 index) { StrFormat format("Index: %d",index); char* str = new char[format.size()]; format.copy(str); return str; }
Public Attributes
char * _dynamicBuffer
U32 _dynamicSize
char _fixedBuffer [2048]
U32 _len
Public Functions
StrFormat()
StrFormat(const char * formatStr, va_list args)
~StrFormat()
append(const char * str)
append(const char * str, S32 len)
c_str()
copy(char * buffer)
Copy the formatted string into the output buffer which must be at least size() characters.
format(const char * format, va_list args)
formatAppend(const char * format, va_list args)
getString()
length()
Return the length of the formated string (does not include the terminating 0)
reset()