OSDN Git Service

Merge branch 'master' into master
[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
18 /** 
19  * @brief WinMerge's command line handler.
20  * This class calls command line parser(s) and allows reading parsed values
21  * from public member variables.
22  */
23 class MergeCmdLineInfo
24 {
25 public:
26         explicit MergeCmdLineInfo(const TCHAR *);
27
28 public:
29
30         enum ExitNoDiff
31         {
32                 Disabled, /**< Don't exit. */
33                 Exit, /**< Exit and show message. */
34                 ExitQuiet, /**< Exit and don't show message. */
35         };
36
37         enum ShowWindowType
38         {
39                 SHOWNORMAL = 1,
40                 MAXIMIZE = 3,
41                 MINIMIZE = 6,
42         };
43
44         ShowWindowType m_nCmdShow; /**< Initial state of the application's window. */
45
46         bool m_bEscShutdown; /**< Pressing ESC will close the application */
47         ExitNoDiff m_bExitIfNoDiff; /**< Exit if files are identical. */
48         bool m_bRecurse; /**< Include sub folder in directories compare. */
49         bool m_bNonInteractive; /**< Suppress user's notifications. */
50         bool m_bSingleInstance; /**< Allow only one instance of WinMerge executable. */
51         bool m_bShowUsage; /**< Show a brief reminder to command line arguments. */
52         int  m_nCodepage;  /**< Codepage. */
53         bool m_bNoPrefs; /**< Do not load or remember options (preferences) */   
54
55         unsigned m_dwLeftFlags; /**< Left side file's behavior options. */
56         unsigned m_dwMiddleFlags; /**< Middle side file's behavior options. */
57         unsigned m_dwRightFlags; /**< Right side file's behavior options. */
58
59         String m_sLeftDesc; /**< Left side file's description. */
60         String m_sMiddleDesc; /**< Middle side file's description. */
61         String m_sRightDesc; /**< Right side file's description. */
62
63         String m_sFileFilter; /**< File filter mask. */
64         String m_sPreDiffer; /**< Pre-differ name. */
65         String m_sUnpacker; /**< Unpacker name. */
66
67         String m_sOutputpath;
68         String m_sReportFile;
69
70         PathContext m_Files; /**< Files (or directories) to compare. */
71
72         std::map<String, String> m_Options;
73
74         std::vector<String> m_sErrorMessages;
75
76 private:
77
78         static const TCHAR *EatParam(const TCHAR *, String &, bool *flag = nullptr);
79         const TCHAR *SetOption(const TCHAR *, const String& key, const TCHAR *value = _T("1"));
80         const TCHAR *SetConfig(const TCHAR *);
81         void ParseWinMergeCmdLine(const TCHAR *);
82         void AddPath(const String &path);
83
84         /** Operator= is not implemented. */
85         MergeCmdLineInfo& operator=(const MergeCmdLineInfo& rhs);
86 };
87