[serializer] Add serialize_copy()

This commit is contained in:
Behdad Esfahbod 2019-05-02 14:04:51 -07:00
parent bf22338f49
commit 273ed6127b
1 changed files with 14 additions and 0 deletions

View File

@ -305,6 +305,20 @@ struct OffsetTo : Offset<OffsetType, has_null>
return ret;
}
template <typename T>
bool serialize_copy (hb_serialize_context_t *c, const T &src, const void *base)
{
*this = 0;
if (has_null && &src == &Null (T))
return false;
c->push ();
c->copy (src);
c->add_link (*this, c->pop_pack (), base);
}
bool sanitize_shallow (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);