Currently, the object class in json.h does not provide a way to iterate over its keys. This commit adds an `iterate` method to the object class, allowing users to iterate over the keys of a JSON object.
Signed-off-by: Yangyu Chen <[email protected]> gcc/ChangeLog: * json.h (class object): Add iterate method to object class. --- gcc/json.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/json.h b/gcc/json.h index c706f2a4fe9..b87da9464de 100644 --- a/gcc/json.h +++ b/gcc/json.h @@ -183,6 +183,11 @@ class object : public value /* Set to literal true/false. */ void set_bool (const char *key, bool v); + bool iterate (unsigned i, const char **key) const + { + return m_keys.iterate (i, key); + } + static int compare (const json::object &obj_a, const json::object &obj_b); size_t get_num_keys () const { return m_keys.length (); } -- 2.49.0
