From: ouv Date: Thu, 26 Nov 2009 08:37:46 +0000 (+0000) Subject: Added method GetExpression( in boolean forceConvert ) X-Git-Tag: PHASE_17_Part1_V1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=342bb86db196a875a64d9bdd78b5d24fa3c80504;p=modules%2Fkernel.git Added method GetExpression( in boolean forceConvert ) --- diff --git a/idl/SALOME_Notebook.idl b/idl/SALOME_Notebook.idl index 199be1ced..39068ab86 100644 --- a/idl/SALOME_Notebook.idl +++ b/idl/SALOME_Notebook.idl @@ -122,6 +122,9 @@ module SALOME + //! change expression of the parameter + string GetExpression( in boolean forceConvert ); + //! return type of parameter ParamType GetType(); diff --git a/src/Notebook/SALOME_Notebook.cxx b/src/Notebook/SALOME_Notebook.cxx index c811839fa..6cc8a8418 100644 --- a/src/Notebook/SALOME_Notebook.cxx +++ b/src/Notebook/SALOME_Notebook.cxx @@ -396,7 +396,7 @@ void SALOME_Notebook::Remove( const char* theParamName ) { std::string anExpr; if( aParam->IsCalculable() ) - anExpr = aParam->Expression(); + anExpr = aParam->GetExpression( false ); else anExpr = aParam->AsString(); AddSubstitution( theParamName, anExpr, false ); @@ -815,7 +815,7 @@ char* SALOME_Notebook::DumpPython() if( aParam->IsCalculable() ) { aRes += "\""; - aRes += aParam->Expression(); + aRes += aParam->GetExpression( false ); aRes += "\""; } else @@ -899,7 +899,7 @@ char* SALOME_Notebook::Dump() if( pit->second->IsAnonymous() ) aStr += "[A] "; if( pit->second->IsCalculable() ) - aStr += pit->second->Expression() + " (val=" + pit->second->AsString() + ")"; + aStr += std::string( pit->second->GetExpression( false ) ) + " (val=" + pit->second->AsString() + ")"; else aStr += pit->second->AsString(); aStr += "\n"; diff --git a/src/Notebook/SALOME_Parameter.cxx b/src/Notebook/SALOME_Parameter.cxx index e99d259f8..a2f9a2980 100644 --- a/src/Notebook/SALOME_Parameter.cxx +++ b/src/Notebook/SALOME_Parameter.cxx @@ -277,9 +277,14 @@ bool SALOME_Parameter::IsCalculable() const return myIsCalculable; } -std::string SALOME_Parameter::Expression() const +char* SALOME_Parameter::GetExpression( CORBA::Boolean theForceConvert ) { - return myExpr.expression(); + const char* aRes; + if( IsCalculable() ) + aRes = myExpr.expression().c_str(); + else + aRes = theForceConvert ? myResult.toString().c_str() : ""; + return CORBA::string_dup( aRes ); } void SALOME_Parameter::Substitute( const std::string& theName, const SALOME_EvalExpr& theExpr ) diff --git a/src/Notebook/SALOME_Parameter.hxx b/src/Notebook/SALOME_Parameter.hxx index 1630a0435..fde123eac 100644 --- a/src/Notebook/SALOME_Parameter.hxx +++ b/src/Notebook/SALOME_Parameter.hxx @@ -71,6 +71,8 @@ public: virtual CORBA::Double AsReal(); virtual CORBA::Boolean AsBoolean(); + virtual char* GetExpression( CORBA::Boolean theForceConvert ); + SALOME_StringList Dependencies() const; std::string Save() const; @@ -79,7 +81,6 @@ public: bool IsAnonymous() const; bool IsCalculable() const; - std::string Expression() const; void Substitute( const std::string& theName, const SALOME_EvalExpr& theExpr ); private: