0029915: Porting to VC 2017 : Regressions in Modeling Algorithms on VC 2017
[occt.git] / src / TDF / TDF_ChildIterator.hxx
1 // Created by: DAUTRY Philippe
2 // Copyright (c) 1997-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _TDF_ChildIterator_HeaderFile
17 #define _TDF_ChildIterator_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
22
23 #include <TDF_LabelNodePtr.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <TDF_Label.hxx>
27 class TDF_Label;
28
29
30 //! Iterates on the children of a label, at the first
31 //! level only. It is possible to ask the iterator to
32 //! explore all the sub label levels of the given one,
33 //! with the option "allLevels".
34 class TDF_ChildIterator 
35 {
36 public:
37
38   DEFINE_STANDARD_ALLOC
39
40   
41   //! Creates an empty iterator  object to
42   //! explore the children of a label.
43   Standard_EXPORT TDF_ChildIterator();
44   
45   //! Constructs the iterator object defined by
46   //! the label aLabel.  Iterates on the children of the given label. If
47   //! <allLevels> option is set to true, it explores not
48   //! only the first, but all the sub label levels.
49   Standard_EXPORT TDF_ChildIterator(const TDF_Label& aLabel, const Standard_Boolean allLevels = Standard_False);
50   
51   //! Initializes the iteration on the children of the
52   //! given label.
53   //! If <allLevels> option is set to true,
54   //! it explores not only the first, but all the sub
55   //! label levels.
56   //! If allLevels is false, only the first level of
57   //! child labels is explored.
58   //! In the example below, the label is iterated
59   //! using Initialize, More and Next and its
60   //! child labels dumped using TDF_Tool::Entry.
61   //! Example
62   //! void DumpChildren(const
63   //! TDF_Label& aLabel)
64   //! {
65   //! TDF_ChildIterator it;
66   //! TCollection_AsciiString es;
67   //! for
68   //! (it.Initialize(aLabel,Standard_True);
69   //! it.More(); it.Next()){
70   //! TDF_Tool::Entry(it.Value(),es);
71   //! cout << as.ToCString() << endl;
72   //! }
73   //! }
74   Standard_EXPORT void Initialize (const TDF_Label& aLabel, const Standard_Boolean allLevels = Standard_False);
75   
76   //! Returns true if a current label is found in the
77   //! iteration process.
78     Standard_Boolean More() const;
79   
80   //! Move the  current  iteration  to the next Item.
81   Standard_EXPORT void Next();
82   
83   //! Moves this iteration to the next brother
84   //! label. A brother label is one with the same
85   //! father as an initial label.
86   //! Use this function when the non-empty
87   //! constructor or Initialize has allLevels set to
88   //! true. The result is that the iteration does not
89   //! explore the children of the current label.
90   //! This method is interesting only with
91   //! "allLevels" behavior, because it avoids to explore
92   //! the current label children.
93   Standard_EXPORT void NextBrother();
94   
95   //! Returns the current label; or, if there is
96   //! none, a null label.
97     const TDF_Label Value() const;
98
99
100
101
102 protected:
103
104
105
106
107
108 private:
109
110
111
112   TDF_LabelNodePtr myNode;
113   Standard_Integer myFirstLevel;
114
115
116 };
117
118
119 #include <TDF_ChildIterator.lxx>
120
121
122
123
124
125 #endif // _TDF_ChildIterator_HeaderFile