Webserv
Loading...
Searching...
No Matches
Nodes.hpp
Go to the documentation of this file.
1#pragma once
2#include "webserv.hpp"
3
4class JSONNode {
5 public:
8 string str();
9 int nbr();
10 bool boo();
11
12 private:
14 union Values {
17 string *str;
18 int nbr;
19 bool bValue;
22
23 void setObject(JSONObject *object);
24 void setList(JSONList *list);
25 void setString(string *str);
26 void setNumber(int nbr);
27 void setBoolean(bool v);
28 void setNull();
29
30 string stringify(int indentationLevel);
31 friend class JSONParser;
32};
@ LIST
Definition: Nodes.hpp:13
@ NUMBER
Definition: Nodes.hpp:13
@ STRING
Definition: Nodes.hpp:13
@ BOOLEAN
Definition: Nodes.hpp:13
@ NULL_TYPE
Definition: Nodes.hpp:13
@ OBJECT
Definition: Nodes.hpp:13
union JSONNode::Values values
void setObject(JSONObject *object)
Definition: Nodes.cpp:29
Type type
Definition: Nodes.hpp:21
int nbr()
Definition: Nodes.cpp:18
void setNumber(int nbr)
Definition: Nodes.cpp:41
JSONObject obj()
Definition: Nodes.cpp:3
void setNull()
Definition: Nodes.cpp:49
void setBoolean(bool v)
Definition: Nodes.cpp:45
string stringify(int indentationLevel)
Definition: Nodes.cpp:51
JSONList lst()
Definition: Nodes.cpp:8
string str()
Definition: Nodes.cpp:13
void setString(string *str)
Definition: Nodes.cpp:37
void setList(JSONList *list)
Definition: Nodes.cpp:33
bool boo()
Definition: Nodes.cpp:23
JSONList * list
Definition: Nodes.hpp:16
JSONObject * object
Definition: Nodes.hpp:15
string * str
Definition: Nodes.hpp:17
std::vector< JSONNode * > JSONList
Definition: webserv.hpp:49
std::map< string, JSONNode * > JSONObject
Definition: webserv.hpp:48