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


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

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


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

示例1: ReadTextBlobL

/**
Utility class to read text blob from given header stream and text buffer, and
return an array of contact item fields defined in aTextDef.

The method loops through the fields of the given text definition and adds (text)
fields from text buffer which match the text definition field types.

@param aHeaderStream the read stream contains text header blob data 
@param aTextBuffer  text buffer storing text fields.
@param aTextDef The text defintion containing the fields IDs required in the
				view contact.
@param aSearchFastAccessFields Return value indicating that additional fields can
							   be found in the Fast Access fields.

@return An array of contact item fields.
*/	
void TCntPersistenceUtility::ReadTextBlobL(RReadStream& aHeaderStream, const HBufC* aTextBuffer, const CContactTextDef& aTextDef, const CContactTemplate& aSystemTemplate, RPointerArray<CContactItemField>& aFields, TBool& aSearchFastAccessFields)
	{
	TInt max = aTextDef.Count();
	for(TInt i=0; i<max; ++i)
		{
		aFields.AppendL(NULL);
		}	
	
	// Extract the number of fields from the header stream.
	TCardinality headerFieldCount;
	aHeaderStream>>headerFieldCount;
	
	TInt textFieldIndex = 0;
	const TInt KMaxTextDefFlds = aTextDef.Count();
	
	CContactItemField* itemField = CContactItemField::NewLC();
	for(TInt hdrFldIndex = 0; hdrFldIndex < headerFieldCount; ++hdrFldIndex)
		{
		// Internalization in RestoreFieldTypesL() moves headerStream on to
		// point to the next element.  RestoreFieldTypesL() knows how to format
		// a header element.
		itemField->RestoreFieldTypesL(aHeaderStream, &aSystemTemplate.CardFields());
	
		// Loop through all the text definition fields.
		for(TInt defIndex = 0; defIndex < KMaxTextDefFlds; ++defIndex)
			{
			// Check if text definition field and current header field types
			// match.
			if((itemField->ContentType().ContainsFieldType(aTextDef.At(defIndex).iFieldType) 
				|| aTextDef.At(defIndex).iFieldType == KUidContactFieldMatchAll) 
				&& itemField->StorageType() == KStorageTypeText)
				{
				// They do match but take care of duplicates.
				if(aFields[defIndex] == NULL)
					{
					itemField->ResetStore();
					// Restore field text from the searchable buffer.
					itemField->RestoreTextL(const_cast<HBufC*>(aTextBuffer), textFieldIndex);
					// Although there's an entry there may be more tables to
					// read.
					if(itemField->TextStorage()->Text().Length() == KNullBlobTextField().Length()
						&& itemField->TextStorage()->Text().Compare(KNullBlobTextField) == 0)
						{
						aSearchFastAccessFields = ETrue;
						}
						
					// Assign the array in correct sequence then clone a new one
					// to continue the search in case there's more than one of
					// this field type.			
					aFields[defIndex] = CContactItemField::NewL(*itemField);
					}
				}
			}
			
		if(itemField->StorageType() == KStorageTypeText)
			{
			++textFieldIndex;
			}
			
		// Always one left over.
		itemField->Reset();
		}
		CleanupStack::PopAndDestroy(itemField);
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:80,代码来源:cntpersistenceutility.cpp


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