Ultralight C++ API 1.3.0
|
#include <Ultralight/Buffer.h>
A fixed-size byte container for passing data around.
Static Public Member Functions | |
static RefPtr< Buffer > | Create (void *data, size_t size, void *user_data, DestroyBufferCallback destruction_callback) |
Create a Buffer from existing, user-owned data without any copies. | |
static RefPtr< Buffer > | CreateFromCopy (const void *data, size_t size) |
Create a Buffer from existing data, a deep copy of data will be made. | |
Public Member Functions | |
virtual void * | data ()=0 |
Get a pointer to the raw byte data. | |
virtual size_t | size () const =0 |
Get the size in bytes. | |
virtual void * | user_data ()=0 |
Get the user data associated with this Buffer, if any. | |
virtual bool | owns_data () const =0 |
Check whether this Buffer owns its own data (Buffer was created via CreateFromCopy). | |
Public Member Functions inherited from ultralight::RefCounted | |
virtual void | AddRef () const =0 |
virtual void | Release () const =0 |
virtual int | ref_count () const =0 |
Protected Member Functions | |
Buffer () | |
virtual | ~Buffer () |
Buffer (const Buffer &) | |
void | operator= (const Buffer &) |
Protected Member Functions inherited from ultralight::RefCounted | |
virtual | ~RefCounted () |
|
protected |
|
protectedvirtual |
|
protected |
|
static |
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. |
|
static |
Create a Buffer from existing data, a deep copy of data will be made.
|
pure virtual |
Get a pointer to the raw byte data.
|
protected |
|
pure virtual |
|
pure virtual |
Get the size in bytes.
|
pure virtual |
Get the user data associated with this Buffer, if any.