ECSTASY
All in the name
Loading...
Searching...
No Matches
IArrayNode.hpp
Go to the documentation of this file.
1
11
12#ifndef UTIL_SERIALIZATION_IARRAYNODE_HPP_
13#define UTIL_SERIALIZATION_IARRAYNODE_HPP_
14
15#include <memory>
16#include "INode.hpp"
18
19namespace util::serialization
20{
27 class IArrayNode {
28 protected:
37 template <bool isConst>
39
40 public:
42 using Index = size_t;
47
49 virtual ~IArrayNode() = default;
50
63 [[nodiscard]] virtual NodeCView get(Index index) const = 0;
64
77 [[nodiscard]] virtual NodeView get(Index index) = 0;
78
89 [[nodiscard]] virtual NodeCView tryGet(Index index) const noexcept = 0;
90
101 [[nodiscard]] virtual NodeView tryGet(Index index) noexcept = 0;
102
111 virtual void pushBack(const INode &node) = 0;
112
126 virtual void insert(Index index, const INode &node) = 0;
127
141 virtual void replace(Index index, const INode &node) = 0;
142
151 virtual void popBack() = 0;
152
161 virtual void erase(Index index) = 0;
162
169 virtual void clear() = 0;
170
179 [[nodiscard]] virtual bool empty() const noexcept = 0;
180
189 [[nodiscard]] virtual size_t size() const noexcept = 0;
190
199 [[nodiscard]] virtual const_iterator cbegin() const noexcept = 0;
200
202 [[nodiscard]] virtual const_iterator begin() const noexcept = 0;
203
212 [[nodiscard]] virtual iterator begin() noexcept = 0;
213
224 [[nodiscard]] virtual const_iterator cend() const noexcept = 0;
225
227 [[nodiscard]] virtual const_iterator end() const noexcept = 0;
228
239 [[nodiscard]] virtual iterator end() noexcept = 0;
240 };
241} // namespace util::serialization
242
243#endif /* !UTIL_SERIALIZATION_IARRAYNODE_HPP_ */
Serialization node interface.
Polymorphic iterator for value T.
virtual NodeView tryGet(Index index) noexcept=0
Get the node at index.
virtual const_iterator cend() const noexcept=0
Get the end iterator of the internal nodes.
virtual const_iterator cbegin() const noexcept=0
Get the start iterator of the internal nodes.
size_t Index
Array index type.
virtual const_iterator begin() const noexcept=0
Get the start iterator of the internal nodes.
virtual NodeCView tryGet(Index index) const noexcept=0
Get the node at index.
virtual NodeView get(Index index)=0
Get the node at index if existing.
virtual ~IArrayNode()=default
Default destructor.
virtual void replace(Index index, const INode &node)=0
Replace a node at the given index.
virtual NodeCView get(Index index) const =0
Get the node at index if existing.
virtual size_t size() const noexcept=0
Get the number of node in this.
virtual void erase(Index index)=0
Delete the node at index.
virtual const_iterator end() const noexcept=0
Get the end iterator of the internal nodes.
virtual void popBack()=0
Delete the last array node.
virtual void pushBack(const INode &node)=0
Push a new node at the end of the array.
virtual void insert(Index index, const INode &node)=0
Insert a node at the given index.
virtual void clear()=0
Remove all the internal nodes.
virtual bool empty() const noexcept=0
Check if the object is empty.
Serialization node.
Definition INode.hpp:32
Polymorphism iterator for value T.