Expressions: Added App::BooleanExpression class.

This commit is contained in:
Eivind Kvedalen
2016-03-04 01:00:54 +01:00
committed by wmayer
parent e063c25b69
commit 778abe9072
3 changed files with 22 additions and 1 deletions

View File

@@ -1262,6 +1262,18 @@ Expression *ConstantExpression::copy() const
return new ConstantExpression(owner, name.c_str(), quantity);
}
TYPESYSTEM_SOURCE_ABSTRACT(App::BooleanExpression, App::NumberExpression);
BooleanExpression::BooleanExpression(const DocumentObject *_owner, bool _value)
: NumberExpression(owner, _value ? 1.0 : 0.0)
{
}
Expression *BooleanExpression::copy() const
{
return new BooleanExpression(owner, getValue() > 0.5 ? true : false);
}
namespace App {
namespace ExpressionParser {