Torque2D Reference
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Member Functions | Public Attributes | List of all members
StringBuffer Class Reference

#include <stringBuffer.h>

Classes

struct  RequestCounts
 

Public Member Functions

 StringBuffer ()
 
 StringBuffer (const StringBuffer &copy)
 Copy constructor. Very important. More...
 
 StringBuffer (const StringBuffer *in)
 
 StringBuffer (const UTF8 *in)
 
 StringBuffer (const UTF16 *in)
 
 StringBuffer (const UTF8 *in, bool bNoConvert)
 
 ~StringBuffer ()
 
void append (const StringBuffer &in)
 
void append (const UTF8 *in)
 
void append (const UTF16 *in)
 
void append (const UTF16 *in, U32 len)
 
StringBufferoperator= (const StringBuffer &inc)
 
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
 
UTF8 * createSubstring8 (const U32 start, const U32 len) const
 
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)
 
void setNoConvert (const UTF8 *in)
 
const U32 length () const
 
const U32 getUTF8BufferSizeEstimate () const
 
void getCopy8 (UTF8 *buff, const U32 buffSize) const
 
void getCopy (UTF16 *buff, const U32 buffSize) const
 
UTF8 * createCopy8 () const
 
UTF16 * createCopy () const
 
const UTF16 * getPtr () const
 
const UTF8 * getPtr8 ()
 

Public Attributes

RequestCountsrc
 

Detailed Description

Utility class to wrap string manipulation in a representation independent way.

Length does NOT include the null terminator.

Constructor & Destructor Documentation

StringBuffer ( const StringBuffer copy)

Copy constructor. Very important.

StringBuffer ( const StringBuffer in)
StringBuffer ( const UTF8 *  in)
StringBuffer ( const UTF16 *  in)
StringBuffer ( const UTF8 *  in,
bool  bNoConvert 
)

Member Function Documentation

void append ( const StringBuffer in)
void append ( const UTF8 *  in)
void append ( const UTF16 *  in)
void append ( const UTF16 *  in,
U32  len 
)
UTF16* createCopy ( ) const
UTF8 * 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* createSubstring16 ( const U32  start,
const U32  len 
) const
UTF8 * 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".

void cut ( const U32  start,
const U32  len 
)
const UTF16 getChar ( const U32  offset) const
void getCopy ( UTF16 *  buff,
const U32  buffSize 
) const
void getCopy8 ( UTF8 *  buff,
const U32  buffSize 
) const
const UTF16 * 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 * getPtr8 ( )
const U32 getUTF8BufferSizeEstimate ( ) const
inline

Get an upper bound size estimate for a UTF8 buffer to hold this string.

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 
)
const U32 length ( ) const
inline
StringBuffer & operator= ( const StringBuffer inc)
void set ( const StringBuffer in)
void set ( const UTF8 *  in)
void set ( const UTF16 *  in)
void setChar ( const U32  offset,
UTF16  c 
)
void setNoConvert ( const UTF8 *  in)
StringBuffer substring ( const U32  start,
const U32  len 
) const

Get a StringBuffer substring of length 'len' starting from 'start'. Returns a new StringBuffer by value;

Member Data Documentation


The documentation for this class was generated from the following files: