Rudiments

- Main Page
- Classes

bytebuffer.h
1 // Copyright (c) 2002 David Muse
2 // See the COPYING file for more information.
3
4 #ifndef RUDIMENTS_BYTEBUFFER_H
5 #define RUDIMENTS_BYTEBUFFER_H
6
7 #include <rudiments/private/bytebufferincludes.h>
8
9 class bytebufferprivate;
10
21 class RUDIMENTS_DLLSPEC bytebuffer {
22 public:
23
26 bytebuffer();
27
30 bytebuffer(size_t initialsize, size_t increment);
31
38 bytebuffer(unsigned char *initialcontents,
39 size_t initialsize, size_t increment);
40
43 bytebuffer(const bytebuffer &v);
44
47 bytebuffer &operator=(const bytebuffer &v);
48
50 virtual ~bytebuffer();
51
57 void setPosition(size_t pos);
58
61 size_t getPosition();
62
71 bytebuffer *write(const unsigned char *data, size_t size);
72
80 bytebuffer *write(const char *string);
81
90 bytebuffer *write(const char *string, size_t size);
91
99 bytebuffer *write(char character);
100
108 bytebuffer *write(int16_t number);
109
117 bytebuffer *write(int32_t number);
118
126 bytebuffer *write(int64_t number);
127
135 bytebuffer *write(unsigned char character);
136
144 bytebuffer *write(uint16_t number);
145
153 bytebuffer *write(uint32_t number);
154
162 bytebuffer *write(uint64_t number);
163
171 bytebuffer *write(float number);
172
180 bytebuffer *write(double number);
181
185 bytebuffer *writeFormatted(const char *format, ...);
186
193 bytebuffer *writeFormatted(const char *format,
194 va_list *argp);
195
196
203 bytebuffer *append(const unsigned char *data, size_t size);
204
210 bytebuffer *append(const char *string);
211
218 bytebuffer *append(const char *string, size_t size);
219
225 bytebuffer *append(char character);
226
232 bytebuffer *append(int16_t number);
233
239 bytebuffer *append(int32_t number);
240
246 bytebuffer *append(int64_t number);
247
253 bytebuffer *append(unsigned char character);
254
260 bytebuffer *append(uint16_t number);
261
267 bytebuffer *append(uint32_t number);
268
274 bytebuffer *append(uint64_t number);
275
281 bytebuffer *append(float number);
282
288 bytebuffer *append(double number);
289
293 bytebuffer *appendFormatted(const char *format, ...);
294
301 bytebuffer *appendFormatted(const char *format,
302 va_list *argp);
303
305 virtual void truncate(size_t pos);
306
308 virtual void truncate();
309
310
314 ssize_t read(unsigned char *data, size_t size);
315
317 void clear();
318
320 const unsigned char *getBuffer();
321
324 size_t getSize();
325
328 size_t getEnd();
329
333 size_t getActualSize();
334
342 unsigned char *detachBuffer();
343
344 #include <rudiments/private/bytebuffer.h>
345 };
346
347 #endif
character
Definition: character.h:11
bytebuffer
Definition: bytebuffer.h:21