Sharg 1.1.2-rc.1
The argument parser for bio-c++ tools.
|
A helper struct to chain validators recursively via the pipe operator. More...
#include <sharg/validators.hpp>
Public Types | |
using | option_value_type |
The underlying type in both validators. | |
Public Member Functions | |
template<typename cmp_type > requires std::invocable<validator1_type, cmp_type const> && std::invocable<validator2_type, cmp_type const> | |
void | operator() (cmp_type const &cmp) const |
Calls the operator() of each validator on the value cmp. | |
std::string | get_help_page_message () const |
Returns a message that can be appended to the (positional) options help page info. | |
Constructors, destructor and assignment | |
validator_chain_adaptor ()=delete | |
Deleted. | |
validator_chain_adaptor (validator_chain_adaptor const &pf)=default | |
Defaulted. | |
validator_chain_adaptor & | operator= (validator_chain_adaptor const &pf)=default |
Defaulted. | |
validator_chain_adaptor (validator_chain_adaptor &&)=default | |
Defaulted. | |
validator_chain_adaptor & | operator= (validator_chain_adaptor &&)=default |
Defaulted. | |
validator_chain_adaptor (validator1_type vali1_, validator2_type vali2_) | |
Constructing from two validators. | |
~validator_chain_adaptor ()=default | |
The destructor. | |
Private Attributes | |
validator1_type | vali1 |
The first validator in the chain. | |
validator2_type | vali2 |
The second validator in the chain. | |
A helper struct to chain validators recursively via the pipe operator.
Note that both validators must operate on the same option_value_type in order to avoid unexpected behaviour and ensure that the sharg::parser::add_option call is well-formed. (add_option(val, ...., validator) requires that val is of same type as validator::option_value_type).
using sharg::detail::validator_chain_adaptor< validator1_type, validator2_type >::option_value_type |
The underlying type in both validators.
|
inline |
Constructing from two validators.
[in] | vali1_ | Some validator to be chained to vali2_. |
[in] | vali2_ | Another validator to be chained to vali1_. |
|
inline |
Calls the operator() of each validator on the value cmp.
cmp_type | The type of value to validate; must be invokable with each of the validator members. |
[in] | cmp | The value to validate. |
This function delegates to the validation of both of the chained validators by calling their operator() one after the other. The behaviour depends on the chained validators which may throw on input error.