From 0fda01cc9fdd9674853b8f787aeecb8d66f90fea Mon Sep 17 00:00:00 2001 From: asl Date: Fri, 20 Nov 2009 14:57:08 +0000 Subject: [PATCH] new method isMonoParam() - it checks if expression contains only one parameter without any operations --- src/Notebook/SALOME_EvalParser.cxx | 10 ++++++++++ src/Notebook/SALOME_EvalParser.hxx | 12 +++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Notebook/SALOME_EvalParser.cxx b/src/Notebook/SALOME_EvalParser.cxx index 905b7adf8..2b20e7e71 100755 --- a/src/Notebook/SALOME_EvalParser.cxx +++ b/src/Notebook/SALOME_EvalParser.cxx @@ -858,6 +858,16 @@ void SALOME_EvalParser::setError(SALOME_EvalExprError err) { myError = err; } + +//======================================================================= +//function : isMonoParam +//purpose : +//======================================================================= +bool SALOME_EvalParser::isMonoParam() const +{ + return myError == EvalExpr_OK && myPostfix.size()==1 && myPostfix.begin()->myType == Param; +} + //======================================================================= //function : dump //purpose : diff --git a/src/Notebook/SALOME_EvalParser.hxx b/src/Notebook/SALOME_EvalParser.hxx index a575af088..9764ad02d 100755 --- a/src/Notebook/SALOME_EvalParser.hxx +++ b/src/Notebook/SALOME_EvalParser.hxx @@ -70,6 +70,8 @@ public: static SALOME_String toString( const SALOME_ListOfEvalVariant& ); + bool isMonoParam() const; + protected: //! Types of postfix representation elements typedef enum @@ -90,8 +92,8 @@ protected: PostfixItemType myType; } PostfixItem; - typedef list Postfix; //!< postfix representation - typedef SALOME_ListOfEvalSet SetList; //!< list of operations + typedef list Postfix; //!< postfix representation + typedef SALOME_ListOfEvalSet SetList; //!< list of operations typedef map ParamMap; //!< parameter-to-value map typedef map ::value_type PairParamMap; @@ -120,9 +122,9 @@ private: SALOME_EvalExprError calculation( const SALOME_String&, SALOME_EvalVariant&, SALOME_EvalVariant& ) const; bool checkOperations() const; - void insert( Postfix& aL, const int aIndex, PostfixItem& aItem ); - const PostfixItem& at( const Postfix& aL, const int aIndex ); - void append( Postfix& aL, const Postfix& aL1 ); + static void insert( Postfix& aL, const int aIndex, PostfixItem& aItem ); + static const PostfixItem& at( const Postfix& aL, const int aIndex ); + static void append( Postfix& aL, const Postfix& aL1 ); private: SALOME_ListOfEvalSet mySets; -- 2.39.2