当前位置: 首页>>代码示例>>C++>>正文


C++ MojObject类代码示例

本文整理汇总了C++中MojObject的典型用法代码示例。如果您正苦于以下问题:C++ MojObject类的具体用法?C++ MojObject怎么用?C++ MojObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MojObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SmtpCommand

// TODO: Need to use ActivitySet for activity hanlding
SmtpSyncOutboxCommand::SmtpSyncOutboxCommand(SmtpClient& client, const MojObject& accountId, const MojObject& folderId, bool force, bool clear)
: SmtpCommand(client),
  m_client(client),
  m_accountId(accountId),
  m_folderId(folderId),
  m_highestRev(0),
  m_canAdopt(true),
  m_setSyncStatusSlot(this, &SmtpSyncOutboxCommand::SetSyncStatusResponse),
  m_clearSyncStatusSlot(this, &SmtpSyncOutboxCommand::ClearSyncStatusResponse),
  m_setSyncStatusSlot2(this, &SmtpSyncOutboxCommand::SetSyncStatusResponse2),
  m_clearSyncStatusSlot2(this, &SmtpSyncOutboxCommand::ClearSyncStatusResponse2),
  m_getOutboxEmailsSlot(this, &SmtpSyncOutboxCommand::GetOutboxEmailsResponse),
  m_sendDoneSlot(this, &SmtpSyncOutboxCommand::SendDone),
  m_activityUpdatedSlot(this, &SmtpSyncOutboxCommand::ActivityUpdated),
  m_activityErrorSlot(this, &SmtpSyncOutboxCommand::ActivityError),
  m_accountActivityUpdatedSlot(this, &SmtpSyncOutboxCommand::AccountActivityUpdated),
  m_accountActivityErrorSlot(this, &SmtpSyncOutboxCommand::AccountActivityError),
  m_getAccountSlot(this, &SmtpSyncOutboxCommand::GotAccount),
  m_temporaryError(false),
  m_createWatchActivitySlot(this, &SmtpSyncOutboxCommand::CreateWatchActivityResponse),
  m_createAccountWatchActivityResponseSlot(this, &SmtpSyncOutboxCommand::CreateAccountWatchResponse),
  m_findFolderSlot(this, &SmtpSyncOutboxCommand::FindOutgoingFolderResponse),
  m_updateRetrySlot(this, &SmtpSyncOutboxCommand::UpdateRetryResponse),
  m_updateErrorSlot(this, &SmtpSyncOutboxCommand::UpdateErrorResponse),
  m_resetErrorSlot(this, &SmtpSyncOutboxCommand::ResetErrorResponse),
  m_cancelled(false),
  m_force(force),
  m_clear(clear),
  m_networkStatus(new NetworkStatus()),
  m_networkActivityUpdatedSlot(this, &SmtpSyncOutboxCommand::NetworkActivityUpdated),
  m_networkActivityErrorSlot(this, &SmtpSyncOutboxCommand::NetworkActivityError)
{
	MojString d;
	m_accountId.stringValue(d);
	m_outboxWatchActivityName.format(SmtpActivityFactory::OUTBOX_WATCH_ACTIVITY_FMT, d.data());
	m_accountWatchActivityName.format(SmtpActivityFactory::ACCOUNT_WATCH_ACTIVITY_FMT, d.data());

#ifdef WEBOS_TARGET_MACHINE_STANDALONE
	MojObject cmStatus;
	MojErr err;
	err = cmStatus.put("isInternetConnectionAvailable", true);
    ErrorToException(err);
    m_networkStatus->ParseStatus(cmStatus);
#endif

}
开发者ID:Garfonso,项目名称:app-services,代码行数:47,代码来源:SmtpSyncOutboxCommand.cpp

示例2: MojLogTrace

MojErr AuthYahooCommand::GetYahooCookiesSlot(MojObject& response, MojErr err)
{
	MojLogTrace(m_log);
	try {
		ResponseToException(response, err);

		MojObject object;
		err = response.getRequired("tCookie", m_tCookie);
		ErrorToException(err);
	
		err = response.getRequired("yCookie", m_yCookie);
		ErrorToException(err);
	
	} catch (const std::exception& e) {
		MojLogInfo(m_log, "Failed to retrieve Yahoo cookies, failing login: %s", e.what());
		
		// FIXME: We should possibly try to decode and pass along a specific error
		
		SmtpSession::SmtpError error;
		error.errorCode = MailError::ACCOUNT_UNAVAILABLE;
		error.errorOnAccount = true;
		error.internalError = std::string("Unable to retrieve yahoo cookies: ") + e.what();
		m_session.AuthYahooFailure(error);
		Complete();
		
		return MojErrNone;
	} catch (...) {
		MojLogInfo(m_log, "Failed to retrieve Yahoo cookies, failing login: unknown exception");

		// FIXME: We should possibly try to decode and pass along a specific error

		SmtpSession::SmtpError error;
		error.errorCode = MailError::ACCOUNT_UNAVAILABLE;
		error.errorOnAccount = true;
		error.internalError = "Unable to retrieve yahoo cookies: unknown exception";
		m_session.AuthYahooFailure(error);
		Complete();

		return MojErrNone;
	}

	m_state = State_SendingYCookie;
	WriteCommand();
	
	return MojErrNone;
}
开发者ID:Garfonso,项目名称:app-services,代码行数:46,代码来源:AuthYahooCommand.cpp

