35 if (_buffer != (
const char *)NULL) {
58 set_used_length(_used_length + size);
59 memcpy(_buffer + _used_length - size, buffer, size);
71 set_used_length(_used_length + size);
72 return _buffer + _used_length - size;
82 set_used_length(_used_length + size);
94 nassertv(position + size <= _used_length);
95 memcpy(_buffer + position, buffer, size);
106 nassertr(position + size <= _used_length, NULL);
107 return _buffer + position;
118 return string(_buffer, _used_length);
165 char *data = _buffer;
char * get_write_pointer(size_t size)
Adds the indicated number of bytes to the end of the data without initializing them, and returns a pointer to the beginning of the new data.
void append_data(const char *buffer, size_t size)
Adds the indicated bytes to the end of the data.
void clear()
Empties the contents of the data (without necessarily freeing its allocated memory).
void append_junk(size_t size)
Adds some uninitialized bytes to the end of the data.
size_t get_length() const
Returns the current length of the buffer.
char * take_data()
Returns the pointer to the beginning of the data buffer, and transfers ownership of the buffer to the...
void rewrite_data(size_t position, const char *buffer, size_t size)
Changes the data at the indicated position to the given value.
char * get_rewrite_pointer(size_t position, size_t size)
Returns a pointer into the middle of the data at the indicated point.
const char * get_data() const
Returns the beginning of the data buffer.
string get_string() const
Returns the data buffer as a string.