From c9c12ac5d1425212b12986cc009286763d1b5d3c Mon Sep 17 00:00:00 2001 From: srn Date: Tue, 17 Oct 2006 10:32:13 +0000 Subject: [PATCH] IMP PAL13614: Added a new attrubute AttributeString --- idl/SALOMEDS_Attributes.idl | 18 +++ src/SALOMEDS/Makefile.am | 4 + src/SALOMEDS/SALOMEDS_AttributeString.cxx | 62 ++++++++++ src/SALOMEDS/SALOMEDS_AttributeString.hxx | 47 ++++++++ src/SALOMEDS/SALOMEDS_AttributeString_i.cxx | 49 ++++++++ src/SALOMEDS/SALOMEDS_AttributeString_i.hxx | 47 ++++++++ src/SALOMEDS/SALOMEDS_Attributes.hxx | 5 +- src/SALOMEDS/SALOMEDS_ClientAttributes.hxx | 8 +- src/SALOMEDSClient/Makefile.am | 1 + src/SALOMEDSClient/SALOMEDSClient.hxx | 1 + src/SALOMEDSImpl/Makefile.am | 4 + .../SALOMEDSImpl_AttributeString.cxx | 108 ++++++++++++++++++ .../SALOMEDSImpl_AttributeString.hxx | 70 ++++++++++++ src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx | 5 +- 14 files changed, 425 insertions(+), 4 deletions(-) create mode 100644 src/SALOMEDS/SALOMEDS_AttributeString.cxx create mode 100644 src/SALOMEDS/SALOMEDS_AttributeString.hxx create mode 100644 src/SALOMEDS/SALOMEDS_AttributeString_i.cxx create mode 100644 src/SALOMEDS/SALOMEDS_AttributeString_i.hxx create mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx create mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx diff --git a/idl/SALOMEDS_Attributes.idl b/idl/SALOMEDS_Attributes.idl index d992ece00..6e50fb52f 100644 --- a/idl/SALOMEDS_Attributes.idl +++ b/idl/SALOMEDS_Attributes.idl @@ -262,6 +262,24 @@ module SALOMEDS \param value This string parameter defines the value of this attribute - a description of a %SObject.
See also an example of this method usage in batchmode of %SALOME application. +*/ + void SetValue(in string value); + }; + //========================================================================== +/*! \brief String attribute + + This attribute stores a string value containing arbitrary information. +*/ + //========================================================================== + interface AttributeString : GenericAttribute + { +/*! + Returns the value of this attribute +*/ + string Value(); +/*! + Sets the value of this attribute + \param value This string parameter defines the value of this attribute. */ void SetValue(in string value); }; diff --git a/src/SALOMEDS/Makefile.am b/src/SALOMEDS/Makefile.am index 00ead570a..ea225cb8f 100644 --- a/src/SALOMEDS/Makefile.am +++ b/src/SALOMEDS/Makefile.am @@ -140,6 +140,7 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_AttributeStudyProperties_i.cxx \ SALOMEDS_AttributePythonObject_i.cxx \ SALOMEDS_AttributeParameter_i.cxx \ + SALOMEDS_AttributeString_i.cxx \ SALOMEDS_SObject.cxx \ SALOMEDS_SComponent.cxx \ SALOMEDS_GenericAttribute.cxx \ @@ -180,6 +181,7 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_AttributeUserID.cxx \ SALOMEDS_TMPFile_i.cxx \ SALOMEDS_AttributeParameter.cxx \ + SALOMEDS_AttributeString.cxx \ SALOMEDS_IParameters.cxx \ \ Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx \ @@ -322,6 +324,8 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_UseCaseIterator_i.hxx \ SALOMEDS_AttributeParameter.hxx \ SALOMEDS_AttributeParameter_i.hxx \ + SALOMEDS_AttributeString.hxx \ + SALOMEDS_AttributeString_i.hxx \ SALOMEDS_TMPFile_i.hxx libSalomeDS_la_CPPFLAGS = $(COMMON_CPPFLAGS) diff --git a/src/SALOMEDS/SALOMEDS_AttributeString.cxx b/src/SALOMEDS/SALOMEDS_AttributeString.cxx new file mode 100644 index 000000000..dcf1f06fd --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeString.cxx @@ -0,0 +1,62 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SALOMEDS_AttributeString.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeString.hxx" +#include "SALOMEDS.hxx" + +#include +#include +#include + +SALOMEDS_AttributeString::SALOMEDS_AttributeString(const Handle(SALOMEDSImpl_AttributeString)& theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeString::SALOMEDS_AttributeString(SALOMEDS::AttributeString_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeString::~SALOMEDS_AttributeString() +{} + +std::string SALOMEDS_AttributeString::Value() +{ + std::string aValue; + if (_isLocal) { + SALOMEDS::Locker lock; + aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeString):: + DownCast(_local_impl)->Value()).ToCString(); + } + else aValue = SALOMEDS::AttributeString::_narrow(_corba_impl)->Value(); + return aValue; +} + +void SALOMEDS_AttributeString::SetValue(const std::string& value) +{ + if (_isLocal) { + CheckLocked(); + SALOMEDS::Locker lock; + Handle(SALOMEDSImpl_AttributeString)::DownCast(_local_impl)->SetValue((char*)value.c_str()); + } + else SALOMEDS::AttributeString::_narrow(_corba_impl)->SetValue(value.c_str()); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeString.hxx b/src/SALOMEDS/SALOMEDS_AttributeString.hxx new file mode 100644 index 000000000..025ae7836 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeString.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SALOMEDS_AttributeString.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeString_HeaderFile +#define SALOMEDS_AttributeString_HeaderFile + +#include "SALOMEDSClient_AttributeString.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeString: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeString +{ +public: + SALOMEDS_AttributeString(const Handle(SALOMEDSImpl_AttributeString)& theAttr); + SALOMEDS_AttributeString(SALOMEDS::AttributeString_ptr theAttr); + ~SALOMEDS_AttributeString(); + + virtual std::string Value(); + virtual void SetValue(const std::string& value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx new file mode 100644 index 000000000..62f9de652 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx @@ -0,0 +1,49 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SALOMEDS_AttributeString_i.cxx +// Author : Sergey RUIN +// Module : SALOME + + +#include "SALOMEDS_AttributeString_i.hxx" + +#include +#include "SALOMEDS_SObject_i.hxx" +#include "SALOMEDS.hxx" + +using namespace std; + +char* SALOMEDS_AttributeString_i::Value() +{ + SALOMEDS::Locker lock; + + CORBA::String_var c_s = + CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeString)::DownCast(_impl)->Value()).ToCString()); + return c_s._retn(); +} + +void SALOMEDS_AttributeString_i::SetValue(const char* value) +{ + SALOMEDS::Locker lock; + + CheckLocked(); + TCollection_AsciiString aStr((char*)value); + Handle(SALOMEDSImpl_AttributeString)::DownCast(_impl)->SetValue(TCollection_ExtendedString(aStr)); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx new file mode 100644 index 000000000..1fa8e024f --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SALOMEDS_AttributeString_i.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeString_i_HeaderFile +#define SALOMEDS_AttributeString_i_HeaderFile + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" + +class SALOMEDS_AttributeString_i: public virtual POA_SALOMEDS::AttributeString, + public virtual SALOMEDS_GenericAttribute_i +{ +public: + SALOMEDS_AttributeString_i(const Handle(SALOMEDSImpl_AttributeString)& theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + + virtual ~SALOMEDS_AttributeString_i() {}; + + char* Value(); + void SetValue(const char* value); +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_Attributes.hxx b/src/SALOMEDS/SALOMEDS_Attributes.hxx index c27e95d2d..4c9901729 100644 --- a/src/SALOMEDS/SALOMEDS_Attributes.hxx +++ b/src/SALOMEDS/SALOMEDS_Attributes.hxx @@ -55,6 +55,7 @@ #include "SALOMEDSImpl_AttributeFlags.hxx" #include "SALOMEDSImpl_AttributeGraphic.hxx" #include "SALOMEDSImpl_AttributeParameter.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" #include "SALOMEDS_AttributeName_i.hxx" @@ -86,6 +87,7 @@ #include "SALOMEDS_AttributeFlags_i.hxx" #include "SALOMEDS_AttributeGraphic_i.hxx" #include "SALOMEDS_AttributeParameter_i.hxx" +#include "SALOMEDS_AttributeString_i.hxx" #define __CreateCORBAAttribute(CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \ Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theAttr); \ @@ -124,6 +126,7 @@ __CreateCORBAAttribute(AttributeFlags) \ __CreateCORBAAttribute(AttributeGraphic) \ __CreateCORBAAttribute(AttributeTreeNode) \ __CreateCORBAAttribute(AttributeUserID) \ -__CreateCORBAAttribute(AttributeParameter) +__CreateCORBAAttribute(AttributeParameter) \ +__CreateCORBAAttribute(AttributeString) #endif diff --git a/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx b/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx index 69ae2d131..cb6786209 100644 --- a/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx +++ b/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx @@ -56,6 +56,7 @@ #include "SALOMEDSImpl_AttributeFlags.hxx" #include "SALOMEDSImpl_AttributeGraphic.hxx" #include "SALOMEDSImpl_AttributeParameter.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" #include "SALOMEDS_GenericAttribute.hxx" #include "SALOMEDS_AttributeName.hxx" @@ -87,6 +88,7 @@ #include "SALOMEDS_AttributeFlags.hxx" #include "SALOMEDS_AttributeGraphic.hxx" #include "SALOMEDS_AttributeParameter.hxx" +#include "SALOMEDS_AttributeString.hxx" #define __CreateClientAttributeLocal(CORBA_Name) if (strcmp(aTypeOfAttribute.c_str(), #CORBA_Name) == 0) { \ Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theGA); \ @@ -127,7 +129,8 @@ __CreateClientAttributeLocal(AttributeFlags) \ __CreateClientAttributeLocal(AttributeGraphic) \ __CreateClientAttributeLocal(AttributeTreeNode) \ __CreateClientAttributeLocal(AttributeUserID) \ -__CreateClientAttributeLocal(AttributeParameter) +__CreateClientAttributeLocal(AttributeParameter) \ +__CreateClientAttributeLocal(AttributeString) #define __CreateGenericClientAttributeCORBA \ __CreateClientAttributeCORBA(AttributeReal) \ @@ -158,6 +161,7 @@ __CreateClientAttributeCORBA(AttributeFlags) \ __CreateClientAttributeCORBA(AttributeGraphic) \ __CreateClientAttributeCORBA(AttributeTreeNode) \ __CreateClientAttributeCORBA(AttributeUserID) \ -__CreateClientAttributeCORBA(AttributeParameter) +__CreateClientAttributeCORBA(AttributeParameter) \ +__CreateClientAttributeCORBA(AttributeString) #endif diff --git a/src/SALOMEDSClient/Makefile.am b/src/SALOMEDSClient/Makefile.am index 489548895..4615a1a86 100644 --- a/src/SALOMEDSClient/Makefile.am +++ b/src/SALOMEDSClient/Makefile.am @@ -55,6 +55,7 @@ salomeinclude_HEADERS=\ SALOMEDSClient_AttributeTreeNode.hxx \ SALOMEDSClient_AttributeUserID.hxx \ SALOMEDSClient_AttributeParameter.hxx \ + SALOMEDSClient_AttributeString.hxx \ SALOMEDSClient_ChildIterator.hxx \ SALOMEDSClient_GenericAttribute.hxx \ SALOMEDSClient_SComponent.hxx \ diff --git a/src/SALOMEDSClient/SALOMEDSClient.hxx b/src/SALOMEDSClient/SALOMEDSClient.hxx index a03c019e0..6551f3cbb 100644 --- a/src/SALOMEDSClient/SALOMEDSClient.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient.hxx @@ -50,6 +50,7 @@ #include "SALOMEDSClient_AttributeTreeNode.hxx" #include "SALOMEDSClient_AttributeUserID.hxx" #include "SALOMEDSClient_AttributeParameter.hxx" +#include "SALOMEDSClient_AttributeString.hxx" #include "SALOMEDSClient_ChildIterator.hxx" #include "SALOMEDSClient_GenericAttribute.hxx" #include "SALOMEDSClient_SComponent.hxx" diff --git a/src/SALOMEDSImpl/Makefile.am b/src/SALOMEDSImpl/Makefile.am index ca9352aab..a228cac57 100644 --- a/src/SALOMEDSImpl/Makefile.am +++ b/src/SALOMEDSImpl/Makefile.am @@ -66,6 +66,7 @@ salomeinclude_HEADERS= \ SALOMEDSImpl_AttributeComment.hxx \ SALOMEDSImpl_AttributeReference.hxx \ SALOMEDSImpl_AttributeParameter.hxx \ + SALOMEDSImpl_AttributeString.hxx \ SALOMEDSImpl_UseCaseBuilder.hxx \ SALOMEDSImpl_UseCaseIterator.hxx \ SALOMEDSImpl_SComponentIterator.hxx \ @@ -147,6 +148,7 @@ libSalomeDSImpl_la_SOURCES =\ SALOMEDSImpl_AttributeComment.cxx \ SALOMEDSImpl_AttributeReference.cxx \ SALOMEDSImpl_AttributeParameter.cxx \ + SALOMEDSImpl_AttributeString.cxx \ SALOMEDSImpl_ChildNodeIterator.cxx \ SALOMEDSImpl_UseCaseBuilder.cxx \ SALOMEDSImpl_UseCaseIterator.cxx \ @@ -187,6 +189,8 @@ libSalomeDSImpl_la_SOURCES =\ SALOMEDSImpl_AttributeTextHighlightColor.hxx \ SALOMEDSImpl_AttributeTreeNode.hxx \ SALOMEDSImpl_AttributeUserID.hxx \ + SALOMEDSImpl_AttributeParameter.hxx \ + SALOMEDSImpl_AttributeString.hxx \ SALOMEDSImpl_Callback.hxx \ SALOMEDSImpl_ChildIterator.hxx \ SALOMEDSImpl_ChildNodeIterator.hxx \ diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx new file mode 100644 index 000000000..7a7ee76a9 --- /dev/null +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx @@ -0,0 +1,108 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SALOMEDSImpl_AttributeString.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDSImpl_AttributeString.hxx" + +#ifndef WNT +using namespace std; +#endif + +IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute ) +IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute ) + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& SALOMEDSImpl_AttributeString::GetID () +{ + static Standard_GUID CommentID ("1808A12F-AD0E-4a6a-B58A-395DCF469FE9"); + return CommentID; +} + +Handle(SALOMEDSImpl_AttributeString) SALOMEDSImpl_AttributeString::Set (const TDF_Label& L, + const TCollection_ExtendedString& Val) +{ + Handle(SALOMEDSImpl_AttributeString) A; + if (!L.FindAttribute(SALOMEDSImpl_AttributeString::GetID(), A)) { + A = new SALOMEDSImpl_AttributeString(); + L.AddAttribute(A); + } + + A->SetValue(Val); + + return A; +} + +//======================================================================= +//function : SetValue +//purpose : +//======================================================================= +void SALOMEDSImpl_AttributeString::SetValue (const TCollection_ExtendedString& S) +{ + CheckLocked(); + + if(myString == S) return; + + Backup(); + + myString = S; + + SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved +} + + +//======================================================================= +//function : ID +//purpose : +//======================================================================= +const Standard_GUID& SALOMEDSImpl_AttributeString::ID () const { return GetID(); } + +//======================================================================= +//function : NewEmpty +//purpose : +//======================================================================= +Handle(TDF_Attribute) SALOMEDSImpl_AttributeString::NewEmpty () const +{ + return new SALOMEDSImpl_AttributeString(); +} + +//======================================================================= +//function : Restore +//purpose : +//======================================================================= +void SALOMEDSImpl_AttributeString::Restore(const Handle(TDF_Attribute)& with) +{ + myString = Handle(SALOMEDSImpl_AttributeString)::DownCast (with)->Value (); +} + +//======================================================================= +//function : Paste +//purpose : +//======================================================================= + +void SALOMEDSImpl_AttributeString::Paste (const Handle(TDF_Attribute)& into, + const Handle(TDF_RelocationTable)& RT) const +{ + Handle(SALOMEDSImpl_AttributeString)::DownCast (into)->SetValue(myString); +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx new file mode 100644 index 000000000..ec0711106 --- /dev/null +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx @@ -0,0 +1,70 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SALOMEDSImpl_AttributeIOR.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef _SALOMEDSImpl_AttributeString_HeaderFile +#define _SALOMEDSImpl_AttributeString_HeaderFile + +#include +#include +#include +#include +#include +#include +#include "SALOMEDSImpl_GenericAttribute.hxx" + +class Handle(TDF_Attribute); +class Handle(TDF_RelocationTable); + +DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute ) + +class SALOMEDSImpl_AttributeString : public SALOMEDSImpl_GenericAttribute +{ +private: + + TCollection_ExtendedString myString; + +public: + +Standard_EXPORT static const Standard_GUID& GetID() ; + +Standard_EXPORT SALOMEDSImpl_AttributeString() :SALOMEDSImpl_GenericAttribute("AttributeString") {} + +Standard_EXPORT static Handle(SALOMEDSImpl_AttributeString) Set(const TDF_Label& L, const TCollection_ExtendedString& Val); +Standard_EXPORT void SetValue (const TCollection_ExtendedString& S); +Standard_EXPORT TCollection_ExtendedString Value() const { return myString; } + +Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; } +Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; } + +Standard_EXPORT const Standard_GUID& ID() const; +Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; +Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; +Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; + +Standard_EXPORT ~SALOMEDSImpl_AttributeString() {} + +public: + DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeString ) +}; + +#endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx index 118cdf3d8..7850a71e0 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx @@ -64,6 +64,7 @@ public : #include "SALOMEDSImpl_AttributeFlags.hxx" #include "SALOMEDSImpl_AttributeGraphic.hxx" #include "SALOMEDSImpl_AttributeParameter.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" #define __AttributeTypeToGUIDForSObject \ @@ -95,7 +96,8 @@ public : if(theType == "AttributeFlags") return SALOMEDSImpl_AttributeFlags::GetID(); \ if(theType == "AttributeGraphic") return SALOMEDSImpl_AttributeGraphic::GetID(); \ if(theType == "AttributeReference") return SALOMEDSImpl_AttributeReference::GetID(); \ - if(theType == "AttributeParameter") return SALOMEDSImpl_AttributeParameter::GetID(); + if(theType == "AttributeParameter") return SALOMEDSImpl_AttributeParameter::GetID(); \ + if(theType == "AttributeString") return SALOMEDSImpl_AttributeString::GetID(); #define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \ @@ -132,6 +134,7 @@ __FindOrCreateAttributeLocked(AttributeTableOfReal) \ __FindOrCreateAttributeLocked(AttributeTableOfString) \ __FindOrCreateAttributeLocked(AttributePythonObject) \ __FindOrCreateAttributeLocked(AttributeParameter) \ +__FindOrCreateAttributeLocked(AttributeString) \ __FindOrCreateAttribute(AttributePersistentRef) \ __FindOrCreateAttribute(AttributeDrawable) \ __FindOrCreateAttribute(AttributeSelectable) \ -- 2.39.2