本文整理汇总了C++中MojRefCountedPtr类的典型用法代码示例。如果您正苦于以下问题:C++ MojRefCountedPtr类的具体用法?C++ MojRefCountedPtr怎么用?C++ MojRefCountedPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MojRefCountedPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Start
void Start(MockBusClient& busClient, MojRefCountedPtr<ActivitySet>& actSet)
{
MockDoneSlot startSlot;
actSet->StartActivities(startSlot.GetSlot());
busClient.ProcessRequests();
ASSERT_TRUE( startSlot.Called() );
}
示例2: MojAssert
MojErr MojDbQuotaEngine::initUsage(MojDbKind* kind, MojDbReq& req)
{
MojAssert(kind);
MojRefCountedPtr<MojDbStorageItem> item;
MojErr err = m_usageDb->get(kind->id(), req.txn(), false, item);
MojErrCheck(err);
if (!item.get()) {
MojObject stats;
MojSize usage = 0;
err = kind->stats(stats, usage, req, false);
MojErrCheck(err);
err = insertUsage(kind->id(), (MojInt64) usage, req.txn());
MojErrCheck(err);
}
return MojErrNone;
}
示例3: sendEcho
MojErr sendEcho(const MojChar* json, const MojObject& expectedResponse, const MojChar* method)
{
MojRefCountedPtr<EchoResponseHdlr> handler(new EchoResponseHdlr(expectedResponse, ++m_pendingResponseCount));
MojAllocCheck(handler.get());
MojRefCountedPtr<MojServiceRequest> req;
MojErr err = m_service.createRequest(req);
MojTestErrCheck(err);
MojObject payload;
err = payload.fromJson(json);
MojTestErrCheck(err);
err = req->send(handler->m_slot, ServiceName, method, payload);
MojTestErrCheck(err);
return MojErrNone;
}
示例4: End
void End(MockBusClient& busClient, MojRefCountedPtr<ActivitySet>& actSet)
{
MockDoneSlot endSlot;
actSet->EndActivities(endSlot.GetSlot());
busClient.ProcessRequests();
ASSERT_TRUE( endSlot.Called() );
}
示例5: MojAssert
MojErr MojDbKindState::writeTokens(const MojObject& tokensObj)
{
MojAssert(m_kindEngine);
MojAssertMutexLocked(m_lock);
MojDbStorageDatabase* db = m_kindEngine->kindDb();
MojRefCountedPtr<MojDbStorageTxn> txn;
MojErr err = db->beginTxn(txn);
MojErrCheck(err);
MojAssert(txn.get());
err = writeObj(TokensKey, tokensObj, db, txn.get(), m_oldTokensItem);
MojErrCheck(err);
err = txn->commit();
MojErrCheck(err);
return MojErrNone;
}
示例6: readObj
MojErr MojDbKindState::readObj(const MojChar* key, MojObject& val, MojDbStorageDatabase* db,
MojDbStorageTxn* txn, MojRefCountedPtr<MojDbStorageItem>& oldItem)
{
MojAssert(key && db);
MojErr err = db->get(m_kindId, txn, false, oldItem);
MojErrCheck(err);
if (oldItem.get()) {
// get objects
MojObject obj;
// TODO: this bugging ( on calling getObj)
err = oldItem->toObject(obj, *m_kindEngine, false);
MojErrCheck(err);
obj.get(key, val);
}
return MojErrNone;
}
示例7: getImpl
MojErr MojDb::getImpl(const MojObject& id, MojObjectVisitor& visitor, MojDbOp op, MojDbReq& req)
{
MojRefCountedPtr<MojDbStorageItem> item;
MojErr err = m_objDb->get(id, req.txn(), false, item);
MojErrCheck(err);
if (item.get()) {
MojString kindId;
err = item->kindId(kindId, m_kindEngine);
MojErrCheck(err);
err = m_kindEngine.checkPermission(kindId, op, req);
MojErrCheck(err);
err = item->visit(visitor, m_kindEngine);
MojErrCheck(err);
err = item->close();
MojErrCheck(err);
}
return MojErrNone;
}
示例8: checkErrMap
MojErr MojDbTestStorageEngine::openSequence(const MojChar* name, MojDbStorageTxn* txn, MojRefCountedPtr<MojDbStorageSeq>& seqOut)
{
MojErr err = checkErrMap(_T("engine.openSequence"));
MojErrCheck(err);
MojAssert(name && !seqOut.get());
//open the actual storage sequence
MojAssert(m_engine.get());
MojRefCountedPtr<MojDbStorageSeq> realSeq;
err = m_engine->openSequence(name, MojTestTxn(txn), realSeq);
MojErrCheck(err);
//create the test storage seq as a wrapper
MojRefCountedPtr<MojDbTestStorageSeq> seq(new MojDbTestStorageSeq(realSeq.get(), this));
MojAllocCheck(seq.get());
seqOut = seq;
return MojErrNone;
}
示例9: MojAssert
MojErr MojDbSandwichEngine::beginTxn(MojRefCountedPtr<MojDbStorageTxn>& txnOut)
{
MojAssert(!txnOut.get());
MojRefCountedPtr<MojDbSandwichEnvTxn> txn(new MojDbSandwichEnvTxn(m_db));
MojAllocCheck(txn.get());
txnOut = txn;
return MojErrNone;
}
示例10: MojErrCheck
MojErr MojDbTestStorageIndex::find(MojAutoPtr<MojDbQueryPlan> plan, MojDbStorageTxn* txn, MojRefCountedPtr<MojDbStorageQuery>& queryOut)
{
MojErr err = m_testEngine->checkErrMap(_T("index.find"));
MojErrCheck(err);
MojAssert(m_idx.get());
MojAssert(plan.get());
//create the real query
MojRefCountedPtr<MojDbStorageQuery> realQuery;
err = m_idx->find(plan, MojTestTxn(txn), realQuery);
MojErrCheck(err);
MojRefCountedPtr<MojDbTestStorageQuery> storageQuery(new MojDbTestStorageQuery(realQuery.get(), m_testEngine));
MojAllocCheck(storageQuery.get());
queryOut = storageQuery;
return MojErrNone;
}
示例11: Connected
void ImapSession::Connected(const MojRefCountedPtr<SocketConnection>& connection)
{
m_connection = connection;
if(connection.get()) {
m_inputStream = connection->GetInputStream();
m_outputStream = connection->GetOutputStream();
m_closedSlot.cancel(); // make sure it's not connected to a slot
m_connection->WatchClosed(m_closedSlot);
if(NeedLoginCapabilities()) {
CheckLoginCapabilities();
} else {
LoginCapabilityComplete();
}
} else {
CheckQueue();
}
}
示例12: LOG_TRACE
MojErr MojDbSandwichEngine::beginTxn(MojRefCountedPtr<MojDbStorageTxn>& txnOut)
{
LOG_TRACE("Entering function %s", __FUNCTION__);
MojAssert(!txnOut.get());
MojRefCountedPtr<MojDbSandwichEnvTxn> txn(new MojDbSandwichEnvTxn(m_db));
MojAllocCheck(txn.get());
txnOut = txn;
return MojErrNone;
}
示例13: MojLogTrace
MojErr MojDb::delImpl(const MojObject& id, bool& foundOut, MojObject& foundObjOut, MojDbReq& req, MojUInt32 flags)
{
MojLogTrace(s_log);
foundObjOut.clear();
// get object, so we can find the type
MojRefCountedPtr<MojDbStorageItem> item;
MojErr err = m_objDb->get(id, req.txn(), true, item);
MojErrCheck(err);
if (item.get()) {
// and delete it
MojObject obj;
err = item->toObject(obj, m_kindEngine);
MojErrCheck(err);
err = delObj(id, obj, item.get(), foundObjOut, req, flags);
MojErrCheck(err);
foundOut = true;
}
return MojErrNone;
}
示例14: command
void ImapSession::DownloadPart(const MojObject& folderId, const MojObject& emailId, const MojObject& partId, const MojRefCountedPtr<DownloadListener>& listener, Command::Priority priority)
{
MojRefCountedPtr<FetchPartCommand> command(new FetchPartCommand(*this, folderId, emailId, partId, priority));
// Look for an active command
MojRefCountedPtr<ImapCommand> activeCommand = FindActiveCommand(command);
if(activeCommand.get()) {
MojLogDebug(m_log, "attaching download request to existing active command");
if(listener.get())
static_cast<FetchPartCommand*>(activeCommand.get())->AddDownloadListener(listener);
return;
}
// Look for a pending command with equal or higher priority
// TODO: requeue if a higher priority is needed
MojRefCountedPtr<ImapCommand> pendingCommand = FindPendingCommand(command);
if(pendingCommand.get() && pendingCommand->GetPriority() >= priority) {
MojLogDebug(m_log, "attaching download request to existing pending command");
if(listener.get())
static_cast<FetchPartCommand*>(pendingCommand.get())->AddDownloadListener(listener);
// Poke the queue in case it's not already running
CheckQueue();
return;
}
// Otherwise, use the new command
if(listener.get())
command->AddDownloadListener(listener);
// If this is a high priority request, set m_recentUserInteraction to true
if (priority >= Command::HighPriority) {
m_recentUserInteraction = true;
}
m_commandManager->QueueCommand(command, false);
CheckQueue();
}
示例15: LOG_TRACE
MojErr MojDbLunaServiceDb::openDb(MojDbEnv* env, const MojChar* dir, const MojObject& conf)
{
LOG_TRACE("Entering function %s", __FUNCTION__);
MojAssert(env && dir);
MojErr err;
// MojRefCountedPtr<MojDbBerkeleyEngine> engine(new MojDbBerkeleyEngine);
MojRefCountedPtr<MojDbStorageEngine> engine;
MojDbStorageEngine::engineFactory()->create(engine);
MojAllocCheck(engine.get());
err = engine->configure(conf);
MojErrCheck(err);
err = engine->open(dir, env);
MojErrCheck(err);
// open db
err = m_db.open(dir, engine.get());
MojErrCheck(err);
return MojErrNone;
}