b311480e |
1 | // Created by: DAUTRY Philippe |
2 | // Copyright (c) 1998-1999 Matra Datavision |
973c2be1 |
3 | // Copyright (c) 1999-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. |
b311480e |
15 | |
7fd59977 |
16 | // ------------------------- |
7fd59977 |
17 | |
18 | // Version: 0.0 |
b311480e |
19 | //Version Date Purpose |
7fd59977 |
20 | // 0.0 Feb 16 1998 Creation |
21 | |
7fd59977 |
22 | #ifndef TDF_AttributeIterator_HeaderFile |
23 | #define TDF_AttributeIterator_HeaderFile |
24 | |
cb389a77 |
25 | #include <TDF_Attribute.hxx> |
ebc93ae7 |
26 | #include <TDF_Label.hxx> |
7fd59977 |
27 | #include <TDF_LabelNodePtr.hxx> |
7fd59977 |
28 | |
29 | // This class provides a way to iterates on the |
30 | // up-to-date (current) valid attributes of a label. |
31 | // |
c1a688e9 |
32 | // This class should not be used for standard attributes workflow. |
33 | // Application allways knows what to search at particular label. |
34 | // So, use IsAttribute and FindAttibute methods of |
35 | // TDF_Label to check and get attributes in usual way. |
36 | // This class may be used for processing of content of labels |
37 | // in generic way, like copy-tool, specific save/restore algorithms, |
38 | // etc. |
39 | // |
40 | // Even a forgotten attribute may be found if this |
7fd59977 |
41 | // option is set. To use this possibility, look at |
42 | // the constructor. |
7fd59977 |
43 | |
44 | class TDF_AttributeIterator { |
45 | |
46 | public: |
47 | |
48 | // Methods PUBLIC |
49 | // |
50 | Standard_EXPORT TDF_AttributeIterator(); |
51 | Standard_EXPORT TDF_AttributeIterator |
52 | (const TDF_Label& aLabel, |
53 | const Standard_Boolean withoutForgotten = Standard_True); |
54 | Standard_EXPORT TDF_AttributeIterator |
55 | (const TDF_LabelNodePtr aLabelNode, |
56 | const Standard_Boolean withoutForgotten = Standard_True); |
57 | Standard_EXPORT void Initialize |
58 | (const TDF_Label& aLabel, |
59 | const Standard_Boolean withoutForgotten = Standard_True) ; |
60 | inline Standard_Boolean More() const; |
61 | Standard_EXPORT void Next() ; |
fe4f17f0 |
62 | inline Handle(TDF_Attribute) Value() const; |
7fd59977 |
63 | |
c2100640 |
64 | //! Provides an access to the internal pointer of the current attribute. |
65 | //! The method has better performance as not-creating handle. |
66 | inline const TDF_Attribute* PtrValue() const { return myValue; } |
7fd59977 |
67 | |
68 | protected: |
69 | |
70 | // Methods PROTECTED |
71 | // |
72 | |
73 | |
74 | // Fields PROTECTED |
75 | // |
76 | |
77 | |
78 | private: |
79 | |
80 | // Methods PRIVATE |
81 | // |
82 | void goToNext (const Handle(TDF_Attribute)& anAttr); |
83 | |
84 | |
85 | // Fields PRIVATE |
86 | // |
87 | TDF_Attribute * myValue; |
88 | Standard_Boolean myWithoutForgotten; |
89 | }; |
90 | |
91 | |
92 | // other inline functions and methods (like "C++: function call" methods) |
93 | // |
94 | |
95 | inline Standard_Boolean TDF_AttributeIterator::More() const |
96 | { return (myValue != 0L); } |
97 | |
fe4f17f0 |
98 | inline Handle(TDF_Attribute) TDF_AttributeIterator::Value() const |
7fd59977 |
99 | { return myValue; } |
100 | |
101 | #endif |