1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SALOMEDSImpl_AttributePythonObject.cxx
23 // Author : Michael Ponikarov
26 #include "SALOMEDSImpl_AttributePythonObject.hxx"
30 const std::string& SALOMEDSImpl_AttributePythonObject::GetID()
32 static std::string SALOMEDSImpl_AttributePythonObjectID ("128371A3-8F52-11d6-A8A3-0001021E8C7F");
33 return SALOMEDSImpl_AttributePythonObjectID;
36 SALOMEDSImpl_AttributePythonObject* SALOMEDSImpl_AttributePythonObject::Set(const DF_Label& label)
38 SALOMEDSImpl_AttributePythonObject* A = NULL;
39 if (!(A = (SALOMEDSImpl_AttributePythonObject*)label.FindAttribute(SALOMEDSImpl_AttributePythonObject::GetID()))) {
40 A = new SALOMEDSImpl_AttributePythonObject();
41 label.AddAttribute(A);
46 SALOMEDSImpl_AttributePythonObject::SALOMEDSImpl_AttributePythonObject()
47 :SALOMEDSImpl_GenericAttribute("AttributePythonObject")
52 void SALOMEDSImpl_AttributePythonObject::SetObject(const string& theSequence,
57 mySequence = theSequence;
58 myIsScript = theScript;
60 SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
63 string SALOMEDSImpl_AttributePythonObject::GetObject() const
68 bool SALOMEDSImpl_AttributePythonObject::IsScript() const
73 int SALOMEDSImpl_AttributePythonObject::GetLength() const
75 return mySequence.size();
78 const std::string& SALOMEDSImpl_AttributePythonObject::ID() const
83 void SALOMEDSImpl_AttributePythonObject::Restore(DF_Attribute* with)
85 SALOMEDSImpl_AttributePythonObject* anObj = dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(with);
86 SetObject(anObj->GetObject(),anObj->IsScript());
89 DF_Attribute* SALOMEDSImpl_AttributePythonObject::NewEmpty() const
91 return new SALOMEDSImpl_AttributePythonObject();
94 void SALOMEDSImpl_AttributePythonObject::Paste(DF_Attribute* into)
96 SALOMEDSImpl_AttributePythonObject* anObj = dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(into);
97 anObj->SetObject(GetObject(),IsScript());
101 string SALOMEDSImpl_AttributePythonObject::Save()
103 string aString = GetObject();
104 string aResult = IsScript()?"s":"n";
110 void SALOMEDSImpl_AttributePythonObject::Load(const string& value)
112 char* aString = (char*)value.c_str();
113 SetObject(aString + 1, aString[0]=='s');