blob: 735b1e7bdea740f5d63bf073ce8665a596c09246 (
plain)
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
|
/* { dg-do compile } */
typedef int PRInt32;
class nsTreeRows {
class Subtree { };
enum { kMaxDepth = 32 };
struct Link {
Subtree* mParent;
PRInt32 mChildIndex;
Link& operator=(const Link& aLink) {
mParent = aLink.mParent;
mChildIndex = aLink.mChildIndex;
}
};
class iterator {
PRInt32 mTop;
PRInt32 mRowIndex;
Link mLink[kMaxDepth];
public:
iterator() : mTop(-1), mRowIndex(-1) { }
iterator& operator=(const iterator& aIterator);
};
Subtree* EnsureSubtreeFor(Subtree* aParent, PRInt32 aChildIndex);
Subtree* GetSubtreeFor(const Subtree* aParent,
PRInt32 aChildIndex, PRInt32* aSubtreeSize = 0);
void InvalidateCachedRow() {
mLastRow = iterator();
}
iterator mLastRow;
};
nsTreeRows::Subtree* nsTreeRows::EnsureSubtreeFor(Subtree* aParent,
PRInt32 aChildIndex) {
Subtree* subtree = GetSubtreeFor(aParent, aChildIndex);
if (! subtree) {
InvalidateCachedRow();
}
}
nsTreeRows::iterator& nsTreeRows::iterator::operator=(const iterator&
aIterator) {
mTop = aIterator.mTop;
for (PRInt32 i = mTop;
i >= 0;
--i) mLink[i] = aIterator.mLink[i];
}
|