iniparser  4.2.4
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 "dictionary.h"
18 #include <stdint.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /*-------------------------------------------------------------------------*/
32 /*--------------------------------------------------------------------------*/
33 
34 void iniparser_set_error_callback(int (*errback)(const char *, ...));
35 
36 /*-------------------------------------------------------------------------*/
53 /*--------------------------------------------------------------------------*/
54 
55 int iniparser_getnsec(const dictionary * d);
56 
57 
58 /*-------------------------------------------------------------------------*/
71 /*--------------------------------------------------------------------------*/
72 
73 const char * iniparser_getsecname(const dictionary * d, int n);
74 
75 
76 /*-------------------------------------------------------------------------*/
91 /*--------------------------------------------------------------------------*/
92 
93 void iniparser_dump_ini(const dictionary * d, FILE * f);
94 
95 /*-------------------------------------------------------------------------*/
105 /*--------------------------------------------------------------------------*/
106 
107 void iniparser_dumpsection_ini(const dictionary * d, const char * s, FILE * f);
108 
109 /*-------------------------------------------------------------------------*/
120 /*--------------------------------------------------------------------------*/
121 void iniparser_dump(const dictionary * d, FILE * f);
122 
123 /*-------------------------------------------------------------------------*/
130 /*--------------------------------------------------------------------------*/
131 int iniparser_getsecnkeys(const dictionary * d, const char * s);
132 
133 /*-------------------------------------------------------------------------*/
148 /*--------------------------------------------------------------------------*/
149 const char ** iniparser_getseckeys(const dictionary * d, const char * s, const char ** keys);
150 
151 
152 /*-------------------------------------------------------------------------*/
166 /*--------------------------------------------------------------------------*/
167 const char * iniparser_getstring(const dictionary * d, const char * key, const char * def);
168 
169 /*-------------------------------------------------------------------------*/
195 /*--------------------------------------------------------------------------*/
196 int iniparser_getint(const dictionary * d, const char * key, int notfound);
197 
198 /*-------------------------------------------------------------------------*/
222 /*--------------------------------------------------------------------------*/
223 long int iniparser_getlongint(const dictionary * d, const char * key, long int notfound);
224 
225 /*-------------------------------------------------------------------------*/
252 /*--------------------------------------------------------------------------*/
253 int64_t iniparser_getint64(const dictionary * d, const char * key, int64_t notfound);
254 
255 /*-------------------------------------------------------------------------*/
282 /*--------------------------------------------------------------------------*/
283 uint64_t iniparser_getuint64(const dictionary * d, const char * key, uint64_t notfound);
284 
285 /*-------------------------------------------------------------------------*/
297 /*--------------------------------------------------------------------------*/
298 double iniparser_getdouble(const dictionary * d, const char * key, double notfound);
299 
300 /*-------------------------------------------------------------------------*/
331 /*--------------------------------------------------------------------------*/
332 int iniparser_getboolean(const dictionary * d, const char * key, int notfound);
333 
334 
335 /*-------------------------------------------------------------------------*/
347 /*--------------------------------------------------------------------------*/
348 int iniparser_set(dictionary * ini, const char * entry, const char * val);
349 
350 
351 /*-------------------------------------------------------------------------*/
359 /*--------------------------------------------------------------------------*/
360 void iniparser_unset(dictionary * ini, const char * entry);
361 
362 /*-------------------------------------------------------------------------*/
373 /*--------------------------------------------------------------------------*/
374 int iniparser_find_entry(const dictionary * ini, const char * entry) ;
375 
376 /*-------------------------------------------------------------------------*/
400 /*--------------------------------------------------------------------------*/
401 dictionary * iniparser_load(const char * ininame);
402 
403 /*-------------------------------------------------------------------------*/
427 /*--------------------------------------------------------------------------*/
428 dictionary * iniparser_load_file(FILE * in, const char * ininame);
429 
430 /*-------------------------------------------------------------------------*/
439 /*--------------------------------------------------------------------------*/
440 void iniparser_freedict(dictionary * d);
441 
442 #ifdef __cplusplus
443 }
444 #endif
445 
446 #endif
void iniparser_dump(const dictionary *d, FILE *f)
Dump a dictionary to an opened file pointer.
int iniparser_getint(const dictionary *d, const char *key, int notfound)
Get the string associated to a key, convert to an int.
int64_t iniparser_getint64(const dictionary *d, const char *key, int64_t notfound)
Get the string associated to a key, convert to an int64_t.
int iniparser_getsecnkeys(const dictionary *d, const char *s)
Get the number of keys in a section of a dictionary.
dictionary * iniparser_load_file(FILE *in, const char *ininame)
Parse an ini file and return an allocated dictionary object.
int iniparser_getboolean(const dictionary *d, const char *key, int notfound)
Get the string associated to a key, convert to a boolean.
const char * iniparser_getstring(const dictionary *d, const char *key, const char *def)
Get the string associated to a key.
int iniparser_find_entry(const dictionary *ini, const char *entry)
Finds out if a given entry exists in a dictionary.
const char ** iniparser_getseckeys(const dictionary *d, const char *s, const char **keys)
Get the number of keys in a section of a dictionary.
void iniparser_set_error_callback(int(*errback)(const char *,...))
Configure a function to receive the error messages.
uint64_t iniparser_getuint64(const dictionary *d, const char *key, uint64_t notfound)
Get the string associated to a key, convert to an uint64_t.
void iniparser_freedict(dictionary *d)
Free all memory associated to an ini dictionary.
void iniparser_unset(dictionary *ini, const char *entry)
Delete an entry in a dictionary.
void iniparser_dumpsection_ini(const dictionary *d, const char *s, FILE *f)
Save a dictionary section to a loadable ini file.
void iniparser_dump_ini(const dictionary *d, FILE *f)
Save a dictionary to a loadable ini file.
int iniparser_set(dictionary *ini, const char *entry, const char *val)
Set an entry in a dictionary.
int iniparser_getnsec(const dictionary *d)
Get number of sections in a dictionary.
dictionary * iniparser_load(const char *ininame)
Parse an ini file and return an allocated dictionary object.
long int iniparser_getlongint(const dictionary *d, const char *key, long int notfound)
Get the string associated to a key, convert to an long int.
const char * iniparser_getsecname(const dictionary *d, int n)
Get name for section n in a dictionary.
double iniparser_getdouble(const dictionary *d, const char *key, double notfound)
Get the string associated to a key, convert to a double.