Robot Agent  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
iniparser.h
Go to the documentation of this file.
1 
2 /*-------------------------------------------------------------------------*/
8 /*--------------------------------------------------------------------------*/
9 
10 #ifndef _INIPARSER_H_
11 #define _INIPARSER_H_
12 
13 /*---------------------------------------------------------------------------
14  Includes
15  ---------------------------------------------------------------------------*/
16 
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 
21 /*
22  * The following #include is necessary on many Unixes but not Linux.
23  * It is not needed for Windows platforms.
24  * Uncomment it if needed.
25  */
26 /* #include <unistd.h> */
27 
28 #include "dictionary.h"
29 
30 /*-------------------------------------------------------------------------*/
47 /*--------------------------------------------------------------------------*/
48 
50 
51 
52 /*-------------------------------------------------------------------------*/
65 /*--------------------------------------------------------------------------*/
66 
67 char * iniparser_getsecname(dictionary * d, int n);
68 
69 
70 /*-------------------------------------------------------------------------*/
80 /*--------------------------------------------------------------------------*/
81 
82 void iniparser_dump_ini(dictionary * d, FILE * f);
83 
84 /*-------------------------------------------------------------------------*/
95 /*--------------------------------------------------------------------------*/
96 
97 void iniparser_dumpsection_ini(dictionary * d, char * s, FILE * f);
98 
99 /*-------------------------------------------------------------------------*/
111 /*--------------------------------------------------------------------------*/
112 void iniparser_dump(dictionary * d, FILE * f);
113 
114 /*-------------------------------------------------------------------------*/
121 /*--------------------------------------------------------------------------*/
122 int iniparser_getsecnkeys(dictionary * d, char * s);
123 
124 /*-------------------------------------------------------------------------*/
137 /*--------------------------------------------------------------------------*/
138 char ** iniparser_getseckeys(dictionary * d, char * s);
139 
140 /*-------------------------------------------------------------------------*/
154 /*--------------------------------------------------------------------------*/
155 char * iniparser_getstring(dictionary * d, const char * key, char * def);
156 
157 /*-------------------------------------------------------------------------*/
183 /*--------------------------------------------------------------------------*/
184 int iniparser_getint(dictionary * d, const char * key, int notfound);
185 
186 /*-------------------------------------------------------------------------*/
198 /*--------------------------------------------------------------------------*/
199 double iniparser_getdouble(dictionary * d, const char * key, double notfound);
200 
201 /*-------------------------------------------------------------------------*/
232 /*--------------------------------------------------------------------------*/
233 int iniparser_getboolean(dictionary * d, const char * key, int notfound);
234 
235 
236 /*-------------------------------------------------------------------------*/
248 /*--------------------------------------------------------------------------*/
249 int iniparser_set(dictionary * ini, const char * entry, const char * val);
250 
251 
252 /*-------------------------------------------------------------------------*/
261 /*--------------------------------------------------------------------------*/
262 void iniparser_unset(dictionary * ini, const char * entry);
263 
264 /*-------------------------------------------------------------------------*/
275 /*--------------------------------------------------------------------------*/
276 int iniparser_find_entry(dictionary * ini, const char * entry) ;
277 
278 /*-------------------------------------------------------------------------*/
291 /*--------------------------------------------------------------------------*/
292 dictionary * iniparser_load(const char * ininame);
293 
294 /*-------------------------------------------------------------------------*/
304 /*--------------------------------------------------------------------------*/
306 
307 #endif
int iniparser_set(dictionary *ini, const char *entry, const char *val)
Set an entry in a dictionary.
Definition: iniparser.c:525
char * iniparser_getstring(dictionary *d, const char *key, char *def)
Get the string associated to a key.
Definition: iniparser.c:368
void iniparser_unset(dictionary *ini, const char *entry)
Delete an entry in a dictionary.
Definition: iniparser.c:540
dictionary * iniparser_load(const char *ininame)
Parse an ini file and return an allocated dictionary object.
Definition: iniparser.c:629
double iniparser_getdouble(dictionary *d, const char *key, double notfound)
Get the string associated to a key, convert to a double.
Definition: iniparser.c:430
int iniparser_getboolean(dictionary *d, const char *key, int notfound)
Get the string associated to a key, convert to a boolean.
Definition: iniparser.c:471
void iniparser_dump(dictionary *d, FILE *f)
Dump a dictionary to an opened file pointer.
Definition: iniparser.c:178
char * iniparser_getsecname(dictionary *d, int n)
Get name for section n in a dictionary.
Definition: iniparser.c:143
void iniparser_dumpsection_ini(dictionary *d, char *s, FILE *f)
Save a dictionary section to a loadable ini file.
Definition: iniparser.c:244
int iniparser_find_entry(dictionary *ini, const char *entry)
Finds out if a given entry exists in a dictionary.
Definition: iniparser.c:500
int iniparser_getsecnkeys(dictionary *d, char *s)
Get the number of keys in a section of a dictionary.
Definition: iniparser.c:278
int iniparser_getnsec(dictionary *d)
Get number of sections in a dictionary.
Definition: iniparser.c:112
char ** iniparser_getseckeys(dictionary *d, char *s)
Get the number of keys in a section of a dictionary.
Definition: iniparser.c:317
Dictionary object.
Definition: dictionary.h:41
void iniparser_dump_ini(dictionary *d, FILE *f)
Save a dictionary to a loadable ini file.
Definition: iniparser.c:206
void iniparser_freedict(dictionary *d)
Free all memory associated to an ini dictionary.
Definition: iniparser.c:743
int iniparser_getint(dictionary *d, const char *key, int notfound)
Get the string associated to a key, convert to an int.
Definition: iniparser.c:408
Implements a dictionary for string variables.