12#include <komparediff2_logging.h>
16DiffHunk::DiffHunk(
int sourceLine,
int destinationLine,
const QString &function, Type type)
17 : d_ptr(new DiffHunkPrivate(sourceLine, destinationLine, function,
type))
21DiffHunk::~DiffHunk() =
default;
27 return d->differences;
30QString DiffHunk::function()
const
37int DiffHunk::sourceLineNumber()
const
44int DiffHunk::destinationLineNumber()
const
48 return d->destinationLine;
51DiffHunk::Type DiffHunk::type()
const
58void DiffHunk::setType(Type type)
69 d->differences.append(diff);
72int DiffHunk::sourceLineCount()
const
78 for (
const Difference *diff : d->differences) {
79 lineCount += diff->sourceLineCount();
85int DiffHunk::destinationLineCount()
const
91 for (
const Difference *diff : d->differences) {
92 lineCount += diff->destinationLineCount();
98QString DiffHunk::recreateHunk()
const
108 for (
const Difference *diff : d->differences) {
109 switch (diff->type()) {
110 case Difference::Unchanged:
111 case Difference::Change:
112 slc += diff->sourceLineCount();
113 dlc += diff->destinationLineCount();
115 case Difference::Insert:
116 dlc += diff->destinationLineCount();
118 case Difference::Delete:
119 slc += diff->sourceLineCount();
122 differences += diff->recreateDifference();
126 hunk += QStringLiteral(
"@@ -%1,%3 +%2,%4 @@").
arg(d->sourceLine).
arg(d->destinationLine).
arg(slc).
arg(dlc);
128 if (!d->function.isEmpty())
135 qCDebug(KOMPAREDIFF2_LOG) << hunk;
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
QString arg(Args &&... args) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:54:52 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.