]> Pileus Git - lackey/blob - src/conf.h
Refactor main and add print mode
[lackey] / src / conf.h
1 /*
2  * Copyright (C) 2013 Andy Spencer <andy753421@gmail.com>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 /* Handlers */
19 typedef void (*parser_t)(const char *group, const char *name,
20                          const char *key, const char *value);
21
22 /* Getters */
23 int get_enum(const char *value, const char **map, int n);
24 int get_bool(const char *value);
25 int get_number(const char *value);
26 char *get_string(const char *value);
27 char *get_name(const char *name);
28
29 /* Setters */
30 void set_enum(const char *group, const char *name,
31                 const char *key, int value,
32                 const char **map, int n);
33 void set_bool(const char *group, const char *name,
34                 const char *key, int value);
35 void set_number(const char *group, const char *name,
36                 const char *key, int value);
37 void set_string(const char *group, const char *name,
38                 const char *key, const char *value);
39 void set_name(const char *group, const char *name,
40                 const char *value);
41
42 /* Functions */
43 void conf_setup(const char *name, parser_t parser);
44 void conf_start(void);
45 void conf_sync(void);