-
Notifications
You must be signed in to change notification settings - Fork 0
/
json_writer.h
66 lines (35 loc) · 915 Bytes
/
json_writer.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
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef _JSON_WRITER_H_
#define _JSON_WRITER_H_
#include <stdio.h>
#define JSON_WRITER_MAX_DEPTH 10
struct json_writer {
FILE *f;
int depth;
int index[JSON_WRITER_MAX_DEPTH];
int in_array[JSON_WRITER_MAX_DEPTH];
};
void
json_writer_init(struct json_writer *ctx, FILE *f);
void
json_writer_finalize(struct json_writer *ctx);
void
json_writer_open(struct json_writer *ctx);
void
json_writer_close(struct json_writer *ctx);
void
json_writer_indent(struct json_writer *ctx);
void
json_writer_key(struct json_writer *ctx, char *key);
void
json_writer_d(struct json_writer *ctx, int value);
void
json_writer_s(struct json_writer *ctx, char *value);
void
json_writer_f(struct json_writer *ctx, float value);
void
json_writer_lf(struct json_writer *ctx, double value);
void
json_writer_array_start(struct json_writer *ctx);
void
json_writer_array_end(struct json_writer *ctx);
#endif