2 // File : SALOMEDS_PythonObjectAttribute.cxx
3 // Created : Tue Oct 8 10:13:30 2002
4 // Author : Michael Ponikarov
7 // Copyright : Open CASCADE
10 #include "SALOMEDS_PythonObjectAttribute.ixx"
13 const Standard_GUID& SALOMEDS_PythonObjectAttribute::GetID()
15 static Standard_GUID SALOMEDS_PythonObjectAttributeID ("128371A3-8F52-11d6-A8A3-0001021E8C7F");
16 return SALOMEDS_PythonObjectAttributeID;
19 Handle(SALOMEDS_PythonObjectAttribute) SALOMEDS_PythonObjectAttribute::Set(const TDF_Label& label)
21 Handle(SALOMEDS_PythonObjectAttribute) anAttr;
22 if (!label.FindAttribute(SALOMEDS_PythonObjectAttribute::GetID(),anAttr)) {
23 anAttr = new SALOMEDS_PythonObjectAttribute();
24 label.AddAttribute(anAttr);
29 SALOMEDS_PythonObjectAttribute::SALOMEDS_PythonObjectAttribute()
33 void SALOMEDS_PythonObjectAttribute::SetObject(const Standard_CString theSequence,
34 const Standard_Boolean theScript)
37 if(mySequence != NULL) delete mySequence;
38 if (theSequence == NULL) {
41 mySequence = new char[strlen(theSequence)+1];
42 strcpy(mySequence, theSequence);
45 myIsScript = theScript;
48 Standard_CString SALOMEDS_PythonObjectAttribute::GetObject() const
53 Standard_Boolean SALOMEDS_PythonObjectAttribute::IsScript() const
58 Standard_Integer SALOMEDS_PythonObjectAttribute::GetLength() const
60 if (mySequence == NULL) return 0;
61 return (strlen(mySequence)+1);
64 const Standard_GUID& SALOMEDS_PythonObjectAttribute::ID() const
69 void SALOMEDS_PythonObjectAttribute::Restore(const Handle(TDF_Attribute)& with)
71 Handle(SALOMEDS_PythonObjectAttribute) anObj = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(with);
72 SetObject(anObj->GetObject(),anObj->IsScript());
75 Handle(TDF_Attribute) SALOMEDS_PythonObjectAttribute::NewEmpty() const
77 return new SALOMEDS_PythonObjectAttribute();
80 void SALOMEDS_PythonObjectAttribute::Paste(const Handle(TDF_Attribute)& into,
81 const Handle(TDF_RelocationTable)&) const
83 Handle(SALOMEDS_PythonObjectAttribute) anObj = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(into);
84 anObj->SetObject(GetObject(),IsScript());