1 // Created by: DAUTRY Philippe
2 // Copyright (c) 1997-1999 Matra Datavision
3 // Copyright (c) 1999-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 #ifndef _TDF_ChildIterator_HeaderFile
17 #define _TDF_ChildIterator_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <TDF_LabelNodePtr.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <TDF_Label.hxx>
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
41 //! Creates an empty iterator object to
42 //! explore the children of a label.
43 Standard_EXPORT TDF_ChildIterator();
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);
51 //! Initializes the iteration on the children of the
53 //! If <allLevels> option is set to true,
54 //! it explores not only the first, but all the sub
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.
62 //! void DumpChildren(const
63 //! TDF_Label& aLabel)
65 //! TDF_ChildIterator it;
66 //! TCollection_AsciiString es;
68 //! (it.Initialize(aLabel,Standard_True);
69 //! it.More(); it.Next()){
70 //! TDF_Tool::Entry(it.Value(),es);
71 //! cout << as.ToCString() << endl;
74 Standard_EXPORT void Initialize (const TDF_Label& aLabel, const Standard_Boolean allLevels = Standard_False);
76 //! Returns true if a current label is found in the
77 //! iteration process.
78 Standard_Boolean More() const;
80 //! Move the current iteration to the next Item.
81 Standard_EXPORT void Next();
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();
95 //! Returns the current label; or, if there is
96 //! none, a null label.
97 const TDF_Label Value() const;
112 TDF_LabelNodePtr myNode;
113 Standard_Integer myFirstLevel;
119 #include <TDF_ChildIterator.lxx>
125 #endif // _TDF_ChildIterator_HeaderFile