DiffEditor: Modernize

* Use member init
* Use nullptr
* Use range-for
* omit QLatin1{String|Char} where possible

Change-Id: Ib231b747cdd9073b3d4fc6779b8e0afb2b404a31
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Andre Hartmann
2017-12-06 21:30:57 +01:00
committed by André Hartmann
parent 53a151074a
commit aae3056b33
21 changed files with 436 additions and 474 deletions

View File

@@ -63,10 +63,10 @@ public:
Separator,
Invalid
};
TextLineData() : textLineType(Invalid) {}
TextLineData() {}
TextLineData(const QString &txt) : textLineType(TextLine), text(txt) {}
TextLineData(TextLineType t) : textLineType(t) {}
TextLineType textLineType;
TextLineType textLineType = Invalid;
QString text;
/*
* <start position, end position>
@@ -79,24 +79,23 @@ public:
class DIFFEDITOR_EXPORT RowData {
public:
RowData() : equal(false) {}
RowData() {}
RowData(const TextLineData &l)
: leftLine(l), rightLine(l), equal(true) {}
RowData(const TextLineData &l, const TextLineData &r)
: leftLine(l), rightLine(r), equal(false) {}
: leftLine(l), rightLine(r) {}
TextLineData leftLine;
TextLineData rightLine;
bool equal;
bool equal = false;
};
class DIFFEDITOR_EXPORT ChunkData {
public:
ChunkData() : contextChunk(false),
leftStartingLineNumber(0), rightStartingLineNumber(0) {}
ChunkData() {}
QList<RowData> rows;
bool contextChunk;
int leftStartingLineNumber;
int rightStartingLineNumber;
bool contextChunk = false;
int leftStartingLineNumber = 0;
int rightStartingLineNumber = 0;
QString contextInfo;
};
@@ -111,23 +110,15 @@ public:
RenameFile
};
FileData()
: fileOperation(ChangeFile),
binaryFiles(false),
lastChunkAtTheEndOfFile(false),
contextChunksIncluded(false) {}
FileData(const ChunkData &chunkData)
: fileOperation(ChangeFile),
binaryFiles(false),
lastChunkAtTheEndOfFile(false),
contextChunksIncluded(false) { chunks.append(chunkData); }
FileData() {}
FileData(const ChunkData &chunkData) { chunks.append(chunkData); }
QList<ChunkData> chunks;
DiffFileInfo leftFileInfo;
DiffFileInfo rightFileInfo;
FileOperation fileOperation;
bool binaryFiles;
bool lastChunkAtTheEndOfFile;
bool contextChunksIncluded;
FileOperation fileOperation = ChangeFile;
bool binaryFiles = false;
bool lastChunkAtTheEndOfFile = false;
bool contextChunksIncluded = false;
};
class DIFFEDITOR_EXPORT DiffUtils {