]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - include/jsonwrt.h
2 * No copyright is claimed. This code is in the public domain; do with
5 #ifndef UTIL_LINUX_JSONWRT_H
6 #define UTIL_LINUX_JSONWRT_H
18 unsigned int after_close
:1;
21 void ul_jsonwrt_init(struct ul_jsonwrt
*fmt
, FILE *out
, int indent
);
22 int ul_jsonwrt_is_ready(struct ul_jsonwrt
*fmt
);
23 void ul_jsonwrt_indent(struct ul_jsonwrt
*fmt
);
24 void ul_jsonwrt_open(struct ul_jsonwrt
*fmt
, const char *name
, int type
);
25 void ul_jsonwrt_close(struct ul_jsonwrt
*fmt
, int type
);
27 #define ul_jsonwrt_root_open(_f) ul_jsonwrt_open(_f, NULL, UL_JSON_OBJECT)
28 #define ul_jsonwrt_root_close(_f) ul_jsonwrt_close(_f, UL_JSON_OBJECT)
30 #define ul_jsonwrt_array_open(_f, _n) ul_jsonwrt_open(_f, _n, UL_JSON_ARRAY)
31 #define ul_jsonwrt_array_close(_f) ul_jsonwrt_close(_f, UL_JSON_ARRAY)
33 #define ul_jsonwrt_object_open(_f, _n) ul_jsonwrt_open(_f, _n, UL_JSON_OBJECT)
34 #define ul_jsonwrt_object_close(_f) ul_jsonwrt_close(_f, UL_JSON_OBJECT)
36 #define ul_jsonwrt_value_open(_f, _n) ul_jsonwrt_open(_f, _n, UL_JSON_VALUE)
37 #define ul_jsonwrt_value_close(_f) ul_jsonwrt_close(_f, UL_JSON_VALUE)
40 void ul_jsonwrt_value_raw(struct ul_jsonwrt
*fmt
,
41 const char *name
, const char *data
);
42 void ul_jsonwrt_value_s(struct ul_jsonwrt
*fmt
,
43 const char *name
, const char *data
);
44 void ul_jsonwrt_value_u64(struct ul_jsonwrt
*fmt
,
45 const char *name
, uint64_t data
);
46 void ul_jsonwrt_value_boolean(struct ul_jsonwrt
*fmt
,
47 const char *name
, int data
);
48 void ul_jsonwrt_value_null(struct ul_jsonwrt
*fmt
,
51 #endif /* UTIL_LINUX_JSONWRT_H */