b311480e |
1 | // Created on: 2001-08-24 |
2 | // Created by: Alexnder GRIGORIEV |
973c2be1 |
3 | // Copyright (c) 2001-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 | |
42cf5bc1 |
16 | |
83ae3591 |
17 | #include <Message_Messenger.hxx> |
42cf5bc1 |
18 | #include <Standard_Type.hxx> |
7fd59977 |
19 | #include <TDataStd_Comment.hxx> |
42cf5bc1 |
20 | #include <TDF_Attribute.hxx> |
21 | #include <XmlMDataStd_CommentDriver.hxx> |
7fd59977 |
22 | #include <XmlObjMgt.hxx> |
42cf5bc1 |
23 | #include <XmlObjMgt_Persistent.hxx> |
7fd59977 |
24 | |
92efcf78 |
25 | IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_CommentDriver,XmlMDF_ADriver) |
26 | |
7fd59977 |
27 | //======================================================================= |
28 | //function : XmlMDataStd_CommentDriver |
29 | //purpose : Constructor |
30 | //======================================================================= |
7fd59977 |
31 | XmlMDataStd_CommentDriver::XmlMDataStd_CommentDriver |
83ae3591 |
32 | (const Handle(Message_Messenger)& theMsgDriver) |
7fd59977 |
33 | : XmlMDF_ADriver (theMsgDriver, NULL) |
34 | {} |
35 | |
36 | //======================================================================= |
37 | //function : NewEmpty |
38 | //purpose : |
39 | //======================================================================= |
40 | Handle(TDF_Attribute) XmlMDataStd_CommentDriver::NewEmpty() const |
41 | { |
42 | return (new TDataStd_Comment()); |
43 | } |
44 | |
45 | //======================================================================= |
46 | //function : Paste |
47 | //purpose : |
48 | //======================================================================= |
49 | Standard_Boolean XmlMDataStd_CommentDriver::Paste |
50 | (const XmlObjMgt_Persistent& theSource, |
51 | const Handle(TDF_Attribute)& theTarget, |
52 | XmlObjMgt_RRelocationTable& ) const |
53 | { |
54 | TCollection_ExtendedString aString; |
55 | if (XmlObjMgt::GetExtendedString (theSource, aString)) |
56 | { |
57 | Handle(TDataStd_Comment)::DownCast(theTarget) -> Set (aString); |
58 | return Standard_True; |
59 | } |
83ae3591 |
60 | myMessageDriver->Send("error retrieving ExtendedString for type TDataStd_Comment", Message_Fail); |
7fd59977 |
61 | return Standard_False; |
62 | } |
63 | |
64 | //======================================================================= |
65 | //function : Paste |
66 | //purpose : |
67 | //======================================================================= |
68 | void XmlMDataStd_CommentDriver::Paste (const Handle(TDF_Attribute)& theSource, |
69 | XmlObjMgt_Persistent& theTarget, |
70 | XmlObjMgt_SRelocationTable& ) const |
71 | { |
72 | Handle(TDataStd_Comment) aName= Handle(TDataStd_Comment)::DownCast(theSource); |
73 | XmlObjMgt::SetExtendedString (theTarget, aName -> Get()); |
74 | } |