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>
58 struct argument_parsing<t &> : argument_parsing<t>
59 {};
60 
61 template <typename t>
62 struct argument_parsing<t const &> : argument_parsing<t>
63 {};
65 
66 } // seqan3::custom
67 
68 namespace seqan3::detail::adl_only
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>>,
87  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>
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
sstream
seqan3::argument_parser_meta_data::citation
std::string citation
How users shall cite your application.
Definition: auxiliary.hpp:290
seqan3::option_spec
option_spec
Used to further specify argument_parser options/flags.
Definition: auxiliary.hpp:231
std::string
type_traits
Provides C++20 additions to the type_traits header.
seqan3::argument_parser_meta_data::short_description
std::string short_description
A short description of the application (e.g. "A tool for mapping reads to the genome").
Definition: auxiliary.hpp:272
seqan3::argument_parser_meta_data::description
std::vector< std::string > description
A more detailed description that is displayed on the help page in the section "DESCRIPTION"....
Definition: auxiliary.hpp:302
concept.hpp
Stream concepts.
seqan3::enumeration_names
const auto enumeration_names
Return a conversion map from std::string_view to option_type.
Definition: auxiliary.hpp:154
SEQAN3_CPO_IMPL
#define SEQAN3_CPO_IMPL(PRIO, TERM)
A macro that helps defining the overload set of a customisation point.
Definition: customisation_point.hpp:45
vector
seqan3::argument_parser_meta_data::version
std::string version
The version information MAJOR.MINOR.PATH (e.g. 3.1.3)
Definition: auxiliary.hpp:270
seqan3::DEFAULT
The default were no checking or special displaying is happening.
Definition: auxiliary.hpp:233
basic.hpp
Provides various type traits on generic types.
seqan3::argument_parser_meta_data::man_page_title
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
debug_stream_type.hpp
Provides seqan3::debug_stream and related types.
seqan3::argument_parser_meta_data
Stores all parser related meta information of the seqan3::argument_parser.
Definition: auxiliary.hpp:261
concepts
The Concepts library.
seqan3::argument_parser_meta_data::short_copyright
std::string short_copyright
Brief copyright (and/or license) information.
Definition: auxiliary.hpp:284
seqan3::debug_stream_type
A "pretty printer" for most SeqAn data structures and related types.
Definition: debug_stream_type.hpp:70
same_as
The concept std::same_as<T, U> is satisfied if and only if T and U denote the same type.
seqan3::REQUIRED
Definition: auxiliary.hpp:234
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:36
seqan3::argument_parser_meta_data::man_page_section
unsigned man_page_section
The man page section info (type man man on the command line for more information).
Definition: auxiliary.hpp:296
seqan3::argument_parser_meta_data::url
std::string url
A link to your github/gitlab project with the newest release.
Definition: auxiliary.hpp:282
seqan3::argument_parser_meta_data::author
std::string author
Your name ;-)
Definition: auxiliary.hpp:274
seqan3::argument_parser_meta_data::email
std::string email
The author's e-mail address for correspondence.
Definition: auxiliary.hpp:276
named_enumeration
Checks whether the free function seqan3::enumeration_names can be called on the type.
argument_parser_compatible_option
Checks whether the the type can be used in an add_(positional_)option call on the argument parser.
seqan3::operator<<
debug_stream_type< char_t > & operator<<(debug_stream_type< char_t > &stream, tuple_t const &alignment)
Stream operator for alignments, which are represented as tuples of aligned sequences.
Definition: aligned_sequence_concept.hpp:559
std::type_identity
The identity transformation (a transformation_trait that returns the input).
Definition: type_traits:31
seqan3::argument_parser_meta_data::date
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
seqan3::HIDDEN
Definition: auxiliary.hpp:243
seqan3::custom::argument_parsing
A type that can be specialised to provide customisation point implementations for the seqan3::argumen...
Definition: auxiliary.hpp:49
input_stream_over
Concept for input streams.
std::conditional_t
seqan3::argument_parser_meta_data::long_copyright
std::string long_copyright
Detailed copyright information that will be displayed when the user specifies "--copyright" on the co...
Definition: auxiliary.hpp:288
seqan3::argument_parser_meta_data::synopsis
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
seqan3::ADVANCED
Definition: auxiliary.hpp:239
seqan3::argument_parser_meta_data::examples
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::unordered_map
seqan3::argument_parser_meta_data::app_name
std::string app_name
The application name that will be displayed on the help page.
Definition: auxiliary.hpp:268
seqan3::custom
A namespace for third party and standard library specialisations of SeqAn customisation points.
Definition: char.hpp:42
customisation_point.hpp
Helper utilities for defining customisation point objects.