Class implementing a reference to a property. More...
#include <ExpressionParser.h>
Public Member Functions | |
virtual void | addComponent (Component *component) override |
ObjectIdentifier | getPath () const |
const App::Property * | getProperty () const |
Find the property this expression referse to. More... | |
virtual bool | isTouched () const override |
Determine if the expression is touched or not, i.e whether the Property object it refers to is touched(). More... | |
std::string | name () const |
void | setPath (const ObjectIdentifier &path) |
virtual Expression * | simplify () const override |
Simplify the expression. More... | |
VariableExpression (const App::DocumentObject *_owner=nullptr, const ObjectIdentifier &_var=ObjectIdentifier()) | |
~VariableExpression () | |
Public Member Functions inherited from App::UnitExpression | |
const Base::Quantity & | getQuantity () const |
double | getScaler () const |
const Base::Unit & | getUnit () const |
const std::string | getUnitString () const |
double | getValue () const |
void | setQuantity (const Base::Quantity &_quantity) |
void | setUnit (const Base::Quantity &_quantity) |
Set unit information. More... | |
virtual Expression * | simplify () const override |
Simplify the expression. More... | |
UnitExpression (const App::DocumentObject *_owner=nullptr, const Base::Quantity &_quantity=Base::Quantity(), const std::string &_unitStr=std::string()) | |
~UnitExpression () | |
Public Member Functions inherited from App::Expression | |
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... | |
Protected Attributes | |
ObjectIdentifier | var |
Variable name More... | |
Protected Attributes inherited from App::UnitExpression | |
PyObject * | cache = nullptr |
Protected Attributes inherited from App::Expression | |
ComponentList | components |
App::DocumentObject * | owner |
The document object used to access unqualified variables (i.e local scope) More... | |
Additional Inherited Members | |
Public Types inherited from App::Expression | |
typedef std::vector< Component * > | ComponentList |
enum | DepOption { DepNormal , DepHidden , DepAll } |
Static Public Member Functions inherited from App::Expression | |
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 inherited from App::Expression | |
std::string | comment |
friend | ExpressionVisitor |
Static Protected Member Functions inherited from Base::BaseClass | |
static void | initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr) |
Class implementing a reference to a property.
If the name is unqualified, the owner of the expression is searched. If it is qualified, the document that contains the owning document object is searched for other document objects to search. Both labels and internal document names are searched.
VariableExpression::VariableExpression | ( | const App::DocumentObject * | _owner = nullptr , |
const ObjectIdentifier & | _var = ObjectIdentifier() |
||
) |
VariableExpression::~VariableExpression | ( | ) |
|
overridevirtual |
Reimplemented from App::Expression.
References App::Expression::addComponent(), App::ObjectIdentifier::ArrayComponent(), App::ObjectIdentifier::MapComponent(), App::ObjectIdentifier::RangeComponent(), and var.
ObjectIdentifier App::VariableExpression::getPath | ( | ) | const |
const Property * VariableExpression::getProperty | ( | ) | const |
Find the property this expression referse to.
Unqualified names (i.e the name only without any dots) are resolved in the owning DocumentObjects. Qualified names are looked up in the owning Document. It is first looked up by its internal name. If not found, the DocumentObjects' labels searched.
If something fails, an exception is thrown.
References App::ObjectIdentifier::getProperty(), App::ObjectIdentifier::resolveErrorString(), and var.
|
overridevirtual |
Determine if the expression is touched or not, i.e whether the Property object it refers to is touched().
Reimplemented from App::Expression.
References App::ObjectIdentifier::isTouched(), and var.
std::string App::VariableExpression::name | ( | ) | const |
Referenced by draftguitools.gui_groups.Ui_AddNamedGroup::accept(), prototype.Node::addtofreecad(), Addon.Addon::disable(), Addon.Addon::enable(), addonmanager_macro.Macro::filename(), gzip_utf8.GzipFile::filename(), addonmanager_macro.Macro::fill_details_from_code(), addonmanager_macro.Macro::fill_details_from_wiki(), Addon.Addon::get_cached_icon_filename(), ifc4.ifcapproval::hasidentifierorname(), addonmanager_macro.Macro::install(), Addon.Addon::is_disabled(), femsolver.elmer.sifio.Section::keys(), automotive_design.si_unit::named_unit_dimensions(), Mod.PartDesign.WizardShaft.SegmentFunction.SegmentFunction::output(), prototype.Node::pprint(), prototype.Node::pprint2(), PathScripts.PathSetupSheetGui.OpTaskPanel::propertyGroup(), PathScripts.PathSetupSheetGui.OpTaskPanel::propertyName(), PathScripts.PathJobGui.TaskPanel::reject(), addonmanager_macro.Macro::remove(), Addon.Addon::to_cache(), ifc2x3.ifcexternalreference::wr1(), ifc2x3.ifcdocumentreference::wr1(), ifc4.ifcexternalreference::wr1(), ifc4.ifcdocumentreference::wr1(), and automotive_design.general_property_association::wr2().
void VariableExpression::setPath | ( | const ObjectIdentifier & | path | ) |
References var.
|
overridevirtual |
Simplify the expression.
Simplification of VariableExpression objects is not possible (if it is instantiated it would be an evaluation instead).
Reimplemented from App::UnitExpression.
References App::Expression::copy().
|
protected |
Variable name
Referenced by addComponent(), getProperty(), isTouched(), and setPath().