theConfig 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - py - rb - jv - cc
Loading...
Searching...
No Matches
libconfig_modified.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2 libconfig - A library for processing structured configuration files
3 Copyright (C) 2005-2018 Mark A Lindner
4
5 This file is part of libconfig.
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public License
9 as published by the Free Software Foundation; either version 2.1 of
10 the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public
18 License along with this library; if not, see
19 <http://www.gnu.org/licenses/>.
20 ----------------------------------------------------------------------------
21*/
22
28
29#ifndef __libconfig_h
30#define __libconfig_h
31
32#ifdef __cplusplus
33extern "C" {
34#endif /* __cplusplus */
35
36#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
37#if defined(LIBCONFIG_STATIC)
38#define LIBCONFIG_API
39#elif defined(LIBCONFIG_EXPORTS)
40#define LIBCONFIG_API __declspec(dllexport)
41#else /* ! LIBCONFIG_EXPORTS */
42#define LIBCONFIG_API __declspec(dllimport)
43#endif /* LIBCONFIG_STATIC */
44#else /* ! WIN32 */
45#define LIBCONFIG_API
46#endif /* WIN32 */
47
48#define LIBCONFIG_VER_MAJOR 1
49#define LIBCONFIG_VER_MINOR 7
50#define LIBCONFIG_VER_REVISION 0
51
52#ifndef PARSE_C_HEADER_TO_META
53#include <stdio.h>
54#endif
55
56#define CONFIG_TYPE_NONE 0
57#define CONFIG_TYPE_GROUP 1
58#define CONFIG_TYPE_INT 2
59#define CONFIG_TYPE_INT64 3
60#define CONFIG_TYPE_FLOAT 4
61#define CONFIG_TYPE_STRING 5
62#define CONFIG_TYPE_BOOL 6
63#define CONFIG_TYPE_ARRAY 7
64#define CONFIG_TYPE_LIST 8
65
66#define CONFIG_FORMAT_DEFAULT 0
67#define CONFIG_FORMAT_HEX 1
68
69#define CONFIG_OPTION_AUTOCONVERT 0x01
70#define CONFIG_OPTION_SEMICOLON_SEPARATORS 0x02
71#define CONFIG_OPTION_COLON_ASSIGNMENT_FOR_GROUPS 0x04
72#define CONFIG_OPTION_COLON_ASSIGNMENT_FOR_NON_GROUPS 0x08
73#define CONFIG_OPTION_OPEN_BRACE_ON_SEPARATE_LINE 0x10
74#define CONFIG_OPTION_ALLOW_SCIENTIFIC_NOTATION 0x20
75#define CONFIG_OPTION_FSYNC 0x40
76#define CONFIG_OPTION_ALLOW_OVERRIDES 0x80
77
78#define CONFIG_TRUE (1)
79#define CONFIG_FALSE (0)
80
81typedef union config_value_t
82{
83 int ival;
84 long long llval;
85 double fval;
86 char *sval;
89
90typedef struct config_setting_t
91{
92 char *name;
93 short type;
94 short format;
98 void *hook;
99 unsigned int line;
100 const char *file;
102
109
115
116typedef const char ** (*config_include_fn_t)(struct config_t *,
117 const char *,
118 const char *,
119 const char **);
120
121typedef struct config_t
122{
124 void (*destructor)(void *);
126 unsigned short tab_width;
127 unsigned short float_precision;
128 unsigned short default_format;
129 const char *include_dir;
131 const char *error_text;
132 const char *error_file;
135 const char **filenames;
136 void *hook;
138
139extern LIBCONFIG_API int config_read(config_t *config, FILE *stream);
140extern LIBCONFIG_API void config_write(const config_t *config, FILE *stream);
141
143 short format);
144
145extern LIBCONFIG_API void config_set_options(config_t *config, int options);
146extern LIBCONFIG_API int config_get_options(const config_t *config);
147
148extern LIBCONFIG_API void config_set_option(config_t *config, int option,
149 int flag);
150extern LIBCONFIG_API int config_get_option(const config_t *config, int option);
151
152extern LIBCONFIG_API int config_read_string(config_t *config, const char *str);
153
155 const char *filename);
157 const char *filename);
158
160 void (*destructor)(void *));
162 const char *include_dir);
165
167 unsigned short digits);
169 const config_t *config);
170
172 unsigned short width);
174 const config_t *config);
175
176extern LIBCONFIG_API void config_set_hook(config_t *config, void *hook);
177
178#define config_get_hook(C) ((C)->hook)
179
180extern LIBCONFIG_API void config_init(config_t *config);
183
185 const config_setting_t *setting);
187 const config_setting_t *setting);
189 const config_setting_t *setting);
191 const config_setting_t *setting);
193 const config_setting_t *setting);
194
196 const config_setting_t *setting, const char *name, int *value);
198 const config_setting_t *setting, const char *name, long long *value);
200 const config_setting_t *setting, const char *name, double *value);
202 const config_setting_t *setting, const char *name, int *value);
204 const config_setting_t *setting, const char *name, const char **value);
205
207 int value);
209 long long value);
211 double value);
213 int value);
215 const char *value);
216
218 short format);
220 const config_setting_t *setting);
221
223 const config_setting_t *setting, int idx);
225 const config_setting_t *setting, int idx);
227 const config_setting_t *setting, int idx);
229 const config_setting_t *setting, int idx);
231 const config_setting_t *setting, int idx);
232
234 config_setting_t *setting, int idx, int value);
236 config_setting_t *setting, int idx, long long value);
238 config_setting_t *setting, int idx, double value);
240 config_setting_t *setting, int idx, int value);
242 config_setting_t *setting, int idx, const char *value);
243
245 config_t *config, const char *include_dir, const char *path,
246 const char **error);
247
249 const config_setting_t *setting);
250
252 const config_setting_t *setting);
253
254#ifndef PARSE_C_HEADER_TO_META
255
256#define /* const char * */ config_get_include_dir(/* const config_t * */ C) \
257 ((C)->include_dir)
258
259#define /* void */ config_set_auto_convert(/* config_t * */ C, F) \
260 config_set_option((C), CONFIG_OPTION_AUTOCONVERT, (F))
261#define /* int */ config_get_auto_convert(/* const config_t * */ C) \
262 config_get_option((C), CONFIG_OPTION_AUTOCONVERT)
263
264#define /* int */ config_setting_type(/* const config_setting_t * */ S) \
265 ((S)->type)
266
267#define /* int */ config_setting_is_group(/* const config_setting_t * */ S) \
268 ((S)->type == CONFIG_TYPE_GROUP)
269#define /* int */ config_setting_is_array(/* const config_setting_t * */ S) \
270 ((S)->type == CONFIG_TYPE_ARRAY)
271#define /* int */ config_setting_is_list(/* const config_setting_t * */ S) \
272 ((S)->type == CONFIG_TYPE_LIST)
273
274#define /* int */ config_setting_is_number(/* const config_setting_t * */ S) \
275 (((S)->type == CONFIG_TYPE_INT) \
276 || ((S)->type == CONFIG_TYPE_INT64) \
277 || ((S)->type == CONFIG_TYPE_FLOAT))
278
279#define /* const char * */ config_setting_name( \
280 /* const config_setting_t * */ S) \
281 ((S)->name)
282
283#define /* config_setting_t * */ config_setting_parent( \
284 /* const config_setting_t * */ S) \
285 ((S)->parent)
286
287#define /* int */ config_setting_is_root( \
288 /* const config_setting_t * */ S) \
289 ((S)->parent ? CONFIG_FALSE : CONFIG_TRUE)
290
291#endif // PARSE_C_HEADER_TO_META
292
294
296 const config_setting_t *setting);
298 const config_setting_t *setting, unsigned int idx);
299
301 const config_setting_t *setting, const char *name);
302
304 config_setting_t *parent, const char *name, int __type);
306 const char *name);
308 unsigned int idx);
310 void *hook);
311#ifndef PARSE_C_HEADER_TO_META
312# define config_setting_get_hook(S) ((S)->hook)
313#endif
314
316 const char *path);
318 config_setting_t *setting, const char *path);
319
320extern LIBCONFIG_API int config_lookup_int(const config_t *config,
321 const char *path, int *value);
323 const char *path,
324 long long *value);
326 const char *path, double *value);
328 const char *path, int *value);
330 const char *path,
331 const char **value);
332
333#ifndef PARSE_C_HEADER_TO_META
334
335#define /* config_setting_t * */ config_root_setting( \
336 /* const config_t * */ C) \
337 ((C)->root)
338
339#define /* void */ config_set_default_format(/* config_t * */ C, \
340 /* short */ F) \
341 (C)->default_format = (F)
342
343#define /* short */ config_get_default_format(/* config_t * */ C) \
344 ((C)->default_format)
345
346#define /* unsigned short */ config_setting_source_line( \
347 /* const config_setting_t * */ S) \
348 ((S)->line)
349
350#define /* const char */ config_setting_source_file( \
351 /* const config_setting_t * */ S) \
352 ((S)->file)
353
354#define /* const char * */ config_error_text(/* const config_t * */ C) \
355 ((C)->error_text)
356
357#define /* const char * */ config_error_file(/* const config_t * */ C) \
358 ((C)->error_file)
359
360#define /* int */ config_error_line(/* const config_t * */ C) \
361 ((C)->error_line)
362
363#define /* config_error_t */ config_error_type(/* const config_t * */ C) \
364 ((C)->error_type)
365
366#endif // PARSE_C_HEADER_TO_META
367
368#ifdef __cplusplus
369}
370#endif /* __cplusplus */
371
372#endif /* __libconfig_h */
373
375
LIBCONFIG_API int config_setting_get_bool(const config_setting_t *setting)
LIBCONFIG_API int config_read_file(config_t *config, const char *filename)
LIBCONFIG_API void config_set_float_precision(config_t *config, unsigned short digits)
LIBCONFIG_API config_setting_t * config_lookup(const config_t *config, const char *path)
struct config_t config_t
LIBCONFIG_API int config_setting_set_int(config_setting_t *setting, int value)
LIBCONFIG_API config_setting_t * config_setting_set_string_elem(config_setting_t *setting, int idx, const char *value)
LIBCONFIG_API void config_set_include_dir(config_t *config, const char *include_dir)
LIBCONFIG_API int config_setting_lookup_int64(const config_setting_t *setting, const char *name, long long *value)
LIBCONFIG_API int config_setting_remove_elem(config_setting_t *parent, unsigned int idx)
LIBCONFIG_API unsigned short config_get_tab_width(const config_t *config)
LIBCONFIG_API config_setting_t * config_setting_set_float_elem(config_setting_t *setting, int idx, double value)
LIBCONFIG_API const char * config_setting_get_string_elem(const config_setting_t *setting, int idx)
LIBCONFIG_API config_setting_t * config_setting_get_member(const config_setting_t *setting, const char *name)
LIBCONFIG_API int config_setting_lookup_int(const config_setting_t *setting, const char *name, int *value)
LIBCONFIG_API config_setting_t * config_setting_add(config_setting_t *parent, const char *name, int __type)
LIBCONFIG_API const char * config_setting_get_string(const config_setting_t *setting)
LIBCONFIG_API const char ** config_default_include_func(config_t *config, const char *include_dir, const char *path, const char **error)
LIBCONFIG_API int config_setting_index(const config_setting_t *setting)
LIBCONFIG_API config_setting_t * config_setting_lookup(config_setting_t *setting, const char *path)
LIBCONFIG_API int config_setting_set_float(config_setting_t *setting, double value)
LIBCONFIG_API int config_setting_set_int64(config_setting_t *setting, long long value)
LIBCONFIG_API void config_set_include_func(config_t *config, config_include_fn_t func)
union config_value_t config_value_t
LIBCONFIG_API double config_setting_get_float(const config_setting_t *setting)
LIBCONFIG_API void config_set_tab_width(config_t *config, unsigned short width)
LIBCONFIG_API int config_setting_set_string(config_setting_t *setting, const char *value)
LIBCONFIG_API config_setting_t * config_setting_get_elem(const config_setting_t *setting, unsigned int idx)
LIBCONFIG_API int config_setting_set_format(config_setting_t *setting, short format)
LIBCONFIG_API void config_set_options(config_t *config, int options)
LIBCONFIG_API void config_setting_set_hook(config_setting_t *setting, void *hook)
LIBCONFIG_API int config_setting_lookup_string(const config_setting_t *setting, const char *name, const char **value)
LIBCONFIG_API int config_lookup_string(const config_t *config, const char *path, const char **value)
struct config_setting_t config_setting_t
const char **(* config_include_fn_t)(struct config_t *, const char *, const char *, const char **)
LIBCONFIG_API int config_setting_lookup_float(const config_setting_t *setting, const char *name, double *value)
LIBCONFIG_API void config_destroy(config_t *config)
#define config_set_default_format(C, F)
LIBCONFIG_API unsigned short config_get_float_precision(const config_t *config)
LIBCONFIG_API int config_lookup_bool(const config_t *config, const char *path, int *value)
LIBCONFIG_API int config_lookup_float(const config_t *config, const char *path, double *value)
LIBCONFIG_API short config_setting_get_format(const config_setting_t *setting)
LIBCONFIG_API int config_lookup_int(const config_t *config, const char *path, int *value)
LIBCONFIG_API void config_init(config_t *config)
struct config_list_t config_list_t
LIBCONFIG_API int config_setting_remove(config_setting_t *parent, const char *name)
LIBCONFIG_API int config_setting_get_bool_elem(const config_setting_t *setting, int idx)
LIBCONFIG_API int config_get_options(const config_t *config)
LIBCONFIG_API void config_set_hook(config_t *config, void *hook)
LIBCONFIG_API int config_setting_get_int(const config_setting_t *setting)
LIBCONFIG_API int config_setting_length(const config_setting_t *setting)
LIBCONFIG_API int config_setting_set_bool(config_setting_t *setting, int value)
LIBCONFIG_API int config_setting_lookup_bool(const config_setting_t *setting, const char *name, int *value)
LIBCONFIG_API void config_set_option(config_t *config, int option, int flag)
LIBCONFIG_API config_setting_t * config_setting_set_int_elem(config_setting_t *setting, int idx, int value)
LIBCONFIG_API int config_write_file(config_t *config, const char *filename)
LIBCONFIG_API int config_get_option(const config_t *config, int option)
LIBCONFIG_API int config_setting_is_scalar(const config_setting_t *setting)
LIBCONFIG_API double config_setting_get_float_elem(const config_setting_t *setting, int idx)
#define LIBCONFIG_API
LIBCONFIG_API int config_lookup_int64(const config_t *config, const char *path, long long *value)
LIBCONFIG_API config_setting_t * config_setting_set_bool_elem(config_setting_t *setting, int idx, int value)
LIBCONFIG_API int config_setting_get_int_elem(const config_setting_t *setting, int idx)
LIBCONFIG_API void config_clear(config_t *config)
LIBCONFIG_API int config_read(config_t *config, FILE *stream)
LIBCONFIG_API long long config_setting_get_int64_elem(const config_setting_t *setting, int idx)
LIBCONFIG_API void config_write(const config_t *config, FILE *stream)
LIBCONFIG_API config_setting_t * config_setting_set_int64_elem(config_setting_t *setting, int idx, long long value)
LIBCONFIG_API void config_set_destructor(config_t *config, void(*destructor)(void *))
LIBCONFIG_API int config_setting_is_aggregate(const config_setting_t *setting)
LIBCONFIG_API int config_read_string(config_t *config, const char *str)
LIBCONFIG_API long long config_setting_get_int64(const config_setting_t *setting)
@ CONFIG_ERR_PARSE
@ CONFIG_ERR_NONE
@ CONFIG_ERR_FILE_IO
unsigned int length
config_setting_t ** elements
config_value_t value
struct config_setting_t * parent
struct config_t * config
const char ** filenames
const char * error_file
config_include_fn_t include_fn
config_setting_t * root
config_error_t error_type
const char * include_dir
unsigned short tab_width
const char * error_text
unsigned short float_precision
void(* destructor)(void *)
unsigned short default_format
struct config_list_t * list