OSDN Git Service

Add WinMergePluginBase.h (2)
[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         ShowWindowType m_nCmdShow; /**< Initial state of the application's window. */
56
57         bool m_bEscShutdown; /**< Pressing ESC will close the application */
58         ExitNoDiff m_bExitIfNoDiff; /**< Exit if files are identical. */
59         bool m_bRecurse; /**< Include sub folder in directories compare. */
60         std::optional<CompareMethodType> m_nCompMethod; /**< Compare method */
61         bool m_bNonInteractive; /**< Suppress user's notifications. */
62         std::optional<int> m_nSingleInstance; /**< Allow only one instance of WinMerge executable. */
63         bool m_bShowUsage; /**< Show a brief reminder to command line arguments. */
64         int  m_nCodepage;  /**< Codepage. */
65         bool m_bNoPrefs; /**< Do not load or remember options (preferences) */   
66         bool m_bSelfCompare; /**< Compares the specified file with a copy of the file */
67
68         unsigned m_dwLeftFlags; /**< Left side file's behavior options. */
69         unsigned m_dwMiddleFlags; /**< Middle side file's behavior options. */
70         unsigned m_dwRightFlags; /**< Right side file's behavior options. */
71
72         String m_sLeftDesc; /**< Left side file's description. */
73         String m_sMiddleDesc; /**< Middle side file's description. */
74         String m_sRightDesc; /**< Right side file's description. */
75
76         String m_sFileFilter; /**< File filter mask. */
77         String m_sPreDiffer; /**< Pre-differ name. */
78         String m_sUnpacker; /**< Unpacker name. */
79
80         String m_sOutputpath;
81         String m_sReportFile;
82
83         PathContext m_Files; /**< Files (or directories) to compare. */
84
85         std::map<String, String> m_Options;
86
87         std::vector<String> m_sErrorMessages;
88
89 private:
90
91         static const TCHAR *EatParam(const TCHAR *, String &, bool *flag = nullptr);
92         const TCHAR *SetOption(const TCHAR *, const String& key, const TCHAR *value = _T("1"));
93         const TCHAR *SetConfig(const TCHAR *);
94         void ParseWinMergeCmdLine(const TCHAR *);
95         void AddPath(const String &path);
96
97         /** Operator= is not implemented. */
98         MergeCmdLineInfo& operator=(const MergeCmdLineInfo& rhs);
99 };
100