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

Function to_flat

src/resource/unit_compiler.cpp:825–850  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

823 }
824
825 void to_flat(FlatJsonObject &obj, const char *json_object, DynamicString &prefix)
826 {
827 TempAllocator4096 ta;
828 JsonObject jo(ta);
829 sjson::parse_object(jo, json_object);
830
831 auto cur = json_object::begin(jo);
832 auto end = json_object::end(jo);
833 for (; cur != end; ++cur) {
834 JSON_OBJECT_SKIP_HOLE(jo, cur);
835
836 DynamicString key(default_allocator());
837 key = prefix;
838 if (key.length() != 0)
839 key += ".";
840 key += cur->first;
841
842 if (json::type(cur->second) == JsonValueType::OBJECT) {
843 hash_map::set(obj, key, cur->second);
844 DynamicString new_prefix(default_allocator());
845 to_flat(obj, cur->second, key);
846 } else {
847 hash_map::set(obj, key, cur->second);
848 }
849 }
850 }
851
852 s32 modify_unit_components(Unit *unit, const char *unit_json, CompileOptions &opts)
853 {

Callers 1

modify_unit_componentsFunction · 0.85

Calls 6

setClass · 0.85
parse_objectFunction · 0.50
beginFunction · 0.50
endFunction · 0.50
typeFunction · 0.50
lengthMethod · 0.45

Tested by

no test coverage detected