[cpluscplus] Wrap hb-subset types as well

Also changes signature of get_user_data of hb.h types to take const
object. This is safe.
This commit is contained in:
Behdad Esfahbod 2022-07-25 10:45:55 -06:00
parent 1ac21246a7
commit 1945b400da
18 changed files with 47 additions and 25 deletions

View File

@ -303,7 +303,7 @@ hb_blob_set_user_data (hb_blob_t *blob,
* Since: 0.9.2 * Since: 0.9.2
**/ **/
void * void *
hb_blob_get_user_data (hb_blob_t *blob, hb_blob_get_user_data (const hb_blob_t *blob,
hb_user_data_key_t *key) hb_user_data_key_t *key)
{ {
return hb_object_get_user_data (blob, key); return hb_object_get_user_data (blob, key);

View File

@ -135,7 +135,7 @@ hb_blob_set_user_data (hb_blob_t *blob,
HB_EXTERN void * HB_EXTERN void *
hb_blob_get_user_data (hb_blob_t *blob, hb_blob_get_user_data (const hb_blob_t *blob,
hb_user_data_key_t *key); hb_user_data_key_t *key);

View File

@ -831,7 +831,7 @@ hb_buffer_set_user_data (hb_buffer_t *buffer,
* Since: 0.9.2 * Since: 0.9.2
**/ **/
void * void *
hb_buffer_get_user_data (hb_buffer_t *buffer, hb_buffer_get_user_data (const hb_buffer_t *buffer,
hb_user_data_key_t *key) hb_user_data_key_t *key)
{ {
return hb_object_get_user_data (buffer, key); return hb_object_get_user_data (buffer, key);

View File

@ -266,7 +266,7 @@ hb_buffer_set_user_data (hb_buffer_t *buffer,
hb_bool_t replace); hb_bool_t replace);
HB_EXTERN void * HB_EXTERN void *
hb_buffer_get_user_data (hb_buffer_t *buffer, hb_buffer_get_user_data (const hb_buffer_t *buffer,
hb_user_data_key_t *key); hb_user_data_key_t *key);

View File

@ -130,7 +130,7 @@ template <typename T,
void *, void *,
hb_destroy_func_t, hb_destroy_func_t,
hb_bool_t), hb_bool_t),
void * (*_get_user_data) (T *, void * (*_get_user_data) (const T *,
hb_user_data_key_t *)> hb_user_data_key_t *)>
struct vtable_t struct vtable_t
{ {
@ -164,6 +164,27 @@ HB_DEFINE_VTABLE (unicode_funcs);
#undef HB_DEFINE_VTABLE #undef HB_DEFINE_VTABLE
#ifdef HB_SUBSET_H
#define HB_DEFINE_VTABLE(name) \
template<> \
struct vtable<hb_##name##_t> \
: vtable_t<hb_##name##_t, \
nullptr, \
&hb_##name##_reference, \
&hb_##name##_destroy, \
&hb_##name##_set_user_data, \
&hb_##name##_get_user_data> {}
HB_DEFINE_VTABLE (subset_input);
HB_DEFINE_VTABLE (subset_plan);
#undef HB_DEFINE_VTABLE
#endif
} // namespace hb } // namespace hb
/* Workaround for GCC < 7, see: /* Workaround for GCC < 7, see:

View File

@ -342,7 +342,7 @@ hb_face_set_user_data (hb_face_t *face,
* Since: 0.9.2 * Since: 0.9.2
**/ **/
void * void *
hb_face_get_user_data (hb_face_t *face, hb_face_get_user_data (const hb_face_t *face,
hb_user_data_key_t *key) hb_user_data_key_t *key)
{ {
return hb_object_get_user_data (face, key); return hb_object_get_user_data (face, key);

View File

@ -96,7 +96,7 @@ hb_face_set_user_data (hb_face_t *face,
hb_bool_t replace); hb_bool_t replace);
HB_EXTERN void * HB_EXTERN void *
hb_face_get_user_data (hb_face_t *face, hb_face_get_user_data (const hb_face_t *face,
hb_user_data_key_t *key); hb_user_data_key_t *key);
HB_EXTERN void HB_EXTERN void

View File

@ -781,7 +781,7 @@ hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs,
* Since: 0.9.2 * Since: 0.9.2
**/ **/
void * void *
hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs, hb_font_funcs_get_user_data (const hb_font_funcs_t *ffuncs,
hb_user_data_key_t *key) hb_user_data_key_t *key)
{ {
return hb_object_get_user_data (ffuncs, key); return hb_object_get_user_data (ffuncs, key);
@ -1897,7 +1897,7 @@ hb_font_set_user_data (hb_font_t *font,
* Since: 0.9.2 * Since: 0.9.2
**/ **/
void * void *
hb_font_get_user_data (hb_font_t *font, hb_font_get_user_data (const hb_font_t *font,
hb_user_data_key_t *key) hb_user_data_key_t *key)
{ {
return hb_object_get_user_data (font, key); return hb_object_get_user_data (font, key);

View File

@ -86,7 +86,7 @@ hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs,
HB_EXTERN void * HB_EXTERN void *
hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs, hb_font_funcs_get_user_data (const hb_font_funcs_t *ffuncs,
hb_user_data_key_t *key); hb_user_data_key_t *key);
@ -993,7 +993,7 @@ hb_font_set_user_data (hb_font_t *font,
HB_EXTERN void * HB_EXTERN void *
hb_font_get_user_data (hb_font_t *font, hb_font_get_user_data (const hb_font_t *font,
hb_user_data_key_t *key); hb_user_data_key_t *key);
HB_EXTERN void HB_EXTERN void

View File

@ -145,7 +145,7 @@ hb_map_set_user_data (hb_map_t *map,
* Since: 1.7.7 * Since: 1.7.7
**/ **/
void * void *
hb_map_get_user_data (hb_map_t *map, hb_map_get_user_data (const hb_map_t *map,
hb_user_data_key_t *key) hb_user_data_key_t *key)
{ {
return hb_object_get_user_data (map, key); return hb_object_get_user_data (map, key);

View File

@ -74,7 +74,7 @@ hb_map_set_user_data (hb_map_t *map,
hb_bool_t replace); hb_bool_t replace);
HB_EXTERN void * HB_EXTERN void *
hb_map_get_user_data (hb_map_t *map, hb_map_get_user_data (const hb_map_t *map,
hb_user_data_key_t *key); hb_user_data_key_t *key);

View File

@ -145,7 +145,7 @@ hb_set_set_user_data (hb_set_t *set,
* Since: 0.9.2 * Since: 0.9.2
**/ **/
void * void *
hb_set_get_user_data (hb_set_t *set, hb_set_get_user_data (const hb_set_t *set,
hb_user_data_key_t *key) hb_user_data_key_t *key)
{ {
return hb_object_get_user_data (set, key); return hb_object_get_user_data (set, key);

View File

@ -77,7 +77,7 @@ hb_set_set_user_data (hb_set_t *set,
hb_bool_t replace); hb_bool_t replace);
HB_EXTERN void * HB_EXTERN void *
hb_set_get_user_data (hb_set_t *set, hb_set_get_user_data (const hb_set_t *set,
hb_user_data_key_t *key); hb_user_data_key_t *key);

View File

@ -358,7 +358,7 @@ hb_shape_plan_set_user_data (hb_shape_plan_t *shape_plan,
* Since: 0.9.7 * Since: 0.9.7
**/ **/
void * void *
hb_shape_plan_get_user_data (hb_shape_plan_t *shape_plan, hb_shape_plan_get_user_data (const hb_shape_plan_t *shape_plan,
hb_user_data_key_t *key) hb_user_data_key_t *key)
{ {
return hb_object_get_user_data (shape_plan, key); return hb_object_get_user_data (shape_plan, key);

View File

@ -102,7 +102,7 @@ hb_shape_plan_set_user_data (hb_shape_plan_t *shape_plan,
hb_bool_t replace); hb_bool_t replace);
HB_EXTERN void * HB_EXTERN void *
hb_shape_plan_get_user_data (hb_shape_plan_t *shape_plan, hb_shape_plan_get_user_data (const hb_shape_plan_t *shape_plan,
hb_user_data_key_t *key); hb_user_data_key_t *key);

View File

@ -308,7 +308,7 @@ hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
* Since: 0.9.2 * Since: 0.9.2
**/ **/
void * void *
hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs, hb_unicode_funcs_get_user_data (const hb_unicode_funcs_t *ufuncs,
hb_user_data_key_t *key) hb_user_data_key_t *key)
{ {
return hb_object_get_user_data (ufuncs, key); return hb_object_get_user_data (ufuncs, key);

View File

@ -317,7 +317,7 @@ hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
HB_EXTERN void * HB_EXTERN void *
hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs, hb_unicode_funcs_get_user_data (const hb_unicode_funcs_t *ufuncs,
hb_user_data_key_t *key); hb_user_data_key_t *key);

View File

@ -33,6 +33,7 @@
#endif #endif
#include <hb.h> #include <hb.h>
#include <hb-subset.h>
#include <hb-ot.h> #include <hb-ot.h>
#include <hb-aat.h> #include <hb-aat.h>