SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
auxiliary.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 <sstream>
16 #include <vector>
17 
22 #include <seqan3/std/concepts>
23 #include <seqan3/std/type_traits>
24 
25 namespace seqan3::custom
26 {
27 
48 template <typename t>
50 {}; // forward
51 
53 template <typename t>
54 struct argument_parsing<t const> : argument_parsing<t>
55 {};
56 
57 template <typename t>
59 {};
60 
61 template <typename t>
62 struct argument_parsing<t const &> : argument_parsing<t>
63 {};
65 
66 } // seqan3::custom
67 
69 {
70 
72 template <typename t>
74 
81 template <typename option_t>
82 struct enumeration_names_fn
83 {
86  seqan3::is_constexpr_default_constructible_v<remove_cvref_t<option_t>>,
89 
91  SEQAN3_CPO_IMPL(0, (enumeration_names(v))) // ADL
92 
93 
94  template <typename dummy = int> // need to make this a template to enforce deferred initialisation
96  requires requires
97  {
98  { impl(priority_tag<1>{}, s_option_t{}, dummy{}) };
99  std::same_as<decltype(impl(priority_tag<1>{}, s_option_t{}, dummy{})),
101  }
103  auto operator()() const
104  {
105  return impl(priority_tag<1>{}, s_option_t{});
106  }
107 };
108 
109 } // namespace seqan3::detail::adl_only
110 
111 namespace seqan3
112 {
113 
150 template <typename option_type>
152  requires requires { { detail::adl_only::enumeration_names_fn<option_type>{}() }; }
154 inline auto const enumeration_names = detail::adl_only::enumeration_names_fn<option_type>{}();
156 
167 template <typename option_type>
169 SEQAN3_CONCEPT named_enumeration = requires
170 {
171  { seqan3::enumeration_names<option_type> };
172 };
174 
185 template <typename option_type>
190 
205 template <typename char_t, typename option_type>
209 inline debug_stream_type<char_t> & operator<<(debug_stream_type<char_t> & s, option_type && op)
210 {
211  for (auto & [key, value] : enumeration_names<option_type>)
212  {
213  if (op == value)
214  return s << key;
215  }
216 
217  return s << "<UNKNOWN_VALUE>";
218 }
220 
232 {
233  DEFAULT = 0,
234  REQUIRED = 1,
239  ADVANCED = 2,
243  HIDDEN = 4,
248 };
249 
261 struct argument_parser_meta_data // holds all meta information
262 {
296  unsigned man_page_section{1};
312 };
313 
314 } // namespace seqan3
Checks whether the the type can be used in an add_(positional_)option call on the argument parser...
std::vector< std::string > description
A more detailed description that is displayed on the help page in the section "DESCRIPTION". Each std::string appended to the description vector will be treated as a paragraph and is separated by a new line.
Definition: auxiliary.hpp:302
std::string url
A link to your github/gitlab project with the newest release.
Definition: auxiliary.hpp:282
std::string citation
How users shall cite your application.
Definition: auxiliary.hpp:290
std::string version
The version information MAJOR.MINOR.PATH (e.g. 3.1.3)
Definition: auxiliary.hpp:270
Definition: auxiliary.hpp:243
#define SEQAN3_CPO_IMPL(PRIO, TERM)
A macro that helps defining the overload set of a customisation point.
Definition: customisation_point.hpp:45
std::string email
The author&#39;s e-mail address for correspondence.
Definition: auxiliary.hpp:276
A type that can be specialised to provide customisation point implementations for the seqan3::argumen...
Definition: auxiliary.hpp:49
auto const enumeration_names
Return a conversion map from std::string_view to option_type.
Definition: auxiliary.hpp:154
Provides seqan3::debug_stream and related types.
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:306
std::string long_copyright
Detailed copyright information that will be displayed when the user specifies "--copyright" on the co...
Definition: auxiliary.hpp:288
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:294
The main SeqAn3 namespace.
Stores all parser related meta information of the seqan3::argument_parser.
Definition: auxiliary.hpp:261
The Concepts library.
std::string app_name
The application name that will be displayed on the help page.
Definition: auxiliary.hpp:268
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:311
std::string date
The date that the application was last updated. Keep this updated, ! since it will tell your users th...
Definition: auxiliary.hpp:280
Definition: concept.hpp:41
Helper utilities for defining customisation point objects.
Definition: auxiliary.hpp:239
Stream concepts.
Provides C++20 additions to the type_traits header.
Provides various type traits on generic types.
option_spec
Used to further specify argument_parser options/flags.
Definition: auxiliary.hpp:231
Concept for input streams.
std::string short_copyright
Brief copyright (and/or license) information.
Definition: auxiliary.hpp:284
Definition: auxiliary.hpp:234
std::string author
Your name ;-)
Definition: auxiliary.hpp:274
A namespace for third party and standard library specialisations of SeqAn customisation points...
Definition: char.hpp:42
A "pretty printer" for most SeqAn data structures and related types.
Definition: debug_stream_type.hpp:70
Checks whether the free function seqan3::enumeration_names can be called on the type.
The concept std::same_as<T, U> is satisfied if and only if T and U denote the same type...
The default were no checking or special displaying is happening.
Definition: auxiliary.hpp:233
The identity transformation (a transformation_trait that returns the input).
Definition: type_traits:31
std::string short_description
A short description of the application (e.g. "A tool for mapping reads to the genome").
Definition: auxiliary.hpp:272