]> git.saurik.com Git - wxWidgets.git/blame - interface/buffer.h
adjusted indentation with astyle; added Id keyword
[wxWidgets.git] / interface / buffer.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: buffer.h
3// Purpose: documentation for wxMemoryBuffer class
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxMemoryBuffer
11 @wxheader{buffer.h}
7c913512 12
23324ae1
FM
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
7c913512
FM
17 is destroyed.
18
23324ae1
FM
19 @library{wxbase}
20 @category{FIXME}
21*/
7c913512 22class wxMemoryBuffer
23324ae1
FM
23{
24public:
25 //@{
26 /**
27 Create a new buffer.
28
7c913512 29 @param size
23324ae1
FM
30 size of new buffer.
31 */
32 wxMemoryBuffer(const wxMemoryBuffer& src);
7c913512 33 wxMemoryBuffer(size_t size);
23324ae1
FM
34 //@}
35
36 /**
37 Append a single byte to the buffer.
38
7c913512 39 @param data
23324ae1
FM
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
7c913512 46 of the empty space in the buffer. This pointer can be used to directly
23324ae1
FM
47 write data into the buffer, this new data will be appended to
48 the existing data.
49
7c913512 50 @param sizeNeeded
23324ae1
FM
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 @e sizeNeeded bytes.
75 */
76 void * GetWriteBuf(size_t sizeNeeded);
77
78 /**
79 Ensures the buffer has at least @e 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
7c913512 87 @param size
23324ae1
FM
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
7c913512
FM
97 @param sizeUsed
98 This is the amount of new data that has been
23324ae1
FM
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
7c913512 107 @param sizeUsed
23324ae1
FM
108 The amount of data written in to buffer
109 by the direct write
110 */
111 void UngetWriteBuf(size_t sizeUsed);
112};