HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
unicode_general_category.hpp
1// Copyright Take Vos 2020.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include <cstdint>
8
9namespace tt {
10
11enum class unicode_general_category : uint8_t {
12 unknown,
13 Lu,
14 Ll,
15 Lt,
16 Lm,
17 Lo,
18 Mn,
19 Mc,
20 Me,
21 Nd,
22 Nl,
23 No,
24 Pc,
25 Pd,
26 Ps,
27 Pe,
28 Pi,
29 Pf,
30 Po,
31 Sm,
32 Sc,
33 Sk,
34 So,
35 Zs,
36 Zl,
37 Zp,
38 Cc,
39 Cf,
40 Cs,
41 Co,
42 Cn
43};
44
45[[nodiscard]] constexpr bool is_LC(unicode_general_category const &rhs) noexcept
46{
47 using enum unicode_general_category;
48 return rhs == Lu || rhs == Ll || rhs == Lt;
49}
50
51[[nodiscard]] constexpr bool is_L(unicode_general_category const &rhs) noexcept
52{
53 using enum unicode_general_category;
54 return is_LC(rhs) || rhs == Lm || rhs == Lo;
55}
56
57[[nodiscard]] constexpr bool is_M(unicode_general_category const &rhs) noexcept
58{
59 using enum unicode_general_category;
60 return rhs == Mn || rhs == Mc || rhs == Me;
61}
62
63[[nodiscard]] constexpr bool is_N(unicode_general_category const &rhs) noexcept
64{
65 using enum unicode_general_category;
66 return rhs == Nd || rhs == Nl || rhs == No;
67}
68
69[[nodiscard]] constexpr bool is_P(unicode_general_category const &rhs) noexcept
70{
71 using enum unicode_general_category;
72 return rhs == Pc || rhs == Pd || rhs == Ps || rhs == Pe || rhs == Pi || rhs == Pf || rhs == Po;
73}
74
75[[nodiscard]] constexpr bool is_S(unicode_general_category const &rhs) noexcept
76{
77 using enum unicode_general_category;
78 return rhs == Sm || rhs == Sc || rhs == Sk || rhs == So;
79}
80
81[[nodiscard]] constexpr bool is_Z(unicode_general_category const &rhs) noexcept
82{
83 using enum unicode_general_category;
84 return rhs == Zs || rhs == Zl || rhs == Zp;
85}
86
87[[nodiscard]] constexpr bool is_C(unicode_general_category const &rhs) noexcept
88{
89 using enum unicode_general_category;
90 return rhs == Cc || rhs == Cf || rhs == Cs || rhs == Co || rhs == Cn;
91}
92
93[[nodiscard]] constexpr bool is_visible(unicode_general_category const &rhs) noexcept
94{
95 return is_L(rhs) | is_M(rhs) | is_N(rhs) | is_P(rhs) | is_S(rhs);
96}
97
98} // namespace tt