ECSTASY
All in the name
Loading...
Searching...
No Matches
ANode.hpp
Go to the documentation of this file.
1
11
12#ifndef UTIL_SERIALIZATION_ANODE_HPP_
13#define UTIL_SERIALIZATION_ANODE_HPP_
14
15#include "INode.hpp"
16
17namespace util::serialization
18{
25 class ANode : public INode {
26 public:
28 virtual ~ANode() = default;
29
31 [[nodiscard]] bool isType(Type type) const noexcept override final;
32
34 [[nodiscard]] bool isNull() const noexcept override final;
35
37 [[nodiscard]] bool isObject() const noexcept override final;
38
40 [[nodiscard]] bool isArray() const noexcept override final;
41
43 [[nodiscard]] bool isString() const noexcept override final;
44
46 [[nodiscard]] bool isInteger() const noexcept override final;
47
49 [[nodiscard]] bool isFloat() const noexcept override final;
50
52 [[nodiscard]] bool isBoolean() const noexcept override final;
53
55 [[nodiscard]] bool isDate() const noexcept override final;
56
58 [[nodiscard]] bool isTime() const noexcept override final;
59
61 [[nodiscard]] bool isDateTime() const noexcept override final;
62
64 [[nodiscard]] const IObjectNode &asObject() const override final;
65
67 [[nodiscard]] IObjectNode &asObject() override final;
68
70 [[nodiscard]] std::optional<std::reference_wrapper<const IObjectNode>>
71 tryAsObject() const noexcept override final;
72
74 [[nodiscard]] std::optional<std::reference_wrapper<IObjectNode>> tryAsObject() noexcept override final;
75
77 [[nodiscard]] const IArrayNode &asArray() const override final;
78
80 [[nodiscard]] IArrayNode &asArray() override final;
81
83 [[nodiscard]] std::optional<std::reference_wrapper<const IArrayNode>>
84 tryAsArray() const noexcept override final;
85
87 [[nodiscard]] std::optional<std::reference_wrapper<IArrayNode>> tryAsArray() noexcept override final;
88
90 [[nodiscard]] std::string_view asString() const override final;
91
93 [[nodiscard]] int64_t asInteger() const override final;
94
96 [[nodiscard]] double asFloat() const override final;
97
99 [[nodiscard]] bool asBoolean() const override final;
100
102 [[nodiscard]] Date asDate() const override final;
103
105 [[nodiscard]] Time asTime() const override final;
106
108 [[nodiscard]] DateTime asDateTime() const override final;
109 };
110} // namespace util::serialization
111
112#endif /* !UTIL_SERIALIZATION_ANODE_HPP_ */
Serialization node interface.
Serialization node.
Definition ANode.hpp:25
int64_t asInteger() const override final
Get the integer node value.
Definition ANode.cpp:130
virtual ~ANode()=default
Default destructor.
bool isNull() const noexcept override final
Check if the node type is Type::Null.
Definition ANode.cpp:23
Date asDate() const override final
Get the date node value.
Definition ANode.cpp:145
const IObjectNode & asObject() const override final
Get the object node value.
Definition ANode.cpp:73
bool isTime() const noexcept override final
Check if the node type is Type::Time.
Definition ANode.cpp:63
bool isBoolean() const noexcept override final
Check if the node type is Type::Boolean.
Definition ANode.cpp:53
bool isFloat() const noexcept override final
Check if the node type is Type::Float.
Definition ANode.cpp:48
bool asBoolean() const override final
Get the boolean node value.
Definition ANode.cpp:140
bool isDateTime() const noexcept override final
Check if the node type is Type::DateTime.
Definition ANode.cpp:68
std::optional< std::reference_wrapper< const IObjectNode > > tryAsObject() const noexcept override final
Try to get the node object value.
Definition ANode.cpp:85
bool isInteger() const noexcept override final
Check if the node type is Type::Integer.
Definition ANode.cpp:43
std::string_view asString() const override final
Get the string node value.
Definition ANode.cpp:125
const IArrayNode & asArray() const override final
Get the array node value.
Definition ANode.cpp:99
Time asTime() const override final
Get the time node value.
Definition ANode.cpp:150
DateTime asDateTime() const override final
Get the datetime node value.
Definition ANode.cpp:155
bool isObject() const noexcept override final
Check if the node type is Type::Object.
Definition ANode.cpp:28
bool isArray() const noexcept override final
Check if the node type is Type::Array.
Definition ANode.cpp:33
std::optional< std::reference_wrapper< const IArrayNode > > tryAsArray() const noexcept override final
Try to get the node array value.
Definition ANode.cpp:111
double asFloat() const override final
Get the float node value.
Definition ANode.cpp:135
bool isType(Type type) const noexcept override final
Check if the node type is type.
Definition ANode.cpp:18
bool isDate() const noexcept override final
Check if the node type is Type::Date.
Definition ANode.cpp:58
bool isString() const noexcept override final
Check if the node type is Type::String.
Definition ANode.cpp:38
Serialization node.
Definition INode.hpp:32
std::chrono::high_resolution_clock::time_point DateTime
Type::DateTime underlying type.
Definition INode.hpp:64
Type
Available node types.
Definition INode.hpp:42