comparison ini.h @ 79:fd817a7dbf2f

Switched a lot of things in ini
author David Demelier <markand@malikania.fr>
date Tue, 15 Nov 2011 20:12:48 +0100
parents
children f42bcb9e7b4a
comparison
equal deleted inserted replaced
78:ad60e5ebd92c 79:fd817a7dbf2f
1 /*
2 * ini.h -- parse .ini like files
3 *
4 * Copyright (c) 2011, David Demelier <markand@malikania.fr>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef _INI_H_
20 #define _INI_H_
21
22 #define INI_VERBOSE (1 << 0) /* be verbose */
23 #define INI_NOREDEFINE (1 << 1) /* do not allow redefinitions */
24 #define INI_FAILERROR (1 << 2) /* abort parsing on first error */
25
26 struct ini_config;
27 struct ini_section;
28
29 /* --------------------------------------------------------
30 * struct ini_config functions.
31 * -------------------------------------------------------- */
32
33 struct ini_config *
34 ini_load(const char *, int);
35
36 char **
37 ini_get_sections_names(struct ini_config *, int *);
38
39 struct ini_section **
40 ini_get_sections(const struct ini_config *, const char *, int *);
41
42 struct ini_section *
43 ini_select_section(struct ini_config *, const char *);
44
45 char *
46 ini_get_option_once(struct ini_config *, const char *, const char *);
47
48 void
49 ini_free(struct ini_config *, int, int);
50
51 char *
52 ini_error(void);
53
54 /* --------------------------------------------------------
55 * struct ini_section functions.
56 * -------------------------------------------------------- */
57
58 char **
59 ini_get_option_names(struct ini_section *, int *);
60
61 char *
62 ini_get_option(struct ini_section *, const char *key);
63
64 #endif /* _INI_H_ */