1 // Created on: 2008-12-10
2 // Created by: Pavel TELKOV
3 // Copyright (c) 2008-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 <MXCAFDoc_DatumRetrievalDriver.ixx>
17 #include <PXCAFDoc_Datum.hxx>
18 #include <XCAFDoc_Datum.hxx>
20 #include <TCollection_HAsciiString.hxx>
21 #include <PCollection_HAsciiString.hxx>
24 //=======================================================================
25 //function : MCAFDoc_DatumRetrievalDriver
27 //=======================================================================
29 MXCAFDoc_DatumRetrievalDriver::MXCAFDoc_DatumRetrievalDriver
30 (const Handle(CDM_MessageDriver)& theMsgDriver) : MDF_ARDriver (theMsgDriver)
33 //=======================================================================
34 //function : VersionNumber
36 //=======================================================================
38 Standard_Integer MXCAFDoc_DatumRetrievalDriver::VersionNumber() const
41 //=======================================================================
42 //function : SourceType
44 //=======================================================================
46 Handle(Standard_Type) MXCAFDoc_DatumRetrievalDriver::SourceType() const
48 static Handle(Standard_Type) sourceType = STANDARD_TYPE(PXCAFDoc_Datum);
52 //=======================================================================
55 //=======================================================================
57 Handle(TDF_Attribute) MXCAFDoc_DatumRetrievalDriver::NewEmpty() const
59 return new XCAFDoc_Datum();
62 //=======================================================================
65 //=======================================================================
67 void MXCAFDoc_DatumRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source,
68 const Handle(TDF_Attribute)& Target,
69 const Handle(MDF_RRelocationTable)& /*RelocTable*/) const
71 Handle(PXCAFDoc_Datum) S = Handle(PXCAFDoc_Datum)::DownCast (Source);
72 Handle(XCAFDoc_Datum) T = Handle(XCAFDoc_Datum)::DownCast (Target);
74 Handle(TCollection_HAsciiString) aName, aDescr, anId;
75 if ( !S->GetName().IsNull() )
76 aName = new TCollection_HAsciiString( (S->GetName())->Convert() );
77 if ( !S->GetDescription().IsNull() )
78 aDescr = new TCollection_HAsciiString( (S->GetDescription())->Convert() );
79 if ( !S->GetIdentification().IsNull() )
80 anId = new TCollection_HAsciiString( (S->GetIdentification())->Convert() );
82 T->Set(aName, aDescr, anId);