024d6f77 |
1 | // Created on: 2017-02-13 |
2 | // Created by: Eugeny NIKONOV |
3 | // Copyright (c) 2005-2017 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 | #include <BinObjMgt_Persistent.hxx> |
83ae3591 |
17 | #include <Message_Messenger.hxx> |
024d6f77 |
18 | #include <Standard_Type.hxx> |
024d6f77 |
19 | #include <BinMXCAFDoc_NoteCommentDriver.hxx> |
20 | #include <XCAFDoc_NoteComment.hxx> |
21 | |
22 | IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver) |
23 | |
24 | //======================================================================= |
25 | //function : |
26 | //purpose : |
27 | //======================================================================= |
83ae3591 |
28 | BinMXCAFDoc_NoteCommentDriver::BinMXCAFDoc_NoteCommentDriver(const Handle(Message_Messenger)& theMsgDriver) |
024d6f77 |
29 | : BinMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteComment)->Name()) |
30 | { |
31 | } |
32 | |
33 | //======================================================================= |
34 | //function : |
35 | //purpose : |
36 | //======================================================================= |
37 | Handle(TDF_Attribute) BinMXCAFDoc_NoteCommentDriver::NewEmpty() const |
38 | { |
39 | return new XCAFDoc_NoteComment(); |
40 | } |
41 | |
42 | //======================================================================= |
43 | //function : |
44 | //purpose : |
45 | //======================================================================= |
46 | Standard_Boolean BinMXCAFDoc_NoteCommentDriver::Paste(const BinObjMgt_Persistent& theSource, |
47 | const Handle(TDF_Attribute)& theTarget, |
48 | BinObjMgt_RRelocationTable& theRelocTable) const |
49 | { |
50 | if (!BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable)) |
51 | return Standard_False; |
52 | |
53 | Handle(XCAFDoc_NoteComment) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theTarget); |
54 | if (aNote.IsNull()) |
55 | return Standard_False; |
56 | |
57 | TCollection_ExtendedString aComment; |
58 | if (!(theSource >> aComment)) |
59 | return Standard_False; |
60 | |
61 | aNote->Set(aComment); |
62 | |
63 | return Standard_True; |
64 | } |
65 | |
66 | //======================================================================= |
67 | //function : |
68 | //purpose : |
69 | //======================================================================= |
70 | void BinMXCAFDoc_NoteCommentDriver::Paste(const Handle(TDF_Attribute)& theSource, |
83ae3591 |
71 | BinObjMgt_Persistent& theTarget, |
72 | BinObjMgt_SRelocationTable& theRelocTable) const |
024d6f77 |
73 | { |
74 | BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable); |
75 | |
76 | Handle(XCAFDoc_NoteComment) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theSource); |
77 | if (!aNote.IsNull()) |
78 | theTarget << aNote->Comment(); |
79 | } |
80 | |
81 | //======================================================================= |
82 | //function : |
83 | //purpose : |
84 | //======================================================================= |
83ae3591 |
85 | BinMXCAFDoc_NoteCommentDriver::BinMXCAFDoc_NoteCommentDriver(const Handle(Message_Messenger)& theMsgDriver, |
024d6f77 |
86 | Standard_CString theName) |
87 | : BinMXCAFDoc_NoteDriver(theMsgDriver, theName) |
88 | { |
89 | |
90 | } |