Lines Matching refs:cJSON
2 Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
93 /* cJSON Types: */
110 /* The cJSON structure: */
111 typedef struct cJSON
114 struct cJSON *next;
115 struct cJSON *prev;
117 struct cJSON *child;
136 } cJSON;
147 /* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
153 /* returns the version of cJSON as a string */
156 /* Supply malloc, realloc and free functions to cJSON */
160 /* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
161 CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
162 CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length);
165 CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
166 CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated);
168 /* Render a cJSON entity to text for transfer/storage. */
169 CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
170 /* Render a cJSON entity to text for transfer/storage without any formatting. */
171 CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
172 /* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
173 CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
174 /* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
175 /* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
176 CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
177 /* Delete a cJSON entity and all subentities. */
178 CJSON_PUBLIC(void) cJSON_Delete(cJSON *item);
181 CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
183 CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
185 CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
186 CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
187 CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
192 CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item);
194 CJSON_PUBLIC(long long *) cJSON_GetInt64NumberValue(cJSON * const item);
196 CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item);
199 CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
200 CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
201 CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item);
202 CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item);
203 CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item);
205 CJSON_PUBLIC(cJSON_bool) cJSON_IsInt64Number(const cJSON * const item);
207 CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item);
208 CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item);
209 CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item);
210 CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item);
211 CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
213 /* These calls create a cJSON item of the appropriate type. */
214 CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
215 CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
216 CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
217 CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
218 CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);
220 CJSON_PUBLIC(cJSON *) cJSON_CreateInt64Number(long long integer);
222 CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
224 CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
225 CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
226 CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
230 CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
233 CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
234 CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
238 CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
239 CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
240 CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);
241 CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count);
244 CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item);
245 CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
246 /* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
249 CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
250 /* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
251 CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
252 CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
255 CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
256 CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
257 CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
258 CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
259 CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
260 CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
261 CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
264 CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
265 CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
266 CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
267 CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
268 CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
270 /* Duplicate a cJSON item */
271 CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
272 /* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
275 /* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
277 CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
286 CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
287 CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
288 CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
289 CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean);
291 CJSON_PUBLIC(cJSON*) cJSON_AddInt64NumberToObject(cJSON * const object, const char * const name, const long long integer);
293 CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number);
294 CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
295 CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
296 CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
297 CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
300 CJSON_PUBLIC(long long) cJSON_SetInt64NumberValue(cJSON * const object, const long long integer);
305 CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
308 CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring);