Json.ObjectIter¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
priv_boolean |
[ |
r |
|
priv_int |
[ |
r |
|
priv_pointer |
[ |
r |
Methods¶
|
|
|
|
|
|
|
Details¶
- class Json.ObjectIter¶
An iterator object used to iterate over the members of a JSON object.
JsonObjectIter
must be allocated on the stack and initialised using [method`Json`.ObjectIter.init] or [method`Json`.ObjectIter.init_ordered].The iterator is invalidated if the object is modified during iteration.
All the fields in the
JsonObjectIter
structure are private and should never be accessed directly.New in version 1.2.
- init(object)¶
- Parameters:
object (
Json.Object
) – the JSON object to iterate over
Initialises the self and associate it with object.
```c
Json.ObjectIter
iter; conststr
*member_name;Json.Node
*member_node;Json.ObjectIter.init
(&iter, some_object); while (Json.ObjectIter.next
(&iter, &member_name, &member_node)) { // Do something with member_name and member_node. } ```The iterator initialized with this function will iterate the members of the object in an undefined order.
See also: [method`Json`.ObjectIter.init_ordered]
New in version 1.2.
- init_ordered(object)¶
- Parameters:
object (
Json.Object
) – the JSON object to iterate over
Initialises the self and associate it with object.
```c
Json.ObjectIter
iter; conststr
*member_name;Json.Node
*member_node;Json.ObjectIter.init_ordered
(&iter, some_object); while (Json.ObjectIter.next_ordered
(&iter, &member_name, &member_node)) { // Do something with member_name and member_node. } ```See also: [method`Json`.ObjectIter.init]
New in version 1.6.
- next()¶
- Returns:
TRUE
if member_name and member_node are valid;FALSE
if there are no more members- Return type:
Advances the iterator and retrieves the next member in the object.
If the end of the object is reached,
FALSE
is returned and member_name and member_node are set to invalid values. After that point, the self is invalid.The order in which members are returned by the iterator is undefined. The iterator is invalidated if the object is modified during iteration.
You must use this function with an iterator initialized with [method`Json`.ObjectIter.init]; using this function with an iterator initialized with [method`Json`.ObjectIter.init_ordered] yields undefined behavior.
See also: [method`Json`.ObjectIter.next_ordered]
New in version 1.2.
- next_ordered()¶
- Returns:
TRUE ``if `member_name` and `member_node` are valid; ``FALSE
if the end of the object has been reached- Return type:
Advances the iterator and retrieves the next member in the object.
If the end of the object is reached,
FALSE
is returned and member_name and member_node are set to invalid values. After that point, the self is invalid.The order in which members are returned by the iterator is the same order in which the members were added to the
JsonObject
. The iterator is invalidated if itsJsonObject
is modified during iteration.You must use this function with an iterator initialized with [method`Json`.ObjectIter.init_ordered]; using this function with an iterator initialized with [method`Json`.ObjectIter.init] yields undefined behavior.
See also: [method`Json`.ObjectIter.next]
New in version 1.6.