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


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

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


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

示例1: unformatFromAddress

/*
 * Unformat the from address - removes blanks and converts to lower case
 *
 *  see IMAddressFormatter.unformat() - palm.com.messaging.data
 */
MojErr IMMessage::unformatFromAddress(const MojString formattedScreenName, MojString& unformattedName) {

	if(!formattedScreenName.empty()) {
		MojVector<MojString> stringTokens;
		MojErr err = formattedScreenName.split(' ', stringTokens);
		MojErrCheck(err);

		MojVector<MojString>::ConstIterator itr = stringTokens.begin();
		while (itr != stringTokens.end()) {
			err = unformattedName.append(*itr);
			MojErrCheck(err);
			itr++;
		}
		err = unformattedName.toLower();
		MojErrCheck(err);
	}
	return MojErrNone;
}
开发者ID:dkirker,项目名称:webos-messaging,代码行数:23,代码来源:IMMessage.cpp

示例2: dumpObj

MojErr MojDb::dumpObj(MojFile& file, MojObject obj, MojSize& bytesWrittenOut, MojUInt32 maxBytes)
{
	// remove the rev key before dumping the object
	bool found = false;
	MojErr err = obj.del(RevKey, found);
	MojErrCheck(err);

	MojString str;
	err = obj.toJson(str);
	MojErrCheck(err);
	err = str.append(_T("\n"));
	MojErrCheck(err);
	MojSize len = str.length() * sizeof(MojChar);
	// if writing this object will put us over the max length, throw an error
	if (maxBytes && bytesWrittenOut + len > maxBytes) {
		MojErrThrow(MojErrDbBackupFull);
	}
	err = file.writeString(str, bytesWrittenOut);
	MojErrCheck(err);

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

示例3: addBuddyResult

/**
 * Callback from the save buddy in buddyStatus DB call.
 *
 * Now save in contacts db
 */
MojErr SendOneCommandHandler::addBuddyResult(MojObject& result, MojErr saveErr)
{
	MojLogTrace(IMServiceApp::s_log);

	if (saveErr) {
		MojString error;
		MojErrToString(saveErr, error);
		MojLogError(IMServiceApp::s_log, _T("addBuddyResult failed. error %d - %s"), saveErr, error.data());
	}
	else {
		IMServiceHandler::logMojObjectJsonString(_T("addBuddyResult success: %s"), result);
	}

	// now add to contacts DB
	// create the DB object
	//{
	//    accountId:<>,
	//    displayName:<>,
	//    photos:[{localFilepath:<>}],
	//    ims:[{value:<>, type:<>}]
	// }
	MojObject contact;
	contact.putString("_kind", IM_CONTACT_KIND);
	contact.put("accountId", m_accountId);
	contact.put("remoteId", m_buddyName); // using username as remote ID since we don't have anything else and this should be unique

	// "ims" array
	MojObject newImsArray, newImObj;
	newImObj.put("value", m_buddyName);
	newImObj.put("type", m_serviceName);
	// Note we need this twice since some services look for "serviceName" and some look for "type"... Maybe we can evenutally standardize...
	newImObj.put("serviceName", m_serviceName);
	newImsArray.push(newImObj);
	contact.put("ims", newImsArray);

	// need to add email address too for contacts linker
	//    email:[{value:<>}]
	MojString emailAddr;
	bool validEmail = true;
	emailAddr.assign(m_buddyName.data());
	// for AIM, need to add back the "@aol.com" to the email
	if (MojInvalidIndex == m_buddyName.find('@')) {
		if (0 == m_serviceName.compare(SERVICENAME_AIM))
			emailAddr.append("@aol.com");
		else
			validEmail = false;
	}

	if (validEmail) {
		MojObject newEmailArray, newEmailObj;
		newEmailObj.put("value", emailAddr);
		newEmailArray.push(newEmailObj);
		contact.put("emails", newEmailArray);
	}

	// log it
	MojString json;
	contact.toJson(json);
	MojLogInfo(IMServiceApp::s_log, _T("saving contact to db: %s"), json.data());

	// save it
	// the save generates a call to the save result handler
	MojErr err = m_dbClient.put(this->m_addContactSlot, contact);
	if (err) {
		MojString error;
		MojErrToString(err, error);
		MojLogError(IMServiceApp::s_log, _T("addBuddyResult: dbClient.put() failed: error %d - %s"), err, error.data());
		// tell the outgoing Command handler we are done
		m_outgoingIMHandler->messageFinished();
	}

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


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