Ultralight C++ API 1.3.0
Loading...
Searching...
No Matches
ultralight::Buffer Class Referenceabstract

#include <Ultralight/Buffer.h>

Details

A fixed-size byte container for passing data around.

Inheritance diagram for ultralight::Buffer:
ultralight::RefCounted

Static Public Member Functions

static RefPtr< BufferCreate (void *data, size_t size, void *user_data, DestroyBufferCallback destruction_callback)
 Create a Buffer from existing, user-owned data without any copies.
 
static RefPtr< BufferCreateFromCopy (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 ()
 

Constructor & Destructor Documentation

◆ Buffer() [1/2]

ultralight::Buffer::Buffer ( )
protected

◆ ~Buffer()

virtual ultralight::Buffer::~Buffer ( )
protectedvirtual

◆ Buffer() [2/2]

ultralight::Buffer::Buffer ( const Buffer )
protected

Member Function Documentation

◆ Create()

static RefPtr< Buffer > ultralight::Buffer::Create ( void *  data,
size_t  size,
void *  user_data,
DestroyBufferCallback  destruction_callback 
)
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.

Parameters
dataA pointer to the data.
sizeSize of the data in bytes.
user_dataOptional user data that will be passed to destruction_callback when the returned Buffer is destroyed.
destruction_callbackOptional callback that will be called upon destruction. Pass a null pointer if you don't want to be informed of destruction.
Returns
A ref-counted Buffer object that wraps the existing data.

◆ CreateFromCopy()

static RefPtr< Buffer > ultralight::Buffer::CreateFromCopy ( const void *  data,
size_t  size 
)
static

Create a Buffer from existing data, a deep copy of data will be made.

◆ data()

virtual void * ultralight::Buffer::data ( )
pure virtual

Get a pointer to the raw byte data.

◆ operator=()

void ultralight::Buffer::operator= ( const Buffer )
protected

◆ owns_data()

virtual bool ultralight::Buffer::owns_data ( ) const
pure virtual

Check whether this Buffer owns its own data (Buffer was created via CreateFromCopy).

If this is false, Buffer will call the user-supplied destruction callback to deallocate data when this Buffer instance is destroyed.

◆ size()

virtual size_t ultralight::Buffer::size ( ) const
pure virtual

Get the size in bytes.

◆ user_data()

virtual void * ultralight::Buffer::user_data ( )
pure virtual

Get the user data associated with this Buffer, if any.


The documentation for this class was generated from the following file: