MCPcopy Create free account
hub / github.com/Bwar/CJsonObject / print_value

Function print_value

cJSON.c:497–530  ·  view source on GitHub ↗

Render a value to text. */

Source from the content-addressed store, hash-verified

495
496/* Render a value to text. */
497static char *print_value(cJSON *item, int depth, int fmt)
498{
499 char *out = 0;
500 if (!item)
501 return 0;
502 switch ((item->type) & 255)
503 {
504 case cJSON_NULL:
505 out = cJSON_strdup("null");
506 break;
507 case cJSON_False:
508 out = cJSON_strdup("false");
509 break;
510 case cJSON_True:
511 out = cJSON_strdup("true");
512 break;
513 case cJSON_Int:
514 out = print_int(item);
515 break;
516 case cJSON_Double:
517 out = print_double(item);
518 break;
519 case cJSON_String:
520 out = print_string(item);
521 break;
522 case cJSON_Array:
523 out = print_array(item, depth, fmt);
524 break;
525 case cJSON_Object:
526 out = print_object(item, depth, fmt);
527 break;
528 }
529 return out;
530}
531
532/* Build an array from input text. */
533static const char *parse_array(cJSON *item, const char *value, const char **ep)

Callers 4

cJSON_PrintFunction · 0.85
cJSON_PrintUnformattedFunction · 0.85
print_arrayFunction · 0.85
print_objectFunction · 0.85

Calls 6

cJSON_strdupFunction · 0.85
print_intFunction · 0.85
print_doubleFunction · 0.85
print_stringFunction · 0.85
print_arrayFunction · 0.85
print_objectFunction · 0.85

Tested by

no test coverage detected