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


C++ Email::GetSubject方法代码示例

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


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

示例1: SerializeToDatabaseObject

// NOTE: This should currently only be used for new emails
void EmailAdapter::SerializeToDatabaseObject(const Email& email, MojObject& obj)
{
	MojErr err;
	
	// Set the object kind
	err = obj.putString(KIND, Kind::EMAIL);
	ErrorToException(err);
	
	// FIXME object ID
	
	// Set the folder ID
	err = obj.put(FOLDER_ID, email.GetFolderId());
	ErrorToException(err);
	
	// Set flags
	MojObject flags;
	SerializeFlags(email, flags);

	err = obj.put(FLAGS, flags);
	ErrorToException(err);
	
	// The following fields only exist for a new e-mail to be added to the DB
	// If the e-mail object already exists in the DB, we shouldn't overwrite these fields
	// FIXME: Except for drafts. Maybe this logic should be moved elsewhere?
	if (true /*!obj.Exists()*/) {
		// Subject
		err = obj.putString(SUBJECT, email.GetSubject().c_str());
		ErrorToException(err);

		// Preview text
		err = obj.putString(SUMMARY, email.GetPreviewText().c_str());
		ErrorToException(err);
		
		// Timestamp in UTC milliseconds
		err = obj.put(TIMESTAMP, email.GetDateReceived());
		ErrorToException(err);
		
		// From address
		MojObject from;
		if(email.GetFrom().get()) // may not have a from address
			SerializeAddress(Address::Type::FROM, email.GetFrom(), from);
		err = obj.put(FROM, from);
		ErrorToException(err);
		
		// Reply-To address
		MojObject replyTo;
		if(email.GetReplyTo().get()) { // may not have a reply-to address
			SerializeAddress(Address::Type::REPLY_TO, email.GetReplyTo(), replyTo);
			err = obj.put(REPLY_TO, replyTo);
			ErrorToException(err);
		}

		// Recipients
		MojObject recipients;
		SerializeRecipients(Address::Type::TO, email.GetTo(), recipients);
		SerializeRecipients(Address::Type::CC, email.GetCc(), recipients);
		SerializeRecipients(Address::Type::BCC, email.GetBcc(), recipients);
		err = obj.put(RECIPIENTS, recipients);
		ErrorToException(err);
		
		// Parts
		MojObject parts;
		SerializeParts(email.GetPartList(), parts);
		err = obj.put(PARTS, parts);
		ErrorToException(err);

		// MessageId and InReplyTo
		DatabaseAdapter::PutOptionalString(obj, MESSAGE_ID, email.GetMessageId());
		DatabaseAdapter::PutOptionalString(obj, IN_REPLY_TO, email.GetInReplyTo());

		// Priority
		Email::Priority priority = email.GetPriority();
		if(priority == Email::Priority_High) {
			err = obj.putString(PRIORITY, PRIORITY_HIGH);
			ErrorToException(err);
		} else if(priority == Email::Priority_Low) {
			err = obj.putString(PRIORITY, PRIORITY_LOW);
			ErrorToException(err);
		}
	}
}
开发者ID:Garfonso,项目名称:app-services,代码行数:82,代码来源:EmailAdapter.cpp


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