2004-07-16 09:09:52 -04:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%% Name: membuf.tex
|
|
|
|
%% Purpose: wxMemoryBuffer class documentation
|
|
|
|
%% Author: Roger Gammans
|
|
|
|
%% Modified by:
|
|
|
|
%% Created: 08.06.2004
|
|
|
|
%% RCS-ID: $Id$
|
|
|
|
%% Copyright: (c) Roger Gammans
|
2005-02-22 10:09:56 -05:00
|
|
|
%% License: wxWindows license
|
2004-07-16 09:09:52 -04:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
\section{\class{wxMemoryBuffer}}\label{wxmemorybuffer}
|
|
|
|
|
|
|
|
A {\bf 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.
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
None
|
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/buffer.h>
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxMemoryBuffer::wxMemoryBuffer}\label{wxmemorybufferctor}
|
2004-07-16 09:09:52 -04:00
|
|
|
|
|
|
|
\func{}{wxMemoryBuffer}{\param{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.
|
|
|
|
|
|
|
|
\func{}{wxMemoryBuffer}{\param{size\_t}{ size}}
|
|
|
|
|
|
|
|
Create a new buffer.
|
|
|
|
|
|
|
|
\docparam{size}{size of new buffer.}
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxMemoryBuffer::GetData}\label{wxmemorybuffergetdata}
|
2004-07-16 09:09:52 -04:00
|
|
|
|
|
|
|
\func{void* }{GetData}{\void}
|
|
|
|
|
|
|
|
Return a pointer to the data in the buffer.
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxMemoryBuffer::GetBufSize}\label{wxmemorybuffergetbufsize}
|
2004-07-16 09:09:52 -04:00
|
|
|
|
|
|
|
\func{size\_t}{GetBufSize}{\void}
|
|
|
|
|
|
|
|
Returns the size of the buffer.
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxMemoryBuffer::GetDataLen}\label{wxmemorybuffergetdatalen}
|
2004-07-16 09:09:52 -04:00
|
|
|
|
|
|
|
\func{size\_t}{GetDataLen}{\void}
|
|
|
|
|
|
|
|
Returns the length of the valid data in the buffer.
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxMemoryBuffer::SetBufSize}\label{wxmemorybuffersetbufsize}
|
2004-07-16 09:09:52 -04:00
|
|
|
|
|
|
|
\func{void}{SetBufSize}{\param{size\_t}{ size}}
|
|
|
|
|
|
|
|
Ensures the buffer has at least {\it size} bytes available.
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxMemoryBuffer::SetDataLen}\label{wxmemorybuffersetdatalen}
|
2004-07-16 09:09:52 -04:00
|
|
|
|
|
|
|
\func{void}{SetDataLen}{\param{size\_t}{ size}}
|
|
|
|
|
|
|
|
Sets the length of the data stored in the buffer. Mainly useful for truncating existing data.
|
|
|
|
|
|
|
|
\docparam{size}{New length of the valid data in the buffer. This is
|
|
|
|
distinct from the allocated size}
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxMemoryBuffer::GetWriteBuf}\label{wxmemorybuffergetwritebuf}
|
2004-07-16 09:09:52 -04:00
|
|
|
|
|
|
|
\func{void *}{GetWriteBuf}{\param{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 {\it sizeNeeded} bytes.
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxMemoryBuffer::UngetWriteBuf}\label{wxmemorybufferungetwritebuf}
|
2004-07-16 09:09:52 -04:00
|
|
|
|
|
|
|
\func{void}{UngetWriteBuf}{\param{size\_t}{ sizeUsed}}
|
|
|
|
|
|
|
|
Update the buffer after completing a direct write, which
|
|
|
|
you must have used GetWriteBuf() to initialise.
|
|
|
|
|
|
|
|
\docparam{sizeUsed}{The amount of data written in to buffer
|
|
|
|
by the direct write}
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxMemoryBuffer::GetAppendBuf}\label{wxmemorybuffergetappendbuf}
|
2004-07-16 09:09:52 -04:00
|
|
|
|
|
|
|
\func{void *}{GetAppendBuf}{\param{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.
|
|
|
|
|
|
|
|
\docparam{sizeNeeded}{Amount of extra space required in the buffer for
|
|
|
|
the append operation}
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxMemoryBuffer::UngetAppendBuf}\label{wxmemorybufferungetappendbuf}
|
2004-07-16 09:09:52 -04:00
|
|
|
|
|
|
|
\func{void}{UngetAppendBuf}{\param{size\_t}{ sizeUsed}}
|
|
|
|
|
|
|
|
Update the length after completing a direct append, which
|
|
|
|
you must have used GetAppendBuf() to initialise.
|
|
|
|
|
|
|
|
\docparam{sizeUsed}{This is the amount of new data that has been
|
|
|
|
appended.}
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxMemoryBuffer::AppendByte}\label{wxmemorybufferappendbyte}
|
2004-07-16 09:09:52 -04:00
|
|
|
|
|
|
|
\func{void}{AppendByte}{\param{char}{ data}}
|
|
|
|
|
|
|
|
Append a single byte to the buffer.
|
|
|
|
|
|
|
|
\docparam{data}{New byte to append to the buffer.}
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxMemoryBuffer::AppendData}\label{wxmemorybufferappenddata}
|
2004-07-16 09:09:52 -04:00
|
|
|
|
|
|
|
\func{void}{AppendData}{\param{void*}{ data}, \param{size\_t}{ len}}
|
|
|
|
|
|
|
|
Single call to append a data block to the buffer.
|
|
|
|
|
|
|
|
\docparam{data}{Pointer to block to append to the buffer.}
|
|
|
|
\docparam{len}{Length of data to append.}
|