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 _TDocStd_XLink_HeaderFile 17 #define _TDocStd_XLink_HeaderFile 18 19 #include <Standard.hxx> 20 #include <Standard_Type.hxx> 21 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; 29 class TDF_Label; 30 class TDF_Reference; 31 class Standard_GUID; 32 class TCollection_AsciiString; 33 class TDF_AttributeDelta; 34 class TDF_Attribute; 35 class TDF_RelocationTable; 36 37 38 class TDocStd_XLink; 39 DEFINE_STANDARD_HANDLE(TDocStd_XLink, TDF_Attribute) 40 41 //! An attribute to store the path and the entry of 42 //! external links. 43 //! These refer from one data structure to a data 44 //! structure in another document. 45 class TDocStd_XLink : public TDF_Attribute 46 { 47 48 public: 49 50 51 //! Sets an empty external reference, at the label aLabel. 52 Standard_EXPORT static Handle(TDocStd_XLink) Set (const TDF_Label& atLabel); 53 54 //! Initializes fields. 55 Standard_EXPORT TDocStd_XLink(); 56 57 //! Updates the data referenced in this external link attribute. 58 Standard_EXPORT Handle(TDF_Reference) Update(); 59 60 //! Returns the ID of the attribute. 61 Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; 62 63 //! Returns the GUID for external links. 64 Standard_EXPORT static const Standard_GUID& GetID(); 65 66 //! Sets the name aDocEntry for the external 67 //! document in this external link attribute. 68 Standard_EXPORT void DocumentEntry (const TCollection_AsciiString& aDocEntry); 69 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; 73 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); 77 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); 81 82 //! Returns the contents of the field <myLabelEntry>. 83 Standard_EXPORT const TCollection_AsciiString& LabelEntry() const; 84 85 //! Updates the XLinkRoot attribute by adding <me> 86 //! to its list. 87 Standard_EXPORT void AfterAddition() Standard_OVERRIDE; 88 89 //! Updates the XLinkRoot attribute by removing <me> 90 //! from its list. 91 Standard_EXPORT void BeforeRemoval() Standard_OVERRIDE; 92 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; 95 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; 98 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; 102 103 //! Does nothing. 104 Standard_EXPORT void Restore (const Handle(TDF_Attribute)& anAttribute) Standard_OVERRIDE; 105 106 //! Returns a null handle. 107 Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; 108 109 //! Does nothing. 110 Standard_EXPORT void Paste (const Handle(TDF_Attribute)& intoAttribute, const Handle(TDF_RelocationTable)& aRelocationTable) const Standard_OVERRIDE; 111 112 //! Dumps the attribute on <aStream>. 113 Standard_EXPORT Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE; 114 115 116 friend class TDocStd_XLinkRoot; 117 friend class TDocStd_XLinkIterator; 118 119 120 DEFINE_STANDARD_RTTIEXT(TDocStd_XLink,TDF_Attribute) 121 122 protected: 123 124 125 126 127 private: 128 129 130 //! Sets the field <myNext> with <anXLinkPtr>. 131 void Next (const TDocStd_XLinkPtr& anXLinkPtr); 132 133 //! Returns the contents of the field <myNext>. 134 TDocStd_XLinkPtr Next() const; 135 136 TCollection_AsciiString myDocEntry; 137 TCollection_AsciiString myLabelEntry; 138 TDocStd_XLinkPtr myNext; 139 140 141 }; 142 143 144 #include <TDocStd_XLink.lxx> 145 146 147 148 149 150 #endif // _TDocStd_XLink_HeaderFile 151