9#include "difference_p.h"
12#include "differencestringpair.h"
13#include "levenshteintable.h"
17Difference::Difference(
int sourceLineNo,
int destinationLineNo,
int type)
18 : d_ptr(new DifferencePrivate(sourceLineNo, destinationLineNo,
type))
22Difference::~Difference() =
default;
24int Difference::type()
const
31int Difference::sourceLineNumber()
const
35 return d->sourceLineNo;
38int Difference::destinationLineNumber()
const
42 return d->destinationLineNo;
49 return d->trackingDestinationLineNo;
52void Difference::setTrackingDestinationLineNumber(
int i)
56 d->trackingDestinationLineNo = i;
63 return d->sourceLines[i];
70 return d->destinationLines[i];
77 return d->sourceLines;
84 return d->destinationLines;
87bool Difference::hasConflict()
const
94void Difference::setConflict(
bool conflicts)
98 d->conflicts = conflicts;
101bool Difference::isUnsaved()
const
108void Difference::setUnsaved(
bool unsaved)
112 d->unsaved = unsaved;
115bool Difference::applied()
const
122void Difference::setType(
int type)
129void Difference::addSourceLine(
const QString &line)
136void Difference::addDestinationLine(
const QString &line)
143int Difference::sourceLineCount()
const
147 return d->sourceLines.count();
150int Difference::destinationLineCount()
const
154 return d->destinationLines.count();
157int Difference::sourceLineEnd()
const
161 return d->sourceLineNo + d->sourceLines.count();
164int Difference::destinationLineEnd()
const
168 return d->destinationLineNo + d->destinationLines.count();
171int Difference::trackingDestinationLineEnd()
const
175 return d->trackingDestinationLineNo + d->destinationLines.count();
178void Difference::apply(
bool apply)
182 if (apply == d->applied) {
187 d->unsaved = !d->unsaved;
188 Q_EMIT differenceApplied(
this);
195 if (d->applied == apply) {
199 d->unsaved = !d->unsaved;
207 if (d->type != Difference::Change)
213 int slc = sourceLineCount();
215 if (slc != destinationLineCount())
220 for (
int i = 0; i < slc; ++i) {
223 DifferenceStringPair *pair =
new DifferenceStringPair(sl, dl);
227 table.createListsOfMarkers();
231QString Difference::recreateDifference()
const
251 difference += diffString->string();
268 difference += diffString->string();
274#include "moc_difference.cpp"
void determineInlineDifferences()
This method will calculate the differences between the individual strings and store them as Markers.
void applyQuietly(bool apply)
Apply without emitting any signals.
int trackingDestinationLineNumber() const
Destination line number that tracks applying/unapplying of other differences Essentially a line numbe...
Computes the Levenshtein distance between two sequences.
unsigned int createTable(SequencePair *sequences)
This calculates the levenshtein distance of 2 sequences.
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)