A value, or the Error saying why there is none.
More...
#include <gui_core/gui_result.h>
|
| | Result (T value) |
| | Implicit from a value or an Error, so functions can return either.
|
| | Result (Error error) |
| bool | HasValue () const |
| | True when it holds the value; same as the bool conversion.
|
| | operator bool () const |
| T | ValueOr (T fallback) const |
| | A copy of the value, or fallback when there is none.
|
| const Error & | GetError () const |
| | The error; only valid when !HasValue().
|
| T & | Value () |
| | The value; only valid when HasValue() (std::get throws otherwise).
|
| const T & | Value () const |
| | The value; only valid when HasValue() (std::get throws otherwise).
|
| T & | operator* () |
| | The value; only valid when HasValue() (std::get throws otherwise).
|
| const T & | operator* () const |
| | The value; only valid when HasValue() (std::get throws otherwise).
|
| T * | operator-> () |
| | The value; only valid when HasValue() (std::get throws otherwise).
|
| const T * | operator-> () const |
| | The value; only valid when HasValue() (std::get throws otherwise).
|
template<class T>
class tachyon::Result< T >
A value, or the Error saying why there is none.
True when it holds the value:
if (auto image = LoadImage(path)) Use(*image); else Log(image.GetError().message);
- Examples
- controls/controls.cpp, custom_theme/custom_theme.cpp, docking/docking.cpp, hello_world/hello_world.cpp, and host_device/host_device.cpp.
◆ HasValue()
True when it holds the value; same as the bool conversion.
◆ operator bool()
◆ Value() [1/2]
The value; only valid when HasValue() (std::get throws otherwise).
◆ Value() [2/2]
The value; only valid when HasValue() (std::get throws otherwise).
◆ operator*() [1/2]
The value; only valid when HasValue() (std::get throws otherwise).
◆ operator*() [2/2]
The value; only valid when HasValue() (std::get throws otherwise).
◆ operator->() [1/2]
The value; only valid when HasValue() (std::get throws otherwise).
◆ operator->() [2/2]
The value; only valid when HasValue() (std::get throws otherwise).
◆ ValueOr()
A copy of the value, or fallback when there is none.
◆ GetError()
The documentation for this class was generated from the following file: