libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
|
#include <gimbal_byte_array.h>
Data Fields | |
size_t | size |
uint8_t * | pData |
Related Symbols | |
(Note that these are not member symbols.) | |
Lifetime Management | |
Methods for creation and reference management | |
GblByteArray * | GblByteArray_create (size_t size, const void *pData, GblContext *pCtx) |
GblByteArray * | GblByteArray_ref (GblByteArray *pSelf) |
GblRefCount | GblByteArray_unref (GblByteArray *pSelf) |
Type Operators | |
Assignment and comparison methods | |
GBL_RESULT | GblByteArray_copy (GblByteArray *pSelf, const GblByteArray *pOther) |
GBL_RESULT | GblByteArray_move (GblByteArray *pSelf, GblByteArray *pOther) |
GBL_RESULT | GblByteArray_acquire (GblByteArray *pSelf, size_t bytes, void *pData) |
GBL_RESULT | GblByteArray_release (GblByteArray *pSelf, size_t *pSize, void **ppData) |
int | GblByteArray_compare (const GblByteArray *pSelf, const GblByteArray *pRhs) |
GblBool | GblByteArray_equals (const GblByteArray *pSelf, const GblByteArray *pRhs) |
Properties | |
Methods for getting values | |
GblRefCount | GblByteArray_refCount (const GblByteArray *pSelf) |
GblContext * | GblByteArray_context (const GblByteArray *pSelf) |
size_t | GblByteArray_size (const GblByteArray *pSelf) |
void * | GblByteArray_data (const GblByteArray *pSelf) |
GblBool | GblByteArray_empty (const GblByteArray *pSelf) |
GblHash | GblByteArray_hash (const GblByteArray *pSelf) |
const char * | GblByteArray_cString (const GblByteArray *pSelf) |
GblStringView | GblByteArray_stringView (const GblByteArray *pSelf) |
Reading and Writing | |
Methods for fetching and storing data | |
uint8_t | GblByteArray_at (const GblByteArray *pSelf, size_t index) |
GBL_RESULT | GblByteArray_read (const GblByteArray *pSelf, size_t offset, size_t bytes, void *pOut) |
GBL_RESULT | GblByteArray_write (GblByteArray *pSelf, size_t offset, size_t bytes, const void *pIn) |
GBL_RESULT | GblByteArray_set (GblByteArray *pSelf, size_t bytes, const void *pData) |
List API | |
Methods providing a standard list-style interface | |
GBL_RESULT | GblByteArray_append (GblByteArray *pSelf, size_t bytes, const void *pData) |
GBL_RESULT | GblByteArray_prepend (GblByteArray *pSelf, size_t bytes, const void *pData) |
GBL_RESULT | GblByteArray_insert (GblByteArray *pSelf, size_t offset, size_t bytes, const void *pData) |
GBL_RESULT | GblByteArray_erase (GblByteArray *pSelf, size_t offset, size_t bytes) |
GBL_RESULT | GblByteArray_clear (GblByteArray *pSelf) |
GBL_RESULT | GblByteArray_resize (GblByteArray *pSelf, size_t bytes) |
GBL_RESULT | GblByteArray_grow (GblByteArray *pSelf, size_t bytes) |
GBL_RESULT | GblByteArray_shrink (GblByteArray *pSelf, size_t bytes) |
Reference-counted resizable array of bytes.
GblByteArray is a reference-counted dynamic array of bytes with a list-style API as well as various methods for manipulating and extracting subarrays.
Definition at line 36 of file gimbal_byte_array.h.
|
related |
Creates and returns a new GblByteArray, with the given size
and optional initial data and context.
|
related |
Increments the reference counter of the given GblByteArray by 1, returning back a pointer to it.
|
related |
Decrements the reference counter of the given GblByteArray by 1, destroying it upon hitting 0.
|
related |
Frees the existing allocation and copies over the allocation and size from pOther
.
|
related |
Frees the existing allocation and takes the allocation from pOther
, clearing it.
|
related |
Frees the existing allocation and takes the allocation given by pData
with the given size.
|
related |
Releases the internal allocation resource, copying it and its size out, clearing them from pSelf
.
|
related |
Compares the two byte arrays with semantics similar to memcmp(), returning the result.
|
related |
Returns GBL_TRUE if the values stored within the two byte arrays are all equal.
|
related |
Returns the current number of active references to the given GblByteArray.
|
related |
Returns the GblContext pointer the GblByteArray was constructed with.
|
related |
Returns the size of the GblByteArray (GblByteArray::size)
|
related |
Returns the data pointer of the GblByteArray (GblByteArray::pData)
|
related |
Return GBL_TRUE if the given GblByteArray is empty (0 bytes)
|
related |
Computes a hash over the GblByteArray, returning its value.
|
related |
Returns the GblByteArray as a C string, or NULL if it's not NULL-terminated.
|
related |
Returns a GblStringView spanning the bytes of the GblByteArray.
|
related |
Returns the value of the byte located at the given index
, raising an error upon out-of-range access.
|
related |
Attempts to read a range of bytes
starting at offset
, copying them to pOut
, returning a result code.
|
related |
Attempts to write a range of bytes
starting at offset
, copying from pIn
, returning a result code.
|
related |
Resizes the GblByteArray to bytes
, copying pData
over into its internal array.
|
related |
Appends bytes
from pData
to the end of the given GblByteArray, returning a status code.
|
related |
Prepends bytes
from pData
to the beginning of the given GblByteArray, returning a status code.
|
related |
Inserts bytes
into the given GblByteArray at offset
, copying from pData
, returning a status code and resizing as needed.
|
related |
Erases bytes
from the given GblByteArray starting at offset
, returning a status code.
|
related |
Clears all bytes from the given GblByteArray, freeing its allocation and resetting its size to 0.
|
related |
Resizes the given GblByteArray to a size of bytes
, appending byte values of 0 when growing, returning a status code.
|
related |
Grows the given GblByteArray by the given number of bytes
, filling the new ones with 0s, returning a status code.
|
related |
Shrinks the given GblByteArray by the given number of bytes
, returning a status code.
size_t GblByteArray::size |
Size of the pData structure.
Definition at line 37 of file gimbal_byte_array.h.
uint8_t* GblByteArray::pData |
Actual data payload, contiguously-allocated array of bytes.
Definition at line 38 of file gimbal_byte_array.h.