StringBuffer
Engine/source/core/stringBuffer.h
Utility class to wrap string manipulation in a representation independent way.
Public Functions
StringBuffer(const StringBuffer & copy)
Copy constructor. Very important.
StringBuffer(const StringBuffer * in)
StringBuffer(const UTF16 * in)
StringBuffer(const UTF8 * in)
append(const StringBuffer & in)
UTF16 *
UTF8 *
Get a copy of the contents of the string buffer.
UTF8 *
createSubstring8(const U32 start, const U32 len)
Get a pointer to a substring of length 'len' starting from 'start'.
getPtr()
Get a pointer to the StringBuffer's data store.
Get an upper bound size estimate for a UTF8 buffer to hold this string.
set(const StringBuffer * in)
Private Functions
Detailed Description
Utility class to wrap string manipulation in a representation independent way.
Length does NOT include the null terminator.
Private Attributes
Vector< UTF16 > mBuffer
Vector< UTF8 > mBuffer8
bool mDirty8
Public Functions
StringBuffer()
StringBuffer(const StringBuffer & copy)
Copy constructor. Very important.
StringBuffer(const StringBuffer * in)
StringBuffer(const UTF16 * in)
StringBuffer(const UTF8 * in)
~StringBuffer()
append(const StringBuffer & in)
append(const UTF16 * in)
append(const UTF16 * in, U32 len)
append(const UTF8 * in)
createCopy()
createCopy8()
Get a copy of the contents of the string buffer.
You must delete[] the returned copy when you are done with it. This follows the "create rule".
createSubstring16(const U32 start, const U32 len)
createSubstring8(const U32 start, const U32 len)
Get a pointer to a substring of length 'len' starting from 'start'.
Returns a raw pointer to a unicode string. You must delete[] the returned string when you are done with it. This follows the "create rule".
cut(const U32 start, const U32 len)
getChar(const U32 offset)
getCopy(UTF16 * buff, const U32 buffSize)
getCopy8(UTF8 * buff, const U32 buffSize)
getPtr()
Get a pointer to the StringBuffer's data store.
Use this in situations where you can be sure that the StringBuffer will not be modified out from under you. The win here is, you avoid yet another data copy. Data copy is slow on most modern hardware.
getPtr8()
getUTF8BufferSizeEstimate()
Get an upper bound size estimate for a UTF8 buffer to hold this string.
insert(const U32 charOffset, const StringBuffer & in)
insert(const U32 charOffset, const UTF16 * in)
insert(const U32 charOffset, const UTF16 * in, const U32 len)
insert(const U32 charOffset, const UTF8 * in)
length()
set(const StringBuffer * in)
set(const UTF16 * in)
set(const UTF8 * in)
setChar(const U32 offset, UTF16 c)
substring(const U32 start, const U32 len)
Get a StringBuffer substring of length 'len' starting from 'start'.
Returns a new StringBuffer by value;