Freeciv-3.3
Loading...
Searching...
No Matches
registry_ini.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__REGISTRY_INI_H
14#define FC__REGISTRY_INI_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* utility */
21#include "ioz.h"
22#include "support.h" /* bool type and fc__attribute */
23
24/* Opaque types. */
25struct section_file;
26struct section;
27struct entry;
28
29/* Typedefs. */
30typedef const void *secfile_data_t;
31
32typedef bool (*secfile_enum_is_valid_fn_t) (int enumerator);
33typedef const char * (*secfile_enum_name_fn_t) (int enumerator);
34typedef int (*secfile_enum_by_name_fn_t) (const char *enum_name,
35 int (*strcmp_fn)(const char *,
36 const char *));
38typedef int (*secfile_enum_next_fn_t) (int enumerator);
39typedef const char * (*secfile_enum_name_data_fn_t) (secfile_data_t data,
40 int enumerator);
41
42/* Create a 'struct section_list' and related functions: */
43#define SPECLIST_TAG section
44#include "speclist.h"
45#define section_list_iterate(seclist, psection) \
46 TYPED_LIST_ITERATE(struct section, seclist, psection)
47#define section_list_iterate_end LIST_ITERATE_END
48#define section_list_iterate_rev(seclist, psection) \
49 TYPED_LIST_ITERATE_REV(struct section, seclist, psection)
50#define section_list_iterate_rev_end LIST_ITERATE_REV_END
51
52/* Create a 'struct entry_list' and related functions: */
53#define SPECLIST_TAG entry
54#include "speclist.h"
55#define entry_list_iterate(entlist, pentry) \
56 TYPED_LIST_ITERATE(struct entry, entlist, pentry)
57#define entry_list_iterate_end LIST_ITERATE_END
58
59/* Main functions. */
60struct section_file *secfile_load_section(const char *filename,
61 const char *section,
62 bool allow_duplicates);
64 bool allow_duplicates);
65
66bool secfile_save(const struct section_file *secfile, const char *filename,
68void secfile_check_unused(const struct section_file *secfile);
69const char *secfile_name(const struct section_file *secfile);
70
72
73/* Insertion functions. */
75 bool value, const char *comment,
76 bool allow_replace,
77 const char *path, ...)
79#define secfile_insert_bool(secfile, value, path, ...) \
80 secfile_insert_bool_full(secfile, value, nullptr, FALSE, \
81 path, ## __VA_ARGS__)
82#define secfile_insert_bool_comment(secfile, value, comment, path, ...) \
83 secfile_insert_bool_full(secfile, value, comment, FALSE, \
84 path, ## __VA_ARGS__)
85#define secfile_replace_bool(secfile, value, path, ...) \
86 secfile_insert_bool_full(secfile, value, nullptr, TRUE, \
87 path, ## __VA_ARGS__)
88#define secfile_replace_bool_comment(secfile, value, comment, path, ...) \
89 secfile_insert_bool_full(secfile, value, comment, TRUE, \
90 path, ## __VA_ARGS__)
92 const bool *values, size_t dim,
93 const char *comment, bool allow_replace,
94 const char *path, ...)
96#define secfile_insert_bool_vec(secfile, values, dim, path, ...) \
97 secfile_insert_bool_vec_full(secfile, values, dim, nullptr, FALSE, \
98 path, ## __VA_ARGS__)
99#define secfile_insert_bool_vec_comment(secfile, values, dim, \
100 comment, path, ...) \
101 secfile_insert_bool_vec_full(secfile, values, dim, comment, FALSE, \
102 path, ## __VA_ARGS__)
103#define secfile_replace_bool_vec(secfile, values, dim, path, ...) \
104 secfile_insert_bool_vec_full(secfile, values, dim, nullptr, TRUE, \
105 path, ## __VA_ARGS__)
106#define secfile_replace_bool_vec_comment(secfile, values, dim, \
107 comment, path, ...) \
108 secfile_insert_bool_vec_full(secfile, values, comment, TRUE, \
109 path, ## __VA_ARGS__)
110
112 int value, const char *comment,
113 bool allow_replace,
114 const char *path, ...)
116#define secfile_insert_int(secfile, value, path, ...) \
117 secfile_insert_int_full(secfile, value, nullptr, FALSE, \
118 path, ## __VA_ARGS__)
119#define secfile_insert_int_comment(secfile, value, comment, path, ...) \
120 secfile_insert_int_full(secfile, value, comment, FALSE, \
121 path, ## __VA_ARGS__)
122#define secfile_replace_int(secfile, value, path, ...) \
123 secfile_insert_int_full(secfile, value, nullptr, TRUE, \
124 path, ## __VA_ARGS__)
125#define secfile_replace_int_comment(secfile, value, comment, path, ...) \
126 secfile_insert_int_full(secfile, value, comment, TRUE, \
127 path, ## __VA_ARGS__)
129 const int *values, size_t dim,
130 const char *comment, bool allow_replace,
131 const char *path, ...)
133#define secfile_insert_int_vec(secfile, values, dim, path, ...) \
134 secfile_insert_int_vec_full(secfile, values, dim, nullptr, FALSE, \
135 path, ## __VA_ARGS__)
136#define secfile_insert_int_vec_comment(secfile, values, dim, \
137 comment, path, ...) \
138 secfile_insert_int_vec_full(secfile, values, dim, comment, FALSE, \
139 path, ## __VA_ARGS__)
140#define secfile_replace_int_vec(secfile, values, dim, path, ...) \
141 secfile_insert_int_vec_full(secfile, values, dim, nullptr, TRUE, \
142 path, ## __VA_ARGS__)
143#define secfile_replace_int_vec_comment(secfile, values, dim, \
144 comment, path, ...) \
145 secfile_insert_int_vec_full(secfile, values, dim, comment, TRUE, \
146 path, ## __VA_ARGS__)
147
149 float value, const char *comment,
150 bool allow_replace,
151 const char *path, ...)
153#define secfile_insert_float(secfile, value, path, ...) \
154 secfile_insert_float_full(secfile, value, nullptr, FALSE, \
155 path, ## __VA_ARGS__)
156#define secfile_replace_float(secfile, value, path, ...) \
157 secfile_insert_float_full(secfile, value, nullptr, TRUE, \
158 path, ## __VA_ARGS__)
159
161 const char *filename);
162
164 const char *comment);
165
167 const char *str,
168 const char *comment,
169 bool allow_replace, bool no_escape,
170 enum entry_special_type stype,
171 const char *path, ...)
173#define secfile_insert_str(secfile, string, path, ...) \
174 secfile_insert_str_full(secfile, string, nullptr, FALSE, FALSE, FALSE, \
175 path, ## __VA_ARGS__)
176#define secfile_insert_str_noescape(secfile, string, path, ...) \
177 secfile_insert_str_full(secfile, string, nullptr, FALSE, TRUE, FALSE, \
178 path, ## __VA_ARGS__)
179#define secfile_insert_str_comment(secfile, string, comment, path, ...) \
180 secfile_insert_str_full(secfile, string, comment, FALSE, TRUE, FALSE, \
181 path, ## __VA_ARGS__)
182#define secfile_insert_str_noescape_comment(secfile, string, \
183 comment, path, ...) \
184 secfile_insert_str_full(secfile, string, comment, FALSE, TRUE, FALSE, \
185 path, ## __VA_ARGS__)
186#define secfile_replace_str(secfile, string, path, ...) \
187 secfile_insert_str_full(secfile, string, nullptr, TRUE, FALSE, FALSE, \
188 path, ## __VA_ARGS__)
189#define secfile_replace_str_noescape(secfile, string, path, ...) \
190 secfile_insert_str_full(secfile, string, nullptr, TRUE, TRUE, FALSE, \
191 path, ## __VA_ARGS__)
192#define secfile_replace_str_comment(secfile, string, comment, path, ...) \
193 secfile_insert_str_full(secfile, string, comment, TRUE, TRUE, FALSE, \
194 path, ## __VA_ARGS__)
195#define secfile_replace_str_noescape_comment(secfile, string, \
196 comment, path, ...) \
197 secfile_insert_str_full(secfile, string, comment, TRUE, TRUE, FALSE, \
198 path, ## __VA_ARGS__)
200 const char *const *strings, size_t dim,
201 const char *comment, bool allow_replace,
202 bool no_escape, const char *path, ...)
204#define secfile_insert_str_vec(secfile, strings, dim, path, ...) \
205 secfile_insert_str_vec_full(secfile, strings, dim, nullptr, FALSE, FALSE, \
206 path, ## __VA_ARGS__)
207#define secfile_insert_str_vec_noescape(secfile, strings, dim, path, ...) \
208 secfile_insert_str_vec_full(secfile, strings, dim, nullptr, FALSE, TRUE, \
209 path, ## __VA_ARGS__)
210#define secfile_insert_str_vec_comment(secfile, strings, dim, \
211 comment, path, ...) \
212 secfile_insert_str_vec_full(secfile, strings, dim, comment, FALSE, TRUE, \
213 path, ## __VA_ARGS__)
214#define secfile_insert_str_vec_noescape_comment(secfile, strings, dim, \
215 comment, path, ...) \
216 secfile_insert_str_vec_full(secfile, strings, dim, comment, FALSE, TRUE, \
217 path, ## __VA_ARGS__)
218#define secfile_replace_str_vec(secfile, strings, dim, path, ...) \
219 secfile_insert_str_vec_full(secfile, strings, dim, nullptr, TRUE, FALSE, \
220 path, ## __VA_ARGS__)
221#define secfile_replace_str_vec_noescape(secfile, strings, dim, path, ...) \
222 secfile_insert_str_vec_full(secfile, strings, dim, nullptr, TRUE, TRUE, \
223 path, ## __VA_ARGS__)
224#define secfile_replace_str_vec_comment(secfile, strings, dim, \
225 comment, path, ...) \
226 secfile_insert_str_vec_full(secfile, strings, dim, comment, TRUE, TRUE, \
227 path, ## __VA_ARGS__)
228#define secfile_replace_str_vec_noescape_comment(secfile, strings, dim, \
229 comment, path, ...) \
230 secfile_insert_str_vec_full(secfile, strings, dim, comment, TRUE, TRUE, \
231 path, ## __VA_ARGS__)
232
234 int enumerator,
236 const char *comment,
237 bool allow_replace,
238 const char *path, ...)
241 int bitwise_val,
246 const char *comment,
247 bool allow_replace,
248 const char *path, ...)
250#define secfile_insert_enum_full(secfile, enumerator, specenum_type, \
251 comment, allow_replace, path, ...) \
252(specenum_type##_is_bitwise() \
253 ? secfile_insert_bitwise_enum_full(secfile, enumerator, \
254 (secfile_enum_name_fn_t) \
255 specenum_type##_name, \
256 (secfile_enum_iter_fn_t) \
257 specenum_type##_begin, \
258 (secfile_enum_iter_fn_t) \
259 specenum_type##_end, \
260 (secfile_enum_next_fn_t) \
261 specenum_type##_next, \
262 comment, allow_replace, \
263 path, ## __VA_ARGS__) \
264 : secfile_insert_plain_enum_full(secfile, enumerator, \
265 (secfile_enum_name_fn_t) \
266 specenum_type##_name, \
267 comment, allow_replace, \
268 path, ## __VA_ARGS__))
269#define secfile_insert_enum(secfile, enumerator, specenum_type, path, ...) \
270 secfile_insert_enum_full(secfile, enumerator, specenum_type, nullptr, FALSE, \
271 path, ## __VA_ARGS__)
272#define secfile_insert_enum_comment(secfile, enumerator, specenum_type, \
273 comment, path, ...) \
274 secfile_insert_enum_full(secfile, enumerator, specenum_type, comment, \
275 FALSE, path, ## __VA_ARGS__)
276#define secfile_replace_enum(secfile, enumerator, specenum_type, path, ...) \
277 secfile_insert_enum_full(secfile, enumerator, specenum_type, nullptr, TRUE, \
278 path, ## __VA_ARGS__)
279#define secfile_replace_enum_comment(secfile, enumerator, specenum_type, \
280 comment, path, ...) \
281 secfile_insert_enum_full(secfile, enumerator, specenum_type, comment, \
282 TRUE, path, ## __VA_ARGS__)
284 const int *enumurators, size_t dim,
286 const char *comment,
287 bool allow_replace,
288 const char *path, ...)
291 const int *bitwise_vals,
292 size_t dim,
297 const char *comment,
298 bool allow_replace,
299 const char *path, ...)
301#define secfile_insert_enum_vec_full(secfile, enumerators, dim, \
302 specenum_type, comment, allow_replace, \
303 path, ...) \
304(specenum_type##_is_bitwise() \
305 ? secfile_insert_bitwise_enum_vec_full(secfile, (const int *) enumerators, \
306 dim, \
307 (secfile_enum_name_fn_t) \
308 specenum_type##_name, \
309 (secfile_enum_iter_fn_t) \
310 specenum_type##_begin, \
311 (secfile_enum_iter_fn_t) \
312 specenum_type##_end, \
313 (secfile_enum_next_fn_t) \
314 specenum_type##_next, \
315 comment, allow_replace, \
316 path, ## __VA_ARGS__) \
317 : secfile_insert_plain_enum_vec_full(secfile, (const int *) enumerators, \
318 dim, \
319 (secfile_enum_name_fn_t) \
320 specenum_type##_name, \
321 comment, allow_replace, \
322 path, ## __VA_ARGS__))
323#define secfile_insert_enum_vec(secfile, enumerators, dim, specenum_type, \
324 path, ...) \
325 secfile_insert_enum_vec_full(secfile, enumerators, dim, specenum_type, \
326 nullptr, FALSE, path, ## __VA_ARGS__)
327#define secfile_insert_enum_vec_comment(secfile, enumerators, dim, \
328 specenum_type, comment, path, ...) \
329 secfile_insert_enum_vec_full(secfile, enumerators, dim, specenum_type, \
330 comment, FALSE, path, ## __VA_ARGS__)
331#define secfile_replace_enum_vec(secfile, enumerators, dim, specenum_type, \
332 path, ...) \
333 secfile_insert_enum_vec_full(secfile, enumerators, dim, specenum_type, \
334 nullptr, TRUE, path, ## __VA_ARGS__)
335#define secfile_replace_enum_vec_comment(secfile, enumerators, dim, \
336 specenum_type, comment, path, ...) \
337 secfile_insert_enum_vec_full(secfile, enumerators, dim, specenum_type, \
338 comment, TRUE, path, ## __VA_ARGS__)
339
341 int value, bool bitwise,
343 secfile_data_t data,
344 const char *comment,
345 bool allow_replace,
346 const char *path, ...)
348#define secfile_insert_enum_data(secfile, value, bitwise, name_fn, data, \
349 path, ...) \
350 secfile_insert_enum_data_full(secfile, value, bitwise, name_fn, data, \
351 nullptr, FALSE, path, ## __VA_ARGS__)
352#define secfile_insert_enum_data_comment(secfile, value, bitwise, name_fn, \
353 data, path, ...) \
354 secfile_insert_enum_data_full(secfile, value, bitwise, name_fn, data, \
355 comment, FALSE, path, ## __VA_ARGS__)
356#define secfile_replace_enum_data(secfile, value, bitwise, name_fn, data, \
357 path, ...) \
358 secfile_insert_enum_data_full(secfile, value, bitwise, name_fn, data, \
359 nullptr, TRUE, path, ## __VA_ARGS__)
360#define secfile_replace_enum_data_comment(secfile, value, bitwise, name_fn, \
361 data, path, ...) \
362 secfile_insert_enum_data_full(secfile, value, bitwise, name_fn, data, \
363 comment, TRUE, path, ## __VA_ARGS__)
365 const int *values, size_t dim,
366 bool bitwise,
368 secfile_data_t data,
369 const char *comment,
370 bool allow_replace,
371 const char *path, ...)
373#define secfile_insert_enum_vec_data(secfile, values, dim, bitwise, \
374 name_fn, data, path, ...) \
375 secfile_insert_enum_vec_data_full(secfile, values, dim, bitwise, name_fn, \
376 data, nullptr, FALSE, path, ## __VA_ARGS__)
377#define secfile_insert_enum_vec_data_comment(secfile, values, dim, bitwise, \
378 name_fn, data, path, ...) \
379 secfile_insert_enum_vec_data_full(secfile, values, dim, bitwise, name_fn, \
380 data, comment, FALSE, path, \
381 ## __VA_ARGS__)
382#define secfile_replace_enum_vec_data(secfile, values, dim, bitwise, \
383 name_fn, data, path, ...) \
384 secfile_insert_enum_vec_data_full(secfile, values, dim, bitwise, name_fn, \
385 data, nullptr, TRUE, path, ## __VA_ARGS__)
386#define secfile_replace_enum_vec_data_comment(secfile, values, dim, \
387 bitwise, name_fn, data, path, \
388 ...) \
389 secfile_insert_enum_vec_data_full(secfile, values, dim, bitwise, name_fn, \
390 data, comment, TRUE, path, \
391 ## __VA_ARGS__)
392
394 const char *filename,
395 const char *path, ...)
397
399 const char *str,
400 const char *path, ...)
402
403/* Deletion function. */
405 const char *path, ...)
407
408/* Lookup functions. */
410 const char *path);
412 const char *path, ...)
414
415/* Macros to silence "unused entry" warnings about entries that
416 * we intentionally ignore. */
417#define secfile_entry_ignore(_sfile_, _fmt_, ...) \
418 (void) secfile_entry_lookup(_sfile_, _fmt_, ## __VA_ARGS__)
419#define secfile_entry_ignore_by_path(_sfile_, _path_) \
420 (void) secfile_entry_by_path(_sfile_, _path_)
421
422bool secfile_lookup_bool(const struct section_file *secfile, bool *bval,
423 const char *path, ...)
427 bool def, const char *path, ...)
431 size_t *dim, const char *path, ...)
434
436 const char *path, ...)
440 const char *path, ...)
444 int defval, int minval, int maxval,
445 const char *path, ...)
449 size_t *dim, const char *path, ...)
452
454 const char *path, ...)
458 float def, const char *path, ...);
459
461 const char *path, ...)
465 const char *def,
466 const char *path, ...)
470 size_t *dim, const char *path, ...)
472
474 int *penumerator,
477 const char *path, ...)
481 int *penumerator,
484 const char *path, ...)
487#define secfile_lookup_enum(secfile, enumerator, specenum_type, path, ...) \
488(specenum_type##_is_bitwise() \
489 ? secfile_lookup_bitwise_enum_full(secfile, FC_ENUM_PTR(enumerator), \
490 (secfile_enum_is_valid_fn_t) \
491 specenum_type##_is_valid, \
492 (secfile_enum_by_name_fn_t) \
493 specenum_type##_by_name, \
494 path, ## __VA_ARGS__) \
495 : secfile_lookup_plain_enum_full(secfile, FC_ENUM_PTR(enumerator), \
496 (secfile_enum_is_valid_fn_t) \
497 specenum_type##_is_valid, \
498 (secfile_enum_by_name_fn_t) \
499 specenum_type##_by_name, \
500 path, ## __VA_ARGS__))
502 *secfile, int defval,
507 const char *path, ...)
511 *secfile, int defval,
516 const char *path, ...)
519#define secfile_lookup_enum_default(secfile, defval, specenum_type, \
520 path, ...) \
521(specenum_type##_is_bitwise() \
522 ? secfile_lookup_bitwise_enum_default_full(secfile, defval, \
523 (secfile_enum_is_valid_fn_t) \
524 specenum_type##_is_valid, \
525 (secfile_enum_by_name_fn_t) \
526 specenum_type##_by_name, \
527 path, ## __VA_ARGS__) \
528 : secfile_lookup_plain_enum_default_full(secfile, defval, \
529 (secfile_enum_is_valid_fn_t) \
530 specenum_type##_is_valid, \
531 (secfile_enum_by_name_fn_t) \
532 specenum_type##_by_name, \
533 path, ## __VA_ARGS__))
535 size_t *dim,
540 const char *path, ...)
544 size_t *dim,
549 const char *path, ...)
552#define secfile_lookup_enum_vec(secfile, dim, specenum_type, \
553 path, ...) \
554(specenum_type##_is_bitwise() \
555 ? (enum specenum_type *) \
556 secfile_lookup_bitwise_enum_vec_full(secfile, dim, \
557 (secfile_enum_is_valid_fn_t) \
558 specenum_type##_is_valid, \
559 (secfile_enum_by_name_fn_t) \
560 specenum_type##_by_name, \
561 path, ## __VA_ARGS__) \
562 : (enum specenum_type *) \
563 secfile_lookup_plain_enum_vec_full(secfile, dim, \
564 (secfile_enum_is_valid_fn_t) \
565 specenum_type##_is_valid, \
566 (secfile_enum_by_name_fn_t) \
567 specenum_type##_by_name, \
568 path, ## __VA_ARGS__))
569
570bool secfile_lookup_enum_data(const struct section_file *secfile,
571 int *pvalue, bool bitwise,
573 secfile_data_t data, const char *path, ...)
577 int defval, bool bitwise,
579 secfile_data_t data,
580 const char *path, ...)
584 size_t *dim, bool bitwise,
586 secfile_data_t data, const char *path, ...)
589
590/* Sections functions. */
592 const char *section_name);
594 const char *path, ...)
600 const char *prefix);
602 const char *prefix);
604 const char *section_name);
605
606
607/* Independent section functions. */
610
612
613/* Entry functions. */
616 const char *entry_name);
618 const char *path, ...)
621 const char *entry_name,
622 int value);
624 const char *entry_name,
625 bool value);
627 const char *entry_name,
628 float value);
630 const char *entry_name,
631 const char *value, bool escaped);
632
633/* Independent entry functions. */
643
644void entry_destroy(struct entry *pentry);
645
646struct section *entry_section(const struct entry *pentry);
647enum entry_type entry_type_get(const struct entry *pentry);
648int entry_path(const struct entry *pentry, char *buf, size_t buf_len);
649
650const char *entry_name(const struct entry *pentry);
651bool entry_set_name(struct entry *pentry, const char *entry_name);
652
653const char *entry_comment(const struct entry *pentry);
654void entry_set_comment(struct entry *pentry, const char *comment);
655
656bool entry_int_get(const struct entry *pentry, int *value);
657bool entry_int_set(struct entry *pentry, int value);
658
659bool entry_bool_get(const struct entry *pentry, bool *value);
660bool entry_bool_set(struct entry *pentry, bool value);
661
662bool entry_float_get(const struct entry *pentry, float *value);
663bool entry_float_set(struct entry *pentry, float value);
664
665bool entry_str_get(const struct entry *pentry, const char **value);
666bool entry_str_set(struct entry *pentry, const char *value);
667bool entry_str_escaped(const struct entry *pentry);
668bool entry_str_set_escaped(struct entry *pentry, bool escaped);
669bool entry_str_set_gt_marking(struct entry *pentry, bool gt_marking);
670
671#ifdef __cplusplus
672}
673#endif /* __cplusplus */
674
675#endif /* FC__REGISTRY_INI_H */
#define str
Definition astring.c:76
char * incite_cost
Definition comments.c:76
const char * enum_name
Definition events.c:76
fz_method
Definition ioz.h:37
const char * section_name(const struct section *psection)
bool bool bool * secfile_lookup_bool_vec(const struct section_file *secfile, size_t *dim, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
bool bool bool bool int int int * secfile_lookup_int_vec(const struct section_file *secfile, size_t *dim, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
bool int secfile_lookup_enum_default_data(const struct section_file *secfile, int defval, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
const char const char * secfile_lookup_str_default(const struct section_file *secfile, const char *def, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
void entry_set_comment(struct entry *pentry, const char *comment)
bool entry_bool_get(const struct entry *pentry, bool *value)
void section_destroy(struct section *psection)
bool int int * secfile_lookup_enum_vec_data(const struct section_file *secfile, size_t *dim, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
void secfile_check_unused(const struct section_file *secfile)
int entry_path(const struct entry *pentry, char *buf, size_t buf_len)
struct section * secfile_insert_long_comment(struct section_file *secfile, const char *comment)
size_t size_t secfile_insert_bitwise_enum_vec_full(struct section_file *secfile, const int *bitwise_vals, size_t dim, secfile_enum_name_fn_t name_fn, secfile_enum_iter_fn_t begin_fn, secfile_enum_iter_fn_t end_fn, secfile_enum_next_fn_t next_fn, const char *comment, bool allow_replace, const char *path,...) fc__attribute((__format__(__printf__
int(* secfile_enum_iter_fn_t)(void)
const char const char const char bool bool secfile_lookup_bitwise_enum_full(const struct section_file *secfile, int *penumerator, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
int * secfile_lookup_plain_enum_vec_full(const struct section_file *secfile, size_t *dim, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
struct entry struct entry * secfile_insert_comment(struct section_file *secfile, const char *str, const char *path,...) fc__attribute((__format__(__printf__
const char *(* secfile_enum_name_data_fn_t)(secfile_data_t data, int enumerator)
entry_type
@ ENTRY_FILEREFERENCE
@ ENTRY_LONG_COMMENT
@ ENTRY_INT
@ ENTRY_FLOAT
@ ENTRY_STR
@ ENTRY_ILLEGAL
@ ENTRY_BOOL
struct entry * secfile_insert_bool_full(struct section_file *secfile, bool value, const char *comment, bool allow_replace, const char *path,...) fc__attribute((__format__(__printf__
bool entry_str_escaped(const struct entry *pentry)
bool bool bool bool int int int bool float secfile_lookup_float_default(const struct section_file *secfile, float def, const char *path,...)
size_t secfile_insert_int_vec_full(struct section_file *secfile, const int *values, size_t dim, const char *comment, bool allow_replace, const char *path,...) fc__attribute((__format__(__printf__
struct section * entry_section(const struct entry *pentry)
struct entry * secfile_entry_lookup(const struct section_file *secfile, const char *path,...) fc__attribute((__format__(__printf__
struct section_list * secfile_sections_by_name_prefix(const struct section_file *secfile, const char *prefix)
const struct entry_list * section_entries(const struct section *psection)
struct entry struct entry bool secfile_entry_delete(struct section_file *secfile, const char *path,...) fc__attribute((__format__(__printf__
struct section_file * secfile_load_section(const char *filename, const char *section, bool allow_duplicates)
bool entry_bool_set(struct entry *pentry, bool value)
struct section_file * secfile_from_stream(fz_FILE *stream, bool allow_duplicates)
struct entry * secfile_insert_filereference(struct section_file *secfile, const char *filename, const char *path,...) fc__attribute((__format__(__printf__
struct entry * secfile_insert_plain_enum_full(struct section_file *secfile, int enumerator, secfile_enum_name_fn_t name_fn, const char *comment, bool allow_replace, const char *path,...) fc__attribute((__format__(__printf__
int int * secfile_lookup_bitwise_enum_vec_full(const struct section_file *secfile, size_t *dim, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
bool entry_float_get(const struct entry *pentry, float *value)
bool entry_str_set_escaped(struct entry *pentry, bool escaped)
struct entry struct entry bool struct entry * secfile_entry_by_path(const struct section_file *secfile, const char *path)
size_t secfile_insert_bool_vec_full(struct section_file *secfile, const bool *values, size_t dim, const char *comment, bool allow_replace, const char *path,...) fc__attribute((__format__(__printf__
const char * entry_name(const struct entry *pentry)
const char const char const char ** secfile_lookup_str_vec(const struct section_file *secfile, size_t *dim, const char *path,...) fc__attribute((__format__(__printf__
struct entry * section_entry_float_new(struct section *psection, const char *entry_name, float value)
bool entry_str_get(const struct entry *pentry, const char **value)
bool entry_str_set_gt_marking(struct entry *pentry, bool gt_marking)
bool(* secfile_enum_is_valid_fn_t)(int enumerator)
void entry_destroy(struct entry *pentry)
int int secfile_lookup_bitwise_enum_default_full(const struct section_file *secfile, int defval, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
bool int int struct section * secfile_section_by_name(const struct section_file *secfile, const char *section_name)
void section_clear_all(struct section *psection)
bool entry_float_set(struct entry *pentry, float value)
struct entry * secfile_insert_enum_data_full(struct section_file *secfile, int value, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *comment, bool allow_replace, const char *path,...) fc__attribute((__format__(__printf__
bool secfile_lookup_enum_data(const struct section_file *secfile, int *pvalue, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
bool secfile_save(const struct section_file *secfile, const char *filename, int compression_level, enum fz_method compression_method)
struct section * secfile_insert_include(struct section_file *secfile, const char *filename)
bool entry_int_set(struct entry *pentry, int value)
entry_special_type
@ EST_COMMENT
@ EST_NORMAL
@ EST_INCLUDE
const char *(* secfile_enum_name_fn_t)(int enumerator)
const char * secfile_lookup_str(const struct section_file *secfile, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
struct section * secfile_section_lookup(const struct section_file *secfile, const char *path,...) fc__attribute((__format__(__printf__
bool bool secfile_lookup_bool_default(const struct section_file *secfile, bool def, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
bool secfile_lookup_bool(const struct section_file *secfile, bool *bval, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
struct entry * section_entry_str_new(struct section *psection, const char *entry_name, const char *value, bool escaped)
int secfile_lookup_plain_enum_default_full(const struct section_file *secfile, int defval, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
struct entry * secfile_insert_str_full(struct section_file *secfile, const char *str, const char *comment, bool allow_replace, bool no_escape, enum entry_special_type stype, const char *path,...) fc__attribute((__format__(__printf__
bool entry_int_get(const struct entry *pentry, int *value)
struct entry * secfile_insert_int_full(struct section_file *secfile, int value, const char *comment, bool allow_replace, const char *path,...) fc__attribute((__format__(__printf__
bool entry_set_name(struct entry *pentry, const char *entry_name)
size_t secfile_insert_str_vec_full(struct section_file *secfile, const char *const *strings, size_t dim, const char *comment, bool allow_replace, bool no_escape, const char *path,...) fc__attribute((__format__(__printf__
struct entry struct entry * section_entry_int_new(struct section *psection, const char *entry_name, int value)
const char * secfile_name(const struct section_file *secfile)
size_t secfile_insert_enum_vec_data_full(struct section_file *secfile, const int *values, size_t dim, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *comment, bool allow_replace, const char *path,...) fc__attribute((__format__(__printf__
const char * entry_comment(const struct entry *pentry)
const char const char const char bool secfile_lookup_plain_enum_full(const struct section_file *secfile, int *penumerator, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
bool bool bool bool int int secfile_lookup_int_def_min_max(const struct section_file *secfile, int defval, int minval, int maxval, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
struct entry * secfile_insert_float_full(struct section_file *secfile, float value, const char *comment, bool allow_replace, const char *path,...) fc__attribute((__format__(__printf__
struct entry * section_entry_by_name(const struct section *psection, const char *entry_name)
bool bool bool bool int secfile_lookup_int_default(const struct section_file *secfile, int def, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
bool secfile_section_prefix_present(const struct section_file *secfile, const char *prefix)
struct entry struct entry * secfile_insert_bitwise_enum_full(struct section_file *secfile, int bitwise_val, secfile_enum_name_fn_t name_fn, secfile_enum_iter_fn_t begin_fn, secfile_enum_iter_fn_t end_fn, secfile_enum_next_fn_t next_fn, const char *comment, bool allow_replace, const char *path,...) fc__attribute((__format__(__printf__
struct entry * section_entry_lookup(const struct section *psection, const char *path,...) fc__attribute((__format__(__printf__
struct section * secfile_section_new(struct section_file *secfile, const char *section_name)
bool entry_str_set(struct entry *pentry, const char *value)
bool bool bool bool int int int bool secfile_lookup_float(const struct section_file *secfile, float *fval, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
int(* secfile_enum_by_name_fn_t)(const char *enum_name, int(*strcmp_fn)(const char *, const char *))
struct entry * section_entry_bool_new(struct section *psection, const char *entry_name, bool value)
size_t secfile_insert_plain_enum_vec_full(struct section_file *secfile, const int *enumurators, size_t dim, secfile_enum_name_fn_t name_fn, const char *comment, bool allow_replace, const char *path,...) fc__attribute((__format__(__printf__
bool bool bool bool secfile_lookup_int(const struct section_file *secfile, int *ival, const char *path,...) fc__warn_unused_result fc__attribute((__format__(__printf__
bool section_set_name(struct section *psection, const char *section_name)
int(* secfile_enum_next_fn_t)(int enumerator)
struct section const struct section_list * secfile_sections(const struct section_file *secfile)
const void * secfile_data_t
enum entry_type entry_type_get(const struct entry *pentry)
struct section * psection
bool escaped
bool value
char * comment
bool allow_duplicates
struct section_file * secfile
#define fc__attribute(x)
Definition support.h:99
#define fc__warn_unused_result
Definition support.h:109
#define bool
Definition support.h:71