29 template <
typename list_t,
template <
typename ...>
typename output_t>
34 template <
template <
typename...>
typename output_t,
typename ...ts>
47 template <std::output_iterator<
char> it_t>
48 constexpr
void write_eol(it_t & it,
bool const add_cr)
66 template <
typename format_variant_type>
72 bool format_found =
false;
74 if (extension.
size() > 1)
76 extension = extension.
substr(1);
77 detail::for_each<valid_formats>([&] (
auto fmt)
79 using fm_type =
typename decltype(fmt)::type;
81 for (
auto const & ext : fm_type::file_extensions)
83 if (std::ranges::equal(ext, extension))
85 format.template emplace<fm_type>();
102 template <
typename list_t>
106 template <
template <
typename ...>
typename list_t,
typename ...ts>
107 requires (requires { ts::file_extensions; }, ...,
true)
116 template <
typename query_t>
120 template <
typename query_t>
121 requires requires {
typename query_t::valid_formats; }
122 inline constexpr
bool has_type_valid_formats<query_t> =
true;
144 template <
typename formats_t>
147 static_assert(has_member_file_extensions<formats_t>,
148 "Expects that all formats have a static member file_extensions storing the extensions in a range");
151 detail::for_each<formats_t>([&extensions] (
auto t_identity)
153 using format_t =
typename decltype(t_identity)::type;
154 std::ranges::copy(format_t::file_extensions, std::cpp20::back_inserter(extensions));
Adaptations of algorithms from the Ranges TS.
This header includes C++17 filesystem support and imports it into namespace std::filesystem (independ...
typename transfer_template_args_onto< source_type, target_template >::type transfer_template_args_onto_t
Shortcut for seqan3::detail::transfer_template_args_onto (transformation_trait shortcut).
Definition: template_inspection.hpp:77
void set_format(format_variant_type &format, std::filesystem::path const &file_name)
Sets the file format according to the file name extension.
Definition: misc.hpp:67
constexpr bool has_type_valid_formats
Helper function to determine if a type has a static member valid_formats.
Definition: misc.hpp:117
std::vector< std::string > valid_file_extensions()
Returns a list of valid file extensions.
Definition: misc.hpp:145
constexpr void write_eol(it_t &it, bool const add_cr)
Write "\n" or "\r\n" to the stream iterator, depending on arguments.
Definition: misc.hpp:48
constexpr bool has_member_file_extensions
Helper function to determine if all types in a format type list have a static member file_extensions.
Definition: misc.hpp:103
Provides exceptions used in the I/O module.
Provides C++20 additions to the <iterator> header.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Provides algorithms for meta programming, parameter packs and seqan3::type_list.
Type that contains multiple types.
Definition: type_list.hpp:29
Thrown if there is no format that accepts a given file extension.
Definition: exception.hpp:30
Provides type traits for working with templates.