Top |
Functions
hb_blob_t * | hb_blob_create () |
hb_blob_t * | hb_blob_create_sub_blob () |
void | hb_blob_destroy () |
const char * | hb_blob_get_data () |
char * | hb_blob_get_data_writable () |
hb_blob_t * | hb_blob_get_empty () |
unsigned int | hb_blob_get_length () |
void * | hb_blob_get_user_data () |
hb_bool_t | hb_blob_is_immutable () |
void | hb_blob_make_immutable () |
hb_blob_t * | hb_blob_reference () |
hb_bool_t | hb_blob_set_user_data () |
Functions
hb_blob_create ()
hb_blob_t * hb_blob_create (const char *data
,unsigned int length
,hb_memory_mode_t mode
,void *user_data
,hb_destroy_func_t destroy
);
Creates a new "blob" object wrapping data
. The mode
parameter is used
to negotiate ownership and lifecycle of data
.
[skip]
Parameters
data |
Pointer to blob data. |
|
length |
Length of |
|
mode |
Memory mode for |
|
user_data |
Data parameter to pass to |
|
destroy |
Callback to call when |
Returns
New blob, or the empty blob if something failed or if length
is
zero. Destroy with hb_blob_destroy()
.
Since: 0.9.2
hb_blob_create_sub_blob ()
hb_blob_t * hb_blob_create_sub_blob (hb_blob_t *parent
,unsigned int offset
,unsigned int length
);
Returns a blob that represents a range of bytes in parent
. The new
blob is always created with HB_MEMORY_MODE_READONLY
, meaning that it
will never modify data in the parent blob. The parent data is not
expected to be modified, and will result in undefined behavior if it
is.
Makes parent
immutable.
Parameters
parent |
Parent blob. |
|
offset |
Start offset of sub-blob within |
|
length |
Length of sub-blob. |
Returns
New blob, or the empty blob if something failed or if
length
is zero or offset
is beyond the end of parent
's data. Destroy
with hb_blob_destroy()
.
Since: 0.9.2
hb_blob_destroy ()
void
hb_blob_destroy (hb_blob_t *blob
);
Descreases the reference count on blob
, and if it reaches zero, destroys
blob
, freeing all memory, possibly calling the destroy-callback the blob
was created for if it has not been called already.
See TODO:link object types for more information.
[skip]
Since: 0.9.2
hb_blob_get_data ()
const char * hb_blob_get_data (hb_blob_t *blob
,unsigned int *length
);
Since: 0.9.2
hb_blob_get_data_writable ()
char * hb_blob_get_data_writable (hb_blob_t *blob
,unsigned int *length
);
Tries to make blob data writable (possibly copying it) and return pointer to data.
Fails if blob has been made immutable, or if memory allocation fails.
Since: 0.9.2
hb_blob_get_empty ()
hb_blob_t *
hb_blob_get_empty (void
);
Returns the singleton empty blob.
See TODO:link object types for more information.
Since: 0.9.2
hb_blob_get_user_data ()
void * hb_blob_get_user_data (hb_blob_t *blob
,hb_user_data_key_t *key
);
[skip]
Since: 0.9.2
hb_blob_reference ()
hb_blob_t *
hb_blob_reference (hb_blob_t *blob
);
Increases the reference count on blob
.
See TODO:link object types for more information.
[skip]
Since: 0.9.2
hb_blob_set_user_data ()
hb_bool_t hb_blob_set_user_data (hb_blob_t *blob
,hb_user_data_key_t *key
,void *data
,hb_destroy_func_t destroy
,hb_bool_t replace
);
[skip]
Parameters
blob |
a blob. |
|
key |
key for data to set. |
|
data |
data to set. |
|
destroy |
callback to call when |
|
replace |
whether to replace an existing data with the same key. |
Since: 0.9.2