SeqAn3  3.2.0-rc.1
The Modern C++ library for sequence analysis.
predicate.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2022, 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 
14 #pragma once
15 
17 
18 // ----------------------------------------------------------------------------
19 // General Purpose Char predicates
20 // ----------------------------------------------------------------------------
21 
22 namespace seqan3
23 {
24 
45 template <uint8_t interval_first, uint8_t interval_last>
46  requires (interval_first <= interval_last)
47 inline constexpr auto is_in_interval = detail::is_in_interval_type<interval_first, interval_last>{};
48 
62 template <int char_v>
63 inline constexpr auto is_char = detail::is_char_type<char_v>{};
64 
75 inline constexpr auto is_eof = is_char<EOF>;
76 
90 inline constexpr auto is_cntrl = is_in_interval<'\0', static_cast<char>(31)> || is_char<static_cast<char>(127)>;
91 
104 inline constexpr auto is_print = is_in_interval<' ', '~'>;
105 
125 inline constexpr auto is_space = is_in_interval<'\t', '\r'> || is_char<' '>;
126 
142 inline constexpr auto is_blank = is_char<'\t'> || is_char<' '>;
143 
162 inline constexpr auto is_graph = is_in_interval<'!', '~'>;
163 
178 inline constexpr auto is_punct =
179  is_in_interval<'!', '/'> || is_in_interval<':', '@'> || is_in_interval<'[', '`'> || is_in_interval<'{', '~'>;
180 
197 inline constexpr auto is_alnum = is_in_interval<'0', '9'> || is_in_interval<'A', 'Z'> || is_in_interval<'a', 'z'>;
198 
214 inline constexpr auto is_alpha = is_in_interval<'A', 'Z'> || is_in_interval<'a', 'z'>;
215 
230 inline constexpr auto is_upper = is_in_interval<'A', 'Z'>;
231 
246 inline constexpr auto is_lower = is_in_interval<'a', 'z'>;
247 
262 inline constexpr auto is_digit = is_in_interval<'0', '9'>;
263 
280 inline constexpr auto is_xdigit = is_in_interval<'0', '9'> || is_in_interval<'A', 'F'> || is_in_interval<'a', 'f'>;
282 
877 } // namespace seqan3
requires requires
The rank_type of the semi-alphabet; defined as the return type of seqan3::to_rank....
Definition: alphabet/concept.hpp:164
constexpr auto is_alnum
Checks whether c is a alphanumeric character.
Definition: predicate.hpp:197
constexpr auto is_graph
Checks whether c is a graphic character.
Definition: predicate.hpp:162
constexpr auto is_eof
Checks whether a given letter is equal to the EOF constant defined in <cstdio>.
Definition: predicate.hpp:75
constexpr auto is_blank
Checks whether c is a blank character.
Definition: predicate.hpp:142
constexpr auto is_punct
Checks whether c is a punctuation character.
Definition: predicate.hpp:178
constexpr auto is_digit
Checks whether c is a digital character.
Definition: predicate.hpp:262
constexpr auto is_alpha
Checks whether c is a alphabetical character.
Definition: predicate.hpp:214
constexpr auto is_char
Checks whether a given letter is the same as the template non-type argument.
Definition: predicate.hpp:63
constexpr auto is_print
Checks whether c is a printable character.
Definition: predicate.hpp:104
constexpr auto is_space
Checks whether c is a space character.
Definition: predicate.hpp:125
constexpr auto is_xdigit
Checks whether c is a hexadecimal character.
Definition: predicate.hpp:280
constexpr auto is_upper
Checks whether c is a upper case character.
Definition: predicate.hpp:230
constexpr auto is_cntrl
Checks whether c is a control character.
Definition: predicate.hpp:90
constexpr auto is_lower
Checks whether c is a lower case character.
Definition: predicate.hpp:246
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Provides parse conditions for tokenization.