$szTitle = "wxmemorybuffer"; include "./_header.inc"; ?>
a wxmemorybuffer is a useful data structure for storing arbitrary sized blocks of memory. wxmemorybuffer guarantees deletion of the memory block when the object is destroyed.
derived from
none
include files
<wx/buffer.h>
members
wxmemorybuffer::wxmemorybuffer
wxmemorybuffer::getdata
wxmemorybuffer::getbufsize
wxmemorybuffer::getdatalen
wxmemorybuffer::setbufsize
wxmemorybuffer::setdatalen
wxmemorybuffer::getwritebuf
wxmemorybuffer::ungetwritebuf
wxmemorybuffer::getappendbuf
wxmemorybuffer::ungetappendbuf
wxmemorybuffer::appendbyte
wxmemorybuffer::appenddata
wxmemorybuffer(const wxmemorybuffer& src)
copy constructor, refcounting is used for performance , but wxmemorybuffer is not a copy-on-write structure so changes made to one buffer effect all copies made from it.
wxmemorybuffer(size_t size)
create a new buffer.
size
void* getdata()
return a pointer to the data in the buffer.
size_t getbufsize()
returns the size of the buffer.
size_t getdatalen()
returns the length of the valid data in the buffer.
void setbufsize(size_t size)
ensures the buffer has at least size bytes available.
void setdatalen(size_t size)
sets the length of the data stored in the buffer. mainly useful for truncating existing data.
size
void * getwritebuf(size_t sizeneeded)
ensure the buffer is big enough and return a pointer to the buffer which can be used to directly write into the buffer up to sizeneeded bytes.
void ungetwritebuf(size_t sizeused)
update the buffer after completing a direct write, which you must have used getwritebuf() to initialise.
sizeused
void * getappendbuf(size_t sizeneeded)
ensure that the buffer is big enough and return a pointer to the start of the empty space in the buffer. this pointer can be used to directly write data into the buffer, this new data will be appended to the existing data.
sizeneeded
void ungetappendbuf(size_t sizeused)
update the length after completing a direct append, which you must have used getappendbuf() to initialise.
sizeused
void appendbyte(char data)
append a single byte to the buffer.
data
void appenddata(void* data, size_t len)
single call to append a data block to the buffer.
data