arg_router  1.4.0
C++ command line argument parsing and routing
arg_router::policy::min_max_value_t< ValueType, LessThanCompare > Class Template Reference

#include <arg_router/policy/min_max_value.hpp>

Public Types

using value_type = ValueType
 
using less_than_compare = LessThanCompare
 

Public Member Functions

constexpr min_max_value_t (std::optional< value_type > min, std::optional< value_type > max, less_than_compare compare=less_than_compare{}) noexcept
 
constexpr const less_than_comparecomp () const noexcept
 
template<typename InputValueType , typename... Parents>
void validation_phase (const InputValueType &value, [[maybe_unused]] const Parents &... parents) const
 

Detailed Description

template<typename ValueType, typename LessThanCompare = std::less<ValueType>>
class arg_router::policy::min_max_value_t< ValueType, LessThanCompare >

Provides inclusive minimum and maximum values for a parsed value.

By default operator< is used for comparisons, but can be overridden.

Template Parameters
ValueTypeMinimum and maximum value type
LessThanCompareLess than comparator type

Definition at line 22 of file min_max_value.hpp.

Member Typedef Documentation

◆ less_than_compare

template<typename ValueType , typename LessThanCompare = std::less<ValueType>>
using arg_router::policy::min_max_value_t< ValueType, LessThanCompare >::less_than_compare = LessThanCompare

Less than comparator type.

Definition at line 28 of file min_max_value.hpp.

◆ value_type

template<typename ValueType , typename LessThanCompare = std::less<ValueType>>
using arg_router::policy::min_max_value_t< ValueType, LessThanCompare >::value_type = ValueType

Value type.

Definition at line 26 of file min_max_value.hpp.

Constructor & Destructor Documentation

◆ min_max_value_t()

template<typename ValueType , typename LessThanCompare = std::less<ValueType>>
constexpr arg_router::policy::min_max_value_t< ValueType, LessThanCompare >::min_max_value_t ( std::optional< value_type min,
std::optional< value_type max,
less_than_compare  compare = less_than_compare{} 
)
inlineconstexprnoexcept

Min and max value constructor.

Unlike min_max_count_t. value_type is not guaranteed to be compile-time constructible, and so no compile-time or runtime checking is done on the validity of min and max. Use min_max_count_ct when the input types can be represented in a std::integral_constant for extra compile-time checks.

Parameters
minMinimum value, or empty optional if no minimum bound
maxMaximum value, or empty optional if no maximum bound
compareComparator instance

Definition at line 40 of file min_max_value.hpp.

Member Function Documentation

◆ comp()

template<typename ValueType , typename LessThanCompare = std::less<ValueType>>
constexpr const less_than_compare& arg_router::policy::min_max_value_t< ValueType, LessThanCompare >::comp ( ) const
inlineconstexprnoexcept

Comparator.

Returns
Compare function object

Definition at line 53 of file min_max_value.hpp.

◆ validation_phase()

template<typename ValueType , typename LessThanCompare = std::less<ValueType>>
template<typename InputValueType , typename... Parents>
void arg_router::policy::min_max_value_t< ValueType, LessThanCompare >::validation_phase ( const InputValueType &  value,
[[maybe_unused] ] const Parents &...  parents 
) const
inline

Checks that value is between the minimum and maximum values.

Template Parameters
InputValueTypeParsed value type, must be implicitly constructible from value_type
ParentsPack of parent tree nodes in ascending ancestry order
Parameters
valueParsed input value to check
parentsParents instances pack

Definition at line 63 of file min_max_value.hpp.


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