arg_router  1.4.0
C++ command line argument parsing and routing
arg_router::policy Namespace Reference

Namespaces

 help_formatter_component
 
 validation
 

Classes

class  alias_t
 
class  custom_parser
 
class  default_help_formatter_t
 
class  default_value
 
class  dependent_t
 
class  description_t
 
class  display_name_t
 
class  error_name_t
 
struct  flatten_help_t
 
class  long_name_t
 
class  min_max_count_t
 
class  min_max_value_t
 
class  min_max_value_ct
 
class  multi_stage_value
 
struct  has_multi_stage_value
 
struct  no_result_value
 
class  none_name_t
 
struct  is_policy
 
struct  is_all_policies
 
struct  has_pre_parse_phase_method
 
struct  has_parse_phase_method
 
struct  has_validation_phase_method
 
struct  has_routing_phase_method
 
struct  has_missing_phase_method
 
struct  has_priority
 
class  nearest_mode_like
 
class  program_addendum_t
 
class  program_intro_t
 
class  program_name_t
 
class  program_version_t
 
class  required_t
 
class  router
 
class  runtime_enable
 
class  short_form_expander_t
 
class  short_name_t
 
class  token_end_marker_t
 
class  value_separator_t
 

Typedefs

template<typename Indent = traits::integral_constant<std::size_t{4}>, typename DescColumnOffset = traits::integral_constant<Indent{} * 2>, typename PreambleFormatter = help_formatter_component::default_preamble_formatter, typename AddendumFormatter = help_formatter_component::default_addendum_formatter>
using colour_help_formatter_t = default_help_formatter_t< Indent, DescColumnOffset, help_formatter_component::colour_line_formatter< Indent{}>, PreambleFormatter, AddendumFormatter >
 
template<typename T >
using has_no_result_value = std::is_base_of< no_result_value<>, T >
 
template<typename T >
using is_required = std::is_base_of< required_t<>, T >
 

Functions

template<typename... AliasedPolicies>
constexpr auto alias (AliasedPolicies... policies) noexcept
 
template<typename... DependsPolicies>
constexpr auto dependent (DependsPolicies... policies) noexcept
 
template<typename ValueType , typename LessThanCompare = std::less<ValueType>>
constexpr auto min_max_value (ValueType &&min, ValueType &&max, LessThanCompare &&compare=LessThanCompare{}) noexcept
 
template<typename ValueType , typename LessThanCompare = std::less<ValueType>>
constexpr auto min_value (ValueType &&min, LessThanCompare &&compare=LessThanCompare{}) noexcept
 
template<typename ValueType , typename LessThanCompare = std::less<ValueType>>
constexpr auto max_value (ValueType &&max, LessThanCompare &&compare=LessThanCompare{}) noexcept
 
template<auto Min, auto Max>
constexpr auto min_max_value () noexcept
 
template<auto Min>
constexpr auto min_value () noexcept
 
template<auto Max>
constexpr auto max_value () noexcept
 

Variables

constexpr auto colour_help_formatter = colour_help_formatter_t<>{}
 
constexpr auto default_help_formatter = default_help_formatter_t<>{}
 
template<typename S >
constexpr auto description = description_t<S>{}
 
template<typename S >
constexpr auto display_name = display_name_t<S>{}
 
template<typename S >
constexpr auto error_name = error_name_t<S>{}
 
template<typename TranslationType , typename FallbackTranslationType = default_error_code_translations>
constexpr auto exception_translator
 
constexpr auto flatten_help = flatten_help_t<>{}
 
template<typename S >
constexpr auto long_name = long_name_t<S>{}
 
template<std::size_t MinValue, std::size_t MaxValue>
constexpr auto min_max_count
 
template<std::size_t Value>
constexpr auto min_count
 
template<std::size_t Value>
constexpr auto max_count
 
template<std::size_t Value>
constexpr auto fixed_count
 
template<typename T >
constexpr bool has_multi_stage_value_v = has_multi_stage_value<T>::value
 
template<typename T >
constexpr bool has_no_result_value_v = has_no_result_value<T>::value
 
template<typename S >
constexpr auto none_name = none_name_t<S>{}
 
template<typename T >
constexpr auto is_policy_v = is_policy<T>::value
 
template<typename Tuple >
constexpr auto is_all_policies_v = is_all_policies<Tuple>::value
 
template<typename S >
constexpr auto program_addendum = program_addendum_t<S>{}
 
template<typename S >
constexpr auto program_intro = program_intro_t<S>{}
 
template<typename S >
constexpr auto program_name = program_name_t<S>{}
 
template<typename S >
constexpr auto program_version = program_version_t<S>{}
 
constexpr auto required = required_t<>{}
 
template<typename T >
constexpr bool is_required_v = is_required<T>::value
 
