ECSTASY
All in the name
Loading...
Searching...
No Matches
TomlArrayNode.hpp
Go to the documentation of this file.
1
11
12#ifndef UTIL_SERIALIZATION_TOML_TOMLARRAYNODE_HPP_
13#define UTIL_SERIALIZATION_TOML_TOMLARRAYNODE_HPP_
14
15#include "TomlNode.hpp"
17
18namespace util::serialization
19{
26 class TomlArrayNode : public TomlNode<toml::array>, public IArrayNode {
27 public:
29 TomlArrayNode() = default;
30
39 TomlArrayNode(const toml::array &array);
40
42 [[nodiscard]] NodeCView get(Index index) const override final;
43
45 [[nodiscard]] NodeView get(Index index) override final;
46
48 [[nodiscard]] NodeCView tryGet(Index index) const noexcept override final;
49
51 [[nodiscard]] NodeView tryGet(Index index) noexcept override final;
52
54 void pushBack(const INode &node) override final;
55
57 void insert(Index index, const INode &node) override final;
58
60 void replace(Index index, const INode &node) override final;
61
63 void popBack() override final;
64
66 void erase(Index index) override final;
67
69 void clear() noexcept override final;
70
72 bool empty() const noexcept override final;
73
75 [[nodiscard]] size_t size() const noexcept override final;
76
78 [[nodiscard]] const_iterator cbegin() const noexcept override final;
79
81 [[nodiscard]] const_iterator begin() const noexcept override final;
82
84 [[nodiscard]] iterator begin() noexcept override final;
85
87 [[nodiscard]] const_iterator cend() const noexcept override final;
88
90 [[nodiscard]] const_iterator end() const noexcept override final;
91
93 [[nodiscard]] iterator end() noexcept override final;
94
95 private:
97 std::vector<NodePtr> _nodes;
98 };
99} // namespace util::serialization
100
101#endif /* !UTIL_SERIALIZATION_TOML_TOMLARRAYNODE_HPP_ */
Array node interface.
Toml node implementation.
size_t Index
Array index type.
Serialization node.
Definition INode.hpp:32
Polymorphism iterator for value T.
void popBack() override final
Delete the last array node.
NodeCView tryGet(Index index) const noexcept override final
Get the node at index.
NodeCView get(Index index) const override final
Get the node at index if existing.
const_iterator begin() const noexcept override final
Get the start iterator of the internal nodes.
const_iterator end() const noexcept override final
Get the end iterator of the internal nodes.
const_iterator cend() const noexcept override final
Get the end iterator of the internal nodes.
void erase(Index index) override final
Delete the node at index.
void replace(Index index, const INode &node) override final
Replace a node at the given index.
void clear() noexcept override final
Remove all the internal nodes.
void pushBack(const INode &node) override final
Push a new node at the end of the array.
std::vector< NodePtr > _nodes
Array nodes.
bool empty() const noexcept override final
Check if the object is empty.
TomlArrayNode()=default
Default constructor.
void insert(Index index, const INode &node) override final
Insert a node at the given index.
size_t size() const noexcept override final
Get the number of node in this.
const_iterator cbegin() const noexcept override final
Get the start iterator of the internal nodes.
Serialization node.
Definition TomlNode.hpp:29