mirror of
				https://github.com/0xFEEDC0DE64/arduino-esp32.git
				synced 2025-11-04 08:01:38 +01:00 
			
		
		
		
	This is very much still work in progress and much more will change before the final 2.0.0 Some APIs have changed. New libraries have been added. LittleFS included. Co-authored-by: Seon Rozenblum <seonr@3sprockets.com> Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com> Co-authored-by: geeksville <kevinh@geeksville.com> Co-authored-by: Mike Dunston <m_dunston@comcast.net> Co-authored-by: Unexpected Maker <seon@unexpectedmaker.com> Co-authored-by: Seon Rozenblum <seonr@3sprockets.com> Co-authored-by: microDev <70126934+microDev1@users.noreply.github.com> Co-authored-by: tobozo <tobozo@users.noreply.github.com> Co-authored-by: bobobo1618 <bobobo1618@users.noreply.github.com> Co-authored-by: lorol <lorolouis@gmail.com> Co-authored-by: geeksville <kevinh@geeksville.com> Co-authored-by: Limor "Ladyada" Fried <limor@ladyada.net> Co-authored-by: Sweety <switi.mhaiske@espressif.com> Co-authored-by: Loick MAHIEUX <loick111@gmail.com> Co-authored-by: Larry Bernstone <lbernstone@gmail.com> Co-authored-by: Valerii Koval <valeros@users.noreply.github.com> Co-authored-by: 快乐的我531 <2302004040@qq.com> Co-authored-by: chegewara <imperiaonline4@gmail.com> Co-authored-by: Clemens Kirchgatterer <clemens@1541.org> Co-authored-by: Aron Rubin <aronrubin@gmail.com> Co-authored-by: Pete Lewis <601236+lewispg228@users.noreply.github.com>
		
			
				
	
	
		
			89 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			89 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
  Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
 | 
						|
 | 
						|
  Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
						|
  of this software and associated documentation files (the "Software"), to deal
 | 
						|
  in the Software without restriction, including without limitation the rights
 | 
						|
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
						|
  copies of the Software, and to permit persons to whom the Software is
 | 
						|
  furnished to do so, subject to the following conditions:
 | 
						|
 | 
						|
  The above copyright notice and this permission notice shall be included in
 | 
						|
  all copies or substantial portions of the Software.
 | 
						|
 | 
						|
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
						|
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
						|
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
						|
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
						|
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
						|
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
						|
  THE SOFTWARE.
 | 
						|
*/
 | 
						|
 | 
						|
#ifndef cJSON_Utils__h
 | 
						|
#define cJSON_Utils__h
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C"
 | 
						|
{
 | 
						|
#endif
 | 
						|
 | 
						|
#include "cJSON.h"
 | 
						|
 | 
						|
/* Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec. */
 | 
						|
CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointer(cJSON * const object, const char *pointer);
 | 
						|
CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointerCaseSensitive(cJSON * const object, const char *pointer);
 | 
						|
 | 
						|
/* Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. */
 | 
						|
/* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */
 | 
						|
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatches(cJSON * const from, cJSON * const to);
 | 
						|
CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatchesCaseSensitive(cJSON * const from, cJSON * const to);
 | 
						|
/* Utility for generating patch array entries. */
 | 
						|
CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON * const array, const char * const operation, const char * const path, const cJSON * const value);
 | 
						|
/* Returns 0 for success. */
 | 
						|
CJSON_PUBLIC(int) cJSONUtils_ApplyPatches(cJSON * const object, const cJSON * const patches);
 | 
						|
CJSON_PUBLIC(int) cJSONUtils_ApplyPatchesCaseSensitive(cJSON * const object, const cJSON * const patches);
 | 
						|
 | 
						|
/*
 | 
						|
// 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.
 | 
						|
*/
 | 
						|
 | 
						|
/* Implement RFC7386 (https://tools.ietf.org/html/rfc7396) JSON Merge Patch spec. */
 | 
						|
/* target will be modified by patch. return value is new ptr for target. */
 | 
						|
CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatch(cJSON *target, const cJSON * const patch);
 | 
						|
CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatchCaseSensitive(cJSON *target, const cJSON * const patch);
 | 
						|
/* generates a patch to move from -> to */
 | 
						|
/* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */
 | 
						|
CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatch(cJSON * const from, cJSON * const to);
 | 
						|
CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatchCaseSensitive(cJSON * const from, cJSON * const to);
 | 
						|
 | 
						|
/* Given a root object and a target object, construct a pointer from one to the other. */
 | 
						|
CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const object, const cJSON * const target);
 | 
						|
 | 
						|
/* Sorts the members of the object into alphabetical order. */
 | 
						|
CJSON_PUBLIC(void) cJSONUtils_SortObject(cJSON * const object);
 | 
						|
CJSON_PUBLIC(void) cJSONUtils_SortObjectCaseSensitive(cJSON * const object);
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
#endif
 |