OSDN Git Service

Success build TortoiseMerge.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseMerge / svninclude / SVNLineDiff.h
diff --git a/src/TortoiseMerge/svninclude/SVNLineDiff.h b/src/TortoiseMerge/svninclude/SVNLineDiff.h
new file mode 100644 (file)
index 0000000..56a7036
--- /dev/null
@@ -0,0 +1,74 @@
+// TortoiseMerge - a Diff/Patch program\r
+\r
+// Copyright (C) 2006-2007 - TortoiseSVN\r
+\r
+// This program is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU General Public License\r
+// as published by the Free Software Foundation; either version 2\r
+// of the License, or (at your option) any later version.\r
+\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software Foundation,\r
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+//\r
+#pragma once\r
+#include "svn_diff.h"\r
+#include "diff.h"\r
+#include "svn_pools.h"\r
+\r
+/**\r
+ * \ingroup TortoiseMerge\r
+ * Handles diffs of single lines. Used for inline diffs.\r
+ */\r
+class SVNLineDiff\r
+{\r
+public:\r
+       SVNLineDiff();\r
+       ~SVNLineDiff();\r
+\r
+       bool Diff(svn_diff_t** diff, LPCTSTR line1, int len1, LPCTSTR line2, int len2, bool bWordDiff);\r
+       /** Checks if we really should show inline diffs.\r
+        * Inline diffs are only useful if the two lines are not\r
+        * completely different but at least a little bit similar.\r
+        */\r
+       static bool ShowInlineDiff(svn_diff_t* diff);\r
+\r
+       std::vector<std::wstring>       m_line1tokens;\r
+       std::vector<std::wstring>       m_line2tokens;\r
+private:\r
+\r
+       apr_pool_t *            m_pool;\r
+       apr_pool_t *            m_subpool;\r
+       LPCTSTR                         m_line1;\r
+       unsigned long           m_line1length;\r
+       LPCTSTR                         m_line2;\r
+       unsigned long           m_line2length;\r
+       unsigned long           m_line1pos;\r
+       unsigned long           m_line2pos;\r
+\r
+       bool                            m_bWordDiff;\r
+\r
+       static svn_error_t * datasource_open(void *baton, svn_diff_datasource_e datasource);\r
+       static svn_error_t * datasource_close(void *baton, svn_diff_datasource_e datasource);\r
+       static svn_error_t * next_token(apr_uint32_t * hash, void ** token, void * baton, svn_diff_datasource_e datasource);\r
+       static svn_error_t * compare_token(void * baton, void * token1, void * token2, int * compare);\r
+       static void discard_token(void * baton, void * token);\r
+       static void discard_all_token(void *baton);\r
+       static bool IsCharWhiteSpace(TCHAR c);\r
+\r
+       static apr_uint32_t Adler32(apr_uint32_t checksum, const WCHAR *data, apr_size_t len);\r
+       static void ParseLineWords(\r
+               LPCTSTR line, unsigned long lineLength, std::vector<std::wstring>& tokens);\r
+       static void ParseLineChars(\r
+               LPCTSTR line, unsigned long lineLength, std::vector<std::wstring>& tokens);\r
+       static void NextTokenWords(\r
+               apr_uint32_t* hash, void** token, unsigned long& linePos, const std::vector<std::wstring>& tokens);\r
+       static void NextTokenChars(\r
+               apr_uint32_t* hash, void** token, unsigned long& linePos, LPCTSTR line, unsigned long lineLength);\r
+       static const svn_diff_fns_t SVNLineDiff_vtable;\r
+};
\ No newline at end of file