lout::misc::StringBuffer Class Reference

A class for fast concatenation of a large number of strings. More...

#include <misc.hh>

List of all members.

Classes

struct  Node

Public Member Functions

 StringBuffer ()
 ~StringBuffer ()
void append (const char *str)
 Append a NUL-terminated string to the buffer, with copying.
void appendNoCopy (char *str)
 Append a NUL-terminated string to the buffer, without copying.
const char * getChars ()
 Return a NUL-terminated strings containing all appended strings.
void clear ()
 Remove all strings appended to the string buffer.

Private Attributes

NodefirstNode
NodelastNode
int numChars
char * str
bool strValid


Detailed Description

A class for fast concatenation of a large number of strings.

Constructor & Destructor Documentation

lout::misc::StringBuffer::StringBuffer (  ) 

References firstNode, lastNode, numChars, str, and strValid.

lout::misc::StringBuffer::~StringBuffer (  ) 

References clear(), and str.


Member Function Documentation

void lout::misc::StringBuffer::append ( const char *  str  )  [inline]

void lout::misc::StringBuffer::appendNoCopy ( char *  str  ) 

Append a NUL-terminated string to the buffer, without copying.

No copy is made, so this method should only be used in cases, where the string would otherwise be freed again. (This method may then save some CPU cycles.)

References lout::misc::StringBuffer::Node::data, firstNode, lastNode, lout::misc::StringBuffer::Node::next, numChars, and strValid.

Referenced by append(), and dw::core::SelectionState::copy().

void lout::misc::StringBuffer::clear (  ) 

Remove all strings appended to the string buffer.

References lout::misc::StringBuffer::Node::data, firstNode, lastNode, lout::misc::StringBuffer::Node::next, numChars, and strValid.

Referenced by ~StringBuffer().

const char * lout::misc::StringBuffer::getChars (  ) 

Return a NUL-terminated strings containing all appended strings.

The caller does not have to free the string, this is done in misc::StringBuffer::~StringBuffer.

References firstNode, lout::misc::StringBuffer::Node::next, numChars, str, and strValid.

Referenced by dw::core::SelectionState::copy(), and lout::object::Object::toString().


Member Data Documentation

Referenced by appendNoCopy(), clear(), and StringBuffer().


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

Generated on Wed Sep 7 02:00:38 2011 for Dillo by  doxygen 1.5.9