modbusd
modbus master daemon
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
cJSON_Utils.h
Go to the documentation of this file.
1 #include "cJSON.h"
2 
3 /* Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec. */
4 cJSON *cJSONUtils_GetPointer(cJSON *object,const char *pointer);
5 
6 /* Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. */
8 void cJSONUtils_AddPatchToArray(cJSON *array,const char *op,const char *path,cJSON *val); /* Utility for generating patch array entries. */
9 int cJSONUtils_ApplyPatches(cJSON *object,cJSON *patches); /* Returns 0 for success. */
10 
11 /*
12 // Note that ApplyPatches is NOT atomic on failure. To implement an atomic ApplyPatches, use:
13 //int cJSONUtils_AtomicApplyPatches(cJSON **object, cJSON *patches)
14 //{
15 // cJSON *modme=cJSON_Duplicate(*object,1);
16 // int error=cJSONUtils_ApplyPatches(modme,patches);
17 // if (!error) {cJSON_Delete(*object);*object=modme;}
18 // else cJSON_Delete(modme);
19 // return error;
20 //}
21 // Code not added to library since this strategy is a LOT slower.
22 */
23 
24 /* Implement RFC7386 (https://tools.ietf.org/html/rfc7396) JSON Merge Patch spec. */
25 cJSON* cJSONUtils_MergePatch(cJSON *target, cJSON *patch); /* target will be modified by patch. return value is new ptr for target. */
26 cJSON *cJSONUtils_GenerateMergePatch(cJSON *from,cJSON *to); /* generates a patch to move from -> to */
27 
28 char *cJSONUtils_FindPointerFromObjectTo(cJSON *object,cJSON *target); /* Given a root object and a target object, construct a pointer from one to the other. */
29 
30 void cJSONUtils_SortObject(cJSON *object); /* Sorts the members of the object into alphabetical order. */
cJSON * cJSONUtils_MergePatch(cJSON *target, cJSON *patch)
Definition: cJSON_Utils.c:346
cJSON * cJSONUtils_GeneratePatches(cJSON *from, cJSON *to)
Definition: cJSON_Utils.c:298
cJSON * cJSONUtils_GetPointer(cJSON *object, const char *pointer)
Definition: cJSON_Utils.c:72
cJSON * cJSONUtils_GenerateMergePatch(cJSON *from, cJSON *to)
Definition: cJSON_Utils.c:365
void cJSONUtils_SortObject(cJSON *object)
Definition: cJSON_Utils.c:344
char * cJSONUtils_FindPointerFromObjectTo(cJSON *object, cJSON *target)
Definition: cJSON_Utils.c:39
int cJSONUtils_ApplyPatches(cJSON *object, cJSON *patches)
Definition: cJSON_Utils.c:209
void cJSONUtils_AddPatchToArray(cJSON *array, const char *op, const char *path, cJSON *val)
Definition: cJSON_Utils.c:238
Definition: cJSON.h:47