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