-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjson_conf.h
More file actions
38 lines (29 loc) · 948 Bytes
/
json_conf.h
File metadata and controls
38 lines (29 loc) · 948 Bytes
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
#ifndef JSON_CONF_H
#define JSON_CONF_H
/**
\file gen_conf.h
\brief Generic json configure file processing.
*/
/** \cond 0 */
#include "cJSON.h"
/** \endcond */
#define MAX_LOAD_DEPTH 16
#define LOAD_KEYWORD "load_json"
cJSON *conf_load(const char *filename);
/**
\fn int conf_delete(cJSON *)
\brief Destroy the internal global configure struct.
*/
int conf_delete(cJSON *);
cJSON *conf_get(const char *, cJSON *);
int *conf_get_int(const char *, cJSON *);
double *conf_get_double(const char *, cJSON *);
char *conf_get_str(const char *, cJSON *);
const int *conf_get_bool(const char *, cJSON *);
/*
#define conf_get_int(NAME, JSON) cJSON_GetObjectItem(JSON, NAME)->valueint
#define conf_get_double(NAME, JSON) cJSON_GetObjectItem(JSON, NAME)->valuedouble
#define conf_get_str(NAME, JSON) cJSON_GetObjectItem(JSON, NAME)->valuestring
#define conf_get_bool(NAME, JSON) (cJSON_GetObjectItem(JSON, NAME)->type==cJSON_True)
*/
#endif