Base class for expressions. More...
#include <Expression.h>
Classes | |
struct | Component |
class | Exception |
Public Types | |
typedef std::vector< Component * > | ComponentList |
enum | DepOption { DepNormal , DepHidden , DepAll } |
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::map< App::DocumentObject *, bool > &, std::vector< std::string > *labels=nullptr) const |
std::map< App::DocumentObject *, bool > | getDepObjects (std::vector< std::string > *labels=nullptr) const |
void | getDeps (ExpressionDeps &deps, int option=DepNormal) const |
ExpressionDeps | getDeps (int option=DepNormal) const |
std::map< App::ObjectIdentifier, bool > | getIdentifiers () const |
void | getIdentifiers (std::map< App::ObjectIdentifier, bool > &) 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, bool checkComment=true) 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... | |
BaseClass (const BaseClass &)=default | |
virtual PyObject * | getPyObject () |
This method returns the Python wrapper for a C++ object. More... | |
virtual Type | getTypeId () const |
bool | isDerivedFrom (const Type type) const |
BaseClass & | operator= (const BaseClass &)=default |
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=nullptr, Expression *e3=nullptr, 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 () |
static Type | getClassTypeId () |
static void | init () |
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) |
Base class for expressions.
typedef std::vector<Component*> App::Expression::ComponentList |
Expression::Expression | ( | const App::DocumentObject * | _owner | ) |
|
virtual |
|
virtual |
Reimplemented in App::VariableExpression.
Referenced by App::VariableExpression::addComponent().
bool Expression::adjustLinks | ( | const std::set< App::DocumentObject * > & | inList | ) |
References visit().
Referenced by AdjustLinksExpressionVisitor::visit().
Expression * Expression::copy | ( | ) | const |
|
static |
|
static |
Expression * Expression::eval | ( | ) | const |
References App::expressionFromPy(), getPyValue(), and owner.
Referenced by App::OperatorExpression::simplify(), and App::FunctionExpression::simplify().
void Expression::getDepObjects | ( | std::map< App::DocumentObject *, bool > & | deps, |
std::vector< std::string > * | labels = nullptr |
||
) | const |
References App::ObjectIdentifier::getDep(), and getIdentifiers().
std::map< App::DocumentObject *, bool > Expression::getDepObjects | ( | std::vector< std::string > * | labels = nullptr | ) | const |
References getDepObjects().
Referenced by getDepObjects().
void Expression::getDeps | ( | ExpressionDeps & | deps, |
int | option = DepNormal |
||
) | const |
References DepHidden, DepNormal, App::ObjectIdentifier::getDep(), and getIdentifiers().
Referenced by getDeps(), and importSubNames().
ExpressionDeps Expression::getDeps | ( | int | option = DepNormal | ) | const |
References getDeps().
std::map< App::ObjectIdentifier, bool > Expression::getIdentifiers | ( | ) | const |
References getIdentifiers().
Referenced by getDepObjects(), getDeps(), getIdentifiers(), updateLabelReference(), and GetIdentifiersExpressionVisitor::visit().
void Expression::getIdentifiers | ( | std::map< App::ObjectIdentifier, bool > & | deps | ) | const |
References visit().
App::DocumentObject * App::Expression::getOwner | ( | ) | const |
Referenced by App::FunctionExpression::evaluate().
Py::Object Expression::getPyValue | ( | ) | const |
Referenced by eval(), App::FunctionExpression::evaluate(), and getValueAsAny().
App::any Expression::getValueAsAny | ( | ) | const |
References getPyValue(), and App::pyObjectToAny().
bool App::Expression::hasComponent | ( | ) | const |
ExpressionPtr Expression::importSubNames | ( | const std::map< std::string, std::string > & | nameMap | ) | const |
References copy(), DepAll, getDeps(), App::DocumentObject::getDocument(), draftfunctions.move::move(), owner, and App::PropertyLinkBase::tryImportSubName().
Referenced by ImportSubNamesExpressionVisitor::visit().
bool Expression::isSame | ( | const Expression & | other, |
bool | checkComment = true |
||
) | const |
References comment, Base::BaseClass::getTypeId(), and toString().
|
virtual |
Reimplemented in App::OperatorExpression, App::ConditionalExpression, App::FunctionExpression, App::VariableExpression, and App::RangeExpression.
Referenced by App::ConditionalExpression::isTouched().
|
static |
References owner, and App::ExpressionParser::parse().
Referenced by SpreadsheetGui::DlgSheetConf::accept(), App::PropertyExpressionEngine::afterRestore(), Sketcher::SketchObject::carbonCopy(), BOPTools.GeneralFuseResult.GeneralFuseResult::explodeCompounds(), StdCmdExpression::pasteExpressions(), SpreadsheetGui::DlgSheetConf::prepare(), App::Metadata::satisfies(), Spreadsheet::PropertySheet::setPathValue(), and BOPTools.GeneralFuseResult.GeneralFuseResult::splitAggregates().
|
virtual |
Reimplemented in App::OperatorExpression, and App::ConditionalExpression.
Referenced by toString().
ExpressionPtr Expression::replaceObject | ( | const App::DocumentObject * | parent, |
App::DocumentObject * | oldObj, | ||
App::DocumentObject * | newObj | ||
) | const |
|
pure virtual |
Implemented in App::UnitExpression, App::NumberExpression, App::OperatorExpression, App::ConditionalExpression, App::FunctionExpression, App::VariableExpression, App::PyObjectExpression, App::StringExpression, and App::RangeExpression.
Referenced by App::ExpressionParser::parseUnit(), App::OperatorExpression::simplify(), App::ConditionalExpression::simplify(), and App::FunctionExpression::simplify().
std::string Expression::toString | ( | bool | persistent = false , |
bool | checkPriority = false , |
||
int | indent = 0 |
||
) | const |
References toString().
Referenced by isSame(), and toString().
void Expression::toString | ( | std::ostream & | os, |
bool | persistent = false , |
||
bool | checkPriority = false , |
||
int | indent = 0 |
||
) | const |
References priority().
ExpressionPtr Expression::updateLabelReference | ( | App::DocumentObject * | obj, |
const std::string & | ref, | ||
const char * | newLabel | ||
) | const |
References copy(), getIdentifiers(), and visit().
Referenced by UpdateLabelExpressionVisitor::visit().
void Expression::visit | ( | ExpressionVisitor & | v | ) |
Referenced by adjustLinks(), getIdentifiers(), replaceObject(), and updateLabelReference().
std::string App::Expression::comment |
|
protected |
Referenced by copy().
friend App::Expression::ExpressionVisitor |
|
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::RangeExpression::isTouched(), parse(), App::Expression::Component::set(), App::UnitExpression::simplify(), App::OperatorExpression::simplify(), App::ConditionalExpression::simplify(), and App::FunctionExpression::simplify().