Dillo
|
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. More... | |
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. 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 | |
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 | ( | ) |
|
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.
References appendNoCopy().
Referenced by appendBool(), appendInt(), appendPointer(), dw::core::SelectionState::copy(), lout::object::Object::intoStringBuffer(), dw::core::Iterator::intoStringBuffer(), dw::oof::OOFFloatsMgr::Float::intoStringBuffer(), lout::container::untyped::Collection::intoStringBuffer(), lout::object::Pointer::intoStringBuffer(), lout::identity::IdentifiableObject::Class::intoStringBuffer(), dw::oof::OOFAwareWidget::OOFAwareWidgetIterator::intoStringBuffer(), lout::identity::IdentifiableObject::intoStringBuffer(), lout::object::Integer::intoStringBuffer(), lout::object::Boolean::intoStringBuffer(), lout::object::ConstString::intoStringBuffer(), lout::object::PairBase::intoStringBuffer(), lout::signal::Emitter::intoStringBuffer(), dw::core::Content::intoStringBuffer(), lout::signal::Receiver::intoStringBuffer(), dw::Textblock::BadnessAndPenalty::intoStringBuffer(), lout::container::untyped::HashTable::intoStringBuffer(), lout::misc::BitSet::intoStringBuffer(), and dw::core::Content::maskIntoStringBuffer().
|
inline |
References append().
Referenced by dw::oof::OOFFloatsMgr::Float::intoStringBuffer().
|
inline |
References append().
Referenced by dw::oof::OOFFloatsMgr::Float::intoStringBuffer(), lout::identity::IdentifiableObject::Class::intoStringBuffer(), dw::oof::OOFAwareWidget::OOFAwareWidgetIterator::intoStringBuffer(), dw::core::Content::intoStringBuffer(), and dw::Textblock::BadnessAndPenalty::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.)
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 |
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::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 |
Referenced by appendNoCopy(), clear(), getChars(), and StringBuffer().
|
private |
Referenced by appendNoCopy(), clear(), and StringBuffer().
|
private |
Referenced by appendNoCopy(), clear(), getChars(), and StringBuffer().
|
private |
Referenced by appendNoCopy(), getChars(), StringBuffer(), and ~StringBuffer().
|
private |
Referenced by appendNoCopy(), clear(), getChars(), and StringBuffer().