|
@ -36,6 +36,7 @@ extern "C" |
|
|
#define cJSON_String (1 << 4) |
|
|
#define cJSON_String (1 << 4) |
|
|
#define cJSON_Array (1 << 5) |
|
|
#define cJSON_Array (1 << 5) |
|
|
#define cJSON_Object (1 << 6) |
|
|
#define cJSON_Object (1 << 6) |
|
|
|
|
|
#define cJSON_Raw (1 << 7) //< raw json
|
|
|
|
|
|
|
|
|
#define cJSON_IsReference 256 |
|
|
#define cJSON_IsReference 256 |
|
|
#define cJSON_StringIsConst 512 |
|
|
#define cJSON_StringIsConst 512 |
|
@ -52,7 +53,7 @@ typedef struct cJSON |
|
|
/* The type of the item, as above. */ |
|
|
/* The type of the item, as above. */ |
|
|
int type; |
|
|
int type; |
|
|
|
|
|
|
|
|
/* The item's string, if type==cJSON_String */ |
|
|
/* The item's string, if type==cJSON_String and type == cJSON_Raw */ |
|
|
char *valuestring; |
|
|
char *valuestring; |
|
|
/* The item's number, if type==cJSON_Number */ |
|
|
/* The item's number, if type==cJSON_Number */ |
|
|
int valueint; |
|
|
int valueint; |
|
@ -101,6 +102,8 @@ extern cJSON *cJSON_CreateFalse(void); |
|
|
extern cJSON *cJSON_CreateBool(int b); |
|
|
extern cJSON *cJSON_CreateBool(int b); |
|
|
extern cJSON *cJSON_CreateNumber(double num); |
|
|
extern cJSON *cJSON_CreateNumber(double num); |
|
|
extern cJSON *cJSON_CreateString(const char *string); |
|
|
extern cJSON *cJSON_CreateString(const char *string); |
|
|
|
|
|
// raw json
|
|
|
|
|
|
extern cJSON *cJSON_CreateRaw(const char *raw); |
|
|
extern cJSON *cJSON_CreateArray(void); |
|
|
extern cJSON *cJSON_CreateArray(void); |
|
|
extern cJSON *cJSON_CreateObject(void); |
|
|
extern cJSON *cJSON_CreateObject(void); |
|
|
|
|
|
|
|
@ -148,6 +151,7 @@ extern void cJSON_Minify(char *json); |
|
|
#define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b)) |
|
|
#define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b)) |
|
|
#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n)) |
|
|
#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n)) |
|
|
#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s)) |
|
|
#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s)) |
|
|
|
|
|
#define cJSON_AddRawToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateRaw(s)) |
|
|
|
|
|
|
|
|
/* When assigning an integer value, it needs to be propagated to valuedouble too. */ |
|
|
/* When assigning an integer value, it needs to be propagated to valuedouble too. */ |
|
|
#define cJSON_SetIntValue(object,val) ((object) ? (object)->valueint = (object)->valuedouble = (val) : (val)) |
|
|
#define cJSON_SetIntValue(object,val) ((object) ? (object)->valueint = (object)->valuedouble = (val) : (val)) |
|
|