diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 25dafd51b..09fe2811d 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -548,6 +548,8 @@ hb_map_is_equal hb_map_hash hb_map_update hb_map_next +hb_map_keys +hb_map_values HB_MAP_VALUE_INVALID hb_map_t diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index 602269081..1084725af 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -34,7 +34,6 @@ #include "hb-dispatch.hh" #include "hb-sanitize.hh" -#include "hb-serialize.hh" /* diff --git a/src/hb-map.cc b/src/hb-map.cc index 6b23d3115..8c027b895 100644 --- a/src/hb-map.cc +++ b/src/hb-map.cc @@ -384,3 +384,35 @@ hb_map_next (const hb_map_t *map, { return map->next (idx, key, value); } + +/** + * hb_map_keys: + * @map: A map + * @keys: A set + * + * Add the keys of @map to @keys. + * + * Since: REPLACEME + **/ +void +hb_map_keys (const hb_map_t *map, + hb_set_t *keys) +{ + map->keys (*keys); +} + +/** + * hb_map_values: + * @map: A map + * @values: A set + * + * Add the values of @map to @values. + * + * Since: REPLACEME + **/ +void +hb_map_values (const hb_map_t *map, + hb_set_t *values) +{ + map->values (*values); +} diff --git a/src/hb-map.h b/src/hb-map.h index 923dd853f..0f2b78a02 100644 --- a/src/hb-map.h +++ b/src/hb-map.h @@ -129,6 +129,14 @@ hb_map_next (const hb_map_t *map, hb_codepoint_t *key, hb_codepoint_t *value); +HB_EXTERN void +hb_map_keys (const hb_map_t *map, + hb_set_t *keys); + +HB_EXTERN void +hb_map_values (const hb_map_t *map, + hb_set_t *values); + HB_END_DECLS #endif /* HB_MAP_H */ diff --git a/src/hb-map.hh b/src/hb-map.hh index 0482c22cd..c3fc6e90c 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -29,6 +29,8 @@ #include "hb.hh" +#include "hb-set.hh" + /* * hb_hashmap_t @@ -315,6 +317,16 @@ struct hb_hashmap_t hb_copy (other, *this); } + void keys (hb_set_t &keys_) const + { + hb_copy (keys() , keys_); + } + + void values (hb_set_t &values_) const + { + hb_copy (values() , values_); + } + /* * Iterator */ diff --git a/src/hb-set.hh b/src/hb-set.hh index f958a081f..b13d5372c 100644 --- a/src/hb-set.hh +++ b/src/hb-set.hh @@ -170,6 +170,11 @@ struct hb_set_t : hb_sparseset_t template hb_set_t (const Iterable &o) : sparseset (o) {} + + hb_set_t& operator << (hb_codepoint_t v) + { sparseset::operator<< (v); return *this; } + hb_set_t& operator << (const hb_pair_t& range) + { sparseset::operator<< (range); return *this; } }; static_assert (hb_set_t::INVALID == HB_SET_VALUE_INVALID, ""); diff --git a/src/hb-subset.hh b/src/hb-subset.hh index 98c5f06fb..4f192aae4 100644 --- a/src/hb-subset.hh +++ b/src/hb-subset.hh @@ -33,6 +33,7 @@ #include "hb-subset.h" #include "hb-machinery.hh" +#include "hb-serialize.hh" #include "hb-subset-input.hh" #include "hb-subset-plan.hh"