21 template <
class _Type>
33 bool AddNode (_Type *lpParent, _Type *lpNode);
40 bool InsertNode (_Type *lpParent, _Type *lpPrevSibling, _Type *lpNode);
44 bool DeleteNode (_Type *lpNode,
bool bCallDelete =
false);
50 bool Clear (
bool bCallDelete =
false);
60 #define DTI_EXCLUDEROOT 0x00000001 // root will be excluded from traversing
61 #define DTI_ONLYLEAVES 0x00000002 // traverse only leaves
62 #define DTI_ONELAYERTRAVERSAL 0x00000004
70 template <
class _Type>
137 template <
class _Type>
140 _Type *tmp = lpParent;
141 unsigned long dw = 0;
150 template <
class _Type>
157 template <
class _Type>
164 template <
class _Type>
169 lpNode->lpParent = lpParent;
170 lpNode->lpChild = NULL;
171 lpNode->lpPrev = NULL;
174 lpNode->lpNext = lpParent->lpChild;
175 if (lpParent->lpChild)
176 lpParent->lpChild->lpPrev = lpNode;
177 lpParent->lpChild = lpNode;
179 lpNode->lpNext = lpRoot;
181 lpRoot->lpPrev = lpNode;
190 template <
class _Type>
195 lpNode->lpParent = lpParent;
196 lpNode->lpChild = NULL;
197 lpNode->lpPrev = NULL;
198 lpNode->lpNext = NULL;
201 if (!lpParent->lpChild) {
202 lpParent->lpChild = lpNode;
204 _Type *child = lpParent->lpChild;
205 while (child->lpNext)
206 child = child->lpNext;
207 child->lpNext = lpNode;
208 lpNode->lpPrev = child;
214 _Type *child = lpRoot;
215 while (child->lpNext)
216 child = child->lpNext;
217 child->lpNext = lpNode;
218 lpNode->lpPrev = child;
227 template <
class _Type>
230 if (NULL == lpPrevSibling)
231 return AddNode (lpParent, lpNode);
235 lpNode->lpParent = lpParent;
236 lpNode->lpChild = NULL;
237 lpNode->lpPrev = lpPrevSibling;
238 lpNode->lpNext = lpPrevSibling->lpNext;
239 if (lpPrevSibling->lpNext)
240 lpPrevSibling->lpNext->lpPrev = lpNode;
241 lpPrevSibling->lpNext = lpNode;
248 template <
class _Type>
252 if (lpNode->lpParent) {
253 if (lpNode->lpParent->lpChild == lpNode)
254 lpNode->lpParent->lpChild = lpNode->lpNext;
257 while (lpNode->lpChild) {
258 if (!DeleteNode (lpNode->lpChild, bCallDelete))
263 lpNode->lpPrev->lpNext = lpNode->lpNext;
266 lpNode->lpNext->lpPrev = lpNode->lpPrev;
268 if (lpNode == lpRoot)
269 lpRoot = lpNode->lpNext;
279 if (!DeleteNode (lpRoot, bCallDelete))
290 template <
class _Type>
293 return DeleteNode (NULL, bCallDelete);
297 template <
class _Type>
300 nodeStart = _lpTravStart;
308 nodePtr = nodeStart->lpChild;
313 nodePtr = tree->GetRoot ();
322 template <
class _Type>
325 if (!bStarting && !nodePtr)
330 nodePtr = nodePtr->lpNext;
332 while (nodePtr && !IsNodeAllowed (nodePtr))
333 nodePtr = nodePtr->lpNext;
338 unsigned long dwState = 1;
342 if (nodePtr->lpChild && IsSubTreeAllowed (nodePtr))
343 nodePtr = nodePtr->lpChild;
345 while (nodePtr && !nodePtr->lpNext) {
346 if (nodePtr == nodeStart) {
350 nodePtr = nodePtr->lpParent;
352 if (nodePtr == nodeStart) {
357 nodePtr = nodePtr->lpNext;
364 if (IsNodeAllowed (nodePtr))
374 template <
class _Type>