[machinery] Refactor shared code into a macro
This commit is contained in:
parent
ebb475bae7
commit
a0b46f3f6b
|
@ -305,38 +305,22 @@ struct hb_table_lazy_loader_t : hb_lazy_loader_t<T,
|
||||||
hb_blob_t* get_blob () const { return this->get_stored (); }
|
hb_blob_t* get_blob () const { return this->get_stored (); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Subclass>
|
#define HB_DEFINE_TYPE_FUNCS_LAZY_LOADER_T(Type) \
|
||||||
struct hb_font_funcs_lazy_loader_t : hb_lazy_loader_t<hb_font_funcs_t, Subclass>
|
template <typename Subclass> \
|
||||||
{
|
struct hb_##Type##_funcs_lazy_loader_t : hb_lazy_loader_t<hb_##Type##_funcs_t, Subclass> \
|
||||||
static void destroy (hb_font_funcs_t *p)
|
{ \
|
||||||
{ hb_font_funcs_destroy (p); }
|
static void destroy (hb_##Type##_funcs_t *p) \
|
||||||
static const hb_font_funcs_t *get_null ()
|
{ hb_##Type##_funcs_destroy (p); } \
|
||||||
{ return hb_font_funcs_get_empty (); }
|
static const hb_##Type##_funcs_t *get_null () \
|
||||||
};
|
{ return hb_##Type##_funcs_get_empty (); } \
|
||||||
template <typename Subclass>
|
}
|
||||||
struct hb_unicode_funcs_lazy_loader_t : hb_lazy_loader_t<hb_unicode_funcs_t, Subclass>
|
|
||||||
{
|
HB_DEFINE_TYPE_FUNCS_LAZY_LOADER_T (font);
|
||||||
static void destroy (hb_unicode_funcs_t *p)
|
HB_DEFINE_TYPE_FUNCS_LAZY_LOADER_T (unicode);
|
||||||
{ hb_unicode_funcs_destroy (p); }
|
HB_DEFINE_TYPE_FUNCS_LAZY_LOADER_T (draw);
|
||||||
static const hb_unicode_funcs_t *get_null ()
|
HB_DEFINE_TYPE_FUNCS_LAZY_LOADER_T (paint);
|
||||||
{ return hb_unicode_funcs_get_empty (); }
|
|
||||||
};
|
#undef HB_DEFINE_TYPE_FUNCS_LAZY_LOADER_T
|
||||||
template <typename Subclass>
|
|
||||||
struct hb_draw_funcs_lazy_loader_t : hb_lazy_loader_t<hb_draw_funcs_t, Subclass>
|
|
||||||
{
|
|
||||||
static void destroy (hb_draw_funcs_t *p)
|
|
||||||
{ hb_draw_funcs_destroy (p); }
|
|
||||||
static const hb_draw_funcs_t *get_null ()
|
|
||||||
{ return hb_draw_funcs_get_empty (); }
|
|
||||||
};
|
|
||||||
template <typename Subclass>
|
|
||||||
struct hb_paint_funcs_lazy_loader_t : hb_lazy_loader_t<hb_paint_funcs_t, Subclass>
|
|
||||||
{
|
|
||||||
static void destroy (hb_paint_funcs_t *p)
|
|
||||||
{ hb_paint_funcs_destroy (p); }
|
|
||||||
static const hb_paint_funcs_t *get_null ()
|
|
||||||
{ return hb_paint_funcs_get_empty (); }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* HB_MACHINERY_HH */
|
#endif /* HB_MACHINERY_HH */
|
||||||
|
|
Loading…
Reference in New Issue