1 // ArchiveCommandLine.h 2 3 #ifndef __ARCHIVE_COMMAND_LINE_H 4 #define __ARCHIVE_COMMAND_LINE_H 5 6 #include "../../../Common/CommandLineParser.h" 7 #include "../../../Common/Wildcard.h" 8 9 #include "EnumDirItems.h" 10 11 #include "Extract.h" 12 #include "HashCalc.h" 13 #include "Update.h" 14 15 typedef CMessagePathException CArcCmdLineException; 16 17 namespace NCommandType { enum EEnum 18 { 19 kAdd = 0, 20 kUpdate, 21 kDelete, 22 kTest, 23 kExtract, 24 kExtractFull, 25 kList, 26 kBenchmark, 27 kInfo, 28 kHash, 29 kRename 30 };} 31 32 struct CArcCommand 33 { 34 NCommandType::EEnum CommandType; 35 36 bool IsFromExtractGroup() const; 37 bool IsFromUpdateGroup() const; IsTestCommandCArcCommand38 bool IsTestCommand() const { return CommandType == NCommandType::kTest; } 39 NExtract::NPathMode::EEnum GetPathMode() const; 40 }; 41 42 enum 43 { 44 k_OutStream_disabled = 0, 45 k_OutStream_stdout = 1, 46 k_OutStream_stderr = 2 47 }; 48 49 struct CArcCmdLineOptions 50 { 51 bool HelpMode; 52 53 // bool LargePages; 54 bool CaseSensitiveChange; 55 bool CaseSensitive; 56 57 bool IsInTerminal; 58 bool IsStdOutTerminal; 59 bool IsStdErrTerminal; 60 bool StdInMode; 61 bool StdOutMode; 62 bool EnableHeaders; 63 64 bool YesToAll; 65 bool ShowDialog; 66 NWildcard::CCensor Censor; 67 68 CArcCommand Command; 69 UString ArchiveName; 70 71 #ifndef _NO_CRYPTO 72 bool PasswordEnabled; 73 UString Password; 74 #endif 75 76 bool TechMode; 77 bool ShowTime; 78 79 UStringVector HashMethods; 80 81 bool AppendName; 82 // UStringVector ArchivePathsSorted; 83 // UStringVector ArchivePathsFullSorted; 84 NWildcard::CCensor arcCensor; 85 UString ArcName_for_StdInMode; 86 87 CObjectVector<CProperty> Properties; 88 89 CExtractOptionsBase ExtractOptions; 90 91 CBoolPair NtSecurity; 92 CBoolPair AltStreams; 93 CBoolPair HardLinks; 94 CBoolPair SymLinks; 95 96 CUpdateOptions UpdateOptions; 97 CHashOptions HashOptions; 98 UString ArcType; 99 UStringVector ExcludedArcTypes; 100 101 unsigned Number_for_Out; 102 unsigned Number_for_Errors; 103 unsigned Number_for_Percents; 104 unsigned LogLevel; 105 106 // bool IsOutAllowed() const { return Number_for_Out != k_OutStream_disabled; } 107 108 // Benchmark 109 UInt32 NumIterations; 110 CArcCmdLineOptionsCArcCmdLineOptions111 CArcCmdLineOptions(): 112 // LargePages(false), 113 CaseSensitiveChange(false), 114 CaseSensitive(false), 115 116 StdInMode(false), 117 StdOutMode(false), 118 119 Number_for_Out(k_OutStream_stdout), 120 Number_for_Errors(k_OutStream_stderr), 121 Number_for_Percents(k_OutStream_stdout), 122 123 LogLevel(0) 124 { 125 }; 126 }; 127 128 class CArcCmdLineParser 129 { 130 NCommandLineParser::CParser parser; 131 public: 132 void Parse1(const UStringVector &commandStrings, CArcCmdLineOptions &options); 133 void Parse2(CArcCmdLineOptions &options); 134 }; 135 136 #endif 137