6#include "TTauri/Text/Grapheme.hpp"
28 for (
ssize_t i = 0; i != ssize(g); ++i) {
33 operator bool ()
const noexcept {
34 return (value[0] != 0) || (value[1] != 0) || (value[2] != 0) || (value[3] != 0);
39 void add(
char32_t c)
noexcept;
45 void add(
char32_t first,
char32_t last)
noexcept;
49 [[nodiscard]]
bool contains(
char32_t c)
const noexcept;
52 for (
ssize_t i = 0; i != ssize(g); ++i) {
60 void set_bit(
int i)
noexcept {
61 tt_assume(i >= 0 && i < 128);
62 value[i / 32] |=
static_cast<uint32_t
>(1) << (i % 32);
65 bool get_bit(
int i)
const noexcept {
66 tt_assume(i >= 0 && i < 128);
67 return (value[i / 32] &
static_cast<uint32_t
>(1) << (i % 32)) != 0;
70 int popcount() const noexcept {
72 for (
int i = 0; i != 4; ++i) {
73 r += ::tt::popcount(value[i]);
79 UnicodeRanges &operator|=(UnicodeRanges
const &rhs)
noexcept {
80 for (
int i = 0; i != 4; ++i) {
81 value[i] |= rhs.value[i];
86 [[nodiscard]]
friend std::string to_string(UnicodeRanges
const &rhs)
noexcept {
87 return fmt::format(
"{:08x}:{:08x}:{:08x}:{:08x}", rhs.value[3], rhs.value[2], rhs.value[1], rhs.value[0]);
93 for (
int i = 0; i < 4; i++) {
94 if (!((lhs.value[i] & rhs.value[i]) == rhs.value[i])) {
108 return lhs << to_string(rhs);
Definition Grapheme.hpp:20
Unicode Ranges based on the OS/2 table in TrueType fonts.
Definition UnicodeRanges.hpp:13
void add(char32_t first, char32_t last) noexcept
Add code points to unicode-ranges.
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.
friend bool operator>=(UnicodeRanges const &lhs, UnicodeRanges const &rhs) noexcept
The lhs has at least all bits on the rhs set.
Definition UnicodeRanges.hpp:92