0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BinMDocStd / BinMDocStd_XLinkDriver.cxx
1 // Created on: 2004-05-13
2 // Created by: Sergey ZARITCHNY
3 // Copyright (c) 2004-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
17 #include <BinMDF_ADriver.hxx>
18 #include <BinMDocStd_XLinkDriver.hxx>
19 #include <BinObjMgt_Persistent.hxx>
20 #include <BinObjMgt_RRelocationTable.hxx>
21 #include <BinObjMgt_SRelocationTable.hxx>
22 #include <CDM_MessageDriver.hxx>
23 #include <Standard_Type.hxx>
24 #include <TDF_Attribute.hxx>
25 #include <TDocStd_XLink.hxx>
26
27 //=======================================================================
28 //function : BinMDocStd_XLinkDriver
29 //purpose  : 
30 //=======================================================================
31 BinMDocStd_XLinkDriver::BinMDocStd_XLinkDriver
32                         (const Handle(CDM_MessageDriver)& theMsgDriver)
33      : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDocStd_XLink)->Name())
34 {
35 }
36
37 //=======================================================================
38 //function : NewEmpty
39 //purpose  : 
40 //=======================================================================
41
42 Handle(TDF_Attribute) BinMDocStd_XLinkDriver::NewEmpty() const
43 {
44   return new TDocStd_XLink();
45 }
46
47 //=======================================================================
48 //function : Paste
49 //purpose  : persistent -> transient (retrieve)
50 //=======================================================================
51
52 Standard_Boolean BinMDocStd_XLinkDriver::Paste
53                                 (const BinObjMgt_Persistent& theSource,
54                                  const Handle(TDF_Attribute)& theTarget,
55                                  BinObjMgt_RRelocationTable& ) const
56 {
57   TCollection_AsciiString aStr;
58   Standard_Boolean ok = theSource >> aStr;
59   if(ok) {
60     Handle(TDocStd_XLink) anAtt = Handle(TDocStd_XLink)::DownCast(theTarget);
61     anAtt->DocumentEntry(aStr);
62     aStr.Clear();
63     ok = theSource >> aStr;
64     if(ok)
65       anAtt->LabelEntry(aStr);
66   }
67   return ok;
68 }
69
70 //=======================================================================
71 //function : Paste
72 //purpose  : transient -> persistent (store)
73 //=======================================================================
74
75 void BinMDocStd_XLinkDriver::Paste (const Handle(TDF_Attribute)& theSource,
76                                        BinObjMgt_Persistent& theTarget,
77                                        BinObjMgt_SRelocationTable&  ) const
78 {
79   Handle(TDocStd_XLink) anAtt = Handle(TDocStd_XLink)::DownCast(theSource);
80   theTarget << anAtt->DocumentEntry() << anAtt->LabelEntry();
81 }
82
83