b311480e |
1 | // Created on: 2008-12-10 |
2 | // Created by: Pavel TELKOV |
973c2be1 |
3 | // Copyright (c) 2008-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | #include <MXCAFDoc_DatumRetrievalDriver.ixx> |
17 | #include <PXCAFDoc_Datum.hxx> |
18 | #include <XCAFDoc_Datum.hxx> |
19 | |
20 | #include <TCollection_HAsciiString.hxx> |
21 | #include <PCollection_HAsciiString.hxx> |
22 | |
23 | |
24 | //======================================================================= |
25 | //function : MCAFDoc_DatumRetrievalDriver |
26 | //purpose : |
27 | //======================================================================= |
28 | |
29 | MXCAFDoc_DatumRetrievalDriver::MXCAFDoc_DatumRetrievalDriver |
30 | (const Handle(CDM_MessageDriver)& theMsgDriver) : MDF_ARDriver (theMsgDriver) |
31 | {} |
32 | |
33 | //======================================================================= |
34 | //function : VersionNumber |
35 | //purpose : |
36 | //======================================================================= |
37 | |
38 | Standard_Integer MXCAFDoc_DatumRetrievalDriver::VersionNumber() const |
39 | { return 0; } |
40 | |
41 | //======================================================================= |
42 | //function : SourceType |
43 | //purpose : |
44 | //======================================================================= |
45 | |
46 | Handle(Standard_Type) MXCAFDoc_DatumRetrievalDriver::SourceType() const |
47 | { |
48 | static Handle(Standard_Type) sourceType = STANDARD_TYPE(PXCAFDoc_Datum); |
49 | return sourceType; |
50 | } |
51 | |
52 | //======================================================================= |
53 | //function : NewEmpty |
54 | //purpose : |
55 | //======================================================================= |
56 | |
57 | Handle(TDF_Attribute) MXCAFDoc_DatumRetrievalDriver::NewEmpty() const |
58 | { |
59 | return new XCAFDoc_Datum(); |
60 | } |
61 | |
62 | //======================================================================= |
63 | //function : Paste |
64 | //purpose : |
65 | //======================================================================= |
66 | |
67 | void MXCAFDoc_DatumRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source, |
68 | const Handle(TDF_Attribute)& Target, |
35e08fe8 |
69 | const Handle(MDF_RRelocationTable)& /*RelocTable*/) const |
7fd59977 |
70 | { |
71 | Handle(PXCAFDoc_Datum) S = Handle(PXCAFDoc_Datum)::DownCast (Source); |
72 | Handle(XCAFDoc_Datum) T = Handle(XCAFDoc_Datum)::DownCast (Target); |
73 | |
7fd59977 |
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() ); |
81 | |
82 | T->Set(aName, aDescr, anId); |
83 | } |