From bf6f2b855d2afb89d0b49aa652bdb27385526f46 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sat, 17 Nov 2018 15:22:34 +0100 Subject: [PATCH] Property: dropping isorderrelevant boolean member in favour of bit in the status of the properties --- src/App/Property.h | 6 ++++-- src/Mod/Part/App/PropertyGeometryList.cpp | 2 +- src/Mod/Sketcher/App/SketchObject.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/App/Property.h b/src/App/Property.h index fd42bbda1a..81faeaa1fa 100644 --- a/src/App/Property.h +++ b/src/App/Property.h @@ -63,6 +63,7 @@ public: ReadOnly = 2, // for property editor Hidden = 3, // for property editor Single = 4, // for save/load of floating point numbers + Ordered = 5, // for PropertyLists whether the order of the elements is relevant for the container using it User1 = 28, // user-defined status User2 = 29, // user-defined status User3 = 30, // user-defined status @@ -204,7 +205,7 @@ class AppExport PropertyLists : public Property TYPESYSTEM_HEADER(); public: - PropertyLists() : isOrderRelevant(false){}; + PropertyLists() {}; virtual void setSize(int newSize)=0; virtual int getSize(void) const =0; @@ -212,7 +213,8 @@ public: // if the order of the elements in the list relevant? // if yes, certain operations, like restoring must make sure that the // order is kept despite errors. - bool isOrderRelevant; + inline void setOrderRelevant(bool on) { this->setStatus(Status::Ordered,on); }; + inline bool isOrderRelevant() const { return this->testStatus(Status::Ordered);} }; /** A template class that is used to inhibit multiple nested calls to aboutToSetValue/hasSetValue for properties. diff --git a/src/Mod/Part/App/PropertyGeometryList.cpp b/src/Mod/Part/App/PropertyGeometryList.cpp index 563e3e5ab6..cc9ee7eba6 100644 --- a/src/Mod/Part/App/PropertyGeometryList.cpp +++ b/src/Mod/Part/App/PropertyGeometryList.cpp @@ -191,7 +191,7 @@ void PropertyGeometryList::Restore(Base::XMLReader &reader) e.ReportException(); - if(isOrderRelevant) { + if(isOrderRelevant()) { // Pushes the best try by the Geometry class values.push_back(newG); } diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 41ccb1b63f..69313c8462 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -104,7 +104,7 @@ SketchObject::SketchObject() ADD_PROPERTY_TYPE(Constraints, (0) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch constraints"); ADD_PROPERTY_TYPE(ExternalGeometry,(0,0),"Sketch",(App::PropertyType)(App::Prop_None),"Sketch external geometry"); - Geometry.isOrderRelevant = true; + Geometry.setOrderRelevant(true); allowOtherBody = true; allowUnaligned = true;