BLOCXX_NAMESPACE::StringBuffer Class Reference

#include <StringBuffer.hpp>

List of all members.

Public Member Functions

 StringBuffer (size_t allocSize=BLOCXX_DEFAULT_ALLOCATION_UNIT)
 StringBuffer (const char *arg)
 StringBuffer (const String &arg)
 StringBuffer (const StringBuffer &arg)
 ~StringBuffer ()
StringBufferoperator= (const StringBuffer &arg)
StringBufferoperator= (const String &arg)
StringBufferoperator= (const char *str)
void swap (StringBuffer &x)
StringBufferappend (char c)
StringBufferappend (const char *str)
StringBufferappend (const char *str, const size_t len)
StringBufferappend (const String &arg)
StringBufferappend (const StringBuffer &arg)
StringBufferoperator+= (char c)
StringBufferoperator+= (Char16 c)
StringBufferoperator+= (const char *str)
StringBufferoperator+= (const String &arg)
StringBufferoperator+= (Bool v)
StringBufferoperator+= (UInt8 v)
StringBufferoperator+= (Int8 v)
StringBufferoperator+= (UInt16 v)
StringBufferoperator+= (Int16 v)
StringBufferoperator+= (UInt32 v)
StringBufferoperator+= (Int32 v)
StringBufferoperator+= (UInt64 v)
StringBufferoperator+= (Int64 v)
StringBufferoperator+= (Real32 v)
StringBufferoperator+= (Real64 v)
StringBufferoperator+= (const StringBuffer &arg)
char operator[] (size_t ndx) const
String toString () const
String releaseString ()
size_t length () const
void truncate (size_t index)
 Truncate the string at the given index.
const char * getLine (std::istream &is, bool resetBuffer=true)
 Fill this StringBuffer object with the next line from the given input stream.
bool endsWith (char ch) const
bool startsWith (char ch) const
void chop ()
void trim ()
size_t allocated () const
void reset ()
const char * c_str () const
bool equals (const char *arg) const
bool equals (const StringBuffer &arg) const

Static Public Attributes

static const size_t BLOCXX_DEFAULT_ALLOCATION_UNIT = 128

Private Member Functions

void checkAvail (size_t len=1)

Private Attributes

size_t m_len
size_t m_allocated
char * m_bfr

Friends

std::ostream & operator<< (std::ostream &ostr, const StringBuffer &b)


Detailed Description

Definition at line 50 of file StringBuffer.hpp.


Constructor & Destructor Documentation

BLOCXX_NAMESPACE::StringBuffer::StringBuffer size_t  allocSize = BLOCXX_DEFAULT_ALLOCATION_UNIT  ) 
 

Definition at line 61 of file StringBuffer.cpp.

References m_bfr.

Referenced by operator=().

BLOCXX_NAMESPACE::StringBuffer::StringBuffer const char *  arg  ) 
 

Definition at line 69 of file StringBuffer.cpp.

References m_bfr.

BLOCXX_NAMESPACE::StringBuffer::StringBuffer const String arg  ) 
 

Definition at line 77 of file StringBuffer.cpp.

References BLOCXX_NAMESPACE::String::c_str(), and m_bfr.

BLOCXX_NAMESPACE::StringBuffer::StringBuffer const StringBuffer arg  ) 
 

Definition at line 85 of file StringBuffer.cpp.

References m_bfr, and m_len.

BLOCXX_NAMESPACE::StringBuffer::~StringBuffer  )  [inline]
 

Definition at line 62 of file StringBuffer.hpp.


Member Function Documentation

size_t BLOCXX_NAMESPACE::StringBuffer::allocated  )  const [inline]
 

Definition at line 147 of file StringBuffer.hpp.

StringBuffer& BLOCXX_NAMESPACE::StringBuffer::append const StringBuffer arg  )  [inline]
 

Definition at line 85 of file StringBuffer.hpp.

References c_str(), and length().

StringBuffer& BLOCXX_NAMESPACE::StringBuffer::append const String arg  )  [inline]
 

Definition at line 83 of file StringBuffer.hpp.

References BLOCXX_NAMESPACE::String::c_str(), and BLOCXX_NAMESPACE::String::length().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::append const char *  str,
const size_t  len
 

Definition at line 266 of file StringBuffer.cpp.

References checkAvail(), m_bfr, and m_len.

StringBuffer& BLOCXX_NAMESPACE::StringBuffer::append const char *  str  )  [inline]
 

