|
1 /** |
|
2 * Some helper functions for working with the iniparser functions - in particular, |
|
3 * for interoperability with the ini format used by the QtSettings class. |
|
4 */ |
|
5 |
|
6 #ifndef INIHELPER_H_ |
|
7 #define INIHELPER_H_ |
|
8 |
|
9 #include "../iniparser/iniparser.h" |
|
10 |
|
11 #include <stdbool.h> |
|
12 |
|
13 /** |
|
14 * Returned buffer must be free()d |
|
15 */ |
|
16 char *inihelper_urlencode(const char *inbuf); |
|
17 |
|
18 /** |
|
19 * Returned buffer must be free()d |
|
20 */ |
|
21 char *inihelper_urldecode(const char *inbuf); |
|
22 |
|
23 /** |
|
24 * Create a key in the format "sectionName:keyName" |
|
25 * Returned buffer must be free()d |
|
26 */ |
|
27 char *inihelper_createDictKey(const char *sectionName, const char *keyName); |
|
28 |
|
29 /** |
|
30 * Returns an internal buffer, don't modify or free |
|
31 * Sets error to true if something goes wrong, leaves it unchanged otherwise. |
|
32 */ |
|
33 char *inihelper_getstring(dictionary *inifile, bool *error, const char *sectionName, const char *keyName); |
|
34 |
|
35 /** |
|
36 * Returned buffer must be free()d |
|
37 * Sets error to true if something goes wrong, leaves it unchanged otherwise. |
|
38 */ |
|
39 char *inihelper_getstringdup(dictionary *inifile, bool *error, const char *sectionName, const char *keyName); |
|
40 |
|
41 /** |
|
42 * Sets error to true if something goes wrong, leaves it unchanged otherwise. |
|
43 */ |
|
44 int inihelper_getint(dictionary *inifile, bool *error, const char *sectionName, const char *keyName); |
|
45 |
|
46 /** |
|
47 * Sets error to true if something goes wrong, leaves it unchanged otherwise. |
|
48 */ |
|
49 bool inihelper_getbool(dictionary *inifile, bool *error, const char *sectionName, const char *keyName); |
|
50 |
|
51 int inihelper_setstr(dictionary *dict, const char *sectionName, const char *keyName, const char *value); |
|
52 int inihelper_setint(dictionary *dict, const char *sectionName, const char *keyName, int value); |
|
53 int inihelper_setbool(dictionary *dict, const char *sectionName, const char *keyName, bool value); |
|
54 #endif /* INIHELPER_H_ */ |