DSL
Classes | Functions
Data Buffer

Classes

struct  DSL_BUFFER
 

Functions

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 either synchronize access yourself or only use it from a single thread.
 
DSL_API void DSL_CC buffer_free (DSL_BUFFER *buf)
 Free the buffer when you are done with it.
 
DSL_API_CLASS string buffer_as_string (DSL_BUFFER *buf)
 Gets the buffer as a string.
 
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_set (DSL_BUFFER *buf, const char *ptr, int64 len)
 Sets the buffer to the specified data, discarding anything existing.
 
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_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_remove_end (DSL_BUFFER *buf, int64 len)
 Remove data from 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 bool DSL_CC buffer_append (DSL_BUFFER *buf, const char *ptr, int64 len)
 Add data to the end of the buffer.
 
template<typename T >
bool buffer_append_int (DSL_BUFFER *buf, T y)
 

Detailed Description

Function Documentation

◆ buffer_append_int()

template<typename T >
bool buffer_append_int ( DSL_BUFFER buf,
y 
)

Adds an int to the end of the buffer in native endianness. Usage: Example to add a 32-bit unsigned int with value 12345: buffer_append_int<uint32>(&buf, 12345);

Definition at line 59 of file Buffer.h.

References buffer_append().