1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * @brief Declaration file for PatchTool class
9 #include "DiffWrapper.h"
15 * @brief Files used for patch creating.
16 * Stores paths of two files used to create a patch. Left side file
17 * is considered as "original" file and right side file as "changed" file.
18 * Times are for printing filetimes to patch file.
22 String lfile; /**< Left file */
23 String pathLeft; /**< Left path added to patch file */
24 String rfile; /**< Right file */
25 String pathRight; /**< Right path added to patch file */
26 time_t ltime; /**< Left time */
27 time_t rtime; /**< Right time */
28 PATCHFILES() : ltime(0), rtime(0) {};
30 * @brief Swap diff sides.
34 std::swap(lfile, rfile);
35 std::swap(pathLeft, pathRight);
36 std::swap(ltime, rtime);
41 * @brief A class which creates patch files.
42 * This class is used to create patch files. The files to patch can be added
43 * to list before calling CreatePatch(). Or user can select files in the
44 * the dialog that CreatePatch() shows.
52 void AddFiles(const String &file1, const String &file2);
53 void AddFiles(const String &file1, const String &altPath1,
54 const String &file2, const String &altPath2);
58 bool ShowDialog(CPatchDlg *pDlgPatch);
61 void AddFilesToList(const String& sDir1, const String& sDir2, const DirItem* ent1, const DirItem* ent2, std::vector<PATCHFILES>* fileList);
62 int GetItemsForPatchList(const PathContext& paths, const String subdir[], std::vector<PATCHFILES>* fileList);
65 std::vector<PATCHFILES> m_fileList; /**< List of files to patch. */
66 CDiffWrapper m_diffWrapper; /**< DiffWrapper instance we use to create patch. */
67 String m_sPatchFile; /**< Patch file path and filename. */
68 bool m_bOpenToEditor; /**< Is patch file opened to external editor? */
69 bool m_bCopyToClipbard; /**< Is patch file copied to clipboard? */