|
1 // ArchiveCommandLine.h |
|
2 |
|
3 #ifndef __ARCHIVECOMMANDLINE_H |
|
4 #define __ARCHIVECOMMANDLINE_H |
|
5 |
|
6 #include "Common/Wildcard.h" |
|
7 #include "Common/CommandLineParser.h" |
|
8 |
|
9 #include "Extract.h" |
|
10 #include "Update.h" |
|
11 |
|
12 struct CArchiveCommandLineException: public AString |
|
13 { |
|
14 CArchiveCommandLineException(const char *errorMessage): AString(errorMessage) {} |
|
15 }; |
|
16 |
|
17 namespace NCommandType { enum EEnum |
|
18 { |
|
19 kAdd = 0, |
|
20 kUpdate, |
|
21 kDelete, |
|
22 kTest, |
|
23 kExtract, |
|
24 kFullExtract, |
|
25 kList, |
|
26 kBenchmark, |
|
27 kInfo |
|
28 };} |
|
29 |
|
30 namespace NRecursedType { enum EEnum |
|
31 { |
|
32 kRecursed, |
|
33 kWildCardOnlyRecursed, |
|
34 kNonRecursed |
|
35 };} |
|
36 |
|
37 struct CArchiveCommand |
|
38 { |
|
39 NCommandType::EEnum CommandType; |
|
40 bool IsFromExtractGroup() const; |
|
41 bool IsFromUpdateGroup() const; |
|
42 bool IsTestMode() const { return CommandType == NCommandType::kTest; } |
|
43 NExtract::NPathMode::EEnum GetPathMode() const; |
|
44 }; |
|
45 |
|
46 struct CArchiveCommandLineOptions |
|
47 { |
|
48 bool HelpMode; |
|
49 |
|
50 #ifdef _WIN32 |
|
51 bool LargePages; |
|
52 #endif |
|
53 |
|
54 bool IsInTerminal; |
|
55 bool IsStdOutTerminal; |
|
56 bool IsStdErrTerminal; |
|
57 bool StdInMode; |
|
58 bool StdOutMode; |
|
59 bool EnableHeaders; |
|
60 |
|
61 bool YesToAll; |
|
62 bool ShowDialog; |
|
63 // NWildcard::CCensor ArchiveWildcardCensor; |
|
64 NWildcard::CCensor WildcardCensor; |
|
65 |
|
66 CArchiveCommand Command; |
|
67 UString ArchiveName; |
|
68 |
|
69 bool PasswordEnabled; |
|
70 UString Password; |
|
71 |
|
72 bool TechMode; |
|
73 // Extract |
|
74 bool AppendName; |
|
75 UString OutputDir; |
|
76 NExtract::NOverwriteMode::EEnum OverwriteMode; |
|
77 UStringVector ArchivePathsSorted; |
|
78 UStringVector ArchivePathsFullSorted; |
|
79 CObjectVector<CProperty> ExtractProperties; |
|
80 |
|
81 CUpdateOptions UpdateOptions; |
|
82 UString ArcType; |
|
83 bool EnablePercents; |
|
84 |
|
85 // Benchmark |
|
86 UInt32 NumIterations; |
|
87 UInt32 NumThreads; |
|
88 UInt32 DictionarySize; |
|
89 UString Method; |
|
90 |
|
91 |
|
92 CArchiveCommandLineOptions(): StdInMode(false), StdOutMode(false) {}; |
|
93 }; |
|
94 |
|
95 class CArchiveCommandLineParser |
|
96 { |
|
97 NCommandLineParser::CParser parser; |
|
98 public: |
|
99 CArchiveCommandLineParser(); |
|
100 void Parse1(const UStringVector &commandStrings, CArchiveCommandLineOptions &options); |
|
101 void Parse2(CArchiveCommandLineOptions &options); |
|
102 }; |
|
103 |
|
104 #endif |