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


C++ CContactItemField::GetFieldText方法代码示例

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


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

示例1: FindTxtFieldInTextBlobL

/**
Reads the first text field from text fields blob based on aFieldType.  

1. If aFieldType is KUidContactFieldMatchAll: 
If the first text field found in the text fields blob is an Email field, 
then the email address is returned in aText and found exit with ETrue returned, 
If an email address is not returned, the first text field found in the text 
field blob is returned, however it is considered as the best effort text, so 
the calling function will return EFalse indicate the caller to found suitable
text in Fast Access fields.

2. If aFieldType is other than KUidContactFieldMatchAll: 
Find the first text field matching aFieldType from given text fields buffer and 
returned the field content in aText with ETrue returned, returning EFalse if it 
can't find matched field.

@param aHeaderStream The read stream contains text field header
@param aTextFieldsBuf The text fields blob buffer.
@param aSystemTemplate Reference to system template class.
@param aFieldType Field type to match the field
@param aText Text found in text fields buffer based on a FieldType. 
*/
TBool TCntPersistenceUtility::FindTxtFieldInTextBlobL(RReadStream& aHeaderStream, HBufC* aTextFieldsBuf, const CContactTemplate& aSystemTemplate, const TFieldType& aFieldType, TDes& aText)
	{
	// Extract the number of fields from the header stream.
	TCardinality headerFieldCount;
	aHeaderStream>>headerFieldCount;
	
	TInt txtFldIndex = 0;
	CContactItemField* itemField = NULL;
	// Assign to a TInt variable to avoid using the overloaded int operator on
	// each iteration - improves performance.
	TInt max = headerFieldCount;
	
	// Loop through the header fields and try to retrieve the text from the
	// searchable text buffer.
	for(TInt hdrFldIndex = 0; hdrFldIndex < max; ++hdrFldIndex)
		{
		itemField = CContactItemField::NewLC();

		// Using both header-fields and template-fields, setup the field to hold
		// the correct type UIDs.
		itemField->RestoreFieldTypesL(aHeaderStream, &aSystemTemplate.CardFields());

		// Only restore text fields - ignore all other fields.
		if(itemField->StorageType() == KStorageTypeText)
			{
			if(aFieldType == KUidContactFieldMatchAll)
				{
				// Restore the field text from the searchable text buffer.
				itemField->RestoreTextL(aTextFieldsBuf, txtFldIndex);
				
				if(itemField->ContentType().ContainsFieldType(KUidContactFieldEMail))
					{
					if(CopyMinFieldText(itemField->TextStorage()->Text(), aText))
						{
						CleanupStack::PopAndDestroy(itemField); 
						return ETrue;
						}
					}
				else if(aText.Length() == 0 && itemField->TextStorage()->Text().Length() > 0)
					{
					// If there is text in the field then make a copy of the first
					// KTextFieldMinimalLength characters.
					CopyMinFieldText(itemField->TextStorage()->Text(), aText);
					} //else if
				} 
			else if(itemField->ContentType().ContainsFieldType(aFieldType))
				{
				// Restore the field text from the searchable text buffer.
				itemField->RestoreTextL(aTextFieldsBuf, txtFldIndex);
				itemField->GetFieldText(aText);
				//CopyMinFieldText(itemField->TextStorage()->Text(), aText);	
				CleanupStack::PopAndDestroy(itemField); 
				return ETrue;
				} //else if
				
			++txtFldIndex;
			} //if
		CleanupStack::PopAndDestroy(itemField);
		} // for
	return EFalse;
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:83,代码来源:cntpersistenceutility.cpp


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