Lines Matching refs:item

96 static const char *parse_number(cJSON *item,const char *num)  in parse_number()  argument
111 item->valuedouble=n; in parse_number()
112 item->valueint=(int)n; in parse_number()
113 item->type=cJSON_Number; in parse_number()
118 static char *print_number(cJSON *item) in print_number() argument
121 double d=item->valuedouble; in print_number()
122 if (fabs(((double)item->valueint)-d)<=DBL_EPSILON && d<=INT_MAX && d>=INT_MIN) in print_number()
125 if (str) sprintf(str,"%d",item->valueint); in print_number()
155 static const char *parse_string(cJSON *item,const char *str) in parse_string() argument
209 item->valuestring=out; in parse_string()
210 item->type=cJSON_String; in parse_string()
250 static char *print_string(cJSON *item) {return print_string_ptr(item->valuestring);} in print_string() argument
253 static const char *parse_value(cJSON *item,const char *value);
254 static char *print_value(cJSON *item,int depth,int fmt);
255 static const char *parse_array(cJSON *item,const char *value);
256 static char *print_array(cJSON *item,int depth,int fmt);
257 static const char *parse_object(cJSON *item,const char *value);
258 static char *print_object(cJSON *item,int depth,int fmt);
283 char *cJSON_Print(cJSON *item) {return print_value(item,0,1);} in cJSON_Print() argument
284 char *cJSON_PrintUnformatted(cJSON *item) {return print_value(item,0,0);} in cJSON_PrintUnformatted() argument
287 static const char *parse_value(cJSON *item,const char *value) in parse_value() argument
290 if (!strncmp(value,"null",4)) { item->type=cJSON_NULL; return value+4; } in parse_value()
291 if (!strncmp(value,"false",5)) { item->type=cJSON_False; return value+5; } in parse_value()
292 if (!strncmp(value,"true",4)) { item->type=cJSON_True; item->valueint=1; return value+4; } in parse_value()
293 if (*value=='\"') { return parse_string(item,value); } in parse_value()
294 if (*value=='-' || (*value>='0' && *value<='9')) { return parse_number(item,value); } in parse_value()
295 if (*value=='[') { return parse_array(item,value); } in parse_value()
296 if (*value=='{') { return parse_object(item,value); } in parse_value()
302 static char *print_value(cJSON *item,int depth,int fmt) in print_value() argument
305 if (!item) return 0; in print_value()
306 switch ((item->type)&255) in print_value()
311 case cJSON_Number: out=print_number(item);break; in print_value()
312 case cJSON_String: out=print_string(item);break; in print_value()
313 case cJSON_Array: out=print_array(item,depth,fmt);break; in print_value()
314 case cJSON_Object: out=print_object(item,depth,fmt);break; in print_value()
320 static const char *parse_array(cJSON *item,const char *value) in parse_array() argument
325 item->type=cJSON_Array; in parse_array()
329 item->child=child=cJSON_New_Item(); in parse_array()
330 if (!item->child) return 0; /* memory fail */ in parse_array()
348 static char *print_array(cJSON *item,int depth,int fmt) in print_array() argument
352 cJSON *child=item->child; in print_array()
369 child=item->child; in print_array()
406 static const char *parse_object(cJSON *item,const char *value) in parse_object() argument
411 item->type=cJSON_Object; in parse_object()
415 item->child=child=cJSON_New_Item(); in parse_object()
416 if (!item->child) return 0; in parse_object()
442 static char *print_object(cJSON *item,int depth,int fmt) in print_object() argument
446 cJSON *child=item->child; in print_object()
469 child=item->child;depth++;if (fmt) len+=depth; in print_object()
511 cJSON *cJSON_GetArrayItem(cJSON *array,int item) {cJSON *c=array->child; while (c && item>0) it… in cJSON_GetArrayItem() argument
515 static void suffix_object(cJSON *prev,cJSON *item) {prev->next=item;item->prev=prev;} in suffix_object() argument
517 static cJSON *create_reference(cJSON *item) {cJSON *ref=cJSON_New_Item();if (!ref) return 0;memcpy(… in create_reference() argument
520 …JSON *item) {cJSON *c=array->child;if (!item) return; if (!c) {array->child=item;} else {whil… in cJSON_AddItemToArray() argument
521 …g,cJSON *item) {if (!item) return; if (item->string) cJSON_free(item->string);item->string=cJSON_s… in cJSON_AddItemToObject() argument
522 …_AddItemReferenceToArray(cJSON *array, cJSON *item) {cJSON_AddItemToArray(array,create_refere… in cJSON_AddItemReferenceToArray() argument
523 …ect(cJSON *object,const char *string,cJSON *item) {cJSON_AddItemToObject(object,string,create_refe… in cJSON_AddItemReferenceToObject() argument
538 cJSON *cJSON_CreateNull(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_NULL;retur… in cJSON_CreateNull() local
539 cJSON *cJSON_CreateTrue(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_True;retur… in cJSON_CreateTrue() local
540 cJSON *cJSON_CreateFalse(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_False;ret… in cJSON_CreateFalse() local
541 … *cJSON_CreateBool(int b) {cJSON *item=cJSON_New_Item();if(item)item->type=b?cJSON_True:cJSON_… in cJSON_CreateBool() local
542 …uble num) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_Number;item->valuedouble=num;i… in cJSON_CreateNumber() local
543 … char *string) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_String;item->valuestring=cJ… in cJSON_CreateString() local
544 cJSON *cJSON_CreateArray(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Array;ret… in cJSON_CreateArray() local
545 cJSON *cJSON_CreateObject(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Object;r… in cJSON_CreateObject() local
554 cJSON *cJSON_Duplicate(cJSON *item,int recurse) in cJSON_Duplicate() argument
558 if (!item) return 0; in cJSON_Duplicate()
563 …newitem->type=item->type&(~cJSON_IsReference),newitem->valueint=item->valueint,newitem->valuedoubl… in cJSON_Duplicate()
564 …if (item->valuestring) {newitem->valuestring=cJSON_strdup(item->valuestring); if (!newitem->values… in cJSON_Duplicate()
565 …if (item->string) {newitem->string=cJSON_strdup(item->string); if (!newitem->string) {cJSON_De… in cJSON_Duplicate()
569 cptr=item->child; in cJSON_Duplicate()