7fd59977 |
1 | // File: XmlMXCAFDoc_AreaDriver.cxx |
2 | // Created: Fri Aug 24 20:46:58 2001 |
3 | // Author: Alexnder GRIGORIEV |
4 | // Copyright: Open Cascade 2001 |
5 | // History: |
6 | |
7 | #include <XmlMXCAFDoc_AreaDriver.ixx> |
8 | #include <XCAFDoc_Area.hxx> |
9 | #include <XmlObjMgt.hxx> |
10 | |
11 | //======================================================================= |
12 | //function : XmlMXCAFDoc_AreaDriver |
13 | //purpose : Constructor |
14 | //======================================================================= |
15 | XmlMXCAFDoc_AreaDriver::XmlMXCAFDoc_AreaDriver |
16 | (const Handle(CDM_MessageDriver)& theMsgDriver) |
17 | : XmlMDF_ADriver (theMsgDriver, "xcaf", "Area") |
18 | {} |
19 | |
20 | //======================================================================= |
21 | //function : NewEmpty |
22 | //purpose : |
23 | //======================================================================= |
24 | Handle(TDF_Attribute) XmlMXCAFDoc_AreaDriver::NewEmpty() const |
25 | { |
26 | return (new XCAFDoc_Area()); |
27 | } |
28 | |
29 | //======================================================================= |
30 | //function : Paste |
31 | //purpose : persistent -> transient (retrieve) |
32 | //======================================================================= |
33 | Standard_Boolean XmlMXCAFDoc_AreaDriver::Paste |
34 | (const XmlObjMgt_Persistent& theSource, |
35 | const Handle(TDF_Attribute)& theTarget, |
36 | XmlObjMgt_RRelocationTable& ) const |
37 | { |
38 | Standard_Real aValue; |
39 | XmlObjMgt_DOMString aRealStr = XmlObjMgt::GetStringValue (theSource); |
40 | |
41 | if (XmlObjMgt::GetReal(aRealStr, aValue) == Standard_False) { |
42 | TCollection_ExtendedString aMessageString = |
43 | TCollection_ExtendedString("Cannot retrieve Area attribute from \"") |
44 | + aRealStr + "\""; |
45 | WriteMessage (aMessageString); |
46 | return Standard_False; |
47 | } |
48 | |
49 | Handle(XCAFDoc_Area) anInt = Handle(XCAFDoc_Area)::DownCast(theTarget); |
50 | anInt->Set(aValue); |
51 | |
52 | return Standard_True; |
53 | } |
54 | |
55 | //======================================================================= |
56 | //function : Paste |
57 | //purpose : transient -> persistent (store) |
58 | //======================================================================= |
59 | void XmlMXCAFDoc_AreaDriver::Paste (const Handle(TDF_Attribute)& theSource, |
60 | XmlObjMgt_Persistent& theTarget, |
61 | XmlObjMgt_SRelocationTable& ) const |
62 | { |
63 | Handle(XCAFDoc_Area) anInt = Handle(XCAFDoc_Area)::DownCast(theSource); |
64 | TCollection_AsciiString aValueStr (anInt->Get()); |
65 | XmlObjMgt::SetStringValue (theTarget, aValueStr.ToCString()); |
66 | } |