|
libcmutils 0.6.5
Multi-platform C99 utility library
|
Manipulation of bytes. More...
Data Fields | |
| CMUTIL_ByteBuffer *(* | AddByte )(CMUTIL_ByteBuffer *buffer, uint8_t b) |
| Append a byte to this buffer. | |
| CMUTIL_ByteBuffer *(* | AddBytes )(CMUTIL_ByteBuffer *buffer, const uint8_t *bytes, uint32_t length) |
| Adds a sequence of bytes to the specified buffer. | |
| CMUTIL_ByteBuffer *(* | AddBytesPart )(CMUTIL_ByteBuffer *buffer, const uint8_t *bytes, uint32_t offset, uint32_t length) |
| Adds a portion of a byte array to the specified buffer. | |
| CMUTIL_ByteBuffer *(* | InsertByteAt )(CMUTIL_ByteBuffer *buffer, uint32_t index, uint8_t b) |
| Inserts a byte at a specified index in the byte buffer. | |
| CMUTIL_ByteBuffer *(* | InsertBytesAt )(CMUTIL_ByteBuffer *buffer, uint32_t index, const uint8_t *bytes, uint32_t length) |
| Inserts a sequence of bytes at a specified index in the byte buffer. | |
| int(* | GetAt )(const CMUTIL_ByteBuffer *buffer, uint32_t index) |
| Retrieves the byte at a specific index in the byte buffer. | |
| size_t(* | GetSize )(const CMUTIL_ByteBuffer *buffer) |
| Retrieves the size of the given byte buffer. | |
| uint8_t *(* | GetBytes )(CMUTIL_ByteBuffer *buffer) |
| Function pointer to retrieve a byte array from a CMUTIL_ByteBuffer. | |
| CMBool(* | ShrinkTo )(CMUTIL_ByteBuffer *buffer, size_t size) |
| Function pointer for resizing a CMUTIL_ByteBuffer to a specified size. | |
| size_t(* | GetCapacity )(const CMUTIL_ByteBuffer *buffer) |
| Retrieves the total capacity of the specified byte buffer. | |
| void(* | Destroy )(CMUTIL_ByteBuffer *buffer) |
| Function pointer for destroying a CMUTIL_ByteBuffer instance. | |
| void(* | Clear )(CMUTIL_ByteBuffer *buffer) |
| Function pointer for clearing the contents of a CMUTIL_ByteBuffer. | |
Manipulation of bytes.
| CMUTIL_ByteBuffer *(* CMUTIL_ByteBuffer::AddByte) (CMUTIL_ByteBuffer *buffer, uint8_t b) |
Append a byte to this buffer.
| buffer | This buffer object. |
| b | A byte to be added. |
| CMUTIL_ByteBuffer *(* CMUTIL_ByteBuffer::AddBytes) (CMUTIL_ByteBuffer *buffer, const uint8_t *bytes, uint32_t length) |
Adds a sequence of bytes to the specified buffer.
This function appends a provided array of bytes to the end of the given byte buffer. It also updates the buffer's internal state to include the newly added bytes.
| buffer | A pointer to the byte buffer where the bytes will be added. |
| bytes | A pointer to the array of bytes to be appended. |
| length | The number of bytes to be added from the array. |
| CMUTIL_ByteBuffer *(* CMUTIL_ByteBuffer::AddBytesPart) (CMUTIL_ByteBuffer *buffer, const uint8_t *bytes, uint32_t offset, uint32_t length) |
Adds a portion of a byte array to the specified buffer.
This function appends a subset of the provided byte array to the specified byte buffer. The portion of the array to be appended is determined by the provided offset and length. The function updates the buffer's state to reflect the added bytes.
| buffer | A pointer to the byte buffer where the bytes will be added. |
| bytes | A pointer to the source byte array. |
| offset | The starting position within the source array from which bytes will be copied. |
| length | The number of bytes to add from the source array. |
| CMUTIL_ByteBuffer *(* CMUTIL_ByteBuffer::InsertByteAt) (CMUTIL_ByteBuffer *buffer, uint32_t index, uint8_t b) |
Inserts a byte at a specified index in the byte buffer.
This function allows placing a single byte at any specified position within the given byte buffer. The existing data in the buffer is shifted as needed to make space for the new byte. If the insertion fails, the buffer remains unmodified.
| buffer | A pointer to the byte buffer where the byte will be inserted. |
| index | The position in the buffer at which the byte should be inserted. |
| b | The byte to insert into the buffer. |
| CMUTIL_ByteBuffer *(* CMUTIL_ByteBuffer::InsertBytesAt) (CMUTIL_ByteBuffer *buffer, uint32_t index, const uint8_t *bytes, uint32_t length) |
Inserts a sequence of bytes at a specified index in the byte buffer.
This function allows inserting an array of bytes into a specific position within the given byte buffer. The existing data in the buffer is shifted as needed to make space for the new bytes. If the insertion operation fails, the buffer remains unmodified.
| buffer | A pointer to the byte buffer where the bytes will be inserted. |
| index | The position in the buffer at which the bytes should be inserted. |
| bytes | A pointer to the array of bytes to insert into the buffer. |
| length | The number of bytes to insert from the array. |
| int(* CMUTIL_ByteBuffer::GetAt) (const CMUTIL_ByteBuffer *buffer, uint32_t index) |
Retrieves the byte at a specific index in the byte buffer.
This function provides access to the byte located at a given index within the specified byte buffer without modifying the buffer. If the index is out of bounds, it returns a negative value.
| buffer | A pointer to the byte buffer from which the byte should be retrieved. |
| index | The position of the byte to retrieve within the buffer. |
| size_t(* CMUTIL_ByteBuffer::GetSize) (const CMUTIL_ByteBuffer *buffer) |
Retrieves the size of the given byte buffer.
This function returns the total number of bytes currently stored in the specified byte buffer. It provides a way to determine the current capacity or length of the buffer's contents.
| buffer | A pointer to the byte buffer whose size will be retrieved. |
| uint8_t *(* CMUTIL_ByteBuffer::GetBytes) (CMUTIL_ByteBuffer *buffer) |
Function pointer to retrieve a byte array from a CMUTIL_ByteBuffer.
This variable is a function pointer that, when assigned, points to a function capable of extracting a byte array stored in the specified CMUTIL_ByteBuffer structure.
| buffer | Pointer to a CMUTIL_ByteBuffer structure from which the byte array is to be retrieved. |
| CMBool(* CMUTIL_ByteBuffer::ShrinkTo) (CMUTIL_ByteBuffer *buffer, size_t size) |
Function pointer for resizing a CMUTIL_ByteBuffer to a specified size.
This function reduces the size of the provided byte buffer to the specified size if possible. Success or failure is indicated through the returned boolean value.
| buffer | A pointer to the CMUTIL_ByteBuffer to be resized. |
| size | The target size to shrink the buffer to. |
| size_t(* CMUTIL_ByteBuffer::GetCapacity) (const CMUTIL_ByteBuffer *buffer) |
Retrieves the total capacity of the specified byte buffer.
This function pointer returns the maximum number of bytes the given CMUTIL_ByteBuffer can hold without resize operation.
| buffer | A pointer to the CMUTIL_ByteBuffer instance. |
| void(* CMUTIL_ByteBuffer::Destroy) (CMUTIL_ByteBuffer *buffer) |
Function pointer for destroying a CMUTIL_ByteBuffer instance.
This function is responsible for releasing and cleaning up resources associated with a given CMUTIL_ByteBuffer object.
| buffer | A pointer to the CMUTIL_ByteBuffer instance to be destroyed. |
| void(* CMUTIL_ByteBuffer::Clear) (CMUTIL_ByteBuffer *buffer) |
Function pointer for clearing the contents of a CMUTIL_ByteBuffer.
This function is used to reset or clear the data in a provided byte buffer, ensuring that its contents are erased or set back to an initial state.
| buffer | A pointer to the CMUTIL_ByteBuffer to be cleared. |