From 653eeb26450053b731b46346606931f5ae88db72 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 23 Nov 2012 16:57:36 -0500 Subject: [PATCH] Make Extension a template --- src/hb-ot-layout-gpos-table.hh | 11 +---------- src/hb-ot-layout-gsub-table.hh | 11 +---------- src/hb-ot-layout-gsubgpos-private.hh | 7 +++++++ 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 70be844..38cf967 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1246,7 +1246,7 @@ struct ContextPos : Context {}; struct ChainContextPos : ChainContext {}; -struct ExtensionPos : Extension +struct ExtensionPos : Extension { inline const struct PosLookupSubTable& get_subtable (void) const { @@ -1255,9 +1255,6 @@ struct ExtensionPos : Extension return StructAtOffset (this, offset); } - template - inline typename context_t::return_t process (context_t *c) const; - inline bool sanitize (hb_sanitize_context_t *c); }; @@ -1525,12 +1522,6 @@ GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer, hb_bool_t /* Out-of-class implementation for methods recursing */ -template -inline typename context_t::return_t ExtensionPos::process (context_t *c) const -{ - return get_subtable ().process (c, get_type ()); -} - inline bool ExtensionPos::sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (this); diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 7f23dec..7cf1e1b 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -878,7 +878,7 @@ struct ContextSubst : Context {}; struct ChainContextSubst : ChainContext {}; -struct ExtensionSubst : Extension +struct ExtensionSubst : Extension { inline const struct SubstLookupSubTable& get_subtable (void) const { @@ -887,9 +887,6 @@ struct ExtensionSubst : Extension return StructAtOffset (this, offset); } - template - inline typename context_t::return_t process (context_t *c) const; - inline bool sanitize (hb_sanitize_context_t *c); inline bool is_reverse (void) const; @@ -1380,12 +1377,6 @@ GSUB::substitute_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer HB_UNUSE /* Out-of-class implementation for methods recursing */ -template -inline typename context_t::return_t ExtensionSubst::process (context_t *c) const -{ - return get_subtable ().process (c, get_type ()); -} - inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (this); diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 30c43bc..300ba7c 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -1765,6 +1765,7 @@ struct ExtensionFormat1 DEFINE_SIZE_STATIC (8); }; +template struct Extension { inline unsigned int get_type (void) const @@ -1782,6 +1783,12 @@ struct Extension } } + template + inline typename context_t::return_t process (context_t *c) const + { + return CastP(this)->get_subtable ().process (c, get_type ()); + } + inline bool sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (this); if (!u.format.sanitize (c)) return TRACE_RETURN (false); -- 2.7.4