|
arg_router
1.4.0
C++ command line argument parsing and routing
|
Namespaces | |
| algorithm | |
| config | |
| dependency | |
| math | |
| multi_lang | |
| parsing | |
| policy | |
| traits | |
| utility | |
Classes | |
| class | arg_t |
| class | counting_flag_t |
| struct | default_error_code_translations |
| class | multi_lang_exception |
| class | parse_exception |
| class | flag_t |
| class | forwarding_arg_t |
| class | help_t |
| class | list |
| class | mode_t |
| class | multi_arg_t |
| class | multi_arg_base_t |
| struct | parser |
| class | add_missing_min_max_policy |
| class | positional_arg_t |
| class | root_t |
| class | tree_node |
| struct | runtime_help_data |
| struct | is_tree_node |
Typedefs | |
| using | string = std::basic_string< char, std::char_traits< char >, config::allocator< char > > |
| using | ostringstream = std::basic_ostringstream< char, std::char_traits< char >, config::allocator< char > > |
| template<typename T > | |
| using | vector = std::vector< T, config::allocator< T > > |
| template<typename T , auto Extent = nonstd::span_lite::dynamic_extent> | |
| using | span = nonstd::span_lite::span< T, Extent > |
Enumerations | |
| enum class | error_code : std::size_t { unknown_argument = 0 , unhandled_arguments , argument_has_already_been_set , failed_to_parse , no_arguments_passed , minimum_value_not_reached , maximum_value_exceeded , minimum_count_not_reached , maximum_count_exceeded , unknown_argument_with_suggestion , mode_requires_arguments = 100 , missing_required_argument , too_few_values_for_alias , dependent_argument_missing , one_of_selected_type_mismatch , missing_value_separator } |
Functions | |
| template<typename T , typename... Policies> | |
| constexpr auto | arg (Policies... policies) noexcept |
| template<typename T , typename... Policies> | |
| constexpr auto | counting_flag (Policies... policies) noexcept |
| template<typename... Policies> | |
| constexpr auto | flag (Policies... policies) noexcept |
| template<typename... Policies> | |
| constexpr auto | forwarding_arg (Policies... policies) noexcept |
| template<typename... Policies> | |
| constexpr auto | help (Policies... policies) noexcept |
| template<typename... Params> | |
| constexpr auto | list_expander (Params... params) noexcept |
| template<typename... Params> | |
| constexpr auto | list_expander (std::tuple< Params... > params) noexcept |
| template<typename... Params> | |
| constexpr auto | mode (Params... params) |
| template<typename T , typename... Policies> | |
| constexpr auto | multi_arg (Policies... policies) noexcept |
| template<typename T , typename... Policies> | |
| constexpr auto | positional_arg (Policies... policies) noexcept |
| template<typename... Params> | |
| constexpr auto | root (Params... params) noexcept |
Variables | |
| template<typename T > | |
| constexpr bool | is_tree_node_v = is_tree_node<T>::value |
| constexpr auto | version_string = "1.4.0" |
Namespace for all arg_router types and functions.
| using arg_router::ostringstream = typedef std::basic_ostringstream<char, std::char_traits<char>, config::allocator<char> > |
arg_router ostringstream.
Same as a std::ostringstream, except that it uses the config::allocator.
Definition at line 31 of file basic_types.hpp.
| using arg_router::span = typedef nonstd::span_lite::span<T, Extent> |
An alias for std::span if compiling with >= C++20 support, otherwise nonstd::span_lite::span.
Definition at line 49 of file basic_types.hpp.
| using arg_router::string = typedef std::basic_string<char, std::char_traits<char>, config::allocator<char> > |
arg_router string.
Same as a std::string, except that it uses the config::allocator.
Definition at line 25 of file basic_types.hpp.
| using arg_router::vector = typedef std::vector<T, config::allocator<T> > |
arg_router vector.
Same as a std::vector, except that it uses the config::allocator.
Definition at line 39 of file basic_types.hpp.
|
strong |
Error code type.
These are used as keys into an error string translation table, either a default internal en_GB one, or user provided.
It can be extended by node or policy developers, but to avoid clashes please start at 1000 or higher, eg:
Definition at line 33 of file exception.hpp.
|
constexprnoexcept |
Constructs an arg_t with the given policies and value type.
This is necessary due to CTAD being required for all template parameters or none, and unfortunately in our case we need T to be explicitly set by the user whilst Policies should be deduced.
Compile-time strings can be passed in directly and will be converted to the appropriate policies automatically. The rules are:
The above are unicode aware. The strings can be passed in any order relative to the other policies, but it is recommended to put them first to ease reading.
| T | Argument value type |
| Policies | Pack of policies that define its behaviour |
| policies | Pack of policy instances |
|
constexprnoexcept |
Constructs a counting_flag_t with the given policies.
Just like 'normal' flags, counting flags with shortnames can be concatenated or 'collapsed' on the command line, e.g.
Compile-time strings can be passed in directly and will be converted to the appropriate policies automatically. The rules are:
The above are unicode aware. The strings can be passed in any order relative to the other policies, but it is recommended to put them first to ease reading.
| Policies | Pack of policies that define its behaviour |
| policies | Pack of policy instances |
Definition at line 144 of file counting_flag.hpp.
|
constexprnoexcept |
Constructs a flag_t with the given policies.
Flags with shortnames can be concatenated or 'collapsed' on the command line, e.g.
Compile-time strings can be passed in directly and will be converted to the appropriate policies automatically. The rules are:
The above are unicode aware. The strings can be passed in any order relative to the other policies, but it is recommended to put them first to ease reading.
| Policies | Pack of policies that define its behaviour |
| policies | Pack of policy instances |
|
constexprnoexcept |
Constructs a forwarding_arg_t with the given policies and value type.
Compile-time strings can be passed in directly and will be converted to the appropriate policies automatically. The rules are:
The above are unicode aware. The strings can be passed in any order relative to the other policies, but it is recommended to put them first to ease reading.
| Policies | Pack of policies that define its behaviour |
| policies | Pack of policy instances |
Definition at line 100 of file forwarding_arg.hpp.
|
constexprnoexcept |
Constructs a help_t with the given policies.
Compile-time strings can be passed in directly and will be converted to the appropriate policies automatically. The rules are:
The above are unicode aware. The strings can be passed in any order relative to the other policies, but it is recommended to put them first to ease reading.
| Policies | Pack of policies that define its behaviour |
| policies | Pack of policy instances |
|
constexprnoexcept |
|
constexprnoexcept |
|
constexpr |
Constructs a mode_t with the given policies.
Compile-time strings can be passed in directly and will be converted to the appropriate policies automatically. The rules are:
The above are unicode aware. The strings can be passed in any order relative to the other policies, but it is recommended to put them first to ease reading.
| Params | Policies and child node types for the mode |
| params | Pack of policy and child node instances |
|
constexprnoexcept |
Constructs a multi_arg_t with the given policies and value type.
This is necessary due to CTAD being required for all template parameters or none, and unfortunately in our case we need T to be explicitly set by the user whilst Policies should be deduced.
Compile-time strings can be passed in directly and will be converted to the appropriate policies automatically. The rules are:
The above are unicode aware. The strings can be passed in any order relative to the other policies, but it is recommended to put them first to ease reading.
| T | Argument value type |
| Policies | Pack of policies that define its behaviour |
| policies | Pack of policy instances |
Definition at line 111 of file multi_arg.hpp.
|
constexprnoexcept |
Constructs an positional_arg_t with the given policies and value type.
This is necessary due to CTAD being required for all template parameters or none, and unfortunately in our case we need T to be explicitly set by the user whilst Policies should be deduced.
Compile-time strings can be passed in directly and will be converted to the appropriate policies automatically. The rules are:
The above are unicode aware. The strings can be passed in any order relative to the other policies, but it is recommended to put them first to ease reading.
| T | Argument value type, must have a push_back(..) method |
| Policies | Pack of policies that define its behaviour |
| policies | Pack of policy instances |
Definition at line 116 of file positional_arg.hpp.
|
constexprnoexcept |
|
constexpr |
Helper variable for is_tree_node.
| T | Type to test |
Definition at line 50 of file tree_node_fwd.hpp.
|
constexpr |
Library version as a SymVers-style string.
Definition at line 17 of file version.hpp.