STASIS
A pipeline delivery generator
Toggle main menu visibility
Loading...
Searching...
No Matches
src
lib
core
include
ini.h
Go to the documentation of this file.
1
2
3
#ifndef STASIS_INI_H
4
#define STASIS_INI_H
5
#include <stdio.h>
6
#include <stddef.h>
7
#include <stdbool.h>
8
#include "
template.h
"
9
10
#define INI_WRITE_RAW 0
11
#define INI_WRITE_PRESERVE 1
12
#define INI_READ_RAW 0
13
#define INI_READ_RENDER 1
14
#define INI_SETVAL_APPEND 0
15
#define INI_SETVAL_REPLACE 1
16
#define INI_SEARCH_EXACT 0
17
#define INI_SEARCH_BEGINS 1
18
#define INI_SEARCH_SUBSTR 2
20
21
#define INIVAL_TYPE_CHAR 1
22
#define INIVAL_TYPE_UCHAR 2
23
#define INIVAL_TYPE_SHORT 3
24
#define INIVAL_TYPE_USHORT 4
25
#define INIVAL_TYPE_INT 5
26
#define INIVAL_TYPE_UINT 6
27
#define INIVAL_TYPE_LONG 7
28
#define INIVAL_TYPE_ULONG 8
29
#define INIVAL_TYPE_LLONG 9
30
#define INIVAL_TYPE_ULLONG 10
31
#define INIVAL_TYPE_DOUBLE 11
32
#define INIVAL_TYPE_FLOAT 12
33
#define INIVAL_TYPE_STR 13
34
#define INIVAL_TYPE_STR_ARRAY 14
35
#define INIVAL_TYPE_BOOL 15
36
37
#define INIVAL_TO_LIST 1 << 1
38
42
union
INIVal
{
43
char
as_char
;
44
unsigned
char
as_uchar
;
45
short
as_short
;
46
unsigned
short
as_ushort
;
47
int
as_int
;
48
unsigned
as_uint
;
49
long
as_long
;
50
unsigned
long
as_ulong
;
51
long
long
as_llong
;
52
unsigned
long
long
as_ullong
;
53
double
as_double
;
54
float
as_float
;
55
char
*
as_char_p
;
56
char
**
as_char_array_p
;
57
bool
as_bool
;
58
};
59
60
64
struct
INIData
{
65
char
*
key
;
66
char
*
value
;
67
unsigned
type_hint;
68
};
69
73
struct
INISection
{
74
size_t
data_count
;
75
char
*
key
;
76
struct
INIData
**
data
;
77
};
78
82
struct
INIFILE
{
83
size_t
section_count
;
84
struct
INISection
**
section
;
85
};
86
106
struct
INIFILE
*
ini_open
(
const
char
*filename);
107
114
struct
INISection
*
ini_section_search
(
struct
INIFILE
**ini,
unsigned
mode,
const
char
*value);
115
122
int
ini_section_create
(
struct
INIFILE
**ini,
char
*key);
123
131
int
ini_has_key
(
struct
INIFILE
*ini,
const
char
*section,
const
char
*key);
132
142
int
ini_setval
(
struct
INIFILE
**ini,
unsigned
type,
char
*section_name,
char
*key,
char
*value);
143
177
struct
INIData
*
ini_getall
(
struct
INIFILE
*ini,
char
*section_name);
178
226
int
ini_getval
(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
type,
int
flags,
union
INIVal
*result);
227
234
int
ini_write
(
struct
INIFILE
*ini, FILE **stream,
unsigned
mode);
235
240
void
ini_free
(
struct
INIFILE
**ini);
241
242
int
ini_getval_int(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
243
unsigned
int
ini_getval_uint(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
244
long
ini_getval_long(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
245
unsigned
long
ini_getval_ulong(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
246
long
long
ini_getval_llong(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
247
unsigned
long
long
ini_getval_ullong(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
248
float
ini_getval_float(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
249
double
ini_getval_double(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
250
bool
ini_getval_bool(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
251
short
ini_getval_short(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
252
unsigned
short
ini_getval_ushort(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
253
char
ini_getval_char(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
254
unsigned
char
ini_getval_uchar(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
255
char
*ini_getval_char_p(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
256
char
*ini_getval_str(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
257
char
*ini_getval_char_array_p(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
258
char
*ini_getval_str_array(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
int
flags,
int
*state);
259
struct
StrList
*ini_getval_strlist(
struct
INIFILE
*ini,
char
*section_name,
char
*key,
char
*tok,
int
flags,
int
*state);
260
#endif
//STASIS_INI_H
ini_section_create
int ini_section_create(struct INIFILE **ini, char *key)
Definition
ini.c:404
ini_open
struct INIFILE * ini_open(const char *filename)
Definition
ini.c:537
ini_free
void ini_free(struct INIFILE **ini)
Definition
ini.c:517
ini_getval
int ini_getval(struct INIFILE *ini, char *section_name, char *key, int type, int flags, union INIVal *result)
Definition
ini.c:118
ini_setval
int ini_setval(struct INIFILE **ini, unsigned type, char *section_name, char *key, char *value)
Definition
ini.c:374
ini_section_search
struct INISection * ini_section_search(struct INIFILE **ini, unsigned mode, const char *value)
Definition
ini.c:22
ini_getall
struct INIData * ini_getall(struct INIFILE *ini, char *section_name)
Definition
ini.c:94
ini_write
int ini_write(struct INIFILE *ini, FILE **stream, unsigned mode)
Definition
ini.c:428
ini_has_key
int ini_has_key(struct INIFILE *ini, const char *section, const char *key)
Definition
ini.c:56
INIData
A structure to describe an INI data record.
Definition
ini.h:64
INIData::value
char * value
INI variable value.
Definition
ini.h:66
INIData::key
char * key
INI variable name.
Definition
ini.h:65
INIFILE
A structure to describe an INI configuration file.
Definition
ini.h:82
INIFILE::section
struct INISection ** section
Array of INISection records.
Definition
ini.h:84
INIFILE::section_count
size_t section_count
Total INISection records.
Definition
ini.h:83
INISection
A structure to describe an INI section.
Definition
ini.h:73
INISection::data
struct INIData ** data
Array of INIData records.
Definition
ini.h:76
INISection::data_count
size_t data_count
Total INIData records.
Definition
ini.h:74
INISection::key
char * key
INI section name.
Definition
ini.h:75
StrList
Definition
strlist.h:16
template.h
INIVal
Consolidate possible value types.
Definition
ini.h:42
INIVal::as_ullong
unsigned long long as_ullong
Unsigned long long integer.
Definition
ini.h:52
INIVal::as_short
short as_short
Short integer.
Definition
ini.h:45
INIVal::as_long
long as_long
Long integer.
Definition
ini.h:49
INIVal::as_llong
long long as_llong
Long long integer.
Definition
ini.h:51
INIVal::as_uint
unsigned as_uint
Unsigned integer.
Definition
ini.h:48
INIVal::as_bool
bool as_bool
Boolean.
Definition
ini.h:57
INIVal::as_char_array_p
char ** as_char_array_p
String Array.
Definition
ini.h:56
INIVal::as_double
double as_double
Double precision float.
Definition
ini.h:53
INIVal::as_float
float as_float
Single precision float.
Definition
ini.h:54
INIVal::as_uchar
unsigned char as_uchar
Unsigned byte.
Definition
ini.h:44
INIVal::as_char_p
char * as_char_p
String.
Definition
ini.h:55
INIVal::as_ulong
unsigned long as_ulong
Unsigned long integer.
Definition
ini.h:50
INIVal::as_ushort
unsigned short as_ushort
Unsigned short integer.
Definition
ini.h:46
INIVal::as_char
char as_char
Byte.
Definition
ini.h:43
INIVal::as_int
int as_int
Integer.
Definition
ini.h:47
Generated by
1.17.0