2015-02-09 21:29:05 +03:00
# include "cJSON.h"
2015-02-13 22:19:26 +03:00
/* Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec. */
2015-02-09 21:29:05 +03:00
cJSON * cJSONUtils_GetPointer ( cJSON * object , const char * pointer ) ;
2015-02-13 22:19:26 +03:00
/* Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. */
2015-02-11 04:29:40 +03:00
cJSON * cJSONUtils_GeneratePatches ( cJSON * from , cJSON * to ) ;
2015-02-13 22:19:26 +03:00
void cJSONUtils_AddPatchToArray ( cJSON * array , const char * op , const char * path , cJSON * val ) ; /* Utility for generating patch array entries. */
int cJSONUtils_ApplyPatches ( cJSON * object , cJSON * patches ) ; /* Returns 0 for success. */
2015-02-10 17:17:59 +03:00
2015-02-13 22:19:26 +03:00
/*
2015-02-10 17:17:59 +03:00
// Note that ApplyPatches is NOT atomic on failure. To implement an atomic ApplyPatches, use:
//int cJSONUtils_AtomicApplyPatches(cJSON **object, cJSON *patches)
//{
// cJSON *modme=cJSON_Duplicate(*object,1);
// int error=cJSONUtils_ApplyPatches(modme,patches);
// if (!error) {cJSON_Delete(*object);*object=modme;}
// else cJSON_Delete(modme);
// return error;
//}
// Code not added to library since this strategy is a LOT slower.
2015-02-13 22:19:26 +03:00
*/
2015-02-11 04:29:40 +03:00
2015-02-13 22:19:26 +03:00
char * cJSONUtils_FindPointerFromObjectTo ( cJSON * object , cJSON * target ) ; /* Given a root object and a target object, construct a pointer from one to the other. */
void cJSONUtils_SortObject ( cJSON * object ) ; /* Sorts the members of the object into alphabetical order. */