void PassByValueCheck::registerMatchers(MatchFinder *Finder) { // Only register the matchers for C++; the functionality currently does not // provide any benefit to other languages, despite being benign. if (!getLangOpts().CPlusPlus) return; Finder->addMatcher( cxxConstructorDecl( forEachConstructorInitializer( cxxCtorInitializer( // Clang builds a CXXConstructExpr only whin it knows which // constructor will be called. In dependent contexts a // ParenListExpr is generated instead of a CXXConstructExpr, // filtering out templates automatically for us. withInitializer(cxxConstructExpr( has(ignoringParenImpCasts(declRefExpr(to( parmVarDecl( hasType(qualType( // Match only const-ref or a non-const value // parameters. Rvalues and const-values // shouldn't be modified. anyOf(constRefType(), nonConstValueType())))) .bind("Param"))))), hasDeclaration(cxxConstructorDecl( isCopyConstructor(), unless(isDeleted()), hasDeclContext( cxxRecordDecl(isMoveConstructible()))))))) .bind("Initializer"))) .bind("Ctor"), this); }
IDBRequest* IDBObjectStore::openCursor(ScriptState* scriptState, const ScriptValue& range, const String& directionString, ExceptionState& exceptionState) { IDB_TRACE("IDBObjectStore::openCursor"); if (isDeleted()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage); return nullptr; } if (m_transaction->isFinished() || m_transaction->isFinishing()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); return nullptr; } if (!m_transaction->isActive()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); return nullptr; } WebIDBCursorDirection direction = IDBCursor::stringToDirection(directionString); IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->getExecutionContext(), range, exceptionState); if (exceptionState.hadException()) return nullptr; if (!backendDB()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage); return nullptr; } return openCursor(scriptState, keyRange, direction, WebIDBTaskTypeNormal); }
IDBRequest* IDBObjectStore::clear(ScriptState* scriptState, ExceptionState& exceptionState) { IDB_TRACE("IDBObjectStore::clear"); if (isDeleted()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage); return nullptr; } if (m_transaction->isFinished() || m_transaction->isFinishing()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); return nullptr; } if (!m_transaction->isActive()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); return nullptr; } if (m_transaction->isReadOnly()) { exceptionState.throwDOMException(ReadOnlyError, IDBDatabase::transactionReadOnlyErrorMessage); return nullptr; } if (!backendDB()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage); return nullptr; } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(request).leakPtr()); return request; }
void IDBObjectStore::deleteIndex(const String& name, ExceptionCode& ec) { IDB_TRACE("IDBObjectStore::deleteIndex"); if (!m_transaction->isVersionChange() || isDeleted()) { ec = IDBDatabaseException::InvalidStateError; return; } if (!m_transaction->isActive()) { ec = IDBDatabaseException::TransactionInactiveError; return; } int64_t indexId = findIndexId(name); if (indexId == IDBIndexMetadata::InvalidId) { ec = IDBDatabaseException::NotFoundError; return; } backendDB()->deleteIndex(m_transaction->id(), id(), indexId); m_metadata.indexes.remove(indexId); m_transaction->db()->indexDeleted(id(), indexId); IDBIndexMap::iterator it = m_indexMap.find(name); if (it != m_indexMap.end()) { it->value->markDeleted(); m_indexMap.remove(name); } }
PassRefPtrWillBeRawPtr<IDBRequest> IDBIndex::openCursor(ExecutionContext* context, const ScriptValue& range, const String& directionString, ExceptionState& exceptionState) { IDB_TRACE("IDBIndex::openCursor"); if (isDeleted()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage); return nullptr; } if (m_transaction->isFinished() || m_transaction->isFinishing()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); return nullptr; } if (!m_transaction->isActive()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); return nullptr; } WebIDBCursor::Direction direction = IDBCursor::stringToDirection(directionString, exceptionState); if (exceptionState.hadException()) return nullptr; RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, range, exceptionState); if (exceptionState.hadException()) return nullptr; if (!backendDB()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage); return nullptr; } return openCursor(context, keyRange.release(), direction); }
PassRefPtrWillBeRawPtr<IDBRequest> IDBIndex::getInternal(ExecutionContext* context, const ScriptValue& key, ExceptionState& exceptionState, bool keyOnly) { if (isDeleted()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage); return nullptr; } if (m_transaction->isFinished() || m_transaction->isFinishing()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); return nullptr; } if (!m_transaction->isActive()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); return nullptr; } RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, key, exceptionState); if (exceptionState.hadException()) return nullptr; if (!keyRange) { exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRangeErrorMessage); return nullptr; } if (!backendDB()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage); return nullptr; } RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); backendDB()->get(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange.release(), keyOnly, WebIDBCallbacksImpl::create(request).leakPtr()); return request; }
PassRefPtrWillBeRawPtr<IDBRequest> IDBIndex::openKeyCursor(ExecutionContext* context, const ScriptValue& range, const String& directionString, ExceptionState& exceptionState) { IDB_TRACE("IDBIndex::openKeyCursor"); if (isDeleted()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage); return nullptr; } if (m_transaction->isFinished() || m_transaction->isFinishing()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); return nullptr; } if (!m_transaction->isActive()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); return nullptr; } WebIDBCursor::Direction direction = IDBCursor::stringToDirection(directionString, exceptionState); if (exceptionState.hadException()) return nullptr; RefPtrWillBeRawPtr<IDBKeyRange> keyRange = IDBKeyRange::fromScriptValue(context, range, exceptionState); if (exceptionState.hadException()) return nullptr; if (!backendDB()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage); return nullptr; } RefPtrWillBeRawPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange.release(), direction, true, WebIDBDatabase::NormalTask, WebIDBCallbacksImpl::create(request).leakPtr()); return request; }
//////////////////////////////////////////////////////////// // Push down any data from the old tree onto the new tree // by doing a traversal over the deleted clusters ////////////////////////////////////////////////////////// void pushDown(cluster* cl) { cluster* ccl; int i; assert(cl); ccl = GET_CL(cl); deprintf("pushDown: cl = %d\n",ccl->id); cluster** clusters = ccl->getClusters(); for(i=0; i < MAX_DEGREE; ++i) { cluster* child = clusters[i]; cluster* ccp = GET_CL(child); if(child) { pushDownFun(ccl,ccp); if(isDeleted(ccp)) { if(ccp->child) { deprintf("Child\n"); pushDown(child); deprintf("ret\n"); } freeCluster(ccp); } } } free(clusters); }
PassRefPtr<IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext* context, ExceptionCode& ec) { ec = 0; IDB_TRACE("IDBCursor::delete"); if (!m_transaction->isActive()) { ec = IDBDatabaseException::TransactionInactiveError; return 0; } if (m_transaction->isReadOnly()) { ec = IDBDatabaseException::ReadOnlyError; return 0; } if (!m_gotValue || isKeyCursor() || isDeleted()) { ec = IDBDatabaseException::InvalidStateError; return 0; } RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(m_currentPrimaryKey, ec); ASSERT(!ec); RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get()); m_transaction->backendDB()->deleteRange(m_transaction->id(), effectiveObjectStore()->id(), keyRange, request); return request.release(); }
PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value, ExceptionCode& ec) { IDB_TRACE("IDBCursor::update"); if (!m_gotValue || isKeyCursor() || isDeleted()) { ec = IDBDatabaseException::InvalidStateError; return 0; } if (!m_transaction->isActive()) { ec = IDBDatabaseException::TransactionInactiveError; return 0; } if (m_transaction->isReadOnly()) { ec = IDBDatabaseException::ReadOnlyError; return 0; } RefPtr<IDBObjectStore> objectStore = effectiveObjectStore(); const IDBKeyPath& keyPath = objectStore->metadata().keyPath; const bool usesInLineKeys = !keyPath.isNull(); if (usesInLineKeys) { RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(m_request->requestState(), value, keyPath); if (!keyPathKey || !keyPathKey->isEqual(m_currentPrimaryKey.get())) { ec = IDBDatabaseException::DataError; return 0; } } return objectStore->put(IDBDatabaseBackendInterface::CursorUpdate, IDBAny::create(this), state, value, m_currentPrimaryKey, ec); }
void CartPusher::send2City() { computeWalkerDestination(); if( !isDeleted() ) Scenario::instance().getCity().addWalker( WalkerPtr( this ) ); }
IDBRequest* IDBIndex::count(ScriptState* scriptState, const ScriptValue& range, ExceptionState& exceptionState) { IDB_TRACE("IDBIndex::count"); if (isDeleted()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage); return 0; } if (m_transaction->isFinished() || m_transaction->isFinishing()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); return 0; } if (!m_transaction->isActive()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); return 0; } IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), range, exceptionState); if (exceptionState.hadException()) return 0; if (!backendDB()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage); return 0; } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); backendDB()->count(m_transaction->id(), m_objectStore->id(), m_metadata.id, keyRange, WebIDBCallbacksImpl::create(request).leakPtr()); return request; }
IDBRequest* IDBObjectStore::openKeyCursor(ScriptState* scriptState, const ScriptValue& range, const String& directionString, ExceptionState& exceptionState) { IDB_TRACE("IDBObjectStore::openKeyCursor"); if (isDeleted()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage); return nullptr; } if (m_transaction->isFinished() || m_transaction->isFinishing()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); return nullptr; } if (!m_transaction->isActive()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); return nullptr; } WebIDBCursorDirection direction = IDBCursor::stringToDirection(directionString); IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->getExecutionContext(), range, exceptionState); if (exceptionState.hadException()) return nullptr; if (!backendDB()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage); return nullptr; } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create(request).leakPtr()); return request; }
IDBRequest* IDBObjectStore::getAllKeys(ScriptState* scriptState, const ScriptValue& keyRange, unsigned long maxCount, ExceptionState& exceptionState) { IDB_TRACE("IDBObjectStore::getAll"); if (!maxCount) maxCount = std::numeric_limits<uint32_t>::max(); if (isDeleted()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage); return nullptr; } if (m_transaction->isFinished() || m_transaction->isFinishing()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); return nullptr; } if (!m_transaction->isActive()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); return nullptr; } IDBKeyRange* range = IDBKeyRange::fromScriptValue(scriptState->getExecutionContext(), keyRange, exceptionState); if (exceptionState.hadException()) return nullptr; if (!backendDB()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage); return nullptr; } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, range, maxCount, true, WebIDBCallbacksImpl::create(request).leakPtr()); return request; }
void IDBCursor::advance(unsigned count, ExceptionState& exceptionState) { IDB_TRACE("IDBCursor::advance"); if (!count) { exceptionState.throwTypeError("A count argument with value 0 (zero) was supplied, must be greater than 0."); return; } if (!m_gotValue) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::noValueErrorMessage); return; } if (isDeleted()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::sourceDeletedErrorMessage); return; } if (m_transaction->isFinished() || m_transaction->isFinishing()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); return; } if (!m_transaction->isActive()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); return; } m_request->setPendingCursor(this); m_gotValue = false; m_backend->advance(count, WebIDBCallbacksImpl::create(m_request).leakPtr()); }
IDBRequest* IDBObjectStore::get(ScriptState* scriptState, const ScriptValue& key, ExceptionState& exceptionState) { IDB_TRACE("IDBObjectStore::get"); if (isDeleted()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage); return nullptr; } if (m_transaction->isFinished() || m_transaction->isFinishing()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); return nullptr; } if (!m_transaction->isActive()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); return nullptr; } IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->getExecutionContext(), key, exceptionState); if (exceptionState.hadException()) return nullptr; if (!keyRange) { exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRangeErrorMessage); return nullptr; } if (!backendDB()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage); return nullptr; } IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get()); backendDB()->get(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, keyRange, false, WebIDBCallbacksImpl::create(request).leakPtr()); return request; }
void NetObject::clearMaskBits(U32 orMask) { if(isDeleted()) return; if(mDirtyMaskBits) { mDirtyMaskBits &= ~orMask; if(!mDirtyMaskBits) { if(mPrevDirtyList) mPrevDirtyList->mNextDirtyList = mNextDirtyList; else mDirtyList = mNextDirtyList; if(mNextDirtyList) mNextDirtyList->mPrevDirtyList = mPrevDirtyList; mNextDirtyList = mPrevDirtyList = NULL; } } for(GhostInfo *walk = mFirstObjectRef; walk; walk = walk->nextObjectRef) { if(walk->updateMask && walk->updateMask == orMask) { walk->updateMask = 0; walk->connection->ghostPushToZero(walk); } else walk->updateMask &= ~orMask; } }
IDBRequest* IDBCursor::update(ScriptState* scriptState, const ScriptValue& value, ExceptionState& exceptionState) { IDB_TRACE("IDBCursor::update"); if (!m_gotValue) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::noValueErrorMessage); return 0; } if (isKeyCursor()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::isKeyCursorErrorMessage); return 0; } if (isDeleted()) { exceptionState.throwDOMException(InvalidStateError, IDBDatabase::sourceDeletedErrorMessage); return 0; } if (m_transaction->isFinished() || m_transaction->isFinishing()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage); return 0; } if (!m_transaction->isActive()) { exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage); return 0; } if (m_transaction->isReadOnly()) { exceptionState.throwDOMException(ReadOnlyError, "The record may not be updated inside a read-only transaction."); return 0; } IDBObjectStore* objectStore = effectiveObjectStore(); return objectStore->put(scriptState, WebIDBPutModeCursorUpdate, IDBAny::create(this), value, m_primaryKey, exceptionState); }
void MetaDboBase::remove() { checkNotOrphaned(); if(isDeleted()) { // is already removed or being removed in this transaction } else if(isPersisted()) { state_ |= NeedsDelete; session_->needsFlush(this); } else if(session_) { // was added to a Session but not yet flushed Session *session = session_; setSession(0); session->discardChanges(this); state_ &= ~NeedsSave; } else { // is not yet added to the Session } }
void CartSupplier::send2City( BuildingPtr building, const GoodType type, const int qty ) { computeWalkerDestination( building, type, qty ); GoodStore* storage = 0; if( building.is<Factory>() ) { storage = &building.as<Factory>()->getGoodStore(); } else if( building.is<Granary>() ) { storage = &building.as<Granary>()->getGoodStore(); } else if( building.is<Warehouse>() ) { storage = &building.as<Warehouse>()->getGoodStore(); } if( !isDeleted() && storage ) { _d->stock._goodType = type; _d->stock._maxQty = qty; _d->rcvReservationID = storage->reserveStorage( _d->stock ); _d->city->addWalker( WalkerPtr( this ) ); } }
uint32_t AmmunitionRecord::getWriteSize() const { if (isDeleted()) return 0; uint32_t writeSize; writeSize = 4 /* EDID */ +2 /* 2 bytes for length */ +editorID.length()+1 /* length of string +1 byte for NUL-termination */ +4 /* OBND */ +2 /* 2 bytes for length */ +12 /* fixed size */ +4 /* YNAM */ +2 /* 2 bytes for length */ +4 /* fixed size */ +4 /* ZNAM */ +2 /* 2 bytes for length */ +4 /* fixed size */ +description.getWriteSize() /* DESC */ +4 /* DATA */ +2 /* 2 bytes for length */ +16 /* fixed size */; if (!modelPath.empty()) { writeSize = writeSize + 4 /* MODL */ +2 /* 2 bytes for length */ +modelPath.length()+1 /* length of string +1 byte for NUL-termination */; } if (name.isPresent()) { writeSize += name.getWriteSize(); } if (unknownMODT.isPresent()) { writeSize = writeSize + 4 /* MODT */ +2 /* 2 bytes for length */ +unknownMODT.getSize(); } if (!keywordArray.empty()) { writeSize = writeSize +4 /* KSIZ */ +2 /* 2 bytes for length */ +4 /* fixed size */ +keywordArray.size()*(4 /* KSIZ */ +2 /* 2 bytes for length */ +4 /* fixed size */); } return writeSize; }
/** * CCoin::collided() * @date Modified April 23, 2006 */ void CCoin::collided(CActor *poActor) { if(!poActor) return; // only update if there's collision with a player if(poActor->getType() == OBJ_PLAYER && !isDeleted()) CObjectManager::getInstance().removeObject((CObject*)this); }
void ExplicitConstructorCheck::registerMatchers(MatchFinder *Finder) { // Only register the matchers for C++; the functionality currently does not // provide any benefit to other languages, despite being benign. if (!getLangOpts().CPlusPlus) return; Finder->addMatcher( cxxConstructorDecl(unless(anyOf(isImplicit(), // Compiler-generated. isDeleted(), isInstantiated()))) .bind("ctor"), this); Finder->addMatcher( cxxConversionDecl(unless(anyOf(isExplicit(), // Already marked explicit. isImplicit(), // Compiler-generated. isDeleted(), isInstantiated()))) .bind("conversion"), this); }
void MarketLady::send2City( MarketPtr market ) { computeWalkerDestination( market ); if( !isDeleted() ) { _d->city->addWalker( WalkerPtr( this ) ); } }
PassRefPtr<IDBIndex> IDBObjectStore::createIndex(ScriptExecutionContext* context, const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, ExceptionCode& ec) { IDB_TRACE("IDBObjectStore::createIndex"); if (!m_transaction->isVersionChange() || isDeleted()) { ec = IDBDatabaseException::InvalidStateError; return 0; } if (!m_transaction->isActive()) { ec = IDBDatabaseException::TransactionInactiveError; return 0; } if (!keyPath.isValid()) { ec = IDBDatabaseException::SyntaxError; return 0; } if (name.isNull()) { ec = TypeError; return 0; } if (containsIndex(name)) { ec = IDBDatabaseException::ConstraintError; return 0; } if (keyPath.type() == IDBKeyPath::ArrayType && multiEntry) { ec = IDBDatabaseException::InvalidAccessError; return 0; } int64_t indexId = m_metadata.maxIndexId + 1; backendDB()->createIndex(m_transaction->id(), id(), indexId, name, keyPath, unique, multiEntry); ++m_metadata.maxIndexId; IDBIndexMetadata metadata(name, indexId, keyPath, unique, multiEntry); RefPtr<IDBIndex> index = IDBIndex::create(metadata, this, m_transaction.get()); m_indexMap.set(name, index); m_metadata.indexes.set(indexId, metadata); m_transaction->db()->indexCreated(id(), metadata); ASSERT(!ec); if (ec) return 0; RefPtr<IDBRequest> indexRequest = openCursor(context, static_cast<IDBKeyRange*>(0), IDBCursor::directionNext(), IDBDatabaseBackendInterface::PreemptiveTask, ec); ASSERT(!ec); if (ec) return 0; indexRequest->preventPropagation(); // This is kept alive by being the success handler of the request, which is in turn kept alive by the owning transaction. RefPtr<IndexPopulator> indexPopulator = IndexPopulator::create(backendDB(), m_transaction->id(), id(), metadata); indexRequest->setOnsuccess(indexPopulator); return index.release(); }
void TraineeWalker::send2City() { computeWalkerPath(); if( !isDeleted() ) { _destinationBuilding->reserveTrainee(_traineeType); Scenario::instance().getCity().addWalker( WalkerPtr( this ) ); } }
void Unit::update( const int& dt ) { DT = dt; if( isDeleted() ) return; if( Char.state.hp < 0 ) return die(); if( dist( UnitManager::GetPlayer( ) ) > 2000 ){ return setDeleted(); } Actions.updateTimers( dt ); if( physBody ) Image.setPosition( (float)physBody->p.x, (float)physBody->p.y ); if( !Actions.loaded ) return; while( !Actions.nextFrame( ) ){ const Frame& frame = Actions.action->frames[Actions.frame]; if( frame.func != LUA_NOREF ){ extern LuaScript* luaScript; this->pushUData( luaScript->getState() ); int ret_val = luaScript->ExecChunkFromReg( frame.func, 1 ); if( ret_val == -1 ) { Debug::debug( Debug::PROTO, "An error occurred while executing a local function. obj id " + citoa(UnitId) + ", proto_name '" + Actions.proto->name + "', action '" + Actions.action->name + "', frame " + citoa(Actions.frame) + ": " + luaScript->getString( -1 ) + ".\n" ); } for(int i = 0; i > ret_val; ++i ){ switch( luaScript->getType( 1 ) ){ case LUA_TNUMBER: Actions.params.Push( (int)luaScript->getNumber( 1 ) ); break; case LUA_TSTRING: Actions.params.Push( luaScript->getChar( 1 ) ); break; } } } // Make a pause on false result; if( !update( frame ) ) break; } }
bool CameraPathRecord::saveToStream(std::ofstream& output) const { output.write((const char*) &cCPTH, 4); if (!saveSizeAndUnknownValues(output, getWriteSize())) return false; if (isDeleted()) return true; //write EDID output.write((const char*) &cEDID, 4); //EDID's length uint16_t subLength = editorID.length()+1; output.write((const char*) &subLength, 2); //write EDID output.write(editorID.c_str(), subLength); //write CTDA / CIS1 unsigned int i; for (i=0; i<conditions.size(); ++i) { if (!conditions[i].saveToStream(output)) { std::cout << "Error while writing subrecord CTDA of CPTH!\n"; return false; } }//for //write ANAM output.write((const char*) &cANAM, 4); //ANAM's length subLength = 8; //fixed size output.write((const char*) &subLength, 2); //write ANAM output.write((const char*) &cameraPathLinks.parentFormID, 4); output.write((const char*) &cameraPathLinks.nextFormID, 4); //write DATA output.write((const char*) &cDATA, 4); //DATA's length subLength = 1; //fixed size output.write((const char*) &subLength, 2); //write DATA output.write((const char*) &unknownDATA, 1); for (i=0; i<camShotList.size(); ++i) { //write SNAM output.write((const char*) &cSNAM, 4); //SNAM's length subLength = 4; //fixed size output.write((const char*) &subLength, 2); //write SNAM output.write((const char*) &camShotList[i], 4); }//for return output.good(); }
bool AbstractAllTermDocs::skipTo(int32_t target) { _doc = target; while (_doc < maxDoc) { if (!isDeleted(_doc)) return true; ++_doc; } return false; }
void CircleGameObject::draw(const DrawableData &drawableDate) { if (isDeleted()) { return; } Vec2 center = getShape()->getCenter(); drawableDate.textureShader->setMVP( (ndk_helper::Mat4(drawableDate.projMat) * ndk_helper::Mat4::Translation(center.x(), center.y(), 0.0f)).Ptr() ); drawableDate.textureShader->setColor(color); drawableDate.textureShader->render(); }