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

#include <arg_router/flag.hpp>

Inheritance diagram for arg_router::flag_t< Policies >:
[legend]

Public Types

using value_type = bool
 
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::default_value< 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 flag_t (Policies... policies) noexcept
 
template<typename... Parents>
value_type parse ([[maybe_unused]] parsing::parse_target &&target, [[maybe_unused]] const Parents &... parents) const
 
- Public Member Functions inherited from arg_router::tree_node< policy::default_value< 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::default_value< 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::default_value< 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... Policies>
class arg_router::flag_t< Policies >

Represents a flag 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. It has a default value of false and a fixed count of 0. 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 flag(Policies...) function for consistency with arg_t.

Template Parameters
PoliciesPack of policies that define its behaviour

Definition at line 29 of file flag.hpp.

Member Typedef Documentation

◆ help_data_type

template<typename... Policies>
template<bool Flatten>
using arg_router::flag_t< Policies >::help_data_type = typename parent_type::template default_leaf_help_data_type<Flatten>

Help data type.

Definition at line 58 of file flag.hpp.

◆ value_type

template<typename... Policies>
using arg_router::flag_t< Policies >::value_type = bool

Flag value type.

Definition at line 54 of file flag.hpp.

Constructor & Destructor Documentation

◆ flag_t()

template<typename... Policies>
constexpr arg_router::flag_t< Policies >::flag_t ( Policies...  policies)
inlineexplicitconstexprnoexcept

Constructor.

Parameters
policiesPolicy instances

Definition at line 64 of file flag.hpp.

Member Function Documentation

◆ parse()

template<typename... Policies>
template<typename... Parents>
value_type arg_router::flag_t< Policies >::parse ( [[maybe_unused] ] parsing::parse_target &&  target,
[[maybe_unused] ] const Parents &...  parents 
) const
inline

Parse function.

Template Parameters
ParentsPack of parent tree nodes in ascending ancestry order
Parameters
targetParse target
parentsParents instances pack
Returns
Parsed result
Exceptions
multi_lang_exceptionThrown if routing phase failed

Definition at line 90 of file flag.hpp.


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