0
|
1 /* XMMS - Cross-platform multimedia player
|
|
2 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies
|
|
3 *
|
|
4 * This program is free software; you can redistribute it and/or modify
|
|
5 * it under the terms of the GNU General Public License as published by
|
|
6 * the Free Software Foundation; either version 2 of the License, or
|
|
7 * (at your option) any later version.
|
|
8 *
|
|
9 * This program is distributed in the hope that it will be useful,
|
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 * GNU General Public License for more details.
|
|
13 *
|
|
14 * You should have received a copy of the GNU General Public License
|
|
15 * along with this program; if not, write to the Free Software
|
|
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
17 */
|
|
18 #ifndef XMMS_CONFIGFILE_H
|
|
19 #define XMMS_CONFIGFILE_H
|
|
20
|
|
21 #include <glib.h>
|
|
22
|
|
23
|
|
24 typedef enum {
|
|
25 XMMS_CFG_INT,
|
|
26 XMMS_CFG_FLOAT,
|
|
27 XMMS_CFG_BOOLEAN,
|
|
28 XMMS_CFG_STRING
|
|
29 } XmmsCfgValueType;
|
|
30
|
|
31
|
|
32 struct _ConfigLine {
|
|
33 gchar *key;
|
|
34 gchar *value;
|
|
35 };
|
|
36
|
|
37 struct _ConfigSection {
|
|
38 gchar *name;
|
|
39 GList *lines;
|
|
40 };
|
|
41
|
|
42 struct _ConfigFile {
|
|
43 GList *sections;
|
|
44 };
|
|
45
|
|
46 typedef struct _ConfigLine ConfigLine;
|
|
47 typedef struct _ConfigSection ConfigSection;
|
|
48 typedef struct _ConfigFile ConfigFile;
|
|
49
|
|
50
|
|
51 #ifdef __cplusplus
|
|
52 extern "C" {
|
|
53 #endif
|
|
54
|
|
55 ConfigFile *xmms_cfg_new(void);
|
|
56 ConfigFile *xmms_cfg_open_file(const gchar * filename);
|
|
57 gboolean xmms_cfg_write_file(ConfigFile * cfg, const gchar * filename);
|
|
58 void xmms_cfg_free(ConfigFile * cfg);
|
|
59 ConfigFile *xmms_cfg_open_default_file(void);
|
|
60 gboolean xmms_cfg_write_default_file(ConfigFile * cfg);
|
|
61
|
|
62 gboolean xmms_cfg_read_value(ConfigFile * config_file,
|
|
63 const gchar * section, const gchar * key,
|
|
64 XmmsCfgValueType value_type,
|
|
65 gpointer * value);
|
|
66
|
|
67 void xmms_cfg_write_value(ConfigFile * config_file,
|
|
68 const gchar * section, const gchar * key,
|
|
69 XmmsCfgValueType value_type,
|
|
70 gpointer * value);
|
|
71
|
|
72 gboolean xmms_cfg_read_string(ConfigFile * cfg, const gchar * section,
|
|
73 const gchar * key, gchar ** value);
|
|
74 gboolean xmms_cfg_read_int(ConfigFile * cfg, const gchar * section,
|
|
75 const gchar * key, gint * value);
|
|
76 gboolean xmms_cfg_read_boolean(ConfigFile * cfg, const gchar * section,
|
|
77 const gchar * key, gboolean * value);
|
|
78 gboolean xmms_cfg_read_float(ConfigFile * cfg, const gchar * section,
|
|
79 const gchar * key, gfloat * value);
|
|
80 gboolean xmms_cfg_read_double(ConfigFile * cfg, const gchar * section,
|
|
81 const gchar * key, gdouble * value);
|
|
82
|
|
83 void xmms_cfg_write_string(ConfigFile * cfg, const gchar * section,
|
|
84 const gchar * key, gchar * value);
|
|
85 void xmms_cfg_write_int(ConfigFile * cfg, const gchar * section,
|
|
86 const gchar * key, gint value);
|
|
87 void xmms_cfg_write_boolean(ConfigFile * cfg, const gchar * section,
|
|
88 const gchar * key, gboolean value);
|
|
89 void xmms_cfg_write_float(ConfigFile * cfg, const gchar * section,
|
|
90 const gchar * key, gfloat value);
|
|
91 void xmms_cfg_write_double(ConfigFile * cfg, const gchar * section,
|
|
92 const gchar * key, gdouble value);
|
|
93
|
|
94 void xmms_cfg_remove_key(ConfigFile * cfg, const gchar * section,
|
|
95 const gchar * key);
|
|
96
|
|
97 #ifdef __cplusplus
|
|
98 };
|
|
99 #endif
|
|
100
|
|
101 #endif
|