constexpr auto short_form_expander = short_form_expander_t<>{}
 
template<char S>
constexpr auto short_name = short_name_t<AR_STRING(S)>{}
 
template<typename S >
constexpr auto short_name_utf8 = short_name_t<S>{}
 
template<typename S >
constexpr auto token_end_marker = token_end_marker_t<S>{}
 
template<char S>
constexpr auto value_separator = value_separator_t<AR_STRING(S)>{}
 
template<typename S >
constexpr auto value_separator_utf8 = value_separator_t<S>{}
 

Detailed Description

Exception message translator policy.

Provides the mapping between the internal multi_lang_exception error code to a translated string, and then re-throws with a parse_exception.

If no matching translation string can be found, an parse_exception is thrown with a message of the form:

"Untranslated error code (<EC>): <tokens>"
Template Parameters
TranslationTypemulti_lang::translation type for the current language
FallbackTranslationTypemulti_lang::translation type to use as a fall back language if a matching error_code is not found in TranslationType. Set to void if no fallback is required

Policy namespace.

arg_router uses policies to compose behaviours on command line argument types.

Typedef Documentation

◆ colour_help_formatter_t

template<typename Indent = traits::integral_constant<std::size_t{4}>, typename DescColumnOffset = traits::integral_constant<Indent{} * 2>, typename PreambleFormatter = help_formatter_component::default_preamble_formatter, typename AddendumFormatter = help_formatter_component::default_addendum_formatter>
using arg_router::policy::colour_help_formatter_t = typedef default_help_formatter_t<Indent, DescColumnOffset, help_formatter_component::colour_line_formatter<Indent{}>, PreambleFormatter, AddendumFormatter>

Same format as the default_help_formatter_t output, but the argument labels are red and the descriptions green.

Template Parameters
IndentNumber of spaces per 'level' of indentation, defaults to 4
DescColumnOffsetMinimum number of description columns remaining in a terminal line needed to attempt proper line breaks i.e. if it is less than DescColumnOffset then the output just overflows onto the next line, defaults to 8
PreambleFormatterControls preamble formatting i.e. the 'intro' part of the output that goes before the argument output
AddendumFormatterControls addendum formatting i.e. the part of the output that goes after the argument output

Definition at line 140 of file colour_help_formatter.hpp.

◆ has_no_result_value

template<typename T >
using arg_router::policy::has_no_result_value = typedef std::is_base_of<no_result_value<>, T>

Evaluates to true if T uses no_result_value.

Template Parameters
TType to test

Definition at line 25 of file no_result_value.hpp.

◆ is_required

template<typename T >
using arg_router::policy::is_required = typedef std::is_base_of<required_t<>, T>

Evaluates to true if T is marked as required.

Template Parameters
TType to test

Definition at line 53 of file required.hpp.

Function Documentation

◆ alias()

template<typename... AliasedPolicies>
constexpr auto arg_router::policy::alias ( AliasedPolicies...  policies)
constexprnoexcept

Constructs a alias_t with the given policies.

This is used for similarity with arg_t.

Template Parameters
AliasedPoliciesPack of policies that define its behaviour
Parameters
policiesPack of policy instances
Returns
Alias instance

Definition at line 263 of file alias.hpp.

◆ dependent()

template<typename... DependsPolicies>
constexpr auto arg_router::policy::dependent ( DependsPolicies...  policies)
constexprnoexcept

Constructs a dependent_t with the given policies.

This is used for similarity with arg_t.

Template Parameters
DependsPoliciesPack of policies that define its behaviour
Parameters
policiesPack of policy instances
Returns
Alias instance

Definition at line 183 of file dependent.hpp.

◆ max_value() [1/2]

template<auto Max>
constexpr auto arg_router::policy::max_value ( )
constexprnoexcept

Constructs a min_max_value_ct with the given params.

Template Parameters
MaxMaximum value
Returns
min_max_value_ct instance

Definition at line 268 of file min_max_value.hpp.

◆ max_value() [2/2]

template<typename ValueType , typename LessThanCompare = std::less<ValueType>>
constexpr auto arg_router::policy::max_value ( ValueType &&  max,
LessThanCompare &&  compare = LessThanCompare{} 
)
constexprnoexcept

Constructs a min_max_value_t with the given params.

Template Parameters
ValueTypeMaximum value type
LessThanCompareLess than comparator type
Parameters
maxMaximum value
compareComparator instance
Returns
min_max_value_t instance

Definition at line 231 of file min_max_value.hpp.

◆ min_max_value() [1/2]

template<auto Min, auto Max>
constexpr auto arg_router::policy::min_max_value ( )
constexprnoexcept

Constructs a min_max_value_ct with the given params.

