summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz-ng/src/hb-map.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-map.hh')
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-map.hh75
1 files changed, 43 insertions, 32 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-map.hh b/src/3rdparty/harfbuzz-ng/src/hb-map.hh
index bfb1b3f768..615d1825ed 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-map.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-map.hh
@@ -29,6 +29,8 @@
#include "hb.hh"
+#include "hb-set.hh"
+
/*
* hb_hashmap_t
@@ -308,6 +310,23 @@ struct hb_hashmap_t
unsigned int get_population () const { return population; }
+ void update (const hb_hashmap_t &other)
+ {
+ if (unlikely (!successful)) return;
+
+ 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
*/
@@ -348,6 +367,30 @@ struct hb_hashmap_t
| hb_map (hb_ridentity)
)
+ /* C iterator. */
+ bool next (int *idx,
+ K *key,
+ V *value) const
+ {
+ unsigned i = (unsigned) (*idx + 1);
+
+ unsigned count = size ();
+ while (i < count && !items[i].is_real ())
+ i++;
+
+ if (i >= count)
+ {
+ *idx = -1;
+ return false;
+ }
+
+ *key = items[i].key;
+ *value = items[i].value;
+
+ *idx = (signed) i;
+ return true;
+ }
+
/* Sink interface. */
hb_hashmap_t& operator << (const hb_pair_t<K, V>& v)
{ set (v.first, v.second); return *this; }
@@ -451,37 +494,5 @@ struct hb_map_t : hb_hashmap_t<hb_codepoint_t,
hb_map_t (const Iterable &o) : hashmap (o) {}
};
-template <typename K, typename V>
-static inline
-hb_hashmap_t<K, V>* hb_hashmap_create ()
-{
- using hashmap = hb_hashmap_t<K, V>;
- hashmap* map;
- if (!(map = hb_object_create<hashmap> ()))
- return nullptr;
-
- return map;
-}
-
-template <typename K, typename V>
-static inline
-void hb_hashmap_destroy (hb_hashmap_t<K, V>* map)
-{
- if (!hb_object_destroy (map))
- return;
-
- hb_free (map);
-}
-
-namespace hb {
-
-template <typename K, typename V>
-struct vtable<hb_hashmap_t<K, V>>
-{
- static constexpr auto destroy = hb_hashmap_destroy<K,V>;
-};
-
-}
-
#endif /* HB_MAP_HH */