1 // Created on: 2000-01-26
2 // Created by: Denis PASCAL
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <TDataStd_ChildNodeIterator.ixx>
18 #define ChildNodeIterator_UpToBrother \
20 while (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \
21 myNode = myNode->myFather; \
22 if (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \
23 myNode = myNode->myNext; \
28 //=======================================================================
29 //function : TDataStd_ChildNodeIterator
31 //=======================================================================
33 TDataStd_ChildNodeIterator::TDataStd_ChildNodeIterator()
37 //=======================================================================
38 //function : TDataStd_ChildNodeIterator
40 //=======================================================================
42 TDataStd_ChildNodeIterator::TDataStd_ChildNodeIterator (const Handle(TDataStd_TreeNode)& aTreeNode,
43 const Standard_Boolean allLevels)
44 : myNode(aTreeNode->myFirst),
45 myFirstLevel(allLevels ? aTreeNode->Depth() : -1)
48 //=======================================================================
49 //function : Initialize
51 //=======================================================================
53 void TDataStd_ChildNodeIterator::Initialize(const Handle(TDataStd_TreeNode)& aTreeNode,
54 const Standard_Boolean allLevels)
56 myNode = aTreeNode->myFirst;
57 myFirstLevel = allLevels ? aTreeNode->Depth() : -1;
60 //=======================================================================
63 //=======================================================================
65 void TDataStd_ChildNodeIterator::Next()
67 if (myFirstLevel == -1) {
68 myNode = myNode->myNext;
71 if (myNode->myFirst != NULL) myNode = myNode->myFirst;
72 else ChildNodeIterator_UpToBrother;
76 //=======================================================================
77 //function : NextBrother
79 //=======================================================================
81 void TDataStd_ChildNodeIterator::NextBrother()
83 if (myNode->myNext != NULL) myNode = myNode->myNext;
84 else ChildNodeIterator_UpToBrother;