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

Namespaces

 common_rules
 

Classes

class  validator
 
struct  despecialised_unique_in_owner
 
struct  policy_unique_from_owner_parent_to_mode_or_root
 
struct  parent_index_pair_type
 
struct  parent_types
 
struct  must_have_policies
 
struct  must_not_have_policies
 
struct  child_must_have_policy
 
struct  child_must_not_have_policy
 
struct  policy_parent_must_not_have_policy
 
struct  single_anonymous_mode
 
struct  at_least_one_of_policies
 
struct  node_types_must_be_at_end
 
struct  anonymous_mode_must_be_at_end
 
struct  list_like_nodes_must_have_fixed_count_if_not_at_end
 
struct  must_have_at_least_min_count_of_1_if_required
 

Typedefs

template<template< typename... > typename T, typename... Conditions>
using rule = std::tuple< boost::mp11::mp_quote< T >, Conditions... >
 
template<typename T , typename... Conditions>
using rule_q = std::tuple< T, Conditions... >
 
template<typename RuleTuple >
using validator_from_tuple = typename detail::validator_from_tuple_impl< RuleTuple >::type
 

Variables

constexpr auto default_validator
 

Detailed Description

Namespace for types associated with parse tree validation.

Typedef Documentation

◆ rule

template<template< typename... > typename T, typename... Conditions>
using arg_router::policy::validation::rule = typedef std::tuple<boost::mp11::mp_quote<T>, Conditions...>

Defines a validator rule.

See validator for how it is to be used.

A condition is defined as:

struct my_condition {
template <typename T, typename... Parents>
constexpr static void check()
{
// Compile-time checks
}
};

Where T is the current type from the tree, from the root down to policy level, and Parents is a pack of ancestors in increasing generation from T. The last in the pack is always the root unless T is itself the root, in which case Parents is empty.

Template Parameters
TA trait-like type that has a static bool member value that evaluates to true if the tested type is a match (e.g. std::is_same)
ConditionsA pack of conditions that all must be satisfied for compilation to be successful

Definition at line 74 of file validator.hpp.

◆ rule_q

template<typename T , typename... Conditions>
using arg_router::policy::validation::rule_q = typedef std::tuple<T, Conditions...>

Quoted metafunction rule overload.

This is the only way to use template template params when defining a rule. The resulting type of T should have the form:

template <typename MyParam>
struct my_rule {
template <typename T>
struct fn {
constexpr static bool value = ...;
};
};
Template Parameters
TA quoted metafunction type with a nested template fn that has a static bool member value that evaluates to true if the tested
ConditionsA pack of conditions that all must be satisfied for compilation to be successful

Definition at line 96 of file validator.hpp.

◆ validator_from_tuple

template<typename RuleTuple >
using arg_router::policy::validation::validator_from_tuple = typedef typename detail::validator_from_tuple_impl<RuleTuple>::type

Defines a validator type built from a tuple-like type of rules.

Template Parameters
RuleTupleTuple of rules

Definition at line 614 of file validator.hpp.

Variable Documentation

◆ default_validator

constexpr auto arg_router::policy::validation::default_validator
constexpr

The default validator instance.

Definition at line 617 of file validator.hpp.