1 // Common/CommandLineParser.h
\r
3 #ifndef __COMMON_COMMAND_LINE_PARSER_H
\r
4 #define __COMMON_COMMAND_LINE_PARSER_H
\r
6 #include "MyString.h"
\r
8 namespace NCommandLineParser {
\r
10 bool SplitCommandLine(const UString &src, UString &dest1, UString &dest2);
\r
11 void SplitCommandLine(const UString &s, UStringVector &parts);
\r
13 namespace NSwitchType {
\r
19 kUnLimitedPostString,
\r
26 const wchar_t *IDString;
\r
27 NSwitchType::EEnum Type;
\r
31 const wchar_t *PostCharSet;
\r
34 struct CSwitchResult
\r
38 UStringVector PostStrings;
\r
40 CSwitchResult(): ThereIs(false) {};
\r
46 CSwitchResult *_switches;
\r
47 bool ParseString(const UString &s, const CSwitchForm *switchForms);
\r
49 UStringVector NonSwitchStrings;
\r
50 CParser(int numSwitches);
\r
52 void ParseStrings(const CSwitchForm *switchForms,
\r
53 const UStringVector &commandStrings);
\r
54 const CSwitchResult& operator[](size_t index) const;
\r
57 /////////////////////////////////
\r
58 // Command parsing procedures
\r
62 const wchar_t *IDString;
\r
63 bool PostStringMode;
\r
66 // Returns: Index of form and postString; -1, if there is no match
\r
67 int ParseCommand(int numCommandForms, const CCommandForm *commandForms,
\r
68 const UString &commandString, UString &postString);
\r