diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 0b3332d70..c08b067e5 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -462,6 +462,7 @@ hb_map_get_population hb_map_is_equal hb_map_get_user_data hb_map_has +hb_map_hash hb_map_is_empty hb_map_reference hb_map_set @@ -652,6 +653,7 @@ hb_set_get_min hb_set_get_population hb_set_get_user_data hb_set_has +hb_set_hash hb_set_intersect hb_set_invert hb_set_is_empty diff --git a/src/hb-map.cc b/src/hb-map.cc index 6c83c670c..de36bc1de 100644 --- a/src/hb-map.cc +++ b/src/hb-map.cc @@ -309,3 +309,20 @@ hb_map_is_equal (const hb_map_t *map, return map->is_equal (*other); } +/** + * hb_map_hash: + * @map: A map + * + * Creates a hash representing @map. + * + * Return value: + * A hash of @map. + * + * Since: REPLACEME + **/ +HB_EXTERN unsigned int +hb_map_hash (const hb_map_t *map) +{ + return map->hash (); +} + diff --git a/src/hb-map.h b/src/hb-map.h index 3f67c50b9..b45f11ef9 100644 --- a/src/hb-map.h +++ b/src/hb-map.h @@ -95,6 +95,9 @@ HB_EXTERN hb_bool_t hb_map_is_equal (const hb_map_t *map, const hb_map_t *other); +HB_EXTERN unsigned int +hb_map_hash (const hb_map_t *map); + HB_EXTERN void hb_map_set (hb_map_t *map, hb_codepoint_t key, diff --git a/src/hb-set.cc b/src/hb-set.cc index 0e2c1f77e..d5d44d92a 100644 --- a/src/hb-set.cc +++ b/src/hb-set.cc @@ -358,6 +358,23 @@ hb_set_is_equal (const hb_set_t *set, return set->is_equal (*other); } +/** + * hb_set_hash: + * @set: A set + * + * Creates a hash representing @set. + * + * Return value: + * A hash of @set. + * + * Since: REPLACEME + **/ +HB_EXTERN unsigned int +hb_set_hash (const hb_set_t *set) +{ + return set->hash (); +} + /** * hb_set_is_subset: * @set: A set diff --git a/src/hb-set.h b/src/hb-set.h index 10ce7c10d..56902c267 100644 --- a/src/hb-set.h +++ b/src/hb-set.h @@ -128,6 +128,9 @@ HB_EXTERN hb_bool_t hb_set_is_equal (const hb_set_t *set, const hb_set_t *other); +HB_EXTERN unsigned int +hb_set_hash (const hb_set_t *set); + HB_EXTERN hb_bool_t hb_set_is_subset (const hb_set_t *set, const hb_set_t *larger_set);