StormByte-Config 2.0.0
C++26 configuration-document module of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Config::Item::List Class Referencefinal

Unnamed container ([ ... ]). More...

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

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

Public Member Functions

 List () noexcept
 Constructor.
 
 List (const StormByte::String::String &name)
 Constructor.
 
 List (StormByte::String::String &&name)
 Constructor.
 
 List (std::string_view name)
 Constructor.
 
 List (const List &list)
 Copy constructor.
 
 List (List &&list) noexcept
 Move constructor.
 
List & operator= (const List &list)
 Assignment operator.
 
List & operator= (List &&list) noexcept
 Move assignment operator.
 
 ~List () 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::String::String &name)
 Constructs a Container with the given name.
 
 Container (StormByte::String::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 (const StormByte::String::String &path) const
 Checks if an item exists by path.
 
bool Exists (std::string_view path) const
 Checks if an item exists by a path view.
 
void Remove (const StormByte::Size &index)
 Removes an item by index.
 
void Remove (const StormByte::String::String &path)
 Removes an item by path.
 
void Remove (std::string_view path)
 Removes an item by a path view.
 
constexpr std::span< const Base::PointerType > Items () noexcept
 Items in this level.
 
constexpr std::span< const 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[] (const StormByte::String::String &path)
 Gets a reference to an item by path.
 
const Base & operator[] (const StormByte::String::String &path) const
 Gets a const reference to an item by path.
 
Base & operator[] (std::string_view path)
 Gets a reference to an item by a path view.
 
const Base & operator[] (std::string_view path) const
 Gets a const reference to an item by a path view.
 
bool operator== (const Container &container) const noexcept
 Equality operator.
 
bool operator!= (const Container &container) const noexcept
 Inequality operator.
 
StormByte::String::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::String::String &name)
 Constructor.
 
 Base (const Base &base) noexcept=default
 Copy constructor.
 
 Base (Base &&base) noexcept=default
 Move constructor.
 
Base & operator= (const Base &base) noexcept=default
 Assignment operator.
 
Base & operator= (Base &&base) noexcept=default
 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::String::String & Name () const noexcept
 Gets the name of the item.
 
constexpr void Name (const StormByte::String::String &name)
 Sets 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::Clonable< Base, StormByte::Shared< Base > >
constexpr Clonable ()=default
 
constexpr Clonable (const Clonable &)=default
 
constexpr Clonable (Clonable &&) noexcept=default
 
constexpr Clonable & operator= (const Clonable &)=default
 
constexpr Clonable & operator= (Clonable &&) noexcept=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::Clonable< Base, StormByte::Shared< Base > >
typedef SmartPointer PointerType
 
- Static Public Member Functions inherited from StormByte::Config::Item::Container
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 (const StormByte::String::String &name) noexcept
 Checks if name is valid.
 
static bool IsNameValid (std::string_view name) noexcept
 Checks if name is valid.
 
- Static Public Member Functions inherited from StormByte::Clonable< Base, StormByte::Shared< Base > >
static PointerType MakePointer (Args &&... args)
 
- Protected Attributes inherited from StormByte::Config::Item::Container
std::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::String::String m_name
 Name of the item.
 

Detailed Description

Unnamed container ([ ... ]).

Constructor & Destructor Documentation

◆ List() [1/6]

StormByte::Config::Item::List::List ( )
noexcept

Constructor.

◆ List() [2/6]

StormByte::Config::Item::List::List ( const StormByte::String::String &  name)
explicit

Constructor.

Parameters
namename of the list

◆ List() [3/6]

StormByte::Config::Item::List::List ( StormByte::String::String &&  name)
explicit

Constructor.

Parameters
namename of the list

◆ List() [4/6]

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

Constructor.

Parameters
namename of the list

◆ List() [5/6]

StormByte::Config::Item::List::List ( const List &  list)

Copy constructor.

Parameters
listlist to copy

◆ List() [6/6]

StormByte::Config::Item::List::List ( List &&  list)
noexcept

Move constructor.

Parameters
listlist to move

◆ ~List()

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

Destructor.

Member Function Documentation

◆ BeforeAdditionActions()

Base::PointerType StormByte::Config::Item::List::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::List::Clone ( ) const
inlineoverridevirtual

Clone.

Returns
pointer

Implements StormByte::Clonable< Base, StormByte::Shared< Base > >.

◆ ContainerType()

constexpr Item::ContainerType StormByte::Config::Item::List::ContainerType ( ) const
inlineconstexproverridevirtualnoexcept

Container type.

Returns
type

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

◆ Move()

PointerType StormByte::Config::Item::List::Move ( )
inlineoverridevirtual

◆ operator=() [1/2]

List & StormByte::Config::Item::List::operator= ( const List &  list)

Assignment operator.

Parameters
listlist to copy
Returns
this

◆ operator=() [2/2]

List & StormByte::Config::Item::List::operator= ( List &&  list)
noexcept

Move assignment operator.

Parameters
listlist to move
Returns
this

◆ Type()

constexpr Item::Type StormByte::Config::Item::List::Type ( ) const
inlineconstexproverridevirtualnoexcept

Item type.

Returns
type

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


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