A validator that checks if a given path is a valid input directory.
More...
#include <seqan3/argument_parser/validators.hpp>
A validator that checks if a given path is a valid input directory.
The struct acts as a functor that throws a seqan3::parser_invalid_argument exception whenever a given directory (std::filesystem::path) does not exist, the specified path is not a directory, or if the directory is not readable.
int main(int argc, const char ** argv)
{
myparser.add_option(mydir, 'd', "dir", "The directory containing the input files.",
try
{
myparser.parse();
}
{
return -1;
}
return 0;
}
- Note
- The validator works on every type that can be implicitly converted to std::filesystem::path.
◆ operator()() [1/2]
template<std::ranges::forward_range range_type>
void seqan3::file_validator_base::operator() |
( |
range_type const & |
v | ) |
const |
|
inlineinherited |
Tests whether every path in list v
passes validation. See operator()(option_value_type const & value) for further information.
- Template Parameters
-
range_type | The type of range to check; must model std::ranges::forward_range and the value type must be convertible to std::filesystem::path. |
- Parameters
-
v | The input range to iterate over and check every element. |
- Exceptions
-
◆ operator()() [2/2]
Tests whether path is an existing directory and is readable.
- Parameters
-
dir | The input value to check. |
- Exceptions
-
Implements seqan3::file_validator_base.
◆ validate_filename()
Validates the given filename path based on the specified extensions.
- Parameters
-
- Exceptions
-
◆ validate_readability()
Checks if the given path is readable.
- Parameters
-
- Returns
true
if readable, otherwise false
.
- Exceptions
-
◆ validate_writeability()
Checks if the given path is writable.
- Parameters
-
- Returns
true
if writable, otherwise false
.
- Exceptions
-
◆ operator()()
Validates the value 'cmp' and throws a seqan3::validation_failed on failure.
- Template Parameters
-
option_value_type | The type of the value to be validated. |
- Parameters
-
[in,out] | cmp | The value to be validated. |
- Exceptions
-
- Attention
- This is a concept requirement, not an actual function (however types satisfying this concept will provide an implementation).
The documentation for this class was generated from the following file: