OSDN Git Service

TortoiseMerge Basic Support Git patch created by format patch
[tortoisegit/TortoiseGitJp.git] / src / TortoiseMerge / DiffData.h
1 // TortoiseMerge - a Diff/Patch program\r
2 \r
3 // Copyright (C) 2006-2008 - TortoiseSVN\r
4 \r
5 // This program is free software; you can redistribute it and/or\r
6 // modify it under the terms of the GNU General Public License\r
7 // as published by the Free Software Foundation; either version 2\r
8 // of the License, or (at your option) any later version.\r
9 \r
10 // This program is distributed in the hope that it will be useful,\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 // GNU General Public License for more details.\r
14 \r
15 // You should have received a copy of the GNU General Public License\r
16 // along with this program; if not, write to the Free Software Foundation,\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
18 //\r
19 #pragma once\r
20 \r
21 #include "svn_diff.h"\r
22 #include "apr_pools.h"\r
23 #include "FileTextLines.h"\r
24 #include "Registry.h"\r
25 #include "WorkingFile.h"\r
26 #include "ViewData.h"\r
27 \r
28 \r
29 \r
30 #define DIFF_EMPTYLINENUMBER                                            ((DWORD)-1)\r
31 /**\r
32  * \ingroup TortoiseMerge\r
33  * Main class for handling diffs.\r
34  */\r
35 class CDiffData\r
36 {\r
37 public:\r
38         CDiffData(void);\r
39         virtual ~CDiffData(void);\r
40 \r
41 \r
42         BOOL                                            Load();\r
43         void                                            SetBlame(bool bBlame = true) {m_bBlame = bBlame;}\r
44         int                                                     GetLineCount();\r
45         int                                                     GetLineActualLength(int index);\r
46         LPCTSTR                                         GetLineChars(int index);\r
47         CString                                         GetError() const  {return m_sError;}\r
48 \r
49         bool    IsBaseFileInUse() const         { return m_baseFile.InUse(); }\r
50         bool    IsTheirFileInUse() const        { return m_theirFile.InUse(); }\r
51         bool    IsYourFileInUse() const         { return m_yourFile.InUse(); }\r
52 \r
53 private:\r
54         bool DoTwoWayDiff(const CString& sBaseFilename, const CString& sYourFilename, DWORD dwIgnoreWS, bool bIgnoreEOL, apr_pool_t * pool);\r
55         bool DoThreeWayDiff(const CString& sBaseFilename, const CString& sYourFilename, const CString& sTheirFilename, DWORD dwIgnoreWS, bool bIgnoreEOL, bool bIgnoreCase, apr_pool_t * pool);\r
56 \r
57 \r
58 public:\r
59         CWorkingFile                            m_baseFile;\r
60         CWorkingFile                            m_theirFile;\r
61         CWorkingFile                            m_yourFile;\r
62         CWorkingFile                            m_mergedFile;\r
63 \r
64         CString                                         m_sDiffFile;\r
65         CString                                         m_sPatchPath;\r
66         CString                                         m_sPatchOriginal;\r
67         CString                                         m_sPatchPatched;\r
68 \r
69 public:\r
70         CFileTextLines                          m_arBaseFile;\r
71         CFileTextLines                          m_arTheirFile;\r
72         CFileTextLines                          m_arYourFile;\r
73 \r
74         CViewData                                       m_YourBaseBoth;                         ///< one-pane view, diff between 'yours' and 'base' (in three-pane view: right view)\r
75         CViewData                                       m_YourBaseLeft;                         ///< two-pane view, diff between 'yours' and 'base', left view\r
76         CViewData                                       m_YourBaseRight;                        ///< two-pane view, diff between 'yours' and 'base', right view\r
77 \r
78         CViewData                                       m_TheirBaseBoth;                        ///< one-pane view, diff between 'theirs' and 'base' (in three-pane view: left view)\r
79         CViewData                                       m_TheirBaseLeft;                        ///< two-pane view, diff between 'theirs' and 'base', left view\r
80         CViewData                                       m_TheirBaseRight;                       ///< two-pane view, diff between 'theirs' and 'base', right view\r
81 \r
82         CViewData                                       m_Diff3;                                        ///< thee-pane view, bottom pane\r
83 \r
84         // the following three arrays are used to check for conflicts even in case the\r
85         // user has ignored spaces/eols.\r
86         CStdDWORDArray                          m_arDiff3LinesBase;\r
87         CStdDWORDArray                          m_arDiff3LinesYour;\r
88         CStdDWORDArray                          m_arDiff3LinesTheir;\r
89 \r
90         CString                                         m_sError;\r
91 \r
92         static int                                      abort_on_pool_failure (int retcode);\r
93 protected:\r
94         bool                                            m_bBlame;\r
95 };\r