ECSTASY
All in the name
Loading...
Searching...
No Matches
IObjectNode.hpp
Go to the documentation of this file.
1
11
12#ifndef UTIL_SERIALIZATION_IOBJECTNODE_HPP_
13#define UTIL_SERIALIZATION_IOBJECTNODE_HPP_
14
15#include "INode.hpp"
17
18namespace util::serialization
19{
27 protected:
36 template <bool isConst>
39
40 public:
45
47 virtual ~IObjectNode() = default;
48
61 [[nodiscard]] virtual NodeCView get(std::string_view key) const = 0;
62
75 [[nodiscard]] virtual NodeView get(std::string_view key) = 0;
76
87 [[nodiscard]] virtual NodeCView tryGet(std::string_view key) const noexcept = 0;
88
99 [[nodiscard]] virtual NodeView tryGet(std::string_view key) noexcept = 0;
100
114 virtual bool insert(std::string_view key, const INode &value) = 0;
115
127 virtual bool insertOrAssign(std::string_view key, const INode &value) = 0;
128
137 virtual void erase(std::string_view key) = 0;
138
145 virtual void clear() = 0;
146
155 [[nodiscard]] virtual bool empty() const noexcept = 0;
156
165 [[nodiscard]] virtual size_t size() const noexcept = 0;
166
177 [[nodiscard]] virtual bool contains(std::string_view key) const noexcept = 0;
178
187 [[nodiscard]] virtual const_iterator cbegin() const noexcept = 0;
188
190 [[nodiscard]] virtual const_iterator begin() const noexcept = 0;
191
200 [[nodiscard]] virtual iterator begin() noexcept = 0;
201
212 [[nodiscard]] virtual const_iterator cend() const noexcept = 0;
213
215 [[nodiscard]] virtual const_iterator end() const noexcept = 0;
216
227 [[nodiscard]] virtual iterator end() noexcept = 0;
228 };
229} // namespace util::serialization
230#endif /* !UTIL_SERIALIZATION_IOBJECTNODE_HPP_ */
Serialization node interface.
Polymorphic iterator for value T.
Serialization node.
Definition INode.hpp:32
virtual const_iterator begin() const noexcept=0
Get the start iterator of the internal nodes.
virtual ~IObjectNode()=default
Default destructor.
virtual const_iterator cbegin() const noexcept=0
Get the start iterator of the internal nodes.
virtual void erase(std::string_view key)=0
Erase the node identified by key.
virtual bool contains(std::string_view key) const noexcept=0
Check if key match a node.
virtual bool insertOrAssign(std::string_view key, const INode &value)=0
Try to insert a new node at key or replace the existing one.
virtual bool insert(std::string_view key, const INode &value)=0
Try to insert a new node at key.
virtual size_t size() const noexcept=0
Get the number of node in this.
virtual NodeCView get(std::string_view key) const =0
Get the node matching key if existing.
virtual void clear()=0
Remove all the internal nodes.
virtual bool empty() const noexcept=0
Check if the object is empty.
virtual NodeCView tryGet(std::string_view key) const noexcept=0
Get the node matching key.
virtual NodeView get(std::string_view key)=0
Get the node matching key if existing.
virtual const_iterator cend() const noexcept=0
Get the end iterator of the internal nodes.
virtual NodeView tryGet(std::string_view key) noexcept=0
Get the node matching key.
virtual const_iterator end() const noexcept=0
Get the end iterator of the internal nodes.
Polymorphism iterator for value T.