EHS
Loading...
Searching...
No Matches
JsonVar.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/EHS.h"
4#include "ehs/Str.h"
5
6namespace ehs
7{
8 class JsonBase;
9 class JsonObj;
10 class JsonArray;
11 class JsonBool;
12 class JsonNum;
13 class JsonStr;
14
15 class EHS_LIB_IO JsonVar final
16 {
17 private:
18 UInt_64 hashId;
19 Str_8 id;
20 JsonBase* value;
21
22 public:
23 ~JsonVar();
24
25 JsonVar();
26
27 JsonVar(Str_8 id);
28
29 JsonVar(Str_8 id, const JsonBase *value);
30
31 JsonVar(Str_8 id, const JsonBase &value);
32
33 JsonVar(Str_8 id, const JsonObj &value);
34
35 JsonVar(Str_8 id, const JsonArray &value);
36
37 JsonVar(Str_8 id, const JsonBool &value);
38
39 JsonVar(Str_8 id, bool boolean);
40
41 JsonVar(Str_8 id, const JsonNum &value);
42
43 JsonVar(Str_8 id, SInt_64 num);
44
45 JsonVar(Str_8 id, UInt_64 num);
46
47 JsonVar(Str_8 id, SInt_32 num);
48
49 JsonVar(Str_8 id, UInt_32 num);
50
51 JsonVar(Str_8 id, SInt_16 num);
52
53 JsonVar(Str_8 id, UInt_16 num);
54
55 JsonVar(Str_8 id, SInt_8 num);
56
57 JsonVar(Str_8 id, UInt_8 num);
58
59 JsonVar(Str_8 id, double num);
60
61 JsonVar(Str_8 id, float num);
62
63 JsonVar(Str_8 id, const JsonStr &value);
64
65 JsonVar(Str_8 id, const Char_8 *str, UInt_64 size = 0);
66
67 JsonVar(Str_8 id, Str_8 str);
68
69 JsonVar(JsonVar&& var) noexcept;
70
71 JsonVar(const JsonVar& var);
72
73 JsonVar& operator=(JsonVar&& var) noexcept;
74
75 JsonVar& operator=(const JsonVar& var);
76
77 UInt_64 GetHashId() const;
78
79 Str_8 GetId() const;
80
81 void SetValue(const JsonBase *newValue);
82
83 void SetValue(const JsonBase &newValue);
84
85 void SetValue(const JsonObj &newValue);
86
87 void SetValue(const JsonArray &newValue);
88
89 void SetValue(const JsonBool &newValue);
90
91 void SetValue(bool newValue);
92
93 void SetValue(const JsonNum& newValue);
94
95 void SetValue(float newValue);
96
97 void SetValue(const JsonStr& newValue);
98
99 void SetValue(const Char_8* newValue, UInt_64 size = 0);
100
101 void SetValue(const Str_8& newValue);
102
103 const JsonBase* GetValue() const;
104
106
107 Str_8 ToStr(UInt_64 level, bool compact) const;
108 };
109}
Definition JsonArray.h:15
Definition JsonBase.h:19
Definition JsonBool.h:11
Definition JsonNum.h:11
Definition JsonObj.h:13
Definition JsonStr.h:11
void SetValue(const JsonBase *newValue)
Definition JsonVar.cpp:247
UInt_64 GetHashId() const
Definition JsonVar.cpp:237
Str_8 GetId() const
Definition JsonVar.cpp:242
JsonVar & operator=(JsonVar &&var) noexcept
Definition JsonVar.cpp:183
Str_8 ToStr(UInt_64 level, bool compact) const
Definition JsonVar.cpp:347
const JsonBase * GetValue() const
Definition JsonVar.cpp:337
JsonVar()
Definition JsonVar.cpp:16
Definition Anchor.h:6
signed int SInt_32
Definition Types.h:50
unsigned int UInt_32
Definition Types.h:49
char Char_8
Definition Types.h:40
unsigned char UInt_8
Definition Types.h:43
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1953
signed char SInt_8
Definition Types.h:44
unsigned short UInt_16
Definition Types.h:46
signed short SInt_16
Definition Types.h:47