Many settings in xlnt are allowed to not have a value set. This class encapsulates a value which may or may not be set. Memory is allocated within the optional class.
More...
|
| optional () noexcept |
| Default contructor. is_set() will be false initially. More...
|
|
| optional (const T &value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_copy_T_noexcept{})) |
| Constructs this optional with a value. noexcept if T copy ctor is noexcept More...
|
|
| optional (T &&value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(ctor_move_T_noexcept{})) |
| Constructs this optional with a value. noexcept if T move ctor is noexcept More...
|
|
| optional (const optional &other) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(copy_ctor_noexcept{})) |
| Copy constructs this optional from other noexcept if T copy ctor is noexcept More...
|
|
| optional (optional &&other) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(move_ctor_noexcept{})) |
| Move constructs this optional from other. Clears the value from other if set noexcept if T move ctor is noexcept More...
|
|
optional & | operator= (const optional &other) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(set_copy_noexcept_t{} &&clear_noexcept_t{})) |
| Copy assignment of this optional from other noexcept if set and clear are noexcept for T& More...
|
|
optional & | operator= (optional &&other) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(set_move_noexcept_t{} &&clear_noexcept_t{})) |
| Move assignment of this optional from other noexcept if set and clear are noexcept for T&& More...
|
|
| ~optional () noexcept |
| Destructor cleans up the T instance if set More...
|
|
bool | is_set () const noexcept |
| Returns true if this object currently has a value set. This should be called before accessing the value with optional::get(). More...
|
|
void | set (const T &value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(set_copy_noexcept_t{})) |
| Copies the value into the stored value More...
|
|
void | set (T &&value) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(set_move_noexcept_t{})) |
| Moves the value into the stored value More...
|
|
optional & | operator= (const T &rhs) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(set_copy_noexcept_t{})) |
| Assignment operator overload. Equivalent to setting the value using optional::set. More...
|
|
optional & | operator= (T &&rhs) noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(set_move_noexcept_t{})) |
| Assignment operator overload. Equivalent to setting the value using optional::set. More...
|
|
void | clear () noexcept(XLNT_NOEXCEPT_VALUE_COMPAT(clear_noexcept_t{})) |
| After this is called, is_set() will return false until a new value is provided. More...
|
|
T & | get () |
| Gets the value. If no value has been initialized in this object, an xlnt::invalid_attribute exception will be thrown. More...
|
|
const T & | get () const |
| Gets the value. If no value has been initialized in this object, an xlnt::invalid_attribute exception will be thrown. More...
|
|
bool | operator== (const optional< T > &other) const noexcept |
| Returns true if neither this nor other have a value or both have a value and those values are equal according to their equality operator. More...
|
|
bool | operator!= (const optional< T > &other) const noexcept |
| Returns false if neither this nor other have a value or both have a value and those values are equal according to their equality operator. More...
|
|
template<typename T>
class xlnt::optional< T >
Many settings in xlnt are allowed to not have a value set. This class encapsulates a value which may or may not be set. Memory is allocated within the optional class.