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

#include <arg_router/policy/short_form_expander.hpp>

Public Member Functions

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, [[maybe_unused]] parsing::parse_target &target, [[maybe_unused]] const Parents &... parents) const
 

Static Public Attributes

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

Detailed Description

template<typename = void>
class arg_router::policy::short_form_expander_t< typename >

Policy implementing a pre-parse phase that expands a collapsed short-form raw token into multiple parsing::token_type instances.

This is provided for node implementers, so this behaviour can be re-used amongst flag-like nodes - library users should not use it (you will likely break your node's parsing behaviour if it has a short name policy).

Definition at line 24 of file short_form_expander.hpp.

Member Function Documentation

◆ pre_parse_phase()

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

Performs the expansion in the pre-parse phase.

Checks if the token's first character matches the owning node's short name. If there isn't a match or the owner does not have short name policy then it just returns false. Otherwise all the characters in the token are converted into short form tokens, added to tokens.

Note
If a short-form expander is used, the long and short prefixes must be different
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
Always returns true because if the token doesn't match the short form name, the node may have a long form one that does. No exception is stored in the return value

Definition at line 49 of file short_form_expander.hpp.

Member Data Documentation

◆ priority

template<typename = void>
constexpr static auto arg_router::policy::short_form_expander_t< typename >::priority = std::size_t{900}
staticconstexpr

Policy priority.

Definition at line 28 of file short_form_expander.hpp.


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