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_expand(snd_config_t *config, const char *args,
42 snd_config_t **result);
44 int snd_config_add(snd_config_t *config, snd_config_t *leaf);
45 int snd_config_delete(snd_config_t *config);
47 int snd_config_make(snd_config_t **config, const char *key,
48 snd_config_type_t type);
49 int snd_config_make_integer(snd_config_t **config, const char *key);
50 int snd_config_make_real(snd_config_t **config, const char *key);
51 int snd_config_make_string(snd_config_t **config, const char *key);
52 int snd_config_make_compound(snd_config_t **config, const char *key, int join);
54 int snd_config_set_id(snd_config_t *config, const char *id);
55 int snd_config_set_integer(snd_config_t *config, long value);
56 int snd_config_set_real(snd_config_t *config, double value);
57 int snd_config_set_string(snd_config_t *config, const char *value);
58 int snd_config_get_integer(snd_config_t *config, long *value);
59 int snd_config_get_real(snd_config_t *config, double *value);
60 int snd_config_get_string(snd_config_t *config, const char **value);
62 snd_config_iterator_t snd_config_iterator_first(snd_config_t *node);
63 snd_config_iterator_t snd_config_iterator_next(snd_config_iterator_t iterator);
64 snd_config_iterator_t snd_config_iterator_end(snd_config_t *node);
65 snd_config_t *snd_config_iterator_entry(snd_config_iterator_t iterator);
67 /** Helper for compound config node leaves traversal
68 * \param pos Current node iterator
69 * \param next Next node iterator
70 * \param node Compound config node
72 * This macro is designed to permit the removal of current node.
74 #define snd_config_for_each(pos, next, node) \
75 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))
77 snd_config_type_t snd_config_get_type(snd_config_t *config);
78 const char *snd_config_get_id(snd_config_t *config);
80 extern snd_config_t *snd_config;
81 int snd_config_update(void);
83 int snd_config_redirect_load(snd_config_t *root, snd_config_t *config,
84 char **name, snd_config_t **dst_config,