Add Dictionary.merge()
This commit is contained in:
parent
3aa83a0235
commit
a0915e6dee
4 changed files with 18 additions and 0 deletions
|
|
@ -269,6 +269,14 @@ void Dictionary::clear() {
|
|||
_p->variant_map.clear();
|
||||
}
|
||||
|
||||
void Dictionary::merge(const Dictionary &p_dictionary, bool p_overwrite) {
|
||||
for (const KeyValue<Variant, Variant> &E : p_dictionary._p->variant_map) {
|
||||
if (p_overwrite || !has(E.key)) {
|
||||
this->operator[](E.key) = E.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Dictionary::_unref() const {
|
||||
ERR_FAIL_COND(!_p);
|
||||
if (_p->refcount.unref()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue