b311480e |
1 | // Created on: 1999-06-25 |
2 | // Created by: Sergey RUIN |
3 | // Copyright (c) 1999-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | #include <TDataStd_Directory.ixx> |
24 | #include <TDataStd.hxx> |
25 | #include <TDF_TagSource.hxx> |
26 | #include <Standard_DomainError.hxx> |
27 | |
28 | //======================================================================= |
29 | //function : Find |
30 | //purpose : |
31 | //======================================================================= |
32 | |
33 | Standard_Boolean TDataStd_Directory::Find (const TDF_Label& current, |
34 | Handle(TDataStd_Directory)& D) |
35 | { |
36 | TDF_Label L = current; |
37 | Handle(TDataStd_Directory) dir; |
38 | if (L.IsNull()) return Standard_False; |
39 | |
302f96fb |
40 | for(;;) { |
7fd59977 |
41 | if(L.FindAttribute(TDataStd_Directory::GetID(), dir)) break; |
42 | L = L.Father(); |
43 | if (L.IsNull()) break; |
44 | } |
45 | |
46 | if (!dir.IsNull()) { |
47 | D = dir; |
48 | return Standard_True; |
49 | } |
50 | return Standard_False; |
51 | } |
52 | |
53 | |
54 | //======================================================================= |
55 | //function : GetID |
56 | //purpose : |
57 | //======================================================================= |
58 | |
59 | const Standard_GUID& TDataStd_Directory::GetID() |
60 | { |
61 | static Standard_GUID TDataStd_DirectoryID("2a96b61f-ec8b-11d0-bee7-080009dc3333"); |
62 | return TDataStd_DirectoryID; |
63 | } |
64 | |
65 | |
66 | //======================================================================= |
67 | //function : New |
68 | //purpose : |
69 | //======================================================================= |
70 | |
71 | Handle(TDataStd_Directory) TDataStd_Directory::New (const TDF_Label& L) |
72 | { |
73 | if (L.HasAttribute()) { |
74 | Standard_DomainError::Raise("TDataStd_Directory::New : not an empty label"); |
75 | } |
76 | Handle(TDataStd_Directory) A = new TDataStd_Directory (); |
77 | L.AddAttribute(A); |
78 | TDF_TagSource::Set(L); |
79 | return A; |
80 | } |
81 | |
82 | |
83 | //======================================================================= |
84 | //function : TDataStd_AddDirectory |
85 | //purpose : |
86 | //======================================================================= |
87 | |
88 | Handle(TDataStd_Directory) TDataStd_Directory::AddDirectory(const Handle(TDataStd_Directory)& dir) |
89 | { |
90 | TDF_Label newLabel = TDF_TagSource::NewChild ( dir->Label() ); |
91 | Handle(TDataStd_Directory) A = TDataStd_Directory::New (newLabel ); |
92 | return A; |
93 | } |
94 | |
95 | |
96 | //======================================================================= |
97 | //function : TDataStd_MakeObjectLabel |
98 | //purpose : |
99 | //======================================================================= |
100 | |
101 | TDF_Label TDataStd_Directory::MakeObjectLabel(const Handle(TDataStd_Directory)& dir) |
102 | { |
103 | return TDF_TagSource::NewChild ( dir->Label() ); |
104 | } |
105 | |
106 | //======================================================================= |
107 | //function : TDataStd_Directory |
108 | //purpose : |
109 | //======================================================================= |
110 | |
111 | TDataStd_Directory::TDataStd_Directory() |
112 | { |
113 | } |
114 | |
115 | |
116 | //======================================================================= |
117 | //function : ID |
118 | //purpose : |
119 | //======================================================================= |
120 | |
121 | const Standard_GUID& TDataStd_Directory::ID() const |
122 | { return GetID(); } |
123 | |
124 | |
125 | //======================================================================= |
126 | //function : NewEmpty |
127 | //purpose : |
128 | //======================================================================= |
129 | |
130 | Handle(TDF_Attribute) TDataStd_Directory::NewEmpty () const |
131 | { |
132 | return new TDataStd_Directory(); |
133 | } |
134 | |
135 | //======================================================================= |
136 | //function : Restore |
137 | //purpose : |
138 | //======================================================================= |
139 | |
35e08fe8 |
140 | void TDataStd_Directory::Restore(const Handle(TDF_Attribute)&) |
7fd59977 |
141 | { |
142 | } |
143 | |
144 | //======================================================================= |
145 | //function : Paste |
146 | //purpose : |
147 | //======================================================================= |
148 | |
35e08fe8 |
149 | void TDataStd_Directory::Paste (const Handle(TDF_Attribute)&, |
150 | const Handle(TDF_RelocationTable)& ) const |
7fd59977 |
151 | { |
152 | } |
153 | |
154 | //======================================================================= |
155 | //function : References |
156 | //purpose : |
157 | //======================================================================= |
158 | |
35e08fe8 |
159 | void TDataStd_Directory::References (const Handle(TDF_DataSet)&) const |
7fd59977 |
160 | { |
161 | } |
162 | |
163 | //======================================================================= |
164 | //function : Dump |
165 | //purpose : |
166 | //======================================================================= |
167 | |
168 | Standard_OStream& TDataStd_Directory::Dump (Standard_OStream& anOS) const |
169 | { |
170 | anOS << "Directory"; |
171 | return anOS; |
172 | } |
173 | |
174 | |