Merge pull request #1 from atsampson/master
[calfbox.git] / config-api.h
blobd021cd55e1ab7ec4b18f48b594ab92c73ce48e1a
1 /*
2 Calf Box, an open source musical instrument.
3 Copyright (C) 2010 Krzysztof Foltman
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef CBOX_CONFIG_API_H
20 #define CBOX_CONFIG_API_H
22 #include <glib.h>
24 struct cbox_sectref;
26 extern void cbox_config_init(const char *override_file);
27 extern int cbox_config_has_section(const char *section);
28 extern char *cbox_config_get_string(const char *section, const char *key);
29 extern char *cbox_config_get_string_with_default(const char *section, const char *key, char *def_value);
30 extern int cbox_config_get_int(const char *section, const char *key, int def_value);
31 extern float cbox_config_get_float(const char *section, const char *key, float def_value);
32 extern float cbox_config_get_gain(const char *section, const char *key, float def_value);
33 extern float cbox_config_get_gain_db(const char *section, const char *key, float def_value);
34 extern void cbox_config_foreach_section(void (*process)(void *user_data, const char *section), void *user_data);
35 extern void cbox_config_foreach_key(void (*process)(void *user_data, const char *key), const char *section, void *user_data);
36 extern char *cbox_config_permify(const char *temporary);
38 extern void cbox_config_set_string(const char *section, const char *key, const char *value);
39 extern void cbox_config_set_int(const char *section, const char *key, int value);
40 extern void cbox_config_set_float(const char *section, const char *key, double value);
41 extern int cbox_config_remove_section(const char *section);
42 extern int cbox_config_remove_key(const char *section, const char *key);
44 extern gboolean cbox_config_save(const char *filename, GError **error);
46 extern struct cbox_sectref *cbox_config_sectref(struct cbox_sectref *def_sect, const char *prefix, const char *refname);
47 extern struct cbox_sectref *cbox_config_get_sectref(struct cbox_sectref *sect, const char *prefix, const char *key);
48 extern struct cbox_sectref *cbox_config_get_sectref_n(struct cbox_sectref *sect, const char *prefix, const char *key, int index);
49 extern struct cbox_sectref *cbox_config_get_sectref_suffix(struct cbox_sectref *sect, const char *prefix, const char *key, const char *suffix);
51 extern void cbox_config_close(void);
53 #endif