Configuration option value. More...
#include <config.hpp>
Public Member Functions | |
| OptionValue ()=default | |
| Default constructor. More... | |
| OptionValue (std::string value_as_string) | |
| Constructs OptionValue from a string representation. More... | |
| template<typename T > | |
| OptionValue (T value) requires(!std | |
| Constructs OptionValue from a typed value. More... | |
| std::any const & | get_value () const |
| Retrieves the stored value. More... | |
| std::string const & | get_value_as_string () const |
| Retrieves the string representation of the value. More... | |
| void | set_value (std::any value) |
| Sets the value if it has not been set already. More... | |
Configuration option value.
The OptionValue class encapsulates a value (of any type using std::any) and a string representation of the value.
Definition at line 41 of file config.hpp.
|
default |
Default constructor.
Constructs an empty OptionValue.
|
inline |
Constructs OptionValue from a string representation.
| value_as_string | A string representation of the value. |
Definition at line 55 of file config.hpp.
|
inlineexplicit |
Constructs OptionValue from a typed value.
The value is stored directly and no string representation is provided. Options constructed this way are considered initialized and make the Options instance unserializable.
| T | Type of the value to store. |
| value | The value to store. |
Definition at line 69 of file config.hpp.
|
inline |
Retrieves the stored value.
Definition at line 78 of file config.hpp.
|
inline |
Retrieves the string representation of the value.
Is the empty string, if not string representation exist.
Definition at line 89 of file config.hpp.
|
inline |
Sets the value if it has not been set already.
| value | The new value to store. |
| std::invalid_argument | if the value is already set. |
Definition at line 100 of file config.hpp.