KompareDiff2

diffhunk.h
1 /*
2 SPDX-FileCopyrightText: 2001-2004,2009 Otto Bruggeman <[email protected]>
3 SPDX-FileCopyrightText: 2001-2003 John Firebaugh <[email protected]>
4 
5 SPDX-License-Identifier: GPL-2.0-or-later
6 */
7 
8 #ifndef DIFFHUNK_H
9 #define DIFFHUNK_H
10 
11 #include "difference.h"
12 
13 
14 namespace Diff2
15 {
16 
17 class Difference;
18 
19 /**
20  * DiffHunk
21  */
22 class DiffHunk
23 {
24 public:
25  enum Type { Normal, AddedByBlend };
26 
27 public:
28  DiffHunk(int sourceLine, int destinationLine, const QString& function = QString(), Type type = Normal);
29  ~DiffHunk();
30 
31  const DifferenceList& differences() const { return m_differences; };
32  const QString& function() const { return m_function; };
33 
34  int sourceLineNumber() const { return m_sourceLine; };
35  int destinationLineNumber() const { return m_destinationLine; };
36 
37  int sourceLineCount() const;
38  int destinationLineCount() const;
39 
40  Type type() const { return m_type; }
41  void setType(Type type) { m_type = type; }
42 
43  void add(Difference* diff);
44 
45  QString recreateHunk() const;
46 
47 private:
48  int m_sourceLine;
49  int m_destinationLine;
50  DifferenceList m_differences;
51  QString m_function;
52  Type m_type;
53 };
54 
56 using DiffHunkListIterator = QList<DiffHunk*>::iterator;
57 using DiffHunkListConstIterator = QList<DiffHunk*>::const_iterator;
58 
59 } // End of namespace Diff2
60 
61 #endif
Diff2 namespace.
Definition: cvsdiffparser.h:12
DiffHunk.
Definition: diffhunk.h:22
A difference.
Definition: difference.h:119
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Dec 4 2022 03:52:11 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.