Make Extension a template
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 ChainContextPos : ChainContext {};
-struct ExtensionPos : Extension
+struct ExtensionPos : Extension<ExtensionPos>
{
inline const struct PosLookupSubTable& get_subtable (void) const
{
@@ -1255,9 +1255,6 @@
return StructAtOffset<PosLookupSubTable> (this, offset);
}
- template <typename context_t>
- inline typename context_t::return_t process (context_t *c) const;
-
inline bool sanitize (hb_sanitize_context_t *c);
};
@@ -1525,12 +1522,6 @@
/* Out-of-class implementation for methods recursing */
-template <typename context_t>
-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 ChainContextSubst : ChainContext {};
-struct ExtensionSubst : Extension
+struct ExtensionSubst : Extension<ExtensionSubst>
{
inline const struct SubstLookupSubTable& get_subtable (void) const
{
@@ -887,9 +887,6 @@
return StructAtOffset<SubstLookupSubTable> (this, offset);
}
- template <typename context_t>
- 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 @@
/* Out-of-class implementation for methods recursing */
-template <typename context_t>
-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 @@
DEFINE_SIZE_STATIC (8);
};
+template <typename T>
struct Extension
{
inline unsigned int get_type (void) const
@@ -1782,6 +1783,12 @@
}
}
+ template <typename context_t>
+ inline typename context_t::return_t process (context_t *c) const
+ {
+ return CastP<T>(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);