1 // Created on: 2017-02-14
2 // Created by: Sergey NIKONOV
3 // Copyright (c) 2008-2017 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 <Message_Messenger.hxx>
17 #include <Standard_Type.hxx>
18 #include <TDF_Attribute.hxx>
19 #include <XCAFDoc_Note.hxx>
20 #include <XmlMXCAFDoc_NoteDriver.hxx>
21 #include <XmlObjMgt_Persistent.hxx>
23 IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_NoteDriver, XmlMDF_ADriver)
24 IMPLEMENT_DOMSTRING(UserName, "user_name")
25 IMPLEMENT_DOMSTRING(TimeStamp, "time_stamp")
27 //=======================================================================
30 //=======================================================================
31 XmlMXCAFDoc_NoteDriver::XmlMXCAFDoc_NoteDriver(const Handle(Message_Messenger)& theMsgDriver,
32 Standard_CString theName)
33 : XmlMDF_ADriver(theMsgDriver, theName)
37 //=======================================================================
40 //=======================================================================
41 Standard_Boolean XmlMXCAFDoc_NoteDriver::Paste(const XmlObjMgt_Persistent& theSource,
42 const Handle(TDF_Attribute)& theTarget,
43 XmlObjMgt_RRelocationTable& /*theRelocTable*/) const
45 const XmlObjMgt_Element& anElement = theSource;
47 XmlObjMgt_DOMString aUserName = anElement.getAttribute(::UserName());
48 XmlObjMgt_DOMString aTimeStamp = anElement.getAttribute(::TimeStamp());
49 if (aUserName == NULL || aTimeStamp == NULL)
50 return Standard_False;
52 Handle(XCAFDoc_Note) aNote = Handle(XCAFDoc_Note)::DownCast(theTarget);
54 return Standard_False;
56 aNote->Set(aUserName.GetString(), aTimeStamp.GetString());
61 //=======================================================================
64 //=======================================================================
65 void XmlMXCAFDoc_NoteDriver::Paste(const Handle(TDF_Attribute)& theSource,
66 XmlObjMgt_Persistent& theTarget,
67 XmlObjMgt_SRelocationTable& /*theRelocTable*/) const
69 Handle(XCAFDoc_Note) aNote = Handle(XCAFDoc_Note)::DownCast(theSource);
73 XmlObjMgt_DOMString aUserName(TCollection_AsciiString(aNote->UserName()).ToCString());
74 XmlObjMgt_DOMString aTimeStamp(TCollection_AsciiString(aNote->TimeStamp()).ToCString());
76 theTarget.Element().setAttribute(::UserName(), aUserName);
77 theTarget.Element().setAttribute(::TimeStamp(), aTimeStamp);