To obtain a suitable converter, complete the following steps:
Create a CCnaConverterList object and use it to get the UID of the converter that convert from a particular data type to another.
Create the converter (a CConverterBase2 -based object) using CCnaConverterList::NewConverterL() . The converter architecture loads the converter DLL and instantiates the converter object from it.
Check whether the converter supports file or stream conversion using CConverterBase2::Capabilities() .
The following code snippet creates a converter that can convert files of data type text/abc to type text/xyz .
_LIT( KFromType, "text/abc" );
_LIT( KToType, "text/xyz" );
CCnaConverterList* list = CCnaConverterList::NewLC();
TUid uid = list->ConverterL( TDataType( KFromType ), TDataType( KToType ) );
CConverterBase* converter = list->NewConverterL( uid );
User::LeaveIfNull( converter );
if( !( converter->Capabilities() & CConverterBase::EConvertsFiles ) )
{
delete converter;
converter = NULL;
}
CleanupStack::PushL( converter );
...
CleanupStack::PopAndDestroy( 2 ); // list, converter
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.