Blame json_visit.h

Packit Service def718
Packit Service def718
#ifndef _json_c_json_visit_h_
Packit Service def718
#define _json_c_json_visit_h_
Packit Service def718
Packit Service def718
/**
Packit Service def718
 * @file
Packit Service def718
 * @brief Methods for walking a tree of objects.
Packit Service def718
 */
Packit Service def718
#include "json_object.h"
Packit Service def718
Packit Service def718
typedef int (json_c_visit_userfunc)(json_object *jso, int flags,
Packit Service def718
                                     json_object *parent_jso,                                                        const char *jso_key,
Packit Service def718
                                     size_t *jso_index, void *userarg);
Packit Service def718
Packit Service def718
/**
Packit Service def718
 * Visit each object in the JSON hierarchy starting at jso.
Packit Service def718
 * For each object, userfunc is called, passing the object and userarg.
Packit Service def718
 * If the object has a parent (i.e. anything other than jso itself)
Packit Service def718
 * its parent will be passed as parent_jso, and either jso_key or jso_index
Packit Service def718
 * will be set, depending on whether the parent is an object or an array.
Packit Service def718
 *
Packit Service def718
 * Nodes will be visited depth first, but containers (arrays and objects)
Packit Service def718
 * will be visited twice, the second time with JSON_C_VISIT_SECOND set in
Packit Service def718
 * flags.
Packit Service def718
 *
Packit Service def718
 * userfunc must return one of the defined return values, to indicate
Packit Service def718
 * whether and how to continue visiting nodes, or one of various ways to stop.
Packit Service def718
 *
Packit Service def718
 * Returns 0 if nodes were visited successfully, even if some were 
Packit Service def718
 *  intentionally skipped due to what userfunc returned.
Packit Service def718
 * Returns <0 if an error occurred during iteration, including if
Packit Service def718
 *  userfunc returned JSON_C_VISIT_RETURN_ERROR.
Packit Service def718
 */
Packit Service def718
int json_c_visit(json_object *jso, int future_flags,
Packit Service def718
                 json_c_visit_userfunc *userfunc, void *userarg);
Packit Service def718
Packit Service def718
/**
Packit Service def718
 * Passed to json_c_visit_userfunc as one of the flags values to indicate
Packit Service def718
 * that this is the second time a container (array or object) is being
Packit Service def718
 * called, after all of it's members have been iterated over.
Packit Service def718
 */
Packit Service def718
#define JSON_C_VISIT_SECOND  0x02
Packit Service def718
Packit Service def718
/**
Packit Service def718
 * This json_c_visit_userfunc return value indicates that iteration
Packit Service def718
 * should proceed normally.
Packit Service def718
 */
Packit Service def718
#define JSON_C_VISIT_RETURN_CONTINUE 0
Packit Service def718
Packit Service def718
Packit Service def718
/**
Packit Service def718
 * This json_c_visit_userfunc return value indicates that iteration
Packit Service def718
 * over the members of the current object should be skipped.
Packit Service def718
 * If the current object isn't a container (array or object), this
Packit Service def718
 * is no different than JSON_C_VISIT_RETURN_CONTINUE.
Packit Service def718
 */
Packit Service def718
#define JSON_C_VISIT_RETURN_SKIP 7547
Packit Service def718
Packit Service def718
/**
Packit Service def718
 * This json_c_visit_userfunc return value indicates that iteration
Packit Service def718
 * of the fields/elements of the containing object should stop
Packit Service def718
 * and continue "popped up" a level of the object hierarchy.
Packit Service def718
 * For example, returning this when handling arg will result in 
Packit Service def718
 * arg3 and any other fields being skipped.   The next call to userfunc
Packit Service def718
 * will be the JSON_C_VISIT_SECOND call on "foo", followed by a userfunc
Packit Service def718
 * call on "bar".
Packit Service def718
 * 
Packit Service def718
 * {
Packit Service def718
 *   "foo": {
Packit Service def718
 *     "arg1": 1,
Packit Service def718
 *     "arg2": 2,
Packit Service def718
 *     "arg3": 3,
Packit Service def718
 *     ...
Packit Service def718
 *   },
Packit Service def718
 *   "bar": {
Packit Service def718
 *     ...
Packit Service def718
 *   }
Packit Service def718
 * }
Packit Service def718
 * 
Packit Service def718
 */
Packit Service def718
#define JSON_C_VISIT_RETURN_POP 767
Packit Service def718
Packit Service def718
/**
Packit Service def718
 * This json_c_visit_userfunc return value indicates that iteration
Packit Service def718
 * should stop immediately, and cause json_c_visit to return success.
Packit Service def718
 */
Packit Service def718
#define JSON_C_VISIT_RETURN_STOP 7867
Packit Service def718
Packit Service def718
/**
Packit Service def718
 * This json_c_visit_userfunc return value indicates that iteration
Packit Service def718
 * should stop immediately, and cause json_c_visit to return an error.
Packit Service def718
 */
Packit Service def718
#define JSON_C_VISIT_RETURN_ERROR -1
Packit Service def718
Packit Service def718
#endif /* _json_c_json_visit_h_ */