OSDN Git Service

Remove unused resource IDs
[winmerge-jp/winmerge-jp.git] / Src / FileActionScript.h
index 3a40dd3..3912f58 100644 (file)
@@ -1,32 +1,13 @@
-/////////////////////////////////////////////////////////////////////////////
-//    License (GPLv2+):
-//    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
 /**
  * @file  FileActionScript.h
  *
  * @brief Declaration file for FileActionScript and related classes
  */
-// ID line follows -- this is updated by SVN
-// $Id$
-
-#ifndef _FILEACTIONSCRIPT_H_
-#define _FILEACTIONSCRIPT_H_
+#pragma once
 
 #include <vector>
-#include <boost/scoped_ptr.hpp>
+#include <memory>
 
 class ShellFileOperations;
 
@@ -65,7 +46,7 @@ struct FileAction
 
        String src; /**< Source for action */
        String dest; /**< Destination action */
-       bool dirflag; /**< Is it directory? (TRUE means directory) */
+       bool dirflag; /**< Is it directory? (`true` means directory) */
        ACT_TYPE atype; /**< Action's type */
 };
 
@@ -110,13 +91,12 @@ struct FileActionItem : public FileAction
 class FileActionScript
 {
 public:
-       typedef 
        FileActionScript();
        ~FileActionScript();
 
        void SetParentWindow(HWND hWnd);
-       void UseRecycleBin(BOOL bUseRecycleBin);
-       BOOL Run();
+       void UseRecycleBin(bool bUseRecycleBin);
+       bool Run();
 
        // Manipulate the FileActionList
        size_t GetActionItemCount() const;
@@ -135,25 +115,53 @@ public:
         */
        FileActionItem GetHeadActionItem() const { return m_actions[0]; }
 
+       bool IsCanceled() const { return m_bCanceled; }
+
        String m_destBase; /**< Base destination path for some operations */
 
 protected:
-       int VCSCheckOut(const String &path, BOOL &bApplyToAll);
        int CreateOperationsScripts();
        bool RunOp(ShellFileOperations *oplist, bool & userCancelled);
 
 private:
        std::vector<FileActionItem> m_actions; /**< List of all actions for this script. */
-       boost::scoped_ptr<ShellFileOperations> m_pCopyOperations; /**< Copy operations. */
-       BOOL m_bHasCopyOperations; /**< flag if we've put anything into m_pCopyOperations */
-       boost::scoped_ptr<ShellFileOperations> m_pMoveOperations; /**< Move operations. */
-       BOOL m_bHasMoveOperations; /**< flag if we've put anything into m_pMoveOperations */
-       boost::scoped_ptr<ShellFileOperations> m_pRenameOperations; /**< Rename operations. */
-       BOOL m_bHasRenameOperations; /**< flag if we've put anything into m_pRenameOperations */
-       boost::scoped_ptr<ShellFileOperations> m_pDelOperations; /**< Delete operations. */
-       BOOL m_bHasDelOperations; /**< flag if we've put anything into m_pDelOperations */
-       BOOL m_bUseRecycleBin; /**< Use recycle bin for script actions? */
+       std::unique_ptr<ShellFileOperations> m_pCopyOperations; /**< Copy operations. */
+       bool m_bHasCopyOperations; /**< flag if we've put anything into m_pCopyOperations */
+       std::unique_ptr<ShellFileOperations> m_pMoveOperations; /**< Move operations. */
+       bool m_bHasMoveOperations; /**< flag if we've put anything into m_pMoveOperations */
+       std::unique_ptr<ShellFileOperations> m_pRenameOperations; /**< Rename operations. */
+       bool m_bHasRenameOperations; /**< flag if we've put anything into m_pRenameOperations */
+       std::unique_ptr<ShellFileOperations> m_pDelOperations; /**< Delete operations. */
+       bool m_bHasDelOperations; /**< flag if we've put anything into m_pDelOperations */
+       bool m_bUseRecycleBin; /**< Use recycle bin for script actions? */
        HWND m_hParentWindow; /**< Parent window for showing messages */
+       bool m_bCanceled;
 };
 
-#endif // _FILEACTIONSCRIPT_H_
+/**
+ * @brief Set parent window used for showing MessageBoxes.
+ * @param [in] hWnd Handle to parent window.
+ */
+inline void FileActionScript::SetParentWindow(HWND hWnd)
+{
+       m_hParentWindow = hWnd;
+}
+
+/**
+ * @brief Does user want to move deleted files to Recycle Bin?
+ * @param [in] bUseRecycleBin If `true` deleted files are moved to Recycle Bin.
+ */
+inline void FileActionScript::UseRecycleBin(bool bUseRecycleBin)
+{
+       m_bUseRecycleBin = bUseRecycleBin;
+}
+
+/**
+ * @brief Return amount of actions (copy, move, etc) in script.
+ * @return Amount of actions.
+ */
+inline size_t FileActionScript::GetActionItemCount() const
+{
+       return m_actions.size();
+}
+