Template Parameters
MinMinimum value
MaxMaximum value
Returns
min_max_value_ct instance

Definition at line 246 of file min_max_value.hpp.

◆ min_max_value() [2/2]

template<typename ValueType , typename LessThanCompare = std::less<ValueType>>
constexpr auto arg_router::policy::min_max_value ( ValueType &&  min,
ValueType &&  max,
LessThanCompare &&  compare = LessThanCompare{} 
)
constexprnoexcept

Constructs a min_max_value_t with the given params.

Template Parameters
ValueTypeMinimum and maximum value type
LessThanCompareLess than comparator type
Parameters
minMinimum value
maxMaximum value
compareComparator instance
Returns
min_max_value_t instance

Definition at line 196 of file min_max_value.hpp.

◆ min_value() [1/2]

template<auto Min>
constexpr auto arg_router::policy::min_value ( )
constexprnoexcept

Constructs a min_max_value_ct with the given params.

Template Parameters
MinMinimum value
Returns
min_max_value_ct instance

Definition at line 257 of file min_max_value.hpp.

◆ min_value() [2/2]

template<typename ValueType , typename LessThanCompare = std::less<ValueType>>
constexpr auto arg_router::policy::min_value ( ValueType &&  min,
LessThanCompare &&  compare = LessThanCompare{} 
)
constexprnoexcept

Constructs a min_max_value_t with the given params.

Template Parameters
ValueTypeMinimum value type
LessThanCompareLess than comparator type
Parameters
minMinimum value
compareComparator instance
Returns
min_max_value_t instance

Definition at line 214 of file min_max_value.hpp.

Variable Documentation

◆ colour_help_formatter

constexpr auto arg_router::policy::colour_help_formatter = colour_help_formatter_t<>{}
constexpr

Constant variable helper.

Definition at line 148 of file colour_help_formatter.hpp.

◆ default_help_formatter

constexpr auto arg_router::policy::default_help_formatter = default_help_formatter_t<>{}
constexpr

Constant variable helper.

Definition at line 372 of file default_help_formatter.hpp.

◆ description

template<typename S >
constexpr auto arg_router::policy::description = description_t<S>{}
constexpr

Constant variable helper.

Template Parameters
SCompile-time string

Definition at line 50 of file description.hpp.

◆ display_name

template<typename S >
constexpr auto arg_router::policy::display_name = display_name_t<S>{}
constexpr

Constant variable helper.

Template Parameters
SCompile-time string

Definition at line 56 of file display_name.hpp.

◆ error_name

template<typename S >
constexpr auto arg_router::policy::error_name = error_name_t<S>{}
constexpr

Constant variable helper.

Template Parameters
SCompile-time string

Definition at line 54 of file error_name.hpp.

◆ exception_translator

template<typename TranslationType , typename FallbackTranslationType = default_error_code_translations>
constexpr auto arg_router::policy::exception_translator
constexpr
Initial value:
=
exception_translator_t<TranslationType, FallbackTranslationType>{}

Constant variable helper.

Template Parameters
TranslationTypemulti_lang::translation type for the current language
FallbackTranslationTypemulti_lang::translation type to use as a fall back language if a matching error_code is not found in TranslationType. Set to void if no fallback is required

Definition at line 87 of file exception_translator.hpp.

◆ fixed_count

template<std::size_t Value>
constexpr auto arg_router::policy::fixed_count
constexpr
Initial value:
=
min_max_count_t<traits::integral_constant<Value>, traits::integral_constant<Value>>{}

Constant variable helper for a count of fixed size.

Template Parameters
ValueMinimum and maximum count value

Definition at line 150 of file min_max_count.hpp.

◆ flatten_help

constexpr auto arg_router::policy::flatten_help = flatten_help_t<>{}
constexpr

Constant variable helper.

Definition at line 21 of file flatten_help.hpp.

◆ has_multi_stage_value_v

template<typename T >
constexpr bool arg_router::policy::has_multi_stage_value_v = has_multi_stage_value<T>::value
constexpr

Helper variable for has_multi_stage_value.

Template Parameters
TType to test

Definition at line 80 of file multi_stage_value.hpp.

◆ has_no_result_value_v

template<typename T >
constexpr bool arg_router::policy::has_no_result_value_v = has_no_result_value<T>::value
constexpr

Helper variable for has_no_result_value.

Template Parameters
TType to test

Definition at line 32 of file no_result_value.hpp.

◆ is_all_policies_v

template<typename Tuple >
constexpr auto arg_router::policy::is_all_policies_v = is_all_policies<Tuple>::value
constexpr

Helper alias variable for is_all_policies.

Template Parameters
TupleTuple of types to test

Definition at line 53 of file policy.hpp.

◆ is_policy_v

