1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDSImpl_AttributePythonObject.cxx
21 // Author : Michael Ponikarov
24 #include "SALOMEDSImpl_AttributePythonObject.hxx"
28 const std::string& SALOMEDSImpl_AttributePythonObject::GetID()
30 static std::string SALOMEDSImpl_AttributePythonObjectID ("128371A3-8F52-11d6-A8A3-0001021E8C7F");
31 return SALOMEDSImpl_AttributePythonObjectID;
34 SALOMEDSImpl_AttributePythonObject* SALOMEDSImpl_AttributePythonObject::Set(const DF_Label& label)
36 SALOMEDSImpl_AttributePythonObject* A = NULL;
37 if (!(A = (SALOMEDSImpl_AttributePythonObject*)label.FindAttribute(SALOMEDSImpl_AttributePythonObject::GetID()))) {
38 A = new SALOMEDSImpl_AttributePythonObject();
39 label.AddAttribute(A);
44 SALOMEDSImpl_AttributePythonObject::SALOMEDSImpl_AttributePythonObject()
45 :SALOMEDSImpl_GenericAttribute("AttributePythonObject")
50 void SALOMEDSImpl_AttributePythonObject::SetObject(const string& theSequence,
55 mySequence = theSequence;
56 myIsScript = theScript;
58 SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
61 string SALOMEDSImpl_AttributePythonObject::GetObject() const
66 bool SALOMEDSImpl_AttributePythonObject::IsScript() const
71 int SALOMEDSImpl_AttributePythonObject::GetLength() const
73 return mySequence.size();
76 const std::string& SALOMEDSImpl_AttributePythonObject::ID() const
81 void SALOMEDSImpl_AttributePythonObject::Restore(DF_Attribute* with)
83 SALOMEDSImpl_AttributePythonObject* anObj = dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(with);
84 SetObject(anObj->GetObject(),anObj->IsScript());
87 DF_Attribute* SALOMEDSImpl_AttributePythonObject::NewEmpty() const
89 return new SALOMEDSImpl_AttributePythonObject();
92 void SALOMEDSImpl_AttributePythonObject::Paste(DF_Attribute* into)
94 SALOMEDSImpl_AttributePythonObject* anObj = dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(into);
95 anObj->SetObject(GetObject(),IsScript());
99 string SALOMEDSImpl_AttributePythonObject::Save()
101 string aString = GetObject();
102 string aResult = IsScript()?"s":"n";
108 void SALOMEDSImpl_AttributePythonObject::Load(const string& value)
110 char* aString = (char*)value.c_str();
111 SetObject(aString + 1, aString[0]=='s');