version 1.4, 2006/01/30 16:16:46
|
version 1.4.2.1, 2006/07/28 20:06:32
|
|
|
| |
size_t capacity() const; | size_t capacity() const; |
| |
|
/** |
|
Returns a pointer to a character buffer with the Buffer contents. |
|
The character buffer is null-terminated even if the Buffer contents |
|
do not include a null termination character. |
|
*/ |
const char* getData() const; | const char* getData() const; |
| |
char get(size_t i) const; | char get(size_t i) const; |
|
|
| |
inline Buffer::~Buffer() | inline Buffer::~Buffer() |
{ | { |
if (_rep != &_empty_rep) |
if (_rep->cap != 0) |
free(_rep); | free(_rep); |
} | } |
| |
|
|
| |
inline const char* Buffer::getData() const | inline const char* Buffer::getData() const |
{ | { |
|
if (_rep->cap == 0) |
|
{ |
|
const_cast<Buffer*>(this)->_append_char_aux(); |
|
} |
|
|
|
_rep->data[_rep->size] = '\0'; |
|
|
return _rep->data; | return _rep->data; |
} | } |
| |
|
|
| |
inline void Buffer::clear() | inline void Buffer::clear() |
{ | { |
if (_rep != &_empty_rep) |
if (_rep->cap != 0) |
_rep->size = 0; | _rep->size = 0; |
} | } |
| |