Symbian3/SDK/Source/GUID-A7DFDC4F-56C2-46B3-8B76-A6488BE4ABE0.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE task
  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-A7DFDC4F-56C2-46B3-8B76-A6488BE4ABE0" xml:lang="en"><title>Get
a converter</title><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context>       <p>To obtain a suitable converter, complete the following
steps:</p><ol>
<li id="GUID-C976E9F3-245D-4502-89FB-175AE749FD59"><p>Create a <codeph>CCnaConverterList</codeph> object and use it to get
the UID of the converter that convert from a particular data type to another.</p></li>
<li id="GUID-509D3420-2060-4865-8269-934B273643F5"><p>Create the converter (a <codeph>CConverterBase2</codeph>-based object)
using <codeph>CCnaConverterList::NewConverterL()</codeph>. The converter architecture
loads the converter DLL and instantiates the converter object from it. </p></li>
<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>
</ol><p>The following code snippet creates a converter that can convert files
of data type <b>text/abc</b> to type <b>text/xyz</b>.</p><codeblock xml:space="preserve">_LIT( KFromType, "text/abc" );
_LIT( KToType, "text/xyz" );
CCnaConverterList* list = CCnaConverterList::NewLC();
TUid uid = list-&gt;ConverterL( TDataType( KFromType ), TDataType( KToType ) );
CConverterBase* converter = list-&gt;NewConverterL( uid );
User::LeaveIfNull( converter );
if( !( converter-&gt;Capabilities() &amp; CConverterBase::EConvertsFiles ) )
    {
    delete converter;
    converter = NULL;
    }
CleanupStack::PushL( converter );
...
CleanupStack::PopAndDestroy( 2 ); // list, converter</codeblock></context>
</taskbody></task>