diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 46ab75207..0b3332d70 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -459,6 +459,7 @@ hb_map_destroy hb_map_get hb_map_get_empty hb_map_get_population +hb_map_is_equal hb_map_get_user_data hb_map_has hb_map_is_empty diff --git a/src/hb-map.cc b/src/hb-map.cc index 9f1ac4284..9df6df304 100644 --- a/src/hb-map.cc +++ b/src/hb-map.cc @@ -289,3 +289,23 @@ hb_map_get_population (const hb_map_t *map) { return map->get_population (); } + +/** + * hb_map_is_equal: + * @map: A map + * @other: Another map + * + * Tests whether @map and @other are equal (contain the same + * elements). + * + * Return value: %true if the two maps are equal, %false otherwise. + * + * Since: REPLACEME + **/ +hb_bool_t +hb_map_is_equal (const hb_map_t *map, + const hb_map_t *other) +{ + return map->is_equal (*other); +} + diff --git a/src/hb-map.h b/src/hb-map.h index 6a45a7bdd..3f67c50b9 100644 --- a/src/hb-map.h +++ b/src/hb-map.h @@ -91,6 +91,10 @@ hb_map_is_empty (const hb_map_t *map); HB_EXTERN unsigned int hb_map_get_population (const hb_map_t *map); +HB_EXTERN hb_bool_t +hb_map_is_equal (const hb_map_t *map, + const hb_map_t *other); + HB_EXTERN void hb_map_set (hb_map_t *map, hb_codepoint_t key, diff --git a/src/hb-map.hh b/src/hb-map.hh index 88f0ea6ee..dbfb85863 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -42,6 +42,7 @@ template m1; + hb_hashmap_t m2; + + m1.map (hb_map_t (), hb_map_t ()); + m2.map (hb_map_t (), hb_map_t ()); + + // m1.map (hb_map_t (), hb_map_t {1}); + // m2.map (hb_map_t (), hb_map_t {1}); + + // m1.map (hb_map_t {1}, hb_map_t {2}); + // m2.map (hb_map_t {1}, hb_map_t {2}); + + /* Cannot override empty map. */ + assert (m1.get (hb_map_t ()) == hb_map_t ()); + assert (m2.get (hb_map_t ()) == hb_map_t ()); + + // assert (m1.get (hb_map_t {1}) == hb_map_t {2}); + // assert (m2.get (hb_map_t {1}) == hb_map_t {2}); + } +#endif + /* Test hashing sets. */ { hb_hashmap_t m1;