11 #ifndef __DSL_BUFFER_H__
12 #define __DSL_BUFFER_H__
14 #include <drift/Mutex.h>
16 #define DSL_BUFFER_USE_VECTOR
37 #ifdef DSL_BUFFER_USE_VECTOR
73 void RemoveFromEnd(uint32 len);
74 void RemoveFromBeginning(uint32 len);
77 bool Get(
char * buf, uint32 * size);
80 bool Get(
char * buf, uint32 size);
84 void Set(
const char * buf, uint32 len=0xFFFFFFFF);
85 void Append(
const char * buf, uint32 len=0xFFFFFFFF);
86 void Prepend(
const char * buf, uint32 len=0xFFFFFFFF);
88 void Append_int8(int8 val);
89 void Append_uint8(uint8 val);
90 void Append_int16(int16 val);
91 void Append_uint16(uint16 val);
92 void Append_int32(int32 val);
93 void Append_uint32(uint32 val);
94 void Append_int64(int64 val);
95 void Append_uint64(uint64 val);
bool buffer_append_int(DSL_BUFFER *buf, T y)
DSL_API void DSL_CC buffer_remove_front(DSL_BUFFER *buf, int64 len)
Remove data from the beginning of the buffer.
DSL_API void DSL_CC buffer_init(DSL_BUFFER *buf, bool useMutex=false)
Initialize the buffer, optionally with a mutex protecting it. If you don't use the mutex you need to ...
DSL_API void DSL_CC buffer_set(DSL_BUFFER *buf, const char *ptr, int64 len)
Sets the buffer to the specified data, discarding anything existing.
DSL_API_CLASS string buffer_as_string(DSL_BUFFER *buf)
Gets the buffer as a string.
DSL_API void DSL_CC buffer_free(DSL_BUFFER *buf)
Free the buffer when you are done with it.
DSL_API void DSL_CC buffer_clear(DSL_BUFFER *buf)
Sets the buffer length to 0 and clears the data. It is still ready to be used unlike buffer_free.
DSL_API void DSL_CC buffer_remove_end(DSL_BUFFER *buf, int64 len)
Remove data from the end of the buffer.
DSL_API bool DSL_CC buffer_append(DSL_BUFFER *buf, const char *ptr, int64 len)
Add data to the end of the buffer.
DSL_API bool DSL_CC buffer_prepend(DSL_BUFFER *buf, const char *ptr, int64 len)
Add data to the beginning of the buffer.
DSL_API void DSL_CC buffer_resize(DSL_BUFFER *buf, int64 len)
Resize the buffer, if the length is longer then the existing data the added byte values are undefined...
DSL_Mutex * hMutex
Handle to the mutex protecting this buffer, if enabled.