|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-A7DFDC4F-56C2-46B3-8B76-A6488BE4ABE0" xml:lang="en"><title>Get |
|
13 a converter</title><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
14 <context> <p>To obtain a suitable converter, complete the following |
|
15 steps:</p><ol> |
|
16 <li id="GUID-C976E9F3-245D-4502-89FB-175AE749FD59"><p>Create a <codeph>CCnaConverterList</codeph> object and use it to get |
|
17 the UID of the converter that convert from a particular data type to another.</p></li> |
|
18 <li id="GUID-509D3420-2060-4865-8269-934B273643F5"><p>Create the converter (a <codeph>CConverterBase2</codeph>-based object) |
|
19 using <codeph>CCnaConverterList::NewConverterL()</codeph>. The converter architecture |
|
20 loads the converter DLL and instantiates the converter object from it. </p></li> |
|
21 <li id="GUID-08E51DD7-BB74-4E8A-BE2F-C1D203B10C52"><p>Check whether the converter supports file or stream conversion using <codeph>CConverterBase2::Capabilities()</codeph>.</p></li> |
|
22 </ol><p>The following code snippet creates a converter that can convert files |
|
23 of data type <b>text/abc</b> to type <b>text/xyz</b>.</p><codeblock xml:space="preserve">_LIT( KFromType, "text/abc" ); |
|
24 _LIT( KToType, "text/xyz" ); |
|
25 CCnaConverterList* list = CCnaConverterList::NewLC(); |
|
26 TUid uid = list->ConverterL( TDataType( KFromType ), TDataType( KToType ) ); |
|
27 CConverterBase* converter = list->NewConverterL( uid ); |
|
28 User::LeaveIfNull( converter ); |
|
29 if( !( converter->Capabilities() & CConverterBase::EConvertsFiles ) ) |
|
30 { |
|
31 delete converter; |
|
32 converter = NULL; |
|
33 } |
|
34 CleanupStack::PushL( converter ); |
|
35 ... |
|
36 CleanupStack::PopAndDestroy( 2 ); // list, converter</codeblock></context> |
|
37 </taskbody></task> |