EHS
Loading...
Searching...
No Matches
Json.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/EHS.h"
4#include "ehs/Str.h"
5#include "JsonBase.h"
6#include "JsonObj.h"
7#include "JsonArray.h"
8#include "JsonBool.h"
9#include "JsonNum.h"
10#include "JsonStr.h"
11#include "JsonVar.h"
12
13namespace ehs
14{
15 class EHS_LIB_IO Json final
16 {
17 private:
18 JsonBase *value;
19
20 public:
21 ~Json();
22
23 Json();
24
25 Json(const JsonBase &value);
26
27 Json(const JsonObj &value);
28
29 Json(const JsonArray &value);
30
31 Json(const JsonBool &value);
32
33 Json(const JsonNum &value);
34
35 Json(const JsonStr &value);
36
37 Json(const char *data, UInt_64 size, UInt_64 extra);
38
39 Json(const Str_8 &data, UInt_64 extra);
40
41 Json(Json &&json) noexcept;
42
43 Json(const Json &json);
44
45 Json &operator=(Json &&json) noexcept;
46
47 Json &operator=(const Json &json);
48
50
51 JsonBase *RetrieveValue(const Str_8 &access);
52
53 Str_8 ToStr(bool compact) const;
54
55 private:
56 static Vector<Str_8> ParseAccess(const Str_8 &access);
57
58 void ParseValue(JsonVar *var, const Char_8 **begin, const Char_8 *end, UInt_64 extra);
59
60 JsonVar ParseVar(const Char_8 **begin, const Char_8 *end, UInt_64 extra);
61
62 void ParseObject(JsonObj *obj, const Char_8 **begin, const Char_8 *end, UInt_64 extra);
63
64 void ParseArray(JsonArray *arr, const Char_8 **begin, const Char_8 *end, UInt_64 extra);
65
66 void Parse(const Str_8 &data, UInt_64 extra);
67 };
68}
Definition JsonArray.h:15
Definition JsonBase.h:19
Definition JsonBool.h:11
Definition JsonNum.h:11
Definition JsonObj.h:13
Definition JsonStr.h:11
Definition JsonVar.h:16
JsonBase * RetrieveValue(const Str_8 &access)
Definition Json.cpp:147
JsonBase * GetValue()
Definition Json.cpp:142
Str_8 ToStr(bool compact) const
Definition Json.cpp:187
Json()
Definition Json.cpp:11
Json & operator=(Json &&json) noexcept
Definition Json.cpp:93
Definition Vector.h:18
Definition Anchor.h:6
char Char_8
Definition Types.h:40
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1953