summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz-ng/src/hb-map.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-map.cc')
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-map.cc86
1 files changed, 81 insertions, 5 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-map.cc b/src/3rdparty/harfbuzz-ng/src/hb-map.cc
index 5c5f5de59e..0014570e8e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-map.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-map.cc
@@ -174,7 +174,7 @@ hb_map_allocation_successful (const hb_map_t *map)
*
* Allocate a copy of @map.
*
- * Return value: Newly-allocated map.
+ * Return value: (transfer full): Newly-allocated map.
*
* Since: 4.4.0
**/
@@ -182,9 +182,10 @@ hb_map_t *
hb_map_copy (const hb_map_t *map)
{
hb_map_t *copy = hb_map_create ();
- if (unlikely (!copy)) return nullptr;
- copy->resize (map->population);
- hb_copy (*map, *copy);
+ if (unlikely (copy->in_error ()))
+ return hb_map_get_empty ();
+
+ *copy = *map;
return copy;
}
@@ -335,9 +336,84 @@ hb_map_is_equal (const hb_map_t *map,
*
* Since: 4.4.0
**/
-HB_EXTERN unsigned int
+unsigned int
hb_map_hash (const hb_map_t *map)
{
return map->hash ();
}
+/**
+ * hb_map_update:
+ * @map: A map
+ * @other: Another map
+ *
+ * Add the contents of @other to @map.
+ *
+ * Since: 7.0.0
+ **/
+HB_EXTERN void
+hb_map_update (hb_map_t *map,
+ const hb_map_t *other)
+{
+ map->update (*other);
+}
+
+/**
+ * hb_map_next:
+ * @map: A map
+ * @idx: (inout): Iterator internal state
+ * @key: (out): Key retrieved
+ * @value: (out): Value retrieved
+ *
+ * Fetches the next key/value paire in @map.
+ *
+ * Set @idx to -1 to get started.
+ *
+ * If the map is modified during iteration, the behavior is undefined.
+ *
+ * The order in which the key/values are returned is undefined.
+ *
+ * Return value: `true` if there was a next value, `false` otherwise
+ *
+ * Since: 7.0.0
+ **/
+hb_bool_t
+hb_map_next (const hb_map_t *map,
+ int *idx,
+ hb_codepoint_t *key,
+ hb_codepoint_t *value)
+{
+ return map->next (idx, key, value);
+}
+
+/**
+ * hb_map_keys:
+ * @map: A map
+ * @keys: A set
+ *
+ * Add the keys of @map to @keys.
+ *
+ * Since: 7.0.0
+ **/
+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: 7.0.0
+ **/
+void
+hb_map_values (const hb_map_t *map,
+ hb_set_t *values)
+{
+ map->values (*values);
+}