-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs0n.h
46 lines (34 loc) · 806 Bytes
/
js0n.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
#ifndef INCL_JS0N_H
#define INCL_JS0N_H
#include <vector>
namespace js0n {
typedef enum {
JST_null,
JST_boolean,
JST_number,
JST_string,
JST_array,
JST_object
} js_type;
typedef struct {
js_type type;
unsigned int depth;
unsigned int start;
unsigned int length;
} js_value;
static js_value invalid_js_value = {JST_null, 0, 0, 0};
typedef struct {
size_t count;
js_value* values;
size_t buffer_length;
const char* buffer;
} cached_object;
typedef std::vector<js_value> result_vector;
typedef struct {
result_vector results;
const char* buffer;
} js0n_buffer;
bool parse(const char *js, unsigned int len, result_vector& results);
js_value* find_key(const char* key, cached_object* cache);
}; // namespace js0n
#endif // INCL_JS0N_H