1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxMemoryBuffer class documentation
4 %% Author: Roger Gammans
8 %% Copyright: (c) Roger Gammans
9 %% License: wxWidgets license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxMemoryBuffer
}}\label{wxmemorybuffer
}
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
18 \wxheading{Derived from
}
22 \wxheading{Include files
}
26 \latexignore{\rtfignore{\wxheading{Members
}}}
28 \membersection{wxMemoryBuffer::wxMemoryBuffer
}
30 \func{}{wxMemoryBuffer
}{\param{const wxMemoryBuffer\&
}{ src
}}
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.
36 \func{}{wxMemoryBuffer
}{\param{size
\_t}{ size
}}
40 \docparam{size
}{size of new buffer.
}
42 \membersection{wxMemoryBuffer::GetData
}
44 \func{void*
}{GetData
}{\void}
46 Return a pointer to the data in the buffer.
48 \membersection{wxMemoryBuffer::GetBufSize
}
50 \func{size
\_t}{GetBufSize
}{\void}
52 Returns the size of the buffer.
54 \membersection{wxMemoryBuffer::GetDataLen
}
56 \func{size
\_t}{GetDataLen
}{\void}
58 Returns the length of the valid data in the buffer.
60 \membersection{wxMemoryBuffer::SetBufSize
}
62 \func{void
}{SetBufSize
}{\param{size
\_t}{ size
}}
64 Ensures the buffer has at least
{\it size
} bytes available.
66 \membersection{wxMemoryBuffer::SetDataLen
}
68 \func{void
}{SetDataLen
}{\param{size
\_t}{ size
}}
70 Sets the length of the data stored in the buffer. Mainly useful for truncating existing data.
72 \docparam{size
}{New length of the valid data in the buffer. This is
73 distinct from the allocated size
}
75 \membersection{wxMemoryBuffer::GetWriteBuf
}
77 \func{void *
}{GetWriteBuf
}{\param{size
\_t}{ sizeNeeded
}}
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.
83 \membersection{wxMemoryBuffer::UngetWriteBuf
}
85 \func{void
}{UngetWriteBuf
}{\param{size
\_t}{ sizeUsed
}}
87 Update the buffer after completing a direct write, which
88 you must have used GetWriteBuf() to initialise.
90 \docparam{sizeUsed
}{The amount of data written in to buffer
93 \membersection{wxMemoryBuffer::GetAppendBuf
}
95 \func{void *
}{GetAppendBuf
}{\param{size
\_t}{ sizeNeeded
}}
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
102 \docparam{sizeNeeded
}{Amount of extra space required in the buffer for
103 the append operation
}
105 \membersection{wxMemoryBuffer::UngetAppendBuf
}
107 \func{void
}{UngetAppendBuf
}{\param{size
\_t}{ sizeUsed
}}
109 Update the length after completing a direct append, which
110 you must have used GetAppendBuf() to initialise.
112 \docparam{sizeUsed
}{This is the amount of new data that has been
115 \membersection{wxMemoryBuffer::AppendByte
}
117 \func{void
}{AppendByte
}{\param{char
}{ data
}}
119 Append a single byte to the buffer.
121 \docparam{data
}{New byte to append to the buffer.
}
123 \membersection{wxMemoryBuffer::AppendData
}
125 \func{void
}{AppendData
}{\param{void*
}{ data
},
\param{size
\_t}{ len
}}
127 Single call to append a data block to the buffer.
129 \docparam{data
}{Pointer to block to append to the buffer.
}
130 \docparam{len
}{Length of data to append.
}