From 86bc8101048a80858b037ea21c0941a19ab2b6fb Mon Sep 17 00:00:00 2001 From: ouv Date: Thu, 3 Dec 2009 11:20:36 +0000 Subject: [PATCH] Debug (problem with SALOME_Notebook::Substitute method) --- src/Notebook/SALOME_EvalParser.cxx | 13 +++++++++++++ src/Notebook/SALOME_EvalParser.hxx | 2 ++ src/Notebook/SALOME_Notebook.cxx | 14 ++++++++++++++ 3 files changed, 29 insertions(+) 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 ); } -- 2.39.2