MySQL 26.10.0
Source Code Documentation
mysql::system_info::System_result< T > Class Template Reference

Result of collecting one system information capability. More...

#include <system_info.h>

Public Member Functions

 System_result ()=default
 Construct an unavailable result. More...
 
Result_state state () const noexcept
 
bool has_value () const noexcept
 
const T & value () const &
 Access the available value. More...
 
T & value () &
 Access the available value. More...
 
T value () &&
 Move the value out of an available temporary result. More...
 
T value () const &&
 Copy the value out of an available const temporary result. More...
 
const std::error_code & error () const &noexcept
 Access the collection error. More...
 
std::error_code error () &&noexcept
 Move the error out of a failed temporary result. More...
 
std::error_code error () const &&noexcept
 Copy the error out of a failed const temporary result. More...
 

Static Public Member Functions

static System_result success (T value)
 Construct an available result. More...
 
static System_result unavailable ()
 
static System_result failure (std::error_code error)
 Construct a failed result. More...
 

Private Attributes

std::optional< T > m_value
 
std::error_code m_error
 
Result_state m_state {Result_state::unavailable}
 

Detailed Description

template<typename T>
class mysql::system_info::System_result< T >

Result of collecting one system information capability.

An available result contains one complete value. An unavailable result means that the platform has no supported equivalent. A failed result means that collection was attempted but failed.

Template Parameters
TCollected capability type

Constructor & Destructor Documentation

◆ System_result()

template<typename T >
mysql::system_info::System_result< T >::System_result ( )
default

Construct an unavailable result.

Member Function Documentation

◆ error() [1/3]

template<typename T >
std::error_code mysql::system_info::System_result< T >::error ( ) &&
inlinenoexcept

Move the error out of a failed temporary result.

Precondition
state() is Result_state::failed.

◆ error() [2/3]

template<typename T >
std::error_code mysql::system_info::System_result< T >::error ( ) const &&
inlinenoexcept

Copy the error out of a failed const temporary result.

Precondition
state() is Result_state::failed.

◆ error() [3/3]

template<typename T >
const std::error_code & mysql::system_info::System_result< T >::error ( ) const &
inlinenoexcept

Access the collection error.

Precondition
state() is Result_state::failed.

◆ failure()

template<typename T >
static System_result mysql::system_info::System_result< T >::failure ( std::error_code  error)
inlinestatic

Construct a failed result.

Parameters
errorCollection error
Returns
Failed result containing error

◆ has_value()

template<typename T >
bool mysql::system_info::System_result< T >::has_value ( ) const
inlinenoexcept
Returns
true if this result contains an available value.

◆ state()

template<typename T >
Result_state mysql::system_info::System_result< T >::state ( ) const
inlinenoexcept
Returns
Current capability state.

◆ success()

template<typename T >
static System_result mysql::system_info::System_result< T >::success ( T  value)
inlinestatic

Construct an available result.

Parameters
valueComplete capability value
Returns
Available result containing value

◆ unavailable()

template<typename T >
static System_result mysql::system_info::System_result< T >::unavailable ( )
inlinestatic
Returns
An unavailable result.

◆ value() [1/4]

template<typename T >
T & mysql::system_info::System_result< T >::value ( ) &
inline

Access the available value.

Precondition
has_value() is true.

◆ value() [2/4]

template<typename T >
T mysql::system_info::System_result< T >::value ( ) &&
inline

Move the value out of an available temporary result.

Precondition
has_value() is true.

◆ value() [3/4]

template<typename T >
const T & mysql::system_info::System_result< T >::value ( ) const &
inline

Access the available value.

Precondition
has_value() is true.

◆ value() [4/4]

template<typename T >
T mysql::system_info::System_result< T >::value ( ) const &&
inline

Copy the value out of an available const temporary result.

Precondition
has_value() is true.

Member Data Documentation

◆ m_error

template<typename T >
std::error_code mysql::system_info::System_result< T >::m_error
private

◆ m_state

template<typename T >
Result_state mysql::system_info::System_result< T >::m_state {Result_state::unavailable}
private

◆ m_value

template<typename T >
std::optional<T> mysql::system_info::System_result< T >::m_value
private

The documentation for this class was generated from the following file: