]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/membuf.tex
define _HPUX_SOURCE under HP-UX, otherwise many things are not defined in standard...
[wxWidgets.git] / docs / latex / wx / membuf.tex
CommitLineData
9b386eca
RG
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: membuf.tex
3%% Purpose: wxMemoryBuffer class documentation
4%% Author: Roger Gammans
5%% Modified by:
6%% Created: 08.06.2004
7%% RCS-ID: $Id$
8%% Copyright: (c) Roger Gammans
8795498c 9%% License: wxWindows license
9b386eca
RG
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxMemoryBuffer}}\label{wxmemorybuffer}
13
14A {\bf wxMemoryBuffer} is a useful data structure for storing arbitrary sized blocks
15of memory. wxMemoryBuffer guarantees deletion of the memory block when the object
16is destroyed.
17
18\wxheading{Derived from}
19
20None
21
22\wxheading{Include files}
23
24<wx/buffer.h>
25
26\latexignore{\rtfignore{\wxheading{Members}}}
27
dcbd177f 28\membersection{wxMemoryBuffer::wxMemoryBuffer}\label{wxmemorybufferctor}
9b386eca
RG
29
30\func{}{wxMemoryBuffer}{\param{const wxMemoryBuffer\&}{ src}}
31
32Copy constructor, refcounting is used for performance , but wxMemoryBuffer
33is not a copy-on-write structure so changes made to one buffer effect
34all copies made from it.
35
36\func{}{wxMemoryBuffer}{\param{size\_t}{ size}}
37
38Create a new buffer.
39
40\docparam{size}{size of new buffer.}
41
dcbd177f 42\membersection{wxMemoryBuffer::GetData}\label{wxmemorybuffergetdata}
9b386eca
RG
43
44\func{void* }{GetData}{\void}
45
46Return a pointer to the data in the buffer.
47
dcbd177f 48\membersection{wxMemoryBuffer::GetBufSize}\label{wxmemorybuffergetbufsize}
9b386eca
RG
49
50\func{size\_t}{GetBufSize}{\void}
51
52Returns the size of the buffer.
53
dcbd177f 54\membersection{wxMemoryBuffer::GetDataLen}\label{wxmemorybuffergetdatalen}
9b386eca
RG
55
56\func{size\_t}{GetDataLen}{\void}
57
58Returns the length of the valid data in the buffer.
59
dcbd177f 60\membersection{wxMemoryBuffer::SetBufSize}\label{wxmemorybuffersetbufsize}
9b386eca
RG
61
62\func{void}{SetBufSize}{\param{size\_t}{ size}}
63
64Ensures the buffer has at least {\it size} bytes available.
65
dcbd177f 66\membersection{wxMemoryBuffer::SetDataLen}\label{wxmemorybuffersetdatalen}
9b386eca
RG
67
68\func{void}{SetDataLen}{\param{size\_t}{ size}}
69
70Sets the length of the data stored in the buffer. Mainly useful for truncating existing data.
71
72\docparam{size}{New length of the valid data in the buffer. This is
73distinct from the allocated size}
74
dcbd177f 75\membersection{wxMemoryBuffer::GetWriteBuf}\label{wxmemorybuffergetwritebuf}
9b386eca
RG
76
77\func{void *}{GetWriteBuf}{\param{size\_t}{ sizeNeeded}}
78
79Ensure the buffer is big enough and return a pointer to the
80buffer which can be used to directly write into the buffer
81up to {\it sizeNeeded} bytes.
82
dcbd177f 83\membersection{wxMemoryBuffer::UngetWriteBuf}\label{wxmemorybufferungetwritebuf}
9b386eca
RG
84
85\func{void}{UngetWriteBuf}{\param{size\_t}{ sizeUsed}}
86
87Update the buffer after completing a direct write, which
88you must have used GetWriteBuf() to initialise.
89
90\docparam{sizeUsed}{The amount of data written in to buffer
91by the direct write}
92
dcbd177f 93\membersection{wxMemoryBuffer::GetAppendBuf}\label{wxmemorybuffergetappendbuf}
9b386eca
RG
94
95\func{void *}{GetAppendBuf}{\param{size\_t}{ sizeNeeded}}
96
97Ensure that the buffer is big enough and return a pointer to the start
98of the empty space in the buffer. This pointer can be used to directly
99write data into the buffer, this new data will be appended to
100the existing data.
101
102\docparam{sizeNeeded}{Amount of extra space required in the buffer for
103the append operation}
104
dcbd177f 105\membersection{wxMemoryBuffer::UngetAppendBuf}\label{wxmemorybufferungetappendbuf}
9b386eca
RG
106
107\func{void}{UngetAppendBuf}{\param{size\_t}{ sizeUsed}}
108
109Update the length after completing a direct append, which
110you must have used GetAppendBuf() to initialise.
111
112\docparam{sizeUsed}{This is the amount of new data that has been
113appended.}
114
dcbd177f 115\membersection{wxMemoryBuffer::AppendByte}\label{wxmemorybufferappendbyte}
9b386eca
RG
116
117\func{void}{AppendByte}{\param{char}{ data}}
118
119Append a single byte to the buffer.
120
121\docparam{data}{New byte to append to the buffer.}
122
dcbd177f 123\membersection{wxMemoryBuffer::AppendData}\label{wxmemorybufferappenddata}
9b386eca
RG
124
125\func{void}{AppendData}{\param{void*}{ data}, \param{size\_t}{ len}}
126
127Single call to append a data block to the buffer.
128
129\docparam{data}{Pointer to block to append to the buffer.}
130\docparam{len}{Length of data to append.}