0022627: Change OCCT memory management defaults
[occt.git] / src / BinMDocStd / BinMDocStd_XLinkDriver.cxx
CommitLineData
7fd59977 1// File: BinMDocStd_XLinkDriver.cxx
2// Created: Thu May 13 16:11:34 2004
3// Author: Sergey ZARITCHNY <szy@opencascade.com>
4// Copyright: Open CasCade S.A. 2004
5
6
7#include <BinMDocStd_XLinkDriver.ixx>
8#include <CDM_MessageDriver.hxx>
9#include <TDF_Attribute.hxx>
10#include <TDocStd_XLink.hxx>
11#include <BinMDF_ADriver.hxx>
12#include <BinObjMgt_Persistent.hxx>
13#include <BinObjMgt_RRelocationTable.hxx>
14#include <BinObjMgt_SRelocationTable.hxx>
15//=======================================================================
16//function : BinMDocStd_XLinkDriver
17//purpose :
18//=======================================================================
19
20BinMDocStd_XLinkDriver::BinMDocStd_XLinkDriver
21 (const Handle(CDM_MessageDriver)& theMsgDriver)
22 : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDocStd_XLink)->Name())
23{
24}
25
26//=======================================================================
27//function : NewEmpty
28//purpose :
29//=======================================================================
30
31Handle(TDF_Attribute) BinMDocStd_XLinkDriver::NewEmpty() const
32{
33 return new TDocStd_XLink();
34}
35
36//=======================================================================
37//function : Paste
38//purpose : persistent -> transient (retrieve)
39//=======================================================================
40
41Standard_Boolean BinMDocStd_XLinkDriver::Paste
42 (const BinObjMgt_Persistent& theSource,
43 const Handle(TDF_Attribute)& theTarget,
44 BinObjMgt_RRelocationTable& ) const
45{
46 TCollection_AsciiString aStr;
47 Standard_Boolean ok = theSource >> aStr;
48 if(ok) {
49 Handle(TDocStd_XLink) anAtt = Handle(TDocStd_XLink)::DownCast(theTarget);
50 anAtt->DocumentEntry(aStr);
51 aStr.Clear();
52 ok = theSource >> aStr;
53 if(ok)
54 anAtt->LabelEntry(aStr);
55 }
56 return ok;
57}
58
59//=======================================================================
60//function : Paste
61//purpose : transient -> persistent (store)
62//=======================================================================
63
64void BinMDocStd_XLinkDriver::Paste (const Handle(TDF_Attribute)& theSource,
65 BinObjMgt_Persistent& theTarget,
66 BinObjMgt_SRelocationTable& ) const
67{
68 Handle(TDocStd_XLink) anAtt = Handle(TDocStd_XLink)::DownCast(theSource);
69 theTarget << anAtt->DocumentEntry() << anAtt->LabelEntry();
70}
71
72