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


C++ MojString::data方法代码示例

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


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

示例1: BuildScheduledSync

void ActivityBuilderFactory::BuildScheduledSync(ActivityBuilder &builder, int intervalMins)
{
	// activity to setup watch
	MojString name;
	GetScheduledSyncActivityName(name);

	// description of watch
	MojString desc;
	GetScheduledSyncActivityDesc(desc);

	// sync interval in seconds
	int intervalSecs = MinsToSecs(intervalMins);

	builder.SetName(name.data());
	builder.SetDescription(desc.data());
	builder.SetPersist(true);
	builder.SetExplicit(true);
	builder.SetRequiresInternet(false);
	builder.SetSyncInterval(0, intervalSecs);
	builder.SetImmediate(true, "low");

	// setup parameters (to be sent when trigger is called)
	MojObject params;
	MojErr err = params.put(PopAccountAdapter::ACCOUNT_ID, m_accountId);
	ErrorToException(err);
	builder.SetCallback(SCHEDULED_SYNC_CALLBACK, params);

	// put accountId in metadata
	MojObject metadata;
	err = metadata.put("accountId", m_accountId);
	ErrorToException(err);
	builder.SetMetadata(metadata);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:33,代码来源:ActivityBuilderFactory.cpp

示例2: BuildDeleteEmailsWatch

void ActivityBuilderFactory::BuildDeleteEmailsWatch(ActivityBuilder& builder)
{
	MojString name;
	GetDeleteEmailsActivityName(name);

	MojString desc;
	GetDeleteEmailsActivityDesc(desc);

	builder.SetName(name.data());
	builder.SetDescription(desc.data());
	builder.SetPersist(true);
	builder.SetExplicit(true);
	builder.SetImmediate(true, "low");

	// setup trigger
	MojDbQuery trigger;
	MojErr err = trigger.from(PopEmailAdapter::POP_EMAIL_KIND);
	ErrorToException(err);
	err = trigger.where("_del", MojDbQuery::OpEq, true);
	ErrorToException(err);
	builder.SetDatabaseWatchTrigger(trigger);

	// setup parameters (to be sent when trigger is called)
	MojObject params;
	err = params.put(PopFolderAdapter::ACCOUNT_ID, m_accountId);
	ErrorToException(err);
	builder.SetCallback(DELETE_EMAILS_CALLBACK, params);

	// put accountId in metadata
	MojObject metadata;
	err = metadata.put(PopFolderAdapter::ACCOUNT_ID, m_accountId);
	ErrorToException(err);
	builder.SetMetadata(metadata);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:34,代码来源:ActivityBuilderFactory.cpp

示例3: BuildAccountPrefsWatch

void ActivityBuilderFactory::BuildAccountPrefsWatch(ActivityBuilder& builder, MojObject& accountRev)
{
	MojString name;
	GetAccountPrefsWatchActivityName(name);

	MojString desc;
	GetAccountPrefsWatchActivityDesc(desc);

	builder.SetName(name.data());
	builder.SetDescription(desc.data());
	builder.SetPersist(true);
	builder.SetExplicit(true);
	builder.SetImmediate(true, "low");

	MojDbQuery trigger;
	MojErr err = trigger.from(PopAccountAdapter::POP_ACCOUNT_KIND);
	ErrorToException(err);
	err = trigger.where(PopAccountAdapter::ACCOUNT_ID, MojDbQuery::OpEq, m_accountId);
	ErrorToException(err);
	err = trigger.where("_revPop", MojDbQuery::OpGreaterThan, accountRev);
	ErrorToException(err);
	builder.SetDatabaseWatchTrigger(trigger);

	MojObject params;
	err = params.put(PopAccountAdapter::ACCOUNT_ID, m_accountId);
	ErrorToException(err);
	builder.SetCallback(ACCOUNT_PREFS_WATCH_CALLBACK, params);

	MojObject metadata;
	err = metadata.put(PopAccountAdapter::ACCOUNT_ID, m_accountId);
	ErrorToException(err);
	builder.SetMetadata(metadata);
}
开发者ID:hatsada1,项目名称:app-services,代码行数:33,代码来源:ActivityBuilderFactory.cpp

示例4: ScheduleShutdown

void BusClient::ScheduleShutdown()
{
	MojLogTrace(m_log);
	// Reply to the "run" message now that we're done
	if (m_launchedAsService && m_msg.get()) {
		const Configurator::ConfigCollection& ok = Configurator::ConfigureOk();
		const Configurator::ConfigCollection& failed = Configurator::ConfigureFailure();

		if (m_wrongAplication) {
			MojString response;
			response.appendFormat("Aplication or service doesn't exist");
			m_wrongAplication = false;
			m_msg->replyError(MojErrInternal, response.data());

		} else if (!failed.empty()) {
			MojString response;
			response.appendFormat("Partial configuration - %zu ok, %zu failed", ok.size(), failed.size());
			m_msg->replyError(MojErrInternal, response.data());
		} else {
			MojObject response;
			response.putInt("configured", ok.size());
			m_msg->replySuccess(response);
		}
		m_msg.reset();
	}

	if (!m_pending.empty()) {
		MojLogDebug(m_log, "%d pending service calls to handle remaining", m_pending.size());

		// still more pending work
		m_configuratorsCompleted = 0;
		m_configurators.clear();
		Configurator::ResetConfigStats();

		const PendingWork &pending = m_pending.back();
		(pending.instance->*(pending.callback))(pending.msg.get(), pending.payload);

		m_pending.pop_back();
		return;
	}

	MojLogDebug(m_log, "No more pending service calls to handle - scheduling shutdown");

	// Schedule an event to shutdown once the stack is unwound.
	if (m_timerTimeout == 0) {
		// this is to work around around a race condition where the LSCall is delivered
		// after we shutdown causing us to start back up - give some time for the LSCall
		// to get delivered.  NOV-114626.  This needs a proper fix within ls2 (can't be
		// worked around anywhere else).
		m_timerTimeout = g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, /* timer priority */
		    500, /* timeout in ms */
		    &BusClient::ShutdownCallback, // callback
		    this, /* callback data */
		    NULL /*destroy notify callback*/
		);
	}
	//g_idle_add(&BusClient::ShutdownCallback, this);

	m_shuttingDown = true;
}
开发者ID:feniksa,项目名称:configurator,代码行数:60,代码来源:BusClient.cpp

示例5: findBuddyResult

/*
 * Result of query for buddy with given username and serviceName
 *
 * If the buddy is found, we can send no matter what. If buddy is not found, we need to check if this service allows sending IM messages
 * to non buddies (gtalk does not allow this, aol does)
 */
MojErr SendOneMessageHandler::findBuddyResult(MojObject& result, MojErr findErr)
{

	if (findErr) {

		MojString error;
		MojErrToString(findErr, error);
		MojLogError(IMServiceApp::s_log, _T("findBuddyResult: error %d - %s"), findErr, error.data());
		// not much we can do here...
		failMessage(ERROR_SEND_GENERIC_ERROR);

	} else {

		// log the results
		MojString mojStringJson;
		result.toJson(mojStringJson);
		MojLogDebug(IMServiceApp::s_log, _T("findBuddyResult result: %s"), mojStringJson.data());

		// "results" in result
		MojObject results;
		result.get(_T("results"), results);

		// check to see if array is empty - there should really always be 0 or 1 item here
		if (!results.empty()){

			// buddy is on the list - send to the transport
			MojLogInfo(IMServiceApp::s_log, _T("findBuddyResult - user is on buddy list. No need to check account template."));
			sendToTransport();
		}
		else {
			MojLogInfo(IMServiceApp::s_log, _T("findBuddyResult - no buddy found. Need to check account template if this is allowed"));

			// check palm://com.palm.service.accounts/listAccountTemplates {"capability":"MESSAGING"} to get a list of account templates that support messaging.
			// If the account template includes "chatWithNonBuddies":false, it should fail to send.
			MojLogInfo(IMServiceApp::s_log, "Issuing listAccountTemplates request to com.palm.service.accounts");

			// parameters: {“capability”:”MESSAGING”}
			MojObject params;
			params.putString("capability", "MESSAGING");

			// Get a request object from the service
			MojRefCountedPtr<MojServiceRequest> req;
			MojErr err = m_service->createRequest(req);

			if (!err) {
				err = req->send(m_listAccountSlot, "com.palm.service.accounts", "listAccountTemplates", params);
			}

			if (err) {
				MojString error;
				MojErrToString(err, error);
				MojLogError(IMServiceApp::s_log, _T("findBuddyResult failed to send request to accounts: error %d - %s"), err, error.data());
				// not much we can do here...don't leave message still pending
				failMessage(ERROR_SEND_GENERIC_ERROR);
			}
		}
	}

	return MojErrNone;
}
开发者ID:ChrisPHL,项目名称:webos-messaging,代码行数:66,代码来源:SendOneMessageHandler.cpp

示例6: Match

bool MojoCompareMatcher::Match(const MojObject& response)
{
	LOG_AM_TRACE("Entering function %s", __FUNCTION__);

	if (response.contains(m_key)) {
		MojObject value;
		MojString valueString;
		response.get(m_key, value);
		value.stringValue(valueString);
		if (value != m_value) {
			MojString oldValueString;
			m_value.stringValue(oldValueString);

			LOG_AM_DEBUG("Compare Matcher: Comparison key \"%s\" value changed from \"%s\" to \"%s\".  Firing.", 
				m_key.data(),
				oldValueString.data(), valueString.data());

			return true;
		} else {
			LOG_AM_DEBUG("Compare Matcher: Comparison key \"%s\" value \"%s\" unchanged.",
				m_key.data(), valueString.data());
		}
	} else {
		LOG_AM_DEBUG("Compare Matcher: Comparison key (%s) not present.",
			m_key.data());
	}

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

示例7: ParseEmlMessage

MojErr PopBusDispatcher::ParseEmlMessage(MojServiceMessage* msg, MojObject& payload)
{
	MojLogInfo(s_log, "PopBusDispatcher::ParseEmlMessage");

	// cancel shut down if it is in shut down state
	CancelShutdown();

	try {

		MojString filePath;
		MojErr err = payload.getRequired("filePath", filePath);
		ErrorToException(err);

		MojLogDebug(s_log, "filePath:%s", filePath.data());
		if (filePath.empty()) {
			msg->replyError(MojErrInvalidArg, "Invalid query string");
		} else {
			new ParseEmlHandler(this, m_bClient, m_tasks, msg, filePath.data());
		}

		return MojErrNone;
	} catch (const std::exception& e) {
		MojErrThrowMsg(MojErrInternal, "%s", e.what());
	}

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

示例8: GetAccountFromTransportObject

void PopBusDispatcher::GetAccountFromTransportObject(boost::shared_ptr<PopAccount>& account, MojObject& payload, MojObject& transportObj)
{
	MojString username;
	MojErr err = transportObj.getRequired("username", username);
	ErrorToException(err);
	account->SetUsername(username.data());

	MojString password;
	err = payload.getRequired("password", password);
	ErrorToException(err);
	account->SetPassword(password.data());

	MojString server;
	err = transportObj.getRequired("server", server);
	ErrorToException(err);
	account->SetHostName(server.data());

	int port;
	err = transportObj.getRequired("port", port);
	ErrorToException(err);
	account->SetPort(port);

	MojString encryption;
	err = transportObj.getRequired("encryption", encryption);
	ErrorToException(err);
	account->SetEncryption(encryption.data());
}
开发者ID:Garfonso,项目名称:app-services,代码行数:27,代码来源:PopBusDispatcher.cpp

示例9: ParseLoginConfig

void ImapAccountAdapter::ParseLoginConfig(const MojObject& config, ImapLoginSettings& login)
{
	MojErr err;

	// Optional username; overrides account username if available
	bool hasServerUsername = false;
	MojString serverUsername;
	err = config.get(ImapAccountAdapter::USERNAME, serverUsername, hasServerUsername);
	ErrorToException(err);
	if(hasServerUsername) {
		login.SetUsername(serverUsername.data());
	}

	MojString hostname;
	err = config.getRequired(ImapAccountAdapter::HOSTNAME, hostname);
	ErrorToException(err);
	login.SetHostname(hostname.data());

	int port;
	err = config.getRequired(ImapAccountAdapter::PORT, port);
	ErrorToException(err);
	login.SetPort(port);

	MojString encryptionStr;
	err = config.getRequired(ImapAccountAdapter::ENCRYPTION, encryptionStr);
	ErrorToException(err);
	login.SetEncryption(GetEncryptionType(encryptionStr));
}
开发者ID:Garfonso,项目名称:app-services,代码行数:28,代码来源:ImapAccountAdapter.cpp

示例10: Match

bool MojoCompareMatcher::Match(const MojObject& response)
{
	MojLogTrace(s_log);

	if (response.contains(m_key)) {
		MojObject value;
		MojString valueString;
		response.get(m_key, value);
		value.stringValue(valueString);
		if (value != m_value) {
			MojString oldValueString;
			m_value.stringValue(oldValueString);

			MojLogInfo(s_log, _T("Compare Matcher: Comparison key \"%s\" "
				"value changed from \"%s\" to \"%s\".  Firing."), m_key.data(),
				oldValueString.data(), valueString.data());

			return true;
		} else {
			MojLogInfo(s_log, _T("Compare Matcher: Comparison key \"%s\" "
				"value \"%s\" unchanged."), m_key.data(), valueString.data());
		}
	} else {
		MojLogInfo(s_log, _T("Compare Matcher: Comparison key (%s) not "
			"present."), m_key.data());
	}

	return false;
}
开发者ID:edwin12345pro,项目名称:activitymanager,代码行数:29,代码来源:MojoMatcher.cpp

示例11: update

MojErr MojDbKind::update(MojObject* newObj, const MojObject* oldObj, MojDbOp op, MojDbReq& req, bool checkSchema)
{
	MojLogTrace(s_log);

	MojErr err = checkPermission(op, req);
	MojErrCheck(err);
	err = req.curKind(this);
	MojErrCheck(err);

#if defined(TESTDBKIND)
	MojString s;
	MojErr e2;
	
	if (oldObj) {
		e2 = oldObj->toJson(s);
		MojLogInfo(s_log, _T("Kind_Update_OldObj: %s ;\n"), s.data());
	}
	if (newObj) {
		e2 = newObj->toJson(s);
		MojLogInfo(s_log, _T("Kind_Update_NewObj: %s ;\n"), s.data());
	}
#endif
	if (newObj) {
		// add the _backup property if not set
		if (m_backup && !newObj->contains(MojDb::SyncKey)) {
			err = newObj->putBool(MojDb::SyncKey, true);
			MojErrCheck(err);
		}

		// TEMPORARY!!! This should be done in pre-update to also check parent kinds
        	// warning message comes from preUpdate
		if(checkSchema)
		{
		   
		   MojSchema::Result res;
		   err = m_schema.validate(*newObj, res);
		   MojErrCheck(err);
		   if (!res.valid())
		   {
		      MojErrThrowMsg(MojErrSchemaValidation, _T("schema validation failed for kind '%s': %s"),
		                     m_id.data(), res.msg().data());
		   }
		}
        
	}

	// update revSets and validate schema
	err = preUpdate(newObj, oldObj, req);
	MojErrCheck(err);
	// update indexes
	MojVector<MojDbKind*> kindVec;
	MojInt32 idxcount = 0;
	err = updateIndexes(newObj, oldObj, req, op, kindVec, idxcount);
	MojLogInfo(s_log, _T("Kind_UpdateIndexes_End: %s; supers = %zu; indexcount = %zu; updated = %d \n"), this->id().data(), 
				m_supers.size(), m_indexes.size(), idxcount);

	MojErrCheck(err);

	return MojErrNone;
}
开发者ID:webOS101,项目名称:db8,代码行数:60,代码来源:MojDbKind.cpp

示例12: informQuotaSubscribers

MojErr MojDbQuotaEngine::informQuotaSubscribers(const MojString& kindId)
{
    LOG_TRACE("Entering function %s", __FUNCTION__);

    MojErr err;
    MojInt64 sizeOut;
    MojInt64 usageOut;
    MojDbKind* kind = NULL;
    MojString owner;

    err = owner.assign("");
    MojErrCheck(err);

    if(m_db->kindEngine()->isExist(kindId.data(), kind))
        owner = kind->owner();

    if((kind == NULL) || owner.empty())
        return MojErrNone;

    //ignore if quota not exist
    QuotaMap::ConstIterator iter = m_quotas.find(owner.data());
    if (iter == m_quotas.end())
        return MojErrNone;

    err = quotaUsage(owner.data(), sizeOut, usageOut);
    MojErrCheck(err);
    err = m_db->getQuotaAlert().notifySubscriber(owner.data(), usageOut, sizeOut);
    MojErrCheck(err);

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

示例13: SmtpCommand

// TODO: Need to use ActivitySet for activity handling.
SmtpAccountDisableCommand::SmtpAccountDisableCommand(SmtpClient& client, const MojRefCountedPtr<MojServiceMessage> msg, const MojObject& accountId)
: SmtpCommand(client),
  m_client(client),
  m_accountId(accountId),
  m_deleteOutboxWatchResponseSlot(this, &SmtpAccountDisableCommand::DeleteOutboxWatchResponse),
  m_deleteAccountWatchResponseSlot(this, &SmtpAccountDisableCommand::DeleteAccountWatchResponse),
  m_msg(msg)
{
	MojString d;
	m_accountId.stringValue(d);
	m_outboxWatchActivityName.format(OUTBOX_WATCH_ACTIVITY_FMT, d.data());
	m_accountWatchActivityName.format(ACCOUNT_WATCH_ACTIVITY_FMT, d.data());
}
开发者ID:hatsada1,项目名称:app-services,代码行数:14,代码来源:SmtpAccountDisableCommand.cpp

示例14: DeleteAccountWatchResponse

MojErr SmtpAccountDisableCommand::DeleteAccountWatchResponse(MojObject& response, MojErr err)
{
	MojLogInfo(m_log, "SmtpAccountDisable replying");

	try {
		if(err) {
			if(err == ENOENT) {
				MojLogWarning(m_log, "account watch activity doesn't exist");
			} else {
				ResponseToException(response, err);
			}
		}

		m_msg->replySuccess();
		Complete();
	} catch (const std::exception& e) {
		m_msg->replyError(err, e.what());
		Failure(e);
	} catch (...) {
		MojString error;
		error.format("uncaught exception in %s", __PRETTY_FUNCTION__);
		m_msg->replyError(MojErrInternal, error.data());
		Failure(MailException("unknown exception in cancelling activities response", __FILE__, __LINE__));
	}
	return MojErrNone;
}
开发者ID:hatsada1,项目名称:app-services,代码行数:26,代码来源:SmtpAccountDisableCommand.cpp

示例15: GetPasswordResponse

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

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

		MojObject credentials;
		// Credentials object can be missing if the POP account is restored from
		// backup.  Checking for its existence before using it will prevent exception
		// to be thrown.
		bool exists = response.get("credentials", credentials);
		if (exists) {
			MojString password;
			err = credentials.getRequired("password", password);
			ErrorToException(err);

			m_account->SetPassword(password.data());
		} else {
			MojLogInfo(m_log, "The credentials of POP account '%s' are missing", AsJsonString(m_accountId).c_str());
		}

		// get the transport object
		GetPopAccount();
	} catch (const std::exception& ex) {
		Failure(ex);
	} catch (...) {
		Failure(MailException("unknown exception", __FILE__, __LINE__));
	}

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


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