示例3: MojLogTrace

MojErr  OnEnabledHandler::getAccountInfoResult(MojObject& payload, MojErr resultErr)
{
	MojLogTrace(IMServiceApp::s_log);
	IMServiceHandler::logMojObjectJsonString(_T("OnEnabledHandler::getAccountInfoResult payload: %s"), payload);

	if (resultErr != MojErrNone) {
		MojLogError(IMServiceApp::s_log, _T("OnEnabledHandler getAccountInfo result error %d"), resultErr);
		return resultErr;
	}

	MojObject result;
	MojErr err = payload.getRequired("result", result);
	if (err != MojErrNone || result.empty()) {
		MojLogError(IMServiceApp::s_log, _T("OnEnabledHandler::getAccountInfoResult result empty or error %d"), err);
		return err;
	}

	MojString accountId;
	err = result.getRequired("_id", accountId);
	if (err != MojErrNone || accountId.empty()) {
		MojLogError(IMServiceApp::s_log, _T("OnEnabledHandler::getAccountInfoResult accountId empty or error %d"), err);
		return err;
	}

	MojString username;
	err = result.getRequired("username", username);
	if (err != MojErrNone || username.empty()) {
		MojLogError(IMServiceApp::s_log, _T("OnEnabledHandler::getAccountInfoResult username empty or error %d"), err);
		return err;
	}

	MojString serviceName;
	getServiceNameFromCapabilityId(serviceName);
	if (serviceName.empty()) {
		MojLogError(IMServiceApp::s_log, _T("OnEnabledHandler::getAccountInfoResult serviceName empty"));
		return err;
	}

	if (m_enable) {
		err = accountEnabled(accountId, serviceName, username);
	} else {
		err = accountDisabled(accountId, serviceName, username);
	}

	return err;
}
开发者ID:wosigh,项目名称:messaging-plugins,代码行数:46,代码来源:OnEnabledHandler.cpp

示例4:

MojoObjectJson::MojoObjectJson(const MojObject& obj)
{
	MojErr err = obj.toJson(m_str);

	/* Intentially ignore err here.  This is for debug output, let's not
	 * make the problem worse... */
	(void)err;
}
开发者ID:edwin12345pro,项目名称:activitymanager,代码行数:8,代码来源:MojoObjectWrapper.cpp

示例5: MojAssert

MojErr MojDbServiceHandler::handleMerge(MojServiceMessage* msg, MojObject& payload, MojDbReq& req)
{
	MojAssert(msg);
	MojLogTrace(s_log);

	MojErr err = MojErrNone;
	MojUInt32 count = 0;
	MojObject obj;
	

	if (payload.get(MojDbServiceDefs::ObjectsKey, obj)) {
		if (payload.contains(MojDbServiceDefs::QueryKey))
			MojErrThrowMsg(MojErrInvalidArg, _T("db: cannot have both an objects param and a query param"));
		MojObject::ArrayIterator begin;
		bool ignoreM = false;
		payload.get(MojDbServiceDefs::IgnoreMissingKey, ignoreM);
		MojUInt32 mflags = MojDb::FlagNone;
		if (ignoreM)
			mflags = mflags | MojDb::FlagIgnoreMissing;
		err = obj.arrayBegin(begin);
		MojErrCheck(err);
		MojObject::ConstArrayIterator end = obj.arrayEnd();
		err = m_db.merge(begin, end, mflags, req);
		MojErrCheck(err);
		err = formatPut(msg, begin, end); // TO DO: we need to drop non-existing objects
		MojErrCheck(err);
	}
	else if (payload.get(MojDbServiceDefs::QueryKey, obj)) {
		MojObject props;
		err = payload.getRequired(MojDbServiceDefs::PropsKey, props);
		MojErrCheck(err);
		bool ignoreM = false;
		if (payload.get(MojDbServiceDefs::IgnoreMissingKey, ignoreM))
			MojErrThrowMsg(MojErrInvalidArg, _T("db: ignoreMissing - invalid option for merge query"));

		MojDbQuery query;
		err = query.fromObject(obj);
		MojErrCheck(err);
		MojUInt32 queryCount = 0;
		err = m_db.merge(query, props, queryCount, MojDb::FlagNone, req);
		MojErrCheck(err);
		count += queryCount;
		err = formatCount(msg, count);
		MojErrCheck(err);
	}
	else {
		MojErrThrowMsg(MojErrInvalidArg, _T("db: either objects or query param required for merge"));
	}

	return MojErrNone;
}
开发者ID:anttiharju-owo,项目名称:db8,代码行数:51,代码来源:MojDbServiceHandler.cpp

