Value class that can hold a wide set of types.
More...
#include <value.h>
|
| std::unique_ptr< Imp > | _imp |
| |
Value class that can hold a wide set of types.
This class is instantiated for the following types:
Definition at line 66 of file value.h.
◆ Value() [1/4]
Default constructor. Creates an empty Value.
◆ Value() [2/4]
template<typename T >
| Ufe::Value::Value |
( |
const T & |
v | ) |
|
Create a Value from the argument.
- Parameters
-
◆ Value() [3/4]
| Ufe::Value::Value |
( |
const Value & |
| ) |
|
Default copy constructor.
◆ Value() [4/4]
| Ufe::Value::Value |
( |
Value && |
| ) |
|
|
noexcept |
Move constructor.
- Note
- Right hand side becomes invalid object and can no longer be used.
◆ ~Value()
◆ empty()
| bool Ufe::Value::empty |
( |
| ) |
const |
- Returns
- True iff this value is empty.
- Note
- An empty Value has no type and no contained value.
-
A Value created with the default constructor is empty.
-
A Value created with a type constructor is non-empty (has a type and a value). This inclues types like std::string which can contain an empty string, but the Value will be non-empty.
◆ get()
template<typename T >
| T Ufe::Value::get |
( |
| ) |
const |
- Returns
- The current value if template type matches actual type.
- Note
- Asking for std::string will always succeed by converting the actual value to string. This is useful for logging and debugging. The returned string is not formatted in any human readable way, it is just a direct conversion of the actual value.
- Exceptions
-
| InvalidValueGet | If the template type doesn't match the type of the actual value unless the requested type is std::string which is supported for all storage types. |
◆ isType()
template<typename T >
| bool Ufe::Value::isType |
( |
| ) |
const |
- Returns
- True if the contained value is an object of type T.
◆ operator!=()
| bool Ufe::Value::operator!= |
( |
const Value & |
rhs | ) |
const |
◆ operator=() [1/2]
Default assignment operator.
◆ operator=() [2/2]
Move assignment.
- Note
- Right hand side becomes invalid object and can no longer be used.
◆ operator==()
| bool Ufe::Value::operator== |
( |
const Value & |
rhs | ) |
const |
◆ safeGet()
template<typename T >
| T Ufe::Value::safeGet |
( |
T |
arg | ) |
const |
Returns a copy of the value if the template type matches actual type. Returns the input argument value otherwise. Especially useful to return a default when dealing with an empty Ufe::Value.
- Returns
- The current value if template type matches actual type, otherwise arg.
◆ typeName()
| std::string Ufe::Value::typeName |
( |
| ) |
const |
◆ _imp
| std::unique_ptr<Imp> Ufe::Value::_imp |
|
private |
The documentation for this class was generated from the following file: