예제 #1
0
void Transaction::addObjectChange(const DocumentObject *Obj,const Property *Prop)
{
    std::map<const DocumentObject*,TransactionObject*>::iterator pos = _Objects.find(Obj);
    TransactionObject *To;

    if (pos != _Objects.end()) {
        To = pos->second;
    }
    else {
        To = new TransactionObject(Obj);
        _Objects[Obj] = To;
        To->status = TransactionObject::Chn;
    }

    To->setProperty(Prop);
}
void Transaction::addObjectChange(const TransactionalObject *Obj, const Property *Prop)
{
    TransactionList::iterator pos = _Objects.end();
    for (TransactionList::iterator it = _Objects.begin(); it != _Objects.end(); ++it) {
        if (it->first == Obj) {
            pos = it;
            break;
        }
    }

    TransactionObject *To;

    if (pos != _Objects.end()) {
        To = pos->second;
    }
    else {
        To = TransactionFactory::instance().createTransaction(Obj->getTypeId());
        _Objects.push_back(std::make_pair(Obj, To));
        To->status = TransactionObject::Chn;
    }

    To->setProperty(Prop);
}