json-c
0.15
|
An API for iterating over json_type_object objects, styled to be familiar to C++ programmers. Unlike json_object_object_foreach() and json_object_object_foreachC(), this avoids the need to expose json-c internals like lh_entry. More...
Data Structures | |
struct | json_object_iterator |
Functions | |
JSON_EXPORT struct json_object_iterator | json_object_iter_init_default (void) |
JSON_EXPORT struct json_object_iterator | json_object_iter_begin (struct json_object *obj) |
JSON_EXPORT struct json_object_iterator | json_object_iter_end (const struct json_object *obj) |
JSON_EXPORT void | json_object_iter_next (struct json_object_iterator *iter) |
JSON_EXPORT const char * | json_object_iter_peek_name (const struct json_object_iterator *iter) |
JSON_EXPORT struct json_object * | json_object_iter_peek_value (const struct json_object_iterator *iter) |
JSON_EXPORT json_bool | json_object_iter_equal (const struct json_object_iterator *iter1, const struct json_object_iterator *iter2) |
An API for iterating over json_type_object objects, styled to be familiar to C++ programmers. Unlike json_object_object_foreach() and json_object_object_foreachC(), this avoids the need to expose json-c internals like lh_entry.
Copyright (c) 2009-2012 Hewlett-Packard Development Company, L.P.
This library is free software; you can redistribute it and/or modify it under the terms of the MIT license. See COPYING for details.
API attributes:
|
read |
Retrieves an iterator to the first pair of the JSON Object.
obj | JSON Object instance (MUST be of type json_object) |
|
read |
Retrieves the iterator that represents the position beyond the last pair of the given JSON Object instance.
obj | JSON Object instance (MUST be of type json_object) |
JSON_EXPORT json_bool json_object_iter_equal | ( | const struct json_object_iterator * | iter1, |
const struct json_object_iterator * | iter2 | ||
) |
Tests two iterators for equality. Typically used to test for end of iteration by comparing an iterator to the corresponding "end" iterator (that was derived from the same JSON Object instance).
iter1 | Pointer to first valid, non-NULL iterator |
iter2 | POinter to second valid, non-NULL iterator |
|
read |
Initializes an iterator structure to a "default" value that is convenient for initializing an iterator variable to a default state (e.g., initialization list in a class' constructor).
JSON_EXPORT void json_object_iter_next | ( | struct json_object_iterator * | iter | ) |
Returns an iterator to the next pair, if any
iter | [IN/OUT] Pointer to iterator that references a name/value pair; MUST be a valid, non-end iterator. WARNING: bad things will happen if invalid or "end" iterator is passed. Upon return will contain the reference to the next pair if there is one; if there are no more pairs, will contain the "end" iterator value, which may be compared against the return value of json_object_iter_end() for the same JSON Object instance. |
JSON_EXPORT const char* json_object_iter_peek_name | ( | const struct json_object_iterator * | iter | ) |
Returns a const pointer to the name of the pair referenced by the given iterator.
iter | pointer to iterator that references a name/value pair; MUST be a valid, non-end iterator. |
|
read |
Returns a pointer to the json-c instance representing the value of the referenced name/value pair, without altering the instance's reference count.
iter | pointer to iterator that references a name/value pair; MUST be a valid, non-end iterator. |