|
Lines 48-54
Link Here
|
| 48 |
|
48 |
|
| 49 |
/** Returns a pointer to the parent node, or NULL if there is none. */ |
49 |
/** Returns a pointer to the parent node, or NULL if there is none. */ |
| 50 |
Sub *parent() const |
50 |
Sub *parent() const |
| 51 |
{ return static_cast<Sub*>(xparent); } |
51 |
{ return static_cast <Sub*>(this->xparent); } |
| 52 |
|
52 |
|
| 53 |
/** Reparents this node. */ |
53 |
/** Reparents this node. */ |
| 54 |
void setparent(Sub *parent) |
54 |
void setparent(Sub *parent) |
|
Lines 56-62
Link Here
|
| 56 |
|
56 |
|
| 57 |
/** Returns a pointer to the root node of the tree. */ |
57 |
/** Returns a pointer to the root node of the tree. */ |
| 58 |
Sub *root() const |
58 |
Sub *root() const |
| 59 |
{ return static_cast<Sub*>(Base::_root()); } |
59 |
{ return static_cast <Sub*>(Base::_root()); } |
| 60 |
|
60 |
|
| 61 |
/** |
61 |
/** |
| 62 |
* Returns full path of this node relative to an ancestor. |
62 |
* Returns full path of this node relative to an ancestor. |
|
Lines 93-105
Link Here
|
| 93 |
/** Removes and deletes all children of this node. */ |
93 |
/** Removes and deletes all children of this node. */ |
| 94 |
void zap() |
94 |
void zap() |
| 95 |
{ |
95 |
{ |
| 96 |
if (!xchildren) |
96 |
if (!(this->xchildren)) |
| 97 |
return; |
97 |
return; |
| 98 |
// set xchildren to NULL first so that the zap() will happen faster |
98 |
// set xchildren to NULL first so that the zap() will happen faster |
| 99 |
// otherwise, each child will attempt to unlink itself uselessly |
99 |
// otherwise, each child will attempt to unlink itself uselessly |
| 100 |
|
100 |
|
| 101 |
typename Base::Container *oldchildren = xchildren; |
101 |
typename Base::Container *oldchildren = this->xchildren; |
| 102 |
xchildren = NULL; |
102 |
this->xchildren = NULL; |
| 103 |
|
103 |
|
| 104 |
// delete all children |
104 |
// delete all children |
| 105 |
typename Base::Container::Iter i(*oldchildren); |
105 |
typename Base::Container::Iter i(*oldchildren); |