24 |
24 |
25 #include "common.h" |
25 #include "common.h" |
26 #include "exceptionreporter.h" |
26 #include "exceptionreporter.h" |
27 #include "version.h" |
27 #include "version.h" |
28 #include "hash.h" |
28 #include "hash.h" |
|
29 |
29 #include <map> |
30 #include <map> |
30 #include <vector> |
31 #include <vector> |
31 |
32 |
32 /** |
33 /** |
33 Tydefs used in this class. |
34 Tydefs used in this class. |
34 |
35 |
35 @internalComponent |
36 @internalComponent |
36 @released |
37 @released |
37 */ |
38 */ |
38 |
39 |
39 typedef std::map<String,unsigned int> OptionsMap; |
40 typedef map<string,unsigned int> OptionsMap; |
40 typedef std::map<String,unsigned int> SuppressionsMap; |
41 typedef map<string,unsigned int> SuppressionsMap; |
41 typedef std::vector<char*> ArgumentList; |
42 typedef vector<const char*> cstrings ; |
42 |
|
43 |
43 |
44 /** |
44 /** |
45 Long options will be intialized into an MAP, this data is used later to |
45 Long options will be intialized into an MAP, this data is used later to |
46 validate the received command line arguments. |
46 validate the received command line arguments. |
47 |
47 |
48 @internalComponent |
48 @internalComponent |
49 @released |
49 @released |
50 */ |
50 */ |
51 const String KLongHelpOption("--help"); |
51 const string KLongHelpOption("--help"); |
52 const String KLongXmlOption("--xml"); |
52 const string KLongXmlOption("--xml"); |
53 const String KLongQuietOption("--quiet"); |
53 const string KLongQuietOption("--quiet"); |
54 const String KLongAllOption("--all"); |
54 const string KLongAllOption("--all"); |
55 const String KLongOutputOption("--output"); |
55 const string KLongOutputOption("--output"); |
56 const String KLongVerboseOption("--verbose"); |
56 const string KLongVerboseOption("--verbose"); |
57 const String KLongSuppressOption("--suppress"); |
57 const string KLongSuppressOption("--suppress"); |
58 const String KLongVidValOption("--vidlist"); |
58 const string KLongVidValOption("--vidlist"); |
59 const String KLongSidAllOption("--sidall"); |
59 const string KLongSidAllOption("--sidall"); |
60 const String KLongE32InputOption("--e32input"); |
60 const string KLongE32InputOption("--e32input"); |
61 |
61 |
62 /** |
62 /** |
63 Short options will be intialized into an MAP, this data is used later to |
63 Short options will be intialized into an MAP, this data is used later to |
64 validate the received command line arguments. |
64 validate the received command line arguments. |
65 |
65 |
66 @internalComponent |
66 @internalComponent |
67 @released |
67 @released |
68 */ |
68 */ |
69 const String KShortHelpOption("-h"); |
69 const string KShortHelpOption("-h"); |
70 const String KShortXmlOption("-x"); |
70 const string KShortXmlOption("-x"); |
71 const String KShortQuietOption("-q"); |
71 const string KShortQuietOption("-q"); |
72 const String KShortAllOption("-a"); |
72 const string KShortAllOption("-a"); |
73 const String KShortOutputOption("-o"); |
73 const string KShortOutputOption("-o"); |
74 const String KShortVerboseOption("-v"); |
74 const string KShortVerboseOption("-v"); |
75 const String KShortSuppressOption("-s"); |
75 const string KShortSuppressOption("-s"); |
76 const String KShortNoCheck("-n"); |
76 const string KShortNoCheck("-n"); |
77 |
77 |
78 /** |
78 /** |
79 options to enable required Validation |
79 options to enable required Validation |
80 |
80 |
81 @internalComponent |
81 @internalComponent |
82 @released |
82 @released |
83 */ |
83 */ |
84 const String KLongEnableDepCheck("--dep"); |
84 const string KLongEnableDepCheck("--dep"); |
85 const String KLongEnableSidCheck("--sid"); |
85 const string KLongEnableSidCheck("--sid"); |
86 const String KLongEnableVidCheck("--vid"); |
86 const string KLongEnableVidCheck("--vid"); |
87 const String KLongEnableDbgFlagCheck("--dbg"); |
87 const string KLongEnableDbgFlagCheck("--dbg"); |
88 const String KLongNoCheck("--nocheck"); |
88 const string KLongNoCheck("--nocheck"); |
89 |
89 |
90 /** |
90 /** |
91 option values to disable specific Validation. |
91 option values to disable specific Validation. |
92 |
92 |
93 @internalComponent |
93 @internalComponent |
94 @released |
94 @released |
95 */ |
95 */ |
96 const String KSuppressDependency("dep"); |
96 const string KSuppressDependency("dep"); |
97 const String KSuppressSid("sid"); |
97 const string KSuppressSid("sid"); |
98 const String KSuppressVid("vid"); |
98 const string KSuppressVid("vid"); |
99 |
99 |
100 /** |
100 /** |
101 To mark whether validaition is enabled or not |
101 To mark whether validaition is enabled or not |
102 |
102 |
103 @internalComponent |
103 @internalComponent |
158 this string is appended. |
158 this string is appended. |
159 |
159 |
160 @internalComponent |
160 @internalComponent |
161 @released |
161 @released |
162 */ |
162 */ |
163 const String KXmlExtension(".xml"); |
163 const char KXmlExtension[] = ".xml"; |
164 |
164 |
165 /** |
165 /** |
166 Default XML report name, used if the output report name is not passed through |
166 Default XML report name, used if the output report name is not passed through |
167 command line. |
167 command line. |
168 |
168 |
169 @internalComponent |
169 @internalComponent |
170 @released |
170 @released |
171 */ |
171 */ |
172 const String GXmlFileName("imgcheckreport.xml"); |
172 const char GXmlFileName[] = "imgcheckreport.xml"; |
173 |
173 |
174 /** |
174 /** |
175 Tool name |
175 Tool name |
176 |
176 |
177 @internalComponent |
177 @internalComponent |
178 @released |
178 @released |
179 */ |
179 */ |
180 const String KToolName("imgcheck"); |
180 const char KToolName[] = "imgcheck"; |
181 |
181 |
182 /** |
182 /** |
183 Constants used validate the input Decimal or Hexadecimal values |
183 Constants used validate the input Decimal or Hexadecimal values |
184 |
184 |
185 @internalComponent |
185 @internalComponent |
186 @released |
186 @released |
187 */ |
187 */ |
188 const String KHexNumber("0123456789abcdef"); |
188 const char KHexNumber[] = "0123456789abcdef"; |
189 const String KDecNumber("0123456789"); |
189 const char KDecNumber[] = "0123456789"; |
190 |
|
191 /** |
190 /** |
192 class command line handler |
191 class command line handler |
193 |
192 |
194 @internalComponent |
193 @internalComponent |
195 @released |
194 @released |
199 public: |
198 public: |
200 CmdLineHandler(void); |
199 CmdLineHandler(void); |
201 ~CmdLineHandler(void); |
200 ~CmdLineHandler(void); |
202 void Usage(void); |
201 void Usage(void); |
203 void Version(void); |
202 void Version(void); |
204 const String& PrintUsage(void) const; |
203 const string& PrintUsage(void) const; |
205 const String& PrintVersion(void) const; |
204 const string& PrintVersion(void) const; |
206 String NextImageName(void); |
205 const char* NextImageName(void); |
207 unsigned int NoOfImages(void) const; |
206 unsigned int NoOfImages(void) const; |
208 const unsigned int ReportFlag(void) const; |
207 const unsigned int ReportFlag(void) const; |
209 const String& XmlReportName(void) const; |
208 const string& XmlReportName(void) const; |
210 ReturnType ProcessCommandLine(unsigned int aArgc, char* aArgv[]); |
209 ReturnType ProcessCommandLine(unsigned int aArgc, char* aArgv[]); |
211 void ValidateArguments(void) const; |
210 void ValidateArguments(void) const; |
212 const unsigned int EnabledValidations(void) const; |
211 const unsigned int EnabledValidations(void) const; |
213 UnIntList& VidValueList(void); |
212 UnIntList& VidValueList(void); |
214 const String& Command(void) const; |
213 const string& Command(void) const; |
215 bool DebuggableFlagVal(void); |
214 bool DebuggableFlagVal(void); |
216 void ValidateImageNameList(void); |
215 void ValidateImageNameList(void); |
217 void ValidateE32NoCheckArguments(void); |
216 void ValidateE32NoCheckArguments(void); |
218 |
217 |
219 private: |
218 private: |
220 bool IsOption(const String& aName, int& aLongOptionFlag); |
219 bool IsOption(const char* aName, int& aLongOptionFlag); |
221 bool Validate(const String& aName, bool aOptionValue, unsigned int aNoOfVal); |
220 bool Validate(const string& aName, bool aOptionValue, unsigned int aNoOfVal); |
222 void NormaliseName(void); |
221 void NormaliseName(void); |
223 void ParseOption(const String& aFullName, String& aOptionName, StringList& aOptionValues, bool& aOptionValue); |
222 void ParseOption(char* aFullName, cstrings& aOptionValues, bool& aOptionValue); |
224 void HandleImage(const String& aImageName); |
223 void HandleImage(const char* aImageName); |
225 void StringListToUnIntList(StringList& aStrList, UnIntList& aUnIntList); |
224 void StringListToUnIntList(cstrings& aStrList, UnIntList& aUnIntList); |
226 bool AlreadyReceived(String& aName); |
225 bool AlreadyReceived(const char* aName); |
227 |
226 |
228 private: |
227 private: |
229 StringList iImageNameList; |
228 cstrings iImageNameList; |
230 OptionsMap iOptionMap; |
229 OptionsMap iOptionMap; |
231 SuppressionsMap iSuppressVal; |
230 SuppressionsMap iSuppressVal; |
232 UnIntList iVidValList; |
231 UnIntList iVidValList; |
233 bool iDebuggableFlagVal; |
232 bool iDebuggableFlagVal; |
234 String iInputCommand; |
233 string iInputCommand; |
235 String iXmlFileName; |
234 string iXmlFileName; |
236 bool iNoImage; |
235 bool iNoImage; |
237 unsigned int iCommmandFlag; |
236 unsigned int iCommmandFlag; |
238 unsigned int iValidations; |
237 unsigned int iValidations; |
239 unsigned int iSuppressions; |
238 unsigned int iSuppressions; |
240 String iVersion; |
239 string iVersion; |
241 String iUsage; |
240 string iUsage; |
242 }; |
241 }; |
243 |
242 |
244 #endif //CMDLINEHANDLER_H |
243 #endif //CMDLINEHANDLER_H |