Quark
0.1
|
TODO: rewrite comment A DiffChunk maps a DiffRange in one DiffSequence (the "base") to a corresponding DiffRange in one or two other files ("theirs" and "yours"). More...
#include <DiffChunk.h++>
Public Types | |
enum | Type { TYPE_UNCHANGED, TYPE_INSERT, TYPE_DELETE, TYPE_CHANGED, TYPE_CONFLICT } |
Public Member Functions | |
DiffChunk () | |
DiffChunk (const DiffRange &baseRange, const DiffRange &yoursRange, bool yoursModified) | |
DiffChunk (const DiffRange &baseRange, const DiffRange &yoursRange, bool yoursModified, const DiffRange &theirsRange, bool theirsModified, bool conflict) | |
~DiffChunk () | |
Type | type (DiffRole role, DiffDirection dir) const |
bool | isUnchanged () const |
bool | isModified (DiffRole destination) const |
bool | isBothModified () const |
bool | isConflict () const |
const DiffRange & | baseRange () const |
DiffRange & | baseRange () |
const DiffRange & | sourceRange () const |
DiffRange & | sourceRange () |
const DiffRange & | destinationRange () const |
DiffRange & | destinationRange () |
const DiffRange & | yoursRange () const |
DiffRange & | yoursRange () |
const DiffRange & | theirsRange () const |
DiffRange & | theirsRange () |
const DiffRange & | range (DiffRole role) const |
void | setSubDiff (DiffResult *subDiff) |
const DiffResult * | subDiff () const |
TODO: rewrite comment A DiffChunk maps a DiffRange in one DiffSequence (the "base") to a corresponding DiffRange in one or two other files ("theirs" and "yours").
For a two-way merge, the "base range" is the DiffRange in the "old" sequence, and the "yours range" in the DiffRange in the "new" sequence.
For a three-way merge, the "base" range is the DiffRange in the "base" sequence, and the "yours range" and "theirs range" are the DiffRanges in the "yours" and "theirs" sequences.
In addition to the two or three DiffRanges, the DiffChunk also has three boolean flags that indicate how the subsequences defined by the two or three DiffRanges relate to each other:
yours_modified_ - Indicates whether the range of elements in "yours" differs from the range of elements in "base". theirs_modified_ - Indicates whether the range of elements in "theirs" differs form the range of elements in "base". conflict_ - Indicates whether the range of elements in "theirs" differs from the range of elements in "yours".
Using these flags, and the lengths of the element ranges, it is possible to deduce the type of edit that occurred. For example: if yours_modified_ is true, theirs_modified_ is false, conflict_ is (necessarily) false, the base range is empty, the theirs range is (necessarily) empty, and the yours range is non-empty, then the chunk represents an insert of one or more new elements in "yours".
enum Type |
DiffChunk | ( | ) |
DiffChunk | ( | const DiffRange & | baseRange, |
const DiffRange & | yoursRange, | ||
bool | yoursModified, | ||
const DiffRange & | theirsRange, | ||
bool | theirsModified, | ||
bool | conflict | ||
) |
~DiffChunk | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool isModified | ( | DiffRole | destination | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Type type | ( | DiffRole | role, |
DiffDirection | dir | ||
) | const |
|
inline |
|
inline |