33 for (
ssize_t i = 0; i != std::ssize(g); ++i) {
38 operator bool()
const noexcept
40 return (value[0] != 0) || (value[1] != 0) || (value[2] != 0) || (value[3] != 0);
45 void add(
char32_t c)
noexcept;
51 void add(
char32_t first,
char32_t last)
noexcept;
55 [[nodiscard]]
bool contains(
char32_t c)
const noexcept;
59 for (
ssize_t i = 0; i != std::ssize(g); ++i) {
67 void set_bit(
int i)
noexcept
69 tt_axiom(i >= 0 && i < 128);
70 value[i / 32] |=
static_cast<uint32_t
>(1) << (i % 32);
73 bool get_bit(
int i)
const noexcept
75 tt_axiom(i >= 0 && i < 128);
76 return (value[i / 32] &
static_cast<uint32_t
>(1) << (i % 32)) != 0;
79 int popcount() const noexcept
82 for (
int i = 0; i != 4; ++i) {
83 r += std::popcount(value[i]);
88 unicode_ranges &operator|=(unicode_ranges
const &rhs)
noexcept
90 for (
int i = 0; i != 4; ++i) {
91 value[i] |= rhs.value[i];
96 [[nodiscard]]
friend std::string to_string(unicode_ranges
const &rhs)
noexcept
98 return std::format(
"{:08x}:{:08x}:{:08x}:{:08x}", rhs.value[3], rhs.value[2], rhs.value[1], rhs.value[0]);
105 for (
int i = 0; i < 4; i++) {
106 if (!((lhs.value[i] & rhs.value[i]) == rhs.value[i])) {
122 return lhs << to_string(rhs);
130template<
typename CharT>
131struct std::formatter<tt::unicode_ranges, CharT> : std::formatter<std::string_view, CharT> {
134 return std::formatter<std::string_view, CharT>::format(
to_string(t), fc);
Definition grapheme.hpp:21
Unicode Ranges based on the OS/2 table in TrueType fonts.
Definition unicode_ranges.hpp:15
bool contains(char32_t c) const noexcept
Check if the code point is present in the unicode-ranges.
void add(char32_t c) noexcept
Add code point to unicode-ranges.
void add(char32_t first, char32_t last) noexcept
Add code points to unicode-ranges.
friend bool operator>=(unicode_ranges const &lhs, unicode_ranges const &rhs) noexcept
The lhs has at least all bits on the rhs set.
Definition unicode_ranges.hpp:103