Definition at line 74 of file StringBuffer.hpp.

StringBuffer& BLOCXX_NAMESPACE::StringBuffer::append char  c  )  [inline]
 

Definition at line 67 of file StringBuffer.hpp.

Referenced by BLOCXX_NAMESPACE::OStringStreamBuf::buffer_to_device(), BLOCXX_NAMESPACE::LogMessagePatternFormatter::Converter::formatMessage(), getLine(), and operator+=().

const char* BLOCXX_NAMESPACE::StringBuffer::c_str  )  const [inline]
 

Definition at line 149 of file StringBuffer.hpp.

Referenced by append(), BLOCXX_NAMESPACE::OStringStreamBuf::c_str(), BLOCXX_NAMESPACE::operator<<(), and BLOCXX_NAMESPACE::operator==().

void BLOCXX_NAMESPACE::StringBuffer::checkAvail size_t  len = 1  )  [inline, private]
 

Definition at line 154 of file StringBuffer.hpp.

Referenced by append().

void BLOCXX_NAMESPACE::StringBuffer::chop  ) 
 

Definition at line 304 of file StringBuffer.cpp.

References m_len, and truncate().

bool BLOCXX_NAMESPACE::StringBuffer::endsWith char  ch  )  const
 

Definition at line 290 of file StringBuffer.cpp.

References m_bfr, and m_len.

bool BLOCXX_NAMESPACE::StringBuffer::equals const StringBuffer arg  )  const
 

Definition at line 283 of file StringBuffer.cpp.

References m_bfr.

bool BLOCXX_NAMESPACE::StringBuffer::equals const char *  arg  )  const
 

Definition at line 276 of file StringBuffer.cpp.

References m_bfr.

Referenced by BLOCXX_NAMESPACE::operator==().

const char * BLOCXX_NAMESPACE::StringBuffer::getLine std::istream &  is,
bool  resetBuffer = true
 

Fill this StringBuffer object with the next line from the given input stream.

Parameters:
is The input stream to retrieve the next line from
resetBuffer whether to reset/clear the buffer first
Returns:
const char* pointer to the line of text just read.

Definition at line 344 of file StringBuffer.cpp.

References append(), m_bfr, reset(), and truncate().

size_t BLOCXX_NAMESPACE::StringBuffer::length  )  const [inline]
 

Definition at line 122 of file StringBuffer.hpp.

Referenced by append(), BLOCXX_NAMESPACE::LogMessagePatternFormatter::Converter::formatMessage(), BLOCXX_NAMESPACE::OStringStreamBuf::length(), and BLOCXX_NAMESPACE::operator<<().

StringBuffer& BLOCXX_NAMESPACE::StringBuffer::operator+= const StringBuffer arg  )  [inline]
 

Definition at line 108 of file StringBuffer.hpp.

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator+= Real64  v  ) 
 

Definition at line 247 of file StringBuffer.cpp.

References append().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator+= Real32  v  ) 
 

Definition at line 231 of file StringBuffer.cpp.

References append().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator+= Int64  v  ) 
 

Definition at line 218 of file StringBuffer.cpp.

References append().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator+= UInt64  v  ) 
 

Definition at line 206 of file StringBuffer.cpp.

References append().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator+= Int32  v  ) 
 

Definition at line 198 of file StringBuffer.cpp.

References append().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator+= UInt32  v  ) 
 

Definition at line 190 of file StringBuffer.cpp.

References append().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator+= Int16  v  ) 
 

Definition at line 182 of file StringBuffer.cpp.

References append().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator+= UInt16  v  ) 
 

Definition at line 174 of file StringBuffer.cpp.

References append().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator+= Int8  v  ) 
 

Definition at line 166 of file StringBuffer.cpp.

References append().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator+= UInt8  v  ) 
 

Definition at line 158 of file StringBuffer.cpp.

References append().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator+= Bool  v  ) 
 

Definition at line 148 of file StringBuffer.cpp.

References append(), and BLOCXX_NAMESPACE::Bool::toString().

StringBuffer& BLOCXX_NAMESPACE::StringBuffer::operator+= const String arg  )  [inline]
 

Definition at line 95 of file StringBuffer.hpp.

StringBuffer& BLOCXX_NAMESPACE::StringBuffer::operator+= const char *  str  )  [inline]
 

Definition at line 93 of file StringBuffer.hpp.

StringBuffer& BLOCXX_NAMESPACE::StringBuffer::operator+= Char16  c  )  [inline]
 

