MCPcopy Create free account
hub / github.com/crownengine/crown / parse_root_object

Function parse_root_object

src/core/json/sjson.cpp:456–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454 }
455
456 static void parse_root_object(JsonObject &obj, const char *json)
457 {
458 if (json == NULL) {
459 fatal("json is NULL");
460 return;
461 }
462
463 while (*json) {
464 const char *key_begin = *json == '"' ? (json + 1) : json;
465
466 TempAllocator256 ta;
467 DynamicString key(ta);
468 json = parse_key(json, key);
469 if (json == NULL)
470 return;
471
472 StringView fs_key(key_begin, key.length());
473
474 json = skip_spaces(json);
475 if (json == NULL)
476 return;
477 NEXT_OR_RETURN(json, (*json == '=') ? '=' : ':', /*void*/);
478 json = skip_spaces(json);
479 if (json == NULL)
480 return;
481
482 hash_map::set(obj._map, fs_key, json);
483
484 json = skip_value(json);
485 if (json == NULL)
486 return;
487
488 json = skip_spaces(json);
489 if (json == NULL)
490 return;
491 }
492
493 obj._end = json + 1;
494 }
495
496 void parse_object(JsonObject &obj, const char *json)
497 {

Callers 1

parseFunction · 0.85

Calls 6

parse_keyFunction · 0.85
skip_spacesFunction · 0.85
setClass · 0.85
fatalFunction · 0.70
skip_valueFunction · 0.70
lengthMethod · 0.45

Tested by

no test coverage detected