version 1.14.2.1, 2013/01/08 13:36:16
|
version 1.15, 2009/12/15 11:39:33
|
|
|
*/ | */ |
const char* getData() const; | const char* getData() const; |
| |
/** |
|
Returns a pointer to the character buffer with the Buffer contents. |
|
This function does NOT append a null character. |
|
Resulting data should NOT be used with C string processing functions. |
|
*/ |
|
char* getContentPtr(); |
|
|
|
char get(Uint32 i) const; | char get(Uint32 i) const; |
| |
void set(Uint32 i, char x); | void set(Uint32 i, char x); |
|
|
| |
void append(char x); | void append(char x); |
| |
|
void append_unchecked(char x); |
|
|
void append(const char* data, Uint32 size); | void append(const char* data, Uint32 size); |
| |
|
void append_unchecked(const char* data, Uint32 size); |
|
|
|
void append(char c1, char c2); |
|
|
|
void append(char c1, char c2, char c3); |
|
|
void append(char c1, char c2, char c3, char c4); | void append(char c1, char c2, char c3, char c4); |
| |
void append( | void append( |
|
|
return _rep->data; | return _rep->data; |
} | } |
| |
inline char* Buffer::getContentPtr() |
|
{ |
|
return _rep->data; |
|
} |
|
|
|
inline char Buffer::get(Uint32 i) const | inline char Buffer::get(Uint32 i) const |
{ | { |
return _rep->data[i]; | return _rep->data[i]; |
|
|
_rep->data[_rep->size++] = x; | _rep->data[_rep->size++] = x; |
} | } |
| |
|
inline void Buffer::append_unchecked(char x) |
|
{ |
|
_rep->data[_rep->size++] = x; |
|
} |
|
|
inline void Buffer::append(const char* data, Uint32 size) | inline void Buffer::append(const char* data, Uint32 size) |
{ | { |
Uint32 cap = _rep->size + size; | Uint32 cap = _rep->size + size; |
|
|
_rep->size += size; | _rep->size += size; |
} | } |
| |
|
inline void Buffer::append_unchecked(const char* data, Uint32 size) |
|
{ |
|
memcpy(_rep->data + _rep->size, data, size); |
|
_rep->size += size; |
|
} |
|
|
inline void Buffer::clear() | inline void Buffer::clear() |
{ | { |
if (_rep->cap != 0) | if (_rep->cap != 0) |
|
|
remove(pos, 1); | remove(pos, 1); |
} | } |
| |
|
inline void Buffer::append(char c1, char c2) |
|
{ |
|
Uint32 cap = _rep->size + 2; |
|
|
|
if (cap > _rep->cap) |
|
_reserve_aux(cap); |
|
|
|
char* p = _rep->data + _rep->size; |
|
p[0] = c1; |
|
p[1] = c2; |
|
_rep->size += 2; |
|
} |
|
|
|
inline void Buffer::append(char c1, char c2, char c3) |
|
{ |
|
Uint32 cap = _rep->size + 3; |
|
|
|
if (cap > _rep->cap) |
|
_reserve_aux(cap); |
|
|
|
char* p = _rep->data + _rep->size; |
|
p[0] = c1; |
|
p[1] = c2; |
|
p[2] = c3; |
|
_rep->size += 3; |
|
} |
|
|
inline void Buffer::append(char c1, char c2, char c3, char c4) | inline void Buffer::append(char c1, char c2, char c3, char c4) |
{ | { |
Uint32 cap = _rep->size + 4; | Uint32 cap = _rep->size + 4; |