Base class for expressions. More...
#include <Expression.h>
Classes | |
struct | Component |
class | Exception |
Public Types | |
typedef std::vector< Component * > | ComponentList |
Public Member Functions | |
virtual void | addComponent (Component *component) |
bool | adjustLinks (const std::set< App::DocumentObject * > &inList) |
Expression * | copy () const |
Expression * | eval () const |
Expression (const App::DocumentObject *_owner) | |
void | getDepObjects (std::set< App::DocumentObject * > &, std::vector< std::string > *labels=0) const |
std::set< App::DocumentObject * > | getDepObjects (std::vector< std::string > *labels=0) const |
ExpressionDeps | getDeps () const |
void | getDeps (ExpressionDeps &deps) const |
std::set< App::ObjectIdentifier > | getIdentifiers () const |
void | getIdentifiers (std::set< App::ObjectIdentifier > &) const |
App::DocumentObject * | getOwner () const |
Py::Object | getPyValue () const |
boost::any | getValueAsAny () const |
bool | hasComponent () const |
ExpressionPtr | importSubNames (const std::map< std::string, std::string > &nameMap) const |
bool | isSame (const Expression &other) const |
virtual bool | isTouched () const |
virtual int | priority () const |
ExpressionPtr | replaceObject (const App::DocumentObject *parent, App::DocumentObject *oldObj, App::DocumentObject *newObj) const |
virtual Expression * | simplify () const =0 |
std::string | toString (bool persistent=false, bool checkPriority=false, int indent=0) const |
void | toString (std::ostream &os, bool persistent=false, bool checkPriority=false, int indent=0) const |
ExpressionPtr | updateLabelReference (App::DocumentObject *obj, const std::string &ref, const char *newLabel) const |
void | visit (ExpressionVisitor &v) |
virtual | ~Expression () |
Public Member Functions inherited from Base::BaseClass | |
BaseClass () | |
Construction. More... | |
virtual PyObject * | getPyObject (void) |
This method returns the Python wrapper for a C++ object. More... | |
virtual Type | getTypeId (void) const |
bool | isDerivedFrom (const Type type) const |
virtual void | setPyObject (PyObject *) |
virtual | ~BaseClass () |
Destruction. More... | |
Static Public Member Functions | |
static Component * | createComponent (const std::string &n) |
static Component * | createComponent (Expression *e1, Expression *e2=0, Expression *e3=0, bool isRange=false) |
static Expression * | parse (const App::DocumentObject *owner, const std::string &buffer) |
Static Public Member Functions inherited from Base::BaseClass | |
static void * | create (void) |
static Type | getClassTypeId (void) |
static void | init (void) |
Public Attributes | |
std::string | comment |
friend | ExpressionVisitor |
Protected Attributes | |
ComponentList | components |
App::DocumentObject * | owner |
The document object used to access unqualified variables (i.e local scope) More... | |
Additional Inherited Members | |
Static Protected Member Functions inherited from Base::BaseClass | |
static void | initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr) |
Detailed Description
Base class for expressions.
Member Typedef Documentation
◆ ComponentList
typedef std::vector<Component*> App::Expression::ComponentList |
Constructor & Destructor Documentation
◆ Expression()
Expression::Expression | ( | const App::DocumentObject * | _owner | ) |
◆ ~Expression()
|
virtual |
Member Function Documentation
◆ addComponent()
|
virtual |
Reimplemented in App::VariableExpression.
Referenced by App::VariableExpression::addComponent().
◆ adjustLinks()
bool Expression::adjustLinks | ( | const std::set< App::DocumentObject * > & | inList | ) |
References visit().
Referenced by AdjustLinksExpressionVisitor::visit().
◆ copy()
Expression * Expression::copy | ( | ) | const |
◆ createComponent() [1/2]
|
static |
◆ createComponent() [2/2]
|
static |
◆ eval()
Expression * Expression::eval | ( | ) | const |
References App::expressionFromPy(), getPyValue(), and owner.
Referenced by Spreadsheet::Cell::setContent(), App::OperatorExpression::simplify(), and App::FunctionExpression::simplify().
◆ getDepObjects() [1/2]
void Expression::getDepObjects | ( | std::set< App::DocumentObject * > & | deps, |
std::vector< std::string > * | labels = 0 |
||
) | const |
References visit().
◆ getDepObjects() [2/2]
std::set< App::DocumentObject * > Expression::getDepObjects | ( | std::vector< std::string > * | labels = 0 | ) | const |
Referenced by updateLabelReference(), and GetDepObjsExpressionVisitor::visit().
◆ getDeps() [1/2]
ExpressionDeps Expression::getDeps | ( | ) | const |
Referenced by importSubNames(), and GetDepsExpressionVisitor::visit().
◆ getDeps() [2/2]
void Expression::getDeps | ( | ExpressionDeps & | deps | ) | const |
References visit().
◆ getIdentifiers() [1/2]
std::set< App::ObjectIdentifier > Expression::getIdentifiers | ( | ) | const |
Referenced by GetIdentifiersExpressionVisitor::visit().
◆ getIdentifiers() [2/2]
void Expression::getIdentifiers | ( | std::set< App::ObjectIdentifier > & | deps | ) | const |
References visit().
◆ getOwner()
App::DocumentObject* App::Expression::getOwner | ( | ) | const |
Referenced by App::FunctionExpression::evaluate().
◆ getPyValue()
Py::Object Expression::getPyValue | ( | ) | const |
Referenced by eval(), App::FunctionExpression::evaluate(), and getValueAsAny().
◆ getValueAsAny()
App::any Expression::getValueAsAny | ( | ) | const |
References getPyValue(), and App::pyObjectToAny().
◆ hasComponent()
bool App::Expression::hasComponent | ( | ) | const |
◆ importSubNames()
ExpressionPtr Expression::importSubNames | ( | const std::map< std::string, std::string > & | nameMap | ) | const |
References copy(), getDeps(), App::DocumentObject::getDocument(), owner, and App::PropertyLinkBase::tryImportSubName().
Referenced by ImportSubNamesExpressionVisitor::visit().
◆ isSame()
bool Expression::isSame | ( | const Expression & | other | ) | const |
References comment, Base::BaseClass::getTypeId(), and toString().
◆ isTouched()
|
virtual |
Reimplemented in App::RangeExpression, App::VariableExpression, App::FunctionExpression, App::ConditionalExpression, and App::OperatorExpression.
◆ parse()
|
static |
References owner, and App::ExpressionParser::parse().
Referenced by App::PropertyExpressionEngine::afterRestore(), Sketcher::SketchObject::carbonCopy(), BOPTools.GeneralFuseResult.GeneralFuseResult::explodeCompounds(), StdCmdExpression::pasteExpressions(), App::DocumentObjectPy::setExpression(), and BOPTools.GeneralFuseResult.GeneralFuseResult::splitAggregates().
◆ priority()
|
virtual |
Reimplemented in App::ConditionalExpression, and App::OperatorExpression.
Referenced by toString().
◆ replaceObject()
ExpressionPtr Expression::replaceObject | ( | const App::DocumentObject * | parent, |
App::DocumentObject * | oldObj, | ||
App::DocumentObject * | newObj | ||
) | const |
◆ simplify()
|
pure virtual |
Implemented in App::RangeExpression, App::StringExpression, App::PyObjectExpression, App::VariableExpression, App::FunctionExpression, App::ConditionalExpression, App::OperatorExpression, App::NumberExpression, and App::UnitExpression.
Referenced by App::ExpressionParser::parseUnit(), App::OperatorExpression::simplify(), and App::FunctionExpression::simplify().
◆ toString() [1/2]
std::string Expression::toString | ( | bool | persistent = false , |
bool | checkPriority = false , |
||
int | indent = 0 |
||
) | const |
Referenced by isSame().
◆ toString() [2/2]
void Expression::toString | ( | std::ostream & | os, |
bool | persistent = false , |
||
bool | checkPriority = false , |
||
int | indent = 0 |
||
) | const |
References priority().
◆ updateLabelReference()
ExpressionPtr Expression::updateLabelReference | ( | App::DocumentObject * | obj, |
const std::string & | ref, | ||
const char * | newLabel | ||
) | const |
References copy(), getDepObjects(), and visit().
Referenced by UpdateLabelExpressionVisitor::visit().
◆ visit()
void Expression::visit | ( | ExpressionVisitor & | v | ) |
Referenced by adjustLinks(), getDepObjects(), getDeps(), getIdentifiers(), replaceObject(), and updateLabelReference().
Member Data Documentation
◆ comment
◆ components
|
protected |
Referenced by copy().
◆ ExpressionVisitor
friend App::Expression::ExpressionVisitor |
◆ owner
|
protected |
The document object used to access unqualified variables (i.e local scope)
Referenced by App::Expression::Component::del(), eval(), App::FunctionExpression::evalAggregate(), App::Expression::Component::get(), App::RangeExpression::getRange(), importSubNames(), App::ExpressionParser::initParser(), App::RangeExpression::isTouched(), parse(), App::ExpressionParser::parse(), App::ExpressionParser::parseUnit(), App::Expression::Component::set(), App::UnitExpression::simplify(), App::OperatorExpression::simplify(), App::ConditionalExpression::simplify(), and App::FunctionExpression::simplify().
The documentation for this class was generated from the following files:
- src/App/Expression.h
- src/App/Expression.cpp