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