105 const char *key,
int dvalue);
116 const char *key,
double dvalue);
139 const char *key,
void *dvalue);
157 const char *key,
int *status);
166 const char *key,
int newvalue);
175 const char *key,
double newvalue);
185 const char *newvalue);
194 const char *key,
void *newvalue);
Dynamic containers such as lists, arrays, and hash tables.
void sc_keyvalue_set_int(sc_keyvalue_t *kv, const char *key, int newvalue)
Routine to set an integer value for a given key.
void sc_keyvalue_foreach(sc_keyvalue_t *kv, sc_keyvalue_foreach_t fn, void *user_data)
Iterate through all stored key-value pairs.
struct sc_keyvalue sc_keyvalue_t
The key-value container is an opaque structure.
Definition: sc_keyvalue.h:47
int sc_keyvalue_get_int_check(sc_keyvalue_t *kv, const char *key, int *status)
Query an integer key with error checking.
sc_keyvalue_t * sc_keyvalue_new()
Create a new key-value container.
sc_keyvalue_entry_type_t
The values can have different types.
Definition: sc_keyvalue.h:37
@ SC_KEYVALUE_ENTRY_DOUBLE
Used for values of type double.
Definition: sc_keyvalue.h:40
@ SC_KEYVALUE_ENTRY_NONE
Designate an invalid situation.
Definition: sc_keyvalue.h:38
@ SC_KEYVALUE_ENTRY_POINTER
Used for values of anonymous pointer type.
Definition: sc_keyvalue.h:42
@ SC_KEYVALUE_ENTRY_STRING
Used for values of type const char *.
Definition: sc_keyvalue.h:41
@ SC_KEYVALUE_ENTRY_INT
Used for values of type int.
Definition: sc_keyvalue.h:39
sc_keyvalue_t * sc_keyvalue_newf(int dummy,...)
Create a container and set one or more key-value pairs.
void sc_keyvalue_destroy(sc_keyvalue_t *kv)
Free a key-value container and all internal memory for key storage.
sc_keyvalue_entry_type_t sc_keyvalue_unset(sc_keyvalue_t *kv, const char *key)
Routine to remove an entry.
void sc_keyvalue_set_double(sc_keyvalue_t *kv, const char *key, double newvalue)
Routine to set a double value for a given key.
void * sc_keyvalue_get_pointer(sc_keyvalue_t *kv, const char *key, void *dvalue)
Retrieve a pointer value by its key.
void sc_keyvalue_set_pointer(sc_keyvalue_t *kv, const char *key, void *newvalue)
Routine to set a pointer value for a given key.
void sc_keyvalue_set_string(sc_keyvalue_t *kv, const char *key, const char *newvalue)
Routine to set a string value for a given key.
sc_keyvalue_t * sc_keyvalue_newv(va_list ap)
Create a container and set one or more key-value pairs.
double sc_keyvalue_get_double(sc_keyvalue_t *kv, const char *key, double dvalue)
Retrieve a double value by its key.
int sc_keyvalue_get_int(sc_keyvalue_t *kv, const char *key, int dvalue)
Routines to retrieve an integer value by its key.
sc_keyvalue_entry_type_t sc_keyvalue_exists(sc_keyvalue_t *kv, const char *key)
Routine to check existence of an entry.
int(* sc_keyvalue_foreach_t)(const char *key, const sc_keyvalue_entry_type_t type, void *entry, const void *u)
Function to call on every key value pair.
Definition: sc_keyvalue.h:203
const char * sc_keyvalue_get_string(sc_keyvalue_t *kv, const char *key, const char *dvalue)
Retrieve a string value by its key.