#include <accumulator.h>
Public Member Functions | |
~nstring_accumulator () | |
nstring_accumulator () | |
nstring_accumulator (const nstring_accumulator &) | |
nstring_accumulator & | operator= (const nstring_accumulator &) |
nstring | mkstr () const |
void | push_back (char c) |
void | push_back (const char *data, size_t len) |
void | push_back (const char *data) |
void | push_back (const nstring_accumulator &data) |
void | push_back (const nstring &data) |
void | clear () |
size_t | size () const |
bool | empty () const |
void | pop_back () |
char | back () |
const char * | get_data () const |
char | operator[] (size_t n) |
Private Member Functions | |
void | overflow (char c) |
Private Attributes | |
size_t | length |
size_t | maximum |
char * | buffer |
Definition at line 34 of file accumulator.h.
nstring_accumulator::~nstring_accumulator | ( | ) |
The destructor. Thou shalt not derive from this class because it isn't virtual.
nstring_accumulator::nstring_accumulator | ( | ) |
The default constructor.
nstring_accumulator::nstring_accumulator | ( | const nstring_accumulator & | ) |
The copy constructor.
nstring_accumulator& nstring_accumulator::operator= | ( | const nstring_accumulator & | ) |
The assignment operator.
nstring nstring_accumulator::mkstr | ( | ) | const |
The mkstr method is used to take the current contents of the accumulated buffer and turn it into a string.
void nstring_accumulator::push_back | ( | char | c | ) | [inline] |
The push_back method is used to append another character to the end of the accumulator.
c | The character to be appended to the buffer. |
Definition at line 72 of file accumulator.h.
void nstring_accumulator::push_back | ( | const char * | data, | |
size_t | len | |||
) |
The push_back method is used to append an array of characters to the end of the accumulator.
data | The data to be appended to the buffer. | |
len | The number of bytes of data. |
void nstring_accumulator::push_back | ( | const char * | data | ) |
The push_back method is used to append a NUL terminated string to the end of the accumulator.
data | The string to be appended to the buffer. |
void nstring_accumulator::push_back | ( | const nstring_accumulator & | data | ) |
The push_back method is used to append another string accumulator to the end of this accumulator.
data | The string to be appended to the buffer. |
void nstring_accumulator::push_back | ( | const nstring & | data | ) |
The push_back method is used to append another string accumulator to the end of this accumulator.
data | The string to be appended to the buffer. |
void nstring_accumulator::clear | ( | ) | [inline] |
The clear method is used to reset the length of the accumulated string to zero.
Definition at line 128 of file accumulator.h.
size_t nstring_accumulator::size | ( | ) | const [inline] |
The size method is used to obtain the current size of the buffer in characters.
Definition at line 134 of file accumulator.h.
bool nstring_accumulator::empty | ( | ) | const [inline] |
The empty method is used to determine if the buffer is empty (has a size of zero).
Definition at line 140 of file accumulator.h.
void nstring_accumulator::pop_back | ( | ) | [inline] |
The pop_back method is used to remove the last character from the buffer.
Definition at line 146 of file accumulator.h.
char nstring_accumulator::back | ( | ) | [inline] |
The back method is used to obtain the last character in the buffer, or NUL if the buffer is empty.
Definition at line 152 of file accumulator.h.
const char* nstring_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.
Please use this methdo as little as possible.
Definition at line 164 of file accumulator.h.
char nstring_accumulator::operator[] | ( | size_t | n | ) | [inline] |
The array index operator is used to obtain thr nth character in the buffer.
Definition at line 174 of file accumulator.h.
void nstring_accumulator::overflow | ( | char | 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).
c | The character to be appended to the buffer. |
size_t nstring_accumulator::length [private] |
The length instance variable is used to remember how many characters in the buffer are significant.
Definition at line 191 of file accumulator.h.
size_t nstring_accumulator::maximum [private] |
The length instance variable is used to remember the allocated size of the buffer.
Definition at line 197 of file accumulator.h.
char* nstring_accumulator::buffer [private] |
The length instance variable is used to remember the base of an array of characters in the heap.
Definition at line 203 of file accumulator.h.