OSDN Git Service

compiler-calculated maximum value for `m_SourceDefs` (#966)
[winmerge-jp/winmerge-jp.git] / Src / MergeCmdLineInfo.h
1 /////////////////////////////////////////////////////////////////////////////
2 //    WinMerge: An interactive diff/merge utility
3 //    Copyright (C) 1997 Dean P. Grimm
4 //    SPDX-License-Identifier: GPL-2.0-or-later
5 /////////////////////////////////////////////////////////////////////////////
6 /** 
7  * @file  MergeCmdLineInfo.h
8  *
9  * @brief MergeCmdLineInfo class declaration.
10  *
11  */
12 #pragma once
13
14 #include "UnicodeString.h"
15 #include "PathContext.h"
16 #include <map>
17 #include <optional>
18
19 /** 
20  * @brief WinMerge's command line handler.
21  * This class calls command line parser(s) and allows reading parsed values
22  * from public member variables.
23  */
24 class MergeCmdLineInfo
25 {
26 public:
27         explicit MergeCmdLineInfo(const TCHAR *);
28
29 public:
30
31         enum ExitNoDiff
32         {
33                 Disabled, /**< Don't exit. */
34                 Exit, /**< Exit and show message. */
35                 ExitQuiet, /**< Exit and don't show message. */
36         };
37
38         enum ShowWindowType
39         {
40                 SHOWNORMAL = 1,
41                 MAXIMIZE = 3,
42                 MINIMIZE = 6,
43         };
44
45         enum CompareMethodType
46         {
47                 CONTENT,
48                 QUICK_CONTENT,
49                 BINARY_CONTENT,
50                 DATE,
51                 DATE_SIZE,
52                 SIZE,
53         };
54
55         enum WindowType
56         {
57                 AUTOMATIC,
58                 TEXT,
59                 TABLE,
60                 BINARY,
61                 IMAGE,
62         };
63
64         ShowWindowType m_nCmdShow; /**< Initial state of the application's window. */
65         WindowType m_nWindowType; /**< The type of window that displays the files to compare. */
66
67         bool m_bEscShutdown; /**< Pressing ESC will close the application */
68         ExitNoDiff m_bExitIfNoDiff; /**< Exit if files are identical. */
69         bool m_bRecurse; /**< Include sub folder in directories compare. */
70         std::optional<CompareMethodType> m_nCompMethod; /**< Compare method */
71         bool m_bNonInteractive; /**< Suppress user's notifications. */
72         std::optional<int> m_nSingleInstance; /**< Allow only one instance of WinMerge executable. */
73         bool m_bShowUsage; /**< Show a brief reminder to command line arguments. */
74         int  m_nCodepage;  /**< Codepage. */
75         bool m_bNoPrefs; /**< Do not load or remember options (preferences) */   
76         bool m_bSelfCompare; /**< Compares the specified file with a copy of the file */
77         bool m_bNewCompare; /**< Show a new blank window */
78         bool m_bEnableExitCode; /**< Returns the comparison result as a process exit code */
79         int m_nLineIndex; /**< Line number to jump after loading files */
80         int m_nCharIndex; /**< Character position to jump after loading files */
81         std::optional<TCHAR> m_cTableDelimiter; /**< Delimiter character for table editing*/
82         std::optional<TCHAR> m_cTableQuote; /* Quote character for table editing *< */
83         std::optional<bool> m_bTableAllowNewlinesInQuotes; /**< Allow newlines in quotes */
84
85         unsigned m_dwLeftFlags; /**< Left side file's behavior options. */
86         unsigned m_dwMiddleFlags; /**< Middle side file's behavior options. */
87         unsigned m_dwRightFlags; /**< Right side file's behavior options. */
88
89         String m_sLeftDesc; /**< Left side file's description. */
90         String m_sMiddleDesc; /**< Middle side file's description. */
91         String m_sRightDesc; /**< Right side file's description. */
92
93         String m_sFileFilter; /**< File filter mask. */
94         String m_sPreDiffer; /**< Pre-differ name. */
95         String m_sUnpacker; /**< Unpacker name. */
96         String m_sFileExt; /**< File extension for determining syntax highliting */
97
98         String m_sOutputpath;
99         String m_sReportFile;
100
101         String m_sIniFilepath;
102
103         PathContext m_Files; /**< Files (or directories) to compare. */
104
105         std::map<String, String> m_Options;
106
107         std::vector<String> m_sErrorMessages;
108
109 private:
110
111         static const TCHAR *EatParam(const TCHAR *, String &, bool *flag = nullptr);
112         const TCHAR *SetOption(const TCHAR *, const String& key, const TCHAR *value = _T("1"));
113         const TCHAR *SetConfig(const TCHAR *);
114         void ParseWinMergeCmdLine(const TCHAR *);
115         void AddPath(const String &path);
116
117         /** Operator= is not implemented. */
118         MergeCmdLineInfo& operator=(const MergeCmdLineInfo& rhs);
119 };
120