diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2020-08-24 11:30:01 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2020-08-24 17:44:07 +0100 |
commit | 695e45c310c795a74c279e1810a19cde775edb82 (patch) | |
tree | 97ee88c0b7782c9dfac41606d3b91d2b10231a8e /json-glib/json-types.h | |
parent | e4db3ea6ea0f8e6318f0d266e2015976b97f7716 (diff) | |
download | json-glib-695e45c310c795a74c279e1810a19cde775edb82.tar.gz |
Add ordered iterator for JsonObject
The current iterator API does not guarantee the iteration order, as it's
based off of the hash table iterator. JsonObject, though, can guarantee
the iteration order—we do that for json_object_foreach_member().
Instead of changing the behaviour of json_object_iter_next(), we can add
API to initialize and iterate a JsonObjectIter in insertion order.
Diffstat (limited to 'json-glib/json-types.h')
-rw-r--r-- | json-glib/json-types.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/json-glib/json-types.h b/json-glib/json-types.h index 99d1fb9..5e16d4d 100644 --- a/json-glib/json-types.h +++ b/json-glib/json-types.h @@ -448,6 +448,14 @@ gboolean json_object_iter_next (JsonObjectIter *iter, const gchar **member_name, JsonNode **member_node); +JSON_AVAILABLE_IN_1_6 +void json_object_iter_init_ordered (JsonObjectIter *iter, + JsonObject *object); +JSON_AVAILABLE_IN_1_6 +gboolean json_object_iter_next_ordered (JsonObjectIter *iter, + const char **member_name, + JsonNode **member_node); + JSON_AVAILABLE_IN_1_0 GType json_array_get_type (void) G_GNUC_CONST; JSON_AVAILABLE_IN_1_0 |