Add default arg to Diff ctor

Change-Id: I97d4b99250d55216ef866f7529ca423e2133db09
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
jkobus
2014-01-16 14:52:37 +01:00
committed by Jarek Kobus
parent a74b59ffd6
commit 096bc3b0e1
2 changed files with 4 additions and 4 deletions

View File

@@ -516,7 +516,7 @@ QList<Diff> Differ::diffNonCharMode(const QString text1, const QString text2)
for (int i = 0; i <= diffList.count(); i++) { for (int i = 0; i <= diffList.count(); i++) {
const Diff diffItem = i < diffList.count() const Diff diffItem = i < diffList.count()
? diffList.at(i) ? diffList.at(i)
: Diff(Diff::Equal, QLatin1String("")); // dummy, ensure we process to the end even when diffList doesn't end with equality : Diff(Diff::Equal); // dummy, ensure we process to the end even when diffList doesn't end with equality
if (diffItem.command == Diff::Delete) { if (diffItem.command == Diff::Delete) {
lastDelete += diffItem.text; lastDelete += diffItem.text;
} else if (diffItem.command == Diff::Insert) { } else if (diffItem.command == Diff::Insert) {
@@ -605,7 +605,7 @@ QList<Diff> Differ::merge(const QList<Diff> &diffList)
for (int i = 0; i <= diffList.count(); i++) { for (int i = 0; i <= diffList.count(); i++) {
Diff diff = i < diffList.count() Diff diff = i < diffList.count()
? diffList.at(i) ? diffList.at(i)
: Diff(Diff::Equal, QString()); // dummy, ensure we process to the end even when diffList doesn't end with equality : Diff(Diff::Equal); // dummy, ensure we process to the end even when diffList doesn't end with equality
if (diff.command == Diff::Delete) { if (diff.command == Diff::Delete) {
lastDelete += diff.text; lastDelete += diff.text;
} else if (diff.command == Diff::Insert) { } else if (diff.command == Diff::Insert) {
@@ -685,7 +685,7 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
for (int i = 0; i <= diffList.count(); i++) { for (int i = 0; i <= diffList.count(); i++) {
Diff diff = i < diffList.count() Diff diff = i < diffList.count()
? diffList.at(i) ? diffList.at(i)
: Diff(Diff::Equal, QString()); // dummy, ensure we process to the end even when diffList doesn't end with equality : Diff(Diff::Equal); // dummy, ensure we process to the end even when diffList doesn't end with equality
if (diff.command == Diff::Equal) { if (diff.command == Diff::Equal) {
if (!equalities.isEmpty()) { if (!equalities.isEmpty()) {
EqualityData &previousData = equalities.last(); EqualityData &previousData = equalities.last();

View File

@@ -50,7 +50,7 @@ public:
}; };
Command command; Command command;
QString text; QString text;
Diff(Command com, const QString &txt); Diff(Command com, const QString &txt = QString());
Diff(); Diff();
bool operator==(const Diff &other) const; bool operator==(const Diff &other) const;
bool operator!=(const Diff &other) const; bool operator!=(const Diff &other) const;