Apparatus Version 1.23
ECS data-oriented workflow for Unreal Engine.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
THarshOutcome< PayloadT > Struct Template Reference

Harsh outcome with no status but an optional payload. More...

#include <ApparatusStatus.h>

Inheritance diagram for THarshOutcome< PayloadT >:
Inheritance graph
[legend]
Collaboration diagram for THarshOutcome< PayloadT >:
Collaboration graph
[legend]

Public Types

using PayloadType = PayloadT
 The type of the payload.
 

Public Member Functions

constexpr EApparatusStatus ToStatus () const
 Convert to a status constant.
 
constexpr bool IsNoop () const
 Check if the outcome is a noop.
 
THarshOutcomeMapStatus (const EApparatusStatus From, const EApparatusStatus To)
 Map the status from a status to a status.
 
constexpr PayloadT GetPayload () const
 Get the payload of the outcome.
 
template<typename T >
THarshOutcome< TStaticCast ()
 Cast the payload statically.
 
THarshOutcome< PayloadT & > Dereference ()
 Dereference.
 
constexpr operator EApparatusStatus () const
 Convert to a successful status.
 
constexpr operator PayloadT () const
 Convert to a payload.
 
auto operator-> () const
 A non-empty outcomes serves as a pointer to its payload by default.
 
constexpr const PayloadT & operator* () const
 Get a constant reference to a payload.
 
constexpr PayloadT & operator* ()
 Get a reference to a payload.
 
constexpr bool IsOK () const
 Convert to successful state for using in a conditional expression.
 
bool operator== (const PayloadT &Other) const
 
bool operator!= (const PayloadT &Other) const
 
THarshOutcomeoperator+= (const THarshOutcome &)
 
THarshOutcomeoperator+= (const EApparatusStatus InStatus)
 
THarshOutcome operator+ (const EApparatusStatus InStatus) const
 
FString ToString () const
 
template<typename InPayloadT >
constexpr THarshOutcome (InPayloadT &&InPayload)
 Initialize a harsh outcome using payload only.
 
 THarshOutcome (const EApparatusStatus InStatus)
 Initialize a harsh outcome using a status and a default payload.
 
template<typename InPayloadT >
 THarshOutcome (const EApparatusStatus InStatus, InPayloadT &&InPayload)
 Initialize a harsh outcome using a status and moving a payload.
 
template<typename InPayloadT >
 THarshOutcome (const TPoliteOutcome< InPayloadT > &InOutcome)
 Convert from a polite outcome.
 
template<typename InPayloadT >
 THarshOutcome (TPoliteOutcome< InPayloadT > &&InOutcome)
 Move a polite outcome to a harsh one.
 
template<typename InAnyPayloadT , typename InPayloadT >
constexpr THarshOutcome (const THarshOutcome< InAnyPayloadT > &InOutcome, InPayloadT &&InPayload)
 Initialize a harsh outcome using a harsh outcome and a payload override.
 

Static Public Member Functions

static constexpr THarshOutcome< PayloadT > Success (const PayloadT &InPayload)
 A constant denoting a successful operation outcome.
 
static constexpr THarshOutcome< PayloadT > Noop (const PayloadT &InPayload)
 A constant denoting a successful skip of any actions.
 

Public Attributes

PayloadT Payload
 The payload of the outcome.
 

Detailed Description

template<typename PayloadT>
struct THarshOutcome< PayloadT >

Harsh outcome with no status but an optional payload.

Template Parameters
PayloadTThe optional payload to provide.

Member Typedef Documentation

◆ PayloadType

template<typename PayloadT >
using THarshOutcome< PayloadT >::PayloadType = PayloadT

The type of the payload.

Constructor & Destructor Documentation

◆ THarshOutcome() [1/6]

template<typename PayloadT >
template<typename InPayloadT >
constexpr THarshOutcome< PayloadT >::THarshOutcome ( InPayloadT &&  InPayload)
inlineconstexpr

Initialize a harsh outcome using payload only.

Template Parameters
InPayloadTThe payload type.
Parameters
InPayloadThe payload to move.

◆ THarshOutcome() [2/6]

template<typename PayloadT >
THarshOutcome< PayloadT >::THarshOutcome ( const EApparatusStatus  InStatus)
inline

Initialize a harsh outcome using a status and a default payload.

Template Parameters
InPayloadTThe payload type.
Parameters
InStatusThe status to initialize with. Must be a successful one.

◆ THarshOutcome() [3/6]

template<typename PayloadT >
template<typename InPayloadT >
THarshOutcome< PayloadT >::THarshOutcome ( const EApparatusStatus  InStatus,
InPayloadT &&  InPayload 
)
inline

Initialize a harsh outcome using a status and moving a payload.

Template Parameters
InPayloadTThe payload type.
Parameters
InStatusThe status to initialize with. Must be a successful one.
InPayloadThe payload to move.

◆ THarshOutcome() [4/6]

template<typename PayloadT >
template<typename InPayloadT >
THarshOutcome< PayloadT >::THarshOutcome ( const TPoliteOutcome< InPayloadT > &  InOutcome)
inline

Convert from a polite outcome.

Will assert the outcome is a successful one.

Template Parameters
InPayloadTThe type of the payload carried by the passed-in outcome.
Parameters
InOutcomeThe polite outcome to convert from. Must be a successful one.

◆ THarshOutcome() [5/6]

template<typename PayloadT >
template<typename InPayloadT >
THarshOutcome< PayloadT >::THarshOutcome ( TPoliteOutcome< InPayloadT > &&  InOutcome)
inline

