|
Ultralight C API 1.4.0
|
A fixed-size container for raw byte data.
#include <Ultralight/CAPI/CAPI_Buffer.h>
This class is used to represent raw data buffers in Ultralight. It intelligently manages the lifetime of the data and can optionally call a user-supplied callback to deallocate the data when the Buffer is destroyed.
Functions | |
| ULBuffer | ulCreateBuffer (void *data, size_t size, void *user_data, ulDestroyBufferCallback destruction_callback) |
| Create a Buffer from existing, user-owned data without any copies. | |
| ULBuffer | ulCreateBufferFromCopy (const void *data, size_t size) |
| Create a Buffer from existing data, a deep copy of data will be made. | |
| void | ulDestroyBuffer (ULBuffer buffer) |
| Destroy buffer (you should destroy any buffers you explicitly Create). | |
| void * | ulBufferGetData (ULBuffer buffer) |
| Get a pointer to the raw byte data. | |
| size_t | ulBufferGetSize (ULBuffer buffer) |
| Get the size in bytes. | |
| void * | ulBufferGetUserData (ULBuffer buffer) |
| Get the user data associated with this Buffer, if any. | |
| bool | ulBufferOwnsData (ULBuffer buffer) |
| Check whether this Buffer owns its own data (Buffer was created via ulCreateBufferFromCopy). | |
Typedefs | |
| typedef void(*) | ulDestroyBufferCallback(void *user_data, void *data) |
| void * ulBufferGetData | ( | ULBuffer | buffer | ) |
Get a pointer to the raw byte data.
| size_t ulBufferGetSize | ( | ULBuffer | buffer | ) |
Get the size in bytes.
| void * ulBufferGetUserData | ( | ULBuffer | buffer | ) |
Get the user data associated with this Buffer, if any.
| bool ulBufferOwnsData | ( | ULBuffer | buffer | ) |
Check whether this Buffer owns its own data (Buffer was created via ulCreateBufferFromCopy).
If this is false, Buffer will call the user-supplied destruction callback to deallocate data when this Buffer instance is destroyed.
| ULBuffer ulCreateBuffer | ( | void * | data, |
| size_t | size, | ||
| void * | user_data, | ||
| ulDestroyBufferCallback | destruction_callback ) |
Create a Buffer from existing, user-owned data without any copies.
An optional, user-supplied callback will be called to deallocate data upon destruction.
| data | A pointer to the data. |
| size | Size of the data in bytes. |
| user_data | Optional user data that will be passed to destruction_callback when the returned Buffer is destroyed. |
| destruction_callback | Optional callback that will be called upon destruction. Pass a null pointer if you don't want to be informed of destruction. |
| ULBuffer ulCreateBufferFromCopy | ( | const void * | data, |
| size_t | size ) |
Create a Buffer from existing data, a deep copy of data will be made.
| void ulDestroyBuffer | ( | ULBuffer | buffer | ) |
Destroy buffer (you should destroy any buffers you explicitly Create).
| typedef void(*) ulDestroyBufferCallback(void *user_data, void *data) |