|
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 converter manager class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MIFCONVCONVERTERMANAGER_H__ |
|
20 #define __MIFCONVCONVERTERMANAGER_H__ |
|
21 |
|
22 #include "mifconv_fileconverter.h" |
|
23 |
|
24 typedef std::map<MifConvString, MifConvFileConverterList> FileConverterMap; |
|
25 |
|
26 class MifConvConverterManager |
|
27 { |
|
28 public: |
|
29 |
|
30 static MifConvConverterManager* Instance(); |
|
31 static void Reset(); |
|
32 ~MifConvConverterManager(); |
|
33 |
|
34 /** |
|
35 * Initializes the converter manager. Note! Argument manager must be initialized |
|
36 * before calling this. |
|
37 */ |
|
38 void Init(); |
|
39 |
|
40 /** |
|
41 * This method initializes the file converter list and processes the source |
|
42 * files given in arguments. It finds the correct file converter for each |
|
43 * source file and lets it do the file conversion. |
|
44 */ |
|
45 void ProcessIcons(); |
|
46 |
|
47 /** |
|
48 * This method runs the cleanup method of each file converter in the file converter list. |
|
49 * @param error True if error situation |
|
50 */ |
|
51 void Cleanup(bool error = false); |
|
52 |
|
53 /** |
|
54 * Returns all the converters for the given type of file. |
|
55 * @return List of the matching converters. |
|
56 * @param source Source file object |
|
57 */ |
|
58 MifConvFileConverterList& GetConverters(const MifConvSourceFile& source); |
|
59 |
|
60 /** |
|
61 * Returns all the converters for the given type of file. |
|
62 * @return List of the matching converters. |
|
63 * @param filename Source file name |
|
64 */ |
|
65 MifConvFileConverterList& GetConverters(const MifConvString& filename); |
|
66 |
|
67 private: |
|
68 |
|
69 MifConvConverterManager(); |
|
70 // File converter map containing all the converters needed to process the source icons. |
|
71 // Map is ordered by file-extensions: |
|
72 FileConverterMap iFileConverters; |
|
73 MifConvFileConverterList iAllConverters; |
|
74 MifConvFileConverterList iDummyConverterList; |
|
75 |
|
76 static MifConvConverterManager* iInstance; |
|
77 }; |
|
78 |
|
79 |
|
80 #endif |