[iter] Fix operator() impls

This commit is contained in:
Behdad Esfahbod 2019-01-28 16:34:04 -05:00
parent 57795bc8dd
commit d438e61042
3 changed files with 10 additions and 6 deletions

View File

@ -162,12 +162,13 @@ struct hb_map_t
static constexpr hb_codepoint_t INVALID = HB_MAP_VALUE_INVALID;
/* Map interface. */
/* Has interface. */
static constexpr hb_codepoint_t 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); }
/* Projection. */
hb_codepoint_t operator () (hb_codepoint_t k) const { return get (k); }
void clear ()
{

View File

@ -1035,11 +1035,12 @@ struct CoverageFormat2
struct Coverage
{
/* Map interface. */
/* Has interface. */
static constexpr unsigned SENTINEL = NOT_COVERED;
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; }
/* Predicate. */
bool operator () (hb_codepoint_t k) const { return has (k); }
unsigned int get (hb_codepoint_t k) const { return get_coverage (k); }
@ -1480,12 +1481,13 @@ struct ClassDefFormat2
struct ClassDef
{
/* Map interface. */
/* Has interface. */
static constexpr unsigned SENTINEL = 0;
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); }
/* Projection. */
hb_codepoint_t operator () (hb_codepoint_t k) const { return get (k); }
unsigned int get (hb_codepoint_t k) const { return get_class (k); }
unsigned int get_class (hb_codepoint_t glyph_id) const

View File

@ -365,11 +365,12 @@ struct hb_set_t
return page->get (g);
}
/* Map interface. */
/* Has interface. */
static constexpr bool 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; }
/* Predicate. */
bool operator () (hb_codepoint_t k) const { return has (k); }
bool intersects (hb_codepoint_t first, hb_codepoint_t last) const