cli20 0.1.2
A C++20 typed-schema command-line parser
Loading...
Searching...
No Matches
cli::ActionResult< void > Struct Reference

Specialisation of ActionResult for terminal (pack) actions that produce no value. More...

#include <action.hh>

Public Types

enum class  State : std::uint8_t { ok , error , ignore }
using value_type = void

Public Member Functions

constexpr operator bool () const noexcept
 Returns true when the result represents success.
constexpr auto have_value () const noexcept -> bool
 Returns true when the result represents success.
constexpr auto has_value () const noexcept -> bool
 Returns true when the result represents success.
constexpr auto has_error () const noexcept -> bool
 Returns true when the result represents failure.
constexpr auto is_ignored () const noexcept -> bool
 Returns true when the result represents an ignored step.

Static Public Member Functions

static constexpr auto ok () -> ActionResult< void >
 Creates a success result.
static constexpr auto fail (ParseError e) -> ActionResult< void >
 Creates a failure result carrying error.
static constexpr auto ignore () -> ActionResult< void >
 Creates an ignore result.

Public Attributes

State state {State::ok}
ParseError error {}
void value

Detailed Description

Specialisation of ActionResult for terminal (pack) actions that produce no value.

Pack actions such as SetTrue or Push write their result directly into the argument storage referenced by ActionCtx::arg; they do not pass a value downstream, so ActionResult<void> carries only an error, success, or ignore state.

Definition at line 124 of file action.hh.

Member Typedef Documentation

◆ value_type

using cli::ActionResult< void >::value_type = void

Definition at line 125 of file action.hh.

Member Enumeration Documentation

◆ State

enum class cli::ActionResult< void >::State : std::uint8_t
strong
Enumerator
ok 
error 
ignore 

Definition at line 127 of file action.hh.

Member Function Documentation

◆ fail()

constexpr auto cli::ActionResult< void >::fail ( ParseError e) -> ActionResult< void >
inlinestaticnodiscardconstexpr

Creates a failure result carrying error.

Parameters
eThe error to store.
Returns
A failed ActionResult<void>.

Definition at line 172 of file action.hh.

◆ has_error()

auto cli::ActionResult< void >::has_error ( ) const -> bool
inlinenodiscardconstexprnoexcept

Returns true when the result represents failure.

Definition at line 148 of file action.hh.

◆ has_value()

auto cli::ActionResult< void >::has_value ( ) const -> bool
inlinenodiscardconstexprnoexcept

Returns true when the result represents success.

Definition at line 143 of file action.hh.

◆ have_value()

auto cli::ActionResult< void >::have_value ( ) const -> bool
inlinenodiscardconstexprnoexcept

Returns true when the result represents success.

Definition at line 138 of file action.hh.

◆ ignore()

constexpr auto cli::ActionResult< void >::ignore ( ) -> ActionResult< void >
inlinestaticnodiscardconstexpr

Creates an ignore result.

Returns
An ignored ActionResult<void>.

Definition at line 181 of file action.hh.

◆ is_ignored()

auto cli::ActionResult< void >::is_ignored ( ) const -> bool
inlinenodiscardconstexprnoexcept

Returns true when the result represents an ignored step.

Definition at line 153 of file action.hh.

◆ ok()

constexpr auto cli::ActionResult< void >::ok ( ) -> ActionResult< void >
inlinestaticnodiscardconstexpr

Creates a success result.

Returns
A successful ActionResult<void>.

Definition at line 162 of file action.hh.

◆ operator bool()

cli::ActionResult< void >::operator bool ( ) const
inlineexplicitnodiscardconstexprnoexcept

Returns true when the result represents success.

Definition at line 133 of file action.hh.

Member Data Documentation

◆ error

ParseError cli::ActionResult< void >::error {}

Definition at line 130 of file action.hh.

◆ state

State cli::ActionResult< void >::state {State::ok}

Definition at line 129 of file action.hh.

◆ value

void cli::ActionResult< void >::value

Definition at line 55 of file action.hh.


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