A validator that checks whether a value is inside a list of valid values.
More...
#include <seqan3/argument_parser/validators.hpp>
|
using | option_value_type = option_value_t |
| Type of values that are tested by validator.
|
|
|
(Note that these are not member symbols.)
|
|
template<typename option_type , typename... option_types> |
| value_list_validator (option_type, option_types...) -> value_list_validator< std::string > |
| Type deduction guides.
|
|
template<typename range_type > |
| value_list_validator (range_type &&rng) -> value_list_validator< std::string > |
| Deduction guide for ranges over a value type convertible to std::string.
|
|
template<typename option_type , typename... option_types> |
| value_list_validator (option_type, option_types...) -> value_list_validator< option_type > |
| Deduction guide for a parameter pack.
|
|
template<typename range_type > |
| value_list_validator (range_type &&rng) -> value_list_validator< std::ranges::range_value_t< range_type > > |
| Deduction guide for ranges.
|
|
using | option_value_type |
| The type of value on which the validator is called on.
|
|
void | operator() (option_value_type const &cmp) const |
| Validates the value 'cmp' and throws a seqan3::validation_error on failure.
|
|
template<typename option_value_t>
class seqan3::value_list_validator< option_value_t >
A validator that checks whether a value is inside a list of valid values.
- Template Parameters
-
option_value_t | Type of values that are tested by validator. |
On construction, the validator must receive a range or parameter pack of valid values. The class than acts as a functor, that throws a seqan3::validation_error exception whenever a given value is not in the given list.
- Note
- In order to simplify the chaining of validators, the option value type is deduced to
std::string
if the range's value type is convertible to it. Otherwise, the option value type is deduced to the value type of the range.
int main(int argc, char const ** argv)
{
int myint;
try
{
myparser.parse();
}
{
return -1;
}
return 0;
}
Meta-header for the Argument Parser module .
Argument parser exception that is thrown whenever there is an error while parsing the command line ar...
Definition exceptions.hpp:37
The SeqAn command line parser.
Definition argument_parser.hpp:145
A validator that checks whether a value is inside a list of valid values.
Definition validators.hpp:196
Provides seqan3::debug_stream and related types.
@ standard
The default were no checking or special displaying is happening.
Definition auxiliary.hpp:248
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition debug_stream.hpp:37
◆ value_list_validator() [1/2]
template<typename option_value_t >
template<std::ranges::forward_range range_type>
requires std::constructible_from<
option_value_type, std::ranges::range_rvalue_reference_t<range_type>>
Constructing from a range.
- Template Parameters
-
- Parameters
-
[in] | rng | The range of valid values to test. |
◆ value_list_validator() [2/2]
template<typename option_value_t >
template<typename... option_types>
requires ((std::constructible_from<
option_value_type, option_types> && ...))
Constructing from a parameter pack.
- Template Parameters
-
- Parameters
-
[in] | opts | The parameter pack values. |
◆ get_help_page_message()
template<typename option_value_t >
Returns a message that can be appended to the (positional) options help page info.
Implements validator.
◆ operator()() [1/2]
template<typename option_value_t >
Tests whether cmp lies inside values.
- Parameters
-
cmp | The input value to check. |
- Exceptions
-
◆ operator()() [2/2]
template<typename option_value_t >
template<std::ranges::forward_range range_type>
requires std::convertible_to<std::ranges::range_value_t<range_type>,
option_value_type>
Tests whether every element in range
lies inside values.
- Template Parameters
-
range_type | The type of range to check; must model std::ranges::forward_range. |
- Parameters
-
range | The input range to iterate over and check every element. |
- Exceptions
-
◆ value_list_validator()
template<typename option_type , typename... option_types>
Type deduction guides.
Given a parameter pack of types that are convertible to std::string, delegate to value type std::string.
The documentation for this class was generated from the following file: