64#define vlBufferInit(bufferPtr) vlBufferInitSz(bufferPtr, VL_DEFAULT_MEMORY_SIZE)
void vlBufferClear(vl_buffer *buffer)
Sets the entirety of the buffer to zero. Also resets offset and computed size.
Definition vl_buffer.c:36
void vlBufferSeekRelative(vl_buffer *buffer, vl_intptr_t offset)
Seeks the internal offset relative to the current offset. Adds the specified offset to the offset int...
Definition vl_buffer.c:101
vl_memsize_t vlBufferRead(vl_buffer *buffer, vl_memsize_t size, void *dest)
Copies bytes from the buffer to the specified destination. Performs a copy from the buffer to the spe...
Definition vl_buffer.c:87
void vlBufferSeek(vl_buffer *buffer, vl_uintptr_t offset)
Sets the buffer offset relative to the beginning of the allocation.
Definition vl_buffer.c:97
vl_dsoffs_t offset
Read-write offset of the buffer.
Definition vl_buffer.h:28
void vlBufferDelete(vl_buffer *buffer)
Deletes the specified buffer.
Definition vl_buffer.c:121
vl_transient * vlBufferBegin(vl_buffer *buffer)
Returns a pointer to the beginning of the buffer allocation.
Definition vl_buffer.c:113
vl_buffer * vlBufferClone(const vl_buffer *src, vl_buffer *dest)
Clones the source buffer to the destination buffer.
Definition vl_buffer.c:47
vl_memsize_t vlBufferWrite(vl_buffer *buffer, vl_memsize_t size, const void *src)
Performs a copy from the specified source pointer into the buffer. The bytes are written at the curre...
Definition vl_buffer.c:70
vl_memsize_t size
Virtual size of the buffer. Actual capacity of the allocation is always equal to or larger.
Definition vl_buffer.h:23
vl_buffer * vlBufferNew(void)
Allocates a new buffer, and initializes it with the default capacity. The buffer must be deleted with...
Definition vl_buffer.c:5
void vlBufferShrinkToFit(vl_buffer *buffer)
Resizes the specified buffer to hold a capacity equal to the current size.
Definition vl_buffer.c:42
vl_transient * vlBufferEnd(vl_buffer *buffer)
Returns a pointer to the end of the buffer allocation.
Definition vl_buffer.c:117
vl_buffer * vlBufferNewSz(vl_memsize_t initialCapacity)
Allocates a new buffer, and initializes it with a capacity of N bytes. The buffer must be deleted wit...
Definition vl_buffer.c:9
void vlBufferSeekEnd(vl_buffer *buffer)
Seeks the internal offset to the end of the buffer. Moves the offset integer belonging to the buffer ...
Definition vl_buffer.c:109
vl_memory * data
Actual allocation managed by the buffer.
Definition vl_buffer.h:33
vl_memsize_t vlBufferCopy(vl_buffer *src, vl_buffer *dest, vl_memsize_t len)
Copies a series of bytes from one buffer to another.
Definition vl_buffer.c:63
void vlBufferFree(vl_buffer *buffer)
Frees the specified buffer.
Definition vl_buffer.c:126
void vlBufferInitSz(vl_buffer *buffer, vl_memsize_t initialCapacity)
Initializes a buffer instance for the first time. This will create the initial allocation for the spe...
Definition vl_buffer.c:19
void vlBufferReset(vl_buffer *buffer)
Resets the state of the specified buffer, setting the offset integer to zero. This will re-allocate t...
Definition vl_buffer.c:25
void vlBufferSeekBegin(vl_buffer *buffer)
Seeks the internal offset to the beginning of the buffer. Moves the offset integer belonging to the b...
Definition vl_buffer.c:105
void vlBufferResetSz(vl_buffer *buffer, vl_memsize_t newCapacity)
Resets the state of the specified buffer, setting the offset integer to zero. This will re-allocate t...
Definition vl_buffer.c:30
A multi-purpose byte buffer.
Definition vl_buffer.h:19
VL_MEMORY_SIZE_T vl_memsize_t
Definition vl_memory.h:18
VL_MEMORY_T vl_memory
Definition vl_memory.h:76
VL_MEMORY_T vl_transient
Definition vl_memory.h:85
VL_UPTR_T vl_uintptr_t
Unsigned integer type suitable for expressing memory addresses.
Definition vl_numtypes.h:101
VL_IPTR_T vl_intptr_t
Signed integer type suitable for expressing memory addresses.
Definition vl_numtypes.h:106
VL_STRUCTURE_OFFSET_T vl_dsoffs_t
Byte offset type for data structures.
Definition vl_numtypes.h:8