|
1 /* |
|
2 * Copyright (c) 2005-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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #ifndef __OPTIONS_H__ |
|
25 #define __OPTIONS_H__ |
|
26 #pragma warning( disable : 4786) |
|
27 |
|
28 #include <string> |
|
29 #include <vector> |
|
30 #include <iomanip> |
|
31 using namespace std; |
|
32 |
|
33 int const KMajorVersion = 1; |
|
34 int const KMinorVersion = 0; |
|
35 int const KLength = 8; |
|
36 int const KRadix = 16; |
|
37 |
|
38 /** |
|
39 Exceptions raised during program execution. |
|
40 @internalComponent |
|
41 */ |
|
42 |
|
43 enum Exceptions |
|
44 { |
|
45 EUnknownOption, |
|
46 EMissingRegistryEntry, |
|
47 EMissingPkgUID, |
|
48 EInvalidOption, |
|
49 EInvalidPackageUID, |
|
50 ESetEnvironmentVariable, |
|
51 EInvalidFile |
|
52 }; |
|
53 |
|
54 /** |
|
55 Contains the command line options . |
|
56 @internalComponent |
|
57 */ |
|
58 |
|
59 class Options |
|
60 { |
|
61 public: |
|
62 |
|
63 Options(int argc, char** argv); |
|
64 |
|
65 ~Options(); |
|
66 |
|
67 /** |
|
68 Displays the exception messages . |
|
69 @param aErr Exception values as defined in the enum. |
|
70 */ |
|
71 static void DisplayError (const Exceptions& aErr); |
|
72 |
|
73 /** |
|
74 Displays the help message . |
|
75 */ |
|
76 static void DisplayUsage (); |
|
77 |
|
78 /** |
|
79 Returns true if -r option is specified . |
|
80 */ |
|
81 bool IsRegistryEntrySpecified() const {return iRegistryEntrySpecified; } |
|
82 |
|
83 /** |
|
84 Returns true if -p option is specified. |
|
85 */ |
|
86 bool IsPkgUIDSpecified() const { return iPkgUIDSpecified; } |
|
87 |
|
88 /** |
|
89 Returns Package UID as specified on command line . |
|
90 */ |
|
91 const string& PkgUID () const { return iPkgUID ; } |
|
92 |
|
93 /** |
|
94 Returns Registry File Path . |
|
95 */ |
|
96 const string& RegistryFilePath () const { return iRegistryFilePath ; } |
|
97 |
|
98 /** |
|
99 Returns Package Name as specified on command line . |
|
100 */ |
|
101 const string& PkgName () const { return iPkgName; } |
|
102 |
|
103 /** |
|
104 Returns Vendor Name as specified on command line . |
|
105 */ |
|
106 const string& VendorName() const { return iVendorName; } |
|
107 |
|
108 static const char* CommandName () { return "DumpSWIRegistryTool"; } |
|
109 |
|
110 private: |
|
111 |
|
112 /** |
|
113 Displays the version of the tool . |
|
114 */ |
|
115 void DisplayVersion (); |
|
116 |
|
117 /** |
|
118 Checks for any command line exceptions . |
|
119 */ |
|
120 void CheckCmdLineExceptions() ; |
|
121 |
|
122 private: |
|
123 |
|
124 bool iVersion; |
|
125 bool iHelpFlag; |
|
126 bool iPkgUIDSpecified; |
|
127 bool iRegistryEntrySpecified; |
|
128 string iPkgUID; |
|
129 string iPkgName; |
|
130 string iVendorName; |
|
131 string iRegistryFilePath; |
|
132 }; |
|
133 |
|
134 #endif |