|
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-5E7A1041-B0E1-47E3-A3BF-6C9AE221B98F" xml:lang="en"><title>Request |
|
13 for conversions</title><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
14 <context> <p>Conversions can be done in a single step or in multiple |
|
15 steps.</p><p/><p><b>Single step</b></p><p>To convert an entire file or |
|
16 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 |
|
17 places the output in <filepath>c:\private\12345678\file2</filepath>.</p><codeblock xml:space="preserve">_LIT(KFromFile, "c:\\private\\12345678\\file1"); |
|
18 _LIT(KToFile, "c:\\private\\12345678\\file2"); |
|
19 converter->ConvertL(KFromFile, KToFile, NULL); |
|
20 </codeblock><p/><p><b>Multiple steps</b></p><p>As the conversion process |
|
21 can take a long time, you can divide the process into multiple steps. To do |
|
22 this:</p><ol> |
|
23 <li id="GUID-6D2816BF-06ED-44B1-B309-F4BCAAE6377A"><p>Call <codeph>CConverterBase2::ConvertAL()</codeph> (files) |
|
24 or <codeph>CConverterBase2::ConvertObjectAL()</codeph> (streams) to prepare |
|
25 the converter to convert.</p></li> |
|
26 <li id="GUID-8D18EDEE-2200-4BF4-8D87-B80E95863A6D"><p>Call <codeph>CConverterBase2::DoConvertL()</codeph> until |
|
27 it returns true.</p></li> |
|
28 </ol><p>The following example converts the contents of <filepath>c:\private\12345678\file1</filepath> and |
|
29 places the output in <filepath>c:\private\12345678\file2</filepath> in multiple |
|
30 steps. It assumes that conversion takes place within an active object, <codeph>CMyActive</codeph>, |
|
31 which does a conversion step in the <codeph>RunL()</codeph> function and reactivates |
|
32 the object if conversion is not complete.</p><codeblock xml:space="preserve">void CMyActive::StartConverting() |
|
33 { |
|
34 _LIT( KFromFile, "c:\\private\\12345678\\file1" ); |
|
35 _LIT( KToFile, "c:\\private\\12345678\\file2" ); |
|
36 converter->ConvertAL( KFromFile, KToFile, NULL ); |
|
37 User::RequestComplete( iStatus,KErrNone ); |
|
38 SetActive(); |
|
39 } |
|
40 void CMyActive::RunL() |
|
41 { |
|
42 if (DoConvertL()) |
|
43 { |
|
44 User::RequestComplete( iStatus,KErrNone ); |
|
45 SetActive(); |
|
46 } |
|
47 else |
|
48 { |
|
49 // Handle completed conversion |
|
50 } |
|
51 } |
|
52 </codeblock><p><b>NOTE</b>: After using the converter, delete the converter |
|
53 and the converter list. The converter architecture unloads the converter DLLs |
|
54 that were loaded.</p></context> |
|
55 </taskbody></task> |