From: ouv Date: Thu, 3 Dec 2009 11:20:36 +0000 (+0000) Subject: Debug (problem with SALOME_Notebook::Substitute method) X-Git-Tag: PHASE_17_Part1_V1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=86bc8101048a80858b037ea21c0941a19ab2b6fb;p=modules%2Fkernel.git Debug (problem with SALOME_Notebook::Substitute method) --- diff --git a/src/Notebook/SALOME_EvalParser.cxx b/src/Notebook/SALOME_EvalParser.cxx index d022a1ca1..72fa687d1 100755 --- a/src/Notebook/SALOME_EvalParser.cxx +++ b/src/Notebook/SALOME_EvalParser.cxx @@ -945,6 +945,19 @@ bool SALOME_EvalParser::isMonoParam() const return myError==EvalExpr_OK && myPostfix.size()==1 && myPostfix.begin()->myType==Param; } +//======================================================================= +//function : isMonoParam +//purpose : +//======================================================================= +bool SALOME_EvalParser::hasPostfix( const SALOME_String& theName ) const +{ + Postfix::const_iterator it = myPostfix.begin(), last = myPostfix.end(); + for( ; it!=last; it++ ) + if( it->myValue.toString() == theName ) + return true; + return false; +} + //======================================================================= //function : substitute //purpose : diff --git a/src/Notebook/SALOME_EvalParser.hxx b/src/Notebook/SALOME_EvalParser.hxx index 673c1d195..bc9480b15 100755 --- a/src/Notebook/SALOME_EvalParser.hxx +++ b/src/Notebook/SALOME_EvalParser.hxx @@ -68,6 +68,8 @@ public: SALOME_StringList parameters () const; bool isMonoParam () const; + virtual bool hasPostfix( const SALOME_String& theName ) const; + static SALOME_String toString( const SALOME_ListOfEvalVariant& theList ); protected: diff --git a/src/Notebook/SALOME_Notebook.cxx b/src/Notebook/SALOME_Notebook.cxx index e01da2512..fbc021776 100644 --- a/src/Notebook/SALOME_Notebook.cxx +++ b/src/Notebook/SALOME_Notebook.cxx @@ -309,12 +309,26 @@ bool SALOME_Notebook::Substitute( SubstitutionInfo& theSubstitution ) for( int i=0; ihasPostfix( anOldName ) ) + { + if( !isRename && anOldName == aParams[i].in() ) + AddExpression( aNewName.c_str() ); + SALOME_EvalExpr aTmpExpr2( aNewName ); + aTmpExpr1.substitute( anOldName, aTmpExpr2 ); + aParams[i] = CORBA::string_dup( aTmpExpr1.expression().c_str() ); + } } anObj->SetParameters( _this(), aParams ); }