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

Method parse

src/device/boot_config.cpp:172–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172bool BootConfig::parse(const char *json)
173{
174 TempAllocator4096 ta;
175 JsonObject cfg(ta);
176 sjson::parse(cfg, json);
177
178 auto cur = json_object::begin(cfg);
179 auto end = json_object::end(cfg);
180 for (; cur != end; ++cur) {
181 JSON_OBJECT_SKIP_HOLE(cfg, cur);
182
183 if (cur->first == "boot_script") {
184 sjson::parse_string(boot_script_name, cur->second);
185 } else if (cur->first == "boot_package") {
186 boot_package_name = sjson::parse_resource_name(cur->second);
187 } else if (cur->first == "window_title") {
188 sjson::parse_string(window_title, cur->second);
189 } else if (cur->first == "render_config") {
190 render_config_name = sjson::parse_resource_name(cur->second);
191 } else if (cur->first == "physics") {
192 parse_physics(&physics_settings, cur->second);
193 } else if (cur->first == "render_settings") {
194 render_settings::parse(render_settings, cur->second);
195 } else if (cur->first == "user_config") {
196 sjson::parse_string(user_config, cur->second);
197 } else if (cur->first == CROWN_PLATFORM_NAME) {
198 parse_platform_settings(this, cur->second);
199 } else {
200 if (!is_platform_name(cur->first)) {
201 logw(BOOT_CONFIG
202 , "Unknown boot_config property '%.*s'"
203 , cur->first.length()
204 , cur->first.data()
205 );
206 }
207 }
208 }
209
210 return true;
211}
212
213} // namespace crown

Callers 4

main_loopMethod · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 10

parse_resource_nameFunction · 0.85
parse_physicsFunction · 0.85
parse_platform_settingsFunction · 0.85
is_platform_nameFunction · 0.85
parseFunction · 0.50
beginFunction · 0.50
endFunction · 0.50
parse_stringFunction · 0.50
lengthMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected