MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / get_or

Function get_or

src/host/settings/settings_store.cpp:53–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51// back to its default without discarding any other valid field.
52template <typename T>
53T get_or(const nlohmann::json& j, const std::string& key, T def) {
54 if (!j.is_object() || !j.contains(key)) {
55 return def;
56 }
57 try {
58 return j.at(key).get<T>();
59 } catch (const nlohmann::json::exception&) {
60 return def;
61 }
62}
63
64} // namespace
65

Callers 1

settings_from_jsonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected