Aegis  4.25.D505
Public Member Functions | Private Member Functions | Private Attributes
wstring_accumulator Class Reference

#include <accumulator.h>

Public Member Functions

 ~wstring_accumulator ()
 wstring_accumulator ()
 wstring_accumulator (const wstring_accumulator &)
wstring_accumulatoroperator= (const wstring_accumulator &)
wstring mkstr () const
void push_back (wchar_t c)
void push_back (const wchar_t *data, size_t len)
void push_back (const wchar_t *data)
void push_back (const wstring_accumulator &data)
void push_back (const wstring &data)
void clear ()
size_t size () const
bool empty () const
void pop_back ()
wchar_t back ()
const wchar_tget_data () const
wchar_t operator[] (size_t n)

Private Member Functions

void overflow (wchar_t c)

Private Attributes

size_t length
size_t maximum
wchar_tbuffer

Detailed Description

The wstring_accumulator class is used to accumulate wide characters into a buffer, for turning into a wide string.

Definition at line 28 of file accumulator.h.


Constructor & Destructor Documentation

The destructor. Thou shalt not derive from this class because it isn't virtual.

The default constructor.

The copy constructor.


Member Function Documentation

wchar_t wstring_accumulator::back ( void  ) [inline]

The back method is used to obtain the last character in the buffer, or NUL if the buffer is empty.

Definition at line 140 of file accumulator.h.

void wstring_accumulator::clear ( void  ) [inline]

The clear method is used to reset the length of the accumulated string to zero.

Definition at line 116 of file accumulator.h.

bool wstring_accumulator::empty ( void  ) const [inline]

The empty method is used to determine if the buffer is empty (has a size of zero).

Definition at line 128 of file accumulator.h.

const wchar_t* wstring_accumulator::get_data ( ) const [inline]

The get_data method is used to obtain a pointer to the base of the array of characters being accumulated.

Note:
The pointer is only garanteed to be valid until the next push_back method call.
Please use this methdo as little as possible.

Definition at line 152 of file accumulator.h.

The mkstr method is used to take the current contents of the accumulated buffer and turn it into a wide string.

wstring_accumulator& wstring_accumulator::operator= ( const wstring_accumulator )

The assignment operator.

wchar_t wstring_accumulator::operator[] ( size_t  n) [inline]

The array index operator is used to obtain thr nth character in the buffer.

Note:
No array bounds checking is performed. If you really stuff up, it will segfault. Caveat emptor.

Definition at line 162 of file accumulator.h.

void wstring_accumulator::overflow ( wchar_t  c) [private]

The overflow method is used to append another character to the end of the accumulator. It is called by the putch method when it get too too hard (and a new buffer is needed).

Parameters:
cThe character to be appended to the buffer.
void wstring_accumulator::pop_back ( void  ) [inline]

The pop_back method is used to remove the last character from the buffer.

Definition at line 134 of file accumulator.h.

The push_back method is used to append another character to the end of the accumulator.

Parameters:
cThe character to be appended to the buffer.

Definition at line 66 of file accumulator.h.

void wstring_accumulator::push_back ( const wchar_t data,
size_t  len 
)

The push_back method is used to append an array of characters to the end of the accumulator.

Parameters:
dataThe data to be appended to the buffer.
lenThe number of bytes of data.
void wstring_accumulator::push_back ( const wchar_t data)

The push_back method is used to append a NUL terminated string to the end of the accumulator.

Parameters:
dataThe string to be appended to the buffer.

The push_back method is used to append another string accumulator to the end of this accumulator.

Parameters:
dataThe string to be appended to the buffer.
void wstring_accumulator::push_back ( const wstring data)

The push_back method is used to append another string accumulator to the end of this accumulator.

Parameters:
dataThe string to be appended to the buffer.
size_t wstring_accumulator::size ( void  ) const [inline]

The size method is used to obtain the current size of the buffer in characters.

Definition at line 122 of file accumulator.h.


Field Documentation

The length instance variable is used to remember the base of an array of characters in the heap.

Definition at line 191 of file accumulator.h.

size_t wstring_accumulator::length [private]

The length instance variable is used to remember how many characters in the buffer are significant.

Definition at line 179 of file accumulator.h.

size_t wstring_accumulator::maximum [private]

The length instance variable is used to remember the allocated size of the buffer.

Definition at line 185 of file accumulator.h.


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