本文整理汇总了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;
}