StringBuffer Class Reference#include <stringBuffer.h>
Detailed Description
Utility class to wrap string manipulation in a representation independent way.
Length does NOT include the null terminator.
|
Public Member Functions |
| StringBuffer () |
| StringBuffer (const StringBuffer ©) |
| StringBuffer (const StringBuffer *in) |
| StringBuffer (const UTF8 *in) |
| StringBuffer (const UTF16 *in) |
| ~StringBuffer () |
void | append (const StringBuffer &in) |
void | append (const UTF8 *in) |
void | append (const UTF16 *in) |
void | append (const UTF16 *in, U32 len) |
void | insert (const U32 charOffset, const StringBuffer &in) |
void | insert (const U32 charOffset, const UTF8 *in) |
void | insert (const U32 charOffset, const UTF16 *in) |
void | insert (const U32 charOffset, const UTF16 *in, const U32 len) |
StringBuffer | substring (const U32 start, const U32 len) const |
| Get a StringBuffer substring of length 'len' starting from 'start'.
|
UTF8 * | createSubstring8 (const U32 start, const U32 len) const |
| Get a pointer to a substring of length 'len' starting from 'start'.
|
UTF16 * | createSubstring16 (const U32 start, const U32 len) const |
void | cut (const U32 start, const U32 len) |
const UTF16 | getChar (const U32 offset) const |
void | setChar (const U32 offset, UTF16 c) |
void | set (const StringBuffer *in) |
void | set (const UTF8 *in) |
void | set (const UTF16 *in) |
const U32 | length () const |
const U32 | getUTF8BufferSizeEstimate () const |
| Get an upper bound size estimate for a UTF8 buffer to hold this string.
|
void | getCopy8 (UTF8 *buff, const U32 buffSize) const |
void | getCopy (UTF16 *buff, const U32 buffSize) const |
UTF8 * | createCopy8 () const |
| Get a copy of the contents of the string buffer.
|
UTF16 * | createCopy () const |
const UTF16 * | getPtr () const |
| Get a pointer to the StringBuffer's data store.
|
const UTF8 * | getPtr8 () const |
Data Fields |
RequestCounts * | rc |
Private Member Functions |
void | updateBuffer8 () |
void | clearRequestCounts () |
Private Attributes |
Vector< UTF16 > | mBuffer |
Vector< UTF8 > | mBuffer8 |
bool | mDirty8 |
Data Structures |
struct | RequestCounts |
Constructor & Destructor Documentation
StringBuffer::StringBuffer |
( |
|
) |
|
StringBuffer::StringBuffer |
( |
const UTF8 * |
in |
) |
|
StringBuffer::StringBuffer |
( |
const UTF16 * |
in |
) |
|
StringBuffer::~StringBuffer |
( |
|
) |
|
Member Function Documentation
void StringBuffer::append |
( |
const UTF8 * |
in |
) |
|
void StringBuffer::append |
( |
const UTF16 * |
in |
) |
|
void StringBuffer::insert |
( |
const U32 |
charOffset, |
|
|
const UTF8 * |
in | |
|
) |
| | |
void StringBuffer::insert |
( |
const U32 |
charOffset, |
|
|
const UTF16 * |
in | |
|
) |
| | |
void StringBuffer::insert |
( |
const U32 |
charOffset, |
|
|
const UTF16 * |
in, |
|
|
const U32 |
len | |
|
) |
| | |
UTF8* StringBuffer::createSubstring8 |
( |
const U32 |
start, |
|
|
const U32 |
len | |
|
) |
| | const |
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".
UTF16* StringBuffer::createSubstring16 |
( |
const U32 |
start, |
|
|
const U32 |
len | |
|
) |
| | const |
void StringBuffer::cut |
( |
const U32 |
start, |
|
|
const U32 |
len | |
|
) |
| | |
const UTF16 StringBuffer::getChar |
( |
const U32 |
offset |
) |
const |
void StringBuffer::set |
( |
const UTF8 * |
in |
) |
|
const U32 StringBuffer::length |
( |
|
) |
const [inline] |
const U32 StringBuffer::getUTF8BufferSizeEstimate |
( |
|
) |
const [inline] |
Get an upper bound size estimate for a UTF8 buffer to hold this string.
void StringBuffer::getCopy8 |
( |
UTF8 * |
buff, |
|
|
const U32 |
buffSize | |
|
) |
| | const |
void StringBuffer::getCopy |
( |
UTF16 * |
buff, |
|
|
const U32 |
buffSize | |
|
) |
| | const |
UTF8* StringBuffer::createCopy8 |
( |
|
) |
const |
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".
UTF16* StringBuffer::createCopy |
( |
|
) |
const |
const UTF16* StringBuffer::getPtr |
( |
|
) |
const |
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.
const UTF8* StringBuffer::getPtr8 |
( |
|
) |
const |
void StringBuffer::updateBuffer8 |
( |
|
) |
[private] |
void StringBuffer::clearRequestCounts |
( |
|
) |
[inline, private] |
Field Documentation
|