9 #include "../DynaList.h" 10 #include "../DynaHashMap.h" 11 #include "../IntWrapper.h" 12 #include "../TimeUtils.h" 14 #define MAKE_LOCAL_REF_NODE Node(NodeType::UNTYPED, false) 15 #define NODE_GET_INIT Node _presult = Node(NodeType::UNTYPED, false) 16 #define NODE_GET_STR(N,K,V) if (Node::present(N, K, _presult)) { V = _presult(); } 17 #define NODE_GET_SEQ(N,K,V) if (Node::present(N, K, _presult)) { V = _presult(); } 18 #define NODE_GET_PROPER(N,K,V) if (Node::present(N, K, _presult)) { V = _presult(); } 19 #define NODE_GET_INT(N,K,V) if (Node::present(N, K, _presult)) { V = _presult.asInt(); } 20 #define NODE_GET_FLOAT(N,K,V) if (Node::present(N, K, _presult)) { V = _presult.asFloat(); } 21 #define NODE_GET_BOOL(N,K,V) if (Node::present(N, K, _presult)) { V = _presult.asBool(); } 22 #define NODE_GET_TIME(N,K,V) if (Node::present(N, K, _presult)) { V = _presult.asTime(); } 23 #define NODE_GET_TS(N,K,V) if (Node::present(N, K, _presult)) { V = _presult.asTimestamp(); } 24 #define NODE_GET_DATE(N,K,V) if (Node::present(N, K, _presult)) { V = _presult.asDate(); } 25 #define NODE_GET_LIST(N,K,V) if (Node::present(N, K, _presult)) { V = _presult.asList(); } 26 #define NODE_GET_MAP(N,K,V) if (Node::present(N, K, _presult)) { V = _presult.asMap(); } 55 void _ensureNodeType(
NodeType nodeType);
57 Node* _addToMap(
const String& key,
Node* node,
bool append =
true);
58 void _setNode(
const Node& other);
62 static bool present(
const Node& node,
const String& fldName,
Node& result);
63 static int getListLeadingScalarCount(
const Node& node);
67 Node(
const char*
value,
bool ownsData =
true);
72 Node(
int value,
bool ownsData =
true);
73 Node(
long long value,
bool ownsData =
true);
77 Node* copy()
override;
78 void setOwnsData(
bool ownsData);
86 NodeList& list()
const;
88 Node* listElem(
int index,
bool throwInvalid =
false)
const;
89 Node* mapElem(
const String& key,
bool throwInvalid =
false)
const;
91 Node* operator()(
int index);
92 const Node* operator()(
int index)
const;
94 const Node* operator()(
const String& key)
const;
95 const String operator()()
const;
97 Node& operator[](
int index);
98 const Node& operator[](
int index)
const;
100 const Node& operator[](
const String& key)
const;
102 Node& operator=(
const char* value);
104 Node& operator=(nullptr_t value);
105 Node& operator=(
bool value);
106 Node& operator=(
char value);
107 Node& operator=(
int value);
108 Node& operator=(
long long value);
109 Node& operator=(
float value);
110 Node& operator=(
long double value);
128 static Node* newUntypedNode();
130 const bool isUntyped()
const;
131 const bool isScalar()
const;
132 const bool isList()
const;
133 const bool isMap()
const;
134 const bool isBool()
const;
135 const bool isString()
const;
136 const bool isSeq()
const;
137 const bool isProper()
const;
138 const bool isInt()
const;
139 const bool isFloat()
const;
140 const bool isTime()
const;
141 const bool isTimestamp()
const;
142 const bool isDate()
const;
144 const String asString()
const;
145 const bool asBool()
const;
146 const long long asInt()
const;
147 const long double asFloat()
const;
148 const String asNullPtr()
const;
154 void setUntypedNode();
155 void setNode(
const Node& other);
156 void setScalar(
const char* value,
ScalarType strType = ScalarType::STRING);
157 void setScalar(
bool value);
158 void setScalar(
long long value);
159 void setScalar(
long double value);
165 Node* addUntypedNode();
167 Node* addUntypedNode(
const String& key,
bool append =
true);
170 Node* addScalar(
const char* value,
ScalarType strType = ScalarType::STRING);
171 Node* addScalar(
bool value);
172 Node* addScalar(
long long value);
173 Node* addScalar(
long double value);
180 Node* addScalar(
const String& key,
bool value);
181 Node* addScalar(
const String& key,
long long value);
182 Node* addScalar(
const String& key,
long double value);
CONSTCD11 bool operator==(const day &x, const day &y) NOEXCEPT
Definition: date.h:1274
Definition: IHashable.h:10
NodeList * listValue
Definition: Node.h:43
GeneratorWrapper< T > value(T &&value)
Definition: catch.hpp:4005
NodeType
Definition: Node.h:34
std::chrono::time_point< Clock, Duration > time_point
Definition: tz.h:2265
ScalarType
Definition: Node.h:35
system_clock::time_point * timeValue
Definition: Node.h:42
auto operator+=(std::string &lhs, StringRef const &sr) -> std::string &
MAKE_MAPTYPE_DEF(String, Node, Node)
bool boolValue
Definition: Node.h:38
Definition: TimeUtils.h:14
long double floatValue
Definition: Node.h:40
long long intValue
Definition: Node.h:39
NodeMap * mapValue
Definition: Node.h:44
MAKE_LISTTYPE_DEF(String, String)
int hashCode(bool key)
Definition: HashCoder.cpp:27
Definition: ICopyable.h:8
GeneratorWrapper< T > map(Func &&function, GeneratorWrapper< U > &&generator)
Definition: catch.hpp:4282
Definition: TimeUtils.h:9