mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-14 02:10:06 +00:00
Add force property override feature to patcher
This has a variety of applications, but is particularly useful when we want to replace arrays instead of add onto them
This commit is contained in:
parent
af8dd61967
commit
36cb32454d
@ -961,6 +961,15 @@ static void patchJSON(json* base, json* patch) {
|
||||
std::string key = _prop.key(); // static identifier
|
||||
json* valLoc = &(*_prop); // pointer to json data
|
||||
|
||||
// special casing for forced replacement.
|
||||
// the ! is stripped, then the property is forcibly replaced without a recursive call
|
||||
// that means no type checking, so use at your own risk
|
||||
if (key.c_str()[0] == '!') {
|
||||
key = key.substr(1, key.length() - 1);
|
||||
(*base)[key] = *valLoc;
|
||||
continue;
|
||||
}
|
||||
|
||||
// search for matching property in base object
|
||||
json::iterator _match = base->find(key);
|
||||
if (_match != base->end()) {
|
||||
|
Loading…
Reference in New Issue
Block a user