StormByte-Config 3.0.0
C++26 configuration-document module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Config::Item::Group Class Reference

Named container ({ ... }). More...

#include <StormByte/config/item/group.hxx>

Inheritance diagram for StormByte::Config::Item::Group:
Collaboration diagram for StormByte::Config::Item::Group:

Public Member Functions

 Group () noexcept
 Constructor.
 Group (std::string_view name)
 Constructor.
 Group (const Group &group)
 Copy constructor.
 Group (Group &&group) noexcept
 Move constructor.
Group & operator= (const Group &group)
 Assignment operator.
Group & operator= (Group &&group) noexcept
 Move assignment operator.
 ~Group () noexcept override
 Destructor.
PointerType Clone () const override
 Clone.
PointerType Move () override
 Move.
constexpr Item::ContainerType ContainerType () const noexcept override
 Container type.
constexpr Item::Type Type () const noexcept override
 Item type.
Public Member Functions inherited from StormByte::Config::Item::Container
 Container ()
 Constructs an empty Container.
 Container (const StormByte::Safe::String &name)
 Constructs a Container with the given name.
 Container (StormByte::Safe::String &&name)
 Constructs a Container with the given name (move).
 Container (const Container &base)
 Copy constructor.
 Container (Container &&base) noexcept
 Move constructor.
Container & operator= (const Container &base)
 Copy assignment operator.
Container & operator= (Container &&base) noexcept
 Move assignment operator.
virtual ~Container () noexcept override
 Destructor.
Base & Add (const Base &item, const StormByte::Config::OnExistingAction &on_existing)
 Adds an item (const reference) using an explicit policy.
Base & Add (Base &&item, const StormByte::Config::OnExistingAction &on_existing)
 Adds an item (rvalue) using an explicit policy.
Base & Add (const Base &item)
 Adds an item using the container's current OnExistingAction policy.
Base & Add (Base &&item)
 Adds an item using the container's current OnExistingAction policy (move).
Base & Add (Base::PointerType item)
 Adds an item to the container using current policy.
Base & Add (Base::PointerType item, const StormByte::Config::OnExistingAction &on_existing)
 Adds an item to the container.
void Clear () noexcept
 Clears all items from the container.
bool Exists (std::string_view path) const
 Checks if an item exists by path.
void Remove (const StormByte::Size &index)
 Removes an item by index.
void Remove (std::string_view path)
 Removes an item by path.
const StormByte::Safe::Vector< Base::PointerType > & Items () noexcept
 Items in this level.
const StormByte::Safe::Vector< Base::PointerType > & Items () const noexcept
 Items in this level.
StormByte::Size Size () const noexcept
 Gets the number of items in the current level.
StormByte::Size Count () const noexcept
 Gets the total number of items including nested ones.
void SetOnExistingAction (StormByte::Config::OnExistingAction action) noexcept
 Sets the action to take when an item with the same identity already exists.
StormByte::Config::OnExistingAction GetOnExistingAction () const noexcept
 Gets the current OnExistingAction policy.
bool Equals (const Base &other) const noexcept override
 Polymorphic equality comparison.
Base & operator[] (const StormByte::Size &index)
 Gets a reference to an item by index.
const Base & operator[] (const StormByte::Size &index) const
 Gets a const reference to an item by index.
Base & operator[] (std::string_view path)
 Gets a reference to an item by path.
const Base & operator[] (std::string_view path) const
 Gets a const reference to an item by path.
bool operator== (const Container &container) const noexcept
 Equality operator.
bool operator!= (const Container &container) const noexcept
 Inequality operator.
StormByte::Safe::String Serialize (const int &indent_level) const noexcept override
 Serializes the container to a string.
constexpr std::string_view ContainerTypeToString () const noexcept
 Gets the container type as string.
Public Member Functions inherited from StormByte::Config::Item::Base
 Base () noexcept
 Constructor.
 Base (const StormByte::Safe::String &name)
 Constructor.
 Base (const Base &base) noexcept
 Copy constructor.
 Base (Base &&base) noexcept
 Move constructor.
Base & operator= (const Base &base) noexcept
 Assignment operator.
Base & operator= (Base &&base) noexcept
 Move assignment operator.
 ~Base () noexcept override
 Destructor.
