arg_router
1.4.0
C++ command line argument parsing and routing
|
#include <arg_router/dependency/alias_group.hpp>
Inherits arg_router::dependency::detail::basic_one_of_t< ParentDocName, Params >.
Classes | |
class | help_data_type |
Public Types | |
using | value_type = boost::mp11::mp_first< typename parent_type::basic_value_type > |
Public Member Functions | |
constexpr | alias_group_t (Params... params) noexcept |
template<typename Validator , bool HasTarget, typename... Parents> | |
std::optional< parsing::parse_target > | pre_parse (parsing::pre_parse_data< Validator, HasTarget > pre_parse_data, const Parents &... parents) const |
Groups child nodes so they all become aliases of a single output.
policy::alias_t defines input aliases, it works by duplicating the input tokens for the node for each of the aliased nodes. An implication of this is that all the aliased nodes need to have the same count and be able to parse the same input tokens, and each aliased node has an entry (but not the node the alias policy is attached to!) in the router arguments.
alias_group_t is almost the opposite of this; it defines output aliases where each child of the group independently parses the tokens it matches to (in the same way one_of_t does). However unlike policy::alias_t, there is only a single entry in the router arguments for the whole group, as such there is a compile-time check that all value_type
types are the same (or ignored if policy::no_result_value is used). In other words, all the children of the group represent the same output.
You can think of policy::alias_t as defining a one-to-many alias, whilst alias_group_t is a many-to-one.
Params | Policies and child node types for the mode |
Definition at line 34 of file alias_group.hpp.
using arg_router::dependency::alias_group_t< Params >::value_type = boost::mp11::mp_first<typename parent_type::basic_value_type> |
The common output type of the all the children that support it.
Definition at line 43 of file alias_group.hpp.
|
inlineexplicitconstexprnoexcept |
Constructor.
params | Policy and child instances |
Definition at line 94 of file alias_group.hpp.
|
inline |
Propagates the pre-parse phase to the child, returns on a positive return from one of them.
Validator | Validator type |
HasTarget | True if pre_parse_data contains the parent's parse_target |
Parents | Pack of parent tree nodes in ascending ancestry order |
pre_parse_data | Pre-parse data aggregate |
parents | Parent node instances |
multi_lang_exception | Thrown if any of the child pre-parse implementations have returned an exception |
Definition at line 112 of file alias_group.hpp.