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

#include <arg_router/help.hpp>

Inherits detail::add_missing_formatter_policy::type.

Public Types

template<bool Flatten>
using help_data_type = typename parent_type::template default_leaf_help_data_type< Flatten >
 

Public Member Functions

template<auto has_formatter = detail::add_missing_formatter_policy<Policies...>::has_formatter>
constexpr help_t (Policies... policies, std::enable_if_t< has_formatter > *=nullptr) noexcept
 
template<bool Flatten, typename Node >
runtime_help_data generate_runtime_help_data (const Node &start_node) const noexcept
 
template<typename... Parents>
void parse (parsing::parse_target &&target, const Parents &... parents) const
 

Detailed Description

template<typename... Policies>
class arg_router::help_t< Policies >

Generates the help output.

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

Template Parameters
PoliciesPack of policies that define its behaviour

Definition at line 49 of file help.hpp.

Member Typedef Documentation

◆ help_data_type

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

Help data type.

Definition at line 86 of file help.hpp.

Constructor & Destructor Documentation

◆ help_t()

template<typename... Policies>
template<auto has_formatter = detail::add_missing_formatter_policy<Policies...>::has_formatter>
constexpr arg_router::help_t< Policies >::help_t ( Policies...  policies,
std::enable_if_t< has_formatter > *  = nullptr 
)
inlineexplicitconstexprnoexcept

Constructor.

Parameters
policiesPolicy instances

Definition at line 93 of file help.hpp.

Member Function Documentation

◆ generate_runtime_help_data()

template<typename... Policies>
template<bool Flatten, typename Node >
runtime_help_data arg_router::help_t< Policies >::generate_runtime_help_data ( const Node &  start_node) const
inlinenoexcept

Starting from start_node, iterate down through the tree generating runtime help data.

Template Parameters
FlattenTrue to flatten output
NodeStart node type
Parameters
start_nodeTree node to start generating from
Returns
Runtime help data

Definition at line 136 of file help.hpp.

◆ parse()

template<typename... Policies>
template<typename... Parents>
void arg_router::help_t< Policies >::parse ( parsing::parse_target &&  target,
const Parents &...  parents 
) const
inline

Parse function.

Unless a routing policy is specified, then when parsed the help output is sent to std::cout and std::exit(EXIT_SUCCESS) is called. If a routing policy is called the generated help output is passed to it for further processing and the parse call returns.

Template Parameters
ParentsPack of parent tree nodes in ascending ancestry order
Parameters
targetParse target
parentsParents instances pack
Exceptions
parese_exceptionThrown if the requested mode cannot be found

Definition at line 179 of file help.hpp.


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