2 * \defgroup Config Configuration Interface
3 * Configuration Interface
7 /** Config node type */
8 typedef enum _snd_config_type {
10 SND_CONFIG_TYPE_INTEGER,
13 /** Character string */
14 SND_CONFIG_TYPE_STRING,
16 SND_CONFIG_TYPE_COMPOUND,
19 /** Config node handle */
20 typedef struct _snd_config snd_config_t;
21 /** Config compound iterator */
22 typedef struct _snd_config_iterator *snd_config_iterator_t;
28 int snd_config_top(snd_config_t **config);
30 int snd_config_load(snd_config_t *config, snd_input_t *in);
31 int snd_config_save(snd_config_t *config, snd_output_t *out);
33 int snd_config_search(snd_config_t *config, const char *key,
34 snd_config_t **result);
35 int snd_config_searchv(snd_config_t *config,
36 snd_config_t **result, ...);
37 int snd_config_search_alias(snd_config_t *config,
38 const char *base, const char *key,
39 snd_config_t **result);
41 int snd_config_add(snd_config_t *config, snd_config_t *leaf);
42 int snd_config_delete(snd_config_t *config);
44 int snd_config_make(snd_config_t **config, const char *key,
45 snd_config_type_t type);
46 int snd_config_make_integer(snd_config_t **config, const char *key);
47 int snd_config_make_real(snd_config_t **config, const char *key);
48 int snd_config_make_string(snd_config_t **config, const char *key);
49 int snd_config_make_compound(snd_config_t **config, const char *key, int join);
51 int snd_config_set_integer(snd_config_t *config, long value);
52 int snd_config_set_real(snd_config_t *config, double value);
53 int snd_config_set_string(snd_config_t *config, const char *value);
54 int snd_config_get_integer(snd_config_t *config, long *value);
55 int snd_config_get_real(snd_config_t *config, double *value);
56 int snd_config_get_string(snd_config_t *config, const char **value);
58 snd_config_iterator_t snd_config_iterator_first(snd_config_t *node);
59 snd_config_iterator_t snd_config_iterator_next(snd_config_iterator_t iterator);
60 snd_config_iterator_t snd_config_iterator_end(snd_config_t *node);
61 snd_config_t *snd_config_iterator_entry(snd_config_iterator_t iterator);
63 /** Helper for compound config node leaves traversal
64 * \param pos Current node iterator
65 * \param next Next node iterator
66 * \param node Compound config node
68 * This macro is designed to permit the removal of current node.
70 #define snd_config_for_each(pos, next, node) \
71 for (pos = snd_config_iterator_first(node), next = snd_config_iterator_next(pos); pos != snd_config_iterator_end(node); pos = next, next = snd_config_iterator_next(pos))
73 snd_config_type_t snd_config_get_type(snd_config_t *config);
74 const char *snd_config_get_id(snd_config_t *config);
76 extern snd_config_t *snd_config;
77 int snd_config_update(void);