Week 23 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.
<?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-5E7A1041-B0E1-47E3-A3BF-6C9AE221B98F" xml:lang="en"><title>Request
for conversions</title><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context> <p>Conversions can be done in a single step or in multiple
steps.</p><p/><p><b>Single step</b></p><p>To convert an entire file or
stream in a single step, use <codeph>CConverterBase2::ConvertL()</codeph> and <codeph>CConverterBase2::ConvertObjectL()</codeph> respectively.</p><p>The following code snippet converts the contents of <filepath>c:\private\12345678\file1</filepath> and
places the output in <filepath>c:\private\12345678\file2</filepath>.</p><codeblock xml:space="preserve">_LIT(KFromFile, "c:\\private\\12345678\\file1");
_LIT(KToFile, "c:\\private\\12345678\\file2");
converter->ConvertL(KFromFile, KToFile, NULL);
</codeblock><p/><p><b>Multiple steps</b></p><p>As the conversion process
can take a long time, you can divide the process into multiple steps. To do
this:</p><ol>
<li id="GUID-6D2816BF-06ED-44B1-B309-F4BCAAE6377A"><p>Call <codeph>CConverterBase2::ConvertAL()</codeph> (files)
or <codeph>CConverterBase2::ConvertObjectAL()</codeph> (streams) to prepare
the converter to convert.</p></li>
<li id="GUID-8D18EDEE-2200-4BF4-8D87-B80E95863A6D"><p>Call <codeph>CConverterBase2::DoConvertL()</codeph> until
it returns true.</p></li>
</ol><p>The following example converts the contents of <filepath>c:\private\12345678\file1</filepath> and
places the output in <filepath>c:\private\12345678\file2</filepath> in multiple
steps. It assumes that conversion takes place within an active object, <codeph>CMyActive</codeph>,
which does a conversion step in the <codeph>RunL()</codeph> function and reactivates
the object if conversion is not complete.</p><codeblock xml:space="preserve">void CMyActive::StartConverting()
{
_LIT( KFromFile, "c:\\private\\12345678\\file1" );
_LIT( KToFile, "c:\\private\\12345678\\file2" );
converter->ConvertAL( KFromFile, KToFile, NULL );
User::RequestComplete( iStatus,KErrNone );
SetActive();
}
void CMyActive::RunL()
{
if (DoConvertL())
{
User::RequestComplete( iStatus,KErrNone );
SetActive();
}
else
{
// Handle completed conversion
}
}
</codeblock><p><b>NOTE</b>: After using the converter, delete the converter
and the converter list. The converter architecture unloads the converter DLLs
that were loaded.</p></context>
</taskbody></task>