From 0e08b51a581ed438ea4e190475fd2ee37013f4a4 Mon Sep 17 00:00:00 2001 From: luz paz Date: Fri, 2 Dec 2022 18:02:05 -0500 Subject: [PATCH] App: fix trailing whitespace --- src/App/CMakeLists.txt | 2 +- src/App/GeoFeatureGroupExtension.cpp | 82 +++++++++++++------------- src/App/GeoFeatureGroupExtension.h | 54 ++++++++--------- src/App/GeoFeatureGroupExtensionPy.xml | 2 +- src/App/GeoFeaturePy.xml | 16 ++--- src/App/GeoFeaturePyImp.cpp | 6 +- src/App/LinkBaseExtensionPy.xml | 20 +++---- src/App/MetadataPyImp.cpp | 12 ++-- src/App/ObjectIdentifier.cpp | 12 ++-- src/App/PartPy.xml | 12 ++-- src/App/PropertyExpressionEngine.cpp | 36 +++++------ src/App/PropertyExpressionEngine.h | 8 +-- src/App/Range.h | 4 +- 13 files changed, 133 insertions(+), 133 deletions(-) diff --git a/src/App/CMakeLists.txt b/src/App/CMakeLists.txt index fa63427f2a..4f46da8792 100644 --- a/src/App/CMakeLists.txt +++ b/src/App/CMakeLists.txt @@ -25,7 +25,7 @@ ENDIF(DOCDIR) # ----------------------------------------------------------------------------- -#write relevant cmake variables to a file for later access with python. Exported are all variables +#write relevant cmake variables to a file for later access with python. Exported are all variables #starting with BUILD. As the variable only exists if the user set it to ON a dict is useless, we #use a python list for export. set(_vars "const char CMakeVariables[] =\"cmake = [") diff --git a/src/App/GeoFeatureGroupExtension.cpp b/src/App/GeoFeatureGroupExtension.cpp index a3f746071d..4ed7683ebd 100644 --- a/src/App/GeoFeatureGroupExtension.cpp +++ b/src/App/GeoFeatureGroupExtension.cpp @@ -53,10 +53,10 @@ GeoFeatureGroupExtension::GeoFeatureGroupExtension() GeoFeatureGroupExtension::~GeoFeatureGroupExtension() = default; void GeoFeatureGroupExtension::initExtension(ExtensionContainer* obj) { - + if(!obj->isDerivedFrom(App::GeoFeature::getClassTypeId())) throw Base::RuntimeError("GeoFeatureGroupExtension can only be applied to GeoFeatures"); - + App::GroupExtension::initExtension(obj); } @@ -64,7 +64,7 @@ PropertyPlacement& GeoFeatureGroupExtension::placement() { if(!getExtendedContainer()) throw Base::RuntimeError("GeoFeatureGroupExtension was not applied to GeoFeature"); - + return static_cast(getExtendedContainer())->Placement; } @@ -81,19 +81,19 @@ DocumentObject* GeoFeatureGroupExtension::getGroupOfObject(const DocumentObject* { if(!obj) return nullptr; - + //we will find origins, but not origin features - if(obj->isDerivedFrom(App::OriginFeature::getClassTypeId())) + if(obj->isDerivedFrom(App::OriginFeature::getClassTypeId())) return OriginGroupExtension::getGroupOfObject(obj); - + //compared to GroupExtension we do return here all GeoFeatureGroups including all extensions derived from it //like OriginGroup. That is needed as we use this function to get all local coordinate systems. Also there //is no reason to distinguish between GeoFeatuerGroups, there is only between group/geofeaturegroup auto list = obj->getInList(); for (auto inObj : list) { - - //There is a chance that a derived geofeaturegroup links with a local link and hence is not - //the parent group even though it links to the object. We use hasObject as one and only truth + + //There is a chance that a derived geofeaturegroup links with a local link and hence is not + //the parent group even though it links to the object. We use hasObject as one and only truth //if it has the object within the group auto group = inObj->getExtensionByType(true); if(group && group->hasObject(obj)) @@ -136,47 +136,47 @@ Base::Placement GeoFeatureGroupExtension::recursiveGroupPlacement(GeoFeatureGrou } std::vector GeoFeatureGroupExtension::addObjects(std::vector objects) { - + std::vector grp = Group.getValues(); std::vector ret; - + for(auto object : objects) { - + if(!allowObject(object)) continue; - - //cross CoordinateSystem links are not allowed, so we need to move the whole link group + + //cross CoordinateSystem links are not allowed, so we need to move the whole link group std::vector links = getCSRelevantLinks(object); links.push_back(object); - + for( auto obj : links) { - //only one geofeaturegroup per object. + //only one geofeaturegroup per object. auto *group = App::GeoFeatureGroupExtension::getGroupOfObject(obj); if(group && group != getExtendedObject()) group->getExtensionByType()->removeObject(obj); - + if (!hasObject(obj)) { grp.push_back(obj); ret.push_back(obj); } } } - + Group.setValues(grp); return ret; } std::vector GeoFeatureGroupExtension::removeObjects(std::vector objects) { - + std::vector removed; std::vector grp = Group.getValues(); - + for(auto object : objects) { - //cross CoordinateSystem links are not allowed, so we need to remove the whole link group + //cross CoordinateSystem links are not allowed, so we need to remove the whole link group std::vector< DocumentObject* > links = getCSRelevantLinks(object); links.push_back(object); - - //remove all links out of group + + //remove all links out of group for(auto link : links) { auto end = std::remove(grp.begin(), grp.end(), link); if(end != grp.end()) { @@ -185,10 +185,10 @@ std::vector GeoFeatureGroupExtension::removeObjects(std::vector } } } - + if(!removed.empty()) Group.setValues(grp); - + return removed; } @@ -196,11 +196,11 @@ void GeoFeatureGroupExtension::extensionOnChanged(const Property* p) { //objects are only allowed in a single GeoFeatureGroup if(p == &Group && !Group.testStatus(Property::User3)) { - + if((!getExtendedObject()->isRestoring() || getExtendedObject()->getDocument()->testStatus(Document::Importing)) && !getExtendedObject()->getDocument()->isPerformingTransaction()) { - + bool error = false; auto corrected = Group.getValues(); for(auto obj : Group.getValues()) { @@ -279,7 +279,7 @@ void GeoFeatureGroupExtension::getCSOutList(const App::DocumentObject* obj, //we get all relevant linked objects. We can't use outList() as this includes the links from expressions, //also we only want links with scope Local auto result = getScopedObjectsFromLinks(obj, LinkScope::Local); - + //we remove all links to origin features and origins, they belong to a CS too and can't be moved result.erase(std::remove_if(result.begin(), result.end(), [](App::DocumentObject* obj)->bool { return (obj->isDerivedFrom(App::OriginFeature::getClassTypeId()) || @@ -306,7 +306,7 @@ void GeoFeatureGroupExtension::getCSInList(const DocumentObject* obj, if(parent->hasExtension(App::GroupExtension::getExtensionClassTypeId())) continue; - //check if the link is real Local scope one or if it is a expression one (could also be both, so it is not + //check if the link is real Local scope one or if it is a expression one (could also be both, so it is not //enough to check the expressions) auto res = getScopedObjectsFromLinks(parent, LinkScope::Local); if(std::find(res.begin(), res.end(), obj) != res.end()) @@ -323,7 +323,7 @@ std::vector< DocumentObject* > GeoFeatureGroupExtension::getCSRelevantLinks(cons if(!obj) return std::vector< DocumentObject* >(); - //get all out links + //get all out links std::vector vec; recursiveCSRelevantLinks(obj, vec); @@ -336,7 +336,7 @@ std::vector< DocumentObject* > GeoFeatureGroupExtension::getCSRelevantLinks(cons return vec; } -void GeoFeatureGroupExtension::recursiveCSRelevantLinks(const DocumentObject* obj, +void GeoFeatureGroupExtension::recursiveCSRelevantLinks(const DocumentObject* obj, std::vector< DocumentObject* >& vec) { if(!obj) @@ -347,7 +347,7 @@ void GeoFeatureGroupExtension::recursiveCSRelevantLinks(const DocumentObject* ob getCSInList(obj, links); //go on traversing the graph in all directions! - for(auto o : links) { + for(auto o : links) { if(!o || o == obj || std::find(vec.begin(), vec.end(), o) != vec.end()) continue; @@ -357,14 +357,14 @@ void GeoFeatureGroupExtension::recursiveCSRelevantLinks(const DocumentObject* ob } bool GeoFeatureGroupExtension::extensionGetSubObject(DocumentObject *&ret, const char *subname, - PyObject **pyObj, Base::Matrix4D *mat, bool transform, int depth) const + PyObject **pyObj, Base::Matrix4D *mat, bool transform, int depth) const { ret = nullptr; const char *dot; if(!subname || *subname==0) { auto obj = dynamic_cast(getExtendedContainer()); ret = const_cast(obj); - if(mat && transform) + if(mat && transform) *mat *= const_cast(this)->placement().getValue().toMatrix(); }else if((dot=strchr(subname,'.'))) { if(subname[0]!='$') @@ -380,9 +380,9 @@ bool GeoFeatureGroupExtension::extensionGetSubObject(DocumentObject *&ret, const } if(ret) { if(dot) ++dot; - if(dot && *dot + if(dot && *dot && !ret->hasExtension(App::LinkBaseExtension::getExtensionClassTypeId()) - && !ret->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId())) + && !ret->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId())) { // Consider this // Body @@ -405,7 +405,7 @@ bool GeoFeatureGroupExtension::extensionGetSubObject(DocumentObject *&ret, const } } } - if(mat && transform) + if(mat && transform) *mat *= const_cast(this)->placement().getValue().toMatrix(); ret = ret->getSubObject(dot?dot:"",pyObj,mat,true,depth+1); } @@ -446,7 +446,7 @@ bool GeoFeatureGroupExtension::isLinkValid(App::Property* prop) { auto result = getScopedObjectsFromLink(prop, LinkScope::Local); auto group = getGroupOfObject(obj); for(auto link : result) { - if(getGroupOfObject(link) != group) + if(getGroupOfObject(link) != group) return false; } @@ -455,7 +455,7 @@ bool GeoFeatureGroupExtension::isLinkValid(App::Property* prop) { result = getScopedObjectsFromLink(prop, LinkScope::Child); auto groupExt = obj->getExtensionByType(); for(auto link : result) { - if(!groupExt->hasObject(link, true)) + if(!groupExt->hasObject(link, true)) return false; } } @@ -472,7 +472,7 @@ void GeoFeatureGroupExtension::getInvalidLinkObjects(const DocumentObject* obj, auto result = getScopedObjectsFromLinks(obj, LinkScope::Local); auto group = obj->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId()) ? obj : getGroupOfObject(obj); for(auto link : result) { - if(getGroupOfObject(link) != group) + if(getGroupOfObject(link) != group) vec.push_back(link); } @@ -481,7 +481,7 @@ void GeoFeatureGroupExtension::getInvalidLinkObjects(const DocumentObject* obj, result = getScopedObjectsFromLinks(obj, LinkScope::Child); auto groupExt = group->getExtensionByType(); for(auto link : result) { - if(!groupExt->hasObject(link, true)) + if(!groupExt->hasObject(link, true)) vec.push_back(link); } } diff --git a/src/App/GeoFeatureGroupExtension.h b/src/App/GeoFeatureGroupExtension.h index 351c658250..bd3dadb624 100644 --- a/src/App/GeoFeatureGroupExtension.h +++ b/src/App/GeoFeatureGroupExtension.h @@ -36,16 +36,16 @@ namespace App /** * @brief The base class for placeable group of DocumentObjects. It represents a local coordnate system - * - * This class is the FreeCAD way of representing local coordinate systems. It groups its children beneath + * + * This class is the FreeCAD way of representing local coordinate systems. It groups its children beneath * it and transforms them all with the GeoFeatureGroup placement. A few important properties: * - Every child that belongs to the CS must be in the Group property. Even if a sketch is part of a pad, - * it must be in the Group property of the same GeoFeatureGroup as pad. This also holds for normal - * GroupExtensions. They can be added to a GeoFeatureGroup, but all objects that the group holds must + * it must be in the Group property of the same GeoFeatureGroup as pad. This also holds for normal + * GroupExtensions. They can be added to a GeoFeatureGroup, but all objects that the group holds must * also be added to the GeoFeatureGroup - * - Objects can be only in a single GeoFeatureGroup. It is not allowed to have a document object in + * - Objects can be only in a single GeoFeatureGroup. It is not allowed to have a document object in * multiple GeoFeatureGroups - * - PropertyLinks between different GeoFeatureGroups are forbidden. There are special link properties + * - PropertyLinks between different GeoFeatureGroups are forbidden. There are special link properties * that allow such cross-CS links. * - Expressions can cross GeoFeatureGroup borders */ @@ -56,7 +56,7 @@ class AppExport GeoFeatureGroupExtension : public App::GroupExtension public: PropertyPlacement& placement(); - + void initExtension(ExtensionContainer* obj) override; /** @@ -66,11 +66,11 @@ public: * @param transform (input). */ virtual void transformPlacement(const Base::Placement &transform); - + /// Constructor GeoFeatureGroupExtension(); ~GeoFeatureGroupExtension() override; - + void extensionOnChanged(const Property* p) override; /** Returns the geo feature group which contains this object. @@ -79,14 +79,14 @@ public: * @param obj the object to search for */ static DocumentObject* getGroupOfObject(const DocumentObject* obj); - + /** * @brief Calculates the global placement of this group - * - * The returned placement describes the transformation from the global reference coordinate + * + * The returned placement describes the transformation from the global reference coordinate * system to the local coordinate system of this geo feature group. If this group has a no parent - * GeoFeatureGroup the returned placement is the one of this group. For multiple stacked - * GeoFeatureGroups the returned Placement is the combination of all parent placements including + * GeoFeatureGroup the returned placement is the one of this group. For multiple stacked + * GeoFeatureGroups the returned Placement is the combination of all parent placements including * the one of this group. * @return Base::Placement The transformation from global reference system to the groups local system */ @@ -94,7 +94,7 @@ public: /// Returns true if the given DocumentObject is DocumentObjectGroup but not GeoFeatureGroup static bool isNonGeoGroup(const DocumentObject* obj) { - return obj->hasExtension(GroupExtension::getExtensionClassTypeId()) && + return obj->hasExtension(GroupExtension::getExtensionClassTypeId()) && !obj->hasExtension(GeoFeatureGroupExtension::getExtensionClassTypeId()); } @@ -102,41 +102,41 @@ public: Base::Matrix4D *mat, bool transform, int depth) const override; bool extensionGetSubObjects(std::vector &ret, int reason) const override; - + std::vector< DocumentObject* > addObjects(std::vector< DocumentObject* > obj) override; std::vector< DocumentObject* > removeObjects(std::vector< DocumentObject* > obj) override; - - /// Collects all links that are relevant for the coordinate system, meaning all recursive links to - /// obj and from obj excluding expressions and stopping the recursion at other geofeaturegroups. + + /// Collects all links that are relevant for the coordinate system, meaning all recursive links to + /// obj and from obj excluding expressions and stopping the recursion at other geofeaturegroups. /// The result is the combination of CSOutList and CSInList. static std::vector getCSRelevantLinks(const App::DocumentObject* obj); /// Checks if the links of the given object comply with all GeoFeatureGroup requirements, that means - /// if normal links are only within the parent GeoFeatureGroup. + /// if normal links are only within the parent GeoFeatureGroup. static bool areLinksValid(const App::DocumentObject* obj); /// Checks if the given link complies with all GeoFeatureGroup requirements, that means - /// if normal links are only within the parent GeoFeatureGroup. + /// if normal links are only within the parent GeoFeatureGroup. static bool isLinkValid(App::Property* link); - //Returns all objects that are wrongly linked from this object, meaning which are out of scope of the + //Returns all objects that are wrongly linked from this object, meaning which are out of scope of the //links of obj static void getInvalidLinkObjects(const App::DocumentObject* obj, std::vector& vec); - + private: Base::Placement recursiveGroupPlacement(GeoFeatureGroupExtension* group, std::unordered_set& history); static std::vector getScopedObjectsFromLinks(const App::DocumentObject*, LinkScope scope = LinkScope::Local); static std::vector getScopedObjectsFromLink(App::Property*, LinkScope scope = LinkScope::Local); /// Collects GeoFeatureGroup relevant objects that are linked from the given one. That means all linked objects - /// except GeoFeatureGroups. Expressions links are ignored. Only local scope links are considered. There is no + /// except GeoFeatureGroups. Expressions links are ignored. Only local scope links are considered. There is no /// recursion. An exception is thrown when there are dependency loops. static void getCSOutList(const App::DocumentObject* obj, std::vector& vec); /// Collects GeoFeatureGroup relevant objects that link to the given one. That means all objects - /// except GeoFeatureGroups. Expression links are ignored. Only local scope links are relevant, and + /// except GeoFeatureGroups. Expression links are ignored. Only local scope links are relevant, and /// there is no recursion. An exception is thrown when there are dependency loops. static void getCSInList(const App::DocumentObject* obj, std::vector& vec); - + static void recursiveCSRelevantLinks(const App::DocumentObject* obj, std::vector& vec); - + }; using GeoFeatureGroupExtensionPython = ExtensionPythonT>; diff --git a/src/App/GeoFeatureGroupExtensionPy.xml b/src/App/GeoFeatureGroupExtensionPy.xml index 30884ba176..2a453912d2 100644 --- a/src/App/GeoFeatureGroupExtensionPy.xml +++ b/src/App/GeoFeatureGroupExtensionPy.xml @@ -8,7 +8,7 @@ Include="App/GeoFeatureGroupExtension.h" Namespace="App" FatherInclude="App/GroupExtensionPy.h" - FatherNamespace="App"> + FatherNamespace="App"> This class handles placeable group of document objects diff --git a/src/App/GeoFeaturePy.xml b/src/App/GeoFeaturePy.xml index 54f7967a8f..b1d0da998f 100644 --- a/src/App/GeoFeaturePy.xml +++ b/src/App/GeoFeaturePy.xml @@ -1,13 +1,13 @@ - diff --git a/src/App/GeoFeaturePyImp.cpp b/src/App/GeoFeaturePyImp.cpp index c5b341bafe..0041db6f1d 100644 --- a/src/App/GeoFeaturePyImp.cpp +++ b/src/App/GeoFeaturePyImp.cpp @@ -44,10 +44,10 @@ PyObject* GeoFeaturePy::getPaths(PyObject * /*args*/) } PyObject* GeoFeaturePy::getGlobalPlacement(PyObject * args) { - + if (!PyArg_ParseTuple(args, "")) return nullptr; - + try { Base::Placement p = static_cast(getDocumentObjectPtr())->globalPlacement(); return new Base::PlacementPy(new Base::Placement(p)); @@ -91,5 +91,5 @@ PyObject *GeoFeaturePy::getCustomAttributes(const char* /*attr*/) const int GeoFeaturePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) { - return 0; + return 0; } diff --git a/src/App/LinkBaseExtensionPy.xml b/src/App/LinkBaseExtensionPy.xml index 0488a12213..317743cea2 100644 --- a/src/App/LinkBaseExtensionPy.xml +++ b/src/App/LinkBaseExtensionPy.xml @@ -1,13 +1,13 @@  - @@ -23,7 +23,7 @@ This methode is here to implement what I called Property Design Pattern. The extension operates on a predefined set of properties, but it relies on the extended object to supply the actual property by calling this methode. You can choose a sub set of functionality of -this extension by supplying only some of the supported properties. +this extension by supplying only some of the supported properties. The 'key' are names used to refer to properties supported by this extension, and 'val' is the actual name of the property of your @@ -72,7 +72,7 @@ setLink({index:(obj,subName,subElements),...}): set link element of a link group obj (DocumentObject): the object to link to. If this is None, then the link is cleared -subName (String): Dot separated object path. +subName (String): Dot separated object path. subElements (String|tuple(String)): non-object sub-elements, e.g. Face1, Edge2. diff --git a/src/App/MetadataPyImp.cpp b/src/App/MetadataPyImp.cpp index fd701d1e4c..70f4cde745 100644 --- a/src/App/MetadataPyImp.cpp +++ b/src/App/MetadataPyImp.cpp @@ -139,22 +139,22 @@ void MetadataPy::setVersion(Py::Object args) const char *name = nullptr; if (!PyArg_Parse(args.ptr(), "z", &name)) throw Py::Exception(); - if (name && name[0] != '\0') + if (name && name[0] != '\0') getMetadataPtr()->setVersion(App::Meta::Version(std::string(name))); else getMetadataPtr()->setVersion(App::Meta::Version()); } -Py::Object MetadataPy::getDate() const -{ - return Py::String(getMetadataPtr()->date()); +Py::Object MetadataPy::getDate() const +{ + return Py::String(getMetadataPtr()->date()); } void MetadataPy::setDate(Py::Object args) { const char *date = nullptr; - if (!PyArg_Parse(args.ptr(), "z", &date)) - throw Py::Exception(); + if (!PyArg_Parse(args.ptr(), "z", &date)) + throw Py::Exception(); if (date) getMetadataPtr()->setDate(date); else getMetadataPtr()->setDate(""); diff --git a/src/App/ObjectIdentifier.cpp b/src/App/ObjectIdentifier.cpp index 595bf72302..1dc41b800c 100644 --- a/src/App/ObjectIdentifier.cpp +++ b/src/App/ObjectIdentifier.cpp @@ -1112,7 +1112,7 @@ void ObjectIdentifier::getDepLabels( } ObjectIdentifier::Dependencies -ObjectIdentifier::getDep(bool needProps, std::vector *labels) const +ObjectIdentifier::getDep(bool needProps, std::vector *labels) const { Dependencies deps; getDep(deps,needProps,labels); @@ -1122,7 +1122,7 @@ ObjectIdentifier::getDep(bool needProps, std::vector *labels) const void ObjectIdentifier::getDep(Dependencies &deps, bool needProps, std::vector *labels) const { ResolveResults result(*this); - if(labels) + if(labels) getDepLabels(result,*labels); if(!result.resolvedDocumentObject) @@ -1306,7 +1306,7 @@ Property *ObjectIdentifier::resolveProperty(const App::DocumentObject *obj, } return &const_cast(obj)->Label; //fake the property } - + return obj->getPropertyByName(propertyName); } @@ -1676,13 +1676,13 @@ Py::Object ObjectIdentifier::access(const ResolveResults &result, if(prop && prop->getContainer()!=obj) { auto linkTouched = Base::freecad_dynamic_cast( obj->getPropertyByName("_LinkTouched")); - if(linkTouched) + if(linkTouched) propName = linkTouched->getName(); else { auto propOwner = Base::freecad_dynamic_cast(prop->getContainer()); - if(propOwner) + if(propOwner) obj = propOwner; - else + else propName = nullptr; } } diff --git a/src/App/PartPy.xml b/src/App/PartPy.xml index 703da3a591..a028330a83 100644 --- a/src/App/PartPy.xml +++ b/src/App/PartPy.xml @@ -1,12 +1,12 @@ - diff --git a/src/App/PropertyExpressionEngine.cpp b/src/App/PropertyExpressionEngine.cpp index 904515f688..6990f4234c 100644 --- a/src/App/PropertyExpressionEngine.cpp +++ b/src/App/PropertyExpressionEngine.cpp @@ -62,7 +62,7 @@ void PropertyExpressionContainer::slotRelabelDocument(const App::Document &doc) // For use a private _ExprContainers to track all living // PropertyExpressionContainer including those inside undo/redo stack, // because document relabel is not undoable/redoable. - + if(doc.getOldLabel() != doc.Label.getValue()) { for(auto prop : _ExprContainers) prop->onRelabeledDocument(doc); @@ -280,7 +280,7 @@ void PropertyExpressionEngine::Save(Base::Writer &writer) const << Property::encodeAttribute(it->first.toString()) <<"\" expression=\"" << Property::encodeAttribute(expression) << "\""; if (!comment.empty()) - writer.Stream() << " comment=\"" + writer.Stream() << " comment=\"" << Property::encodeAttribute(comment) << "\""; writer.Stream() << "/>" << std::endl; } @@ -431,7 +431,7 @@ void PropertyExpressionEngine::onContainerRestored() { UpdateElementReferenceExpressionVisitor v(*this); for(auto &e : expressions) { auto expr = e.second.expression; - if(expr) + if(expr) expr->visit(v); } } @@ -473,8 +473,8 @@ void PropertyExpressionEngine::setValue(const ObjectIdentifier & path, std::shar // Check if the current expression equals the new one and do nothing if so to reduce unneeded computations ExpressionMap::iterator it = expressions.find(usePath); if(it != expressions.end() - && (expr == it->second.expression || - (expr && it->second.expression + && (expr == it->second.expression || + (expr && it->second.expression && expr->isSame(*it->second.expression)))) { return; @@ -523,7 +523,7 @@ struct cycle_detector : public boost::dfs_visitor<> { */ void PropertyExpressionEngine::buildGraph(const ExpressionMap & exprs, - boost::unordered_map & revNodes, + boost::unordered_map & revNodes, DiGraph & g, ExecuteOption option) const { boost::unordered_map nodes; @@ -538,7 +538,7 @@ void PropertyExpressionEngine::buildGraph(const ExpressionMap & exprs, bool is_output = prop->testStatus(App::Property::Output)||(prop->getType()&App::Prop_Output); if((is_output && option==ExecuteNonOutput) || (!is_output && option==ExecuteOutput)) continue; - if(option == ExecuteOnRestore + if(option == ExecuteOnRestore && !prop->testStatus(Property::Transient) && !(prop->getType() & Prop_Transient) && !prop->testStatus(Property::EvalOnRestore)) @@ -732,7 +732,7 @@ void PropertyExpressionEngine::getPathsToDocumentObject(DocumentObject* obj, auto it = deps.find(obj); if(it==deps.end()) continue; - for(auto &dep : it->second) + for(auto &dep : it->second) paths.insert(paths.end(),dep.second.begin(),dep.second.end()); } } @@ -927,7 +927,7 @@ bool PropertyExpressionEngine::adjustLink(const std::set &inLis return true; } -void PropertyExpressionEngine::updateElementReference(DocumentObject *feature, bool reverse, bool notify) +void PropertyExpressionEngine::updateElementReference(DocumentObject *feature, bool reverse, bool notify) { (void)notify; if(!feature) @@ -954,7 +954,7 @@ bool PropertyExpressionEngine::referenceChanged() const { } Property *PropertyExpressionEngine::CopyOnImportExternal( - const std::map &nameMap) const + const std::map &nameMap) const { std::unique_ptr engine; for(auto it=expressions.begin();it!=expressions.end();++it) { @@ -963,7 +963,7 @@ Property *PropertyExpressionEngine::CopyOnImportExternal( #else std::shared_ptr expr(it->second.expression->importSubNames(nameMap)); #endif - if(!expr && !engine) + if(!expr && !engine) continue; if(!engine) { engine.reset(new PropertyExpressionEngine); @@ -981,7 +981,7 @@ Property *PropertyExpressionEngine::CopyOnImportExternal( return engine.release(); } -Property *PropertyExpressionEngine::CopyOnLabelChange(App::DocumentObject *obj, +Property *PropertyExpressionEngine::CopyOnLabelChange(App::DocumentObject *obj, const std::string &ref, const char *newLabel) const { std::unique_ptr engine; @@ -991,7 +991,7 @@ Property *PropertyExpressionEngine::CopyOnLabelChange(App::DocumentObject *obj, #else std::shared_ptr expr(it->second.expression->updateLabelReference(obj,ref,newLabel)); #endif - if(!expr && !engine) + if(!expr && !engine) continue; if(!engine) { engine.reset(new PropertyExpressionEngine); @@ -1011,7 +1011,7 @@ Property *PropertyExpressionEngine::CopyOnLabelChange(App::DocumentObject *obj, return engine.release(); } -Property *PropertyExpressionEngine::CopyOnLinkReplace(const App::DocumentObject *parent, +Property *PropertyExpressionEngine::CopyOnLinkReplace(const App::DocumentObject *parent, App::DocumentObject *oldObj, App::DocumentObject *newObj) const { std::unique_ptr engine; @@ -1023,7 +1023,7 @@ Property *PropertyExpressionEngine::CopyOnLinkReplace(const App::DocumentObject std::shared_ptr expr( it->second.expression->replaceObject(parent,oldObj,newObj)); #endif - if(!expr && !engine) + if(!expr && !engine) continue; if(!engine) { engine.reset(new PropertyExpressionEngine); @@ -1043,11 +1043,11 @@ Property *PropertyExpressionEngine::CopyOnLinkReplace(const App::DocumentObject return engine.release(); } -std::map -PropertyExpressionEngine::getExpressions() const +std::map +PropertyExpressionEngine::getExpressions() const { std::map res; - for(auto &v : expressions) + for(auto &v : expressions) res[v.first] = v.second.expression.get(); return res; } diff --git a/src/App/PropertyExpressionEngine.h b/src/App/PropertyExpressionEngine.h index efb54a7479..2689eb3303 100644 --- a/src/App/PropertyExpressionEngine.h +++ b/src/App/PropertyExpressionEngine.h @@ -61,7 +61,7 @@ private: static void slotRelabelDocument(const App::Document &doc); }; -class AppExport PropertyExpressionEngine : public App::PropertyExpressionContainer, +class AppExport PropertyExpressionEngine : public App::PropertyExpressionContainer, private App::AtomicPropertyChangeInterface { TYPESYSTEM_HEADER_WITH_OVERRIDE(); @@ -139,7 +139,7 @@ public: ExecuteOnRestore, }; /** Evaluate the expressions - * + * * @param option: execution option, see ExecuteOption. */ DocumentObjectExecReturn * execute(ExecuteOption option=ExecuteAll, bool *touched=nullptr); @@ -161,7 +161,7 @@ public: size_t numExpressions() const; - ///signal called when an expression was changed + ///signal called when an expression was changed boost::signals2::signal expressionChanged; void afterRestore() override; @@ -192,7 +192,7 @@ private: boost::unordered_map &revNodes, std::vector &edges) const; void buildGraph(const ExpressionMap &exprs, - boost::unordered_map &revNodes, + boost::unordered_map &revNodes, DiGraph &g, ExecuteOption option=ExecuteAll) const; void slotChangedObject(const App::DocumentObject &obj, const App::Property &prop); diff --git a/src/App/Range.h b/src/App/Range.h index 89b53d31d9..57b2f2ca8a 100644 --- a/src/App/Range.h +++ b/src/App/Range.h @@ -50,7 +50,7 @@ struct AppExport CellAddress { }; explicit CellAddress(int row = -1, int col = -1, bool absRow=false, bool absCol=false) - : _row(row), _col(col), _absRow(absRow), _absCol(absCol) + : _row(row), _col(col), _absRow(absRow), _absCol(absCol) { } explicit CellAddress(const char * address) { @@ -162,7 +162,7 @@ public: CellAddress operator*() const { return CellAddress(row_curr, col_curr); } - inline bool operator<(const Range & other) const { + inline bool operator<(const Range & other) const { if(from() < other.from()) return true; if(from() > other.from())