Move a polite outcome to a harsh one.

Will assert the outcome is a successful one.

Template Parameters
InPayloadTThe type of the payload carried by the passed-in outcome.
Parameters
InOutcomeThe polite outcome to move. Must be a successful one.

◆ THarshOutcome() [6/6]

template<typename PayloadT >
template<typename InAnyPayloadT , typename InPayloadT >
constexpr THarshOutcome< PayloadT >::THarshOutcome ( const THarshOutcome< InAnyPayloadT > &  InOutcome,
InPayloadT &&  InPayload 
)
inlineconstexpr

Initialize a harsh outcome using a harsh outcome and a payload override.

Template Parameters
InAnyPayloadTThe payload type of the incoming outcome. This is used for deduction only ignored.
Parameters
InOutcomeThe outcome to initialize from. This is basically ignored here.
InPayloadThe payload override to initialize with.

Member Function Documentation

◆ Dereference()

template<typename PayloadT >
THarshOutcome< PayloadT & > THarshOutcome< PayloadT >::Dereference ( )
inline

Dereference.

◆ GetPayload()

template<typename PayloadT >
constexpr PayloadT THarshOutcome< PayloadT >::GetPayload ( ) const
inlineconstexpr

Get the payload of the outcome.

◆ IsNoop()

template<typename PayloadT >
constexpr bool THarshOutcome< PayloadT >::IsNoop ( ) const
inlineconstexpr

Check if the outcome is a noop.

◆ IsOK()

template<typename PayloadT >
constexpr bool THarshOutcome< PayloadT >::IsOK ( ) const
inlineconstexpr

Convert to successful state for using in a conditional expression.

This always return true, since every harsh result is already a success.

Returns
The state of examination.

◆ MapStatus()

template<typename PayloadT >
THarshOutcome & THarshOutcome< PayloadT >::MapStatus ( const EApparatusStatus  From,
const EApparatusStatus  To 
)
inline

Map the status from a status to a status.

Parameters
FromThe status to map from.
ToThe status to map to.
Returns
Returns itself.

◆ Noop()

template<typename PayloadT >
static constexpr THarshOutcome< PayloadT > THarshOutcome< PayloadT >::Noop ( const PayloadT &  InPayload)
inlinestaticconstexpr

A constant denoting a successful skip of any actions.

Parameters
InPayloadThe payload to initialize with.

◆ operator EApparatusStatus()

template<typename PayloadT >
constexpr THarshOutcome< PayloadT >::operator EApparatusStatus ( ) const
inlineexplicitconstexpr

Convert to a successful status.

This operation should always be an explicit one for a harsh outcome, since the user should absolutely be aware of what he's actually doing.

◆ operator PayloadT()

template<typename PayloadT >
constexpr THarshOutcome< PayloadT >::operator PayloadT ( ) const
inlineconstexpr

Convert to a payload.

This operator is an implicit one to be able to use the valuable outcome in place of a value itself.

◆ operator!=()

template<typename PayloadT >
bool THarshOutcome< PayloadT >::operator!= ( const PayloadT &  Other) const
inline

◆ operator*() [1/2]

template<typename PayloadT >
constexpr PayloadT & THarshOutcome< PayloadT >::operator* ( )
inlineconstexpr

Get a reference to a payload.

◆ operator*() [2/2]

template<typename PayloadT >
constexpr const PayloadT & THarshOutcome< PayloadT >::operator* ( ) const
inlineconstexpr

Get a constant reference to a payload.

◆ operator+()

template<typename PayloadT >
THarshOutcome THarshOutcome< PayloadT >::operator+ ( const EApparatusStatus  InStatus) const
inline

◆ operator+=() [1/2]

template<typename PayloadT >
THarshOutcome & THarshOutcome< PayloadT >::operator+= ( const EApparatusStatus  InStatus)
inline

◆ operator+=() [2/2]

template<typename PayloadT >
THarshOutcome & THarshOutcome< PayloadT >::operator+= ( const THarshOutcome< PayloadT > &  )
inline

◆ operator->()

template<typename PayloadT >
auto THarshOutcome< PayloadT >::operator-> ( ) const
inline

A non-empty outcomes serves as a pointer to its payload by default.

◆ operator==()

template<typename PayloadT >
bool THarshOutcome< PayloadT >::operator== ( const PayloadT &  Other) const
inline

◆ StaticCast()

template<typename PayloadT >
template<typename T >
THarshOutcome< T > THarshOutcome< PayloadT >::StaticCast ( )
inline

Cast the payload statically.

Template Parameters
Thetype to cast to.

◆ Success()

template<typename PayloadT >
static constexpr THarshOutcome< PayloadT > THarshOutcome< PayloadT >::Success ( const PayloadT &  InPayload)
inlinestaticconstexpr

A constant denoting a successful operation outcome.

Parameters
InPayloadThe payload to initialize with.

◆ ToStatus()

template<typename PayloadT >
constexpr EApparatusStatus THarshOutcome< PayloadT >::ToStatus ( ) const
inlineconstexpr

Convert to a status constant.

Returns
EApparatusStatus::Success Every harsh outcome is considered to be a success by default.

◆ ToString()

template<typename PayloadT >
FString THarshOutcome< PayloadT >::ToString ( ) const
inline

Member Data Documentation

◆ Payload

template<typename PayloadT >
PayloadT THarshOutcome< PayloadT >::Payload

The payload of the outcome.


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