MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / print_value

Function print_value

common/map_sdk/transmission/src/cJSON.cpp:400–430  ·  view source on GitHub ↗

Render a value to text. */

Source from the content-addressed store, hash-verified

398
399/* Render a value to text. */
400static char *print_value(cJSON *item, int depth, int fmt) {
401 char *out = 0;
402 if (!item) return 0;
403 switch ((item->type) & 255) {
404 case cJSON_NULL:
405 out = cJSON_strdup("null");
406 break;
407 case cJSON_False:
408 out = cJSON_strdup("false");
409 break;
410 case cJSON_True:
411 out = cJSON_strdup("true");
412 break;
413 case cJSON_Int:
414 out = print_int(item);
415 break;
416 case cJSON_Double:
417 out = print_double(item);
418 break;
419 case cJSON_String:
420 out = print_string(item);
421 break;
422 case cJSON_Array:
423 out = print_array(item, depth, fmt);
424 break;
425 case cJSON_Object:
426 out = print_object(item, depth, fmt);
427 break;
428 }
429 return out;
430}
431
432/* Build an array from input text. */
433static const char *parse_array(cJSON *item, const char *value) {

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