SeqAn3  3.1.0
The Modern C++ library for sequence analysis.
predicate.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2021, 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>
47  requires (interval_first <= interval_last)
49 inline constexpr auto is_in_interval = detail::is_in_interval_type<interval_first, interval_last>{};
50 
64 template <int char_v>
65 inline constexpr auto is_char = detail::is_char_type<char_v>{};
66 
77 inline auto constexpr is_eof = is_char<EOF>;
78 
92 inline auto constexpr is_cntrl = is_in_interval<'\0', static_cast<char>(31)> ||
93  is_char<static_cast<char>(127)>;
94 
107 inline auto constexpr is_print = is_in_interval<' ', '~'> ;
108 
128 inline auto constexpr is_space = is_in_interval<'\t', '\r'> || is_char<' '>;
129 
145 inline auto constexpr is_blank = is_char<'\t'> || is_char<' '>;
146 
165 inline auto constexpr is_graph = is_in_interval<'!', '~'>;
166 
181 inline auto constexpr is_punct = is_in_interval<'!', '/'> ||
182  is_in_interval<':', '@'> ||
183  is_in_interval<'[', '`'> ||
184  is_in_interval<'{', '~'>;
185 
202 inline auto constexpr is_alnum = is_in_interval<'0','9'> ||
203  is_in_interval<'A','Z'> ||
204  is_in_interval<'a','z'>;
205 
221 inline auto constexpr is_alpha = is_in_interval<'A', 'Z'> || is_in_interval<'a', 'z'>;
222 
237 inline auto constexpr is_upper = is_in_interval<'A', 'Z'>;
238 
253 inline auto constexpr is_lower = is_in_interval<'a', 'z'>;
254 
269 inline auto constexpr is_digit = is_in_interval<'0', '9'>;
270 
287 inline auto constexpr is_xdigit = is_in_interval<'0', '9'> ||
288  is_in_interval<'A', 'F'> ||
289  is_in_interval<'a', 'f'>;
291 
886 } // namespace seqan3
constexpr auto is_alnum
Checks whether c is a alphanumeric character.
Definition: predicate.hpp:202
constexpr auto is_graph
Checks whether c is a graphic character.
Definition: predicate.hpp:165
constexpr auto is_eof
Checks whether a given letter is equal to the EOF constant defined in <cstdio>.
Definition: predicate.hpp:77
constexpr auto is_blank
Checks whether c is a blank character.
Definition: predicate.hpp:145
constexpr auto is_punct
Checks whether c is a punctuation character.
Definition: predicate.hpp:181
constexpr auto is_digit
Checks whether c is a digital character.
Definition: predicate.hpp:269
constexpr auto is_alpha
Checks whether c is a alphabetical character.
Definition: predicate.hpp:221
constexpr auto is_char
Checks whether a given letter is the same as the template non-type argument.
Definition: predicate.hpp:65
constexpr auto is_print
Checks whether c is a printable character.
Definition: predicate.hpp:107
constexpr auto is_space
Checks whether c is a space character.
Definition: predicate.hpp:128
constexpr auto is_xdigit
Checks whether c is a hexadecimal character.
Definition: predicate.hpp:287
constexpr auto is_upper
Checks whether c is a upper case character.
Definition: predicate.hpp:237
constexpr auto is_cntrl
Checks whether c is a control character.
Definition: predicate.hpp:92
constexpr auto is_in_interval
Checks whether a given letter is in the specified interval.
Definition: predicate.hpp:49
constexpr auto is_lower
Checks whether c is a lower case character.
Definition: predicate.hpp:253
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Provides parse conditions for tokenization.