Soletta™ Framework
|
File system peristence API for Soletta. More...
Macros | |
#define | CREATE_BLOB(_val) |
Macro to create a struct sol_blob with value passed as argument. More... | |
#define | CREATE_BUFFER(_val) |
Macro to create a struct sol_buffer with value passed as argument and flags SOL_BUFFER_FLAGS_MEMORY_NOT_OWNED and SOL_BUFFER_FLAGS_NO_NUL_BYTE. More... | |
Functions | |
static int | sol_fs_read_bool (const char *name, bool *value) |
Read a boolean from storage. More... | |
static int | sol_fs_read_double (const char *name, double *value) |
Read double in storage. More... | |
static int | sol_fs_read_drange (const char *name, struct sol_drange *value) |
Read sol_drange struct from storage. More... | |
static int | sol_fs_read_int32 (const char *name, int32_t *value) |
Read an int32 from storage. More... | |
static int | sol_fs_read_irange (const char *name, struct sol_irange *value) |
Read sol_irange struct from storage. More... | |
int | sol_fs_read_raw (const char *name, struct sol_buffer *buffer) |
Read stored contents and set to buffer. More... | |
static int | sol_fs_read_string (const char *name, char **value) |
Read string in storage. More... | |
static int | sol_fs_read_uint8 (const char *name, uint8_t *value) |
Read an uint8_t from storage. More... | |
static int | sol_fs_write_bool (const char *name, bool value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data) |
Writes boolean in storage. More... | |
static int | sol_fs_write_double (const char *name, double value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data) |
Writes a double in storage. More... | |
static int | sol_fs_write_drange (const char *name, struct sol_drange *value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data) |
Writes sol_drange struct in storage. More... | |
static int | sol_fs_write_int32 (const char *name, int32_t value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data) |
Writes int32 in storage. More... | |
static int | sol_fs_write_irange (const char *name, struct sol_irange *value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data) |
Writes sol_irange struct in storage. More... | |
int | sol_fs_write_raw (const char *name, struct sol_blob *blob, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data) |
Writes buffer contents to storage. More... | |
static int | sol_fs_write_string (const char *name, const char *value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data) |
Writes a string in storage. More... | |
static int | sol_fs_write_uint8 (const char *name, uint8_t value, void(*cb)(void *data, const char *name, struct sol_blob *blob, int status), const void *data) |
Writes uint8_t in storage. More... | |
File system peristence API for Soletta.
Properties will be saved on filesystem, relative to Soletta current directory. Property name is used as file name, so it can contain a path - like 'foo/bar'.
#define CREATE_BLOB | ( | _val | ) |
Macro to create a struct sol_blob with value passed as argument.
Referenced by sol_fs_write_bool(), sol_fs_write_double(), sol_fs_write_drange(), sol_fs_write_int32(), sol_fs_write_irange(), and sol_fs_write_uint8().
#define CREATE_BUFFER | ( | _val | ) |
Macro to create a struct sol_buffer with value passed as argument and flags SOL_BUFFER_FLAGS_MEMORY_NOT_OWNED and SOL_BUFFER_FLAGS_NO_NUL_BYTE.
Referenced by sol_fs_read_bool(), sol_fs_read_double(), sol_fs_read_drange(), sol_fs_read_int32(), sol_fs_read_irange(), and sol_fs_read_uint8().
|
inlinestatic |
Read a boolean from storage.
name | name of property. It will look for a file on filesystem with this name |
value | the boolean read from the storage |
return 0
on success, a negative number on failure
References CREATE_BUFFER, and sol_fs_read_raw().
|
inlinestatic |
Read double in storage.
name | name of property. It will look for a file on filesystem with this name |
value | the int read from the storage |
return 0
on success, a negative number on failure
References CREATE_BUFFER, and sol_fs_read_raw().
|
inlinestatic |
Read sol_drange struct from storage.
name | name of property. It will look for a file on filesystem with this name |
value | the drange read from the storage |
return 0
on success, a negative number on failure
References CREATE_BUFFER, and sol_fs_read_raw().
|
inlinestatic |
Read an int32 from storage.
name | name of property. It will look for a file on filesystem with this name |
value | the int32 read from the storage |
return 0
on success, a negative number on failure
References CREATE_BUFFER, and sol_fs_read_raw().
|
inlinestatic |
Read sol_irange struct from storage.
name | name of property. It will look for a file on filesystem with this name |
value | the irange read from the storage |
return 0
on success, a negative number on failure
References CREATE_BUFFER, and sol_fs_read_raw().
int sol_fs_read_raw | ( | const char * | name, |
struct sol_buffer * | buffer | ||
) |
Read stored contents and set to buffer.
name | name of property. It will look for a file on filesystem with this name. |
buffer | buffer that will be set with read contents. |
return 0 on success, a negative number on failure
Referenced by sol_fs_read_bool(), sol_fs_read_double(), sol_fs_read_drange(), sol_fs_read_int32(), sol_fs_read_irange(), sol_fs_read_string(), and sol_fs_read_uint8().
|
inlinestatic |
Read string in storage.
name | name of property. It will look for a file on filesystem with this name |
value | the char read from the storage |
return 0
on success, a negative number on failure
References sol_buffer_fini(), SOL_BUFFER_INIT_EMPTY, sol_buffer_steal(), and sol_fs_read_raw().
|
inlinestatic |
Read an uint8_t from storage.
name | name of property. It will look for a file on filesystem with this name |
value | the uint8_t read from the storage return 0 on success, a negative number on failure |
References CREATE_BUFFER, and sol_fs_read_raw().
|
inlinestatic |
Writes boolean in storage.
name | name of property. It will create a file on filesystem with this name. |
value | value that will be written |
cb | callback to be called when writing finishes. It contains status of writing: if failed, is lesser than zero. |
data | user data to be sent to callback cb |
return 0
on success, a negative number on failure
References CREATE_BLOB, sol_blob_unref(), and sol_fs_write_raw().
|
inlinestatic |
Writes a double in storage.
name | name of property. It will create a file on filesystem with this name. |
value | value that will be written |
cb | callback to be called when writing finishes. It contains status of writing: if failed, is lesser than zero. |
data | user data to be sent to callback cb |
return 0
on success, a negative number on failure
References CREATE_BLOB, sol_blob_unref(), and sol_fs_write_raw().
|
inlinestatic |
Writes sol_drange struct in storage.
name | name of property. It will create a file on filesystem with this name. |
value | value that will be written |
cb | callback to be called when writing finishes. It contains status of writing: if failed, is lesser than zero. |
data | user data to be sent to callback cb |
return 0
on success, a negative number on failure
References CREATE_BLOB, sol_blob_unref(), and sol_fs_write_raw().
|
inlinestatic |
Writes int32 in storage.
name | name of property. It will create a file on filesystem with this name. |
value | value that will be written |
cb | callback to be called when writing finishes. It contains status of writing: if failed, is lesser than zero. |
data | user data to be sent to callback cb |
return 0
on success, a negative number on failure
References CREATE_BLOB, sol_blob_unref(), and sol_fs_write_raw().
|
inlinestatic |
Writes sol_irange struct in storage.
name | name of property. It will create a file on filesystem with this name. |
value | value that will be written |
cb | callback to be called when writing finishes. It contains status of writing: if failed, is lesser than zero. |
data | user data to be sent to callback cb |
return 0
on success, a negative number on failure
References CREATE_BLOB, sol_blob_unref(), and sol_fs_write_raw().
int sol_fs_write_raw | ( | const char * | name, |
struct sol_blob * | blob, | ||
void(*)(void *data, const char *name, struct sol_blob *blob, int status) | cb, | ||
const void * | data | ||
) |
Writes buffer contents to storage.
Note that as writing operations are asynchronous, to check if it completely succeeded, one needs to register a callback that will inform writing result.
name | name of property. It will create a file on filesystem with this name. |
blob | blob that will be written |
cb | callback to be called when writing finishes. It contains status of writing: if failed, is lesser than zero. |
data | user data to be sent to callback cb |
return 0 on success, a negative number on failure
Referenced by sol_fs_write_bool(), sol_fs_write_double(), sol_fs_write_drange(), sol_fs_write_int32(), sol_fs_write_irange(), sol_fs_write_string(), and sol_fs_write_uint8().
|
inlinestatic |
Writes a string in storage.
name | name of property. It will create a file on filesystem with this name. |
value | value that will be written |
cb | callback to be called when writing finishes. It contains status of writing: if failed, is lesser than zero. |
data | user data to be sent to callback cb |
return 0
on success, a negative number on failure
References sol_blob_new(), SOL_BLOB_TYPE_DEFAULT, sol_blob_unref(), sol_fs_write_raw(), SOL_NULL_CHECK, and SOL_NULL_CHECK_GOTO.
|
inlinestatic |
Writes uint8_t in storage.
name | name of property. It will create a file on filesystem with this name. |
value | value that will be written |
cb | callback to be called when writing finishes. It contains status of writing: if failed, is lesser than zero. |
data | user data to be sent to callback cb |
return 0
on success, a negative number on failure
References CREATE_BLOB, sol_blob_unref(), and sol_fs_write_raw().