MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / JSONValue

Class JSONValue

LibLemon/include/lemon/core/json.h:14–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12 using JSONKey = std::string;
13
14 struct JSONValue{
15 enum {
16 TypeString,
17 TypeArray,
18 TypeObject,
19 TypeNumber,
20 TypeBoolean,
21 TypeNull,
22 };
23
24 int type;
25 bool isFloatingPoint = false;
26 bool isSigned = true;
27
28 union{
29 std::string* str = nullptr;
30 std::vector<JSONValue>* array;
31 std::map<JSONKey, JSONValue>* object;
32 unsigned long uLong;
33 long sLong;
34 float fl;
35 double dbl;
36 bool boolean;
37 };
38
39 JSONValue(){
40 type = TypeNull;
41 }
42
43 JSONValue(const std::string& s){
44 type = TypeString;
45
46 str = new std::string(s);
47 }
48
49 JSONValue(std::string&& s){
50 type = TypeString;
51
52 str = new std::string(s);
53 }
54
55 JSONValue(const std::vector<JSONValue>& v){
56 type = TypeArray;
57
58 array = new std::vector<JSONValue>(v);
59 }
60
61 JSONValue(std::vector<JSONValue>&& v){
62 type = TypeArray;
63
64 array = new std::vector<JSONValue>(v);
65 }
66
67 JSONValue(const std::map<JSONKey, JSONValue>& o){
68 type = TypeObject;
69
70 object = new std::map<JSONKey, JSONValue>(o);
71 }

Callers 4

ParseMethod · 0.85
ParseValueMethod · 0.85
ParseObjectMethod · 0.85
ParseArrayMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected