SeqAn3 3.4.0-rc.4
The Modern C++ library for sequence analysis.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
auxiliary.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <concepts>
13#include <sstream>
14#include <type_traits>
15#include <unordered_map>
16#include <vector>
17
21
22SEQAN3_DEPRECATED_HEADER("This header and its functionality is deprecated and will be removed in a future version of SeqAn. Please use the sharg-parser (url: https://github.com/seqan/sharg-parser) instead.");
23
24namespace seqan3::custom
25{
26
49template <typename t>
51{}; // forward
52
54template <typename t>
56{};
57
58template <typename t>
59struct argument_parsing<t &> : argument_parsing<t>
60{};
61
62template <typename t>
63struct argument_parsing<t const &> : argument_parsing<t>
64{};
66
67} // namespace seqan3::custom
68
69namespace seqan3::detail::adl_only
70{
71
73template <typename t>
74std::unordered_map<std::string_view, t> enumeration_names(t) = delete;
75
79template <typename option_t>
80struct enumeration_names_cpo : public detail::customisation_point_object<enumeration_names_cpo<option_t>, 1>
81{
83 using base_t = detail::customisation_point_object<enumeration_names_cpo<option_t>, 1>;
85 using base_t::base_t;
86
90 template <typename option_type>
91 using option_or_type_identity =
95
99 template <typename option_type = option_t>
100 static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<1>)(
102 );
103
113 template <typename option_type = option_t>
114 static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<0>)(
115 /*return*/ enumeration_names(option_or_type_identity<option_type>{}) /*;*/
116 );
117};
118
119} // namespace seqan3::detail::adl_only
120
121namespace seqan3
122{
123
162template <typename option_type>
163 requires requires {
164 { detail::adl_only::enumeration_names_cpo<option_type>{}() };
166inline auto const enumeration_names = detail::adl_only::enumeration_names_cpo<option_type>{}();
168
182template <typename option_type>
183concept named_enumeration = requires {
185};
187
201template <typename option_type>
205
214template <named_enumeration enum_t>
215struct enumeration_printer<enum_t>
216{
224 template <typename stream_t>
225 constexpr void operator()(stream_t & stream, enum_t const arg) const
226 {
227 for (auto & [label, enumerator] : enumeration_names<enum_t>)
228 {
229 if (arg == enumerator)
230 {
231 stream << label;
232 return;
233 }
234 }
235
236 stream << "<UNKNOWN_VALUE>";
237 }
238};
239
252enum option_spec
253{
254 standard = 0,
260 advanced = 2,
268};
269
271enum class update_notifications
272{
273 on,
274 off
275};
276
290struct argument_parser_meta_data // holds all meta information
291{
325 unsigned man_page_section{1};
341};
342
343} // namespace seqan3
A "pretty printer" for most SeqAn data structures and related types.
Definition debug_stream_type.hpp:79
Helper utilities for defining customisation point objects (CPOs).
#define SEQAN3_CPO_OVERLOAD(...)
A macro that helps to define a seqan3::detail::customisation_point_object.
Definition customisation_point.hpp:106
Provides seqan3::debug_stream and related types.
auto const enumeration_names
Return a conversion map from std::string_view to option_type.
Definition auxiliary.hpp:162
option_spec
Used to further specify argument_parser options/flags.
Definition auxiliary.hpp:249
@ standard
The default were no checking or special displaying is happening.
Definition auxiliary.hpp:250
@ advanced
Definition auxiliary.hpp:256
@ hidden
Definition auxiliary.hpp:260
@ required
Definition auxiliary.hpp:251
Checks whether the the type can be used in an add_(positional_)option call on the argument parser.
Concept for input streams.
Checks whether the free function seqan3::enumeration_names can be called on the type.
Stream concepts.
A namespace for third party and standard library specialisations of SeqAn customisation points.
Definition char.hpp:40
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
update_notifications
Indicates whether application allows automatic update notifications by the seqan3::argument_parser.
Definition auxiliary.hpp:268
@ off
Automatic update notifications should be disabled.
@ on
Automatic update notifications should be enabled.
std::string long_copyright
Detailed copyright information that will be displayed when the user specifies "--copyright" on the co...
Definition auxiliary.hpp:313
std::string man_page_title
The title of your man page when exported by specifying "--export-help man" on the common line.
Definition auxiliary.hpp:319
std::string email
The author's e-mail address for correspondence.
Definition auxiliary.hpp:301
std::string short_copyright
Brief copyright (and/or license) information.
Definition auxiliary.hpp:309
std::string date
The date that the application was last updated. Keep this updated, ! since it will tell your users th...
Definition auxiliary.hpp:305
std::string author
Your name ;-)
Definition auxiliary.hpp:299
std::string version
The version information MAJOR.MINOR.PATH (e.g. 3.1.3)
Definition auxiliary.hpp:295
std::string app_name
The application name that will be displayed on the help page.
Definition auxiliary.hpp:293
std::vector< std::string > synopsis
Add lines of usage to the synopsis section of the help page (e.g. "./my_read_mapper [OPTIONS] FILE1 F...
Definition auxiliary.hpp:331
std::string short_description
A short description of the application (e.g. "A tool for mapping reads to the genome").
Definition auxiliary.hpp:297
std::string url
A link to your github/gitlab project with the newest release.
Definition auxiliary.hpp:307
std::string citation
How users shall cite your application.
Definition auxiliary.hpp:315
std::vector< std::string > description
A more detailed description that is displayed on the help page in the section "DESCRIPTION"....
Definition auxiliary.hpp:327
std::vector< std::string > examples
Provide some examples on how to use your tool and what standard parameters might be appropriate in di...
Definition auxiliary.hpp:336
unsigned man_page_section
The man page section info (type man man on the command line for more information).
Definition auxiliary.hpp:321
A type that can be specialised to provide customisation point implementations for the seqan3::argumen...
Definition auxiliary.hpp:51
Hide me