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

#include <arg_router/policy/runtime_enable.hpp>

Public Member Functions

 runtime_enable (bool enable) noexcept
 
bool runtime_enabled () const noexcept
 
template<typename ProcessedTarget , typename... Parents>
parsing::pre_parse_result pre_parse_phase ([[maybe_unused]] 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{800}
 

Detailed Description

template<typename T = void>
class arg_router::policy::runtime_enable< T >

Policy that allows a node to be ignored during the parse phase depending upon it's runtime constructor argument.

This policy allows nodes or entire modes of a parse tree to be disabled, for example a feature may not be available on a particular application license type - this policy can hide the feature from the user.

This policy does not affect the arguments dispatched to appropriate router, so values associated with disabled nodes come from an attached policy::default_value or a default constructed instance if no policy::default_value is attached.

Definition at line 24 of file runtime_enable.hpp.

Constructor & Destructor Documentation

◆ runtime_enable()

template<typename T = void>
arg_router::policy::runtime_enable< T >::runtime_enable ( bool  enable)
inlineexplicitnoexcept

Constructor.

Parameters
enableTrue to enable the node

Definition at line 34 of file runtime_enable.hpp.

Member Function Documentation

◆ pre_parse_phase()

template<typename T = void>
template<typename ProcessedTarget , typename... Parents>
parsing::pre_parse_result arg_router::policy::runtime_enable< T >::pre_parse_phase ( [[maybe_unused] ] 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

Calls the enabled_type function object and skips further processing for the token parsing if disabled.

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
parsing::pre_parse_action::valid_node if enabled, otherwise parsing::pre_parse_action::skip_node

Definition at line 53 of file runtime_enable.hpp.

◆ runtime_enabled()

template<typename T = void>
bool arg_router::policy::runtime_enable< T >::runtime_enabled ( ) const
inlinenoexcept
Returns
Enabled state

Definition at line 37 of file runtime_enable.hpp.

Member Data Documentation

◆ priority

template<typename T = void>
constexpr static auto arg_router::policy::runtime_enable< T >::priority = std::size_t{800}
staticconstexpr

Policy priority.

Definition at line 28 of file runtime_enable.hpp.


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