inline bool objectCopy(JsonObjectData* dst, const JsonObjectData* src, MemoryPool* pool) { if (!dst || !src) return false; objectClear(dst); for (VariantSlot* s = src->head; s; s = s->next) { JsonVariantData* var; if (s->value.keyIsOwned) var = objectAdd(dst, ZeroTerminatedRamString(s->ownedKey->value), pool); else var = objectAdd(dst, ZeroTerminatedRamStringConst(s->linkedKey), pool); if (!variantCopy(var, &s->value, pool)) return false; } return true; }
inline JsonVariantData* objectSet(JsonObjectData* obj, TKey key, MemoryPool* pool) { if (!obj) return 0; // ignore null key if (key.isNull()) return 0; // search a matching key VariantSlot* slot = objectFindSlot(obj, key); if (slot) return &slot->value; return objectAdd(obj, key, pool); }
void Scene::__addObject( const Object3D::Ptr& object ) { if ( !object ) return; detail::Add objectAdd( *this, object ); object->visit( objectAdd ); dispatchEvent( Event("objectAdded", object.get()) ); object->dispatchEvent( Event("addedToScene", this) ); for ( auto& child : object->children ) { __addObject( child ); } }