Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TValueOrError< ValueType, ErrorType > Class Template Reference

#include <ValueOrError.h>

+ Collaboration diagram for TValueOrError< ValueType, ErrorType >:

Classes

struct  FEmptyType
 
struct  FWrapErrorType
 

Public Member Functions

template<typename... ArgTypes>
 TValueOrError (TValueOrError_ValueProxy< ArgTypes... > &&Proxy)
 
template<typename... ArgTypes>
 TValueOrError (TValueOrError_ErrorProxy< ArgTypes... > &&Proxy)
 
bool IsValid () const
 
bool HasError () const
 
ErrorTypeGetError () &
 
const ErrorTypeGetError () const &
 
ErrorType GetError () &&
 
ErrorTypeTryGetError ()
 
const ErrorTypeTryGetError () const
 
ErrorType StealError ()
 
bool HasValue () const
 
ValueType & GetValue () &
 
const ValueType & GetValue () const &
 
ValueType GetValue () &&
 
ValueType * TryGetValue ()
 
const ValueType * TryGetValue () const
 
ValueType StealValue ()
 

Private Member Functions

template<typename... ArgTypes, uint32... ArgIndices>
 TValueOrError (TValueOrError_ValueProxy< ArgTypes... > &&Proxy, TIntegerSequence< uint32, ArgIndices... >)
 
template<typename... ArgTypes, uint32... ArgIndices>
 TValueOrError (TValueOrError_ErrorProxy< ArgTypes... > &&Proxy, TIntegerSequence< uint32, ArgIndices... >)
 

Private Attributes

TVariant< ValueType, FWrapErrorType, FEmptyTypeVariant
 

Detailed Description

template<typename ValueType, typename ErrorType>
class TValueOrError< ValueType, ErrorType >

Type used to return either a value or an error.

These must have a value or an error when newly constructed, but it is possible to have neither because of the functions to steal the value or error. This is critical for callers to consider since it means that HasValue() and HasError() must be checked independently; a return value of false from one does not imply that the other will return true.

The MakeValue and MakeError functions may be used to construct these conveniently.

Definition at line 48 of file ValueOrError.h.

Constructor & Destructor Documentation

◆ TValueOrError() [1/4]

template<typename ValueType , typename ErrorType >
template<typename... ArgTypes, uint32... ArgIndices>
TValueOrError< ValueType, ErrorType >::TValueOrError ( TValueOrError_ValueProxy< ArgTypes... > && Proxy,
TIntegerSequence< uint32, ArgIndices... >  )
inlineprivate

Definition at line 64 of file ValueOrError.h.

◆ TValueOrError() [2/4]

template<typename ValueType , typename ErrorType >
template<typename... ArgTypes, uint32... ArgIndices>
TValueOrError< ValueType, ErrorType >::TValueOrError ( TValueOrError_ErrorProxy< ArgTypes... > && Proxy,
TIntegerSequence< uint32, ArgIndices... >  )
inlineprivate

Definition at line 70 of file ValueOrError.h.

◆ TValueOrError() [3/4]

template<typename ValueType , typename ErrorType >
template<typename... ArgTypes>
TValueOrError< ValueType, ErrorType >::TValueOrError ( TValueOrError_ValueProxy< ArgTypes... > && Proxy)
inline

Construct the value from a proxy from MakeValue.

Definition at line 78 of file ValueOrError.h.

◆ TValueOrError() [4/4]

template<typename ValueType , typename ErrorType >
template<typename... ArgTypes>
TValueOrError< ValueType, ErrorType >::TValueOrError ( TValueOrError_ErrorProxy< ArgTypes... > && Proxy)
inline

Construct the error from a proxy from MakeError.

Definition at line 85 of file ValueOrError.h.

Member Function Documentation

◆ GetError() [1/3]

template<typename ValueType , typename ErrorType >
ErrorType & TValueOrError< ValueType, ErrorType >::GetError ( ) &
inline

Access the error. Asserts if this does not have an error.

Definition at line 97 of file ValueOrError.h.

◆ GetError() [2/3]

template<typename ValueType , typename ErrorType >
ErrorType TValueOrError< ValueType, ErrorType >::GetError ( ) &&
inline

Definition at line 99 of file ValueOrError.h.

◆ GetError() [3/3]

template<typename ValueType , typename ErrorType >
const ErrorType & TValueOrError< ValueType, ErrorType >::GetError ( ) const &
inline

Definition at line 98 of file ValueOrError.h.

◆ GetValue() [1/3]

template<typename ValueType , typename ErrorType >
ValueType & TValueOrError< ValueType, ErrorType >::GetValue ( ) &
inline

Access the value. Asserts if this does not have a value.

Definition at line 131 of file ValueOrError.h.

◆ GetValue() [2/3]

template<typename ValueType , typename ErrorType >
ValueType TValueOrError< ValueType, ErrorType >::GetValue ( ) &&
inline

Definition at line 133 of file ValueOrError.h.

◆ GetValue() [3/3]

template<typename ValueType , typename ErrorType >
const ValueType & TValueOrError< ValueType, ErrorType >::GetValue ( ) const &
inline

Definition at line 132 of file ValueOrError.h.

◆ HasError()

template<typename ValueType , typename ErrorType >
bool TValueOrError< ValueType, ErrorType >::HasError ( ) const
inline

Whether the error is set. An error does imply no value. No error does not imply that a value is set.

Definition at line 94 of file ValueOrError.h.

◆ HasValue()

template<typename ValueType , typename ErrorType >
bool TValueOrError< ValueType, ErrorType >::HasValue ( ) const
inline

Whether the value is set. A value does imply no error. No value does not imply that an error is set.

Definition at line 128 of file ValueOrError.h.

◆ IsValid()

template<typename ValueType , typename ErrorType >
bool TValueOrError< ValueType, ErrorType >::IsValid ( ) const
inline

Check whether a value is set. Prefer HasValue and HasError to this. !IsValid() does not imply HasError().

Definition at line 91 of file ValueOrError.h.

◆ StealError()

template<typename ValueType , typename ErrorType >
ErrorType TValueOrError< ValueType, ErrorType >::StealError ( )
inline

Steal the error. Asserts if this does not have an error. This causes the error to be unset.

Definition at line 120 of file ValueOrError.h.

◆ StealValue()

template<typename ValueType , typename ErrorType >
ValueType TValueOrError< ValueType, ErrorType >::StealValue ( )
inline

Steal the value. Asserts if this does not have a value. This causes the value to be unset.

Definition at line 140 of file ValueOrError.h.

◆ TryGetError() [1/2]

template<typename ValueType , typename ErrorType >
ErrorType * TValueOrError< ValueType, ErrorType >::TryGetError ( )
inline

Access the error if it is set.

Definition at line 102 of file ValueOrError.h.

◆ TryGetError() [2/2]

template<typename ValueType , typename ErrorType >
const ErrorType * TValueOrError< ValueType, ErrorType >::TryGetError ( ) const
inline

Definition at line 110 of file ValueOrError.h.

◆ TryGetValue() [1/2]

template<typename ValueType , typename ErrorType >
ValueType * TValueOrError< ValueType, ErrorType >::TryGetValue ( )
inline

Access the value if it is set.

Definition at line 136 of file ValueOrError.h.

◆ TryGetValue() [2/2]

template<typename ValueType , typename ErrorType >
const ValueType * TValueOrError< ValueType, ErrorType >::TryGetValue ( ) const
inline

Definition at line 137 of file ValueOrError.h.

Member Data Documentation

◆ Variant

template<typename ValueType , typename ErrorType >
TVariant<ValueType, FWrapErrorType, FEmptyType> TValueOrError< ValueType, ErrorType >::Variant
private

Definition at line 148 of file ValueOrError.h.


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