arg_router  1.4.0
C++ command line argument parsing and routing
arg_router::dependency::one_of_t< Params > Class Template Reference

#include <arg_router/dependency/one_of.hpp>

Inherits arg_router::dependency::detail::basic_one_of_t< ParentDocName, Params >.

Classes

class  help_data_type
 

Public Types

using value_type = std::conditional_t<(std::variant_size_v< variant_type >==1), std::variant_alternative_t< 0, variant_type >, variant_type >
 

Public Member Functions

constexpr one_of_t (Params... params) noexcept
 
template<typename Validator , bool HasTarget, typename... Parents>
std::optional< parsing::parse_targetpre_parse (parsing::pre_parse_data< Validator, HasTarget > pre_parse_data, const Parents &... parents) const
 

Detailed Description

template<typename... Params>
class arg_router::dependency::one_of_t< Params >

Groups child nodes such that any one can be used on the command line, but only one.

The value_type is a variant of all the policies' value_types that are not derived from policy::no_result_value. If that list is only a single type, then it collapses into just that type (i.e. it won't be a variant containing a single type).

Template Parameters
ParamsPolicies and child node types for the mode

Definition at line 20 of file one_of.hpp.

Member Typedef Documentation

◆ value_type

template<typename... Params>
using arg_router::dependency::one_of_t< Params >::value_type = std::conditional_t<(std::variant_size_v<variant_type> == 1), std::variant_alternative_t<0, variant_type>, variant_type>

A variant of the child value_types, or just the value_type if there is only a single child.

Definition at line 42 of file one_of.hpp.

Constructor & Destructor Documentation

◆ one_of_t()

template<typename... Params>
constexpr arg_router::dependency::one_of_t< Params >::one_of_t ( Params...  params)
inlineexplicitconstexprnoexcept

Constructor.

Parameters
paramsPolicy and child instances

Definition at line 69 of file one_of.hpp.

Member Function Documentation

◆ pre_parse()

template<typename... Params>
template<typename Validator , bool HasTarget, typename... Parents>
std::optional<parsing::parse_target> arg_router::dependency::one_of_t< Params >::pre_parse ( parsing::pre_parse_data< Validator, HasTarget >  pre_parse_data,
const Parents &...  parents 
) const
inline

Propagates the pre-parse phase to the child, returns on a positive return from one of them.

Template Parameters
ValidatorValidator type
HasTargetTrue if pre_parse_data contains the parent's parse_target
ParentsPack of parent tree nodes in ascending ancestry order
Parameters
pre_parse_dataPre-parse data aggregate
parentsParent node instances
Returns
Non-empty if the leading tokens in args are consumable by this node
Exceptions
multi_lang_exceptionThrown if any of the child pre-parse implementations have returned an exception, or if called more than once resolving to different children (i.e. a "one of" violation)

Definition at line 84 of file one_of.hpp.


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