MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / jsonMergeNulling

Function jsonMergeNulling

source/core/StarJson.cpp:1051–1066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1049}
1050
1051Json jsonMergeNulling(Json const& base, Json const& merger) {
1052 if (base.type() == Json::Type::Object && merger.type() == Json::Type::Object) {
1053 JsonObject merged = base.toObject();
1054 for (auto const& p : merger.toObject()) {
1055 if (p.second.isNull())
1056 merged.erase(p.first);
1057 else {
1058 auto res = merged.insert(p);
1059 if (!res.second)
1060 res.first->second = jsonMergeNulling(res.first->second, p.second);
1061 }
1062 }
1063 return merged;
1064 }
1065 return merger;
1066}
1067
1068bool jsonPartialMatch(Json const& base, Json const& compare) {
1069 if (base == compare) {

Callers 2

ObjectMethod · 0.85
readJsonMethod · 0.85

Calls 5

toObjectMethod · 0.80
typeMethod · 0.45
isNullMethod · 0.45
eraseMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected