|
duvc-ctl 2.0.0
USB Video Class Camera Control Library
|
Result type that can contain either a value or an error. More...
#include <duvc-ctl/core/result.h>
Public Member Functions | |
| Result (T value) | |
| Create successful result with value. | |
| Result (Error error) | |
| Create error result. | |
| Result (ErrorCode code, std::string message="") | |
| Create error result from error code. | |
| bool | is_ok () const |
| Check if result contains a value (success) | |
| bool | is_error () const |
| Check if result contains an error. | |
| const T & | value () const & |
| Get the value (assumes success) | |
| T && | value () && |
| Get the value (assumes success) | |
| const Error & | error () const |
| Get the error (assumes error) | |
| T | value_or (const T &default_value) const & |
| Get value or default if error. | |
| T | value_or (T &&default_value) && |
| Get value or default if error. | |
| operator bool () const | |
| Boolean conversion (true if success) | |
Result type that can contain either a value or an error.
| T | Value type (use void for operations that don't return values) |
|
inline |
Create successful result with value.
| value | Result value |
Definition at line 81 of file result.h.
Referenced by duvc::Result< T >::value_or().
|
inline |
|
inline |
|
inline |
Get the error (assumes error)
| std::bad_variant_access | if result is success |
Definition at line 128 of file result.h.
Referenced by duvc::logitech::get_logitech_property_typed(), and duvc::KsPropertySet::get_property_typed().
|
inline |
|
inline |
Check if result contains a value (success)
Definition at line 101 of file result.h.
Referenced by duvc::get(), duvc::get(), duvc::logitech::get_logitech_property_typed(), duvc::KsPropertySet::get_property_typed(), duvc::get_range(), duvc::get_range(), duvc::Result< T >::operator bool(), duvc::Result< void >::operator bool(), duvc::set(), duvc::set(), duvc::logitech::supports_logitech_properties(), duvc::Result< T >::value_or(), and duvc::Result< T >::value_or().
|
inlineexplicit |
Boolean conversion (true if success)
Definition at line 151 of file result.h.
References duvc::Result< T >::is_ok().
|
inline |
|
inline |
Get the value (assumes success)
| std::bad_variant_access | if result is error |
Definition at line 114 of file result.h.
Referenced by duvc::DeviceConnection::get(), duvc::get(), duvc::get(), duvc::DeviceConnection::get(), duvc::logitech::get_logitech_property_typed(), duvc::KsPropertySet::get_property_typed(), duvc::get_range(), duvc::get_range(), duvc::DeviceConnection::set(), duvc::DeviceConnection::set(), duvc::logitech::supports_logitech_properties(), duvc::Result< T >::value_or(), and duvc::Result< T >::value_or().
|
inline |
Get value or default if error.
| default_value | Default value to return on error |
Definition at line 135 of file result.h.
References duvc::Result< T >::is_ok(), duvc::Result< T >::Result(), and duvc::Result< T >::value().
|
inline |
Get value or default if error.
| default_value | Default value to return on error |
Definition at line 144 of file result.h.
References duvc::Result< T >::is_ok(), and duvc::Result< T >::value().