示例6: LOG_TRACE

void TelephonyProxy::Enable()
{
	LOG_TRACE("Entering function %s", __FUNCTION__);
	LOG_DEBUG("Enabling TIL Proxy");

	MojObject params;
	params.putBool(_T("subscribe"), true);

	// Start out with a platformQuery
	m_platformQuery = boost::make_shared<MojoWeakPtrCall<TelephonyProxy> >(
		boost::dynamic_pointer_cast<TelephonyProxy, RequirementManager>
			(shared_from_this()),
		&TelephonyProxy::PlatformQueryUpdate, m_service,
		"palm://com.palm.telephony/platformQuery", params,
		MojoCall::Unlimited);
	m_platformQuery->Call();
}
开发者ID:azimut2000,项目名称:activitymanager,代码行数:17,代码来源:TelephonyProxy.cpp

示例7: ToJson

MojErr MojoCompareMatcher::ToJson(MojObject& rep, unsigned long flags) const
{
	MojErr err;

	MojObject compare;

	err = compare.put(_T("key"), m_key);
	MojErrCheck(err);

	err = compare.put(_T("value"), m_value);
	MojErrCheck(err);

	err = rep.put(_T("compare"), compare);
	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:ctbrowser,项目名称:activitymanager,代码行数:17,代码来源:MojoMatcher.cpp

示例8: LOG_TRACE

void MojoDBProxy::PreparePurgeCall()
{
	LOG_TRACE("Entering function %s", __FUNCTION__);
	LOG_DEBUG("Preparing to purge batch of old Activities");

	MojObject ids(MojObject::TypeArray);
	PopulatePurgeIds(ids);

	MojObject params;
	params.put(_T("ids"), ids);

	m_call = boost::make_shared<MojoWeakPtrCall<MojoDBProxy> >(
		boost::dynamic_pointer_cast<MojoDBProxy, PersistProxy>
			(shared_from_this()),
		&MojoDBProxy::ActivityPurgeComplete,
		m_service, "palm://com.palm.db/del", params);
}
开发者ID:azimut2000,项目名称:activitymanager,代码行数:17,代码来源:MojoDBProxy.cpp

示例9: 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;
	}
开发者ID:KyleMaas,项目名称:db8,代码行数:17,代码来源:MojLunaServiceTest.cpp

示例10: put

MojErr MojDbQuotaEngine::put(MojObject& obj, MojDbReq& req, bool putObj)
{
	MojLogTrace(s_log);
	MojAssertWriteLocked(m_db->schemaLock());

	// check for admin permission
	if (!req.admin()) {
		MojErrThrow(MojErrDbPermissionDenied);
	}

	// pull params out of object
	MojString owner;
	MojErr err = obj.getRequired(MojDbServiceDefs::OwnerKey, owner);
	MojErrCheck(err);
	MojInt64 size = 0;
	err = obj.getRequired(MojDbServiceDefs::SizeKey, size);
	MojErrCheck(err);

	// validate owner
	err = validateWildcard(owner, MojErrDbInvalidOwner);
	MojErrCheck(err);

	// put object
	if (putObj) {
		MojString id;
		err = id.format(_T("_quotas/%s"), owner.data());
		MojErrCheck(err);
		err = obj.put(MojDb::IdKey, id);
		MojErrCheck(err);
		err = obj.putString(MojDb::KindKey, MojDbKindEngine::QuotaId);
		MojErrCheck(err);

		MojDbAdminGuard adminGuard(req);
		err = m_db->put(obj, MojDb::FlagForce, req);
		MojErrCheck(err);

		// defer commit of quota until txn commit
		MojRefCountedPtr<MojDbQuotaCommitHandler> handler(new MojDbQuotaCommitHandler(this, owner, size, req.txn()));
		MojAllocCheck(handler.get());
	} else {
		err = commitQuota(owner, size);
		MojErrCheck(err);
	}
	return MojErrNone;
}
开发者ID:anttiharju-owo,项目名称:db8,代码行数:45,代码来源:MojDbQuotaEngine.cpp

