HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
ucd_bidi_paired_bracket_types.hpp
1// This file was generated by generate_unicode_data.py
2
3#pragma once
4
5#include "../utility/utility.hpp"
6#include <cstdint>
7#include <optional>
8#include <bit>
9#include <string_view>
10#include <string>
11
12hi_export_module(hikogui.unicode.ucd_bidi_paired_bracket_types);
13
14hi_export namespace hi {
15inline namespace v1 {
16namespace detail {
17
18constexpr auto ucd_bidi_paired_bracket_types_chunk_size = 128_uz;
19constexpr auto ucd_bidi_paired_bracket_types_index_width = 4_uz;
20constexpr auto ucd_bidi_paired_bracket_types_indices_size = 512_uz;
21constexpr auto ucd_bidi_paired_bracket_type_width = 2_uz;
22
23static_assert(std::has_single_bit(ucd_bidi_paired_bracket_types_chunk_size));
24
25constexpr uint8_t ucd_bidi_paired_bracket_types_indices_bytes[272] = {
26 1, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 33, 17, 17, 17, 17, 17, 17, 19, 17, 17, 17, 17, 17, 17, 17, 17, 17,
27 69, 17, 17, 97, 17, 17, 17,120, 17, 25, 17, 17, 17, 17,161, 17,177, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
28 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
29 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
30 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
31 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
32 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
33 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,193,209,
34 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
35};
36
37constexpr uint8_t ucd_bidi_paired_bracket_types_bytes[464] = {
38 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 32, 0, 0, 0, 0, 0, 0, 1, 32,
39 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
40 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
41 0, 0, 0, 0, 0, 0, 1,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
42 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24,
43 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
44 0, 0,102, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
45 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,102,102,102, 96, 0, 0,
46 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 6,102,102, 0, 0, 0, 0,
47 1,153,153,153,153,153,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,102, 0, 0, 0, 0, 0, 0, 0, 0, 96,
48 0, 0, 0, 0, 0, 0, 0, 0, 6,102, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25,153,128, 0, 0, 0, 0, 0, 0, 0, 0,
49 0, 0,102,102, 96,102,102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
50 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25,152, 0, 0, 0, 0, 0, 0, 0, 0,
51 0, 0, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 32, 0, 0, 0, 0, 0, 0, 1, 33,134, 0, 0, 0, 0, 0, 0, 0,
52 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
53};
54
55
56} // namespace detail
57
58enum class unicode_bidi_paired_bracket_type : uint8_t {
59 n = 0,
60 o = 1,
61 c = 2,
62};
63
64[[nodiscard]] constexpr unicode_bidi_paired_bracket_type ucd_get_bidi_paired_bracket_type(char32_t code_point) noexcept
65{
66 constexpr auto max_code_point_hi = detail::ucd_bidi_paired_bracket_types_indices_size - 1;
67
68 auto code_point_hi = code_point / detail::ucd_bidi_paired_bracket_types_chunk_size;
69 auto const code_point_lo = code_point % detail::ucd_bidi_paired_bracket_types_chunk_size;
70
71 if (code_point_hi > max_code_point_hi) {
72 code_point_hi = max_code_point_hi;
73 }
74
75 auto const chunk_index = load_bits_be<detail::ucd_bidi_paired_bracket_types_index_width>(
76 detail::ucd_bidi_paired_bracket_types_indices_bytes,
77 code_point_hi * detail::ucd_bidi_paired_bracket_types_index_width);
78
79 // Add back in the lower-bits of the code-point.
80 auto const index = (chunk_index * detail::ucd_bidi_paired_bracket_types_chunk_size) + code_point_lo;
81
82 // Get the canonical combining class from the table.
83 auto const value = load_bits_be<detail::ucd_bidi_paired_bracket_type_width>(
84 detail::ucd_bidi_paired_bracket_types_bytes, index * detail::ucd_bidi_paired_bracket_type_width);
85
86 return static_cast<unicode_bidi_paired_bracket_type>(value);
87}
88
89}} // namespace hi::v1
90
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20