Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



How to get a converter

To perform a conversion you must first get a converter that handles the relevant source and target data types. A converter can handle files or streams or both, so its capabilities must also be checked.

To obtain a suitable converter:

Example

The following code fragment 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

Note

When use of the converter is complete, delete the converter and the converter list. The converter architecture unloads the converter DLLs that were loaded.