/////////////////////////////////////////////////////////////////////////////
-//
// WinMerge: An interactive diff/merge utility
// Copyright (C) 1997 Dean P. Grimm
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
+// SPDX-License-Identifier: GPL-2.0-or-later
/////////////////////////////////////////////////////////////////////////////
-
-#ifndef _MERGE_CMD_LINE_INFO_INCLUDED_
-#define _MERGE_CMD_LINE_INFO_INCLUDED_
-
/**
* @file MergeCmdLineInfo.h
*
* @brief MergeCmdLineInfo class declaration.
*
*/
+#pragma once
-// RCS ID line follows -- this is updated by CVS
-// $Id$
-
-class CmdLineParser;
+#include "UnicodeString.h"
+#include "PathContext.h"
+#include <map>
+#include <optional>
/**
* @brief WinMerge's command line handler.
- *
+ * This class calls command line parser(s) and allows reading parsed values
+ * from public member variables.
*/
-class MergeCmdLineInfo : public CCommandLineInfo
+class MergeCmdLineInfo
{
public:
-
- /** @brief ClearCaseCmdLineParser's constructor.
- *
- * @param [in] szFileName Executable file name. Required in order to
- * know which command line parser to create and use.
- *
- */
- MergeCmdLineInfo(const TCHAR *szExeName);
-
- ~MergeCmdLineInfo();
-
- /** @brief Override CCommandLineInfo's method. */
- virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast);
+ explicit MergeCmdLineInfo(const TCHAR *);
public:
- int m_nCmdShow; /**< Initial state of the application's window. */
+ enum ExitNoDiff
+ {
+ Disabled, /**< Don't exit. */
+ Exit, /**< Exit and show message. */
+ ExitQuiet, /**< Exit and don't show message. */
+ };
+
+ enum ShowWindowType
+ {
+ SHOWNORMAL = 1,
+ MAXIMIZE = 3,
+ MINIMIZE = 6,
+ };
+
+ enum CompareMethodType
+ {
+ CONTENT,
+ QUICK_CONTENT,
+ BINARY_CONTENT,
+ DATE,
+ DATE_SIZE,
+ SIZE,
+ };
+
+ ShowWindowType m_nCmdShow; /**< Initial state of the application's window. */
- bool m_bClearCaseTool; /**< Running as Rational ClearCase external tool. */
bool m_bEscShutdown; /**< Pressing ESC will close the application */
- bool m_bExitIfNoDiff; /**< Exit after telling the user that files are identical. */
+ ExitNoDiff m_bExitIfNoDiff; /**< Exit if files are identical. */
bool m_bRecurse; /**< Include sub folder in directories compare. */
+ std::optional<CompareMethodType> m_nCompMethod; /**< Compare method */
bool m_bNonInteractive; /**< Suppress user's notifications. */
- bool m_bNoPrefs; /**< Do not load or remember preferences. */
- bool m_bSingleInstance; /**< Allow only one instance of WinMerge executable. */
+ std::optional<int> m_nSingleInstance; /**< Allow only one instance of WinMerge executable. */
bool m_bShowUsage; /**< Show a brief reminder to command line arguments. */
+ int m_nCodepage; /**< Codepage. */
+ bool m_bNoPrefs; /**< Do not load or remember options (preferences) */
+ bool m_bSelfCompare; /**< Compares the specified file with a copy of the file */
+
+ unsigned m_dwLeftFlags; /**< Left side file's behavior options. */
+ unsigned m_dwMiddleFlags; /**< Middle side file's behavior options. */
+ unsigned m_dwRightFlags; /**< Right side file's behavior options. */
- DWORD m_dwLeftFlags; /**< Left side file's behavior options. */
- DWORD m_dwRightFlags; /**< Right side file's behavior options. */
+ String m_sLeftDesc; /**< Left side file's description. */
+ String m_sMiddleDesc; /**< Middle side file's description. */
+ String m_sRightDesc; /**< Right side file's description. */
- CString m_sLeftDesc; /**< Left side file's description. */
- CString m_sRightDesc; /**< Right side file's description. */
+ String m_sFileFilter; /**< File filter mask. */
+ String m_sPreDiffer; /**< Pre-differ name. */
+ String m_sUnpacker; /**< Unpacker name. */
- CString m_sFileFilter; /**< File filter mask. */
- CString m_sPreDiffer;
+ String m_sOutputpath;
+ String m_sReportFile;
- /**< Command line arguments which are mapped to WinMerge's preferences. */
- CMapStringToString m_Settings;
+ PathContext m_Files; /**< Files (or directories) to compare. */
- CStringArray m_Files; /**< Files (or directories) to compare. */
+ std::map<String, String> m_Options;
- int m_nFiles; /**< Number of files (or directories) in m_Files. */
+ std::vector<String> m_sErrorMessages;
private:
- /**< operator= is not implemented. */
- MergeCmdLineInfo& operator=(const MergeCmdLineInfo& rhs);
+ static const TCHAR *EatParam(const TCHAR *, String &, bool *flag = nullptr);
+ const TCHAR *SetOption(const TCHAR *, const String& key, const TCHAR *value = _T("1"));
+ const TCHAR *SetConfig(const TCHAR *);
+ void ParseWinMergeCmdLine(const TCHAR *);
+ void AddPath(const String &path);
- CmdLineParser *m_pCmdLineParser; /**< The command line parser instance. */
+ /** Operator= is not implemented. */
+ MergeCmdLineInfo& operator=(const MergeCmdLineInfo& rhs);
};
-#endif // _MERGE_CMD_LINE_INFO_INCLUDED_