arg_router  1.4.0
C++ command line argument parsing and routing
arg_router::counting_flag_t< T, Policies > Class Template Reference

#include <arg_router/counting_flag.hpp>

Inheritance diagram for arg_router::counting_flag_t< T, Policies >:
[legend]

Public Types

using value_type = T
 
template<bool Flatten>
using help_data_type = typename parent_type::template default_leaf_help_data_type< Flatten >
 
- Public Types inherited from arg_router::tree_node< policy::multi_stage_value< T, bool >, policy::min_max_count_t< traits::integral_constant< std::size_t{0}>, traits::integral_constant< std::size_t{0}> >, std::decay_t< Policies >... >
using parameters_type = std::tuple< std::decay_t< Params >... >
 
using policies_type = boost::mp11::mp_filter< policy::is_policy, parameters_type >
 
using priority_ordered_policies_type = boost::mp11::mp_sort< policies_type, priority_order >
 
using children_type = boost::mp11::mp_filter< is_tree_node, std::decay_t< decltype(list_expander(std::declval< std::decay_t< Params > >()...))> >
 
using phase_finder_t = typename phase_finder< PolicyChecker, Args... >::type
 

Public Member Functions

constexpr counting_flag_t (Policies... policies) noexcept
 
template<typename... Parents>
bool parse ([[maybe_unused]] parsing::parse_target &&target, [[maybe_unused]] const Parents &... parents) const noexcept
 
- Public Member Functions inherited from arg_router::tree_node< policy::multi_stage_value< T, bool >, policy::min_max_count_t< traits::integral_constant< std::size_t{0}>, traits::integral_constant< std::size_t{0}> >, std::decay_t< Policies >... >
children_typechildren () noexcept
 
constexpr const children_typechildren () const noexcept
 

Additional Inherited Members

- Static Public Attributes inherited from arg_router::tree_node< policy::multi_stage_value< T, bool >, policy::min_max_count_t< traits::integral_constant< std::size_t{0}>, traits::integral_constant< std::size_t{0}> >, std::decay_t< Policies >... >
constexpr static auto is_named
 
constexpr static bool any_phases_v
 
- Protected Member Functions inherited from arg_router::tree_node< policy::multi_stage_value< T, bool >, policy::min_max_count_t< traits::integral_constant< std::size_t{0}>, traits::integral_constant< std::size_t{0}> >, std::decay_t< Policies >... >
constexpr tree_node (Params... params) noexcept
 
std::optional< parsing::parse_targetpre_parse (parsing::pre_parse_data< Validator, HasTarget > pre_parse_data, const Node &node, const Parents &... parents) const
 
auto parse (std::string_view token, const Node &node, const Parents &... parents) const
 

Detailed Description

template<typename T, typename... Policies>
class arg_router::counting_flag_t< T, Policies >

Represents a flag that can appear multiple times in the command line.

A flag is a boolean indicator, it has no value assigned on the command line, its presence represents a positive boolean value. However a counting flag's value is the number of times it appears on the command line. By default this type does not do short-form name collapsing, add policy::short_form_expander to the policies during construction to enable that.

Create with the counting_flag(Policies...) function for consistency with arg_t.

Template Parameters
TCounting value type, must be explicitly convertible to std::size_t
PoliciesPack of policies that define its behaviour

Definition at line 30 of file counting_flag.hpp.

Member Typedef Documentation

◆ help_data_type

template<typename T , typename... Policies>
template<bool Flatten>
using arg_router::counting_flag_t< T, Policies >::help_data_type = typename parent_type::template default_leaf_help_data_type<Flatten>

Help data type.

Definition at line 62 of file counting_flag.hpp.

◆ value_type

template<typename T , typename... Policies>
using arg_router::counting_flag_t< T, Policies >::value_type = T

Flag value type.

Definition at line 58 of file counting_flag.hpp.

Constructor & Destructor Documentation

◆ counting_flag_t()

template<typename T , typename... Policies>
constexpr arg_router::counting_flag_t< T, Policies >::counting_flag_t ( Policies...  policies)
inlineexplicitconstexprnoexcept

Constructor.

Parameters
policiesPolicy instances

Definition at line 68 of file counting_flag.hpp.

Member Function Documentation

◆ parse()

template<typename T , typename... Policies>
template<typename... Parents>
bool arg_router::counting_flag_t< T, Policies >::parse ( [[maybe_unused] ] parsing::parse_target &&  target,
[[maybe_unused] ] const Parents &...  parents 
) const
inlinenoexcept

Parse function.

Template Parameters
ParentsPack of parent tree nodes in ascending ancestry order
Parameters
targetParse target
parentsParents instances pack
Returns
Parsed result

Definition at line 93 of file counting_flag.hpp.


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