[dispatch] Use functionality from previous commit
To remove a couple of unwanted wrapper methods
This commit is contained in:
parent
ac350c92fd
commit
b10f65933a
|
@ -47,16 +47,19 @@ struct hb_dispatch_context_t
|
||||||
typedef Return return_t;
|
typedef Return return_t;
|
||||||
template <typename T, typename F>
|
template <typename T, typename F>
|
||||||
bool may_dispatch (const T *obj HB_UNUSED, const F *format HB_UNUSED) { return true; }
|
bool may_dispatch (const T *obj HB_UNUSED, const F *format HB_UNUSED) { return true; }
|
||||||
template <typename T>
|
template <typename T, typename ...Ts>
|
||||||
return_t dispatch (const T &obj) { return _dispatch_impl (obj, hb_prioritize); }
|
return_t dispatch (const T &obj, Ts &&...ds)
|
||||||
|
{ return _dispatch_impl (obj, hb_prioritize, hb_forward<Ts> (ds)...); }
|
||||||
static return_t no_dispatch_return_value () { return Context::default_return_value (); }
|
static return_t no_dispatch_return_value () { return Context::default_return_value (); }
|
||||||
static bool stop_sublookup_iteration (const return_t r HB_UNUSED) { return false; }
|
static bool stop_sublookup_iteration (const return_t r HB_UNUSED) { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename T>
|
template <typename T, typename ...Ts>
|
||||||
auto _dispatch_impl (const T &obj, hb_priority<1>) HB_AUTO_RETURN (obj.dispatch (thiz ()))
|
auto _dispatch_impl (const T &obj, hb_priority<1>, Ts &&...ds) HB_AUTO_RETURN
|
||||||
template <typename T>
|
(obj.dispatch (thiz (), hb_forward<Ts> (ds)...))
|
||||||
Return _dispatch_impl (const T &obj, hb_priority<0>) { return thiz()->_dispatch (obj); }
|
template <typename T, typename ...Ts>
|
||||||
|
Return _dispatch_impl (const T &obj, hb_priority<0>, Ts &&...ds)
|
||||||
|
{ return thiz()->_dispatch (obj, hb_forward<Ts> (ds)...); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ struct OffsetTo : Offset<OffsetType, has_null>
|
||||||
|
|
||||||
s->push ();
|
s->push ();
|
||||||
|
|
||||||
bool ret = src.subset (c, hb_forward<Ts> (ds)...);
|
bool ret = c->dispatch (src, hb_forward<Ts> (ds)...);
|
||||||
|
|
||||||
if (ret || !has_null)
|
if (ret || !has_null)
|
||||||
s->add_link (*this, s->pop_pack (), base);
|
s->add_link (*this, s->pop_pack (), base);
|
||||||
|
@ -336,7 +336,7 @@ struct OffsetTo : Offset<OffsetType, has_null>
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
return_trace (sanitize_shallow (c, base) &&
|
return_trace (sanitize_shallow (c, base) &&
|
||||||
(this->is_null () ||
|
(this->is_null () ||
|
||||||
StructAtOffset<Type> (base, *this).sanitize (c, hb_forward<Ts> (ds)...) ||
|
c->dispatch (StructAtOffset<Type> (base, *this), hb_forward<Ts> (ds)...) ||
|
||||||
neuter (c)));
|
neuter (c)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ struct UnsizedArrayOf
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
if (unlikely (!sanitize_shallow (c, count))) return_trace (false);
|
if (unlikely (!sanitize_shallow (c, count))) return_trace (false);
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
if (unlikely (!arrayZ[i].sanitize (c, hb_forward<Ts> (ds)...)))
|
if (unlikely (!c->dispatch (arrayZ[i], hb_forward<Ts> (ds)...)))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
@ -652,7 +652,7 @@ struct ArrayOf
|
||||||
if (unlikely (!sanitize_shallow (c))) return_trace (false);
|
if (unlikely (!sanitize_shallow (c))) return_trace (false);
|
||||||
unsigned int count = len;
|
unsigned int count = len;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
if (unlikely (!arrayZ[i].sanitize (c, hb_forward<Ts> (ds)...)))
|
if (unlikely (!c->dispatch (arrayZ[i], hb_forward<Ts> (ds)...)))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
@ -828,7 +828,7 @@ struct ArrayOfM1
|
||||||
if (unlikely (!sanitize_shallow (c))) return_trace (false);
|
if (unlikely (!sanitize_shallow (c))) return_trace (false);
|
||||||
unsigned int count = lenM1 + 1;
|
unsigned int count = lenM1 + 1;
|
||||||
for (unsigned int i = 0; i < count; i++)
|
for (unsigned int i = 0; i < count; i++)
|
||||||
if (unlikely (!arrayZ[i].sanitize (c, hb_forward<Ts> (ds)...)))
|
if (unlikely (!c->dispatch (arrayZ[i], hb_forward<Ts> (ds)...)))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1525,12 +1525,6 @@ struct PosLookupSubTable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX Remove? */
|
|
||||||
bool subset (hb_subset_context_t *c, unsigned lookup_type) const
|
|
||||||
{ return dispatch (c, lookup_type); }
|
|
||||||
bool sanitize (hb_sanitize_context_t *c, unsigned lookup_type) const
|
|
||||||
{ return dispatch (c, lookup_type); }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
union {
|
union {
|
||||||
SinglePos single;
|
SinglePos single;
|
||||||
|
|
|
@ -1170,12 +1170,6 @@ struct SubstLookupSubTable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX Remove? */
|
|
||||||
bool subset (hb_subset_context_t *c, unsigned lookup_type) const
|
|
||||||
{ return dispatch (c, lookup_type); }
|
|
||||||
bool sanitize (hb_sanitize_context_t *c, unsigned lookup_type) const
|
|
||||||
{ return dispatch (c, lookup_type); }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
union {
|
union {
|
||||||
SingleSubst single;
|
SingleSubst single;
|
||||||
|
|
|
@ -130,8 +130,9 @@ struct hb_sanitize_context_t :
|
||||||
template <typename T, typename F>
|
template <typename T, typename F>
|
||||||
bool may_dispatch (const T *obj HB_UNUSED, const F *format)
|
bool may_dispatch (const T *obj HB_UNUSED, const F *format)
|
||||||
{ return format->sanitize (this); }
|
{ return format->sanitize (this); }
|
||||||
template <typename T>
|
template <typename T, typename ...Ts>
|
||||||
return_t _dispatch (const T &obj) { return obj.sanitize (this); }
|
return_t _dispatch (const T &obj, Ts &&...ds)
|
||||||
|
{ return obj.sanitize (this, hb_forward<Ts> (ds)...); }
|
||||||
static return_t default_return_value () { return true; }
|
static return_t default_return_value () { return true; }
|
||||||
static return_t no_dispatch_return_value () { return false; }
|
static return_t no_dispatch_return_value () { return false; }
|
||||||
bool stop_sublookup_iteration (const return_t r) const { return !r; }
|
bool stop_sublookup_iteration (const return_t r) const { return !r; }
|
||||||
|
|
|
@ -40,8 +40,9 @@ struct hb_subset_context_t :
|
||||||
hb_dispatch_context_t<hb_subset_context_t, bool, HB_DEBUG_SUBSET>
|
hb_dispatch_context_t<hb_subset_context_t, bool, HB_DEBUG_SUBSET>
|
||||||
{
|
{
|
||||||
const char *get_name () { return "SUBSET"; }
|
const char *get_name () { return "SUBSET"; }
|
||||||
template <typename T>
|
template <typename T, typename ...Ts>
|
||||||
return_t _dispatch (const T &obj) { return obj.subset (this); }
|
return_t _dispatch (const T &obj, Ts &&...ds)
|
||||||
|
{ return obj.subset (this, hb_forward<Ts> (ds)...); }
|
||||||
static return_t default_return_value () { return true; }
|
static return_t default_return_value () { return true; }
|
||||||
|
|
||||||
hb_subset_plan_t *plan;
|
hb_subset_plan_t *plan;
|
||||||
|
|
Loading…
Reference in New Issue