The base class for all configuration items.
More...
#include <StormByte/config/item/base.hxx>
|
| | Base ()=default |
| | Default constructor.
|
| |
| | Base (const std::string &name) |
| | Constructs a Base item with a name.
|
| |
| | Base (const Base &base)=default |
| | Copy constructor.
|
| |
| | Base (Base &&base) noexcept=default |
| | Move constructor.
|
| |
| Base & | operator= (const Base &base)=default |
| | Copy assignment operator.
|
| |
| Base & | operator= (Base &&base) noexcept=default |
| | Move assignment operator.
|
| |
| virtual | ~Base () noexcept=default |
| | Destructor.
|
| |
| bool | operator== (const Base &other) const noexcept |
| | Equality operator.
|
| |
| bool | operator!= (const Base &other) const noexcept |
| | Inequality operator.
|
| |
| virtual bool | Equals (const Base &other) const noexcept=0 |
| | Polymorphic equality comparison.
|
| |
| constexpr const std::optional< std::string > & | Name () const noexcept |
| | Gets the name of the item.
|
| |
| constexpr void | Name (const std::string &name) noexcept |
| | Sets the item name.
|
| |
| bool | IsNameValid () const noexcept |
| | Checks if the current name is valid.
|
| |
| virtual constexpr Type | Type () const noexcept=0 |
| | Gets the item type.
|
| |
| virtual std::optional< CommentType > | GetCommentType () const noexcept |
| | Returns the comment type if this item is a Comment, otherwise std::nullopt.
|
| |
| constexpr std::string | TypeToString () const noexcept |
| | Gets the item type as a string.
|
| |
| virtual std::string | Serialize (const int &indent_level) const noexcept |
| | Serializes the item.
|
| |
| | operator std::string () const |
| | Converts the item to a string.
|
| |
| template<typename T > |
| const T & | Value () const |
| | Gets the item value (const).
|
| |
| template<typename T > |
| T & | Value () |
| | Gets the item value (mutable).
|
| |
The base class for all configuration items.
◆ Base() [1/4]
| StormByte::Config::Item::Base::Base |
( |
| ) |
|
|
default |
◆ Base() [2/4]
| StormByte::Config::Item::Base::Base |
( |
const std::string & |
name | ) |
|
Constructs a Base item with a name.
- Parameters
-
| name | The name of the item. |
◆ Base() [3/4]
| StormByte::Config::Item::Base::Base |
( |
const Base & |
base | ) |
|
|
default |
Copy constructor.
- Parameters
-
◆ Base() [4/4]
| StormByte::Config::Item::Base::Base |
( |
Base && |
base | ) |
|
|
defaultnoexcept |
Move constructor.
- Parameters
-
◆ ~Base()
| virtual StormByte::Config::Item::Base::~Base |
( |
| ) |
|
|
virtualdefaultnoexcept |
◆ Equals()
| virtual bool StormByte::Config::Item::Base::Equals |
( |
const Base & |
other | ) |
const |
|
pure virtualnoexcept |
◆ GetCommentType()
| virtual std::optional< CommentType > StormByte::Config::Item::Base::GetCommentType |
( |
| ) |
const |
|
inlinevirtualnoexcept |
Returns the comment type if this item is a Comment, otherwise std::nullopt.
Used by the serialization layer to determine the concrete Comment specialization without relying on RTTI / dynamic_cast.
- Returns
- The CommentType if this is a comment, std::nullopt otherwise.
Reimplemented in StormByte::Config::Item::Comment< T >.
◆ IsNameValid()
| bool StormByte::Config::Item::Base::IsNameValid |
( |
| ) |
const |
|
inlinenoexcept |
Checks if the current name is valid.
- Returns
- true if the name is valid.
◆ Name() [1/2]
| constexpr const std::optional< std::string > & StormByte::Config::Item::Base::Name |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Gets the name of the item.
- Returns
- The name of the item.
◆ Name() [2/2]
| constexpr void StormByte::Config::Item::Base::Name |
( |
const std::string & |
name | ) |
|
|
inlineconstexprnoexcept |
Sets the item name.
- Parameters
-
◆ operator std::string()
| StormByte::Config::Item::Base::operator std::string |
( |
| ) |
const |
|
inline |
Converts the item to a string.
- Returns
- Serialized representation.
◆ operator!=()
| bool StormByte::Config::Item::Base::operator!= |
( |
const Base & |
other | ) |
const |
|
inlinenoexcept |
Inequality operator.
- Parameters
-
- Returns
- true if items are not equal.
◆ operator=() [1/2]
| Base & StormByte::Config::Item::Base::operator= |
( |
Base && |
base | ) |
|
|
defaultnoexcept |
Move assignment operator.
- Parameters
-
- Returns
- Reference to this Base.
◆ operator=() [2/2]
| Base & StormByte::Config::Item::Base::operator= |
( |
const Base & |
base | ) |
|
|
default |
Copy assignment operator.
- Parameters
-
- Returns
- Reference to this Base.
◆ operator==()
| bool StormByte::Config::Item::Base::operator== |
( |
const Base & |
other | ) |
const |
|
inlinenoexcept |
Equality operator.
- Parameters
-
- Returns
- true if both items are equal.
◆ Serialize()
| virtual std::string StormByte::Config::Item::Base::Serialize |
( |
const int & |
indent_level | ) |
const |
|
virtualnoexcept |
◆ Type()
| virtual constexpr Type StormByte::Config::Item::Base::Type |
( |
| ) |
const |
|
constexprpure virtualnoexcept |
◆ TypeToString()
| constexpr std::string StormByte::Config::Item::Base::TypeToString |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Gets the item type as a string.
- Returns
- Item type as string.
◆ Value() [1/2]
template<typename T >
| T & StormByte::Config::Item::Base::Value |
( |
| ) |
|
|
inline |
Gets the item value (mutable).
- Template Parameters
-
- Returns
- Reference to the value.
- Exceptions
-
◆ Value() [2/2]
template<typename T >
| const T & StormByte::Config::Item::Base::Value |
( |
| ) |
const |
|
inline |
Gets the item value (const).
- Template Parameters
-
- Returns
- Const reference to the value.
- Exceptions
-
◆ m_name
| std::optional<std::string> StormByte::Config::Item::Base::m_name |
|
protected |
The documentation for this class was generated from the following file:
- lib/public/StormByte/config/item/base.hxx