2 // File : SALOMEDS_IORAttribute.cxx
3 // Created : Wed Nov 28 16:09:35 2001
4 // Author : Yves FRICAUD
7 // Copyright : Open CASCADE 2001
10 #include "SALOMEDS_IORAttribute.ixx"
11 #include <TDataStd_Comment.hxx>
12 #include <TCollection_ExtendedString.hxx>
13 #include "SALOMEDS_Study_i.hxx"
15 //=======================================================================
18 //=======================================================================
20 const Standard_GUID& SALOMEDS_IORAttribute::GetID ()
22 static Standard_GUID SALOMEDS_IORAttributeID ("92888E01-7074-11d5-A690-0800369C8A03");
23 return SALOMEDS_IORAttributeID;
28 //=======================================================================
31 //=======================================================================
33 Handle(SALOMEDS_IORAttribute) SALOMEDS_IORAttribute::Set (const TDF_Label& L,
34 const TCollection_ExtendedString& S,
37 Handle(SALOMEDS_IORAttribute) A;
38 if (!L.FindAttribute(SALOMEDS_IORAttribute::GetID(),A)) {
39 A = new SALOMEDS_IORAttribute();
43 (Handle(TDataStd_Comment)::DownCast(A))->Set (S);
44 SALOMEDS_Study_i::IORUpdated(A,orb);
48 //=======================================================================
49 //function : constructor
51 //=======================================================================
52 SALOMEDS_IORAttribute::SALOMEDS_IORAttribute()
55 //=======================================================================
58 //=======================================================================
60 const Standard_GUID& SALOMEDS_IORAttribute::ID () const { return GetID(); }
63 //=======================================================================
66 //=======================================================================
68 Handle(TDF_Attribute) SALOMEDS_IORAttribute::NewEmpty () const
70 return new SALOMEDS_IORAttribute();
73 //=======================================================================
76 //=======================================================================
78 void SALOMEDS_IORAttribute::Restore(const Handle(TDF_Attribute)& with)
80 TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get ();
81 TDataStd_Comment::Set(s);
85 //=======================================================================
88 //=======================================================================
90 void SALOMEDS_IORAttribute::Paste (const Handle(TDF_Attribute)& into,
91 const Handle(TDF_RelocationTable)& RT) const
93 Handle(TDataStd_Comment)::DownCast (into)->Set (Get());