Coverage, ClassDef, hb_set_t, and hb_map_t implement.
void del (hb_codepoint_t key) { set (key, INVALID); }
- bool has (hb_codepoint_t key) const
- { return get (key) != INVALID; }
-
- hb_codepoint_t operator [] (unsigned int key) const
- { return get (key); }
-
static constexpr hb_codepoint_t INVALID = HB_MAP_VALUE_INVALID;
+ /* Map interface. */
+ enum { SENTINEL = INVALID };
+ typedef hb_codepoint_t value_t;
+ value_t operator [] (hb_codepoint_t k) const { return get (k); }
+ bool has (hb_codepoint_t k) const { return (*this)[k] != SENTINEL; }
+ bool operator () (hb_codepoint_t k) const { return has (k); }
+
void clear ()
{
memset (items, 0xFF, ((size_t) mask + 1) * sizeof (item_t));
struct Coverage
{
+ /* Map interface. */
enum { SENTINEL = NOT_COVERED };
- unsigned int operator[] (hb_codepoint_t glyph_id) { return get_coverage (glyph_id); }
+ typedef unsigned int value_t;
+ value_t operator [] (hb_codepoint_t k) const { return get (k); }
+ bool has (hb_codepoint_t k) const { return (*this)[k] != SENTINEL; }
+ bool operator () (hb_codepoint_t k) const { return has (k); }
+ unsigned int get (hb_codepoint_t k) const { return get_coverage (k); }
unsigned int get_coverage (hb_codepoint_t glyph_id) const
{
switch (u.format) {
struct ClassDef
{
+ /* Map interface. */
enum { SENTINEL = 0 };
- unsigned int operator[] (hb_codepoint_t glyph_id) { return get_class (glyph_id); }
+ typedef unsigned int value_t;
+ value_t operator [] (hb_codepoint_t k) const { return get (k); }
+ bool has (hb_codepoint_t k) const { return (*this)[k] != SENTINEL; }
+ bool operator () (hb_codepoint_t k) const { return has (k); }
+ unsigned int get (hb_codepoint_t k) const { return get_class (k); }
unsigned int get_class (hb_codepoint_t glyph_id) const
{
switch (u.format) {
void add (hb_codepoint_t g) { elt (g) |= mask (g); }
void del (hb_codepoint_t g) { elt (g) &= ~mask (g); }
- bool has (hb_codepoint_t g) const { return !!(elt (g) & mask (g)); }
+ bool get (hb_codepoint_t g) const { return elt (g) & mask (g); }
void add_range (hb_codepoint_t a, hb_codepoint_t b)
{
for (unsigned int i = a; i < b + 1; i++)
del (i);
}
- bool has (hb_codepoint_t g) const
+ bool get (hb_codepoint_t g) const
{
const page_t *page = page_for (g);
if (!page)
return false;
- return page->has (g);
+ return page->get (g);
}
- bool intersects (hb_codepoint_t first,
- hb_codepoint_t last) const
+
+ /* Map interface. */
+ enum { SENTINEL = false };
+ typedef bool value_t;
+ value_t operator [] (hb_codepoint_t k) const { return get (k); }
+ bool has (hb_codepoint_t k) const { return (*this)[k] != SENTINEL; }
+ bool operator () (hb_codepoint_t k) const { return has (k); }
+
+ bool intersects (hb_codepoint_t first, hb_codepoint_t last) const
{
hb_codepoint_t c = first - 1;
return next (&c) && c <= last;