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
|
1459
|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
0
|
17 */
|
|
18 #ifndef RCFILE_H
|
|
19 #define RCFILE_H
|
|
20
|
|
21 #include <glib.h>
|
|
22
|
2060
|
23 /**
|
|
24 * RcLine:
|
|
25 * @key: A key for the key->value mapping.
|
|
26 * @value: A value for the key->value mapping.
|
|
27 *
|
|
28 * RcLine objects contain key->value mappings.
|
|
29 **/
|
0
|
30 typedef struct {
|
|
31 gchar *key;
|
|
32 gchar *value;
|
|
33 } RcLine;
|
|
34
|
2060
|
35 /**
|
|
36 * RcSection:
|
|
37 * @name: The name for the #RcSection.
|
|
38 * @lines: A list of key->value mappings for the #RcSection.
|
|
39 *
|
|
40 * RcSection objects contain collections of key->value mappings.
|
|
41 **/
|
0
|
42 typedef struct {
|
|
43 gchar *name;
|
|
44 GList *lines;
|
|
45 } RcSection;
|
|
46
|
2060
|
47 /**
|
|
48 * RcFile:
|
|
49 * @sections: A list of sections.
|
|
50 *
|
|
51 * An RcFile object contains a collection of key->value mappings organized by section.
|
|
52 **/
|
0
|
53 typedef struct {
|
|
54 GList *sections;
|
|
55 } RcFile;
|
|
56
|
|
57 G_BEGIN_DECLS
|
|
58
|
|
59 RcFile *bmp_rcfile_new(void);
|
|
60 void bmp_rcfile_free(RcFile * file);
|
|
61
|
|
62 RcFile *bmp_rcfile_open(const gchar * filename);
|
|
63 gboolean bmp_rcfile_write(RcFile * file, const gchar * filename);
|
|
64
|
|
65 gboolean bmp_rcfile_read_string(RcFile * file, const gchar * section,
|
|
66 const gchar * key, gchar ** value);
|
|
67 gboolean bmp_rcfile_read_int(RcFile * file, const gchar * section,
|
|
68 const gchar * key, gint * value);
|
|
69 gboolean bmp_rcfile_read_bool(RcFile * file, const gchar * section,
|
|
70 const gchar * key, gboolean * value);
|
|
71 gboolean bmp_rcfile_read_float(RcFile * file, const gchar * section,
|
|
72 const gchar * key, gfloat * value);
|
|
73 gboolean bmp_rcfile_read_double(RcFile * file, const gchar * section,
|
|
74 const gchar * key, gdouble * value);
|
|
75
|
|
76 void bmp_rcfile_write_string(RcFile * file, const gchar * section,
|
|
77 const gchar * key, const gchar * value);
|
|
78 void bmp_rcfile_write_int(RcFile * file, const gchar * section,
|
|
79 const gchar * key, gint value);
|
|
80 void bmp_rcfile_write_boolean(RcFile * file, const gchar * section,
|
|
81 const gchar * key, gboolean value);
|
|
82 void bmp_rcfile_write_float(RcFile * file, const gchar * section,
|
|
83 const gchar * key, gfloat value);
|
|
84 void bmp_rcfile_write_double(RcFile * file, const gchar * section,
|
|
85 const gchar * key, gdouble value);
|
|
86
|
|
87 void bmp_rcfile_remove_key(RcFile * file, const gchar * section,
|
|
88 const gchar * key);
|
|
89
|
|
90 G_END_DECLS
|
|
91
|
|
92 #endif // RCFILE_H
|