]> git.saurik.com Git - wxWidgets.git/blame - interface/buffer.h
rename fobr95.{cpp,h} files to foobar.{cpp,h}
[wxWidgets.git] / interface / buffer.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: buffer.h
e54c96f1 3// Purpose: interface of wxMemoryBuffer
23324ae1
FM
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
4cc4bfaf 30 size of new buffer.
23324ae1
FM
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
4cc4bfaf 40 New byte to append to the buffer.
23324ae1
FM
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
4cc4bfaf
FM
51 Amount of extra space required in the buffer for
52 the append operation
23324ae1 53 */
4cc4bfaf 54 void* GetAppendBuf(size_t sizeNeeded);
23324ae1
FM
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
4cc4bfaf 74 up to @a sizeNeeded bytes.
23324ae1 75 */
4cc4bfaf 76 void* GetWriteBuf(size_t sizeNeeded);
23324ae1
FM
77
78 /**
4cc4bfaf 79 Ensures the buffer has at least @a size bytes available.
23324ae1
FM
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
4cc4bfaf
FM
88 New length of the valid data in the buffer. This is
89 distinct from the allocated size
23324ae1
FM
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 97 @param sizeUsed
4cc4bfaf
FM
98 This is the amount of new data that has been
99 appended.
23324ae1
FM
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
4cc4bfaf
FM
108 The amount of data written in to buffer
109 by the direct write
23324ae1
FM
110 */
111 void UngetWriteBuf(size_t sizeUsed);
112};
e54c96f1 113