* @brief Default constructor, initialises difflist to 64 items.
*/
DiffList::DiffList()
+: m_firstSignificant(-1)
+, m_lastSignificant(-1)
{
m_diffs.SetSize(64);
- m_firstSignificant = -1;
- m_lastSignificant = -1;
}
/**
* count includes significant and non-significant diffs.
* @note Use GetSignificantDiffs() to get count of non-ignored diffs.
*/
-int DiffList::GetSize()
+int DiffList::GetSize() const
{
return m_diffs.GetSize();
}
* @brief Returns count of significant diffs in the list.
* This function returns total count of significant diffs in list. So returned
* count doesn't include non-significant diffs.
+ * @return Count of significant differences.
*/
int DiffList::GetSignificantDiffs() const
{
}
/**
- * @brief Sets size of diff list.
- */
-void DiffList::SetSize(UINT nSize)
-{
- m_diffs.SetSize(nSize);
-}
-
-/**
- * @brief Adds given diff to end of list.
+ * @brief Adds given diff to end of the list.
+ * Adds given difference to end of the list (append).
+ * @param [in] di Difference to add.
*/
-void DiffList::AddDiff(DIFFRANGE di)
+void DiffList::AddDiff(const DIFFRANGE & di)
{
DiffRangeInfo dri(di);
m_diffs.Add(dri);
/**
* @brief Checks if diff in given list index is significant or not.
- * @param [in] nDiff Index of DIFFITEM to check.
- * @return TRUE if diff is significant.
+ * @param [in] nDiff Index of DIFFRANGE to check.
+ * @return TRUE if diff is significant, FALSE if not.
*/
BOOL DiffList::IsDiffSignificant(int nDiff) const
{
/**
* @brief Returns copy of DIFFRANGE from diff-list.
- * @param [in] nDiff Index of DIFFITEM to return.
- * @param [out] di DIFFITEM returned (empty if error)
- * @return TRUE if DIFFITEM found from given index.
+ * @param [in] nDiff Index of DIFFRANGE to return.
+ * @param [out] di DIFFRANGE returned (empty if error)
+ * @return TRUE if DIFFRANGE found from given index.
*/
-BOOL DiffList::GetDiff(int nDiff, DIFFRANGE &di) const
+BOOL DiffList::GetDiff(int nDiff, DIFFRANGE & di) const
{
const DIFFRANGE * dfi = DiffRangeAt(nDiff);
if (!dfi)
}
/**
- * @brief Return (const) pointer to DIFFRANGE entry requested
+ * @brief Return constant pointer to requested diff.
+ * This function returns constant pointer to DIFFRANGE at given index.
+ * @param [in] nDiff Index of DIFFRANGE to return.
+ * @return Constant pointer to DIFFRANGE.
*/
const DIFFRANGE * DiffList::DiffRangeAt(int nDiff) const
{
/**
* @brief Replaces diff in list in given index with given diff.
- *
* @param [in] nDiff Index (0-based) of diff to be replaced
* @param [in] di Diff to put in list.
+ * @return TRUE if index was valid and diff put to list.
*/
-BOOL DiffList::SetDiff(int nDiff, DIFFRANGE di)
+BOOL DiffList::SetDiff(int nDiff, const DIFFRANGE & di)
{
if (nDiff < m_diffs.GetSize())
{
* @brief Checks if line is inside given diff
* @param [in] nLine Linenumber to text buffer (not "real" number)
* @param [in] nDiff Index to diff table
+ * @return TRUE if line is inside given difference.
*/
BOOL DiffList::LineInDiff(UINT nLine, UINT nDiff) const
{
* @param [out] nDiff Index of diff found.
* @return TRUE if line is inside diff, FALSE otherwise.
*/
-BOOL DiffList::GetPrevDiff(int nLine, int &nDiff) const
+BOOL DiffList::GetPrevDiff(int nLine, int & nDiff) const
{
BOOL bInDiff = TRUE;
int numDiff = LineToDiff(nLine);
* @param [out] nDiff Index of diff found.
* @return TRUE if line is inside diff, FALSE otherwise.
*/
-BOOL DiffList::GetNextDiff(int nLine, int &nDiff) const
+BOOL DiffList::GetNextDiff(int nLine, int & nDiff) const
{
BOOL bInDiff = TRUE;
int numDiff = LineToDiff(nLine);
/**
* @brief Return previous diff index from given line.
* @param [in] nLine First line searched.
- * @return Index for next difference.
+ * @return Index for next difference or -1 if no difference is found.
*/
int DiffList::PrevSignificantDiffFromLine(UINT nLine) const
{
/**
* @brief Return next diff index from given line.
* @param [in] nLine First line searched.
- * @return Index for previous difference.
+ * @return Index for previous difference or -1 if no difference is found.
*/
int DiffList::NextSignificantDiffFromLine(UINT nLine) const
{
}
/**
- * @brief Return index to first significant diff.
+ * @brief Return index to first significant difference.
+ * @return Index of first significant difference.
*/
int DiffList::FirstSignificantDiff() const
{
/**
* @brief Return index of next significant diff.
* @param [in] nDiff Index to start looking for next diff.
+ * @return Index of next significant difference.
*/
int DiffList::NextSignificantDiff(int nDiff) const
{
/**
* @brief Return index of previous significant diff.
* @param [in] nDiff Index to start looking for previous diff.
+ * @return Index of previous significant difference.
*/
int DiffList::PrevSignificantDiff(int nDiff) const
{
/**
* @brief Return index to last significant diff.
+ * @return Index of last significant difference.
*/
int DiffList::LastSignificantDiff() const
{
}
/**
- * @brief Return pointer to first significant diff range
+ * @brief Return pointer to first significant diff.
+ * @return Constant pointer to first significant difference.
*/
const DIFFRANGE * DiffList::FirstSignificantDiffRange() const
{
}
/**
- * @brief Return pointer to last significant diff range
+ * @brief Return pointer to last significant diff.
+ * @return Constant pointer to last significant difference.
*/
const DIFFRANGE * DiffList::LastSignificantDiffRange() const
{
public:
DiffList();
void Clear();
- int GetSize();
+ int GetSize() const;
int GetSignificantDiffs() const;
- void SetSize(UINT nSize);
- void AddDiff(DIFFRANGE di);
+ void AddDiff(const DIFFRANGE & di);
BOOL IsDiffSignificant(int nDiff) const;
- BOOL GetDiff(int nDiff, DIFFRANGE &di) const;
- BOOL SetDiff(int nDiff, DIFFRANGE di);
+ BOOL GetDiff(int nDiff, DIFFRANGE & di) const;
+ BOOL SetDiff(int nDiff, const DIFFRANGE & di);
int LineRelDiff(UINT nLine, UINT nDiff) const;
BOOL LineInDiff(UINT nLine, UINT nDiff) const;
int LineToDiff(UINT nLine) const;
- BOOL GetPrevDiff(int nLine, int &nDiff) const;
- BOOL GetNextDiff(int nLine, int &nDiff) const;
+ BOOL GetPrevDiff(int nLine, int & nDiff) const;
+ BOOL GetNextDiff(int nLine, int & nDiff) const;
BOOL HasSignificantDiffs() const;
int PrevSignificantDiffFromLine(UINT nLine) const;
int NextSignificantDiffFromLine(UINT nLine) const;