30 for (
ssize_t i = 0; i != std::ssize(g); ++i) {
35 operator bool ()
const noexcept {
36 return (value[0] != 0) || (value[1] != 0) || (value[2] != 0) || (value[3] != 0);
41 void add(
char32_t c)
noexcept;
47 void add(
char32_t first,
char32_t last)
noexcept;
51 [[nodiscard]]
bool contains(
char32_t c)
const noexcept;
54 for (
ssize_t i = 0; i != std::ssize(g); ++i) {
62 void set_bit(
int i)
noexcept {
63 tt_axiom(i >= 0 && i < 128);
64 value[i / 32] |=
static_cast<uint32_t
>(1) << (i % 32);
67 bool get_bit(
int i)
const noexcept {
68 tt_axiom(i >= 0 && i < 128);
69 return (value[i / 32] &
static_cast<uint32_t
>(1) << (i % 32)) != 0;
72 int popcount() const noexcept {
74 for (
int i = 0; i != 4; ++i) {
75 r += std::popcount(value[i]);
81 unicode_ranges &operator|=(unicode_ranges
const &rhs)
noexcept {
82 for (
int i = 0; i != 4; ++i) {
83 value[i] |= rhs.value[i];
88 [[nodiscard]]
friend std::string to_string(unicode_ranges
const &rhs)
noexcept {
89 return fmt::format(
"{:08x}:{:08x}:{:08x}:{:08x}", rhs.value[3], rhs.value[2], rhs.value[1], rhs.value[0]);
95 for (
int i = 0; i < 4; i++) {
96 if (!((lhs.value[i] & rhs.value[i]) == rhs.value[i])) {
110 return lhs << to_string(rhs);
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:94