Definition at line 91 of file StringBuffer.hpp.

References BLOCXX_NAMESPACE::Char16::toString().

StringBuffer& BLOCXX_NAMESPACE::StringBuffer::operator+= char  c  )  [inline]
 

Definition at line 89 of file StringBuffer.hpp.

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator= const char *  str  ) 
 

Definition at line 100 of file StringBuffer.cpp.

References StringBuffer().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator= const String arg  ) 
 

Definition at line 93 of file StringBuffer.cpp.

References StringBuffer().

StringBuffer & BLOCXX_NAMESPACE::StringBuffer::operator= const StringBuffer arg  ) 
 

Definition at line 107 of file StringBuffer.cpp.

References StringBuffer().

char BLOCXX_NAMESPACE::StringBuffer::operator[] size_t  ndx  )  const
 

Definition at line 141 of file StringBuffer.cpp.

References m_bfr, and m_len.

String BLOCXX_NAMESPACE::StringBuffer::releaseString  )  [inline]
 

Definition at line 116 of file StringBuffer.hpp.

References BLOCXX_NAMESPACE::String::E_TAKE_OWNERSHIP.

Referenced by BLOCXX_NAMESPACE::LogMessagePatternFormatter::Converter::formatMessage(), BLOCXX_NAMESPACE::LogAppender::logMessage(), BLOCXX_NAMESPACE::UnnamedPipe::readAll(), BLOCXX_NAMESPACE::OStringStreamBuf::releaseString(), BLOCXX_NAMESPACE::UTF8Utils::transform(), and BLOCXX_NAMESPACE::UTF8Utils::UCS4toUTF8().

void BLOCXX_NAMESPACE::StringBuffer::reset  ) 
 

Definition at line 122 of file StringBuffer.cpp.

References m_bfr, and m_len.

Referenced by getLine(), and BLOCXX_NAMESPACE::OStringStreamBuf::reset().

bool BLOCXX_NAMESPACE::StringBuffer::startsWith char  ch  )  const
 

Definition at line 297 of file StringBuffer.cpp.

References m_bfr, and m_len.

void BLOCXX_NAMESPACE::StringBuffer::swap StringBuffer x  ) 
 

Definition at line 114 of file StringBuffer.cpp.

References m_allocated, m_bfr, m_len, and BLOCXX_NAMESPACE::swap().

String BLOCXX_NAMESPACE::StringBuffer::toString  )  const [inline]
 

Definition at line 113 of file StringBuffer.hpp.

Referenced by BLOCXX_NAMESPACE::OStringStreamBuf::toString().

void BLOCXX_NAMESPACE::StringBuffer::trim  ) 
 

Definition at line 314 of file StringBuffer.cpp.

References m_bfr, and m_len.

void BLOCXX_NAMESPACE::StringBuffer::truncate size_t  index  ) 
 

Truncate the string at the given index.

This doesn't change anything before the given index and does not free up any memory.

Parameters:
index The index to truncate the string buffer at. If this value is greater than the current length of the StringBuffer, then nothing is done.

Definition at line 130 of file StringBuffer.cpp.

References m_bfr, and m_len.

Referenced by chop(), and getLine().


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  ostr,
const StringBuffer b
[friend]
 

Definition at line 387 of file StringBuffer.cpp.


Member Data Documentation

const size_t BLOCXX_NAMESPACE::StringBuffer::BLOCXX_DEFAULT_ALLOCATION_UNIT = 128 [static]
 

Definition at line 56 of file StringBuffer.hpp.

size_t BLOCXX_NAMESPACE::StringBuffer::m_allocated [private]
 

Definition at line 169 of file StringBuffer.hpp.

Referenced by swap().

char* BLOCXX_NAMESPACE::StringBuffer::m_bfr [private]
 

Definition at line 170 of file StringBuffer.hpp.

Referenced by append(), endsWith(), equals(), getLine(), operator[](), reset(), startsWith(), StringBuffer(), swap(), trim(), and truncate().

size_t BLOCXX_NAMESPACE::StringBuffer::m_len [private]
 

Definition at line 168 of file StringBuffer.hpp.

Referenced by append(), chop(), endsWith(), operator[](), reset(), startsWith(), StringBuffer(), swap(), trim(), and truncate().


The documentation for this class was generated from the following files:
Generated on Fri Jun 16 15:39:11 2006 for blocxx by  doxygen 1.4.6