SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::detail::validator_chain_adaptor< validator1_type, validator2_type > Class Template Reference

A helper struct to chain validators recursively via the pipe operator. More...

+ Inheritance diagram for seqan3::detail::validator_chain_adaptor< validator1_type, validator2_type >:

Public Types

using option_value_type = std::common_type_t< typename validator1_type::option_value_type, typename validator2_type::option_value_type >
 The underlying type in both validators.
 

Public Member Functions

std::string get_help_page_message () const
 Returns a message that can be appended to the (positional) options help page info.
 
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.
 
Constructors, destructor and assignment
 validator_chain_adaptor ()=delete
 Deleted.
 
 validator_chain_adaptor (validator_chain_adaptor const &pf)=default
 Defaulted.
 
validator_chain_adaptoroperator= (validator_chain_adaptor const &pf)=default
 Defaulted.
 
 validator_chain_adaptor (validator_chain_adaptor &&)=default
 Defaulted.
 
validator_chain_adaptoroperator= (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.
 

Additional Inherited Members

Detailed Description

template<validator validator1_type, validator validator2_type>
requires std::common_with<typename validator1_type::option_value_type, typename validator2_type::option_value_type>
class seqan3::detail::validator_chain_adaptor< validator1_type, validator2_type >

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 seqan3::argument_parser::add_option call is well-formed. (add_option(val, ...., validator) requires that val is of same type as validator::option_value_type).

Remarks
For a complete overview, take a look at Argument Parser

Constructor & Destructor Documentation

◆ validator_chain_adaptor()

template<validator validator1_type, validator validator2_type>
seqan3::detail::validator_chain_adaptor< validator1_type, validator2_type >::validator_chain_adaptor ( validator1_type  vali1_,
validator2_type  vali2_ 
)
inline

Constructing from two validators.

Parameters
[in]vali1_Some validator to be chained to vali2_.
[in]vali2_Another validator to be chained to vali1_.

Member Function Documentation

◆ get_help_page_message()

template<validator validator1_type, validator validator2_type>
std::string seqan3::detail::validator_chain_adaptor< validator1_type, validator2_type >::get_help_page_message ( ) const
inline

Returns a message that can be appended to the (positional) options help page info.

Implements validator.

◆ operator()()

template<validator validator1_type, validator validator2_type>
template<typename cmp_type >
requires std::invocable<validator1_type, cmp_type const> && std::invocable<validator2_type, cmp_type const>
void seqan3::detail::validator_chain_adaptor< validator1_type, validator2_type >::operator() ( cmp_type const &  cmp) const
inline

Calls the operator() of each validator on the value cmp.

Template Parameters
cmp_typeThe type of value to validate; must be invokable with each of the validator members.
Parameters
[in]cmpThe 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.


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