From 5fa849b77d49da2212825ebb1bea9145713b8449 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 27 Apr 2011 21:46:01 -0400 Subject: [PATCH] [API] Add _set/get_user_data() for all objects --- src/hb-blob.cc | 17 +++++++++++++++++ src/hb-blob.h | 12 ++++++++++++ src/hb-buffer.cc | 16 ++++++++++++++++ src/hb-buffer.h | 10 ++++++++++ src/hb-font.cc | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/hb-font.h | 36 ++++++++++++++++++++++++++++++++++++ src/hb-unicode.cc | 17 +++++++++++++++++ src/hb-unicode.h | 12 ++++++++++++ 8 files changed, 171 insertions(+) diff --git a/src/hb-blob.cc b/src/hb-blob.cc index 435d37b..83a75f6 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -162,6 +162,23 @@ hb_blob_destroy (hb_blob_t *blob) free (blob); } +hb_bool_t +hb_blob_set_user_data (hb_blob_t *blob, + hb_user_data_key_t *key, + void * data, + hb_destroy_func_t destroy) +{ + return hb_object_set_user_data (blob, key, data, destroy); +} + +void * +hb_blob_get_user_data (hb_blob_t *blob, + hb_user_data_key_t *key) +{ + return hb_object_get_user_data (blob, key); +} + + unsigned int hb_blob_get_length (hb_blob_t *blob) { diff --git a/src/hb-blob.h b/src/hb-blob.h index 76ea80d..d698ee2 100644 --- a/src/hb-blob.h +++ b/src/hb-blob.h @@ -62,6 +62,18 @@ hb_blob_reference (hb_blob_t *blob); void hb_blob_destroy (hb_blob_t *blob); +hb_bool_t +hb_blob_set_user_data (hb_blob_t *blob, + hb_user_data_key_t *key, + void * data, + hb_destroy_func_t destroy); + + +void * +hb_blob_get_user_data (hb_blob_t *blob, + hb_user_data_key_t *key); + + unsigned int hb_blob_get_length (hb_blob_t *blob); diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 2ae29ca..98ddd96 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -167,6 +167,22 @@ hb_buffer_destroy (hb_buffer_t *buffer) free (buffer); } +hb_bool_t +hb_buffer_set_user_data (hb_buffer_t *buffer, + hb_user_data_key_t *key, + void * data, + hb_destroy_func_t destroy) +{ + return hb_object_set_user_data (buffer, key, data, destroy); +} + +void * +hb_buffer_get_user_data (hb_buffer_t *buffer, + hb_user_data_key_t *key) +{ + return hb_object_get_user_data (buffer, key); +} + void hb_buffer_set_unicode_funcs (hb_buffer_t *buffer, diff --git a/src/hb-buffer.h b/src/hb-buffer.h index e7ef087..47a2123 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -68,6 +68,16 @@ hb_buffer_reference (hb_buffer_t *buffer); void hb_buffer_destroy (hb_buffer_t *buffer); +hb_bool_t +hb_buffer_set_user_data (hb_buffer_t *buffer, + hb_user_data_key_t *key, + void * data, + hb_destroy_func_t destroy); + +void * +hb_buffer_get_user_data (hb_buffer_t *buffer, + hb_user_data_key_t *key); + void hb_buffer_set_unicode_funcs (hb_buffer_t *buffer, diff --git a/src/hb-font.cc b/src/hb-font.cc index 5506480..b067901 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -124,6 +124,23 @@ hb_font_funcs_destroy (hb_font_funcs_t *ffuncs) free (ffuncs); } +hb_bool_t +hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs, + hb_user_data_key_t *key, + void * data, + hb_destroy_func_t destroy) +{ + return hb_object_set_user_data (ffuncs, key, data, destroy); +} + +void * +hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs, + hb_user_data_key_t *key) +{ + return hb_object_get_user_data (ffuncs, key); +} + + hb_font_funcs_t * hb_font_funcs_copy (hb_font_funcs_t *other_ffuncs) { @@ -408,6 +425,23 @@ hb_face_destroy (hb_face_t *face) free (face); } +hb_bool_t +hb_face_set_user_data (hb_face_t *face, + hb_user_data_key_t *key, + void * data, + hb_destroy_func_t destroy) +{ + return hb_object_set_user_data (face, key, data, destroy); +} + +void * +hb_face_get_user_data (hb_face_t *face, + hb_user_data_key_t *key) +{ + return hb_object_get_user_data (face, key); +} + + hb_blob_t * hb_face_reference_table (hb_face_t *face, hb_tag_t tag) @@ -480,6 +514,23 @@ hb_font_destroy (hb_font_t *font) free (font); } +hb_bool_t +hb_font_set_user_data (hb_font_t *font, + hb_user_data_key_t *key, + void * data, + hb_destroy_func_t destroy) +{ + return hb_object_set_user_data (font, key, data, destroy); +} + +void * +hb_font_get_user_data (hb_font_t *font, + hb_user_data_key_t *key) +{ + return hb_object_get_user_data (font, key); +} + + void hb_font_set_funcs (hb_font_t *font, hb_font_funcs_t *klass, diff --git a/src/hb-font.h b/src/hb-font.h index e349591..f018a8b 100644 --- a/src/hb-font.h +++ b/src/hb-font.h @@ -58,6 +58,18 @@ hb_face_reference (hb_face_t *face); void hb_face_destroy (hb_face_t *face); +hb_bool_t +hb_face_set_user_data (hb_face_t *face, + hb_user_data_key_t *key, + void * data, + hb_destroy_func_t destroy); + + +void * +hb_face_get_user_data (hb_face_t *face, + hb_user_data_key_t *key); + + /* XXX * * I have two major concerns about this API as it is right now: @@ -91,6 +103,18 @@ hb_font_funcs_reference (hb_font_funcs_t *ffuncs); void hb_font_funcs_destroy (hb_font_funcs_t *ffuncs); +hb_bool_t +hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs, + hb_user_data_key_t *key, + void * data, + hb_destroy_func_t destroy); + + +void * +hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs, + hb_user_data_key_t *key); + + hb_font_funcs_t * hb_font_funcs_copy (hb_font_funcs_t *ffuncs); @@ -203,6 +227,18 @@ hb_font_reference (hb_font_t *font); void hb_font_destroy (hb_font_t *font); +hb_bool_t +hb_font_set_user_data (hb_font_t *font, + hb_user_data_key_t *key, + void * data, + hb_destroy_func_t destroy); + + +void * +hb_font_get_user_data (hb_font_t *font, + hb_user_data_key_t *key); + + void hb_font_set_funcs (hb_font_t *font, hb_font_funcs_t *klass, diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc index 9922955..0486be3 100644 --- a/src/hb-unicode.cc +++ b/src/hb-unicode.cc @@ -155,6 +155,23 @@ hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs) free (ufuncs); } +hb_bool_t +hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs, + hb_user_data_key_t *key, + void * data, + hb_destroy_func_t destroy) +{ + return hb_object_set_user_data (ufuncs, key, data, destroy); +} + +void * +hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs, + hb_user_data_key_t *key) +{ + return hb_object_get_user_data (ufuncs, key); +} + + void hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs) { diff --git a/src/hb-unicode.h b/src/hb-unicode.h index d558c22..a46431b 100644 --- a/src/hb-unicode.h +++ b/src/hb-unicode.h @@ -59,6 +59,18 @@ hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs); void hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs); +hb_bool_t +hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs, + hb_user_data_key_t *key, + void * data, + hb_destroy_func_t destroy); + + +void * +hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs, + hb_user_data_key_t *key); + + void hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs); -- 2.7.4