ECSTASY
All in the name
Loading...
Searching...
No Matches
util::serialization::IObjectNode Class Referenceabstract

Object node. More...

#include <IObjectNode.hpp>

Inheritance diagram for util::serialization::IObjectNode:

Public Types

using iterator = ObjectIterator< false >
 Object iterator type.
 
using const_iterator = ObjectIterator< true >
 Object const iterator type.
 

Public Member Functions

virtual ~IObjectNode ()=default
 Default destructor.
 
virtual NodeCView get (std::string_view key) const =0
 Get the node matching key if existing.
 
virtual NodeView get (std::string_view key)=0
 Get the node matching key if existing.
 
virtual NodeCView tryGet (std::string_view key) const noexcept=0
 Get the node matching key.
 
virtual NodeView tryGet (std::string_view key) noexcept=0
 Get the node matching key.
 
virtual bool insert (std::string_view key, const INode &value)=0
 Try to insert a new node at key.
 
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 void erase (std::string_view key)=0
 Erase the node identified by key.
 
virtual void clear ()=0
 Remove all the internal nodes.
 
virtual bool empty () const noexcept=0
 Check if the object is empty.
 
virtual size_t size () const noexcept=0
 Get the number of node in this.
 
virtual bool contains (std::string_view key) const noexcept=0
 Check if key match a node.
 
virtual const_iterator cbegin () const noexcept=0
 Get the start iterator of the internal nodes.
 
virtual const_iterator begin () const noexcept=0
 Get the start iterator of the internal nodes.
 
virtual iterator begin () noexcept=0
 Get the start iterator of the internal nodes.
 
virtual const_iterator cend () const noexcept=0
 Get the end iterator of the internal nodes.
 
virtual const_iterator end () const noexcept=0
 Get the end iterator of the internal nodes.
 
virtual iterator end () noexcept=0
 Get the end iterator of the internal nodes.
 

Protected Types

template<bool isConst>
using ObjectIterator = PolymorphicIterator< std::pair< std::string, std::conditional_t< isConst, NodeCView, NodeView > > >
 Abstract Array Iterator.
 

Detailed Description

Object node.

Contains nodes identified by strings.

Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Definition at line 26 of file IObjectNode.hpp.

Member Typedef Documentation

◆ const_iterator

Object const iterator type.

Definition at line 44 of file IObjectNode.hpp.

◆ iterator

Object iterator type.

Definition at line 42 of file IObjectNode.hpp.

◆ ObjectIterator

Abstract Array Iterator.

Template Parameters
isConstWhether the iterator is a const iterator or not.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Definition at line 37 of file IObjectNode.hpp.

Constructor & Destructor Documentation

◆ ~IObjectNode()

virtual util::serialization::IObjectNode::~IObjectNode ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ begin() [1/2]

virtual const_iterator util::serialization::IObjectNode::begin ( ) const
pure virtualnoexcept

Get the start iterator of the internal nodes.

Returns
const_iterator Iterator to the first node.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ begin() [2/2]

virtual iterator util::serialization::IObjectNode::begin ( )
pure virtualnoexcept

Get the start iterator of the internal nodes.

Returns
iterator Iterator to the first node.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ cbegin()

virtual const_iterator util::serialization::IObjectNode::cbegin ( ) const
pure virtualnoexcept

Get the start iterator of the internal nodes.

Returns
const_iterator Iterator to the first node.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ cend()

virtual const_iterator util::serialization::IObjectNode::cend ( ) const
pure virtualnoexcept

Get the end iterator of the internal nodes.

Warning
This iterator is never valid.
Returns
const_iterator Iterator to the last node + 1.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ clear()

virtual void util::serialization::IObjectNode::clear ( )
pure virtual

Remove all the internal nodes.

Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ contains()

virtual bool util::serialization::IObjectNode::contains ( std::string_view  key) const
pure virtualnoexcept

Check if key match a node.

Parameters
[in]keyEvaluated key.
Returns
bool Whether there is a node associated to key.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ empty()

virtual bool util::serialization::IObjectNode::empty ( ) const
pure virtualnoexcept

Check if the object is empty.

Returns
bool True if this doesn't contains any node.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ end() [1/2]

virtual const_iterator util::serialization::IObjectNode::end ( ) const
pure virtualnoexcept

Get the end iterator of the internal nodes.

Warning
This iterator is never valid.
Returns
const_iterator Iterator to the last node + 1.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ end() [2/2]

virtual iterator util::serialization::IObjectNode::end ( )
pure virtualnoexcept

Get the end iterator of the internal nodes.

Warning
This iterator is never valid.
Returns
iterator Iterator to the last node + 1.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ erase()

virtual void util::serialization::IObjectNode::erase ( std::string_view  key)
pure virtual

Erase the node identified by key.

Parameters
[in]keyNode's key.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ get() [1/2]

virtual NodeCView util::serialization::IObjectNode::get ( std::string_view  key) const
pure virtual

Get the node matching key if existing.

Parameters
[in]keyThe node's key.
Returns
NodeCView A weak pointer to the requested node.
Exceptions
std::out_of_rangeIf the key doesn't exists.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ get() [2/2]

virtual NodeView util::serialization::IObjectNode::get ( std::string_view  key)
pure virtual

Get the node matching key if existing.

Parameters
[in]keyThe node's key.
Returns
NodeView A weak pointer to the requested node.
Exceptions
std::out_of_rangeIf the key doesn't exists.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ insert()

virtual bool util::serialization::IObjectNode::insert ( std::string_view  key,
const INode value 
)
pure virtual

Try to insert a new node at key.

Warning
If the key is already used, this method will fail. Use insertOrAssign() instead.
Parameters
[in]keyNew node key.
[in]valueNew node.
Returns
bool Whether the node was inserted or not.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ insertOrAssign()

virtual bool util::serialization::IObjectNode::insertOrAssign ( std::string_view  key,
const INode value 
)
pure virtual

Try to insert a new node at key or replace the existing one.

Parameters
[in]keyNew node key.
[in]valueNew node.
Returns
bool Whether the node was inserted. It is false if it was assigned.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ size()

virtual size_t util::serialization::IObjectNode::size ( ) const
pure virtualnoexcept

Get the number of node in this.

Returns
size_t Number of node contained in this.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ tryGet() [1/2]

virtual NodeCView util::serialization::IObjectNode::tryGet ( std::string_view  key) const
pure virtualnoexcept

Get the node matching key.

Parameters
[in]keyThe node's key.
Returns
NodeCView A weak pointer to the requested node if it exists.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.

◆ tryGet() [2/2]

virtual NodeView util::serialization::IObjectNode::tryGet ( std::string_view  key)
pure virtualnoexcept

Get the node matching key.

Parameters
[in]keyThe node's key.
Returns
NodeView A weak pointer to the requested node if it exists.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-12-08)

Implemented in util::serialization::TomlObjectNode.


The documentation for this class was generated from the following file: