File indexing completed on 2024-03-24 05:46:57
0001 /* 0002 SPDX-FileCopyrightText: 2001-2004,2009 Otto Bruggeman <bruggie@gmail.com> 0003 SPDX-FileCopyrightText: 2001-2003 John Firebaugh <jfirebaugh@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef KOMPAREDIFF2_DIFFHUNK_H 0009 #define KOMPAREDIFF2_DIFFHUNK_H 0010 0011 // lib 0012 #include "difference.h" 0013 #include "komparediff2_export.h" 0014 // Std 0015 #include <memory> 0016 0017 namespace KompareDiff2 0018 { 0019 0020 class Difference; 0021 class DiffHunkPrivate; 0022 0023 /** 0024 * DiffHunk 0025 */ 0026 class KOMPAREDIFF2_EXPORT DiffHunk 0027 { 0028 public: 0029 enum Type { 0030 Normal, 0031 AddedByBlend, 0032 }; 0033 0034 public: 0035 DiffHunk(int sourceLine, int destinationLine, const QString &function = QString(), Type type = Normal); 0036 ~DiffHunk(); 0037 0038 DifferenceList differences() const; 0039 QString function() const; 0040 0041 int sourceLineNumber() const; 0042 int destinationLineNumber() const; 0043 0044 int sourceLineCount() const; 0045 int destinationLineCount() const; 0046 0047 Type type() const; 0048 void setType(Type type); 0049 0050 void add(Difference *diff); 0051 0052 QString recreateHunk() const; 0053 0054 private: 0055 Q_DECLARE_PRIVATE(DiffHunk) 0056 std::unique_ptr<DiffHunkPrivate> const d_ptr; 0057 }; 0058 0059 using DiffHunkList = QList<DiffHunk *>; 0060 using DiffHunkListIterator = QList<DiffHunk *>::iterator; 0061 using DiffHunkListConstIterator = QList<DiffHunk *>::const_iterator; 0062 0063 } // End of namespace KompareDiff2 0064 0065 #endif