template<typename T >
constexpr auto arg_router::policy::is_policy_v = is_policy<T>::value
constexpr

Helper alias variable for is_policy.

Template Parameters
TType to test

Definition at line 38 of file policy.hpp.

◆ is_required_v

template<typename T >
constexpr bool arg_router::policy::is_required_v = is_required<T>::value
constexpr

Helper variable for is_required.

Template Parameters
TType to test

Definition at line 60 of file required.hpp.

◆ long_name

template<typename S >
constexpr auto arg_router::policy::long_name = long_name_t<S>{}
constexpr

Constant variable helper.

Template Parameters
Scompile_time_string

Definition at line 53 of file long_name.hpp.

◆ max_count

template<std::size_t Value>
constexpr auto arg_router::policy::max_count
constexpr
Initial value:
=
min_max_count_t<traits::integral_constant<std::size_t{0}>, traits::integral_constant<Value>>{}

Constant variable helper for a maximum count with a minimum count of zero.

Template Parameters
ValueMaximum count value

Definition at line 142 of file min_max_count.hpp.

◆ min_count

template<std::size_t Value>
constexpr auto arg_router::policy::min_count
constexpr
Initial value:
=
min_max_count_t<traits::integral_constant<Value>,
traits::integral_constant<std::numeric_limits<std::size_t>::max()>>{}

Constant variable helper for a minimum count with an unbounded maximum count.

Template Parameters
ValueMinimum count value

Definition at line 133 of file min_max_count.hpp.

◆ min_max_count

template<std::size_t MinValue, std::size_t MaxValue>
constexpr auto arg_router::policy::min_max_count
constexpr
Initial value:
=
min_max_count_t<traits::integral_constant<MinValue>, traits::integral_constant<MaxValue>>{}

Constant variable helper.

Template Parameters
MinValueMinimum count value
MaxValueMaximum count value

Definition at line 125 of file min_max_count.hpp.

◆ none_name

template<typename S >
constexpr auto arg_router::policy::none_name = none_name_t<S>{}
constexpr

Constant variable helper.

Template Parameters
SCompile-time string

Definition at line 56 of file none_name.hpp.

◆ program_addendum

template<typename S >
constexpr auto arg_router::policy::program_addendum = program_addendum_t<S>{}
constexpr

Constant variable helper.

Template Parameters
SCompile-time string

Definition at line 53 of file program_addendum.hpp.

◆ program_intro

template<typename S >
constexpr auto arg_router::policy::program_intro = program_intro_t<S>{}
constexpr

Constant variable helper.

Template Parameters
SCompile-time string

Definition at line 53 of file program_intro.hpp.

◆ program_name

template<typename S >
constexpr auto arg_router::policy::program_name = program_name_t<S>{}
constexpr

Constant variable helper.

Template Parameters
SCompile-time string

Definition at line 56 of file program_name.hpp.

◆ program_version

template<typename S >
constexpr auto arg_router::policy::program_version = program_version_t<S>{}
constexpr

Constant variable helper.

Template Parameters
SCompile-time string

Definition at line 53 of file program_version.hpp.

◆ required

constexpr auto arg_router::policy::required = required_t<>{}
constexpr

Constant variable helper.

Definition at line 46 of file required.hpp.

◆ short_form_expander

constexpr auto arg_router::policy::short_form_expander = short_form_expander_t<>{}
constexpr

Constant variable helper.

Definition at line 119 of file short_form_expander.hpp.

◆ short_name

template<char S>
constexpr auto arg_router::policy::short_name = short_name_t<AR_STRING(S)>{}
constexpr

Constant variable helper.

Template Parameters
SShort name character

Definition at line 59 of file short_name.hpp.

◆ short_name_utf8

template<typename S >
constexpr auto arg_router::policy::short_name_utf8 = short_name_t<S>{}
constexpr

Constant variable helper that supports UTF-8 code points.

Template Parameters
SCompile-time string

Definition at line 66 of file short_name.hpp.

◆ token_end_marker

template<typename S >
constexpr auto arg_router::policy::token_end_marker = token_end_marker_t<S>{}
constexpr

Constant variable helper.

Template Parameters
Scompile_time_string

Definition at line 108 of file token_end_marker.hpp.

◆ value_separator

template<char S>
constexpr auto arg_router::policy::value_separator = value_separator_t<AR_STRING(S)>{}
constexpr

Constant variable helper.

Template Parameters
SArg/value separator character

Definition at line 134 of file value_separator.hpp.

◆ value_separator_utf8

template<typename S >
constexpr auto arg_router::policy::value_separator_utf8 = value_separator_t<S>{}
constexpr

Constant variable helper that supports UTF-8 code points.

Template Parameters
SUTF-8 code point

Definition at line 141 of file value_separator.hpp.