bool operator== (const Base &base) const noexcept
 Compares two items.
bool operator!= (const Base &base) const noexcept
 Compares two items.
constexpr const StormByte::Safe::String & Name () const noexcept
 Gets the name of the item.
void Name (std::string_view name)
 Sets the name of the item.
constexpr std::string_view TypeToString () const noexcept
 Gets the type as string.
template<class T>
decltype(auto) As ()
 Typed view of this item.
template<class T>
decltype(auto) As () const
 Typed view of this item.
Public Member Functions inherited from StormByte::Safe::Clonable< Base, StormByte::Safe::Shared< Base > >
constexpr Clonable ()=default
constexpr Clonable & operator= (const Clonable &)=default
virtual constexpr ~Clonable () noexcept=default

Protected Member Functions

Base::PointerType BeforeAdditionActions (Base::PointerType item, const StormByte::Config::OnExistingAction onexisting) override
 Actions before addition.

Additional Inherited Members

Public Types inherited from StormByte::Safe::Clonable< Base, StormByte::Safe::Shared< Base > >
typedef SmartPointer PointerType
static constexpr std::pair< const char, const char > EnclosureCharacters (const ContainerType &type) noexcept
 Returns the enclosure characters for a given container type.
static constexpr const char EndCharacter (const ContainerType &type) noexcept
 Returns the closing character for a given container type.
Static Public Member Functions inherited from StormByte::Config::Item::Base
static bool IsNameValid (std::string_view name) noexcept
 Checks if name is valid.
Static Public Member Functions inherited from StormByte::Safe::Clonable< Base, StormByte::Safe::Shared< Base > >
static PointerType MakePointer (Args &&... args)
Protected Attributes inherited from StormByte::Config::Item::Container
StormByte::Safe::Vector< Base::PointerType > m_items
 Items stored in the container.
StormByte::Config::OnExistingAction m_on_existing_action = StormByte::Config::OnExistingAction::ThrowException
 Collision policy.
Protected Attributes inherited from StormByte::Config::Item::Base
StormByte::Safe::String m_name
 Name of the item.

Detailed Description

Named container ({ ... }).

Constructor & Destructor Documentation

◆ Group() [1/4]

StormByte::Config::Item::Group::Group ( )
noexcept

Constructor.

◆ Group() [2/4]

StormByte::Config::Item::Group::Group ( std::string_view name)
explicit

Constructor.

Parameters
namename of the group. A literal, std::string, string_view or Safe::String binds here.

◆ Group() [3/4]

StormByte::Config::Item::Group::Group ( const Group & group)

Copy constructor.

Parameters
groupgroup to copy

◆ Group() [4/4]

StormByte::Config::Item::Group::Group ( Group && group)
noexcept

Move constructor.

Parameters
groupgroup to move

◆ ~Group()

StormByte::Config::Item::Group::~Group ( )
overridenoexcept

Destructor.

Member Function Documentation

◆ BeforeAdditionActions()

Base::PointerType StormByte::Config::Item::Group::BeforeAdditionActions ( Base::PointerType item,
const StormByte::Config::OnExistingAction onexisting )
overrideprotectedvirtual

Actions before addition.

Parameters
itemitem
onexistingcollision policy
Returns
pointer

Implements StormByte::Config::Item::Container.

◆ Clone()

PointerType StormByte::Config::Item::Group::Clone ( ) const
overridevirtual

◆ ContainerType()

Item::ContainerType StormByte::Config::Item::Group::ContainerType ( ) const
inlineconstexproverridevirtualnoexcept

Container type.

Returns
type

Implements StormByte::Config::Item::Container.

◆ Move()

PointerType StormByte::Config::Item::Group::Move ( )
overridevirtual

◆ operator=() [1/2]

Group & StormByte::Config::Item::Group::operator= ( const Group & group)

Assignment operator.

Parameters
groupgroup to copy
Returns
this

◆ operator=() [2/2]

Group & StormByte::Config::Item::Group::operator= ( Group && group)
noexcept

Move assignment operator.

Parameters
groupgroup to move
Returns
this

◆ Type()

Item::Type StormByte::Config::Item::Group::Type ( ) const
inlineconstexproverridevirtualnoexcept

Item type.

Returns
type

Reimplemented from StormByte::Config::Item::Container.


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