Changeset 2550 in Sophya


Ignore:
Timestamp:
Jun 8, 2004, 1:46:25 AM (21 years ago)
Author:
ansari
Message:

Correction bug ds CExprEvaluator (gestion Chs - ) - Reza 8 Juin 2004

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/SysTools/cexpre.cc

    r2520 r2550  
    6565}
    6666
     67//---------------------------------------------------------
     68//-----------  Expression changement de signe -------------
     69class CE_ChsExp : public CExprBase {
     70public:
     71  explicit CE_ChsExp(CExprBase * e) { _e = e; }
     72  virtual  ~CE_ChsExp() { if (_e) delete _e; }
     73  virtual double Evaluate() const { return -_e->Evaluate(); } 
     74  virtual bool   CheckE(string& errmsg) const { if (_e) return true; else return false; }
     75  virtual void  Print(ostream& os) const { os << "-( "; _e->Print(os); os << " )"; }
     76 protected:
     77  CExprBase * _e;
     78};
    6779
    6880//---------------------------------------------------------
     
    334346          if (!cx)  { checkok = false; p = stop+1; }
    335347          else {
    336             if (rx) {
     348            if (osn == 1) {
     349              if (sex[p-osn] == '-')  cx = new CE_ChsExp(cx);
     350            }
     351            if (osn > 1) {
     352              checkok = false; p = stop+1; fgcont = false;
     353              delete cx;
     354              errmsg = "CExpressionEvaluator::ParseString()/ Syntax Error - multiple chs (+/-) (AA)";
     355            }
     356            else if (rx) {
    337357              checkok = false; p = stop+1; fgcont = false;
    338358              delete cx;
Note: See TracChangeset for help on using the changeset viewer.