0026912: CLang 3.6.2 compiler warning [-Winconsistent-missing-override]
[occt.git] / src / TDataStd / TDataStd_ChildNodeIterator.cxx
CommitLineData
b311480e 1// Created on: 2000-01-26
2// Created by: Denis PASCAL
973c2be1 3// Copyright (c) 2000-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
42cf5bc1 16
17#include <TDataStd_ChildNodeIterator.hxx>
18#include <TDataStd_TreeNode.hxx>
7fd59977 19
20#define ChildNodeIterator_UpToBrother \
21{ \
22 while (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \
23 myNode = myNode->myFather; \
24 if (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \
25 myNode = myNode->myNext; \
26 else \
27 myNode = NULL; \
28}
29
30//=======================================================================
31//function : TDataStd_ChildNodeIterator
32//purpose :
33//=======================================================================
34
35TDataStd_ChildNodeIterator::TDataStd_ChildNodeIterator()
36 : myFirstLevel(0)
37{}
38
39//=======================================================================
40//function : TDataStd_ChildNodeIterator
41//purpose :
42//=======================================================================
43
44TDataStd_ChildNodeIterator::TDataStd_ChildNodeIterator (const Handle(TDataStd_TreeNode)& aTreeNode,
45 const Standard_Boolean allLevels)
46: myNode(aTreeNode->myFirst),
47 myFirstLevel(allLevels ? aTreeNode->Depth() : -1)
48{}
49
50//=======================================================================
51//function : Initialize
52//purpose :
53//=======================================================================
54
55void TDataStd_ChildNodeIterator::Initialize(const Handle(TDataStd_TreeNode)& aTreeNode,
56 const Standard_Boolean allLevels)
57{
58 myNode = aTreeNode->myFirst;
59 myFirstLevel = allLevels ? aTreeNode->Depth() : -1;
60}
61
62//=======================================================================
63//function : Next
64//purpose :
65//=======================================================================
66
67void TDataStd_ChildNodeIterator::Next()
68{
69 if (myFirstLevel == -1) {
70 myNode = myNode->myNext;
71 }
72 else {
73 if (myNode->myFirst != NULL) myNode = myNode->myFirst;
74 else ChildNodeIterator_UpToBrother;
75 }
76}
77
78//=======================================================================
79//function : NextBrother
80//purpose :
81//=======================================================================
82
83void TDataStd_ChildNodeIterator::NextBrother()
84{
85 if (myNode->myNext != NULL) myNode = myNode->myNext;
86 else ChildNodeIterator_UpToBrother;
87}