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


C++ CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC方法代码示例

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


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

示例1: TestGetBodyTextL

LOCAL_C TBool TestGetBodyTextL()
	{
	__UHEAP_MARK;
	// Retrieve the store from the current context... 
	CMsvStore* store = pContext->EditStoreL();
	CleanupStack::PushL(store);
	
	// Populate CMsvBodyText from the data in the store...
	CMsvBodyText* obj = CMsvBodyText::NewLC();
	obj->RestoreL(*store);
	
	// Create a rich text object...
	CParaFormatLayer* paraLayer = CParaFormatLayer::NewL();
	CleanupStack::PushL(paraLayer);
	CCharFormatLayer* charLayer = CCharFormatLayer::NewL();
	CleanupStack::PushL(charLayer);
	CRichText* richText = CRichText::NewL(paraLayer, charLayer);
	CleanupStack::PushL(richText);
	
	// Create an array of available character sets...
	CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* charSets;
	CCnvCharacterSetConverter* converter = CCnvCharacterSetConverter::NewL();
	CleanupStack::PushL(converter);
	charSets = converter->CreateArrayOfCharacterSetsAvailableLC(gFs);
	
	// For each available character set, call GetBodyTextL...
	TInt i;
	for (i = 0; i < charSets->Count(); i++)
		{
		// Over-ride the stored character set.
		obj->SetCharacterSet((*charSets)[i].Identifier());
		// Convert the 8 bit data to the specified character set.
		obj->GetBodyTextL(gFs, *store, *richText);
		test(richText->HasChanged());
		richText->Reset();
		}
	
	// Instead of decoding 10 bytes of data, increase the amount of data to 4000 bytes.
	obj->SetCharacterSet(0);
	obj->SetDefaultCharacterSet((*charSets)[0].Identifier());
	const TInt KTextBufferSize=4000;
	CBufBase *buffer=CBufFlat::NewL(KTextBufferSize);
	CleanupStack::PushL(buffer);
	while(buffer->Size()<KTextBufferSize)
		{
		buffer->InsertL(buffer->Size(),K10BytesData);
		}

	obj->StoreL(*store, *buffer);
	CleanupStack::PopAndDestroy(buffer);
	store->CommitL();
	obj->RestoreL(*store);
	obj->GetBodyTextL(gFs, *store, *richText);
	test(richText->HasChanged());
	
	// Clean up and release resources...
	CleanupStack::PopAndDestroy(charSets);
	CleanupStack::PopAndDestroy(converter);
	CleanupStack::PopAndDestroy(richText);
	CleanupStack::PopAndDestroy(charLayer);
	CleanupStack::PopAndDestroy(paraLayer);
	CleanupStack::PopAndDestroy(obj);
	CleanupStack::PopAndDestroy(store);
	__UHEAP_MARKEND;
		
	return ETrue;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:67,代码来源:T_CMsvBodyText.cpp


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