#include <Tools/Widgets/textdifferencer.h>
◆ TextDifferencer()
◆ bisect()
QList< TextDifference > bisect |
( |
const QString & |
text1, |
|
|
const QString & |
text2, |
|
|
clock_t |
deadline |
|
) |
| |
|
protected |
Find the 'middle snake' of a diff, split the problem in two and return the recursively constructed diff. See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
- Parameters
-
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
deadline | Operation returns if this time is reached (comparison with clock()>deadline) |
- Returns
- List of TextDifference objects.
◆ cleanupEfficiency()
Reduce the number of edits by eliminating operationally trivial equalities.
- Parameters
-
diffs | LinkedList of Diff objects. |
◆ cleanupMerge()
Reorder and merge like edit sections. Merge equalities. Any edit section can move as long as it doesn't cross an equality.
- Parameters
-
diffs | LinkedList of Diff objects. |
◆ cleanupSemantic()
Reduce the number of edits by eliminating semantically trivial equalities.
- Parameters
-
◆ cleanupSemanticLossless()
◆ compareLines()
QMap< int, StringHighlights > compareLines |
( |
int |
keyA, |
|
|
int |
keyB, |
|
|
const QString & |
stringA, |
|
|
const QString & |
stringB |
|
) |
| |
|
static |
◆ findCommonOverlap()
int findCommonOverlap |
( |
const QString & |
text1, |
|
|
const QString & |
text2 |
|
) |
| |
|
protected |
Determine if the suffix of one string is the prefix of another.
- Parameters
-
text1 | First string. |
text2 | Second string. |
- Returns
- The number of characters common to the end of the first string and the start of the second string.
◆ findCommonPrefix()
int findCommonPrefix |
( |
const QString & |
text1, |
|
|
const QString & |
text2 |
|
) |
| |
Determine the common prefix of two strings.
- Parameters
-
text1 | First string. |
text2 | Second string. |
- Returns
- The number of characters common to the start of each string.
◆ findCommonSuffix()
int findCommonSuffix |
( |
const QString & |
text1, |
|
|
const QString & |
text2 |
|
) |
| |
Determine the common suffix of two strings.
- Parameters
-
text1 | First string. |
text2 | Second string. |
- Returns
- The number of characters common to the end of each string.
◆ findDifferences() [1/2]
QList< TextDifference > findDifferences |
( |
const QString & |
text1, |
|
|
const QString & |
text2 |
|
) |
| |
Find the differences between two texts. Run a faster slightly less optimal diff. This method allows the 'checklines' of diff_main() to be optional. Most of the time checklines is wanted, so default to true.
- Parameters
-
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
- Returns
- List of TextDifference objects.
◆ findDifferences() [2/2]
QList< TextDifference > findDifferences |
( |
const QString & |
text1, |
|
|
const QString & |
text2, |
|
|
bool |
checklines |
|
) |
| |
Find the differences between two texts.
- Parameters
-
text1 | Old string to be diffed. |
text2 | New string to be diffed. |
checklines | Speedup flag. If false, then don't run a line -level diff first to identify the changed areas. If true, then run a faster slightly less optimal diff. |
- Returns
- List of TextDifference objects.
◆ halfMatch()
QStringList halfMatch |
( |
const QString & |
text1, |
|
|
const QString & |
text2 |
|
) |
| |
|
protected |
Do the two texts share a substring which is at least half the length of the longer text? This speedup can produce non-minimal diffs.
- Parameters
-
text1 | First string. |
text2 | Second string. |
- Returns
- Five element String array, containing the prefix of text1, the suffix of text1, the prefix of text2, the suffix of text2 and the common middle. Or null if there was no match.
◆ linesToChars()
QList< QVariant > linesToChars |
( |
const QString & |
text1, |
|
|
const QString & |
text2 |
|
) |
| |
|
protected |
Split two texts into a list of strings. Reduce the texts to a string of hashes where each Unicode character represents one line.
- Parameters
-
text1 | First string. |
text2 | Second string. |
- Returns
- Three element Object array, containing the encoded text1, the encoded text2 and the List of unique strings. The zeroth element of the List of unique strings is intentionally blank.
◆ diffEditCost_
◆ diffTimeout_