2313
|
1 /* Audacious - Cross-platform multimedia player
|
|
2 * Copyright (C) 2005-2007 Audacious development team
|
|
3 *
|
|
4 * Based on XMMS:
|
|
5 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies
|
|
6 *
|
|
7 * This program is free software; you can redistribute it and/or modify
|
|
8 * it under the terms of the GNU General Public License as published by
|
|
9 * the Free Software Foundation; under version 2 of the License.
|
|
10 *
|
|
11 * This program is distributed in the hope that it will be useful,
|
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 * GNU General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU General Public License
|
|
17 * along with this program; if not, write to the Free Software
|
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
19 */
|
|
20 #ifndef RCFILE_H
|
|
21 #define RCFILE_H
|
|
22
|
|
23 #include <glib.h>
|
|
24
|
|
25 /**
|
|
26 * RcLine:
|
|
27 * @key: A key for the key->value mapping.
|
|
28 * @value: A value for the key->value mapping.
|
|
29 *
|
|
30 * RcLine objects contain key->value mappings.
|
|
31 **/
|
|
32 typedef struct {
|
|
33 gchar *key;
|
|
34 gchar *value;
|
|
35 } RcLine;
|
|
36
|
|
37 /**
|
|
38 * RcSection:
|
|
39 * @name: The name for the #RcSection.
|
|
40 * @lines: A list of key->value mappings for the #RcSection.
|
|
41 *
|
|
42 * RcSection objects contain collections of key->value mappings.
|
|
43 **/
|
|
44 typedef struct {
|
|
45 gchar *name;
|
|
46 GList *lines;
|
|
47 } RcSection;
|
|
48
|
|
49 /**
|
|
50 * RcFile:
|
|
51 * @sections: A list of sections.
|
|
52 *
|
|
53 * An RcFile object contains a collection of key->value mappings organized by section.
|
|
54 **/
|
|
55 typedef struct {
|
|
56 GList *sections;
|
|
57 } RcFile;
|
|
58
|
|
59 G_BEGIN_DECLS
|
|
60
|
|
61 RcFile *bmp_rcfile_new(void);
|
|
62 void bmp_rcfile_free(RcFile * file);
|
|
63
|
|
64 RcFile *bmp_rcfile_open(const gchar * filename);
|
|
65 gboolean bmp_rcfile_write(RcFile * file, const gchar * filename);
|
|
66
|
|
67 gboolean bmp_rcfile_read_string(RcFile * file, const gchar * section,
|
|
68 const gchar * key, gchar ** value);
|
|
69 gboolean bmp_rcfile_read_int(RcFile * file, const gchar * section,
|
|
70 const gchar * key, gint * value);
|
|
71 gboolean bmp_rcfile_read_bool(RcFile * file, const gchar * section,
|
|
72 const gchar * key, gboolean * value);
|
|
73 gboolean bmp_rcfile_read_float(RcFile * file, const gchar * section,
|
|
74 const gchar * key, gfloat * value);
|
|
75 gboolean bmp_rcfile_read_double(RcFile * file, const gchar * section,
|
|
76 const gchar * key, gdouble * value);
|
|
77
|
|
78 void bmp_rcfile_write_string(RcFile * file, const gchar * section,
|
|
79 const gchar * key, const gchar * value);
|
|
80 void bmp_rcfile_write_int(RcFile * file, const gchar * section,
|
|
81 const gchar * key, gint value);
|
|
82 void bmp_rcfile_write_boolean(RcFile * file, const gchar * section,
|
|
83 const gchar * key, gboolean value);
|
|
84 void bmp_rcfile_write_float(RcFile * file, const gchar * section,
|
|
85 const gchar * key, gfloat value);
|
|
86 void bmp_rcfile_write_double(RcFile * file, const gchar * section,
|
|
87 const gchar * key, gdouble value);
|
|
88
|
|
89 void bmp_rcfile_remove_key(RcFile * file, const gchar * section,
|
|
90 const gchar * key);
|
|
91
|
|
92 G_END_DECLS
|
|
93
|
|
94 #endif // RCFILE_H
|