MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / FileDiff

Method FileDiff

MiniZincIDE/history.cpp:9–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include <QUuid>
8
9FileDiff::FileDiff(const QString& origText, const QString& newText):
10 _orig(origText.split("\n")),
11 _new(newText.split("\n"))
12{
13 _offset = 0;
14 _origLength = _orig.size();
15 _newLength = _new.size();
16
17 // Trim start lines if same
18 while (_offset < _orig.size() - 1 && _offset < _new.size() - 1 && _orig[_offset] == _new[_offset]) {
19 _offset++;
20 _origLength--;
21 _newLength--;
22 }
23
24 // Trim end lines if same
25 while (_origLength > 0 && _newLength > 0 && _orig[_offset + _origLength - 1] == _new[_offset + _newLength - 1]) {
26 _origLength--;
27 _newLength--;
28 }
29}
30
31QVector<FileDiff::Entry> FileDiff::diff()
32{

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected