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 _TDocStd_XLink_HeaderFile
17 #define _TDocStd_XLink_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
22 #include <TCollection_AsciiString.hxx>
23 #include <TDocStd_XLinkPtr.hxx>
24 #include <TDF_Attribute.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_OStream.hxx>
27 class TDocStd_XLinkRoot;
28 class TDocStd_XLinkIterator;
32 class TCollection_AsciiString;
33 class TDF_AttributeDelta;
35 class TDF_RelocationTable;
39 DEFINE_STANDARD_HANDLE(TDocStd_XLink, TDF_Attribute)
41 //! An attribute to store the path and the entry of
43 //! These refer from one data structure to a data
44 //! structure in another document.
45 class TDocStd_XLink : public TDF_Attribute
51 //! Sets an empty external reference, at the label aLabel.
52 Standard_EXPORT static Handle(TDocStd_XLink) Set (const TDF_Label& atLabel);
54 //! Initializes fields.
55 Standard_EXPORT TDocStd_XLink();
57 //! Updates the data referenced in this external link attribute.
58 Standard_EXPORT Handle(TDF_Reference) Update();
60 //! Returns the ID of the attribute.
61 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
63 //! Returns the GUID for external links.
64 Standard_EXPORT static const Standard_GUID& GetID();
66 //! Sets the name aDocEntry for the external
67 //! document in this external link attribute.
68 Standard_EXPORT void DocumentEntry (const TCollection_AsciiString& aDocEntry);
70 //! Returns the contents of the document identified by aDocEntry.
71 //! aDocEntry provides external data to this external link attribute.
72 Standard_EXPORT const TCollection_AsciiString& DocumentEntry() const;
74 //! Sets the label entry for this external link attribute with the label aLabel.
75 //! aLabel pilots the importation of data from the document entry.
76 Standard_EXPORT void LabelEntry (const TDF_Label& aLabel);
78 //! Sets the label entry for this external link attribute
79 //! as a document identified by aLabEntry.
80 Standard_EXPORT void LabelEntry (const TCollection_AsciiString& aLabEntry);
82 //! Returns the contents of the field <myLabelEntry>.
83 Standard_EXPORT const TCollection_AsciiString& LabelEntry() const;
85 //! Updates the XLinkRoot attribute by adding <me>
87 Standard_EXPORT void AfterAddition() Standard_OVERRIDE;
89 //! Updates the XLinkRoot attribute by removing <me>
91 Standard_EXPORT void BeforeRemoval() Standard_OVERRIDE;
93 //! Something to do before applying <anAttDelta>.
94 Standard_EXPORT virtual Standard_Boolean BeforeUndo (const Handle(TDF_AttributeDelta)& anAttDelta, const Standard_Boolean forceIt = Standard_False) Standard_OVERRIDE;
96 //! Something to do after applying <anAttDelta>.
97 Standard_EXPORT virtual Standard_Boolean AfterUndo (const Handle(TDF_AttributeDelta)& anAttDelta, const Standard_Boolean forceIt = Standard_False) Standard_OVERRIDE;
99 //! Returns a null handle. Raise allways for ,it is
100 //! nonsense to use this method.
101 Standard_EXPORT Handle(TDF_Attribute) BackupCopy() const Standard_OVERRIDE;
104 Standard_EXPORT void Restore (const Handle(TDF_Attribute)& anAttribute) Standard_OVERRIDE;
106 //! Returns a null handle.
107 Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
110 Standard_EXPORT void Paste (const Handle(TDF_Attribute)& intoAttribute, const Handle(TDF_RelocationTable)& aRelocationTable) const Standard_OVERRIDE;
112 //! Dumps the attribute on <aStream>.
113 Standard_EXPORT Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE;
116 friend class TDocStd_XLinkRoot;
117 friend class TDocStd_XLinkIterator;
120 DEFINE_STANDARD_RTTIEXT(TDocStd_XLink,TDF_Attribute)
130 //! Sets the field <myNext> with <anXLinkPtr>.
131 void Next (const TDocStd_XLinkPtr& anXLinkPtr);
133 //! Returns the contents of the field <myNext>.
134 TDocStd_XLinkPtr Next() const;
136 TCollection_AsciiString myDocEntry;
137 TCollection_AsciiString myLabelEntry;
138 TDocStd_XLinkPtr myNext;
144 #include <TDocStd_XLink.lxx>
150 #endif // _TDocStd_XLink_HeaderFile