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_ChildIDIterator_HeaderFile
17 #define _TDF_ChildIDIterator_HeaderFile
18 
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
22 
23 #include <Standard_GUID.hxx>
24 #include <TDF_ChildIterator.hxx>
25 #include <Standard_Boolean.hxx>
26 class TDF_Attribute;
27 class TDF_Label;
28 class Standard_GUID;
29 
30 
31 //! Iterates on the children of a label, to find
32 //! attributes having ID as Attribute ID.
33 //!
34 //! Level option works as TDF_ChildIterator.
35 class TDF_ChildIDIterator
36 {
37 public:
38 
39   DEFINE_STANDARD_ALLOC
40 
41 
42   //! Creates an empty iterator.
43   Standard_EXPORT TDF_ChildIDIterator();
44 
45   //! Iterates on the children of the given label. If
46   //! <allLevels> option is set to true, it explores not
47   //! only the first, but all the sub label levels.
48   Standard_EXPORT TDF_ChildIDIterator(const TDF_Label& aLabel, const Standard_GUID& anID, const Standard_Boolean allLevels = Standard_False);
49 
50   //! Initializes the iteration on the children of the
51   //! given label. If <allLevels> option is set to true,
52   //! it explores not only the first, but all the sub
53   //! label levels.
54   Standard_EXPORT void Initialize (const TDF_Label& aLabel, const Standard_GUID& anID, const Standard_Boolean allLevels = Standard_False);
55 
56   //! Returns True if there is a current Item in the
57   //! iteration.
58     Standard_Boolean More() const;
59 
60   //! Move to the next Item
61   Standard_EXPORT void Next();
62 
63   //! Move to the next Brother. If there is none, go up
64   //! etc. This method is interesting only with
65   //! "allLevels" behavior, because it avoids to explore
66   //! the current label children.
67   Standard_EXPORT void NextBrother();
68 
69   //! Returns the current item; a null handle if there is none.
70     Handle(TDF_Attribute) Value() const;
71 
72 
73 
74 
75 protected:
76 
77 
78 
79 
80 
81 private:
82 
83 
84 
85   Standard_GUID myID;
86   TDF_ChildIterator myItr;
87   Handle(TDF_Attribute) myAtt;
88 
89 
90 };
91 
92 
93 #include <TDF_ChildIDIterator.lxx>
94 
95 
96 
97 
98 
99 #endif // _TDF_ChildIDIterator_HeaderFile
100