42 unicode_general_category general_category,
43 unicode_grapheme_cluster_break grapheme_cluster_break,
44 unicode_line_break_class line_break_class,
45 unicode_word_break_property word_break_property,
46 unicode_sentence_break_property sentence_break_property,
47 unicode_east_asian_width east_asian_width,
48 unicode_script script,
49 unicode_bidi_class bidi_class,
50 unicode_bidi_bracket_type bidi_bracket_type,
51 char32_t bidi_mirroring_glyph,
52 uint8_t canonical_combining_class,
53 unicode_decomposition_type decomposition_type,
54 uint32_t decomposition_index,
55 uint16_t composition_index) noexcept :
56 _general_category(to_underlying(general_category)),
57 _grapheme_cluster_break(to_underlying(grapheme_cluster_break)),
58 _line_break_class(to_underlying(line_break_class)),
59 _word_break_property(to_underlying(word_break_property)),
60 _sentence_break_property(to_underlying(sentence_break_property)),
61 _east_asian_width(to_underlying(east_asian_width)),
62 _script(to_underlying(script)),
63 _bidi_class(to_underlying(bidi_class)),
64 _bidi_bracket_type(to_underlying(bidi_bracket_type)),
65 _bidi_mirroring_glyph(truncate<uint32_t>(bidi_mirroring_glyph)),
66 _canonical_combining_class(truncate<uint32_t>(canonical_combining_class)),
67 _decomposition_type(to_underlying(decomposition_type)),
68 _decomposition_index(truncate<uint32_t>(decomposition_index)),
69 _composition_index(truncate<uint16_t>(composition_index))
71 hi_axiom(to_underlying(general_category) <= 0x1f);
72 hi_axiom(to_underlying(grapheme_cluster_break) <= 0x0f);
73 hi_axiom(to_underlying(line_break_class) <= 0x3f);
74 hi_axiom(to_underlying(word_break_property) <= 0x1f);
75 hi_axiom(to_underlying(sentence_break_property) <= 0xf);
76 hi_axiom(to_underlying(east_asian_width) <= 0x7);
77 hi_axiom(to_underlying(script) <= 0xff);
78 hi_axiom(to_underlying(bidi_class) <= 0x1f);
79 hi_axiom(to_underlying(bidi_bracket_type) <= 0x03);
80 hi_axiom(
static_cast<uint32_t
>(bidi_mirroring_glyph) <= 0xffff);
81 hi_axiom(
static_cast<uint32_t
>(canonical_combining_class) <= 0xff);
82 hi_axiom(to_underlying(decomposition_type) <= 0x1f);
83 hi_axiom(
static_cast<uint32_t
>(decomposition_index) <= 0x1f'ffff);
84 hi_axiom(
static_cast<uint32_t
>(composition_index) <= 0x3fff);
95 return static_cast<unicode_general_category
>(_general_category);
106 return static_cast<unicode_grapheme_cluster_break
>(_grapheme_cluster_break);
109 [[nodiscard]]
constexpr unicode_line_break_class line_break_class() const noexcept
111 return static_cast<unicode_line_break_class
>(_line_break_class);
114 [[nodiscard]]
constexpr unicode_word_break_property word_break_property() const noexcept
116 return static_cast<unicode_word_break_property
>(_word_break_property);
119 [[nodiscard]]
constexpr unicode_sentence_break_property sentence_break_property() const noexcept
121 return static_cast<unicode_sentence_break_property
>(_sentence_break_property);
124 [[nodiscard]]
constexpr unicode_east_asian_width east_asian_width() const noexcept
126 return static_cast<unicode_east_asian_width
>(_east_asian_width);
135 [[nodiscard]]
constexpr unicode_bidi_class
bidi_class() const noexcept
137 return static_cast<unicode_bidi_class
>(_bidi_class);
142 [[nodiscard]]
constexpr unicode_script
script() const noexcept
144 return static_cast<unicode_script
>(_script);
155 return static_cast<unicode_bidi_bracket_type
>(_bidi_bracket_type);
163 return truncate<char32_t>(_bidi_mirroring_glyph);
171 return static_cast<unicode_decomposition_type
>(_decomposition_type);
185 return truncate<uint8_t>(_canonical_combining_class);
199 [[nodiscard]]
char32_t compose(
char32_t other) const noexcept;
207 [[nodiscard]] constexpr
char32_t canonical_equivalent() const noexcept
209 if (decomposition_type() == unicode_decomposition_type::canonical and _decomposition_index <= 0x1f'ffff) {
210 return truncate<char32_t>(_decomposition_index);
228 [[nodiscard]]
friend bool operator==(
unicode_description const& lhs, unicode_general_category
const& rhs)
noexcept
230 return lhs.general_category() == rhs;
233 [[nodiscard]]
friend bool operator==(
unicode_description const& lhs, unicode_decomposition_type
const& rhs)
noexcept
235 return lhs.decomposition_type() == rhs;
238 [[nodiscard]]
friend bool operator==(unicode_description
const& lhs, unicode_bidi_bracket_type
const& rhs)
noexcept
240 return lhs.bidi_bracket_type() == rhs;
243 [[nodiscard]]
friend bool operator==(unicode_description
const& lhs, unicode_bidi_class
const& rhs)
noexcept
245 return lhs.bidi_class() == rhs;
247 [[nodiscard]]
friend bool operator==(unicode_description
const& lhs, unicode_east_asian_width
const& rhs)
noexcept
249 return lhs.east_asian_width() == rhs;
252 [[nodiscard]]
friend bool operator==(unicode_description
const& lhs, unicode_sentence_break_property
const& rhs)
noexcept
254 return lhs.sentence_break_property() == rhs;
257 [[nodiscard]]
friend bool operator==(unicode_description
const& lhs, unicode_line_break_class
const& rhs)
noexcept
259 return lhs.line_break_class() == rhs;
262 [[nodiscard]]
friend bool operator==(unicode_description
const& lhs, unicode_word_break_property
const& rhs)
noexcept
264 return lhs.word_break_property() == rhs;
267 [[nodiscard]]
friend bool operator==(unicode_description
const& lhs, unicode_grapheme_cluster_break
const& rhs)
noexcept
269 return lhs.grapheme_cluster_break() == rhs;
272 [[nodiscard]]
friend bool is_C(unicode_description
const& rhs)
noexcept
274 return is_C(rhs.general_category());
279 uint64_t _general_category : 5;
280 uint64_t _grapheme_cluster_break : 4;
281 uint64_t _line_break_class : 6;
282 uint64_t _word_break_property : 5;
283 uint64_t _sentence_break_property : 4;
284 uint64_t _east_asian_width : 3;
285 uint64_t _bidi_class : 5;
286 uint64_t _bidi_bracket_type : 2;
287 uint64_t _bidi_mirroring_glyph : 16;
288 uint64_t _canonical_combining_class : 8;
289 uint64_t _word0_reserved : 6 = 0;
292 uint64_t _script : 8;
293 uint64_t _decomposition_type : 5;
294 uint64_t _decomposition_index : 21;
295 uint64_t _composition_index : 14;
296 uint64_t _word1_reserved : 16 = 0;