#include <stracc.h>
Detailed Description
The
stracc_t class is used to accumulate strings into a buffer.
Definition at line 34 of file stracc.h.
Constructor & Destructor Documentation
The destructor. Thou shalt not derive from this class because it isn't virtual.
Member Function Documentation
The mkstr method is used to take the current contents of the accumulated buffer and turn it into a string.
void stracc_t::push_back |
( |
char |
c |
) |
[inline] |
The push_back method is used to append another character to the end of the accumulator.
- Parameters:
-
| c | The character to be appended to the buffer. |
Definition at line 72 of file stracc.h.
void stracc_t::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.
- Parameters:
-
| data | The data to be appended to the buffer. |
| len | The number of bytes of data. |
void stracc_t::push_back |
( |
const char * |
data |
) |
|
The push_back method is used to append a NUL terminated string to the end of the accumulator.
- Parameters:
-
| data | The string to be appended to the buffer. |
void stracc_t::push_back |
( |
const stracc_t & |
data |
) |
|
The push_back method is used to append another string accumulator to the end of this accumulator.
- Parameters:
-
| data | The string to be appended to the buffer. |
char stracc_t::back |
( |
|
) |
[inline] |
The back method is used to obtain the last character in the buffer. The result is undefined if the buffer is empty.
Definition at line 118 of file stracc.h.
void stracc_t::clear |
( |
|
) |
[inline] |
The clear method is used to reset the length of the accumulated string to zero.
Definition at line 124 of file stracc.h.
size_t stracc_t::size |
( |
|
) |
const [inline] |
The size method is used to obtain the current size of the buffer in characters.
Definition at line 130 of file stracc.h.
bool stracc_t::empty |
( |
|
) |
const [inline] |
The empty method is used to determine if the buffer is empty (has a size of zero).
Definition at line 136 of file stracc.h.
void stracc_t::pop_back |
( |
|
) |
[inline] |
The pop_back method is used to remove the last character from the buffer.
Definition at line 142 of file stracc.h.
const char* stracc_t::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 154 of file stracc.h.
char stracc_t::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. Caveat emptor.
Definition at line 163 of file stracc.h.
size_t stracc_t::count_nul_characters |
( |
|
) |
const |
void stracc_t::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).
- Parameters:
-
| c | The character to be appended to the buffer. |
Field Documentation
The length instance variable is used to remember how many characters in the buffer are significant.
Definition at line 182 of file stracc.h.
The length instance variable is used to remember the allocated size of the buffer.
Definition at line 188 of file stracc.h.
The length instance variable is used to remember the base of an array of characters in the heap.
Definition at line 194 of file stracc.h.
The documentation for this class was generated from the following file: