You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
618 B
31 lines
618 B
2 years ago
|
#pragma once
|
||
|
|
||
|
class JSONNode {
|
||
|
public:
|
||
|
JSONObject obj();
|
||
|
JSONList lst();
|
||
|
string str();
|
||
|
int nbr();
|
||
|
|
||
|
private:
|
||
|
enum Type { OBJECT, LIST, STRING, NUMBER, BOOLEAN, NULL_TYPE };
|
||
|
union Values {
|
||
|
JSONObject *object;
|
||
|
JSONList *list;
|
||
|
string *str;
|
||
|
int nbr;
|
||
|
bool bValue;
|
||
|
} values;
|
||
|
Type type;
|
||
|
|
||
|
void setObject(JSONObject *object);
|
||
|
void setList(JSONList *list);
|
||
|
void setString(string *str);
|
||
|
void setNumber(int nbr);
|
||
|
void setBoolean(bool v);
|
||
|
void setNull();
|
||
|
|
||
|
string stringify(int indentationLevel);
|
||
|
friend class JSONParser;
|
||
|
};
|