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


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

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


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

示例1: RestoreBinaryL

/**
Utility method used to read binary fields from blob and fill item field set,Provides a mechanism to restore a 
contact item field set from binary blob field within contact database.
Blob informations are stored based on contact item field. At restore, a reference to a contact item field set
is provided. For every contact item field in the item field set, a text restore is made.

@param		aFieldSet Reference to CContactItemFieldSet. Item field set that has to be filled with informations from blob
@param		aHeaderStore Stream store containing the header informations
@param		aId Root id for the header stream store
@param		aValuesStore Read stream used to read text fields from binary blob
@param		aViewDef View definition indicating which fields have to be read from blob
@param		aTemplate Template indicating if current field set should be filled based on a template			
*/	
void TCntPersistenceUtility::RestoreBinaryL(CContactItemFieldSet& aFieldSet, CStreamStore& aHeaderStore, TStreamId aId, CStreamStore* aBlobStore, const CContactItemViewDef& aViewDef, const CContactItem* aTemplate)
	{
	const TBool KIncludeFields = aViewDef.Use() == CContactItemViewDef::EIncludeFields;
	
	if (KIncludeFields && aViewDef.Count() == 0)
		{
		// If view definition does not contain any field we don't do anything (don't read from 
		// blob). We simply return from method without doing anything.
		// This is not an error condition		
		return;	
		}
		
	RStoreReadStream stream;
	stream.OpenLC(aHeaderStore,aId);
	TCardinality fieldCount;
	stream>>fieldCount;
	TStreamId nestedId;
	
	for (TInt ii = 0; ii < fieldCount; ++ii)
		{
		// Restore binary value for every CContactItemField in provided CContactItemFieldSet.
		CContactItemField* field = CContactItemField::NewLC();
		if(aTemplate)
			{
			nestedId = field->RestoreFieldTypesL(stream, &(aTemplate->CardFields()));
			}
		else
			{
			nestedId = field->RestoreFieldTypesL(stream, NULL);	
			}
			
		ASSERT(field->StorageType() != KStorageTypeText);
		
		TBool fieldDefined = ETrue;
		if(!aViewDef.MatchesAll())
			{
			fieldDefined = (aViewDef.Find(field->ContentType()) != KErrNotFound);
			}

		if ((!((fieldDefined && KIncludeFields) || (!fieldDefined && !KIncludeFields))) || 
			(field->IsHidden() && aViewDef.Mode() == CContactItemViewDef::EMaskHiddenFields))
			{
       		CleanupStack::PopAndDestroy(field);
			}
        else
            {
    		RStoreReadStream readStream;
        	readStream.OpenLC(*aBlobStore, nestedId);
    		field->Storage()->RestoreL(*aBlobStore, readStream);
    		CleanupStack::PopAndDestroy(&readStream);
    		aFieldSet.AddL(*field);
    		CleanupStack::Pop(field); 
            }			
		}
		
	CleanupStack::PopAndDestroy(&stream); 
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:70,代码来源:cntpersistenceutility.cpp


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