Sharg 1.1.2-rc.1
The argument parser for bio-c++ tools.
Loading...
Searching...
No Matches
validators.hpp File Reference

Provides some standard validators for (positional) options. More...

#include <algorithm>
#include <any>
#include <concepts>
#include <exception>
#include <fstream>
#include <ranges>
#include <regex>
#include <sharg/detail/safe_filesystem_entry.hpp>
#include <sharg/detail/to_string.hpp>
#include <sharg/exceptions.hpp>
+ Include dependency graph for validators.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  sharg::arithmetic_range_validator< option_value_t >
 A validator that checks whether a number is inside a given range. More...
 
class  sharg::value_list_validator< option_value_t >
 A validator that checks whether a value is inside a list of valid values. More...
 
class  sharg::file_validator_base
 An abstract base class for the file and directory validators. More...
 
class  sharg::input_file_validator
 A validator that checks if a given path is a valid input file. More...
 
class  sharg::output_file_validator
 A validator that checks if a given path is a valid output file. More...
 
class  sharg::input_directory_validator
 A validator that checks if a given path is a valid input directory. More...
 
class  sharg::output_directory_validator
 A validator that checks if a given path is a valid output directory. More...
 
class  sharg::regex_validator
 A validator that checks if a matches a regular expression pattern. More...
 
struct  sharg::detail::default_validator
 Validator that always returns true. More...
 
class  sharg::detail::validator_chain_adaptor< validator1_type, validator2_type >
 A helper struct to chain validators recursively via the pipe operator. More...
 

Concepts

concept  sharg::validator
 The concept for option validators passed to add_option/positional_option.
 

Enumerations

enum class  sharg::output_file_open_options { open_or_create , create_new }
 Mode of an output file: Determines whether an existing file can be (silently) overwritten. More...
 

Functions

template<validator validator1_type, validator validator2_type>
requires std::common_with<typename std::remove_reference_t<validator1_type>::option_value_type, typename std::remove_reference_t<validator2_type>::option_value_type>
auto sharg::operator| (validator1_type &&vali1, validator2_type &&vali2)
 Enables the chaining of validators.
 

Detailed Description

Provides some standard validators for (positional) options.

Author
Svenja Mehringer <svenja.mehringer AT fu-berlin.de>

Enumeration Type Documentation

◆ output_file_open_options

Mode of an output file: Determines whether an existing file can be (silently) overwritten.

This entity is experimental and subject to change in the future. Experimental since version 1.0.

Enumerator
open_or_create 

Allow to overwrite the output file.

create_new 

Forbid overwriting the output file.

Hide me