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