StormByte C++ Library: Config module 0.0.9999
StormByte-Config is a StormByte library module for parsing configuration files
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
StormByte::Config::Item::Value< T > Class Template Reference

Represents a configuration item with a value. More...

#include <value.hxx>

Inheritance diagram for StormByte::Config::Item::Value< T >:
Inheritance graph
[legend]
Collaboration diagram for StormByte::Config::Item::Value< T >:
Collaboration graph
[legend]

Public Member Functions

 Value (const T &value)
 Constructs a Value with the given value.
 
template<typename U = T>
requires std::is_same_v<U, std::string>
 Value (const char *value)
 
template<typename U = T>
requires std::is_same_v<U, std::string>
 Value (const char *name, const char *value)
 
 Value (T &&value)
 
 Value (const std::string &name, const T &value)
 
 Value (std::string &&name, T &&value)
 
 Value (const std::string &name, const char *value)
 
 Value (std::string &&name, const char *value)
 
 Value (const Value &single)=default
 
 Value (Value &&single) noexcept=default
 
Valueoperator= (const Value &single)=default
 
Valueoperator= (Value &&single) noexcept=default
 
virtual ~Value () noexcept override=default
 
virtual constexpr Item::Type Type () const noexcept override
 Gets the type of the item.
 
bool operator== (const Value< T > &single) const noexcept
 Checks if two Value objects are equal.
 
bool operator!= (const Value< T > &single) const noexcept
 
T & operator* () noexcept
 
const T & operator* () const noexcept
 
std::string Serialize (const int &indent_level) const noexcept override
 Serializes the item to a string.
 
virtual PointerType Clone () const override
 
virtual PointerType Move () override
 
- Public Member Functions inherited from StormByte::Config::Item::Base
 Base ()=default
 Constructs a Base item with an optional name.
 
 Base (const std::string &name)
 Constructs a Base item with an optional name.
 
 Base (const Base &base)=default
 
 Base (Base &&base) noexcept=default
 
Baseoperator= (const Base &base)=default
 
Baseoperator= (Base &&base) noexcept=default
 
virtual ~Base () noexcept=default
 
bool operator== (const Base &base) const noexcept
 
bool operator!= (const Base &base) const noexcept
 
constexpr const std::optional< std::string > & Name () const noexcept
 Gets the name of the item.
 
constexpr void Name (const std::string &name) noexcept
 
bool IsNameValid () const noexcept
 
constexpr std::string TypeToString () const noexcept
 
 operator std::string () const
 
template<typename T >
const T & Value () const
 
template<typename T >
T & Value ()
 

Protected Attributes

m_value
 The value of the item.
 
- Protected Attributes inherited from StormByte::Config::Item::Base
std::optional< std::string > m_name
 Item name.
 

Detailed Description

template<AllowedValueType T>
class StormByte::Config::Item::Value< T >

Represents a configuration item with a value.

Template Parameters
TThe type of the value (only std::string, int, double, or bool allowed).

Constructor & Destructor Documentation

◆ Value() [1/8]

template<AllowedValueType T>
StormByte::Config::Item::Value< T >::Value ( const T &  value)
inline

Constructs a Value with the given value.

Parameters
valueThe value of the item.

◆ Value() [2/8]

template<AllowedValueType T>
StormByte::Config::Item::Value< T >::Value ( T &&  value)
inline

Move Constructor

Parameters
valueitem value

◆ Value() [3/8]

template<AllowedValueType T>
StormByte::Config::Item::Value< T >::Value ( const std::string &  name,
const T &  value 
)
inline

Constructor

Parameters
nameitem name
valueitem value

◆ Value() [4/8]

template<AllowedValueType T>
StormByte::Config::Item::Value< T >::Value ( std::string &&  name,
T &&  value 
)
inline

Move Constructor

Parameters
nameitem name
valueitem value

◆ Value() [5/8]

template<AllowedValueType T>
StormByte::Config::Item::Value< T >::Value ( const std::string &  name,
const char *  value 
)
inline

Constructor overload (for std::string only)

Parameters
nameitem name
valueitem value

◆ Value() [6/8]

template<AllowedValueType T>
StormByte::Config::Item::Value< T >::Value ( std::string &&  name,
const char *  value 
)
inline

Move Constructor overload (for std::string only)

Parameters
nameitem name
valueitem value

◆ Value() [7/8]

template<AllowedValueType T>
StormByte::Config::Item::Value< T >::Value ( const Value< T > &  single)
default

Copy constructor

Parameters
singleitem to copy

◆ Value() [8/8]

template<AllowedValueType T>
StormByte::Config::Item::Value< T >::Value ( Value< T > &&  single)
defaultnoexcept

Move constructor

Parameters
singleitem to move

◆ ~Value()

template<AllowedValueType T>
virtual StormByte::Config::Item::Value< T >::~Value ( )
overridevirtualdefaultnoexcept

Destructor

Member Function Documentation

◆ Clone()

template<AllowedValueType T>
virtual PointerType StormByte::Config::Item::Value< T >::Clone ( ) const
inlineoverridevirtual

Clones the item

Returns
cloned item

Reimplemented in StormByte::Config::Item::Comment< T >.

◆ Move()

template<AllowedValueType T>
virtual PointerType StormByte::Config::Item::Value< T >::Move ( )
inlineoverridevirtual

Moves the item

Returns
moved item

Reimplemented in StormByte::Config::Item::Comment< T >.

◆ operator!=()

template<AllowedValueType T>
bool StormByte::Config::Item::Value< T >::operator!= ( const Value< T > &  single) const
inlinenoexcept

Inequality operator

Parameters
singleitem to compare
Returns
is not equal?

◆ operator*() [1/2]

template<AllowedValueType T>
const T & StormByte::Config::Item::Value< T >::operator* ( ) const
inlinenoexcept

Gets the item value

Returns
item value

◆ operator*() [2/2]

template<AllowedValueType T>
T & StormByte::Config::Item::Value< T >::operator* ( )
inlinenoexcept

Gets the item value

Returns
item value

◆ operator=() [1/2]

template<AllowedValueType T>
Value & StormByte::Config::Item::Value< T >::operator= ( const Value< T > &  single)
default

Assignment operator

Parameters
singleitem to copy

◆ operator=() [2/2]

template<AllowedValueType T>
Value & StormByte::Config::Item::Value< T >::operator= ( Value< T > &&  single)
defaultnoexcept

Move assignment operator

Parameters
singleitem to move

◆ operator==()

template<AllowedValueType T>
bool StormByte::Config::Item::Value< T >::operator== ( const Value< T > &  single) const
inlinenoexcept

Checks if two Value objects are equal.

Parameters
singleThe Value object to compare.
Returns
True if equal, false otherwise.

◆ Serialize()

template<AllowedValueType T>
std::string StormByte::Config::Item::Value< T >::Serialize ( const int &  indent_level) const
overridevirtualnoexcept

Serializes the item to a string.

Parameters
indent_levelThe indentation level for serialization.
Returns
The serialized string.

Reimplemented from StormByte::Config::Item::Base.

◆ Type()

template<AllowedValueType T>
virtual constexpr Item::Type StormByte::Config::Item::Value< T >::Type ( ) const
inlineconstexproverridevirtualnoexcept

Gets the type of the item.

Returns
Item::Type The type of the item.

Implements StormByte::Config::Item::Base.

Reimplemented in StormByte::Config::Item::Comment< T >.


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