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

Partial specialisation of ActionCtx used for intermediate pipeline steps. More...

#include <action.hh>

Public Member Functions

template<class T>
 ActionCtx (const ActionCtx< T > &other)
 Constructs from a typed ActionCtx<T>, copying the counters.
 ActionCtx ()=default

Public Attributes

size_t index {}
 Zero-based index into argv of the current token.
size_t occurrences {}
 Number of times the parent option token has appeared.
size_t nargs {}
 Number of values in this option occurrence.
size_t value_index {}
 0-based index of current value in this occurrence.
size_t total_values {}
 Total values across all occurrences of this option.
std::reference_wrapper< void > arg
 Reference to the argument's storage value.

Detailed Description

Partial specialisation of ActionCtx used for intermediate pipeline steps.

Conversion and validation actions do not have access to the final storage; they receive ActionCtx<void> which carries only the positional counters. This specialisation also provides a converting constructor from ActionCtx<T> so that the parser can downcast when invoking non-terminal actions.

Definition at line 268 of file action.hh.

Constructor & Destructor Documentation

◆ ActionCtx() [1/2]

template<class T>
cli::ActionCtx< void >::ActionCtx ( const ActionCtx< T > & other)
inline

Constructs from a typed ActionCtx<T>, copying the counters.

Template Parameters
TThe storage type of the source context.
Parameters
otherThe source context to copy counters from.

Definition at line 284 of file action.hh.

◆ ActionCtx() [2/2]

cli::ActionCtx< void >::ActionCtx ( )
default

Member Data Documentation

◆ arg

std::reference_wrapper<void> cli::ActionCtx< void >::arg

Reference to the argument's storage value.

Definition at line 255 of file action.hh.

◆ index

size_t cli::ActionCtx< void >::index {}

Zero-based index into argv of the current token.

Definition at line 269 of file action.hh.

◆ nargs

size_t cli::ActionCtx< void >::nargs {}

Number of values in this option occurrence.

Definition at line 272 of file action.hh.

◆ occurrences

size_t cli::ActionCtx< void >::occurrences {}

Number of times the parent option token has appeared.

Definition at line 271 of file action.hh.

◆ total_values

size_t cli::ActionCtx< void >::total_values {}

Total values across all occurrences of this option.

Definition at line 275 of file action.hh.

◆ value_index

size_t cli::ActionCtx< void >::value_index {}

0-based index of current value in this occurrence.

Definition at line 273 of file action.hh.


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