[set/map] Expose hash API publicly

New API:
+ hb_set_hash()
+ hb_map_hash()
This commit is contained in:
Behdad Esfahbod 2022-05-20 13:19:27 -06:00
parent 2e186d9f24
commit 4ea2725704
5 changed files with 42 additions and 0 deletions

View File

@ -462,6 +462,7 @@ hb_map_get_population
hb_map_is_equal hb_map_is_equal
hb_map_get_user_data hb_map_get_user_data
hb_map_has hb_map_has
hb_map_hash
hb_map_is_empty hb_map_is_empty
hb_map_reference hb_map_reference
hb_map_set hb_map_set
@ -652,6 +653,7 @@ hb_set_get_min
hb_set_get_population hb_set_get_population
hb_set_get_user_data hb_set_get_user_data
hb_set_has hb_set_has
hb_set_hash
hb_set_intersect hb_set_intersect
hb_set_invert hb_set_invert
hb_set_is_empty hb_set_is_empty

View File

@ -309,3 +309,20 @@ hb_map_is_equal (const hb_map_t *map,
return map->is_equal (*other); 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 ();
}

View File

@ -95,6 +95,9 @@ HB_EXTERN hb_bool_t
hb_map_is_equal (const hb_map_t *map, hb_map_is_equal (const hb_map_t *map,
const hb_map_t *other); const hb_map_t *other);
HB_EXTERN unsigned int
hb_map_hash (const hb_map_t *map);
HB_EXTERN void HB_EXTERN void
hb_map_set (hb_map_t *map, hb_map_set (hb_map_t *map,
hb_codepoint_t key, hb_codepoint_t key,

View File

@ -358,6 +358,23 @@ hb_set_is_equal (const hb_set_t *set,
return set->is_equal (*other); 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: * hb_set_is_subset:
* @set: A set * @set: A set

View File

@ -128,6 +128,9 @@ HB_EXTERN hb_bool_t
hb_set_is_equal (const hb_set_t *set, hb_set_is_equal (const hb_set_t *set,
const hb_set_t *other); const hb_set_t *other);
HB_EXTERN unsigned int
hb_set_hash (const hb_set_t *set);
HB_EXTERN hb_bool_t HB_EXTERN hb_bool_t
hb_set_is_subset (const hb_set_t *set, hb_set_is_subset (const hb_set_t *set,
const hb_set_t *larger_set); const hb_set_t *larger_set);