![]() |
GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
Typed recursive storage for key value pairs. More...
Go to the source code of this file.
Data Structures | |
struct | gp_data_rational |
Rational number. More... | |
struct | gp_data_node |
A data node. More... | |
Typedefs | |
typedef struct gp_data_node | gp_data_node |
A data node. | |
Enumerations | |
enum | gp_data_type { GP_DATA_INT , GP_DATA_STRING , GP_DATA_DOUBLE , GP_DATA_RATIONAL , GP_DATA_DICT } |
Data type. More... | |
Functions | |
gp_storage * | gp_storage_create (void) |
Creates an empty data storage. | |
void | gp_storage_destroy (gp_storage *self) |
Destroys a data storage and frees all its data. | |
gp_data_node * | gp_storage_root (gp_storage *self) |
Returns storage root node. | |
void | gp_storage_clear (gp_storage *self) |
Clears all data in storage. | |
void | gp_data_print (const gp_data_node *node) |
Prints a data node into a stdout. | |
static void | gp_storage_print (gp_storage *self) |
Prints a content of a storage into the stdout. | |
const char * | gp_data_type_name (enum gp_data_type type) |
Returns a data type name. | |
gp_data_node * | gp_storage_add_int (gp_storage *self, gp_data_node *node, const char *id, long i) |
Adds a long integer to a storage. | |
gp_data_node * | gp_storage_add_string (gp_storage *self, gp_data_node *node, const char *id, const char *str) |
Adds a string to a storage. | |
gp_data_node * | gp_storage_add_double (gp_storage *self, gp_data_node *node, const char *id, double d) |
Adds a double floating point to a storage. | |
gp_data_node * | gp_storage_add_rational (gp_storage *self, gp_data_node *node, const char *id, long num, long den) |
Adds a rational number to a storage. | |
gp_data_node * | gp_storage_add_dict (gp_storage *self, gp_data_node *node, const char *id) |
Adds a dictionary to a storage. | |
Typed recursive storage for key value pairs.
Definition in file gp_data_storage.h.
enum gp_data_type |
Data type.
Enumerator | |
---|---|
GP_DATA_INT | A long integer. |
GP_DATA_STRING | A string. |
GP_DATA_DOUBLE | A double. |
GP_DATA_RATIONAL | A rational number. |
GP_DATA_DICT | A dictionary aka hash. |
Definition at line 17 of file gp_data_storage.h.
void gp_data_print | ( | const gp_data_node * | node | ) |
const char * gp_data_type_name | ( | enum gp_data_type | type | ) |
Returns a data type name.
type | A data type. |
gp_data_node * gp_storage_add_dict | ( | gp_storage * | self, |
gp_data_node * | node, | ||
const char * | id ) |
Adds a dictionary to a storage.
storage | A storage to add the data to. |
node | A dict node to add the data to, if NULL data are added to root node. |
id | A name for the newly added node. |
gp_data_node * gp_storage_add_double | ( | gp_storage * | self, |
gp_data_node * | node, | ||
const char * | id, | ||
double | d ) |
Adds a double floating point to a storage.
storage | A storage to add the data to. |
node | A dict node to add the data to, if NULL data are added to root node. |
id | A name for the newly added node. |
d | A value for the newly added node. |
gp_data_node * gp_storage_add_int | ( | gp_storage * | self, |
gp_data_node * | node, | ||
const char * | id, | ||
long | i ) |
Adds a long integer to a storage.
storage | A storage to add the data to. |
node | A dict node to add the data to, if NULL data are added to root node. |
id | A name for the newly added node. |
i | A value for the newly added node. |
gp_data_node * gp_storage_add_rational | ( | gp_storage * | self, |
gp_data_node * | node, | ||
const char * | id, | ||
long | num, | ||
long | den ) |
Adds a rational number to a storage.
storage | A storage to add the data to. |
node | A dict node to add the data to, if NULL data are added to root node. |
id | A name for the newly added node. |
num | A numerator value for the newly added node. |
den | A denominator value for the newly added node. |
gp_data_node * gp_storage_add_string | ( | gp_storage * | self, |
gp_data_node * | node, | ||
const char * | id, | ||
const char * | str ) |
Adds a string to a storage.
storage | A storage to add the data to. |
node | A dict node to add the data to, if NULL data are added to root node. |
id | A name for the newly added node. |
str | A value for the newly added node. |
void gp_storage_clear | ( | gp_storage * | self | ) |
Clears all data in storage.
After this call the data storage is empty as it was just created with gp_storage_create().
self | A data storage. |
gp_storage * gp_storage_create | ( | void | ) |
Creates an empty data storage.
void gp_storage_destroy | ( | gp_storage * | self | ) |
Destroys a data storage and frees all its data.
self | A data storage to be freed. |
|
inlinestatic |
Prints a content of a storage into the stdout.
self | A data storage. |
Definition at line 116 of file gp_data_storage.h.
References gp_data_print(), and gp_storage_root().
gp_data_node * gp_storage_root | ( | gp_storage * | self | ) |
Returns storage root node.
The root node in data storage is always a dictionary.
self | A data storage. |
Referenced by gp_storage_print().