0024057: Eliminate compiler warning C4100 in MSVC++ with warning level 4
[occt.git] / src / TDocStd / TDocStd_XLinkRoot.cxx
1 // Created by: DAUTRY Philippe
2 // Copyright (c) 1997-1999 Matra Datavision
3 // Copyright (c) 1999-2012 OPEN CASCADE SAS
4 //
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
9 //
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 //
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
19
20 //              ------------------
21
22 // Version:     0.0
23 //Version       Date            Purpose
24 //              0.0     Sep 15 1997     Creation
25
26
27
28 #include <TDocStd_XLinkRoot.ixx>
29
30 #include <TDocStd_XLink.hxx>
31
32
33 //=======================================================================
34 //             CLASS METHODS
35 //=======================================================================
36
37 //=======================================================================
38 //function : GetID
39 //purpose  : 
40 //=======================================================================
41
42 const Standard_GUID& TDocStd_XLinkRoot::GetID() 
43 {
44   static Standard_GUID myID("5d587401-5690-11d1-8940-080009dc3333");
45   return myID;
46 }
47
48
49 //=======================================================================
50 //function : Set
51 //purpose  : CLASS method.
52 //=======================================================================
53
54 Handle(TDocStd_XLinkRoot) TDocStd_XLinkRoot::Set
55 (const Handle(TDF_Data)& aDF) 
56 {
57   Handle(TDocStd_XLinkRoot) xRefRoot;
58   if (!aDF->Root().FindAttribute (TDocStd_XLinkRoot::GetID(),xRefRoot)) {
59     xRefRoot = new TDocStd_XLinkRoot;
60     aDF->Root().AddAttribute(xRefRoot);
61   }
62   return xRefRoot;
63 }
64
65
66 //=======================================================================
67 //function : Insert
68 //purpose  : 
69 //=======================================================================
70
71 void TDocStd_XLinkRoot::Insert(const TDocStd_XLinkPtr& anXLinkPtr)
72 {
73   Handle(TDocStd_XLinkRoot) xRefRoot =
74     TDocStd_XLinkRoot::Set(anXLinkPtr->Label().Data());
75   // Insertion at beginning because the order is not significant.
76   anXLinkPtr->Next(xRefRoot->First());
77   xRefRoot->First(anXLinkPtr);
78 }
79
80
81 //=======================================================================
82 //function : Remove
83 //purpose  : 
84 //=======================================================================
85
86 void TDocStd_XLinkRoot::Remove(const TDocStd_XLinkPtr& anXLinkPtr)
87 {
88   Handle(TDocStd_XLinkRoot) xRefRoot;
89   if (anXLinkPtr->Label().Root().FindAttribute(TDocStd_XLinkRoot::GetID(),
90                                               xRefRoot)) {
91     TDocStd_XLink* previous = xRefRoot->First();
92     if (previous == anXLinkPtr) {
93       xRefRoot->First(anXLinkPtr->Next());
94       previous = NULL; anXLinkPtr->Next(previous);
95     }
96     else {
97       while (previous != NULL && previous->Next() != anXLinkPtr)
98         previous = previous->Next();
99       if (previous != NULL) {
100         previous->Next(anXLinkPtr->Next());
101         previous = NULL; anXLinkPtr->Next(previous);
102       }
103     }
104   }
105 }
106
107
108 //=======================================================================
109 //             INSTANCE METHODS
110 //=======================================================================
111
112 //=======================================================================
113 //function : TDocStd_XLinkRoot
114 //purpose  : 
115 //=======================================================================
116
117 TDocStd_XLinkRoot::TDocStd_XLinkRoot()
118 : myFirst(NULL)
119 {}
120
121
122 //=======================================================================
123 //function : ID
124 //purpose  : 
125 //=======================================================================
126
127 const Standard_GUID& TDocStd_XLinkRoot::ID() const
128 { return GetID(); }
129
130
131 //=======================================================================
132 //function : BackupCopy
133 //purpose  : 
134 //=======================================================================
135
136 Handle(TDF_Attribute) TDocStd_XLinkRoot::BackupCopy() const
137 { return new TDocStd_XLinkRoot; } // Does nothing.
138
139
140 //=======================================================================
141 //function : Restore
142 //purpose  : 
143 //=======================================================================
144
145 void TDocStd_XLinkRoot::Restore(const Handle(TDF_Attribute)& /*anAttribute*/) 
146 {} // Does nothing.
147
148
149 //=======================================================================
150 //function : NewEmpty
151 //purpose  : 
152 //=======================================================================
153
154 Handle(TDF_Attribute) TDocStd_XLinkRoot::NewEmpty() const
155 { return new TDocStd_XLinkRoot; }
156
157
158 //=======================================================================
159 //function : Paste
160 //purpose  : 
161 //=======================================================================
162
163 void TDocStd_XLinkRoot::Paste
164 (const Handle(TDF_Attribute)&,
165  const Handle(TDF_RelocationTable)&) const
166 {} // Does nothing.
167
168
169 //=======================================================================
170 //function : Dump
171 //purpose  : 
172 //=======================================================================
173
174 Standard_OStream& TDocStd_XLinkRoot::Dump(Standard_OStream& anOS) const
175 { return anOS; }
176