arg_router  1.4.0
C++ command line argument parsing and routing
arg_router::policy::alias_t< AliasedPolicies > Class Template Reference

#include <arg_router/policy/alias.hpp>

Inheritance diagram for arg_router::policy::alias_t< AliasedPolicies >:
[legend]

Public Types

using aliased_policies_type = std::tuple< std::decay_t< AliasedPolicies >... >
 

Public Member Functions

constexpr alias_t ([[maybe_unused]] const AliasedPolicies &... policies)
 
template<typename ProcessedTarget , typename... Parents>
parsing::pre_parse_result pre_parse_phase (parsing::dynamic_token_adapter &tokens, [[maybe_unused]] utility::compile_time_optional< ProcessedTarget > processed_target, parsing::parse_target &target, const Parents &... parents) const
 

Static Public Attributes

constexpr static auto priority = std::size_t{100}
 

Detailed Description

template<typename... AliasedPolicies>
class arg_router::policy::alias_t< AliasedPolicies >

Allows the 'aliasing' of arguments, i.e. a single argument will set multiple others.

Note
An aliased argument cannot be routed, it's aliased arguments are set instead
Template Parameters
AliasedPoliciesPack of policies to alias

Definition at line 22 of file alias.hpp.

Member Typedef Documentation

◆ aliased_policies_type

template<typename... AliasedPolicies>
using arg_router::policy::alias_t< AliasedPolicies >::aliased_policies_type = std::tuple<std::decay_t<AliasedPolicies>...>

Tuple of policy types.

Definition at line 26 of file alias.hpp.

Constructor & Destructor Documentation

◆ alias_t()

template<typename... AliasedPolicies>
constexpr arg_router::policy::alias_t< AliasedPolicies >::alias_t ( [[maybe_unused] ] const AliasedPolicies &...  policies)
inlineexplicitconstexpr

Constructor.

Parameters
policiesPolicy instances

Definition at line 35 of file alias.hpp.

Member Function Documentation

◆ pre_parse_phase()

template<typename... AliasedPolicies>
template<typename ProcessedTarget , typename... Parents>
parsing::pre_parse_result arg_router::policy::alias_t< AliasedPolicies >::pre_parse_phase ( parsing::dynamic_token_adapter tokens,
[[maybe_unused] ] utility::compile_time_optional< ProcessedTarget >  processed_target,
parsing::parse_target target,
const Parents &...  parents 
) const
inline

Duplicates any value tokens as aliases of other nodes.

The token duplication mechanism has two approaches, depending on the owning node's fixed count:

  • If the count is zero then it is flag-like so the aliased names are just appended to the processed part of tokens
  • If the count is greater than zero then it is argument-like and the aliased names are appended to the processed part of tokens, each followed by count tokens (i.e. the values)

In either circumstance the original tokens are removed as they are for the alias, rather than the aliased.

Template Parameters
ProcessedTargetprocessed_target payload type
ParentsPack of parent tree nodes in ascending ancestry order
Parameters
tokensCurrently processed tokens
processed_targetPreviously processed parse_target of parent node, or empty is there is no non-root parent
targetPre-parse generated target
parentsParent node instances
Returns
Either true if successful, or a multi_lang_exception if there too few value tokens

Definition at line 60 of file alias.hpp.

Member Data Documentation

◆ priority

template<typename... AliasedPolicies>
constexpr static auto arg_router::policy::alias_t< AliasedPolicies >::priority = std::size_t{100}
staticconstexpr

Policy priority.

Definition at line 29 of file alias.hpp.


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