|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Mifconv MIF converters class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MIFCONVMIFCONVERTER_H__ |
|
20 #define __MIFCONVMIFCONVERTER_H__ |
|
21 |
|
22 #include "mifconv_fileconverter.h" |
|
23 #include <fstream> |
|
24 #include <vector> |
|
25 |
|
26 /** |
|
27 * Converter class for converting source files to .mif file. |
|
28 */ |
|
29 |
|
30 class MifConvMifConverter : public MifConvFileConverter |
|
31 { |
|
32 public: |
|
33 |
|
34 /** |
|
35 * Default constructor |
|
36 */ |
|
37 MifConvMifConverter(); |
|
38 |
|
39 /** |
|
40 * Destructor |
|
41 */ |
|
42 virtual ~MifConvMifConverter(); |
|
43 |
|
44 // From MifConvFileConverter |
|
45 virtual void AppendFile( const MifConvSourceFile& sourcefile ); |
|
46 virtual void Convert(); |
|
47 virtual void Cleanup(bool err = false); |
|
48 virtual void Init(); |
|
49 virtual void CleanupTargetFiles(); |
|
50 |
|
51 protected: |
|
52 |
|
53 /** |
|
54 * Converts files to .mif file |
|
55 * @param argMgr Reference to argument manager object. |
|
56 */ |
|
57 virtual void ConvertToMif(); |
|
58 |
|
59 /** |
|
60 * Removes temporary files from the file system. |
|
61 */ |
|
62 virtual void CleanupTempFiles(); |
|
63 |
|
64 /** |
|
65 * Creates and initializes the temporary file. |
|
66 * @param argMgr Reference to argument manager object. |
|
67 */ |
|
68 void InitTempFile(); |
|
69 |
|
70 /** |
|
71 * Add source file to the temporary file |
|
72 * @param srcFile Source file object |
|
73 */ |
|
74 void AppendSourceToTempFile(const MifConvSourceFile& srcFile); |
|
75 |
|
76 void ReadFileContents(); |
|
77 void OpenTargetFile(); |
|
78 void WriteTargetHeader(); |
|
79 void WriteIconArray(); |
|
80 void WriteIcons(); |
|
81 void WriteIconHeader(const MifConvSourceFile& src); |
|
82 void WriteIconData(const MifConvSourceFile& src); |
|
83 MifConvDefs::IconFormatType ReadIconBinaryType(const MifConvSourceFile& src); |
|
84 |
|
85 |
|
86 private: |
|
87 |
|
88 MifConvString iTargetFilename; |
|
89 fstream iTargetFile; |
|
90 typedef std::vector<char*> StringPtrVector; |
|
91 StringPtrVector iContentPointers; |
|
92 }; |
|
93 |
|
94 #endif |