0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / BinMXCAFDoc / BinMXCAFDoc_NoteDriver.cxx
1 // Created on: 2017-02-10
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>
17 #include <CDM_MessageDriver.hxx>
18 #include <Standard_Type.hxx>
19 #include <TDF_Attribute.hxx>
20 #include <BinMXCAFDoc_NoteDriver.hxx>
21 #include <XCAFDoc_Note.hxx>
22
23 IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteDriver, BinMDF_ADriver)
24
25 //=======================================================================
26 //function :
27 //purpose  : 
28 //=======================================================================
29 BinMXCAFDoc_NoteDriver::BinMXCAFDoc_NoteDriver(const Handle(CDM_MessageDriver)& theMsgDriver,
30                                                Standard_CString                 theName)
31   : BinMDF_ADriver(theMsgDriver, theName)
32 {
33
34 }
35
36 //=======================================================================
37 //function :
38 //purpose  : 
39 //=======================================================================
40 Standard_Boolean BinMXCAFDoc_NoteDriver::Paste(const BinObjMgt_Persistent&  theSource,
41                                                const Handle(TDF_Attribute)& theTarget,
42                                                BinObjMgt_RRelocationTable&  /*theRelocTable*/) const
43 {
44   Handle(XCAFDoc_Note) aNote = Handle(XCAFDoc_Note)::DownCast(theTarget);
45   if (aNote.IsNull())
46     return Standard_False;
47   
48   TCollection_ExtendedString aUserName, aTimeStamp;
49   if (!(theSource >> aUserName >> aTimeStamp))
50     return Standard_False;
51
52   aNote->Set(aUserName, aTimeStamp);
53
54   return Standard_True;
55 }
56
57 //=======================================================================
58 //function :
59 //purpose  : 
60 //=======================================================================
61 void BinMXCAFDoc_NoteDriver::Paste(const Handle(TDF_Attribute)& theSource,
62                                                                  BinObjMgt_Persistent&        theTarget,
63                                                                  BinObjMgt_SRelocationTable&  /*theRelocTable*/) const
64 {
65   Handle(XCAFDoc_Note) aNote = Handle(XCAFDoc_Note)::DownCast(theSource);
66   if (!aNote.IsNull())
67     theTarget << aNote->UserName() << aNote->TimeStamp();
68 }