esp::core::config::ConfigValue class

This class uses an anonymous tagged union to store values of different types, as well as providing access to the values in a type safe manner.

Constructors, destructors, conversion operators

ConfigValue() defaulted
Constructor.
ConfigValue(const ConfigValue& otr)
Copy Constructor.
ConfigValue(ConfigValue&& otr) noexcept
Move Constructor.
~ConfigValue()

Public functions

auto operator=(const ConfigValue& otr) -> ConfigValue&
Copy assignment.
auto operator=(ConfigValue&& otr) -> ConfigValue& noexcept
Move assignment.
auto isValid() const -> bool
Whether this ConfigValue is valid.
auto writeToJsonObject(io::JsonAllocator& allocator) const -> io::JsonGenericValue
Write this ConfigValue to an appropriately configured json object.
template<class T>
void set(const T& value)
Set the passed value as the data for this ConfigValue, while also setting the appropriate type.
template<class T>
auto get() const -> const T&
Retrieve an appropriately cast copy of the data stored in this ConfigValue.
auto getType() const -> ConfigStoredType
Returns the current type of this ConfigValue.
auto getAsString() const -> std::string
Retrieve a string representation of the data held in this ConfigValue.
auto putValueInConfigGroup(const std::string& key, Cr::Utility::ConfigurationGroup& cfg) const -> bool
Copy this ConfigValue into the passed Corrade::Utility::ConfigurationGroup.

Function documentation

bool esp::core::config::ConfigValue::isValid() const

Whether this ConfigValue is valid.

Returns Whether or not the specified type of this ConfigValue is known.

template<class T>
void esp::core::config::ConfigValue::set(const T& value)

Set the passed value as the data for this ConfigValue, while also setting the appropriate type.

Parameters
value The value to store in this ConfigValue