1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: SALOMEDSImpl_ChildNodeIterator.cxx
21 // Created: Wed Jan 26 16:43:08 2000
22 // Author: Denis PASCAL
23 // <dp@dingox.paris1.matra-dtv.fr>
26 #include <SALOMEDSImpl_ChildNodeIterator.hxx>
28 #define ChildNodeIterator_UpToBrother \
30 while (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \
31 myNode = myNode->myFather; \
32 if (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \
33 myNode = myNode->myNext; \
38 //=======================================================================
39 //function : SALOMEDSImpl_ChildNodeIterator
41 //=======================================================================
42 SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator()
46 //=======================================================================
47 //function : SALOMEDSImpl_ChildNodeIterator
49 //=======================================================================
51 SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode,
52 const Standard_Boolean allLevels)
53 : myNode(aNode->myFirst),
54 myFirstLevel(allLevels ? aNode->Depth() : -1)
57 //=======================================================================
58 //function : Initialize
60 //=======================================================================
62 void SALOMEDSImpl_ChildNodeIterator::Initialize(const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode,
63 const Standard_Boolean allLevels)
65 myNode = aNode->myFirst;
66 myFirstLevel = allLevels ? aNode->Depth() : -1;
69 //=======================================================================
72 //=======================================================================
74 void SALOMEDSImpl_ChildNodeIterator::Next()
76 if (myFirstLevel == -1) {
77 myNode = myNode->myNext;
80 if (myNode->myFirst != NULL) myNode = myNode->myFirst;
81 else ChildNodeIterator_UpToBrother;
85 //=======================================================================
86 //function : NextBrother
88 //=======================================================================
90 void SALOMEDSImpl_ChildNodeIterator::NextBrother()
92 if (myNode->myNext != NULL) myNode = myNode->myNext;
93 else ChildNodeIterator_UpToBrother;