Fix compilation warnings
[TortoiseGit.git] / src / TortoiseMerge / DiffData.h
blob5ef7a4a4118f4422b91b2dfc23ae2e203bd47fe3
1 // TortoiseGitMerge - a Diff/Patch program
3 // Copyright (C) 2006-2008, 2010-2011 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #pragma once
21 #pragma warning(push)
22 #include "svn_diff.h"
23 #include "apr_pools.h"
24 #pragma warning(pop)
25 #include "FileTextLines.h"
26 #include "registry.h"
27 #include "WorkingFile.h"
28 #include "ViewData.h"
29 #include "MovedBlocks.h"
33 #define DIFF_EMPTYLINENUMBER ((DWORD)-1)
34 /**
35 * \ingroup TortoiseMerge
36 * Main class for handling diffs.
38 class CDiffData
40 public:
41 CDiffData(void);
42 virtual ~CDiffData(void);
45 BOOL Load();
46 void SetBlame(bool bBlame = true) {m_bBlame = bBlame;}
47 void SetMovedBlocks(bool bViewMovedBlocks = true);
48 int GetLineCount() const;
49 CString GetError() const {return m_sError;}
51 bool IsBaseFileInUse() const { return m_baseFile.InUse(); }
52 bool IsTheirFileInUse() const { return m_theirFile.InUse(); }
53 bool IsYourFileInUse() const { return m_yourFile.InUse(); }
55 private:
56 bool DoTwoWayDiff(const CString& sBaseFilename, const CString& sYourFilename, DWORD dwIgnoreWS, bool bIgnoreEOL, apr_pool_t * pool);
58 void StickAndSkip(svn_diff_t * &tempdiff, apr_off_t &original_length_sticked, apr_off_t &modified_length_sticked);
59 bool DoThreeWayDiff(const CString& sBaseFilename, const CString& sYourFilename, const CString& sTheirFilename, DWORD dwIgnoreWS, bool bIgnoreEOL, bool bIgnoreCase, apr_pool_t * pool);
60 /**
61 * Moved blocks detection for further highlighting,
62 * implemented exclusively for TwoWayDiff
63 **/
64 tsvn_svn_diff_t_extension * MovedBlocksDetect(svn_diff_t * diffYourBase, DWORD dwIgnoreWS, apr_pool_t * pool);
66 void TieMovedBlocks(int from, int to, apr_off_t length);
68 void HideUnchangedSections(CViewData * data1, CViewData * data2, CViewData * data3);
70 svn_diff_file_ignore_space_t GetIgnoreSpaceMode(DWORD dwIgnoreWS);
71 svn_diff_file_options_t * CreateDiffFileOptions(DWORD dwIgnoreWS, bool bIgnoreEOL, apr_pool_t * pool);
72 bool HandleSvnError(svn_error_t * svnerr);
73 bool CompareWithIgnoreWS(CString s1, CString s2, DWORD dwIgnoreWS);
74 public:
75 CWorkingFile m_baseFile;
76 CWorkingFile m_theirFile;
77 CWorkingFile m_yourFile;
78 CWorkingFile m_mergedFile;
80 CString m_sDiffFile;
81 CString m_sPatchPath;
82 CString m_sPatchOriginal;
83 CString m_sPatchPatched;
84 bool m_bPatchRequired;
86 public:
87 CFileTextLines m_arBaseFile;
88 CFileTextLines m_arTheirFile;
89 CFileTextLines m_arYourFile;
91 CViewData m_YourBaseBoth; ///< one-pane view, diff between 'yours' and 'base' (in three-pane view: right view)
92 CViewData m_YourBaseLeft; ///< two-pane view, diff between 'yours' and 'base', left view
93 CViewData m_YourBaseRight; ///< two-pane view, diff between 'yours' and 'base', right view
95 CViewData m_TheirBaseBoth; ///< one-pane view, diff between 'theirs' and 'base' (in three-pane view: left view)
96 CViewData m_TheirBaseLeft; ///< two-pane view, diff between 'theirs' and 'base', left view
97 CViewData m_TheirBaseRight; ///< two-pane view, diff between 'theirs' and 'base', right view
99 CViewData m_Diff3; ///< three-pane view, bottom pane
101 CString m_sError;
103 static int abort_on_pool_failure (int retcode);
104 protected:
105 bool m_bBlame;
106 bool m_bViewMovedBlocks;