Dillo v3.1.1-95-g3af05307
|
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 | |
Node * | firstNode |
Node * | lastNode |
int | numChars |
char * | str |
bool | strValid |
A class for fast concatenation of a large number of strings.
lout::misc::StringBuffer::StringBuffer | ( | ) |
lout::misc::StringBuffer::~StringBuffer | ( | ) |
|
inline |
Append a NUL-terminated string to the buffer, with copying.
A copy is kept in the buffer, so the caller does not have to care about memory management.
Definition at line 593 of file misc.hh.
References appendNoCopy(), dStrdup(), and str.
Referenced by appendBool(), appendInt(), appendPointer(), dw::core::SelectionState::copy(), dw::core::Content::intoStringBuffer(), dw::core::Iterator::intoStringBuffer(), dw::oof::OOFAwareWidget::OOFAwareWidgetIterator::intoStringBuffer(), dw::oof::OOFFloatsMgr::Float::intoStringBuffer(), dw::Textblock::BadnessAndPenalty::intoStringBuffer(), lout::container::untyped::Collection::intoStringBuffer(), lout::container::untyped::HashTable::intoStringBuffer(), lout::identity::IdentifiableObject::Class::intoStringBuffer(), lout::identity::IdentifiableObject::intoStringBuffer(), lout::misc::BitSet::intoStringBuffer(), lout::object::Object::intoStringBuffer(), lout::object::Pointer::intoStringBuffer(), lout::object::Integer::intoStringBuffer(), lout::object::Boolean::intoStringBuffer(), lout::object::ConstString::intoStringBuffer(), lout::object::PairBase::intoStringBuffer(), lout::signal::Emitter::intoStringBuffer(), lout::signal::Receiver::intoStringBuffer(), and dw::core::Content::maskIntoStringBuffer().
|
inline |
Definition at line 598 of file misc.hh.
References append().
Referenced by dw::oof::OOFFloatsMgr::Float::intoStringBuffer().
|
inline |
Definition at line 594 of file misc.hh.
References append().
Referenced by dw::core::Content::intoStringBuffer(), dw::oof::OOFAwareWidget::OOFAwareWidgetIterator::intoStringBuffer(), dw::oof::OOFFloatsMgr::Float::intoStringBuffer(), dw::Textblock::BadnessAndPenalty::intoStringBuffer(), and lout::identity::IdentifiableObject::Class::intoStringBuffer().
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().
|
inline |
Definition at line 596 of file misc.hh.
References append().
Referenced by dw::core::Content::intoStringBuffer(), dw::core::Iterator::intoStringBuffer(), dw::oof::OOFFloatsMgr::Float::intoStringBuffer(), lout::identity::IdentifiableObject::intoStringBuffer(), and lout::object::Object::intoStringBuffer().
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().
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 86 of file misc.cc.
References firstNode, lout::misc::StringBuffer::Node::next, numChars, str, and strValid.
Referenced by dw::Textblock::accumulateWordData(), dw::core::SelectionState::buttonPress(), dw::core::SelectionState::buttonRelease(), dw::core::SelectionState::copy(), dw::fltk::FltkImgbuf::copyRow(), dw::Textblock::TextblockIterator::highlight(), dw::fltk::FltkImgbuf::init(), dw::fltk::FltkImgbuf::newScan(), dw::oof::OOFAwareWidget::OOFAwareWidgetIterator::next(), dw::oof::OOFAwareWidget::OOFAwareWidgetIterator::prev(), dw::core::Content::print(), dw::core::Content::printMask(), dw::fltk::FltkImgbuf::scaleRowBeautiful(), dw::fltk::FltkImgbuf::scaleRowSimple(), dw::Textblock::searchBreakPos(), dw::Textblock::searchMinBap(), lout::object::Object::toString(), and dw::Textblock::TextblockIterator::unhighlight().
|
private |
Definition at line 578 of file misc.hh.
Referenced by appendNoCopy(), clear(), getChars(), and StringBuffer().
|
private |
Definition at line 578 of file misc.hh.
Referenced by appendNoCopy(), clear(), and StringBuffer().
|
private |
Definition at line 579 of file misc.hh.
Referenced by appendNoCopy(), clear(), getChars(), and StringBuffer().
|
private |
Definition at line 580 of file misc.hh.
Referenced by append(), appendNoCopy(), getChars(), StringBuffer(), and ~StringBuffer().
|
private |
Definition at line 581 of file misc.hh.
Referenced by appendNoCopy(), clear(), getChars(), and StringBuffer().