-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.h
53 lines (36 loc) · 1.03 KB
/
settings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright © 2016 Victor Hermann "vitorhnn" Chiletto
// Licensed under the MIT/Expat license.
#ifndef SETTINGS_H
#define SETTINGS_H
#include <stdbool.h>
typedef enum {
SETTING_BOOL,
SETTING_FLOAT,
SETTING_INT,
SETTING_STR
} setting_type;
typedef struct setting {
char *name;
union {
char strval[32];
float floatval;
int intval;
bool boolval;
} value;
setting_type type;
bool initialized;
struct setting *next;
} setting;
void setting_register(setting *setting);
setting *setting_find(char *setting_name);
void setting_set(char *setting_name, char *value);
void setting_set_float(char *setting_name, float value);
void setting_set_bool(char *setting_name, bool value);
char *setting_strvalue(char *setting_name);
float setting_floatvalue(char *setting_name);
int setting_intvalue(char *setting_name);
bool setting_boolvalue(char *setting_name);
void settings_quit(void);
void settings_parse_argv(int argc, char **argv);
#endif
// vim: set ts=4 sw=4 expandtab: