Stores and manages values for SettingsBackend
#include <tools/SettingsBackend.hpp>
◆ SettingValue() [1/7]
openfluid::tools::SettingValue::SettingValue |
( |
| ) |
|
|
inline |
Constructor of an empty value
- See also
- isNull()
◆ SettingValue() [2/7]
openfluid::tools::SettingValue::SettingValue |
( |
bool |
Val | ) |
|
|
inline |
Constructor from a boolean value
◆ SettingValue() [3/7]
openfluid::tools::SettingValue::SettingValue |
( |
int |
Val | ) |
|
|
inline |
Constructor from an integer value
◆ SettingValue() [4/7]
openfluid::tools::SettingValue::SettingValue |
( |
double |
Val | ) |
|
|
inline |
Constructor from a double value
◆ SettingValue() [5/7]
openfluid::tools::SettingValue::SettingValue |
( |
const char * |
Val | ) |
|
|
inline |
Constructor from an char* value (mainly for casting to std::string)
◆ SettingValue() [6/7]
openfluid::tools::SettingValue::SettingValue |
( |
const std::string & |
Val | ) |
|
|
inline |
Constructor from a string value
◆ SettingValue() [7/7]
openfluid::tools::SettingValue::SettingValue |
( |
const std::vector< std::string > & |
Val | ) |
|
|
inline |
Constructor from a vector of strings
◆ fromJSON()
Constructor from a native JSON value
◆ get()
template<typename T >
const T openfluid::tools::SettingValue::get |
( |
const std::optional< T > & |
DefaultValue = std::nullopt | ) |
const |
|
inline |
Returns the stored value if it matches the given type. If the stored value dos not match the type, it returns a default value if given, otherwise throws an exception.
- Template Parameters
-
- Parameters
-
[in] | DefaultValue | The value returned by default |
- Returns
- the stored value or the default value
◆ is()
template<typename T >
bool openfluid::tools::SettingValue::is |
( |
| ) |
const |
|
inline |
Checks if the stored value matches the given type
- Template Parameters
-
- Returns
- true if the type is correct
◆ isJSONValue()
bool openfluid::tools::SettingValue::isJSONValue |
( |
| ) |
const |
|
inline |
Returns true if the stored value is a JSON tree
- Returns
- true if the value is a JSON structure
◆ isNull()
bool openfluid::tools::SettingValue::isNull |
( |
| ) |
const |
|
inline |
Check if the value is null (it is neither a stored value nor a JSON tree)
- Returns
- true if the value is null
◆ JSONValue()
Returns if the stored value is a JSON tree, otherwise returns nullptr
- Returns
- the stored JSON tree
The documentation for this class was generated from the following file: