|
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 tool argument definitions. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MIFCONVARGUMENT_H__ |
|
20 #define __MIFCONVARGUMENT_H__ |
|
21 |
|
22 #include "mifconv.h" |
|
23 #include "mifconv_sourcefile.h" |
|
24 #include <vector> |
|
25 |
|
26 // Argument constants |
|
27 static const MifConvString MifConvUseExtensionArg("e"); |
|
28 static const MifConvString MifConvHeaderArg("h"); |
|
29 static const MifConvString MifConvHelpHArg("h"); // Duplicate name |
|
30 static const MifConvString MifConvHelpQArg("?"); |
|
31 static const MifConvString MifConvHelpHelpArg("-help"); |
|
32 static const MifConvString MifConvPaletteFileArg("p"); |
|
33 static const MifConvString MifConvTempPathArg("t"); |
|
34 static const MifConvString MifConvBmconvPathArg("b"); |
|
35 static const MifConvString MifConvSvgencodePathArg("s"); |
|
36 static const MifConvString MifConvSvgtVersionArg("v"); |
|
37 static const MifConvString MifConvParameterFileArg("f"); |
|
38 static const MifConvString MifConvAnimatedIconArg("a"); // This is part of source file argument |
|
39 static const MifConvString MifConvDisableSvgCompression("x"); |
|
40 static const MifConvString MifConvIconSourceDirectory("i"); |
|
41 static const MifConvString MifConvDepth_1("1"); |
|
42 static const MifConvString MifConvDepth_2("2"); |
|
43 static const MifConvString MifConvDepth_4("4"); |
|
44 static const MifConvString MifConvDepth_8("8"); |
|
45 static const MifConvString MifConvDepth_c4("c4"); |
|
46 static const MifConvString MifConvDepth_c8("c8"); |
|
47 static const MifConvString MifConvDepth_c12("c12"); |
|
48 static const MifConvString MifConvDepth_c16("c16"); |
|
49 static const MifConvString MifConvDepth_c24("c24"); |
|
50 static const MifConvString MifConvDepth_c32("c32"); |
|
51 static const MifConvString MifConvMaskDepth_1("1"); |
|
52 static const MifConvString MifConvMaskDepth_8("8"); |
|
53 |
|
54 // Array of help arguments: |
|
55 const MifConvString MifConvHelpArguments[] = { |
|
56 MifConvHelpHArg, |
|
57 MifConvHelpQArg, |
|
58 MifConvHelpHelpArg |
|
59 }; |
|
60 |
|
61 // Array of boolean arguments: |
|
62 const MifConvString MifConvBooleanArguments[] = { |
|
63 MifConvUseExtensionArg, |
|
64 MifConvDisableSvgCompression |
|
65 }; |
|
66 |
|
67 // Array of string arguments: |
|
68 const MifConvString MifConvStringArguments[] = { |
|
69 MifConvHeaderArg, |
|
70 MifConvPaletteFileArg, |
|
71 MifConvTempPathArg, |
|
72 MifConvBmconvPathArg, |
|
73 MifConvSvgencodePathArg, |
|
74 MifConvSvgtVersionArg, |
|
75 MifConvParameterFileArg |
|
76 }; |
|
77 |
|
78 // Array of string list arguments: |
|
79 const MifConvString MifConvStringListArguments[] = { |
|
80 MifConvIconSourceDirectory |
|
81 }; |
|
82 |
|
83 // Array of depth values: |
|
84 const MifConvString MifConvDepthArguments[] = { |
|
85 MifConvDepth_1, |
|
86 MifConvDepth_2, |
|
87 MifConvDepth_4, |
|
88 MifConvDepth_8, |
|
89 MifConvDepth_c4, |
|
90 MifConvDepth_c8, |
|
91 MifConvDepth_c12, |
|
92 MifConvDepth_c16, |
|
93 MifConvDepth_c24, |
|
94 MifConvDepth_c32 |
|
95 }; |
|
96 |
|
97 // Argument class template |
|
98 template <typename T> |
|
99 class MifConvArgument |
|
100 { |
|
101 public: |
|
102 /** |
|
103 * Constructor |
|
104 * @param argName Argument name |
|
105 * @param argVal Argument value |
|
106 */ |
|
107 MifConvArgument( const MifConvString& argName, const T& argVal ); |
|
108 |
|
109 /** |
|
110 * Copy constructor |
|
111 * @param arg Argument object to be copied |
|
112 */ |
|
113 MifConvArgument( const MifConvArgument& arg ); |
|
114 |
|
115 /** |
|
116 * Destructor |
|
117 */ |
|
118 virtual ~MifConvArgument(); |
|
119 |
|
120 /** |
|
121 * Returns the argument name |
|
122 * @return Argument name |
|
123 */ |
|
124 const MifConvString& Name() const; |
|
125 |
|
126 /** |
|
127 * Returns the argument value |
|
128 * @return Argument value |
|
129 */ |
|
130 const T& Value() const; |
|
131 |
|
132 /** |
|
133 * Sets the argument name |
|
134 * @param argName Argument name |
|
135 */ |
|
136 void SetName( const MifConvString& argName ); |
|
137 |
|
138 /** |
|
139 * Sets the argument value |
|
140 * @param argVal Argument value |
|
141 */ |
|
142 void SetValue( const T& argVal ); |
|
143 |
|
144 /** |
|
145 * Comparison argument for sorting |
|
146 */ |
|
147 bool operator< (const MifConvArgument& arg ); |
|
148 |
|
149 protected: |
|
150 MifConvString iName; |
|
151 T iValue; |
|
152 }; |
|
153 |
|
154 /** |
|
155 * |
|
156 */ |
|
157 template <typename T> |
|
158 MifConvArgument<T>::MifConvArgument(const MifConvString& argName, const T& argVal ) |
|
159 : |
|
160 iName( argName ), |
|
161 iValue( argVal ) |
|
162 { |
|
163 } |
|
164 |
|
165 /** |
|
166 * |
|
167 */ |
|
168 template <typename T> |
|
169 MifConvArgument<T>::MifConvArgument(const MifConvArgument& arg ) |
|
170 : |
|
171 iName(arg.iName), |
|
172 iValue(arg.iValue) |
|
173 {} |
|
174 |
|
175 /** |
|
176 * |
|
177 */ |
|
178 template <typename T> |
|
179 MifConvArgument<T>::~MifConvArgument() |
|
180 {} |
|
181 |
|
182 /** |
|
183 * |
|
184 */ |
|
185 template <typename T> |
|
186 const MifConvString& MifConvArgument<T>::Name() const |
|
187 { |
|
188 return iName; |
|
189 } |
|
190 |
|
191 /** |
|
192 * |
|
193 */ |
|
194 template <typename T> |
|
195 const T& MifConvArgument<T>::Value() const |
|
196 { |
|
197 return iValue; |
|
198 } |
|
199 |
|
200 /** |
|
201 * |
|
202 */ |
|
203 template <typename T> |
|
204 void MifConvArgument<T>::SetName( const MifConvString& argName ) |
|
205 { |
|
206 iName = argName; |
|
207 } |
|
208 |
|
209 /** |
|
210 * |
|
211 */ |
|
212 template <typename T> |
|
213 void MifConvArgument<T>::SetValue( const T& argVal ) |
|
214 { |
|
215 iValue = argVal; |
|
216 } |
|
217 |
|
218 /** |
|
219 * |
|
220 */ |
|
221 template <typename T> |
|
222 bool MifConvArgument<T>::operator< ( const MifConvArgument& arg ) |
|
223 { |
|
224 return iName < arg.iName; |
|
225 } |
|
226 |
|
227 /** |
|
228 * Type definitions |
|
229 */ |
|
230 typedef MifConvArgument<bool> MifConvBooleanArgument; |
|
231 typedef MifConvArgument<MifConvString> MifConvStringArgument; |
|
232 typedef MifConvArgument<MifConvStringList> MifConvStringListArgument; |
|
233 typedef MifConvArgument<MifConvSourceFile> MifConvSourceFileArgument; |
|
234 |
|
235 typedef std::vector<MifConvBooleanArgument> MifConvBooleanArgumentList; |
|
236 typedef std::vector<MifConvStringArgument> MifConvStringArgumentList; |
|
237 typedef std::vector<MifConvSourceFileArgument> MifConvSourceFileArgumentList; |
|
238 |
|
239 #endif |