Expressions: Added App::BooleanExpression class.
This commit is contained in:
parent
34135e5d2e
commit
26f4d1ae8e
|
@ -1139,7 +1139,7 @@ void Application::initTypes(void)
|
|||
App ::ConditionalExpression ::init();
|
||||
App ::StringExpression ::init();
|
||||
App ::FunctionExpression ::init();
|
||||
|
||||
App ::BooleanExpression ::init();
|
||||
}
|
||||
|
||||
void Application::initConfig(int argc, char ** argv)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -190,6 +190,15 @@ protected:
|
|||
std::string name; /**< Constant's name */
|
||||
};
|
||||
|
||||
class AppExport BooleanExpression : public NumberExpression {
|
||||
TYPESYSTEM_HEADER();
|
||||
public:
|
||||
BooleanExpression(const App::DocumentObject *_owner = 0, bool _value = false);
|
||||
|
||||
virtual Expression * copy() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class implementing an infix expression.
|
||||
|
|
Loading…
Reference in New Issue
Block a user