示例11: InsertCacheObject

void FileCacheClient::InsertCacheObject(ReplySignal::SlotRef slot, const char* typeName, const char* fileName, MojInt64 size, MojInt64 cost, MojInt64 lifetime)
{
    MojErr err;
    MojObject payload;

    err = payload.putString("typeName", typeName);
    ErrorToException(err);

    err = payload.putString("fileName", fileName);
    ErrorToException(err);

    // Size must be >0 and larger than the actual content.
    // If the content is empty, we'll use 1 so FileCache doesn't complain.
    err = payload.put("size", size > 0 ? size : 1);
    ErrorToException(err);

    if(cost >= 0) {
        err = payload.put("cost", cost);
        ErrorToException(err);
    }

    if(lifetime >= 0) {
        err = payload.put("lifetime", lifetime);
        ErrorToException(err);
    }

    err = payload.put("subscribe", true);
    ErrorToException(err);

    m_busClient.SendRequest(slot, FILECACHE_SERVICE, "InsertCacheObject", payload, MojServiceRequest::Unlimited);
}
开发者ID:kasimling,项目名称:app-services,代码行数:31,代码来源:FileCacheClient.cpp

示例12: CommandTraceFunction

MojErr PopAccountUpdateCommand::GetPasswordResponse(MojObject& response, MojErr err)
{
	CommandTraceFunction();

	try {
		// check the result first
		ErrorToException(err);

		MojObject credentials;
		err = response.getRequired("credentials", credentials);
		ErrorToException(err);

		MojString password;
		err = credentials.getRequired("password", password);
		ErrorToException(err);

		boost::shared_ptr<PopAccount> newPopAccount(new PopAccount());
		PopAccountAdapter::GetPopAccountFromTransportObject(m_transportObj, *(newPopAccount.get()));
		newPopAccount->SetPassword(password.data());

		boost::shared_ptr<PopAccount> oldPopAccount = m_client.GetAccount();

		if (!oldPopAccount.get()) {
			m_callSyncFolderOnClient = true;
		} else if (newPopAccount->GetPort() != oldPopAccount->GetPort() ||
			newPopAccount->GetEncryption() != oldPopAccount->GetEncryption() ||
			newPopAccount->GetUsername() != oldPopAccount->GetUsername() ||
			newPopAccount->GetSyncFrequencyMins() != oldPopAccount->GetSyncWindowDays() ||
			newPopAccount->GetHostName() != oldPopAccount->GetHostName()) {
			m_callSyncFolderOnClient = true;
		}
		
		// Should be initial sync if the old account does not exist 
		// or the old account is in initial sync state.
		newPopAccount->SetInitialSync(!oldPopAccount.get() || oldPopAccount->IsInitialSync());
		m_client.SetAccount(newPopAccount);
		UpdateAccountWatchActivity();
	} catch (const std::exception& ex) {
		Failure(ex);
	} catch (...) {
		Failure(MailException("unknown exception", __FILE__, __LINE__));
	}

	return MojErrNone;
}
开发者ID:Garfonso,项目名称:app-services,代码行数:45,代码来源:PopAccountUpdateCommand.cpp

示例13: MojAssert

MojErr MojDbKindState::delIndex(const MojChar* indexName, MojDbReq& req)
{
	MojAssert(indexName);
	MojThreadGuard guard(m_lock);

	MojObject obj;
	MojRefCountedPtr<MojDbStorageItem> item;
	MojErr err = readIds(IndexIdsKey, req, obj, item);
	MojErrCheck(err);
	bool found = false;
	err = obj.del(indexName, found);
    MojErrCheck(err);
	MojAssert(found);
	err = writeIds(IndexIdsKey, obj, req, item);
	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:feniksa,项目名称:indb8,代码行数:18,代码来源:MojDbKindState.cpp

示例14: replySuccess

MojErr MojServiceMessage::replySuccess(MojObject& payload)
{
	MojErr err = payload.putBool(ReturnValueKey, true);
	MojErrCheck(err);
	err = reply(payload);
	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:ctbrowser,项目名称:db8,代码行数:9,代码来源:MojServiceMessage.cpp

示例15: ToJson

MojErr ControlGroup::ToJson(MojObject& rep) const
{
    std::string path = GetRoot() + "/" + m_name;

    MojErr err = rep.putString(_T("path"), path.c_str());
    MojErrCheck(err);

    return ResourceContainer::ToJson(rep);
}
开发者ID:edwin12345pro,项目名称:activitymanager,代码行数:9,代码来源:ControlGroup.cpp


注:本文中的MojObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。