annotate src/audacious/rcfile.h @ 2865:d226b83fa329 trunk

BSD relicensing (pass 6).
author William Pitcock <nenolod@atheme.org>
date Sat, 23 Jun 2007 22:51:13 -0500
parents 7aac1b5ef85d
children 4c758281fe8f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2865
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
1 /*
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
2 * audacious: Cross-platform multimedia player.
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
3 * rcfile.h: Reading and manipulation of .ini-like files.
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
4 *
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
5 * Copyright (c) 2005-2007 Audacious development team.
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
6 * Copyright (c) 2003-2005 BMP development team.
2537
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
7 *
2865
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
8 * Redistribution and use in source and binary forms, with or without
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
9 * modification, are permitted provided that the following conditions are
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
10 * met:
2537
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
11 *
2865
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
12 * 1. Redistributions of source code must retain the above copyright notice,
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
13 * this list of conditions and the following disclaimer.
2537
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
14 *
2865
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
15 * 2. Redistributions in binary form must reproduce the above copyright
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
16 * notice, this list of conditions and the following disclaimer in the
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
17 * documentation and/or other materials provided with the distribution.
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
18 *
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
19 * 3. The name of the author may not be used to endorse or promote products
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
20 * derived from this software without specific prior written permission.
2537
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
21 *
2865
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
25 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
31 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
32 * POSSIBILITY OF SUCH DAMAGE.
2537
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
33 */
2865
d226b83fa329 BSD relicensing (pass 6).
William Pitcock <nenolod@atheme.org>
parents: 2537
diff changeset
34
2537
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
35 #ifndef RCFILE_H
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
36 #define RCFILE_H
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
37
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
38 #include <glib.h>
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
39
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
40 /**
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
41 * RcLine:
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
42 * @key: A key for the key->value mapping.
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
43 * @value: A value for the key->value mapping.
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
44 *
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
45 * RcLine objects contain key->value mappings.
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
46 **/
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
47 typedef struct {
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
48 gchar *key;
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
49 gchar *value;
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
50 } RcLine;
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
51
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
52 /**
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
53 * RcSection:
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
54 * @name: The name for the #RcSection.
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
55 * @lines: A list of key->value mappings for the #RcSection.
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
56 *
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
57 * RcSection objects contain collections of key->value mappings.
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
58 **/
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
59 typedef struct {
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
60 gchar *name;
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
61 GList *lines;
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
62 } RcSection;
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
63
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
64 /**
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
65 * RcFile:
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
66 * @sections: A list of sections.
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
67 *
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
68 * An RcFile object contains a collection of key->value mappings organized by section.
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
69 **/
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
70 typedef struct {
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
71 GList *sections;
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
72 } RcFile;
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
73
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
74 G_BEGIN_DECLS
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
75
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
76 RcFile *bmp_rcfile_new(void);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
77 void bmp_rcfile_free(RcFile * file);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
78
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
79 RcFile *bmp_rcfile_open(const gchar * filename);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
80 gboolean bmp_rcfile_write(RcFile * file, const gchar * filename);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
81
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
82 gboolean bmp_rcfile_read_string(RcFile * file, const gchar * section,
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
83 const gchar * key, gchar ** value);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
84 gboolean bmp_rcfile_read_int(RcFile * file, const gchar * section,
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
85 const gchar * key, gint * value);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
86 gboolean bmp_rcfile_read_bool(RcFile * file, const gchar * section,
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
87 const gchar * key, gboolean * value);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
88 gboolean bmp_rcfile_read_float(RcFile * file, const gchar * section,
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
89 const gchar * key, gfloat * value);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
90 gboolean bmp_rcfile_read_double(RcFile * file, const gchar * section,
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
91 const gchar * key, gdouble * value);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
92
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
93 void bmp_rcfile_write_string(RcFile * file, const gchar * section,
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
94 const gchar * key, const gchar * value);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
95 void bmp_rcfile_write_int(RcFile * file, const gchar * section,
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
96 const gchar * key, gint value);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
97 void bmp_rcfile_write_boolean(RcFile * file, const gchar * section,
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
98 const gchar * key, gboolean value);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
99 void bmp_rcfile_write_float(RcFile * file, const gchar * section,
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
100 const gchar * key, gfloat value);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
101 void bmp_rcfile_write_double(RcFile * file, const gchar * section,
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
102 const gchar * key, gdouble value);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
103
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
104 void bmp_rcfile_remove_key(RcFile * file, const gchar * section,
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
105 const gchar * key);
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
106
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
107 G_END_DECLS
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
108
7aac1b5ef85d [svn] - reinstate rcfile class for now
nenolod
parents:
diff changeset
109 #endif // RCFILE_H