-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathtoml.h
44 lines (36 loc) · 996 Bytes
/
toml.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
#ifndef TOML_H
#define TOML_H
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
enum toml_type {
TOML_ROOT = 1,
TOML_TABLE,
TOML_LIST,
TOML_INT,
TOML_FLOAT,
TOML_STRING,
TOML_DATE,
TOML_BOOLEAN,
TOML_TABLE_ARRAY,
TOML_INLINE_TABLE,
TOML_MAX
};
struct toml_node;
typedef void (*toml_node_walker)(struct toml_node*, void*);
int toml_init(struct toml_node**);
int toml_parse(struct toml_node*, char*, int);
struct toml_node* toml_get(struct toml_node*, char*);
void toml_dump(struct toml_node*, FILE*);
void toml_tojson(struct toml_node*, FILE*);
void toml_free(struct toml_node*);
void toml_walk(struct toml_node*, toml_node_walker, void*);
void toml_dive(struct toml_node*, toml_node_walker, void*);
enum toml_type toml_type(struct toml_node*);
char* toml_name(struct toml_node*); /* caller should free return value */
char* toml_value_as_string(struct toml_node*); /* caller should free return value */
#ifdef __cplusplus
}; // extern "C"
#endif
#endif /* TOML_H */