Correct comment and variable declaration style to be more compatible. Added cJSONUtils_SortObject for sorting the members of an object alphabetically.

git-svn-id: svn://svn.code.sf.net/p/cjson/code@70 e3330c51-1366-4df0-8b21-3ccf24e3d50e
This commit is contained in:
Dave Gamble
2015-02-13 19:19:26 +00:00
parent 1d9b70e706
commit c4ddd7aaa3
3 changed files with 136 additions and 66 deletions

View File

@ -1,13 +1,14 @@
#include "cJSON.h"
// Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec.
/* Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec. */
cJSON *cJSONUtils_GetPointer(cJSON *object,const char *pointer);
// Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec.
/* Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. */
cJSON* cJSONUtils_GeneratePatches(cJSON *from,cJSON *to);
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.
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. */
/*
// Note that ApplyPatches is NOT atomic on failure. To implement an atomic ApplyPatches, use:
//int cJSONUtils_AtomicApplyPatches(cJSON **object, cJSON *patches)
//{
@ -18,5 +19,8 @@ int cJSONUtils_ApplyPatches(cJSON *object,cJSON *patches); // Returns 0 for succ
// return error;
//}
// Code not added to library since this strategy is a LOT slower.
*/
char *cJSONUtils_FindPointerFromObjectTo(cJSON *object,cJSON *target); // Given a root object and a target object, construct a pointer from one to the other.
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. */