MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / from_json

Method from_json

rpcs3/util/Config.cpp:586–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584}
585
586bool cfg::node::from_json(const nlohmann::json& json, bool dynamic)
587{
588 if (!json.is_object())
589 {
590 return false;
591 }
592
593 auto find_node = [this](std::string_view name) -> _base*
594 {
595 for (const auto& node : get_nodes())
596 {
597 if (node->get_name() == name)
598 {
599 return node;
600 }
601 }
602
603 return nullptr;
604 };
605
606 for (auto& [key, value] : json.get<nlohmann::json::object_t>())
607 {
608 auto keyNode = find_node(key);
609
610 if (keyNode == nullptr || (dynamic && !keyNode->get_is_dynamic()))
611 {
612 continue;
613 }
614
615 keyNode->from_json(value, dynamic);
616 }
617
618 return false;
619}
620
621bool cfg::node::from_string(std::string_view value, bool dynamic)
622{

Callers 1

_rpcsx_settingsSetFunction · 0.45

Calls 2

get_is_dynamicMethod · 0.80
get_nameMethod · 0.45

Tested by

no test coverage detected