1 // Created on: 2004-05-13
2 // Created by: Sergey ZARITCHNY
3 // Copyright (c) 2004-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 #include <BinMDocStd_XLinkDriver.ixx>
17 #include <CDM_MessageDriver.hxx>
18 #include <TDF_Attribute.hxx>
19 #include <TDocStd_XLink.hxx>
20 #include <BinMDF_ADriver.hxx>
21 #include <BinObjMgt_Persistent.hxx>
22 #include <BinObjMgt_RRelocationTable.hxx>
23 #include <BinObjMgt_SRelocationTable.hxx>
24 //=======================================================================
25 //function : BinMDocStd_XLinkDriver
27 //=======================================================================
29 BinMDocStd_XLinkDriver::BinMDocStd_XLinkDriver
30 (const Handle(CDM_MessageDriver)& theMsgDriver)
31 : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDocStd_XLink)->Name())
35 //=======================================================================
38 //=======================================================================
40 Handle(TDF_Attribute) BinMDocStd_XLinkDriver::NewEmpty() const
42 return new TDocStd_XLink();
45 //=======================================================================
47 //purpose : persistent -> transient (retrieve)
48 //=======================================================================
50 Standard_Boolean BinMDocStd_XLinkDriver::Paste
51 (const BinObjMgt_Persistent& theSource,
52 const Handle(TDF_Attribute)& theTarget,
53 BinObjMgt_RRelocationTable& ) const
55 TCollection_AsciiString aStr;
56 Standard_Boolean ok = theSource >> aStr;
58 Handle(TDocStd_XLink) anAtt = Handle(TDocStd_XLink)::DownCast(theTarget);
59 anAtt->DocumentEntry(aStr);
61 ok = theSource >> aStr;
63 anAtt->LabelEntry(aStr);
68 //=======================================================================
70 //purpose : transient -> persistent (store)
71 //=======================================================================
73 void BinMDocStd_XLinkDriver::Paste (const Handle(TDF_Attribute)& theSource,
74 BinObjMgt_Persistent& theTarget,
75 BinObjMgt_SRelocationTable& ) const
77 Handle(TDocStd_XLink) anAtt = Handle(TDocStd_XLink)::DownCast(theSource);
78 theTarget << anAtt->DocumentEntry() << anAtt->LabelEntry();