PNG  IHDR* pHYs+ IDATx]n#; cdLb Ǚ[at¤_:uP}>!Usă cag޿ ֵNu`ݼTâabO7uL&y^wFٝA"l[|ŲHLN밪4*sG3|Dv}?+y߉{OuOAt4Jj.u]Gz*҉sP'VQKbA1u\`& Af;HWj hsO;ogTu uj7S3/QzUr&wS`M$X_L7r2;aE+ώ%vikDA:dR+%KzƉo>eOth$z%: :{WwaQ:wz%4foɹE[9<]#ERINƻv溂E%P1i01 |Jvҗ&{b?9g=^wζXn/lK::90KwrюO\!ջ3uzuGv^;騢wq<Iatv09:tt~hEG`v;3@MNZD.1]L:{ծI3`L(÷ba")Y.iljCɄae#I"1 `3*Bdz>j<fU40⨬%O$3cGt]j%Fߠ_twJ;ABU8vP3uEԑwQ V:h%))LfraqX-ۿX]v-\9I gl8tzX ]ecm)-cgʒ#Uw=Wlێn(0hPP/ӨtQ“&J35 $=]r1{tLuǮ*i0_;NƝ8;-vݏr8+U-kruȕYr0RnC]*ެ(M:]gE;{]tg(#ZJ9y>utRDRMdr9㪩̞zֹb<ģ&wzJM"iI( .ꮅX)Qw:9,i좜\Ԛi7&N0:asϓc];=ΗOӣ APqz93 y $)A*kVHZwBƺnWNaby>XMN*45~ղM6Nvm;A=jֲ.~1}(9`KJ/V F9[=`~[;sRuk]rєT!)iQO)Y$V ی ۤmzWz5IM Zb )ˆC`6 rRa}qNmUfDsWuˤV{ Pݝ'=Kֳbg,UҘVz2ﴻnjNgBb{? ߮tcsͻQuxVCIY۠:(V뺕 ٥2;t`@Fo{Z9`;]wMzU~%UA蛚dI vGq\r82iu +St`cR.6U/M9IENDB`/* * Copyright (c) 2016 Alexadru Ardelean. * * This is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See COPYING for details. * */ /** * @file * @brief JSON Pointer (RFC 6901) implementation for retrieving * objects from a json-c object tree. */ #ifndef _json_pointer_h_ #define _json_pointer_h_ #include "json_object.h" #ifdef __cplusplus extern "C" { #endif /** * Retrieves a JSON sub-object from inside another JSON object * using the JSON pointer notation as defined in RFC 6901 * https://tools.ietf.org/html/rfc6901 * * The returned JSON sub-object is equivalent to parsing manually the * 'obj' JSON tree ; i.e. it's not a new object that is created, but rather * a pointer inside the JSON tree. * * Internally, this is equivalent to doing a series of 'json_object_object_get()' * and 'json_object_array_get_idx()' along the given 'path'. * * Note that the 'path' string supports 'printf()' type arguments, so, whatever * is added after the 'res' param will be treated as an argument for 'path' * Example: json_pointer_get(obj, "/foo/%d/%s", &res, 0, bar) * This means, that you need to escape '%' with '%%' (just like in printf()) * * @param obj the json_object instance/tree from where to retrieve sub-objects * @param path a (RFC6901) string notation for the sub-object to retrieve * @param res a pointer where to store a reference to the json_object * associated with the given path * * @return negative if an error (or not found), or 0 if succeeded */ int json_pointer_get(struct json_object *obj, const char *path, struct json_object **res); /** * This is a variant of 'json_pointer_get()' that supports printf() style arguments. * * Example: json_pointer_getf(obj, res, "/foo/%d/%s", 0, bak) * This also means that you need to escape '%' with '%%' (just like in printf()) * * Please take into consideration all recommended 'printf()' format security * aspects when using this function. * * @param obj the json_object instance/tree to which to add a sub-object * @param res a pointer where to store a reference to the json_object * associated with the given path * @param path_fmt a printf() style format for the path * * @return negative if an error (or not found), or 0 if succeeded */ int json_pointer_getf(struct json_object *obj, struct json_object **res, const char *path_fmt, ...); /** * Sets JSON object 'value' in the 'obj' tree at the location specified * by the 'path'. 'path' is JSON pointer notation as defined in RFC 6901 * https://tools.ietf.org/html/rfc6901 * * Note that 'obj' is a double pointer, mostly for the "" (empty string) * case, where the entire JSON object would be replaced by 'value'. * In the case of the "" path, the object at '*obj' will have it's refcount * decremented with 'json_object_put()' and the 'value' object will be assigned to it. * * For other cases (JSON sub-objects) ownership of 'value' will be transferred into * '*obj' via 'json_object_object_add()' & 'json_object_array_put_idx()', so the * only time the refcount should be decremented for 'value' is when the return value of * 'json_pointer_set()' is negative (meaning the 'value' object did not get set into '*obj'). * * That also implies that 'json_pointer_set()' does not do any refcount incrementing. * (Just that single decrement that was mentioned above). * * Note that the 'path' string supports 'printf()' type arguments, so, whatever * is added after the 'value' param will be treated as an argument for 'path' * Example: json_pointer_set(obj, "/foo/%d/%s", value, 0, bak) * This means, that you need to escape '%' with '%%' (just like in printf()) * * @param obj the json_object instance/tree to which to add a sub-object * @param path a (RFC6901) string notation for the sub-object to set in the tree * @param value object to set at path * * @return negative if an error (or not found), or 0 if succeeded */ int json_pointer_set(struct json_object **obj, const char *path, struct json_object *value); /** * This is a variant of 'json_pointer_set()' that supports printf() style arguments. * * Example: json_pointer_setf(obj, value, "/foo/%d/%s", 0, bak) * This also means that you need to escape '%' with '%%' (just like in printf()) * * Please take into consideration all recommended 'printf()' format security * aspects when using this function. * * @param obj the json_object instance/tree to which to add a sub-object * @param value object to set at path * @param path_fmt a printf() style format for the path * * @return negative if an error (or not found), or 0 if succeeded */ int json_pointer_setf(struct json_object **obj, struct json_object *value, const char *path_fmt, ...); #ifdef __cplusplus } #endif #endif