Variable &Variable::set(Value *v) { DENG2_ASSERT(v != 0); QScopedPointer<Value> val(v); // If the value would change, must check if this is allowed. verifyWritable(*v); verifyValid(*v); QScopedPointer<Value> oldValue(d->value); // old value deleted afterwards d->value = val.take(); // We'll only determine if actual change occurred if someone is interested. if(!audienceForChange().isEmpty() || !audienceForChangeFrom().isEmpty()) { bool notify = true; try { // Did it actually change? Let's compare... notify = oldValue.isNull() || oldValue->compare(*v); } catch(Error const &) { // Perhaps the values weren't comparable? } if(notify) { DENG2_FOR_AUDIENCE2(Change, i) i->variableValueChanged(*this, *d->value); DENG2_FOR_AUDIENCE2(ChangeFrom, i) i->variableValueChangedFrom(*this, *oldValue, *d->value); } } return *this; }
void Asset::setState(State s) { State old = d->state; d->state = s; if (old != d->state) { DENG2_FOR_AUDIENCE2(StateChange, i) i->assetStateChanged(*this); } }
ArchiveEntryFile::~ArchiveEntryFile() { DENG2_GUARD(this); DENG2_FOR_AUDIENCE2(Deletion, i) i->fileBeingDeleted(*this); audienceForDeletion().clear(); deindex(); }
void Loop::nextLoopIteration() { try { if (d->running) { DENG2_FOR_AUDIENCE2(Iteration, i) i->loopIteration(); } } catch (Error const &er) { LOG_AS("Loop"); // This is called from Qt's event loop, we mustn't let exceptions // out of here uncaught. App::app().handleUncaughtException("Uncaught exception during loop iteration:\n" + er.asText()); } }
Variable::~Variable() { DENG2_FOR_AUDIENCE2(Deletion, i) i->variableBeingDeleted(*this); }
Asset::~Asset() { DENG2_FOR_AUDIENCE2(Deletion, i) i->assetBeingDeleted(*this); }
ArchiveFolder::~ArchiveFolder() { DENG2_FOR_AUDIENCE2(Deletion, i) i->fileBeingDeleted(*this); audienceForDeletion().clear(); deindex(); }