31#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
55#define CJSON_CDECL __cdecl
56#define CJSON_STDCALL __stdcall
59#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
60#define CJSON_EXPORT_SYMBOLS
63#if defined(CJSON_HIDE_SYMBOLS)
64#define CJSON_PUBLIC(type) type CJSON_STDCALL
65#elif defined(CJSON_EXPORT_SYMBOLS)
66#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL
67#elif defined(CJSON_IMPORT_SYMBOLS)
68#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL
74#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
75#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
77#define CJSON_PUBLIC(type) type
82#define CJSON_VERSION_MAJOR 1
83#define CJSON_VERSION_MINOR 7
84#define CJSON_VERSION_PATCH 17
89#define cJSON_Invalid (0)
90#define cJSON_False (1 << 0)
91#define cJSON_True (1 << 1)
92#define cJSON_NULL (1 << 2)
93#define cJSON_Number (1 << 3)
94#define cJSON_String (1 << 4)
95#define cJSON_Array (1 << 5)
96#define cJSON_Object (1 << 6)
97#define cJSON_Raw (1 << 7)
99#define cJSON_IsReference 256
100#define cJSON_StringIsConst 512
128 void *(CJSON_CDECL *malloc_fn)(
size_t sz);
129 void (CJSON_CDECL *free_fn)(
void *ptr);
132typedef int cJSON_bool;
136#ifndef CJSON_NESTING_LIMIT
137#define CJSON_NESTING_LIMIT 1000
141CJSON_PUBLIC(
const char*) cJSON_Version(
void);
144CJSON_PUBLIC(
void) cJSON_InitHooks(
cJSON_Hooks* hooks);
148CJSON_PUBLIC(
cJSON *) cJSON_Parse(
const char *value);
149CJSON_PUBLIC(
cJSON *) cJSON_ParseWithLength(
const char *value,
size_t buffer_length);
152CJSON_PUBLIC(
cJSON *) cJSON_ParseWithOpts(
const char *value,
const char **return_parse_end, cJSON_bool require_null_terminated);
153CJSON_PUBLIC(
cJSON *) cJSON_ParseWithLengthOpts(
const char *value,
size_t buffer_length,
const char **return_parse_end, cJSON_bool require_null_terminated);
156CJSON_PUBLIC(
char *) cJSON_Print(
const cJSON *item);
158CJSON_PUBLIC(
char *) cJSON_PrintUnformatted(
const cJSON *item);
160CJSON_PUBLIC(
char *) cJSON_PrintBuffered(
const cJSON *item,
int prebuffer, cJSON_bool fmt);
163CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(
cJSON *item,
char *buffer,
const int length,
const cJSON_bool format);
165CJSON_PUBLIC(
void) cJSON_Delete(
cJSON *item);
168CJSON_PUBLIC(
int) cJSON_GetArraySize(
const cJSON *array);
170CJSON_PUBLIC(
cJSON *) cJSON_GetArrayItem(
const cJSON *array,
int index);
172CJSON_PUBLIC(
cJSON *) cJSON_GetObjectItem(
const cJSON *
const object,
const char *
const string);
173CJSON_PUBLIC(
cJSON *) cJSON_GetObjectItemCaseSensitive(
const cJSON *
const object,
const char *
const string);
174CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(
const cJSON *
object,
const char *
string);
176CJSON_PUBLIC(
const char *) cJSON_GetErrorPtr(
void);
179CJSON_PUBLIC(
char *) cJSON_GetStringValue(
const cJSON *
const item);
180CJSON_PUBLIC(
double) cJSON_GetNumberValue(
const cJSON *
const item);
183CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(
const cJSON *
const item);
184CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(
const cJSON *
const item);
185CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(
const cJSON *
const item);
186CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(
const cJSON *
const item);
187CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(
const cJSON *
const item);
188CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(
const cJSON *
const item);
189CJSON_PUBLIC(cJSON_bool) cJSON_IsString(
const cJSON *
const item);
190CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(
const cJSON *
const item);
191CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(
const cJSON *
const item);
192CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(
const cJSON *
const item);
195CJSON_PUBLIC(
cJSON *) cJSON_CreateNull(
void);
196CJSON_PUBLIC(
cJSON *) cJSON_CreateTrue(
void);
197CJSON_PUBLIC(
cJSON *) cJSON_CreateFalse(
void);
198CJSON_PUBLIC(
cJSON *) cJSON_CreateBool(cJSON_bool
boolean);
199CJSON_PUBLIC(
cJSON *) cJSON_CreateNumber(
double num);
200CJSON_PUBLIC(
cJSON *) cJSON_CreateString(
const char *
string);
202CJSON_PUBLIC(
cJSON *) cJSON_CreateRaw(
const char *raw);
203CJSON_PUBLIC(
cJSON *) cJSON_CreateArray(
void);
204CJSON_PUBLIC(
cJSON *) cJSON_CreateObject(
void);
208CJSON_PUBLIC(
cJSON *) cJSON_CreateStringReference(
const char *
string);
211CJSON_PUBLIC(
cJSON *) cJSON_CreateObjectReference(
const cJSON *child);
212CJSON_PUBLIC(
cJSON *) cJSON_CreateArrayReference(
const cJSON *child);
216CJSON_PUBLIC(
cJSON *) cJSON_CreateIntArray(
const int *numbers,
int count);
217CJSON_PUBLIC(
cJSON *) cJSON_CreateFloatArray(
const float *numbers,
int count);
218CJSON_PUBLIC(
cJSON *) cJSON_CreateDoubleArray(
const double *numbers,
int count);
219CJSON_PUBLIC(
cJSON *) cJSON_CreateStringArray(
const char *
const *strings,
int count);
222CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(
cJSON *array,
cJSON *item);
223CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(
cJSON *
object,
const char *
string,
cJSON *item);
227CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(
cJSON *
object,
const char *
string,
cJSON *item);
229CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(
cJSON *array,
cJSON *item);
230CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(
cJSON *
object,
const char *
string,
cJSON *item);
233CJSON_PUBLIC(
cJSON *) cJSON_DetachItemViaPointer(
cJSON *parent,
cJSON *
const item);
234CJSON_PUBLIC(
cJSON *) cJSON_DetachItemFromArray(
cJSON *array,
int which);
235CJSON_PUBLIC(
void) cJSON_DeleteItemFromArray(
cJSON *array,
int which);
236CJSON_PUBLIC(
cJSON *) cJSON_DetachItemFromObject(
cJSON *
object,
const char *
string);
237CJSON_PUBLIC(
cJSON *) cJSON_DetachItemFromObjectCaseSensitive(
cJSON *
object,
const char *
string);
238CJSON_PUBLIC(
void) cJSON_DeleteItemFromObject(
cJSON *
object,
const char *
string);
239CJSON_PUBLIC(
void) cJSON_DeleteItemFromObjectCaseSensitive(
cJSON *
object,
const char *
string);
242CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(
cJSON *array,
int which,
cJSON *newitem);
243CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(
cJSON *
const parent,
cJSON *
const item,
cJSON * replacement);
244CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(
cJSON *array,
int which,
cJSON *newitem);
245CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(
cJSON *
object,
const char *
string,
cJSON *newitem);
246CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(
cJSON *
object,
const char *
string,
cJSON *newitem);
249CJSON_PUBLIC(
cJSON *) cJSON_Duplicate(
const cJSON *item, cJSON_bool recurse);
255CJSON_PUBLIC(cJSON_bool) cJSON_Compare(
const cJSON *
const a,
const cJSON *
const b,
const cJSON_bool case_sensitive);
260CJSON_PUBLIC(
void) cJSON_Minify(
char *json);
264CJSON_PUBLIC(
cJSON*) cJSON_AddNullToObject(
cJSON *
const object,
const char *
const name);
265CJSON_PUBLIC(
cJSON*) cJSON_AddTrueToObject(
cJSON *
const object,
const char *
const name);
266CJSON_PUBLIC(
cJSON*) cJSON_AddFalseToObject(
cJSON *
const object,
const char *
const name);
267CJSON_PUBLIC(
cJSON*) cJSON_AddBoolToObject(
cJSON *
const object,
const char *
const name,
const cJSON_bool
boolean);
268CJSON_PUBLIC(
cJSON*) cJSON_AddNumberToObject(
cJSON *
const object,
const char *
const name,
const double number);
269CJSON_PUBLIC(
cJSON*) cJSON_AddStringToObject(
cJSON *
const object,
const char *
const name,
const char *
const string);
270CJSON_PUBLIC(
cJSON*) cJSON_AddRawToObject(
cJSON *
const object,
const char *
const name,
const char *
const raw);
271CJSON_PUBLIC(
cJSON*) cJSON_AddObjectToObject(
cJSON *
const object,
const char *
const name);
272CJSON_PUBLIC(
cJSON*) cJSON_AddArrayToObject(
cJSON *
const object,
const char *
const name);
275#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
277CJSON_PUBLIC(
double) cJSON_SetNumberHelper(
cJSON *
object,
double number);
278#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
280CJSON_PUBLIC(
char*) cJSON_SetValuestring(
cJSON *
object,
const char *valuestring);
283#define cJSON_SetBoolValue(object, boolValue) ( \
284 (object != NULL && ((object)->type & (cJSON_False|cJSON_True))) ? \
285 (object)->type=((object)->type &(~(cJSON_False|cJSON_True)))|((boolValue)?cJSON_True:cJSON_False) : \
290#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
293CJSON_PUBLIC(
void *) cJSON_malloc(
size_t size);
294CJSON_PUBLIC(
void) cJSON_free(
void *
object);