![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/util/Option.h>
Public Member Functions | |
| Option () | |
| Option (const OptionalNone &none) | |
| Option (t::in< T > value) | |
| Option (const Option< T > &opt) | |
| bool | some () const |
| bool | none () const |
| t::ret< T > | value () const |
| t::ret< T > | operator* () const |
| template<class F > | |
| const Option< T > & | if_one (const F &f) const |
| template<class F > | |
| const Option< T > & | if_else (const F &f) const |
| Option< T > & | operator= (const Option< T > &opt) |
| Option< T > & | operator= (t::in< T > value) |
| bool | equals (const OptionalNone &_) const |
| bool | equals (const Option< T > &opt) const |
| bool | operator== (const OptionalNone &_) const |
| bool | operator!= (const OptionalNone &_) const |
| bool | operator== (const Option< T > &o) const |
| bool | operator!= (const Option< T > &o) const |
| operator bool (void) const | |
| operator t::ret< T > () const | |
| bool | isOne () const |
| bool | isNone () const |
This class is very handy to manage parameters or return value that may be optional. This class records there is no value or there is a value and the instance of the value.
| T | Type of the stored value. |
|
inline |
|
inline |
@fn Option::Option();
Build an empty optional value recording there is no value.
For nternal use only.
Build an optional value containing the given one.
| value | Value to store. |
Build an optional value by copying an existing one.
| opt | Optional value to clone. |
References Option< T >::none(), and Option< T >::some().
|
inline |
References Option< T >::none().
Referenced by Option< T >::operator!=(), and Option< T >::operator==().
|
inline |
|
inline |
Test if no value is available.
Referenced by StrictMapDelegate< C >::get().
Test if a value is available.
|
inline |
Referenced by Option< T >::equals(), Option< T >::operator!=(), and Option< T >::operator==().
References Option< T >::some().
References Option< T >::equals().
|
inline |
References Option< T >::none().
References Option< T >::value().
Provides assignment support.
| opt | Optional value to assign. |
References type_info< T >::put().
References Option< T >::equals().
|
inline |
References Option< T >::none().
|
inline |
Referenced by Option< T >::equals(), Option< T >::operator bool(), and AbstractAttribute::parse().
Get the value.
Referenced by Option< T >::operator t::ret< T >(), and Option< T >::operator*().