]>
git.saurik.com Git - wxWidgets.git/blob - interface/buffer.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxMemoryBuffer
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 A @b wxMemoryBuffer is a useful data structure for storing arbitrary sized
15 of memory. wxMemoryBuffer guarantees deletion of the memory block when the
32 wxMemoryBuffer(const wxMemoryBuffer
& src
);
33 wxMemoryBuffer(size_t size
);
37 Append a single byte to the buffer.
40 New byte to append to the buffer.
42 void AppendByte(char data
);
45 Ensure that the buffer is big enough and return a pointer to the start
46 of the empty space in the buffer. This pointer can be used to directly
47 write data into the buffer, this new data will be appended to
51 Amount of extra space required in the buffer for
54 void* GetAppendBuf(size_t sizeNeeded
);
57 Returns the size of the buffer.
62 Return a pointer to the data in the buffer.
67 Returns the length of the valid data in the buffer.
72 Ensure the buffer is big enough and return a pointer to the
73 buffer which can be used to directly write into the buffer
74 up to @a sizeNeeded bytes.
76 void* GetWriteBuf(size_t sizeNeeded
);
79 Ensures the buffer has at least @a size bytes available.
81 void SetBufSize(size_t size
);
84 Sets the length of the data stored in the buffer. Mainly useful for truncating
88 New length of the valid data in the buffer. This is
89 distinct from the allocated size
91 void SetDataLen(size_t size
);
94 Update the length after completing a direct append, which
95 you must have used GetAppendBuf() to initialise.
98 This is the amount of new data that has been
101 void UngetAppendBuf(size_t sizeUsed
);
104 Update the buffer after completing a direct write, which
105 you must have used GetWriteBuf() to initialise.
108 The amount of data written in to buffer
111 void UngetWriteBuf(size_t sizeUsed
);