Dillo v3.1.1-95-g3af05307
Loading...
Searching...
No Matches
lout::misc::StringBuffer Class Reference

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

#include <misc.hh>

Classes

struct  Node
 

Public Member Functions

 StringBuffer ()
 
 ~StringBuffer ()
 
void append (const char *str)
 Append a NUL-terminated string to the buffer, with copying.
 
void appendInt (int n)
 
void appendPointer (void *p)
 
void appendBool (bool b)
 
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.

Definition at line 569 of file misc.hh.

Constructor & Destructor Documentation

◆ StringBuffer()

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

Definition at line 40 of file misc.cc.

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

◆ ~StringBuffer()

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

Definition at line 48 of file misc.cc.

References clear(), and str.

Member Function Documentation

◆ append()

◆ appendBool()

void lout::misc::StringBuffer::appendBool ( bool  b)
inline

Definition at line 598 of file misc.hh.

References append().

Referenced by dw::oof::OOFFloatsMgr::Float::intoStringBuffer().

◆ appendInt()

◆ 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 62 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().

◆ appendPointer()

◆ clear()

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

Remove all strings appended to the string buffer.

Definition at line 110 of file misc.cc.

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

Referenced by ~StringBuffer().

◆ getChars()

Member Data Documentation

◆ firstNode

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

Definition at line 578 of file misc.hh.

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

◆ lastNode

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

Definition at line 578 of file misc.hh.

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

◆ numChars

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

Definition at line 579 of file misc.hh.

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

◆ str

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

Definition at line 580 of file misc.hh.

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

◆ strValid

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

Definition at line 581 of file misc.hh.

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


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