Fire Foot API Reference Manual |
---|
FFBlob — Class for handling BLOB data type.
#include <ff-blob.h> struct FFBlob; struct FFBlobClass; FFBlob* ff_blob_new (void); const ISC_QUAD* ff_blob_get_id (FFBlob *self); void ff_blob_set_id (FFBlob *self, const ISC_QUAD *blob_id); void ff_blob_set_id_from_value (FFBlob *self, FFValue *val); void ff_blob_set_default_transaction (FFBlob *self, FFTransaction *tr); FFTransaction* ff_blob_get_default_transaction (FFBlob *self); gdouble ff_blob_get_size (FFBlob *self); gboolean ff_blob_create (FFBlob *self); gboolean ff_blob_open (FFBlob *self); gboolean ff_blob_is_open (FFBlob *self); gboolean ff_blob_cancel (FFBlob *self); gboolean ff_blob_close (FFBlob *self); gboolean ff_blob_read (FFBlob *self, gpointer buffer, gint buffer_size, gint *fetched_size); gboolean ff_blob_write (FFBlob *self, gpointer buffer, gint buffer_size); gboolean ff_blob_save_to_file (FFBlob *self, const gchar *file_name, gint buffer_size); gboolean ff_blob_write_from_file (FFBlob *self, const gchar *file_name, gint buffer_size);
Blobs or "Binary Large Objects" fields can store large amounts of data of various types. For example:
Large text streams.
Image files (png, jpg, ...).
Video or audio files.
Basically anything that you can save to a stream.
struct FFBlobClass { void (* on_error) (FFBlob *self, FFError *error, gpointer data); };
FFBlob* ff_blob_new (void);
Constructor for FFBlob class.
Returns : | A new FFBlob object. |
const ISC_QUAD* ff_blob_get_id (FFBlob *self);
Get blob id.
self : | A FFBlob. |
Returns : | Blob id. |
void ff_blob_set_id (FFBlob *self, const ISC_QUAD *blob_id);
Set blob id.
self : | A FFBlob. |
blob_id : | A blob id. |
void ff_blob_set_id_from_value (FFBlob *self, FFValue *val);
Set blob id from val.
void ff_blob_set_default_transaction (FFBlob *self, FFTransaction *tr);
Set blob's default transaction.
self : | A FFBlob. |
tr : | A FFTransaction. |
FFTransaction* ff_blob_get_default_transaction (FFBlob *self);
Get default transaction.
self : | A FFBlob. |
Returns : | A FFTransaction. |
gdouble ff_blob_get_size (FFBlob *self);
Get blob size in kbytes.
self : | A FFBlob. |
Returns : | Size of blob, or -1 if error. |
gboolean ff_blob_create (FFBlob *self);
Create a new blob with a new blob id.
self : | A FFBlob. |
Returns : | TRUE if new blob id was successfully created, or FALSE otherwise. |
gboolean ff_blob_open (FFBlob *self);
Open blob to be processed.
self : | A FFBlob. |
Returns : | TRUE if blob was opened successfully, or FALSE otherwise. |
gboolean ff_blob_is_open (FFBlob *self);
Get blob opened status.
self : | A FFBlob. |
Returns : | TRUE if blob is opened, or FALSE otherwise. |
gboolean ff_blob_cancel (FFBlob *self);
Cancel current blob. Blob will be deleted.
self : | A FFBlob. |
Returns : | TRUE if blob was successfully cancelled, or FALSE otherwise. |
gboolean ff_blob_close (FFBlob *self);
Close blob.
self : | A FFBlob. |
Returns : | TRUE if blob closed successfully, or FALSE otherwise. |
gboolean ff_blob_read (FFBlob *self, gpointer buffer, gint buffer_size, gint *fetched_size);
Read blob contents to buffer. Variable fetched_size returns size of actual read. fetched_value might be smaller than buffer_size, for example when last segment of blob is read.
self : | A FFBlob. |
buffer : | A buffer to hold data read. |
buffer_size : | The size of buffer. |
fetched_size : | A pointer to an integer to save actual read size. |
Returns : | FALSE if all blob data was read, or TRUE while blob eof is not reached. |
gboolean ff_blob_write (FFBlob *self, gpointer buffer, gint buffer_size);
Write buffer contents to blob.
self : | A FFBlob. |
buffer : | A buffer containing data to write to blob. |
buffer_size : | The size of buffer. |
Returns : | TRUE if blob data was written, or FALSE otherwise. |
gboolean ff_blob_save_to_file (FFBlob *self, const gchar *file_name, gint buffer_size);
Save blob contents to file_name, using a buffer_size buffer for each read of blob content.
self : | A FFBlob. |
file_name : | A string containing a file name. |
buffer_size : | Size of buffer for each read. |
Returns : | TRUE if blob content was successfully saved, or FALSE otherwise. |
gboolean ff_blob_write_from_file (FFBlob *self, const gchar *file_name, gint buffer_size);
Set blob contents from file_name, using a buffer_size buffer for each read of buffer content.
self : | A FFBlob. |
file_name : | A string containing a file name. |
buffer_size : | Size of buffer for each write. |
Returns : | TRUE if blob content was successfully read, or FALSE otherwise. |
<< FFRow | FFValue >> |