User:PerfektesChaos/WikidiffLX/coding/WikidiffLX.cpp

Based on wikidiff2/wikidiff2.cpp (rev 83886 Mar 2011).

Declarations in WikidiffLX.h


 * Renamed following the new generation name
 * Added many methods

execute
Based on wikidiff2 with following changes: Major task controlling line separation, diff engine, postprocessing engine result, formatting HTML.
 * merged with former diffLines
 * delegating HTML output to printLines

diffResult
New methodology for postprocessing of virtual lines. Result of engine is transferred from LineDiff into Line objects. Note that the two LineVector collections are accessed by their pointers in DiffOp.

The block structure of combined op codes in LineDiff is part of the engine algorithm, located deep inside. That should not be changed. It would affect Word presentation as well as possible exchange of the engine. The Diff object does not permit array manipulation. The least confusing way is to transfer the engine result into the Line objects.

diffWhitespace
New methodology for trailing whitespace at end of line and invisible trailing lines. Major part of work is done within Line objects.

Note that this is called once for from only but does affect the to counterparts also.

explodeLines
Based on explodeLines in wikidiff2 but recognizing breaks of virtual lines. Detect invisible trailing lines, separate from lines with visible content and hide them in Line objects.

Usage of allocated String for line text replaced by iterators.

explodeWords
Based on explodeWords in wikidiff2 but completely rewritten and accelerated. Handling of Unicode spaces introduced. Thai processing started only if really Thai character. Every CJK symbol is treated as single word now.

Not yet included:
 * 107135 possible future direction: ICU.

explodeWordsThai
Re-written procedure for handling of substring containing thai characters only in Thai line splitting into words within explodeWords.

findVirtualBreak
New method for detection of breaks of virtual lines within explodeLines.

nextUtf8Char
Based on wikidiff2 but demanding 32bit characters explicitly.

printLines
Mainly new code for the presentation of paragraphs. The respective diffLines procedure in wikidiff2 is replaced by printLines</tt>. Handling of virtual line sequences is implemented by filling table cells until hard break encountered. Trailing invisible lines are discovered and presented as table cells where necessary.

printText
Based on wikidiff2.
 * Use printText</tt> unchanged.
 * Added printTextRed</tt> basically like printText</tt> but visualize zero-width differences within a red word.

printWordDiff
Based on wikidiff2.
 * Added printWordDiffSideBlack</tt>
 * Modified printWordDiffSide</tt> to reflect whether both adjacent words are black and shall present whitespace differences.

recoverParagraphs
New methodology for postprocessing of virtual lines.
 * Precondition: virtual lines might change op code within paragraph
 * Postcondition: every paragraph has a unique op code