Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
void Asset::setState(State s)
{
    State old = d->state;
    d->state = s;
    if (old != d->state)
    {
        DENG2_FOR_AUDIENCE2(StateChange, i) i->assetStateChanged(*this);
    }
}
Ejemplo n.º 3
0
ArchiveEntryFile::~ArchiveEntryFile()
{
    DENG2_GUARD(this);

    DENG2_FOR_AUDIENCE2(Deletion, i) i->fileBeingDeleted(*this);
    audienceForDeletion().clear();
    
    deindex();
}
Ejemplo n.º 4
0
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());
    }
}
Ejemplo n.º 5
0
Variable::~Variable()
{
    DENG2_FOR_AUDIENCE2(Deletion, i) i->variableBeingDeleted(*this);
}
Ejemplo n.º 6
0
Asset::~Asset()
{
    DENG2_FOR_AUDIENCE2(Deletion, i) i->assetBeingDeleted(*this);
}
Ejemplo n.º 7
0
ArchiveFolder::~ArchiveFolder()
{
    DENG2_FOR_AUDIENCE2(Deletion, i) i->fileBeingDeleted(*this);
    audienceForDeletion().clear();
    deindex();
}