squareball  0.2.0.53-dd5b
A general-purpose library for C99
sb-configparser.h
Go to the documentation of this file.
1 /*
2  * squareball: A general-purpose library for C99.
3  * Copyright (C) 2014-2018 Rafael G. Martins <rafael@rafaelmartins.eng.br>
4  *
5  * This program can be distributed under the terms of the BSD License.
6  * See the file LICENSE.
7  */
8 
9 #ifndef _SQUAREBALL_CONFIGPARSER_H
10 #define _SQUAREBALL_CONFIGPARSER_H
11 
12 #include <stdlib.h>
13 #include "sb-error.h"
14 #include "sb-slist.h"
15 #include "sb-trie.h"
16 
27 typedef struct _sb_config_t sb_config_t;
28 
39 sb_config_t* sb_config_parse(const char *src, size_t src_len,
40  const char *list_sections[], sb_error_t **err);
41 
49 char** sb_config_list_sections(sb_config_t *config);
50 
60 char** sb_config_list_keys(sb_config_t *config, const char *section);
61 
71 const char* sb_config_get(sb_config_t *config, const char *section,
72  const char *key);
73 
86 const char* sb_config_get_with_default(sb_config_t *config, const char *section,
87  const char *key, const char *default_);
88 
100 char** sb_config_get_list(sb_config_t *config, const char *section);
101 
107 void sb_config_free(sb_config_t *config);
108 
111 #endif /* _SQUAREBALL_CONFIGPARSER_H */
sb_config_t * sb_config_parse(const char *src, size_t src_len, const char *list_sections[], sb_error_t **err)
Singly-linked list implementation.
char ** sb_config_list_keys(sb_config_t *config, const char *section)
char ** sb_config_list_sections(sb_config_t *config)
char ** sb_config_get_list(sb_config_t *config, const char *section)
Implementation of a trie data structure.
Error reporting infrastructure.
const char * sb_config_get_with_default(sb_config_t *config, const char *section, const char *key, const char *default_)
void sb_config_free(sb_config_t *config)
const char * sb_config_get(sb_config_t *config, const char *section, const char *key)
struct _sb_config_t sb_config_t
Definition: sb-configparser.h:27
struct _sb_error_t sb_error_t
Definition: sb-error.h:71