Elm
1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/string/StringBuffer.h>
Public Member Functions | |
StringBuffer (int capacity=64, int increment=32) | |
String | toString (void) |
String | copyString (void) |
int | length (void) const |
void | reset (void) |
io::OutStream & | stream (void) |
Public Member Functions inherited from elm::io::Output | |
Output (void) | |
Output (OutStream &stream) | |
OutStream & | stream (void) const |
void | setStream (OutStream &stream) |
void | flush (void) |
void | print (bool value) |
void | print (char chr) |
void | print (double value) |
void | print (void *value) |
void | print (const char *str) |
void | print (const CString str) |
void | print (const String &str) |
void | print (const IntFormat &fmt) |
void | print (const FloatFormat &fmt) |
void | format (CString fmt,...) |
void | format (CString fmt, VarArg &args) |
void | print (t::int32 value) |
void | print (t::uint32 value) |
void | print (t::int64 value) |
void | print (t::uint64 value) |
As the ELM String class is immutable, the big building of strings may have a prohibitive cost. Instead, this class provides an economic way of concatenating strings.
elm::StringBuffer::StringBuffer | ( | int | capacity = 64 , |
int | increment = 32 |
||
) |
Build a new string buffer.
capacity | Initial capacity of the buffer. |
increment | Incrementation size when buffer is enlarged. |
References elm::io::BlockOutStream::write().
String elm::StringBuffer::copyString | ( | void | ) |
References elm::io::BlockOutStream::block(), and elm::io::BlockOutStream::size().
int elm::StringBuffer::length | ( | void | ) | const |
Get the length of the string stored in the buffer.
References elm::io::BlockOutStream::size().
Referenced by elm::sys::ProcessBuilder::run(), and toString().
void elm::StringBuffer::reset | ( | void | ) |
Remove all characters from the string buffer.
References elm::io::BlockOutStream::setSize().
io::OutStream & elm::StringBuffer::stream | ( | void | ) |
Get the an output stream to write to the string buffer.
String elm::StringBuffer::toString | ( | void | ) |
Convert the buffer to a string. The string buffer must no more be used after this call.
References elm::io::BlockOutStream::detach(), length(), and elm::io::BlockOutStream::write().
Referenced by elm::sys::Path::append(), elm::sys::Plugger::getLastError(), elm::AutoString::operator const string(), elm::sys::Plugger::plug(), elm::sys::ProcessBuilder::run(), elm::io::Input::scanLine(), elm::io::Input::scanWord(), elm::sys::Path::setExtension(), and elm::sys::SystemException::SystemException().