author | Medo <smaxein@googlemail.com> |
Tue, 12 Jun 2012 21:10:11 +0200 | |
changeset 7227 | 1c859f572d72 |
parent 7224 | 5143861c83bd |
child 7271 | 5608ac657362 |
permissions | -rw-r--r-- |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
1 |
/** |
7224
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
2 |
* Convenience interface for ini reading/writing. |
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
3 |
* |
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
4 |
* We currently use iniparser in the background, but using its interface directly is a bit verbose. |
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
5 |
* This module is supposed to 1. make ini reading and writing a bit more convenient, and 2. hide |
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
6 |
* the iniparser dependency so it can at need be easily replaced. |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
7 |
*/ |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
8 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
9 |
#ifndef INIHELPER_H_ |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
10 |
#define INIHELPER_H_ |
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
11 |
|
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
12 |
#include <stdbool.h> |
7179
f84805e6df03
Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents:
7177
diff
changeset
|
13 |
|
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
14 |
#define INI_ERROR_NOTFOUND -1 |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
15 |
#define INI_ERROR_FORMAT -2 |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
16 |
#define INI_ERROR_OTHER -100 |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
17 |
|
7224
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
18 |
struct _flib_ini; |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
19 |
typedef struct _flib_ini flib_ini; |
7224
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
20 |
|
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
21 |
/** |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
22 |
* Create a new ini data structure, pre-filled with the contents of |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
23 |
* the file "filename" if it exists. If filename is null, or the file |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
24 |
* is not found, an empty ini will be created. However, if an error |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
25 |
* occurs while reading the ini file (or any other error), null |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
26 |
* is returned. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
27 |
* |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
28 |
* This behavior is useful for modifying an existing ini file without |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
29 |
* discarding unknown keys. |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
30 |
*/ |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
31 |
flib_ini *flib_ini_create(const char *filename); |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
32 |
|
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
33 |
/** |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
34 |
* Similar to flib_ini_create, but fails if the file is not found |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
35 |
* or if filename is null. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
36 |
*/ |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
37 |
flib_ini *flib_ini_load(const char *filename); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
38 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
39 |
/** |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
40 |
* Store the ini to the file "filename", overwriting |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
41 |
* the previous contents. Returns 0 on success. |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
42 |
*/ |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
43 |
int flib_ini_save(flib_ini *ini, const char *filename); |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
44 |
|
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
45 |
void flib_ini_destroy(flib_ini *ini); |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
46 |
|
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
47 |
/** |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
48 |
* Enter the section with the specified name. Returns 0 on |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
49 |
* success, INI_ERROR_NOTFOUND if the section does not exist |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
50 |
* and a different value if another error occurs. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
51 |
* If an error occurs, there is no current section. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
52 |
* |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
53 |
* The section name should only consist of letters and |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
54 |
* numbers. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
55 |
*/ |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
56 |
int flib_ini_enter_section(flib_ini *ini, const char *section); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
57 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
58 |
/** |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
59 |
* Creates and enters the section with the specified name. Simply |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
60 |
* enters the section if it exists already. Returns 0 on success |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
61 |
* and a different value if another error occurs. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
62 |
* If an error occurs, there is no current section. |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
63 |
*/ |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
64 |
int flib_ini_create_section(flib_ini *ini, const char *section); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
65 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
66 |
/** |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
67 |
* Find a key in the current section and store the value in outVar |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
68 |
* as a newly allocated string. Returns 0 on success, INI_ERROR_NOTFOUND |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
69 |
* if the key was not found and a different value for other errors, |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
70 |
* e.g. if there is no current section. |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
71 |
*/ |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
72 |
int flib_ini_get_str(flib_ini *ini, char **outVar, const char *key); |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
73 |
|
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
74 |
/** |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
75 |
* Find a key in the current section and store the value in outVar |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
76 |
* as a newly allocated string. If the key is not found, the default |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
77 |
* value will be used instead. Returns 0 on success. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
78 |
*/ |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
79 |
int flib_ini_get_str_opt(flib_ini *ini, char **outVar, const char *key, const char *def); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
80 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
81 |
/** |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
82 |
* Find a key in the current section and store the value in outVar |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
83 |
* as an int. Returns 0 on success, INI_ERROR_NOTFOUND |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
84 |
* if the key was not found, INI_ERROR_FORMAT if it was found but |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
85 |
* could not be converted to an int, and a different value for other |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
86 |
* errors, e.g. if there is no current section. |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
87 |
*/ |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
88 |
int flib_ini_get_int(flib_ini *ini, int *outVar, const char *key); |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
89 |
|
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
90 |
/** |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
91 |
* Find a key in the current section and store the value in outVar |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
92 |
* as an int. If the key is not found, the default value will be used instead. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
93 |
* Returns 0 on success, INI_ERROR_FORMAT if the value was found but |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
94 |
* could not be converted to int, and another value otherwise. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
95 |
*/ |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
96 |
int flib_ini_get_int_opt(flib_ini *ini, int *outVar, const char *key, int def); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
97 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
98 |
/** |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
99 |
* Find a key in the current section and store the value in outVar |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
100 |
* as a bool. Treats everything beginning with "Y", "T" or "1" as true, |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
101 |
* everything starting with "N", "F" or "1" as false. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
102 |
* |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
103 |
* Returns 0 on success, INI_ERROR_NOTFOUND if the key was not found, |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
104 |
* INI_ERROR_FORMAT if the value could not be interpreted as boolean, |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
105 |
* and another value otherwise. |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
106 |
*/ |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
107 |
int flib_ini_get_bool(flib_ini *ini, bool *outVar, const char *key); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
108 |
|
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
109 |
/** |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
110 |
* Find a key in the current section and store the value in outVar |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
111 |
* as a bool. If the key is not found, the default value will be |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
112 |
* used instead. Returns 0 on success, INI_ERROR_FORMAT if the |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
113 |
* value could not be interpreted as boolean, and another value otherwise. |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
114 |
*/ |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
115 |
int flib_ini_get_bool_opt(flib_ini *ini, bool *outVar, const char *key, bool def); |
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
116 |
|
7224
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
117 |
/** |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
118 |
* In the current section, associate key with value. Returns 0 on success. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
119 |
*/ |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
120 |
int flib_ini_set_str(flib_ini *ini, const char *key, const char *value); |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
121 |
|
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
122 |
/** |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
123 |
* In the current section, associate key with value. Returns 0 on success. |
7224
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
124 |
*/ |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
125 |
int flib_ini_set_int(flib_ini *ini, const char *key, int value); |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
126 |
|
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
127 |
/** |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
128 |
* In the current section, associate key with value. Returns 0 on success. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
129 |
*/ |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
130 |
int flib_ini_set_bool(flib_ini *ini, const char *key, bool value); |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
131 |
|
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
132 |
/** |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
133 |
* Returns the number of sections in the ini file, or a negative value on error. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
134 |
*/ |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
135 |
int flib_ini_get_sectioncount(flib_ini *ini); |
7224
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
136 |
|
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
137 |
/** |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
138 |
* Returns the name of the section, or NULL on error. The returned string must |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
139 |
* be free()d. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
140 |
* |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
141 |
* Note: There is no guarantee that the order of the sections |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
142 |
* will remain stable if the ini is modified. |
7224
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
143 |
*/ |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
144 |
char *flib_ini_get_sectionname(flib_ini *ini, int number); |
7224
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
145 |
|
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
146 |
/** |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
147 |
* Returns the number of keys in the current section, or -1 on error. |
7224
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
148 |
*/ |
7227
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
149 |
int flib_ini_get_keycount(flib_ini *ini); |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
150 |
|
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
151 |
/** |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
152 |
* Returns the name of the key in the current section, or NULL on error. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
153 |
* The returned string must be free()d. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
154 |
* |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
155 |
* Note: There is no guarantee that the order of the keys in a section |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
156 |
* will remain stable if the ini is modified. |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
157 |
*/ |
1c859f572d72
frontlib: Rewrote the ini helper code, finished ini reading/writing support for all relevant file types
Medo <smaxein@googlemail.com>
parents:
7224
diff
changeset
|
158 |
char *flib_ini_get_keyname(flib_ini *ini, int number); |
7224
5143861c83bd
Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents:
7179
diff
changeset
|
159 |
|
7175
038e3415100a
Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
160 |
#endif /* INIHELPER_H_ */ |