]> git.saurik.com Git - wxWidgets.git/blob - interface/buffer.h
turn GENERATE_HTML on otherwise CHM generation does not work correctly
[wxWidgets.git] / interface / buffer.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: buffer.h
3 // Purpose: interface of wxMemoryBuffer
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxMemoryBuffer
11 @wxheader{buffer.h}
12
13 A @b wxMemoryBuffer is a useful data structure for storing arbitrary sized
14 blocks
15 of memory. wxMemoryBuffer guarantees deletion of the memory block when the
16 object
17 is destroyed.
18
19 @library{wxbase}
20 @category{FIXME}
21 */
22 class wxMemoryBuffer
23 {
24 public:
25 //@{
26 /**
27 Create a new buffer.
28
29 @param size
30 size of new buffer.
31 */
32 wxMemoryBuffer(const wxMemoryBuffer& src);
33 wxMemoryBuffer(size_t size);
34 //@}
35
36 /**
37 Append a single byte to the buffer.
38
39 @param data
40 New byte to append to the buffer.
41 */
42 void AppendByte(char data);
43
44 /**
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
48 the existing data.
49
50 @param sizeNeeded
51 Amount of extra space required in the buffer for
52 the append operation
53 */
54 void* GetAppendBuf(size_t sizeNeeded);
55
56 /**
57 Returns the size of the buffer.
58 */
59 size_t GetBufSize();
60
61 /**
62 Return a pointer to the data in the buffer.
63 */
64 void* GetData();
65
66 /**
67 Returns the length of the valid data in the buffer.
68 */
69 size_t GetDataLen();
70
71 /**
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.
75 */
76 void* GetWriteBuf(size_t sizeNeeded);
77
78 /**
79 Ensures the buffer has at least @a size bytes available.
80 */
81 void SetBufSize(size_t size);
82
83 /**
84 Sets the length of the data stored in the buffer. Mainly useful for truncating
85 existing data.
86
87 @param size
88 New length of the valid data in the buffer. This is
89 distinct from the allocated size
90 */
91 void SetDataLen(size_t size);
92
93 /**
94 Update the length after completing a direct append, which
95 you must have used GetAppendBuf() to initialise.
96
97 @param sizeUsed
98 This is the amount of new data that has been
99 appended.
100 */
101 void UngetAppendBuf(size_t sizeUsed);
102
103 /**
104 Update the buffer after completing a direct write, which
105 you must have used GetWriteBuf() to initialise.
106
107 @param sizeUsed
108 The amount of data written in to buffer
109 by the direct write
110 */
111 void UngetWriteBuf(size_t sizeUsed);
112 };
113