forked from WinMerge/winmerge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiffItemList.h
65 lines (57 loc) · 1.95 KB
/
DiffItemList.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @file DiffItemList.h
*
* @brief Declaration of DiffItemList
*/
#pragma once
#include "DiffItem.h"
/**
* @brief List of DIFFITEMs in folder compare.
* This class holds a list of items we have in the folder compare. Basically
* we have a linked list of DIFFITEMs. But there is a structure that follows
* the actual folder structure. Each DIFFITEM can have a parent folder and
* another list of child items. Parent DIFFITEM is always a folder item.
*/
class DiffItemList
{
public:
DiffItemList();
~DiffItemList();
// add & remove differences
DIFFITEM *AddNewDiff(DIFFITEM *parent);
void RemoveAll();
void InitDiffItemList();
void ClearAllAdditionalProperties();
// to iterate over all differences on list
DIFFITEM *GetFirstDiffPosition() const;
DIFFITEM *GetFirstChildDiffPosition(const DIFFITEM *par) const;
const DIFFITEM &GetNextDiffPosition(DIFFITEM *&diffpos) const;
DIFFITEM &GetNextDiffRefPosition(DIFFITEM *&diffpos);
const DIFFITEM &GetNextSiblingDiffPosition(DIFFITEM *&diffpos) const;
DIFFITEM &GetNextSiblingDiffRefPosition(DIFFITEM *&diffpos);
const DIFFITEM &GetDiffAt(DIFFITEM *diffpos) const;
DIFFITEM &GetDiffRefAt(DIFFITEM *diffpos);
void SetDiffStatusCode(DIFFITEM *diffpos, unsigned diffcode, unsigned mask);
void SetDiffCounts(DIFFITEM *diffpos, unsigned diffs, unsigned ignored);
unsigned GetCustomFlags1(DIFFITEM *diffpos) const;
void SetCustomFlags1(DIFFITEM *diffpos, unsigned flag);
void Swap(int idx1, int idx2);
protected:
DIFFITEM* m_pRoot; /**< Root of list of diffitems; initially `nullptr`. */
};
/**
* @brief Get copy of Diff Item at given position in difflist.
* @param diffpos position of item to return
*/
inline const DIFFITEM &DiffItemList::GetDiffAt(DIFFITEM *diffpos) const
{
return *diffpos;
}
/**
* @brief Get Diff Item (by reference) at given position in difflist.
* @param diffpos position of item to return
*/
inline DIFFITEM &DiffItemList::GetDiffRefAt(DIFFITEM *diffpos)
{
return *diffpos;
}