|
dmlite
0.6
|
Opaque handler to pass different types of values to the API. More...


Go to the source code of this file.
Typedefs | |
| typedef struct dmlite_any | dmlite_any |
| Used to pass configuration values. More... | |
| typedef struct dmlite_any_dict | dmlite_any_dict |
| Handles key->value pairs. More... | |
Functions | |
| dmlite_any * | dmlite_any_new_string (const char *str) |
| Creates a new dmlite_any. More... | |
| dmlite_any * | dmlite_any_new_long (long l) |
| Creates a new dmlite_any. More... | |
| dmlite_any * | dmlite_any_new_s64 (int64_t i) |
| Creates a new dmlite_any from an int64_t type. More... | |
| dmlite_any * | dmlite_any_new_u64 (uint64_t i) |
| Creates a new dmlite_any from an uint64_t type. More... | |
| dmlite_any * | dmlite_any_new_string_array (unsigned n, const char **strv) |
| Creates a new dmlite_any. More... | |
| dmlite_any * | dmlite_any_new_long_array (unsigned n, long *lv) |
| Creates a new dmlite_any. More... | |
| void | dmlite_any_free (dmlite_any *any) |
| Frees a dmlite_any. More... | |
| void | dmlite_any_to_string (const dmlite_any *any, char *buffer, size_t bsize) |
| Gets the string interpretation of the dmlite_any. More... | |
| long | dmlite_any_to_long (const dmlite_any *any) |
| Returns the long interpretation of they dmlite_any. More... | |
| int64_t | dmlite_any_to_s64 (const dmlite_any *any) |
| Returns the int64_t interpretation of they dmlite_any. More... | |
| uint64_t | dmlite_any_to_u64 (const dmlite_any *any) |
| Returns the uint64_t interpretation of they dmlite_any. More... | |
| dmlite_any_dict * | dmlite_any_dict_new () |
| Created a new generic dictionary. More... | |
| dmlite_any_dict * | dmlite_any_dict_copy (const dmlite_any_dict *dict) |
| Make a copy of the dictionary. More... | |
| void | dmlite_any_dict_free (dmlite_any_dict *d) |
| Frees a dmlite_any_dict. More... | |
| void | dmlite_any_dict_clear (dmlite_any_dict *d) |
| Clears the dictionary. More... | |
| void | dmlite_any_dict_insert (dmlite_any_dict *d, const char *k, const dmlite_any *v) |
| Insert a new dmlite_any value into the dictionary. More... | |
| unsigned long | dmlite_any_dict_count (const dmlite_any_dict *d) |
| Returns how many elements there are in a specific dictionary. More... | |
| dmlite_any * | dmlite_any_dict_get (const dmlite_any_dict *d, const char *k) |
| Returns the value associated with the key k. More... | |
| void | dmlite_any_dict_erase (dmlite_any_dict *d, const char *k) |
| Removes a key-value from the dictionary. More... | |
| char * | dmlite_any_dict_to_json (const dmlite_any_dict *d, char *buffer, size_t bsize) |
| Generates a JSON serialization of the dictionary. More... | |
| dmlite_any_dict * | dmlite_any_dict_from_json (const char *json) |
| Populates a dmlite_any_dict from a JSON string. More... | |
| void | dmlite_any_dict_keys (const dmlite_any_dict *d, unsigned *nkeys, char ***keys) |
| Puts in keys a pointer to an array of strings with all the available keys in d. More... | |
| void | dmlite_any_dict_keys_free (unsigned n, char **keys) |
| Frees an array of strings allocated by dmlite_any_dict_keys. More... | |
Opaque handler to pass different types of values to the API.
| typedef struct dmlite_any dmlite_any |
Used to pass configuration values.
| typedef struct dmlite_any_dict dmlite_any_dict |
Handles key->value pairs.
| void dmlite_any_dict_clear | ( | dmlite_any_dict * | d | ) |
Clears the dictionary.
| dmlite_any_dict* dmlite_any_dict_copy | ( | const dmlite_any_dict * | dict | ) |
Make a copy of the dictionary.
| dict | The original |
| unsigned long dmlite_any_dict_count | ( | const dmlite_any_dict * | d | ) |
Returns how many elements there are in a specific dictionary.
| void dmlite_any_dict_erase | ( | dmlite_any_dict * | d, |
| const char * | k | ||
| ) |
Removes a key-value from the dictionary.
| d | The dictionary. |
| k | The key to be removed. |
| void dmlite_any_dict_free | ( | dmlite_any_dict * | d | ) |
Frees a dmlite_any_dict.
| dmlite_any_dict* dmlite_any_dict_from_json | ( | const char * | json | ) |
Populates a dmlite_any_dict from a JSON string.
| dmlite_any* dmlite_any_dict_get | ( | const dmlite_any_dict * | d, |
| const char * | k | ||
| ) |
Returns the value associated with the key k.
| void dmlite_any_dict_insert | ( | dmlite_any_dict * | d, |
| const char * | k, | ||
| const dmlite_any * | v | ||
| ) |
Insert a new dmlite_any value into the dictionary.
Replaces if already present.
| d | The dictionary. |
| k | The key. |
| v | The value. |
| void dmlite_any_dict_keys | ( | const dmlite_any_dict * | d, |
| unsigned * | nkeys, | ||
| char *** | keys | ||
| ) |
Puts in keys a pointer to an array of strings with all the available keys in d.
Use dmlite_any_dict_keys_free to free.
| d | The Dictionary. |
| nkeys | Will be set to the number of stored keys. |
| void dmlite_any_dict_keys_free | ( | unsigned | n, |
| char ** | keys | ||
| ) |
Frees an array of strings allocated by dmlite_any_dict_keys.
| n | The number of keys in **keys |
| keys | The array of keys. |
| dmlite_any_dict* dmlite_any_dict_new | ( | ) |
Created a new generic dictionary.
| char* dmlite_any_dict_to_json | ( | const dmlite_any_dict * | d, |
| char * | buffer, | ||
| size_t | bsize | ||
| ) |
Generates a JSON serialization of the dictionary.
| void dmlite_any_free | ( | dmlite_any * | any | ) |
Frees a dmlite_any.
| any | The dmlite_any to destroy. |
| dmlite_any* dmlite_any_new_long | ( | long | l | ) |
Creates a new dmlite_any.
| l | The long that will be wrapped. |
| dmlite_any* dmlite_any_new_long_array | ( | unsigned | n, |
| long * | lv | ||
| ) |
Creates a new dmlite_any.
| n | The number of elements. |
| lv | The longs that will be wrapped. |
| dmlite_any* dmlite_any_new_s64 | ( | int64_t | i | ) |
Creates a new dmlite_any from an int64_t type.
| i | The int64_t value. |
| dmlite_any* dmlite_any_new_string | ( | const char * | str | ) |
Creates a new dmlite_any.
| str | The string that will be wrapped. It is safe to free afterwards. |
| dmlite_any* dmlite_any_new_string_array | ( | unsigned | n, |
| const char ** | strv | ||
| ) |
Creates a new dmlite_any.
| n | The number of elements. |
| strv | The strings that will be wrapped. It is safe to free afterwards. |
| dmlite_any* dmlite_any_new_u64 | ( | uint64_t | i | ) |
Creates a new dmlite_any from an uint64_t type.
| i | The uint64_t value. |
| long dmlite_any_to_long | ( | const dmlite_any * | any | ) |
Returns the long interpretation of they dmlite_any.
Defaults to 0.
| any | The dmlite_any to convert. |
| int64_t dmlite_any_to_s64 | ( | const dmlite_any * | any | ) |
Returns the int64_t interpretation of they dmlite_any.
Defaults to 0.
| any | The dmlite_any to convert. |
| void dmlite_any_to_string | ( | const dmlite_any * | any, |
| char * | buffer, | ||
| size_t | bsize | ||
| ) |
Gets the string interpretation of the dmlite_any.
Defaults to "".
| any | The dmlite_any to convert. |
| buffer | Where to put the string. |
| bsize | The size of the buffer. |
| uint64_t dmlite_any_to_u64 | ( | const dmlite_any * | any | ) |
Returns the uint64_t interpretation of they dmlite_any.
Defaults to 0.
| any | The dmlite_any to convert. |
1.8.15