Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-10 09:18:26

0001 // Created on: 1998-05-12
0002 // Created by: Isabelle GRIGNON
0003 // Copyright (c) 1998-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _TDocStd_XLinkTool_HeaderFile
0018 #define _TDocStd_XLinkTool_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Boolean.hxx>
0025 class TDF_DataSet;
0026 class TDF_RelocationTable;
0027 class TDF_Label;
0028 
0029 //! This  tool class  is  used to copy  the content of
0030 //! source label   under  target label.   Only child
0031 //! labels and  attributes   of  source are   copied.
0032 //! attributes located   out of source  scope are  not
0033 //! copied by this algorithm.
0034 //! Depending  of   the called  method  an   external
0035 //! reference is set  in  the target  document  to
0036 //! registered the externallink.
0037 //! Provide services to set, update and perform
0038 //! external references.
0039 //! Warning1: Nothing is provided in this class  about the
0040 //! opportunity to copy, set a link or  update  it.
0041 //! Such decisions must be under application control.
0042 //! Warning2: If the document manages shapes, use after copy
0043 //! TNaming::ChangeShapes(target,M) to make copy of
0044 //! shapes.
0045 class TDocStd_XLinkTool
0046 {
0047 public:
0048   DEFINE_STANDARD_ALLOC
0049 
0050   Standard_EXPORT TDocStd_XLinkTool();
0051 
0052   //! Copies the content of the label <fromsource> to the label <intarget>.
0053   //! The link is registered with an XLink attribute by <intarget>
0054   //! label.  if  the    content  of <fromsource>   is  not
0055   //! self-contained,  and/or <intarget> has already an XLink
0056   //! attribute, an exception is raised.
0057   Standard_EXPORT void CopyWithLink(const TDF_Label& intarget, const TDF_Label& fromsource);
0058 
0059   //! Update the external reference set   at <L>.
0060   //! Example
0061   //! Handle(TDocStd_Document) aDoc;
0062   //! if
0063   //! (!OCAFTest::GetDocument(1,aDoc)) return 1;
0064   //! Handle(TDataStd_Reference) aRef;
0065   //! TDocStd_XLinkTool xlinktool;
0066   //! if
0067   //! (!OCAFTest::Find(aDoc,2),TDataStd_Reference::GetID(),aRef) return 1;
0068   //! xlinktool.UpdateLink(aRef->Label());
0069   //! Exceptions
0070   //! Standard_DomainError if <L> has no XLink attribute.
0071   Standard_EXPORT void UpdateLink(const TDF_Label& L);
0072 
0073   //! Copy    the   content     of    <fromsource>   under
0074   //! <intarget>. No link is registered. No check is done.
0075   //! Example
0076   //! Handle(TDocStd_Document) DOC, XDOC;
0077   //! TDF_Label L, XL;
0078   //! TDocStd_XLinkTool xlinktool;
0079   //! xlinktool.Copy(L,XL);
0080   //! Exceptions:
0081   //! Standard_DomainError if the contents of
0082   //! fromsource are not entirely in the scope of this
0083   //! label, in other words, are not self-contained.
0084   //! !!! ==> Warning:
0085   //! If the document manages shapes use the next way:
0086   //! TDocStd_XLinkTool xlinktool;
0087   //! xlinktool.Copy(L,XL);
0088   //! TopTools_DataMapOfShapeShape M;
0089   //! TNaming::ChangeShapes(target,M);
0090   Standard_EXPORT virtual void Copy(const TDF_Label& intarget, const TDF_Label& fromsource);
0091 
0092   Standard_EXPORT Standard_Boolean IsDone() const;
0093 
0094   Standard_EXPORT Handle(TDF_DataSet) DataSet() const;
0095 
0096   Standard_EXPORT Handle(TDF_RelocationTable) RelocationTable() const;
0097 
0098 protected:
0099   Standard_Boolean isDone;
0100 
0101 private:
0102   Handle(TDF_DataSet)         myDS;
0103   Handle(TDF_RelocationTable) myRT;
0104 };
0105 
0106 #endif // _TDocStd_XLinkTool_HeaderFile