SeqAn3  3.0.3
The Modern C++ library for sequence analysis.
validators.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
13 #pragma once
14 
15 #include <seqan3/std/algorithm>
16 #include <seqan3/std/concepts>
17 #include <seqan3/std/filesystem>
18 #include <fstream>
19 #include <seqan3/std/ranges>
20 #include <regex>
21 #include <sstream>
22 
34 
35 namespace seqan3
36 {
37 
95 template <typename validator_type>
96 SEQAN3_CONCEPT validator = std::copyable<std::remove_cvref_t<validator_type>> &&
97  requires(validator_type validator,
99 {
101 
102  SEQAN3_RETURN_TYPE_CONSTRAINT(validator(value), std::same_as, void);
104 };
106 
120 template <arithmetic option_value_t>
122 {
123 public:
125  using option_value_type = option_value_t;
126 
132  min{min_}, max{max_}
133  {}
134 
139  void operator()(option_value_type const & cmp) const
140  {
141  if (!((cmp <= max) && (cmp >= min)))
142  throw validation_error{detail::to_string("Value ", cmp, " is not in range [", min, ",", max, "].")};
143  }
144 
151  template <std::ranges::forward_range range_type>
155  void operator()(range_type const & range) const
156  {
157  std::for_each(range.begin(), range.end(), [&] (auto cmp) { (*this)(cmp); });
158  }
159 
162  {
163  return detail::to_string("Value must be in range [", min, ",", max, "].");
164  }
165 
166 private:
169 
172 };
173 
191 template <typename option_value_t>
193 {
194 public:
196  using option_value_type = option_value_t;
197 
201  value_list_validator() = default;
206  ~value_list_validator() = default;
207 
213  template <std::ranges::forward_range range_type>
215  requires std::constructible_from<option_value_type, std::ranges::range_rvalue_reference_t<range_type>>
217  value_list_validator(range_type rng)
218  {
219  values.clear();
220  std::ranges::move(std::move(rng), std::cpp20::back_inserter(values));
221  }
222 
228  template <typename ...option_types>
230  requires ((std::constructible_from<option_value_type, option_types> && ...))
232  value_list_validator(option_types && ...opts)
233  {
234  (values.emplace_back(std::forward<option_types>(opts)), ...);
235  }
237 
242  void operator()(option_value_type const & cmp) const
243  {
244  if (!(std::find(values.begin(), values.end(), cmp) != values.end()))
245  throw validation_error{detail::to_string("Value ", cmp, " is not one of ", std::views::all(values), ".")};
246  }
247 
253  template <std::ranges::forward_range range_type>
255  requires std::convertible_to<std::ranges::range_value_t<range_type>, option_value_type>
257  void operator()(range_type const & range) const
258  {
259  std::for_each(std::ranges::begin(range), std::ranges::end(range), [&] (auto cmp) { (*this)(cmp); });
260  }
261 
264  {
265  return detail::to_string("Value must be one of ", std::views::all(values), ".");
266  }
267 
268 private:
269 
272 };
273 
279 template <typename option_type, typename ...option_types>
281  requires (std::constructible_from<std::string, std::decay_t<option_types>> && ... &&
282  std::constructible_from<std::string, std::decay_t<option_type>>)
284 value_list_validator(option_type, option_types...) -> value_list_validator<std::string>;
285 
287 template <typename range_type>
289  requires (std::ranges::forward_range<std::decay_t<range_type>> &&
290  std::constructible_from<std::string, std::ranges::range_value_t<range_type>>)
292 value_list_validator(range_type && rng) -> value_list_validator<std::string>;
293 
295 template <typename option_type, typename ...option_types>
296 value_list_validator(option_type, option_types ...) -> value_list_validator<option_type>;
297 
299 template <typename range_type>
301  requires (std::ranges::forward_range<std::decay_t<range_type>>)
303 value_list_validator(range_type && rng) -> value_list_validator<std::ranges::range_value_t<range_type>>;
305 
319 {
320 public:
321 
324 
328  file_validator_base() = default;
333  virtual ~file_validator_base() = default;
335 
343  virtual void operator()(std::filesystem::path const & path) const = 0;
344 
352  template <std::ranges::forward_range range_type>
354  requires (std::convertible_to<std::ranges::range_value_t<range_type>, std::filesystem::path const &>
355  && !std::convertible_to<range_type, std::filesystem::path const &>)
357  void operator()(range_type const & v) const
358  {
359  std::for_each(v.begin(), v.end(), [&] (auto cmp) { this->operator()(cmp); });
360  }
361 
362 protected:
368  void validate_filename(std::filesystem::path const & path) const
369  {
370  // If no valid extensions are given we can safely return here.
371  if (extensions.empty())
372  return;
373 
374  // Check if extension is available.
375  if (!path.has_extension())
376  throw validation_error{detail::to_string("The given filename ", path.string(), " has no extension. Expected"
377  " one of the following valid extensions:", extensions, "!")};
378 
379  std::string file_path{path.filename().string()};
380 
381  // Leading dot indicates a hidden file is not part of the extension.
382  if (file_path.front() == '.')
383  file_path.erase(0, 1);
384 
385  // Store a string_view containing all extensions for a better error message.
386  std::string const all_extensions{file_path.substr(file_path.find(".") + 1)};
387 
388  // Compares the extensions in lower case.
389  auto case_insensitive_ends_with = [&] (std::string const & ext)
390  {
391  return case_insensitive_string_ends_with(file_path, ext);
392  };
393 
394  // Check if requested extension is present.
395  if (std::ranges::find_if(extensions, case_insensitive_ends_with) == extensions.end())
396  {
397  throw validation_error{detail::to_string("Expected one of the following valid extensions: ", extensions,
398  "! Got ", all_extensions, " instead!")};
399  }
400  }
401 
409  {
410  // Check if input directory is readable.
412  {
413  std::error_code ec{};
414  std::filesystem::directory_iterator{path, ec}; // if directory iterator cannot be created, ec will be set.
415  if (static_cast<bool>(ec))
416  throw validation_error{detail::to_string("Cannot read the directory ", path ,"!")};
417  }
418  else
419  {
420  // Must be a regular file.
422  throw validation_error{detail::to_string("Expected a regular file ", path, "!")};
423 
424  std::ifstream file{path};
425  if (!file.is_open() || !file.good())
426  throw validation_error{detail::to_string("Cannot read the file ", path, "!")};
427  }
428  }
429 
437  {
438  std::ofstream file{path};
439  detail::safe_filesystem_entry file_guard{path};
440 
441  bool is_open = file.is_open();
442  bool is_good = file.good();
443  file.close();
444 
445  if (!is_good || !is_open)
446  throw validation_error{detail::to_string("Cannot write ", path, "!")};
447 
448  file_guard.remove();
449  }
450 
453  {
454  if (extensions.empty())
455  return "";
456  else
457  return detail::to_string(" Valid file extensions are: [", extensions | views::join(std::string{", "}), "].");
458  }
459 
466  {
467  size_t const suffix_length{suffix.size()};
468  size_t const str_length{str.size()};
469  return suffix_length > str_length ?
470  false :
471  std::ranges::equal(str.substr(str_length - suffix_length), suffix, [] (char const chr1, char const chr2)
472  {
473  return std::tolower(chr1) == std::tolower(chr2);
474  });
475  }
476 
479 };
480 
503 template <typename file_t = void>
505 {
506 public:
507 
508  static_assert(std::same_as<file_t, void> || detail::has_type_valid_formats<file_t>,
509  "Expected either a template type with a static member called valid_formats (a file type) or void.");
510 
511  // Import from base class.
513 
527  {
528  if constexpr (!std::same_as<file_t, void>)
529  file_validator_base::extensions = detail::valid_file_extensions<typename file_t::valid_formats>();
530  }
531 
536  virtual ~input_file_validator() = default;
537 
548  requires std::same_as<file_t, void>
551  {
553  }
554 
555  // Import base class constructor.
558 
559  // Import the base::operator()
560  using file_validator_base::operator();
561 
567  virtual void operator()(std::filesystem::path const & file) const override
568  {
569  try
570  {
571  if (!std::filesystem::exists(file))
572  throw validation_error{detail::to_string("The file ", file, " does not exist!")};
573 
574  // Check if file is regular and can be opened for reading.
575  validate_readability(file);
576 
577  // Check extension.
578  validate_filename(file);
579  }
581  {
582  std::throw_with_nested(validation_error{"Unhandled filesystem error!"});
583  }
584  catch (...)
585  {
587  }
588  }
589 
592  {
593  return "The input file must exist and read permissions must be granted." +
595  }
596 };
597 
600 {
604  create_new
605 };
606 
633 template <typename file_t = void>
635 {
636 public:
637  static_assert(std::same_as<file_t, void> || detail::has_type_valid_formats<file_t>,
638  "Expected either a template type with a static member called valid_formats (a file type) or void.");
639 
640  // Import from base class.
642 
649  {}
650 
655  virtual ~output_file_validator() = default;
656 
657 #ifdef SEQAN3_DEPRECATED_310
661  {}
662 #endif // SEQAN3_DEPRECATED_310
663 
673  {
675  }
676 
677  // Import base constructor.
680 
690  {
691  if constexpr (!std::same_as<file_t, void>)
692  return detail::valid_file_extensions<typename file_t::valid_formats>();
693  return {};
694  }
695 
696  // Import the base::operator()
697  using file_validator_base::operator();
698 
704  virtual void operator()(std::filesystem::path const & file) const override
705  {
706  try
707  {
709  throw validation_error{detail::to_string("The file ", file, " already exists!")};
710 
711  // Check if file has any write permissions.
712  validate_writeability(file);
713 
714  validate_filename(file);
715  }
717  {
718  std::throw_with_nested(validation_error{"Unhandled filesystem error!"});
719  }
720  catch (...)
721  {
723  }
724  }
725 
728  {
730  return "Write permissions must be granted." + valid_extensions_help_page_message();
731  else // mode == create_new
732  return "The output file must not exist already and write permissions must be granted." +
734  }
735 
736 private:
739 };
740 
756 {
757 public:
758  // Import from base class.
760 
769  virtual ~input_directory_validator() = default;
770 
771  // Import base constructor.
774 
775  // Import the base::operator()
776  using file_validator_base::operator();
777 
783  virtual void operator()(std::filesystem::path const & dir) const override
784  {
785  try
786  {
787  if (!std::filesystem::exists(dir))
788  throw validation_error{detail::to_string("The directory ", dir, " does not exists!")};
789 
791  throw validation_error{detail::to_string("The path ", dir, " is not a directory!")};
792 
793  // Check if directory has any read permissions.
795  }
797  {
798  std::throw_with_nested(validation_error{"Unhandled filesystem error!"});
799  }
800  catch (...)
801  {
803  }
804  }
805 
808  {
809  return detail::to_string("An existing, readable path for the input directory.");
810  }
811 };
812 
828 {
829 public:
830  // Imported from base class.
832 
841  virtual ~output_directory_validator() = default;
842 
843  // Import base constructor.
846 
847  // Import the base::operator().
848  using file_validator_base::operator();
849 
855  virtual void operator()(std::filesystem::path const & dir) const override
856  {
857  bool dir_exists = std::filesystem::exists(dir);
858  // Make sure the created dir is deleted after we are done.
859  std::error_code ec;
860  std::filesystem::create_directory(dir, ec); // does nothing and is not treated as error if path already exists.
861  // if error code was set or if dummy.txt could not be created within the output dir, throw an error.
862  if (static_cast<bool>(ec))
863  throw validation_error{detail::to_string("Cannot create directory: ", dir, "!")};
864 
865  try
866  {
867  if (!dir_exists)
868  {
869  detail::safe_filesystem_entry dir_guard{dir};
870  validate_writeability(dir / "dummy.txt");
871  dir_guard.remove_all();
872  }
873  else
874  {
875  validate_writeability(dir / "dummy.txt");
876  }
877  }
879  {
880  std::throw_with_nested(validation_error{"Unhandled filesystem error!"});
881  }
882  catch (...)
883  {
885  }
886  }
887 
890  {
891  return detail::to_string("A valid path for the output directory.");
892  }
893 };
894 
913 {
914 public:
917 
921  regex_validator(std::string const & pattern_) :
922  pattern{pattern_}
923  {}
924 
929  void operator()(option_value_type const & cmp) const
930  {
931  std::regex rgx(pattern);
932  if (!std::regex_match(cmp, rgx))
933  throw validation_error{detail::to_string("Value ", cmp, " did not match the pattern ", pattern, ".")};
934  }
935 
942  template <std::ranges::forward_range range_type>
944  requires std::convertible_to<std::ranges::range_reference_t<range_type>, option_value_type const &>
946  void operator()(range_type const & v) const
947  {
948  for (auto && file_name : v)
949  {
950  // note: we explicitly copy/construct any reference type other than `std::string &`
951  (*this)(static_cast<option_value_type const &>(file_name));
952  }
953  }
954 
957  {
958  return detail::to_string("Value must match the pattern '", pattern, "'.");
959  }
960 
961 private:
964 };
965 
966 namespace detail
967 {
968 
979 template <typename option_value_t>
981 {
983  using option_value_type = option_value_t;
984 
986  void operator()(option_value_t const & /*cmp*/) const noexcept
987  {}
988 
991  {
992  return "";
993  }
994 };
995 
1007 template <validator validator1_type, validator validator2_type>
1009  requires std::common_with<typename validator1_type::option_value_type, typename validator2_type::option_value_type>
1012 {
1013 public:
1015  using option_value_type = std::common_type_t<typename validator1_type::option_value_type,
1016  typename validator2_type::option_value_type>;
1017 
1026 
1031  validator_chain_adaptor(validator1_type vali1_, validator2_type vali2_) :
1032  vali1{std::move(vali1_)}, vali2{std::move(vali2_)}
1033  {}
1034 
1038 
1047  template <typename cmp_type>
1049  requires std::invocable<validator1_type, cmp_type const> && std::invocable<validator2_type, cmp_type const>
1051  void operator()(cmp_type const & cmp) const
1052  {
1053  vali1(cmp);
1054  vali2(cmp);
1055  }
1056 
1059  {
1060  return detail::to_string(vali1.get_help_page_message(), " ", vali2.get_help_page_message());
1061  }
1062 
1063 private:
1065  validator1_type vali1;
1067  validator2_type vali2;
1068 };
1069 
1070 } // namespace detail
1071 
1099 template <validator validator1_type, validator validator2_type>
1101  requires std::common_with<typename std::remove_reference_t<validator1_type>::option_value_type,
1104 auto operator|(validator1_type && vali1, validator2_type && vali2)
1105 {
1106  return detail::validator_chain_adaptor{std::forward<validator1_type>(vali1),
1107  std::forward<validator2_type>(vali2)};
1108 }
1109 
1110 } // namespace seqan3
Adaptations of algorithms from the Ranges TS.
T begin(T... args)
A validator that checks whether a number is inside a given range.
Definition: validators.hpp:122
void operator()(option_value_type const &cmp) const
Tests whether cmp lies inside [min, max].
Definition: validators.hpp:139
option_value_type max
Maximum of the range to test.
Definition: validators.hpp:171
option_value_t option_value_type
The type of value that this validator invoked upon.
Definition: validators.hpp:125
void operator()(range_type const &range) const
Tests whether every element in range lies inside [min, max].
Definition: validators.hpp:155
option_value_type min
Minimum of the range to test.
Definition: validators.hpp:168
std::string get_help_page_message() const
Returns a message that can be appended to the (positional) options help page info.
Definition: validators.hpp:161
arithmetic_range_validator(option_value_type const min_, option_value_type const max_)
The constructor.
Definition: validators.hpp:131
A safe guard to manage a filesystem entry, e.g. a file or a directory.
Definition: safe_filesystem_entry.hpp:38
A helper struct to chain validators recursively via the pipe operator.
Definition: validators.hpp:1012
validator_chain_adaptor(validator_chain_adaptor &&)=default
Defaulted.
validator_chain_adaptor & operator=(validator_chain_adaptor &&)=default
Defaulted.
void operator()(cmp_type const &cmp) const
Calls the operator() of each validator on the value cmp.
Definition: validators.hpp:1051
validator_chain_adaptor(validator1_type vali1_, validator2_type vali2_)
Constructing from two validators.
Definition: validators.hpp:1031
validator2_type vali2
The second validator in the chain.
Definition: validators.hpp:1067
~validator_chain_adaptor()=default
The destructor.
validator_chain_adaptor & operator=(validator_chain_adaptor const &pf)=default
Defaulted.
validator_chain_adaptor(validator_chain_adaptor const &pf)=default
Defaulted.
std::string get_help_page_message() const
Returns a message that can be appended to the (positional) options help page info.
Definition: validators.hpp:1058
validator1_type vali1
The first validator in the chain.
Definition: validators.hpp:1065
An abstract base class for the file and directory validators.
Definition: validators.hpp:319
file_validator_base & operator=(file_validator_base &&)=default
Defaulted.
bool case_insensitive_string_ends_with(std::string_view str, std::string_view suffix) const
Helper function that checks if a string is a suffix of another string. Case insensitive.
Definition: validators.hpp:465
void validate_filename(std::filesystem::path const &path) const
Validates the given filename path based on the specified extensions.
Definition: validators.hpp:368
file_validator_base & operator=(file_validator_base const &)=default
Defaulted.
std::string valid_extensions_help_page_message() const
Returns the information of valid file extensions.
Definition: validators.hpp:452
virtual void operator()(std::filesystem::path const &path) const =0
Tests if the given path is a valid input, respectively output, file or directory.
std::string option_value_type
Type of values that are tested by validator.
Definition: validators.hpp:323
file_validator_base(file_validator_base &&)=default
Defaulted.
void validate_readability(std::filesystem::path const &path) const
Checks if the given path is readable.
Definition: validators.hpp:408
file_validator_base()=default
Defaulted.
file_validator_base(file_validator_base const &)=default
Defaulted.
std::vector< std::string > extensions
Stores the extensions.
Definition: validators.hpp:478
virtual ~file_validator_base()=default
void validate_writeability(std::filesystem::path const &path) const
Checks if the given path is writable.
Definition: validators.hpp:436
A validator that checks if a given path is a valid input directory.
Definition: validators.hpp:756
input_directory_validator(input_directory_validator &&)=default
Defaulted.
std::string get_help_page_message() const
Returns a message that can be appended to the (positional) options help page info.
Definition: validators.hpp:807
input_directory_validator & operator=(input_directory_validator &&)=default
Defaulted.
input_directory_validator()=default
Defaulted.
input_directory_validator & operator=(input_directory_validator const &)=default
Defaulted.
input_directory_validator(input_directory_validator const &)=default
Defaulted.
virtual void operator()(std::filesystem::path const &dir) const override
Tests whether path is an existing directory and is readable.
Definition: validators.hpp:783
virtual ~input_directory_validator()=default
Virtual Destructor.
A validator that checks if a given path is a valid input file.
Definition: validators.hpp:505
input_file_validator(input_file_validator const &)=default
Defaulted.
virtual ~input_file_validator()=default
Virtual destructor.
input_file_validator(std::vector< std::string > extensions)
Constructs from a given collection of valid extensions.
Definition: validators.hpp:546
std::string get_help_page_message() const
Returns a message that can be appended to the (positional) options help page info.
Definition: validators.hpp:591
input_file_validator(input_file_validator &&)=default
Defaulted.
input_file_validator & operator=(input_file_validator &&)=default
Defaulted.
virtual void operator()(std::filesystem::path const &file) const override
Tests whether path is an existing regular file and is readable.
Definition: validators.hpp:567
input_file_validator()
Default constructor.
Definition: validators.hpp:526
input_file_validator & operator=(input_file_validator const &)=default
Defaulted.
A validator that checks if a given path is a valid output directory.
Definition: validators.hpp:828
output_directory_validator()=default
Defaulted.
output_directory_validator & operator=(output_directory_validator const &)=default
Defaulted.
virtual ~output_directory_validator()=default
Virtual Destructor.
output_directory_validator(output_directory_validator &&)=default
Defaulted.
output_directory_validator(output_directory_validator const &)=default
Defaulted.
virtual void operator()(std::filesystem::path const &dir) const override
Tests whether path is writable.
Definition: validators.hpp:855
output_directory_validator & operator=(output_directory_validator &&)=default
Defaulted.
std::string get_help_page_message() const
Returns a message that can be appended to the (positional) options help page info.
Definition: validators.hpp:889
A validator that checks if a given path is a valid output file.
Definition: validators.hpp:635
output_file_validator(output_file_validator &&)=default
Defaulted.
output_file_validator(output_file_validator const &)=default
Defaulted.
output_file_validator & operator=(output_file_validator const &)=default
Defaulted.
virtual void operator()(std::filesystem::path const &file) const override
Tests whether path is does not already exists and is writable.
Definition: validators.hpp:704
output_file_validator(std::vector< std::string > extensions)
Definition: validators.hpp:659
static std::vector< std::string > default_extensions()
The default extensions of file_t.
Definition: validators.hpp:689
output_file_validator()
Default constructor.
Definition: validators.hpp:648
output_file_validator & operator=(output_file_validator &&)=default
Defaulted.
output_file_open_options mode
Stores the current mode of whether it is valid to overwrite the output file.
Definition: validators.hpp:738
std::string get_help_page_message() const
Returns a message that can be appended to the (positional) options help page info.
Definition: validators.hpp:727
virtual ~output_file_validator()=default
Virtual Destructor.
output_file_validator(output_file_open_options const mode, std::vector< std::string > extensions=default_extensions())
Constructs from a given overwrite mode and a list of valid extensions.
Definition: validators.hpp:670
A validator that checks if a matches a regular expression pattern.
Definition: validators.hpp:913
std::string get_help_page_message() const
Returns a message that can be appended to the (positional) options help page info.
Definition: validators.hpp:956
std::string pattern
The pattern to match.
Definition: validators.hpp:963
void operator()(option_value_type const &cmp) const
Tests whether cmp lies inside values.
Definition: validators.hpp:929
void operator()(range_type const &v) const
Tests whether every filename in list v matches the pattern.
Definition: validators.hpp:946
std::string option_value_type
Type of values that are tested by validator.
Definition: validators.hpp:916
regex_validator(std::string const &pattern_)
Constructing from a vector.
Definition: validators.hpp:921
Argument parser exception thrown when an argument could not be casted to the according type.
Definition: exceptions.hpp:141
A validator that checks whether a value is inside a list of valid values.
Definition: validators.hpp:193
value_list_validator()=default
Defaulted.
void operator()(option_value_type const &cmp) const
Tests whether cmp lies inside values.
Definition: validators.hpp:242
value_list_validator(value_list_validator const &)=default
Defaulted.
option_value_t option_value_type
Type of values that are tested by validator.
Definition: validators.hpp:196
std::string get_help_page_message() const
Returns a message that can be appended to the (positional) options help page info.
Definition: validators.hpp:263
std::vector< option_value_type > values
Minimum of the range to test.
Definition: validators.hpp:271
value_list_validator & operator=(value_list_validator &&)=default
Defaulted.
void operator()(range_type const &range) const
Tests whether every element in range lies inside values.
Definition: validators.hpp:257
value_list_validator(value_list_validator &&)=default
Defaulted.
~value_list_validator()=default
Defaulted.
value_list_validator & operator=(value_list_validator const &)=default
Defaulted.
value_list_validator(range_type rng)
Constructing from a range.
Definition: validators.hpp:217
T clear(T... args)
The Concepts library.
T create_directory(T... args)
T current_exception(T... args)
Auxiliary for pretty printing of exception messages.
Provides seqan3::debug_stream and related types.
T emplace_back(T... args)
T end(T... args)
Provides parser related exceptions.
T exists(T... args)
Provides concepts for core language types and relations that don't have concepts in C++20 (yet).
T filename(T... args)
This header includes C++17 filesystem support and imports it into namespace std::filesystem (independ...
T find(T... args)
T for_each(T... args)
auto operator|(validator1_type &&vali1, validator2_type &&vali2)
Enables the chaining of validators.
Definition: validators.hpp:1104
constexpr ptrdiff_t find_if
Get the index of the first type in a pack that satisfies the given predicate.
Definition: traits.hpp:209
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:70
T has_extension(T... args)
A type that satisfies std::is_arithmetic_v<t>.
The concept for option validators passed to add_option/positional_option.
std::string get_help_page_message() const
Returns a message that can be appended to the (positional) options help page info.
Provides various utility functions.
T is_directory(T... args)
T is_regular_file(T... args)
Provides seqan3::views::join.
std::string to_string(value_type &&...values)
Streams all parameters via the seqan3::debug_stream and returns a concatenated string.
Definition: to_string.hpp:29
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
output_file_open_options
Mode of an output file: Determines whether an existing file can be (silently) overwritten.
Definition: validators.hpp:600
@ create_new
Forbid overwriting the output file.
@ open_or_create
Allow to overwrite the output file.
SeqAn specific customisations in the standard namespace.
#define SEQAN3_DEPRECATED_310
Deprecation message for SeqAn 3.1.0 release.
Definition: platform.hpp:202
#define SEQAN3_RETURN_TYPE_CONSTRAINT(expression, concept_name,...)
Same as writing {expression} -> concept_name<type1[, ...]> in a concept definition.
Definition: platform.hpp:57
Adaptations of concepts from the standard library.
Adaptations of concepts from the Ranges TS.
T regex_match(T... args)
T rethrow_exception(T... args)
Provides seqan3::detail::safe_filesystem_entry.
T size(T... args)
Validator that always returns true.
Definition: validators.hpp:981
void operator()(option_value_t const &) const noexcept
Value cmp always passes validation because the operator never throws.
Definition: validators.hpp:986
option_value_t option_value_type
Type of values that are tested by validator.
Definition: validators.hpp:983
std::string get_help_page_message() const
Since no validation is happening the help message is empty.
Definition: validators.hpp:990
T substr(T... args)
T throw_with_nested(T... args)
Provides traits for seqan3::type_list.
Provides various traits for template packs.
Provides various type traits on generic types.