Commit b7b1f1c7 authored by Michael Reeves's avatar Michael Reeves

Make Diff members private

parent ec286251
This diff is collapsed.
......@@ -57,18 +57,29 @@ enum e_MergeDetails
// Then again range of matching elements should follow.
class Diff
{
public:
qint32 nofEquals;
qint64 diff1;
qint64 diff2;
private:
qint32 nofEquals = 0;
Diff(qint32 eq, qint64 d1, qint64 d2)
qint64 mDiff1 = 0;
qint64 mDiff2 = 0;
public:
Diff(qint32 eq, const qint64 inDiff1, const qint64 inDiff2)
{
nofEquals = eq;
diff1 = d1;
diff2 = d2;
mDiff1 = inDiff1;
mDiff2 = inDiff2;
}
inline qint32 numberOfEquals() const { return nofEquals; };
inline qint64 diff1() const { return mDiff1; };
inline qint64 diff2() const { return mDiff2; };
inline void setNumberOfEquals(const qint32 inNumOfEquals) { nofEquals = inNumOfEquals; }
inline void adjustNumberOfEquals(const qint64 delta) { mDiff2 += delta; }
inline void adjustDiff1(const qint64 delta) { mDiff1 += delta; }
inline void adjustDiff2(const qint64 delta) { mDiff2 += delta; }
};
typedef std::list<Diff> DiffList;
......
......@@ -32,25 +32,25 @@ Merger::MergeData::MergeData(const DiffList* p, int i)
bool Merger::MergeData::eq()
{
return pDiffList == nullptr || d.nofEquals > 0;
return pDiffList == nullptr || d.numberOfEquals() > 0;
}
bool Merger::MergeData::isEnd()
{
return (pDiffList == nullptr || (it == pDiffList->end() && d.nofEquals == 0 &&
(idx == 0 ? d.diff1 == 0 : d.diff2 == 0)));
return (pDiffList == nullptr || (it == pDiffList->end() && d.numberOfEquals() == 0 &&
(idx == 0 ? d.diff1() == 0 : d.diff2() == 0)));
}
void Merger::MergeData::update()
{
if(d.nofEquals > 0)
--d.nofEquals;
else if(idx == 0 && d.diff1 > 0)
--d.diff1;
else if(idx == 1 && d.diff2 > 0)
--d.diff2;
if(d.numberOfEquals() > 0)
d.adjustNumberOfEquals(-1);
else if(idx == 0 && d.diff1() > 0)
d.adjustDiff1(-1);
else if(idx == 1 && d.diff2() > 0)
d.adjustDiff2(-1);
while(d.nofEquals == 0 && ((idx == 0 && d.diff1 == 0) || (idx == 1 && d.diff2 == 0)) && pDiffList != nullptr && it != pDiffList->end())
while(d.numberOfEquals() == 0 && ((idx == 0 && d.diff1() == 0) || (idx == 1 && d.diff2() == 0)) && pDiffList != nullptr && it != pDiffList->end())
{
d = *it;
++it;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment