Expressions: Moved Expression::priority to cpp file.

This commit is contained in:
Eivind Kvedalen 2016-03-25 15:41:41 +01:00 committed by wmayer
parent b37e6ece98
commit 1626c69494
2 changed files with 55 additions and 14 deletions

View File

@ -207,6 +207,11 @@ Expression *UnitExpression::copy() const
return new UnitExpression(owner, quantity, unitStr);
}
int UnitExpression::priority() const
{
return 20;
}
//
// NumberExpression class
//
@ -246,6 +251,11 @@ Expression *NumberExpression::copy() const
return new NumberExpression(owner, quantity);
}
int NumberExpression::priority() const
{
return 20;
}
/**
* Negate the stored value.
*/
@ -529,21 +539,27 @@ Expression *OperatorExpression::copy() const
int OperatorExpression::priority() const
{
switch (op) {
case EQ:
case NEQ:
case LT:
case GT:
case LTE:
case GTE:
return 1;
case ADD:
return 5;
case SUB:
return 5;
return 3;
case MUL:
case UNIT:
return 10;
case DIV:
return 10;
return 4;
case POW:
return 10;
return 5;
case UNIT:
case NEG:
case POS:
return 15;
return 6;
default:
assert(false);
return 0;
}
}
@ -1177,6 +1193,11 @@ Expression *FunctionExpression::copy() const
return new FunctionExpression(owner, f, a);
}
int FunctionExpression::priority() const
{
return 20;
}
/**
* Compute the dependecy set of the expression. The set contains the names
* of all Property objects this expression relies on.
@ -1347,6 +1368,11 @@ Expression *VariableExpression::copy() const
return new VariableExpression(owner, var);
}
int VariableExpression::priority() const
{
return 20;
}
/**
* Compute the dependecy of the expression. In this case \a props
* is a set of strings, i.e the names of the Property objects, and
@ -1421,6 +1447,11 @@ std::string StringExpression::toString() const
return quote(text);
}
int StringExpression::priority() const
{
return 20;
}
/**
* Return a copy of the expression.
*/
@ -1528,6 +1559,11 @@ Expression *ConstantExpression::copy() const
return new ConstantExpression(owner, name.c_str(), quantity);
}
int ConstantExpression::priority() const
{
return 20;
}
TYPESYSTEM_SOURCE_ABSTRACT(App::BooleanExpression, App::NumberExpression);
BooleanExpression::BooleanExpression(const DocumentObject *_owner, bool _value)
@ -1577,6 +1613,11 @@ Expression *RangeExpression::copy() const
return new RangeExpression(owner, range.fromCellString(), range.toCellString());
}
int RangeExpression::priority() const
{
return 20;
}
void RangeExpression::getDeps(std::set<ObjectIdentifier> &props) const
{
Range i(range);

View File

@ -129,7 +129,7 @@ public:
virtual Expression * copy() const;
virtual int priority() const { return 20; }
virtual int priority() const;
void setUnit(const Base::Quantity &_quantity);
@ -165,7 +165,7 @@ public:
virtual Expression * copy() const;
virtual int priority() const { return 20; }
virtual int priority() const;
void negate();
@ -183,7 +183,7 @@ public:
virtual Expression * copy() const;
virtual int priority() const { return 20; }
virtual int priority() const;
std::string getName() const { return name; }
@ -344,7 +344,7 @@ public:
virtual Expression * copy() const;
virtual int priority() const { return 20; }
virtual int priority() const;
virtual void getDeps(std::set<ObjectIdentifier> &props) const;
@ -382,7 +382,7 @@ public:
virtual Expression * copy() const;
virtual int priority() const { return 20; }
virtual int priority() const;
virtual void getDeps(std::set<ObjectIdentifier> &props) const;
@ -425,7 +425,7 @@ public:
virtual std::string getText() const { return text; }
virtual int priority() const { return 20; }
virtual int priority() const;
virtual Expression * copy() const;
@ -449,7 +449,7 @@ public:
virtual Expression * copy() const;
virtual int priority() const { return 20; }
virtual int priority() const;
virtual void getDeps(std::set<App::ObjectIdentifier> &props) const;