ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
+template <> class hb_mark_as_flags_t<hb_buffer_flags_t> {};
+template <> class hb_mark_as_flags_t<hb_buffer_serialize_flags_t> {};
+
/*
* hb_buffer_t
DEFINE_SIZE_STATIC (2);
};
+} /* namespace OT */
+/* This has to be outside the namespace. */
+template <> class hb_mark_as_flags_t<OT::LookupFlag::Flags> {};
+namespace OT {
+
struct Lookup
{
inline unsigned int get_subtable_count (void) const { return subTable.len; }
* GDEF
*/
-typedef enum
+enum hb_ot_layout_glyph_props_flags_t
{
/* The following three match LookupFlags::Ignore* numbers. */
HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH = 0x02u,
HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE = HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED |
HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED
-} hb_ot_layout_glyph_class_mask_t;
+};
+template <> class hb_mark_as_flags_t<hb_ot_layout_glyph_props_flags_t> {};
/*
* freeing two more bits.
*/
-enum {
+enum hb_unicode_props_flags_t {
UPROPS_MASK_ZWJ = 0x20u,
UPROPS_MASK_ZWNJ = 0x40u,
UPROPS_MASK_IGNORABLE = 0x80u,
UPROPS_MASK_GEN_CAT = 0x1Fu
};
+template <> class hb_mark_as_flags_t<hb_unicode_props_flags_t> {};
static inline void
_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode)
F_MANUAL_ZWJ = 0x0004u, /* Don't skip over ZWJ when matching. */
F_GLOBAL_SEARCH = 0x0008u /* If feature not found in LangSys, look for it in global feature list and pick one. */
};
+template <> class hb_mark_as_flags_t<hb_ot_map_feature_flags_t> {};
/* Macro version for where const is desired. */
#define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigned int) (r)))
-static inline hb_ot_map_feature_flags_t
-operator | (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
-{ return hb_ot_map_feature_flags_t ((unsigned int) l | (unsigned int) r); }
-static inline hb_ot_map_feature_flags_t
-operator & (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
-{ return hb_ot_map_feature_flags_t ((unsigned int) l & (unsigned int) r); }
-static inline hb_ot_map_feature_flags_t
-operator ~ (hb_ot_map_feature_flags_t r)
-{ return hb_ot_map_feature_flags_t (~(unsigned int) r); }
-static inline hb_ot_map_feature_flags_t&
-operator |= (hb_ot_map_feature_flags_t &l, hb_ot_map_feature_flags_t r)
-{ l = l | r; return l; }
-static inline hb_ot_map_feature_flags_t&
-operator &= (hb_ot_map_feature_flags_t& l, hb_ot_map_feature_flags_t r)
-{ l = l & r; return l; }
struct hb_ot_map_builder_t
hb_glyph_info_t *info = c->buffer->info;
for (unsigned int i = 0; i < count; i++)
{
- hb_ot_layout_glyph_class_mask_t klass;
+ hb_ot_layout_glyph_props_flags_t klass;
/* Never mark default-ignorables as marks.
* They won't get in the way of lookups anyway,
}
+/* Enable bitwise ops on enums marked as flags_t */
+template <class T> class hb_mark_as_flags_t;
+template <class T> static inline T operator | (T l, T r)
+{ hb_mark_as_flags_t<T> unused HB_UNUSED; return T ((unsigned int) l | (unsigned int) r); }
+template <class T> static inline T operator & (T l, T r)
+{ hb_mark_as_flags_t<T> unused HB_UNUSED; return T ((unsigned int) l & (unsigned int) r); }
+template <class T> static inline T operator ~ (T r)
+{ hb_mark_as_flags_t<T> unused HB_UNUSED; return T (~(unsigned int) r); }
+template <class T> static inline T& operator |= (T &l, T r)
+{ hb_mark_as_flags_t<T> unused HB_UNUSED; l = l | r; return l; }
+template <class T> static inline T& operator &= (T& l, T r)
+{ hb_mark_as_flags_t<T> unused HB_UNUSED; l = l & r; return l; }
+
+
/* Useful for set-operations on small enums.
* For example, for testing "x ∈ {x1, x2, x3}" use:
* (FLAG_SAFE(x) & (FLAG(x1) | FLAG(x2) | FLAG(x3)))