dillo  3.0.5
About: dillo is a small, fast, extensible Web browser particularly suitable for older or smaller computers and embedded systems (but only limited or no support for frames, CSS, JavaScript, Java).
  Fossies Dox: dillo-3.0.5.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

lout::misc::StringBuffer Class Reference

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

#include <misc.hh>

Collaboration diagram for lout::misc::StringBuffer:
[legend]

Classes

struct  Node
 

Public Member Functions

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

Private Attributes

NodefirstNode
 
NodelastNode
 
int numChars
 
char * str
 
bool strValid
 

Detailed Description

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

Definition at line 493 of file misc.hh.

Constructor & Destructor Documentation

◆ StringBuffer()

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

Definition at line 46 of file misc.cc.

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

◆ ~StringBuffer()

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

Definition at line 54 of file misc.cc.

References clear(), and str.

Member Function Documentation

◆ append()

◆ appendNoCopy()

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.)

Definition at line 68 of file misc.cc.

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

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

◆ clear()

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

Remove all strings appended to the string buffer.

Definition at line 116 of file misc.cc.

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

Referenced by ~StringBuffer().

◆ getChars()

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.

Definition at line 92 of file misc.cc.

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

◆ firstNode

Node* lout::misc::StringBuffer::firstNode
private

Definition at line 502 of file misc.hh.

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

◆ lastNode

Node * lout::misc::StringBuffer::lastNode
private

Definition at line 502 of file misc.hh.

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

◆ numChars

int lout::misc::StringBuffer::numChars
private

Definition at line 503 of file misc.hh.

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

◆ str

char* lout::misc::StringBuffer::str
private

Definition at line 504 of file misc.hh.

Referenced by append(), appendNoCopy(), getChars(), StringBuffer(), and ~StringBuffer().

◆ strValid

bool lout::misc::StringBuffer::strValid
private

Definition at line 505 of file misc.hh.

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


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