From: SONOLET Aymeric Date: Wed, 3 Jan 2024 08:14:16 +0000 (+0100) Subject: refactor: use clang-tidy to modernize SHAPER code X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=692866cdc77502c6139d139cfc621c3ef6994894;p=modules%2Fshaper.git refactor: use clang-tidy to modernize SHAPER code --- diff --git a/.clang-tidy b/.clang-tidy index 7af9d2341..118e72abf 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,6 +1,6 @@ --- Checks: | - clang-diagnostic-*,clang-analyzer-*,modernize-use-override,modernize-use-nullptr,modernize-use-using,modernize-use-default-member-init,modernize-loop-convert,modernize-use-auto,modernize-redundant-void-arg,modernize-type-traits,modernize-use-bool-literals,modernize-use-equals-default,modernize-use-equals-delete,misc-include-cleaner,misc-const-correctness,misc-unused-parameters + -*,clang-diagnostic-*,clang-analyzer-*,modernize-use-override,modernize-use-nullptr,modernize-use-using,modernize-use-default-member-init,modernize-loop-convert,modernize-use-auto,modernize-redundant-void-arg,modernize-type-traits,modernize-use-bool-literals,modernize-use-equals-default,modernize-use-equals-delete,misc-include-cleaner,misc-const-correctness,misc-unused-parameters WarningsAsErrors: '' HeaderFilterRegex: .*SHAPER.* AnalyzeTemporaryDtors: false diff --git a/src/BuildAPI/BuildAPI_Compound.cpp b/src/BuildAPI/BuildAPI_Compound.cpp index 8ea0560b5..f70f523b0 100644 --- a/src/BuildAPI/BuildAPI_Compound.cpp +++ b/src/BuildAPI/BuildAPI_Compound.cpp @@ -41,7 +41,7 @@ BuildAPI_Compound::BuildAPI_Compound( } //================================================================================================== -BuildAPI_Compound::~BuildAPI_Compound() {} +BuildAPI_Compound::~BuildAPI_Compound() = default; //================================================================================================== void BuildAPI_Compound::setBase( diff --git a/src/BuildAPI/BuildAPI_Compound.h b/src/BuildAPI/BuildAPI_Compound.h index 515ad1f96..8daa1e0c4 100644 --- a/src/BuildAPI/BuildAPI_Compound.h +++ b/src/BuildAPI/BuildAPI_Compound.h @@ -48,7 +48,7 @@ public: /// Destructor. BUILDAPI_EXPORT - virtual ~BuildAPI_Compound(); + ~BuildAPI_Compound() override; INTERFACE_1(BuildPlugin_Compound::ID(), baseObjects, BuildPlugin_Compound::BASE_OBJECTS_ID(), @@ -61,7 +61,7 @@ public: /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Compound object. diff --git a/src/BuildAPI/BuildAPI_Edge.cpp b/src/BuildAPI/BuildAPI_Edge.cpp index fa9272d67..10dc2bb95 100644 --- a/src/BuildAPI/BuildAPI_Edge.cpp +++ b/src/BuildAPI/BuildAPI_Edge.cpp @@ -59,7 +59,7 @@ BuildAPI_Edge::BuildAPI_Edge( } //================================================================================================== -BuildAPI_Edge::~BuildAPI_Edge() {} +BuildAPI_Edge::~BuildAPI_Edge() = default; //================================================================================================== void BuildAPI_Edge::setBase( diff --git a/src/BuildAPI/BuildAPI_Edge.h b/src/BuildAPI/BuildAPI_Edge.h index e59a0e074..82a02a1bd 100644 --- a/src/BuildAPI/BuildAPI_Edge.h +++ b/src/BuildAPI/BuildAPI_Edge.h @@ -54,7 +54,7 @@ public: /// Destructor. BUILDAPI_EXPORT - virtual ~BuildAPI_Edge(); + ~BuildAPI_Edge() override; INTERFACE_5(BuildPlugin_Edge::ID(), baseObjects, BuildPlugin_Edge::BASE_OBJECTS_ID(), @@ -74,7 +74,7 @@ public: /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Edge object. diff --git a/src/BuildAPI/BuildAPI_Face.cpp b/src/BuildAPI/BuildAPI_Face.cpp index 63f6fdfa1..417bf386d 100644 --- a/src/BuildAPI/BuildAPI_Face.cpp +++ b/src/BuildAPI/BuildAPI_Face.cpp @@ -41,7 +41,7 @@ BuildAPI_Face::BuildAPI_Face( } //================================================================================================== -BuildAPI_Face::~BuildAPI_Face() {} +BuildAPI_Face::~BuildAPI_Face() = default; //================================================================================================== void BuildAPI_Face::setBase( diff --git a/src/BuildAPI/BuildAPI_Face.h b/src/BuildAPI/BuildAPI_Face.h index 5c3c8050b..33ad74b42 100644 --- a/src/BuildAPI/BuildAPI_Face.h +++ b/src/BuildAPI/BuildAPI_Face.h @@ -47,7 +47,7 @@ public: /// Destructor. BUILDAPI_EXPORT - virtual ~BuildAPI_Face(); + ~BuildAPI_Face() override; INTERFACE_1(BuildPlugin_Face::ID(), baseObjects, BuildPlugin_Face::BASE_OBJECTS_ID(), @@ -60,7 +60,7 @@ public: /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Face object. diff --git a/src/BuildAPI/BuildAPI_Interpolation.cpp b/src/BuildAPI/BuildAPI_Interpolation.cpp index 7f3a0be0f..ea11a5df2 100644 --- a/src/BuildAPI/BuildAPI_Interpolation.cpp +++ b/src/BuildAPI/BuildAPI_Interpolation.cpp @@ -87,7 +87,7 @@ BuildAPI_Interpolation::BuildAPI_Interpolation( } //================================================================================================== -BuildAPI_Interpolation::~BuildAPI_Interpolation() {} +BuildAPI_Interpolation::~BuildAPI_Interpolation() = default; //================================================================================================== void BuildAPI_Interpolation::setBase( diff --git a/src/BuildAPI/BuildAPI_Interpolation.h b/src/BuildAPI/BuildAPI_Interpolation.h index b35d89a0b..e02555ceb 100644 --- a/src/BuildAPI/BuildAPI_Interpolation.h +++ b/src/BuildAPI/BuildAPI_Interpolation.h @@ -70,7 +70,7 @@ public: /// Destructor. BUILDAPI_EXPORT - virtual ~BuildAPI_Interpolation(); + ~BuildAPI_Interpolation() override; INTERFACE_13(BuildPlugin_Interpolation::ID(), baseObjects, BuildPlugin_Interpolation::BASE_OBJECTS_ID(), @@ -118,7 +118,7 @@ public: /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; private: void execIfBaseNotEmpty(); diff --git a/src/BuildAPI/BuildAPI_Polyline.cpp b/src/BuildAPI/BuildAPI_Polyline.cpp index 94a2f71b1..c7af3abe1 100644 --- a/src/BuildAPI/BuildAPI_Polyline.cpp +++ b/src/BuildAPI/BuildAPI_Polyline.cpp @@ -43,7 +43,7 @@ BuildAPI_Polyline::BuildAPI_Polyline( } //================================================================================================== -BuildAPI_Polyline::~BuildAPI_Polyline() {} +BuildAPI_Polyline::~BuildAPI_Polyline() = default; //================================================================================================== void BuildAPI_Polyline::setBase( diff --git a/src/BuildAPI/BuildAPI_Polyline.h b/src/BuildAPI/BuildAPI_Polyline.h index fbcc7f543..9dcaa811c 100644 --- a/src/BuildAPI/BuildAPI_Polyline.h +++ b/src/BuildAPI/BuildAPI_Polyline.h @@ -49,7 +49,7 @@ public: /// Destructor. BUILDAPI_EXPORT - virtual ~BuildAPI_Polyline(); + ~BuildAPI_Polyline() override; INTERFACE_2(BuildPlugin_Polyline::ID(), baseObjects, BuildPlugin_Polyline::BASE_OBJECTS_ID(), @@ -66,7 +66,7 @@ public: /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Polyline object. diff --git a/src/BuildAPI/BuildAPI_Shell.cpp b/src/BuildAPI/BuildAPI_Shell.cpp index 293850685..cfce2e86a 100644 --- a/src/BuildAPI/BuildAPI_Shell.cpp +++ b/src/BuildAPI/BuildAPI_Shell.cpp @@ -41,7 +41,7 @@ BuildAPI_Shell::BuildAPI_Shell( } //================================================================================================== -BuildAPI_Shell::~BuildAPI_Shell() {} +BuildAPI_Shell::~BuildAPI_Shell() = default; //================================================================================================== void BuildAPI_Shell::setBase( diff --git a/src/BuildAPI/BuildAPI_Shell.h b/src/BuildAPI/BuildAPI_Shell.h index 74d16f089..84cd87155 100644 --- a/src/BuildAPI/BuildAPI_Shell.h +++ b/src/BuildAPI/BuildAPI_Shell.h @@ -47,7 +47,7 @@ public: /// Destructor. BUILDAPI_EXPORT - virtual ~BuildAPI_Shell(); + ~BuildAPI_Shell() override; INTERFACE_1(BuildPlugin_Shell::ID(), baseObjects, BuildPlugin_Shell::BASE_OBJECTS_ID(), @@ -60,7 +60,7 @@ public: /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Shell object. diff --git a/src/BuildAPI/BuildAPI_Solid.cpp b/src/BuildAPI/BuildAPI_Solid.cpp index 0f7e59958..d21ab1fa4 100644 --- a/src/BuildAPI/BuildAPI_Solid.cpp +++ b/src/BuildAPI/BuildAPI_Solid.cpp @@ -41,7 +41,7 @@ BuildAPI_Solid::BuildAPI_Solid( } //================================================================================================== -BuildAPI_Solid::~BuildAPI_Solid() {} +BuildAPI_Solid::~BuildAPI_Solid() = default; //================================================================================================== void BuildAPI_Solid::setBase( diff --git a/src/BuildAPI/BuildAPI_Solid.h b/src/BuildAPI/BuildAPI_Solid.h index deb753de8..6a4aaf11b 100644 --- a/src/BuildAPI/BuildAPI_Solid.h +++ b/src/BuildAPI/BuildAPI_Solid.h @@ -47,7 +47,7 @@ public: /// Destructor. BUILDAPI_EXPORT - virtual ~BuildAPI_Solid(); + ~BuildAPI_Solid() override; INTERFACE_1(BuildPlugin_Solid::ID(), baseObjects, BuildPlugin_Solid::BASE_OBJECTS_ID(), @@ -60,7 +60,7 @@ public: /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Solid object. diff --git a/src/BuildAPI/BuildAPI_SubShapes.cpp b/src/BuildAPI/BuildAPI_SubShapes.cpp index cb2ca933c..71a9b8d69 100644 --- a/src/BuildAPI/BuildAPI_SubShapes.cpp +++ b/src/BuildAPI/BuildAPI_SubShapes.cpp @@ -43,7 +43,7 @@ BuildAPI_SubShapes::BuildAPI_SubShapes( } //================================================================================================== -BuildAPI_SubShapes::~BuildAPI_SubShapes() {} +BuildAPI_SubShapes::~BuildAPI_SubShapes() = default; //================================================================================================== void BuildAPI_SubShapes::setBaseShape( diff --git a/src/BuildAPI/BuildAPI_SubShapes.h b/src/BuildAPI/BuildAPI_SubShapes.h index ef81591bd..10214657f 100644 --- a/src/BuildAPI/BuildAPI_SubShapes.h +++ b/src/BuildAPI/BuildAPI_SubShapes.h @@ -49,7 +49,7 @@ public: /// Destructor. BUILDAPI_EXPORT - virtual ~BuildAPI_SubShapes(); + ~BuildAPI_SubShapes() override; INTERFACE_2(BuildPlugin_SubShapes::ID(), baseShape, BuildPlugin_SubShapes::BASE_SHAPE_ID(), @@ -68,7 +68,7 @@ public: /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on SubShapes object. diff --git a/src/BuildAPI/BuildAPI_Vertex.cpp b/src/BuildAPI/BuildAPI_Vertex.cpp index 3367f0f48..62f4edeb3 100644 --- a/src/BuildAPI/BuildAPI_Vertex.cpp +++ b/src/BuildAPI/BuildAPI_Vertex.cpp @@ -54,7 +54,7 @@ BuildAPI_Vertex::BuildAPI_Vertex( } //================================================================================================== -BuildAPI_Vertex::~BuildAPI_Vertex() {} +BuildAPI_Vertex::~BuildAPI_Vertex() = default; //================================================================================================== void BuildAPI_Vertex::setBase( diff --git a/src/BuildAPI/BuildAPI_Vertex.h b/src/BuildAPI/BuildAPI_Vertex.h index 9e8096ad3..f078e9b13 100644 --- a/src/BuildAPI/BuildAPI_Vertex.h +++ b/src/BuildAPI/BuildAPI_Vertex.h @@ -54,7 +54,7 @@ public: /// Destructor. BUILDAPI_EXPORT - virtual ~BuildAPI_Vertex(); + ~BuildAPI_Vertex() override; INTERFACE_2(BuildPlugin_Vertex::ID(), baseObjects, BuildPlugin_Vertex::BASE_OBJECTS_ID(), @@ -68,7 +68,7 @@ public: /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Vertex object. diff --git a/src/BuildAPI/BuildAPI_Wire.cpp b/src/BuildAPI/BuildAPI_Wire.cpp index e8c0f6052..4d8241ba8 100644 --- a/src/BuildAPI/BuildAPI_Wire.cpp +++ b/src/BuildAPI/BuildAPI_Wire.cpp @@ -43,7 +43,7 @@ BuildAPI_Wire::BuildAPI_Wire( } //================================================================================================== -BuildAPI_Wire::~BuildAPI_Wire() {} +BuildAPI_Wire::~BuildAPI_Wire() = default; //================================================================================================== void BuildAPI_Wire::setBase( diff --git a/src/BuildAPI/BuildAPI_Wire.h b/src/BuildAPI/BuildAPI_Wire.h index d992ba8ce..f4fbca759 100644 --- a/src/BuildAPI/BuildAPI_Wire.h +++ b/src/BuildAPI/BuildAPI_Wire.h @@ -48,7 +48,7 @@ public: /// Destructor. BUILDAPI_EXPORT - virtual ~BuildAPI_Wire(); + ~BuildAPI_Wire() override; INTERFACE_2(BuildPlugin_Wire::ID(), baseObjects, BuildPlugin_Wire::BASE_OBJECTS_ID(), @@ -67,7 +67,7 @@ public: /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Wire object. diff --git a/src/BuildPlugin/BuildPlugin_CompSolid.cpp b/src/BuildPlugin/BuildPlugin_CompSolid.cpp index 7fa437b7c..944abdd5b 100644 --- a/src/BuildPlugin/BuildPlugin_CompSolid.cpp +++ b/src/BuildPlugin/BuildPlugin_CompSolid.cpp @@ -24,7 +24,7 @@ #include //================================================================================================= -BuildPlugin_CompSolid::BuildPlugin_CompSolid() {} +BuildPlugin_CompSolid::BuildPlugin_CompSolid() = default; //================================================================================================= void BuildPlugin_CompSolid::initAttributes() { diff --git a/src/BuildPlugin/BuildPlugin_Compound.cpp b/src/BuildPlugin/BuildPlugin_Compound.cpp index a2afd9361..a16dbba2c 100644 --- a/src/BuildPlugin/BuildPlugin_Compound.cpp +++ b/src/BuildPlugin/BuildPlugin_Compound.cpp @@ -27,7 +27,7 @@ #include //================================================================================================= -BuildPlugin_Compound::BuildPlugin_Compound() {} +BuildPlugin_Compound::BuildPlugin_Compound() = default; //================================================================================================= void BuildPlugin_Compound::initAttributes() { diff --git a/src/BuildPlugin/BuildPlugin_Compound.h b/src/BuildPlugin/BuildPlugin_Compound.h index 6ebee72d1..1316c6e5a 100644 --- a/src/BuildPlugin/BuildPlugin_Compound.h +++ b/src/BuildPlugin/BuildPlugin_Compound.h @@ -46,17 +46,17 @@ public: } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string &getKind() { + BUILDPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = BuildPlugin_Compound::ID(); return MY_KIND; } /// Request for initialization of data model of the feature: adding all /// attributes. - BUILDPLUGIN_EXPORT virtual void initAttributes(); + BUILDPLUGIN_EXPORT void initAttributes() override; /// Creates a new part document if needed. - BUILDPLUGIN_EXPORT virtual void execute(); + BUILDPLUGIN_EXPORT void execute() override; }; #endif diff --git a/src/BuildPlugin/BuildPlugin_Edge.cpp b/src/BuildPlugin/BuildPlugin_Edge.cpp index 2468abe0e..e294266df 100644 --- a/src/BuildPlugin/BuildPlugin_Edge.cpp +++ b/src/BuildPlugin/BuildPlugin_Edge.cpp @@ -53,7 +53,7 @@ static bool getShape(const AttributeSelectionPtr theAttribute, } //================================================================================================= -BuildPlugin_Edge::BuildPlugin_Edge() {} +BuildPlugin_Edge::BuildPlugin_Edge() = default; //================================================================================================= void BuildPlugin_Edge::initAttributes() { diff --git a/src/BuildPlugin/BuildPlugin_Edge.h b/src/BuildPlugin/BuildPlugin_Edge.h index a7827a18d..65e843f78 100644 --- a/src/BuildPlugin/BuildPlugin_Edge.h +++ b/src/BuildPlugin/BuildPlugin_Edge.h @@ -46,7 +46,7 @@ public: } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string &getKind() { + BUILDPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = BuildPlugin_Edge::ID(); return MY_KIND; } @@ -89,10 +89,10 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes. - BUILDPLUGIN_EXPORT virtual void initAttributes(); + BUILDPLUGIN_EXPORT void initAttributes() override; /// Creates a new part document if needed. - BUILDPLUGIN_EXPORT virtual void execute(); + BUILDPLUGIN_EXPORT void execute() override; private: /// Build edges by the set of segments diff --git a/src/BuildPlugin/BuildPlugin_Face.cpp b/src/BuildPlugin/BuildPlugin_Face.cpp index 74bd2d37d..f8c1b28a5 100644 --- a/src/BuildPlugin/BuildPlugin_Face.cpp +++ b/src/BuildPlugin/BuildPlugin_Face.cpp @@ -36,7 +36,7 @@ #include //================================================================================================= -BuildPlugin_Face::BuildPlugin_Face() {} +BuildPlugin_Face::BuildPlugin_Face() = default; //================================================================================================= void BuildPlugin_Face::initAttributes() { @@ -157,8 +157,7 @@ void BuildPlugin_Face::execute() { // Store result. int anIndex = 0; - for (ListOfShape::const_iterator anIt = aFaces.cbegin(); - anIt != aFaces.cend(); ++anIt) { + for (auto aShape : aFaces) { std::shared_ptr aMakeShapeList( new GeomAlgoAPI_MakeShapeList); if (anIndex < aNbFacesFromEdges) @@ -166,7 +165,6 @@ void BuildPlugin_Face::execute() { else if (anIndex < aNbNonPlanarFaces) aMakeShapeList->appendAlgo(aNonPlanarFaceBuilder); - GeomShapePtr aShape = *anIt; GeomMakeShapePtr aCopy(new GeomAlgoAPI_Copy(aShape)); aMakeShapeList->appendAlgo(aCopy); @@ -195,8 +193,7 @@ void BuildPlugin_Face::buildFacesByEdges( GeomAlgoAPI_ShapeTools::findPlane(theEdges); std::shared_ptr aNormal = aPln->direction(); bool isReverse = !theNormals.empty(); - std::list>::const_iterator aNormIt = - theNormals.begin(); + auto aNormIt = theNormals.begin(); for (; aNormIt != theNormals.end() && isReverse; ++aNormIt) if ((*aNormIt)->dot(aNormal) > 1.e-7) isReverse = false; @@ -214,9 +211,8 @@ void BuildPlugin_Face::buildFacesByEdges( // Get wires from faces. ListOfShape aWires; - for (ListOfShape::const_iterator anIt = theFaces.cbegin(); - anIt != theFaces.cend(); ++anIt) - aWires.push_back(GeomAlgoAPI_ShapeTools::getFaceOuterWire(*anIt)); + for (const auto &theFace : theFaces) + aWires.push_back(GeomAlgoAPI_ShapeTools::getFaceOuterWire(theFace)); // Make faces with holes. theFaces.clear(); diff --git a/src/BuildPlugin/BuildPlugin_Face.h b/src/BuildPlugin/BuildPlugin_Face.h index ff7f70411..1216261f8 100644 --- a/src/BuildPlugin/BuildPlugin_Face.h +++ b/src/BuildPlugin/BuildPlugin_Face.h @@ -49,17 +49,17 @@ public: } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string &getKind() { + BUILDPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = BuildPlugin_Face::ID(); return MY_KIND; } /// Request for initialization of data model of the feature: adding all /// attributes. - BUILDPLUGIN_EXPORT virtual void initAttributes(); + BUILDPLUGIN_EXPORT void initAttributes() override; /// Creates a new part document if needed. - BUILDPLUGIN_EXPORT virtual void execute(); + BUILDPLUGIN_EXPORT void execute() override; private: /// Create faces basing on the list of edges diff --git a/src/BuildPlugin/BuildPlugin_Filling.cpp b/src/BuildPlugin/BuildPlugin_Filling.cpp index b34546670..69e42797c 100644 --- a/src/BuildPlugin/BuildPlugin_Filling.cpp +++ b/src/BuildPlugin/BuildPlugin_Filling.cpp @@ -60,7 +60,7 @@ static void shiftStartPoint(GeomWirePtr &theWire, const GeomEdgePtr &theRefEdge, const double theTolerance); //================================================================================================= -BuildPlugin_Filling::BuildPlugin_Filling() {} +BuildPlugin_Filling::BuildPlugin_Filling() = default; //================================================================================================= void BuildPlugin_Filling::initAttributes() { diff --git a/src/BuildPlugin/BuildPlugin_Plugin.h b/src/BuildPlugin/BuildPlugin_Plugin.h index 4870b488d..307c3db5f 100644 --- a/src/BuildPlugin/BuildPlugin_Plugin.h +++ b/src/BuildPlugin/BuildPlugin_Plugin.h @@ -35,7 +35,7 @@ public: BuildPlugin_Plugin(); /// Creates the feature object of this plugin by the feature string ID - virtual FeaturePtr createFeature(std::string theFeatureID); + FeaturePtr createFeature(std::string theFeatureID) override; }; #endif diff --git a/src/BuildPlugin/BuildPlugin_Polyline.cpp b/src/BuildPlugin/BuildPlugin_Polyline.cpp index 5c9b37a19..0b22f3aaa 100644 --- a/src/BuildPlugin/BuildPlugin_Polyline.cpp +++ b/src/BuildPlugin/BuildPlugin_Polyline.cpp @@ -37,7 +37,7 @@ #include //================================================================================================= -BuildPlugin_Polyline::BuildPlugin_Polyline() {} +BuildPlugin_Polyline::BuildPlugin_Polyline() = default; //================================================================================================= void BuildPlugin_Polyline::initAttributes() { @@ -106,7 +106,7 @@ void BuildPlugin_Polyline::execute() { // Store result. ResultBodyPtr aResultBody = document()->createBody(data()); - std::set::const_iterator aContextIt = aContexts.begin(); + auto aContextIt = aContexts.begin(); for (; aContextIt != aContexts.end(); aContextIt++) { aResultBody->storeModified(*aContextIt, aWire, aContextIt == aContexts.begin()); diff --git a/src/BuildPlugin/BuildPlugin_Polyline.h b/src/BuildPlugin/BuildPlugin_Polyline.h index 3e72079e1..177bbd414 100644 --- a/src/BuildPlugin/BuildPlugin_Polyline.h +++ b/src/BuildPlugin/BuildPlugin_Polyline.h @@ -55,17 +55,17 @@ public: inline static bool CLOSED_DEFAULT() { return false; } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string &getKind() { + BUILDPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = BuildPlugin_Polyline::ID(); return MY_KIND; } /// Request for initialization of data model of the feature: adding all /// attributes. - BUILDPLUGIN_EXPORT virtual void initAttributes(); + BUILDPLUGIN_EXPORT void initAttributes() override; /// Creates a new part document if needed. - BUILDPLUGIN_EXPORT virtual void execute(); + BUILDPLUGIN_EXPORT void execute() override; }; #endif diff --git a/src/BuildPlugin/BuildPlugin_Shape.cpp b/src/BuildPlugin/BuildPlugin_Shape.cpp index ac0f8b8a5..2f3b8494e 100644 --- a/src/BuildPlugin/BuildPlugin_Shape.cpp +++ b/src/BuildPlugin/BuildPlugin_Shape.cpp @@ -36,9 +36,7 @@ void BuildPlugin_Shape::storeResult(const GeomMakeShapePtr &theAlgorithm, ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex); aResultBody->storeModified(theOriginalSolids, theResultShape, theAlgorithm); - for (ListOfShape::const_iterator anIt = theOriginalShapes.cbegin(); - anIt != theOriginalShapes.cend(); ++anIt) { - GeomShapePtr aShape = *anIt; + for (auto aShape : theOriginalShapes) { aResultBody->loadModifiedShapes(theAlgorithm, aShape, GeomAPI_Shape::VERTEX); aResultBody->loadModifiedShapes(theAlgorithm, aShape, GeomAPI_Shape::EDGE); @@ -68,8 +66,7 @@ void BuildPlugin_Shape::getOriginalShapesAndContexts( aContexts.insert(aContext); } - std::set::const_iterator anIt = - aContexts.begin(); + auto anIt = aContexts.begin(); for (; anIt != aContexts.end(); ++anIt) theContexts.push_back(*anIt); } diff --git a/src/BuildPlugin/BuildPlugin_Shell.cpp b/src/BuildPlugin/BuildPlugin_Shell.cpp index fd2a40ff1..47b10053d 100644 --- a/src/BuildPlugin/BuildPlugin_Shell.cpp +++ b/src/BuildPlugin/BuildPlugin_Shell.cpp @@ -29,7 +29,7 @@ #include //================================================================================================= -BuildPlugin_Shell::BuildPlugin_Shell() {} +BuildPlugin_Shell::BuildPlugin_Shell() = default; //================================================================================================= void BuildPlugin_Shell::initAttributes() { diff --git a/src/BuildPlugin/BuildPlugin_Shell.h b/src/BuildPlugin/BuildPlugin_Shell.h index e52a8d509..bda55c2c0 100644 --- a/src/BuildPlugin/BuildPlugin_Shell.h +++ b/src/BuildPlugin/BuildPlugin_Shell.h @@ -45,17 +45,17 @@ public: } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string &getKind() { + BUILDPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = BuildPlugin_Shell::ID(); return MY_KIND; } /// Request for initialization of data model of the feature: adding all /// attributes. - BUILDPLUGIN_EXPORT virtual void initAttributes(); + BUILDPLUGIN_EXPORT void initAttributes() override; /// Creates a new part document if needed. - BUILDPLUGIN_EXPORT virtual void execute(); + BUILDPLUGIN_EXPORT void execute() override; }; #endif diff --git a/src/BuildPlugin/BuildPlugin_Solid.cpp b/src/BuildPlugin/BuildPlugin_Solid.cpp index 02de79148..466772063 100644 --- a/src/BuildPlugin/BuildPlugin_Solid.cpp +++ b/src/BuildPlugin/BuildPlugin_Solid.cpp @@ -29,7 +29,7 @@ #include //================================================================================================= -BuildPlugin_Solid::BuildPlugin_Solid() {} +BuildPlugin_Solid::BuildPlugin_Solid() = default; //================================================================================================= void BuildPlugin_Solid::initAttributes() { diff --git a/src/BuildPlugin/BuildPlugin_SubShapes.cpp b/src/BuildPlugin/BuildPlugin_SubShapes.cpp index 00e374d46..a95f5235b 100644 --- a/src/BuildPlugin/BuildPlugin_SubShapes.cpp +++ b/src/BuildPlugin/BuildPlugin_SubShapes.cpp @@ -33,7 +33,7 @@ #include //================================================================================================== -BuildPlugin_SubShapes::BuildPlugin_SubShapes() {} +BuildPlugin_SubShapes::BuildPlugin_SubShapes() = default; //================================================================================================== void BuildPlugin_SubShapes::initAttributes() { @@ -128,10 +128,9 @@ void BuildPlugin_SubShapes::execute() { ResultBodyPtr aResultBody = document()->createBody(data()); aResultBody->storeModified(aBaseShape, aResultShape); aResultBody->loadModifiedShapes(aBuilder, aBaseShape, GeomAPI_Shape::EDGE); - for (ListOfShape::const_iterator anIt = aShapesToAdd.cbegin(); - anIt != aShapesToAdd.cend(); ++anIt) { - GeomAPI_Shape::ShapeType aShType = (*anIt)->shapeType(); - aResultBody->loadModifiedShapes(aBuilder, *anIt, aShType); + for (const auto &anIt : aShapesToAdd) { + GeomAPI_Shape::ShapeType aShType = anIt->shapeType(); + aResultBody->loadModifiedShapes(aBuilder, anIt, aShType); } setResult(aResultBody); } diff --git a/src/BuildPlugin/BuildPlugin_SubShapes.h b/src/BuildPlugin/BuildPlugin_SubShapes.h index a06f9b868..5b3599485 100644 --- a/src/BuildPlugin/BuildPlugin_SubShapes.h +++ b/src/BuildPlugin/BuildPlugin_SubShapes.h @@ -52,21 +52,21 @@ public: } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string &getKind() { + BUILDPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = BuildPlugin_SubShapes::ID(); return MY_KIND; } /// Request for initialization of data model of the feature: adding all /// attributes. - BUILDPLUGIN_EXPORT virtual void initAttributes(); + BUILDPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object. /// \param[in] theID identifier of changed attribute. - BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + BUILDPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// Creates a new part document if needed. - BUILDPLUGIN_EXPORT virtual void execute(); + BUILDPLUGIN_EXPORT void execute() override; }; #endif diff --git a/src/BuildPlugin/BuildPlugin_Validators.h b/src/BuildPlugin/BuildPlugin_Validators.h index 5c8703585..c890331db 100644 --- a/src/BuildPlugin/BuildPlugin_Validators.h +++ b/src/BuildPlugin/BuildPlugin_Validators.h @@ -35,9 +35,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class BuildPlugin_ValidatorBaseForWire @@ -51,9 +51,9 @@ public: //! \param theFeature the checked feature. //! \param theArguments arguments of the feature. //! \param theError error message. - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class BuildPlugin_ValidatorBaseForFace @@ -67,9 +67,9 @@ public: //! \param theFeature the checked feature. //! \param theArguments arguments of the feature. //! \param theError error message. - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class BuildPlugin_ValidatorBaseForSolids @@ -82,9 +82,9 @@ public: //! \param theFeature the checked feature. //! \param theArguments arguments of the feature. //! \param theError error message. - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class BuildPlugin_ValidatorSubShapesSelection @@ -97,9 +97,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class BuildPlugin_ValidatorFillingSelection @@ -112,9 +112,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class BuildPlugin_ValidatorBaseForVertex @@ -126,9 +126,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class BuildPlugin_ValidatorExpression @@ -141,9 +141,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError the error string message if validation fails - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/BuildPlugin/BuildPlugin_Vertex.cpp b/src/BuildPlugin/BuildPlugin_Vertex.cpp index d893c0373..90ecdb7f1 100644 --- a/src/BuildPlugin/BuildPlugin_Vertex.cpp +++ b/src/BuildPlugin/BuildPlugin_Vertex.cpp @@ -37,7 +37,7 @@ #include //================================================================================================= -BuildPlugin_Vertex::BuildPlugin_Vertex() {} +BuildPlugin_Vertex::BuildPlugin_Vertex() = default; //================================================================================================= void BuildPlugin_Vertex::initAttributes() { @@ -112,7 +112,7 @@ static void collectEdgesAndVertices(AttributeSelectionPtr theSelection, // process results of the feature const std::list &aResults = aFeature->results(); - std::list::const_iterator anIt = aResults.begin(); + auto anIt = aResults.begin(); for (; anIt != aResults.end(); ++anIt) thePrimitives.push_back((*anIt)->shape()); diff --git a/src/BuildPlugin/BuildPlugin_Vertex.h b/src/BuildPlugin/BuildPlugin_Vertex.h index 057c77caf..3428c7a9e 100644 --- a/src/BuildPlugin/BuildPlugin_Vertex.h +++ b/src/BuildPlugin/BuildPlugin_Vertex.h @@ -54,17 +54,17 @@ public: } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string &getKind() { + BUILDPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = BuildPlugin_Vertex::ID(); return MY_KIND; } /// Request for initialization of data model of the feature: adding all /// attributes. - BUILDPLUGIN_EXPORT virtual void initAttributes(); + BUILDPLUGIN_EXPORT void initAttributes() override; /// Creates a new part document if needed. - BUILDPLUGIN_EXPORT virtual void execute(); + BUILDPLUGIN_EXPORT void execute() override; protected: void buildVertices(const ListOfShape &theShapes, bool isIntersect); diff --git a/src/BuildPlugin/BuildPlugin_Wire.cpp b/src/BuildPlugin/BuildPlugin_Wire.cpp index a2b23939e..b16606ff5 100644 --- a/src/BuildPlugin/BuildPlugin_Wire.cpp +++ b/src/BuildPlugin/BuildPlugin_Wire.cpp @@ -52,7 +52,7 @@ static bool buildWire(const ListOfShape &theEdges, GeomShapePtr &theWire, std::string &theError); //================================================================================================= -BuildPlugin_Wire::BuildPlugin_Wire() {} +BuildPlugin_Wire::BuildPlugin_Wire() = default; //================================================================================================= void BuildPlugin_Wire::initAttributes() { @@ -124,9 +124,8 @@ void BuildPlugin_Wire::execute() { for (GeomAPI_ShapeExplorer anExp(aWire, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { GeomShapePtr anEdgeInResult = anExp.current(); - for (ListOfShape::const_iterator anIt = anEdges.cbegin(); - anIt != anEdges.cend(); ++anIt) { - std::shared_ptr anEdgeInList(new GeomAPI_Edge(*anIt)); + for (const auto &anEdge : anEdges) { + std::shared_ptr anEdgeInList(new GeomAPI_Edge(anEdge)); if (anEdgeInList->isEqual(anEdgeInResult)) { if (anEdgeInList->isSame(anEdgeInResult)) aResultBody->generated(anEdgeInResult, "Edge"); @@ -141,24 +140,21 @@ void BuildPlugin_Wire::execute() { } // create wires from sketches - for (std::list>::iterator anIt = - aSketches.begin(); - anIt != aSketches.end(); ++anIt) { + for (auto &aSketche : aSketches) { ListOfShape aWires; GeomMakeShapePtr aMakeShapeList; - if (!buildSketchWires(anIt->first, anIt->second, isIntersect, aWires, + if (!buildSketchWires(aSketche.first, aSketche.second, isIntersect, aWires, aMakeShapeList, anError)) { setError(anError); return; } - for (ListOfShape::iterator aWIt = aWires.begin(); aWIt != aWires.end(); - ++aWIt) { + for (auto &aWire : aWires) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); ListOfShape aSketch; - aSketch.push_back(anIt->second); - aResultBody->storeModified(aSketch, *aWIt, aMakeShapeList); - aResultBody->loadModifiedShapes(aMakeShapeList, anIt->second, + aSketch.push_back(aSketche.second); + aResultBody->storeModified(aSketch, aWire, aMakeShapeList); + aResultBody->loadModifiedShapes(aMakeShapeList, aSketche.second, GeomAPI_Shape::EDGE); setResult(aResultBody, aResultIndex); ++aResultIndex; @@ -233,10 +229,7 @@ bool BuildPlugin_Wire::addContour() { // Check if edges have contours. bool isAnyContourAdded = false; - for (std::list::const_iterator aListIt = - anAttributesToCheck.cbegin(); - aListIt != anAttributesToCheck.cend(); ++aListIt) { - AttributeSelectionPtr aSelection = *aListIt; + for (auto aSelection : anAttributesToCheck) { std::shared_ptr anEdgeInList( new GeomAPI_Edge(aSelection->value())); @@ -272,7 +265,7 @@ bool BuildPlugin_Wire::addContour() { anExp.more(); anExp.next()) { std::shared_ptr anEdgeOnFace( new GeomAPI_Edge(anExp.current())); - ListOfShape::const_iterator anEdgesIt = anAddedEdges.cbegin(); + auto anEdgesIt = anAddedEdges.cbegin(); for (; anEdgesIt != anAddedEdges.cend(); ++anEdgesIt) { if (anEdgeOnFace->isEqual(*anEdgesIt)) { break; @@ -338,9 +331,8 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, // collect wires from faces const ListOfShape &aFaces = aSketchBuilder->faces(); - for (ListOfShape::const_iterator anIt = aFaces.begin(); - anIt != aFaces.end(); ++anIt) { - for (GeomAPI_ShapeExplorer aWExp(*anIt, GeomAPI_Shape::WIRE); + for (const auto &aFace : aFaces) { + for (GeomAPI_ShapeExplorer aWExp(aFace, GeomAPI_Shape::WIRE); aWExp.more(); aWExp.next()) { // skip the wire if at least one its edge was already processed GeomAPI_ShapeExplorer aEExp(aWExp.current(), GeomAPI_Shape::EDGE); @@ -361,14 +353,12 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, // collect unused edges ListOfShape aCopy; - for (ListOfShape::iterator anIt = aSketchEdges.begin(); - anIt != aSketchEdges.end(); ++anIt) { + for (auto &aSketchEdge : aSketchEdges) { ListOfShape anImages; - aSketchBuilder->modified(*anIt, anImages); - for (ListOfShape::iterator anEdge = anImages.begin(); - anEdge != anImages.end(); ++anEdge) - if (aProcessedEdges.find(*anEdge) == aProcessedEdges.end()) - aCopy.push_back(*anEdge); + aSketchBuilder->modified(aSketchEdge, anImages); + for (auto &anImage : anImages) + if (aProcessedEdges.find(anImage) == aProcessedEdges.end()) + aCopy.push_back(anImage); } if (aCopy.size() > 1) { @@ -393,22 +383,20 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, // connect least edges to wires typedef std::list ListOfWires; ListOfWires aNewWires; - typedef std::map - MapVertexWire; + using MapVertexWire = std::map; MapVertexWire aMapVW; - for (ListOfShape::iterator aEIt = aSketchEdges.begin(); - aEIt != aSketchEdges.end(); ++aEIt) { - GeomEdgePtr anEdge = (*aEIt)->edge(); + for (auto &aSketchEdge : aSketchEdges) { + GeomEdgePtr anEdge = aSketchEdge->edge(); GeomVertexPtr aStartV, aEndV; anEdge->vertices(aStartV, aEndV); - MapVertexWire::iterator aFoundStart = aMapVW.find(aStartV); - MapVertexWire::iterator aFoundEnd = aMapVW.find(aEndV); + auto aFoundStart = aMapVW.find(aStartV); + auto aFoundEnd = aMapVW.find(aEndV); if (aFoundStart == aMapVW.end()) { if (aFoundEnd == aMapVW.end()) { // new wire aNewWires.push_back(ListOfShape()); - ListOfWires::iterator aNewW = --aNewWires.end(); + auto aNewW = --aNewWires.end(); aNewW->push_back(anEdge); aMapVW[aStartV] = aNewW; aMapVW[aEndV] = aNewW; @@ -429,8 +417,7 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, aFoundStart->second->insert(aFoundStart->second->end(), aFoundEnd->second->begin(), aFoundEnd->second->end()); - for (MapVertexWire::iterator it = aMapVW.begin(); it != aMapVW.end(); - ++it) + for (auto it = aMapVW.begin(); it != aMapVW.end(); ++it) if (it != aFoundEnd && it->second == aFoundEnd->second) { // another boundary of the wire, change link to the whole result it->second = aFoundStart->second; @@ -451,10 +438,9 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape, } // generate new wires from the sets of edges - for (ListOfWires::iterator anIt = aNewWires.begin(); anIt != aNewWires.end(); - ++anIt) { + for (auto &aNewWire : aNewWires) { GeomShapePtr aWire; - if (!buildWire(*anIt, aWire, theError)) + if (!buildWire(aNewWire, aWire, theError)) return false; theWires.push_back(aWire); } diff --git a/src/BuildPlugin/BuildPlugin_Wire.h b/src/BuildPlugin/BuildPlugin_Wire.h index e1e580a2b..0f867a90f 100644 --- a/src/BuildPlugin/BuildPlugin_Wire.h +++ b/src/BuildPlugin/BuildPlugin_Wire.h @@ -58,22 +58,22 @@ public: } /// \return the kind of a feature. - BUILDPLUGIN_EXPORT virtual const std::string &getKind() { + BUILDPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = BuildPlugin_Wire::ID(); return MY_KIND; } /// Request for initialization of data model of the feature: adding all /// attributes. - BUILDPLUGIN_EXPORT virtual void initAttributes(); + BUILDPLUGIN_EXPORT void initAttributes() override; /// Creates a new part document if needed. - BUILDPLUGIN_EXPORT virtual void execute(); + BUILDPLUGIN_EXPORT void execute() override; /// Performs some functionality by action id. /// \param[in] theAttributeId action key id. /// \return false in case if action not perfomed. - BUILDPLUGIN_EXPORT virtual bool customAction(const std::string &theActionId); + BUILDPLUGIN_EXPORT bool customAction(const std::string &theActionId) override; private: /// Action: Adds to the list of segments other segments of the sketcher diff --git a/src/CollectionAPI/CollectionAPI_Field.cpp b/src/CollectionAPI/CollectionAPI_Field.cpp index b7ba04567..561415701 100644 --- a/src/CollectionAPI/CollectionAPI_Field.cpp +++ b/src/CollectionAPI/CollectionAPI_Field.cpp @@ -37,7 +37,7 @@ CollectionAPI_Field::CollectionAPI_Field( } //================================================================================================= -CollectionAPI_Field::~CollectionAPI_Field() {} +CollectionAPI_Field::~CollectionAPI_Field() = default; //================================================================================================= void CollectionAPI_Field::setSelection( diff --git a/src/CollectionAPI/CollectionAPI_Field.h b/src/CollectionAPI/CollectionAPI_Field.h index f88032980..254cdc6f0 100644 --- a/src/CollectionAPI/CollectionAPI_Field.h +++ b/src/CollectionAPI/CollectionAPI_Field.h @@ -45,7 +45,7 @@ public: /// Destructor. COLLECTIONAPI_EXPORT - virtual ~CollectionAPI_Field(); + ~CollectionAPI_Field() override; INTERFACE_4(CollectionPlugin_Field::ID(), selection, CollectionPlugin_Field::SELECTED_ID(), @@ -96,7 +96,7 @@ public: /// Dump wrapped feature COLLECTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; /// Returns the internal values tables COLLECTIONAPI_EXPORT diff --git a/src/CollectionAPI/CollectionAPI_Group.cpp b/src/CollectionAPI/CollectionAPI_Group.cpp index e8639efaa..6e05b841b 100644 --- a/src/CollectionAPI/CollectionAPI_Group.cpp +++ b/src/CollectionAPI/CollectionAPI_Group.cpp @@ -43,7 +43,7 @@ CollectionAPI_Group::CollectionAPI_Group( } //================================================================================================== -CollectionAPI_Group::~CollectionAPI_Group() {} +CollectionAPI_Group::~CollectionAPI_Group() = default; //================================================================================================== void CollectionAPI_Group::setGroupList( diff --git a/src/CollectionAPI/CollectionAPI_Group.h b/src/CollectionAPI/CollectionAPI_Group.h index 6e685fe35..058df38f7 100644 --- a/src/CollectionAPI/CollectionAPI_Group.h +++ b/src/CollectionAPI/CollectionAPI_Group.h @@ -48,7 +48,7 @@ public: /// Destructor. COLLECTIONAPI_EXPORT - virtual ~CollectionAPI_Group(); + ~CollectionAPI_Group() override; INTERFACE_1(CollectionPlugin_Group::ID(), groupList, CollectionPlugin_Group::LIST_ID(), @@ -61,7 +61,7 @@ public: /// Dump wrapped feature COLLECTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Group object. diff --git a/src/CollectionAPI/CollectionAPI_GroupAddition.cpp b/src/CollectionAPI/CollectionAPI_GroupAddition.cpp index a104971d6..4f8cefaef 100644 --- a/src/CollectionAPI/CollectionAPI_GroupAddition.cpp +++ b/src/CollectionAPI/CollectionAPI_GroupAddition.cpp @@ -38,7 +38,7 @@ CollectionAPI_GroupAddition::CollectionAPI_GroupAddition( } } -CollectionAPI_GroupAddition::~CollectionAPI_GroupAddition() {} +CollectionAPI_GroupAddition::~CollectionAPI_GroupAddition() = default; void CollectionAPI_GroupAddition::setGroupList( const std::list &theGroupList) { diff --git a/src/CollectionAPI/CollectionAPI_GroupAddition.h b/src/CollectionAPI/CollectionAPI_GroupAddition.h index be237cc27..0a1cea958 100644 --- a/src/CollectionAPI/CollectionAPI_GroupAddition.h +++ b/src/CollectionAPI/CollectionAPI_GroupAddition.h @@ -49,7 +49,7 @@ public: /// Destructor. COLLECTIONAPI_EXPORT - virtual ~CollectionAPI_GroupAddition(); + ~CollectionAPI_GroupAddition() override; INTERFACE_1(CollectionPlugin_GroupAddition::ID(), groupList, CollectionPlugin_GroupAddition::LIST_ID(), @@ -62,7 +62,7 @@ public: /// Dump wrapped feature COLLECTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Group Addition object. diff --git a/src/CollectionAPI/CollectionAPI_GroupIntersection.cpp b/src/CollectionAPI/CollectionAPI_GroupIntersection.cpp index 712dbe87f..f864f313c 100644 --- a/src/CollectionAPI/CollectionAPI_GroupIntersection.cpp +++ b/src/CollectionAPI/CollectionAPI_GroupIntersection.cpp @@ -38,7 +38,7 @@ CollectionAPI_GroupIntersection::CollectionAPI_GroupIntersection( } } -CollectionAPI_GroupIntersection::~CollectionAPI_GroupIntersection() {} +CollectionAPI_GroupIntersection::~CollectionAPI_GroupIntersection() = default; void CollectionAPI_GroupIntersection::setGroupList( const std::list &theGroupList) { diff --git a/src/CollectionAPI/CollectionAPI_GroupIntersection.h b/src/CollectionAPI/CollectionAPI_GroupIntersection.h index fd74c86ba..ee3afde7f 100644 --- a/src/CollectionAPI/CollectionAPI_GroupIntersection.h +++ b/src/CollectionAPI/CollectionAPI_GroupIntersection.h @@ -49,7 +49,7 @@ public: /// Destructor. COLLECTIONAPI_EXPORT - virtual ~CollectionAPI_GroupIntersection(); + ~CollectionAPI_GroupIntersection() override; INTERFACE_1(CollectionPlugin_GroupIntersection::ID(), groupList, CollectionPlugin_GroupIntersection::LIST_ID(), @@ -62,7 +62,7 @@ public: /// Dump wrapped feature COLLECTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Group Addition object. diff --git a/src/CollectionAPI/CollectionAPI_GroupShape.cpp b/src/CollectionAPI/CollectionAPI_GroupShape.cpp index 337cc94b4..704877196 100644 --- a/src/CollectionAPI/CollectionAPI_GroupShape.cpp +++ b/src/CollectionAPI/CollectionAPI_GroupShape.cpp @@ -38,7 +38,7 @@ CollectionAPI_GroupShape::CollectionAPI_GroupShape( } } -CollectionAPI_GroupShape::~CollectionAPI_GroupShape() {} +CollectionAPI_GroupShape::~CollectionAPI_GroupShape() = default; void CollectionAPI_GroupShape::setGroupList( const std::list &theGroupList) { diff --git a/src/CollectionAPI/CollectionAPI_GroupShape.h b/src/CollectionAPI/CollectionAPI_GroupShape.h index 0a06e1f92..8e9da763d 100644 --- a/src/CollectionAPI/CollectionAPI_GroupShape.h +++ b/src/CollectionAPI/CollectionAPI_GroupShape.h @@ -49,7 +49,7 @@ public: /// Destructor. COLLECTIONAPI_EXPORT - virtual ~CollectionAPI_GroupShape(); + ~CollectionAPI_GroupShape() override; INTERFACE_1(CollectionPlugin_GroupShape::ID(), groupList, CollectionPlugin_GroupShape::LIST_ID(), @@ -62,7 +62,7 @@ public: /// Dump wrapped feature COLLECTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Group Shape object. diff --git a/src/CollectionAPI/CollectionAPI_GroupSubstraction.cpp b/src/CollectionAPI/CollectionAPI_GroupSubstraction.cpp index 8e78a3e7f..5c391c97d 100644 --- a/src/CollectionAPI/CollectionAPI_GroupSubstraction.cpp +++ b/src/CollectionAPI/CollectionAPI_GroupSubstraction.cpp @@ -40,7 +40,7 @@ CollectionAPI_GroupSubstraction::CollectionAPI_GroupSubstraction( } } -CollectionAPI_GroupSubstraction::~CollectionAPI_GroupSubstraction() {} +CollectionAPI_GroupSubstraction::~CollectionAPI_GroupSubstraction() = default; void CollectionAPI_GroupSubstraction::setObjectsList( const std::list &theGroupList) { diff --git a/src/CollectionAPI/CollectionAPI_GroupSubstraction.h b/src/CollectionAPI/CollectionAPI_GroupSubstraction.h index 1a6644e01..b3a482060 100644 --- a/src/CollectionAPI/CollectionAPI_GroupSubstraction.h +++ b/src/CollectionAPI/CollectionAPI_GroupSubstraction.h @@ -50,7 +50,7 @@ public: /// Destructor. COLLECTIONAPI_EXPORT - virtual ~CollectionAPI_GroupSubstraction(); + ~CollectionAPI_GroupSubstraction() override; INTERFACE_2(CollectionPlugin_GroupSubstraction::ID(), objectsList, CollectionPlugin_GroupSubstraction::LIST_ID(), @@ -69,7 +69,7 @@ public: /// Dump wrapped feature COLLECTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Group Addition object. diff --git a/src/CollectionPlugin/CollectionPlugin_Field.cpp b/src/CollectionPlugin/CollectionPlugin_Field.cpp index 46c7e31b2..9ff175c04 100644 --- a/src/CollectionPlugin/CollectionPlugin_Field.cpp +++ b/src/CollectionPlugin/CollectionPlugin_Field.cpp @@ -30,7 +30,7 @@ #include #include -CollectionPlugin_Field::CollectionPlugin_Field() {} +CollectionPlugin_Field::CollectionPlugin_Field() = default; void CollectionPlugin_Field::initAttributes() { data()->addAttribute(SELECTED_ID(), diff --git a/src/CollectionPlugin/CollectionPlugin_Field.h b/src/CollectionPlugin/CollectionPlugin_Field.h index 342e35d33..cdff5ff7f 100644 --- a/src/CollectionPlugin/CollectionPlugin_Field.h +++ b/src/CollectionPlugin/CollectionPlugin_Field.h @@ -72,20 +72,20 @@ public: } /// Returns the kind of a feature - COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() { + COLLECTIONPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = CollectionPlugin_Field::ID(); return MY_KIND; } /// Creates a new field result if needed - COLLECTIONPLUGIN_EXPORT virtual void execute(); + COLLECTIONPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - COLLECTIONPLUGIN_EXPORT virtual void initAttributes(); + COLLECTIONPLUGIN_EXPORT void initAttributes() override; /// Result of fields is created on the fly and don't stored to the document - COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() { return false; } + COLLECTIONPLUGIN_EXPORT bool isPersistentResult() override { return false; } /// Use plugin manager for features creation CollectionPlugin_Field(); diff --git a/src/CollectionPlugin/CollectionPlugin_Group.cpp b/src/CollectionPlugin/CollectionPlugin_Group.cpp index 451371c81..eaf5b479f 100644 --- a/src/CollectionPlugin/CollectionPlugin_Group.cpp +++ b/src/CollectionPlugin/CollectionPlugin_Group.cpp @@ -30,7 +30,7 @@ #include #include -CollectionPlugin_Group::CollectionPlugin_Group() {} +CollectionPlugin_Group::CollectionPlugin_Group() = default; void CollectionPlugin_Group::initAttributes() { AttributeSelectionListPtr aList = @@ -83,15 +83,14 @@ bool CollectionPlugin_Group::customAction(const std::string &theActionId) { // collect all existing names of features to give unique names std::set aFeatNames, aResNames; std::list allFeat = aDoc->allFeatures(); - std::list::iterator allFeatIter = allFeat.begin(); + auto allFeatIter = allFeat.begin(); for (; allFeatIter != allFeat.end(); allFeatIter++) { FeaturePtr aFeat = *allFeatIter; if (aFeat->data().get() && aFeat->data()->isValid()) { aFeatNames.insert(aFeat->name()); if (aFeat->getKind() == ID() && aFeat->data().get() && aFeat->data()->isValid()) { - std::list::const_iterator aRess = - aFeat->results().cbegin(); + auto aRess = aFeat->results().cbegin(); for (; aRess != aFeat->results().cend(); aRess++) { ResultPtr aRes = *aRess; if (aRes->data().get() && aRes->data()->isValid()) { @@ -183,7 +182,7 @@ bool CollectionPlugin_Group::customAction(const std::string &theActionId) { aNew = aDoc->addFeature(ID(), false); aResults.push_front(aNew); // to keep the order } else { // appending in already created new result - std::list::reverse_iterator aResIter = aResults.rbegin(); + auto aResIter = aResults.rbegin(); for (; aFGroup > 1; aResIter++) aFGroup--; aNew = *aResIter; @@ -199,7 +198,7 @@ bool CollectionPlugin_Group::customAction(const std::string &theActionId) { aList->remove(aRemoved); // set names if (aResults.size() > 1) { // rename if there are new groups appeared only - std::list::iterator aResIter = aResults.begin(); + auto aResIter = aResults.begin(); for (int aSuffix = 1; aResIter != aResults.end(); aResIter++) { FeaturePtr aFeat = std::dynamic_pointer_cast(*aResIter); @@ -218,7 +217,7 @@ bool CollectionPlugin_Group::customAction(const std::string &theActionId) { FiltersFeaturePtr aFilters = aList->filters(); if (aFilters.get()) { std::list aFiltersList = aFilters->filters(); - std::list::iterator aFilterName = aFiltersList.begin(); + auto aFilterName = aFiltersList.begin(); for (; aFilterName != aFiltersList.end(); aFilterName++) { aFilters->removeFilter(*aFilterName); } diff --git a/src/CollectionPlugin/CollectionPlugin_GroupAddition.h b/src/CollectionPlugin/CollectionPlugin_GroupAddition.h index 300db8d06..5d6231573 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupAddition.h +++ b/src/CollectionPlugin/CollectionPlugin_GroupAddition.h @@ -38,13 +38,13 @@ public: } /// Returns the kind of a feature - COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() { + COLLECTIONPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = CollectionPlugin_GroupAddition::ID(); return MY_KIND; } /// Creates a new group result if needed - COLLECTIONPLUGIN_EXPORT void execute(); + COLLECTIONPLUGIN_EXPORT void execute() override; /// Use plugin manager for features creation CollectionPlugin_GroupAddition() = default; diff --git a/src/CollectionPlugin/CollectionPlugin_GroupMerge.cpp b/src/CollectionPlugin/CollectionPlugin_GroupMerge.cpp index 8be380abe..ebf0dcc42 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupMerge.cpp +++ b/src/CollectionPlugin/CollectionPlugin_GroupMerge.cpp @@ -46,16 +46,16 @@ static void explodeCompound(const GeomShapePtr &theCompound, } static void keepUniqueShapes(ListOfShape &theShapes) { - ListOfShape::iterator anIt = theShapes.begin(); + auto anIt = theShapes.begin(); while (anIt != theShapes.end()) { GeomShapePtr aCurrent = *anIt; - ListOfShape::iterator anIt2 = theShapes.begin(); + auto anIt2 = theShapes.begin(); for (; anIt2 != anIt; ++anIt2) if (aCurrent->isEqual(*anIt2)) break; if (anIt2 != anIt) { // the same shape is found - ListOfShape::iterator aRemoveIt = anIt++; + auto aRemoveIt = anIt++; theShapes.erase(aRemoveIt); } else ++anIt; diff --git a/src/CollectionPlugin/CollectionPlugin_GroupMerge.h b/src/CollectionPlugin/CollectionPlugin_GroupMerge.h index 799a51595..0afbf15e5 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupMerge.h +++ b/src/CollectionPlugin/CollectionPlugin_GroupMerge.h @@ -43,7 +43,7 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes - COLLECTIONPLUGIN_EXPORT virtual void initAttributes(); + COLLECTIONPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation CollectionPlugin_GroupMerge() = default; diff --git a/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp b/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp index 7f152f499..a4ab7a747 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp +++ b/src/CollectionPlugin/CollectionPlugin_GroupShape.cpp @@ -28,7 +28,7 @@ void CollectionPlugin_GroupShape::execute() { CollectionPlugin_GroupMerge::execute(aGroup); GeomShapePtr aCompound = aGroup->shape(); - const TopoDS_Shape &aShape = aCompound->impl(); + const auto &aShape = aCompound->impl(); if (aShape.NbChildren() == 1) { /// unique shape, remove compound on type diff --git a/src/CollectionPlugin/CollectionPlugin_GroupShape.h b/src/CollectionPlugin/CollectionPlugin_GroupShape.h index 5a7c92b93..1b5cbbe1d 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupShape.h +++ b/src/CollectionPlugin/CollectionPlugin_GroupShape.h @@ -38,13 +38,13 @@ public: } /// Returns the kind of a feature - COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() { + COLLECTIONPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = CollectionPlugin_GroupShape::ID(); return MY_KIND; } /// Creates a new group result if needed - COLLECTIONPLUGIN_EXPORT void execute(); + COLLECTIONPLUGIN_EXPORT void execute() override; /// Use plugin manager for features creation CollectionPlugin_GroupShape() = default; diff --git a/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.cpp b/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.cpp index c3af3434f..749c9cac6 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.cpp +++ b/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.cpp @@ -33,7 +33,8 @@ typedef std::set SetOfShape; -CollectionPlugin_GroupSubstraction::CollectionPlugin_GroupSubstraction() {} +CollectionPlugin_GroupSubstraction::CollectionPlugin_GroupSubstraction() = + default; void CollectionPlugin_GroupSubstraction::initAttributes() { data()->addAttribute(CollectionPlugin_GroupSubstraction::LIST_ID(), @@ -56,7 +57,7 @@ static void subtractLists(const GeomShapePtr &theCompound, if (theExclude.find(aCurrent) != theExclude.end()) continue; // shape has to be excluded // check the shape is already in the list - ListOfShape::iterator anIt2 = theResult.begin(); + auto anIt2 = theResult.begin(); for (; anIt2 != theResult.end(); ++anIt2) if (aCurrent->isEqual(*anIt2)) break; diff --git a/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.h b/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.h index 9c6c00b60..2ef214c3c 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.h +++ b/src/CollectionPlugin/CollectionPlugin_GroupSubstraction.h @@ -49,17 +49,17 @@ public: } /// Returns the kind of a feature - COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() { + COLLECTIONPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = CollectionPlugin_GroupSubstraction::ID(); return MY_KIND; } /// Creates a new group result if needed - COLLECTIONPLUGIN_EXPORT virtual void execute(); + COLLECTIONPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - COLLECTIONPLUGIN_EXPORT virtual void initAttributes(); + COLLECTIONPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation CollectionPlugin_GroupSubstraction(); diff --git a/src/CollectionPlugin/CollectionPlugin_Plugin.h b/src/CollectionPlugin/CollectionPlugin_Plugin.h index 11d093cdc..f00dfc930 100644 --- a/src/CollectionPlugin/CollectionPlugin_Plugin.h +++ b/src/CollectionPlugin/CollectionPlugin_Plugin.h @@ -32,7 +32,7 @@ class COLLECTIONPLUGIN_EXPORT CollectionPlugin_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - virtual FeaturePtr createFeature(std::string theFeatureID); + FeaturePtr createFeature(std::string theFeatureID) override; public: /// Default constructor diff --git a/src/CollectionPlugin/CollectionPlugin_Validators.cpp b/src/CollectionPlugin/CollectionPlugin_Validators.cpp index 4114bdb5c..eb5c25ff5 100644 --- a/src/CollectionPlugin/CollectionPlugin_Validators.cpp +++ b/src/CollectionPlugin/CollectionPlugin_Validators.cpp @@ -91,7 +91,7 @@ bool CollectionPlugin_GroupOperationAttributeValidator::isValid( return false; } // check types of all selection lists are the same - for (std::list::const_iterator aParIt = theArguments.begin(); + for (auto aParIt = theArguments.begin(); aParIt != theArguments.end() && !aType.empty(); ++aParIt) { AttributeSelectionListPtr aCurList = anOwner->selectionList(*aParIt); if (aCurList->size() == 0) diff --git a/src/CollectionPlugin/CollectionPlugin_Validators.h b/src/CollectionPlugin/CollectionPlugin_Validators.h index 5f252021f..eb1dd4775 100644 --- a/src/CollectionPlugin/CollectionPlugin_Validators.h +++ b/src/CollectionPlugin/CollectionPlugin_Validators.h @@ -35,9 +35,9 @@ public: //! \param theFeature the checked feature //! \param theArguments arguments of the feature (not used) //! \param theError error message - virtual bool isValid(const FeaturePtr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const FeaturePtr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class CollectionPlugin_GroupOperationAttributeValidator @@ -50,9 +50,9 @@ class CollectionPlugin_GroupOperationAttributeValidator //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class CollectionPlugin_GroupSelectionValidator @@ -65,9 +65,9 @@ class CollectionPlugin_GroupSelectionValidator //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute (not used). //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetCreator.cpp b/src/CollectionPlugin/CollectionPlugin_WidgetCreator.cpp index 18905621d..088924ab2 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetCreator.cpp +++ b/src/CollectionPlugin/CollectionPlugin_WidgetCreator.cpp @@ -34,7 +34,7 @@ void CollectionPlugin_WidgetCreator::widgetTypes( ModuleBase_ModelWidget *CollectionPlugin_WidgetCreator::createWidgetByType( const std::string &theType, QWidget *theParent, Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop *theWorkshop) { - ModuleBase_ModelWidget *aWidget = 0; + ModuleBase_ModelWidget *aWidget = nullptr; if (myPanelTypes.find(theType) == myPanelTypes.end()) return aWidget; diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetCreator.h b/src/CollectionPlugin/CollectionPlugin_WidgetCreator.h index 3706652d2..dc65763a8 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetCreator.h +++ b/src/CollectionPlugin/CollectionPlugin_WidgetCreator.h @@ -39,11 +39,11 @@ public: CollectionPlugin_WidgetCreator(); /// Virtual destructor - ~CollectionPlugin_WidgetCreator() {} + ~CollectionPlugin_WidgetCreator() = default; /// Returns a container of possible page types, which this creator can process /// \param theTypes a list of type names - virtual void widgetTypes(std::set &theTypes); + void widgetTypes(std::set &theTypes) override; /// Create widget by its type /// The default implementation is empty @@ -52,10 +52,10 @@ public: /// \param theData a low-level API for reading xml definitions of widgets /// \param theWorkshop a current workshop /// \return a created model widget or null - virtual ModuleBase_ModelWidget * + ModuleBase_ModelWidget * createWidgetByType(const std::string &theType, QWidget *theParent, Config_WidgetAPI *theWidgetApi, - ModuleBase_IWorkshop * /*theWorkshop*/); + ModuleBase_IWorkshop * /*theWorkshop*/) override; private: std::set myPanelTypes; ///< types of panels diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp b/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp index e9fa02049..050f71d1d 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp +++ b/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp @@ -62,15 +62,15 @@ QWidget * DataTableItemDelegate::createEditor(QWidget *theParent, const QStyleOptionViewItem &theOption, const QModelIndex &theIndex) const { - QWidget *aEditor = 0; + QWidget *aEditor = nullptr; if ((theIndex.column() == 0) && (theIndex.row() > 0)) { QWidget *aWgt = QStyledItemDelegate::createEditor(theParent, theOption, theIndex); - QLineEdit *aEdt = static_cast(aWgt); + auto *aEdt = static_cast(aWgt); aEdt->setReadOnly(true); aEditor = aEdt; } else { - QLineEdit *aLineEdt = 0; + QLineEdit *aLineEdt = nullptr; switch (myType) { case ModelAPI_AttributeTables::DOUBLE: aLineEdt = dynamic_cast( @@ -89,7 +89,7 @@ DataTableItemDelegate::createEditor(QWidget *theParent, } break; case ModelAPI_AttributeTables::BOOLEAN: { - QComboBox *aBox = new QComboBox(theParent); + auto *aBox = new QComboBox(theParent); aBox->addItem(MYFalse); aBox->addItem(MYTrue); aEditor = aBox; @@ -108,8 +108,8 @@ DataTableItemDelegate::createEditor(QWidget *theParent, return aEditor; } -void DataTableItemDelegate::onEditItem(const QString &theText) { - QWidget *aWgt = dynamic_cast(sender()); +void DataTableItemDelegate::onEditItem(const QString & /*theText*/) { + auto *aWgt = dynamic_cast(sender()); commitData(aWgt); } @@ -120,12 +120,12 @@ CollectionPlugin_WidgetField::CollectionPlugin_WidgetField( QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData) : ModuleBase_WidgetSelector(theParent, theWorkshop, theData), - myHeaderEditor(0), myIsTabEdit(false), myActivation(false) { - QVBoxLayout *aMainLayout = new QVBoxLayout(this); + myHeaderEditor(nullptr), myIsTabEdit(false), myActivation(false) { + auto *aMainLayout = new QVBoxLayout(this); // Types definition controls - QWidget *aTypesWgt = new QWidget(this); - QFormLayout *aTypesLayout = new QFormLayout(aTypesWgt); + auto *aTypesWgt = new QWidget(this); + auto *aTypesLayout = new QFormLayout(aTypesWgt); aTypesLayout->setContentsMargins(0, 0, 0, 0); aMainLayout->addWidget(aTypesWgt); @@ -151,10 +151,10 @@ CollectionPlugin_WidgetField::CollectionPlugin_WidgetField( aTypesLayout->addRow(tr("Nb. of components"), myNbComponentsSpn); // Steps controls - QFrame *aStepFrame = new QFrame(this); + auto *aStepFrame = new QFrame(this); aStepFrame->setFrameShape(QFrame::Box); aStepFrame->setFrameStyle(QFrame::StyledPanel); - QGridLayout *aStepLayout = new QGridLayout(aStepFrame); + auto *aStepLayout = new QGridLayout(aStepFrame); aMainLayout->addWidget(aStepFrame); // Current step label @@ -166,9 +166,9 @@ CollectionPlugin_WidgetField::CollectionPlugin_WidgetField( aStepLayout->addWidget(myCurStepLbl, 0, 1); // Steps slider - QWidget *aSliderWidget = new QWidget(aStepFrame); + auto *aSliderWidget = new QWidget(aStepFrame); aStepLayout->addWidget(aSliderWidget, 1, 0, 1, 2); - QHBoxLayout *aSliderLayout = new QHBoxLayout(aSliderWidget); + auto *aSliderLayout = new QHBoxLayout(aSliderWidget); aSliderLayout->setContentsMargins(0, 0, 0, 0); aSliderLayout->addWidget(new QLabel("1", aSliderWidget)); @@ -193,12 +193,12 @@ CollectionPlugin_WidgetField::CollectionPlugin_WidgetField( appendStepControls(); // Buttons below - QWidget *aBtnWgt = new QWidget(this); + auto *aBtnWgt = new QWidget(this); aMainLayout->addWidget(aBtnWgt); - QHBoxLayout *aBtnLayout = new QHBoxLayout(aBtnWgt); + auto *aBtnLayout = new QHBoxLayout(aBtnWgt); aBtnLayout->setContentsMargins(0, 0, 0, 0); - QPushButton *aAddBtn = new QPushButton(tr("Add step"), aBtnWgt); + auto *aAddBtn = new QPushButton(tr("Add step"), aBtnWgt); aBtnLayout->addWidget(aAddBtn); aBtnLayout->addStretch(1); @@ -224,20 +224,19 @@ CollectionPlugin_WidgetField::CollectionPlugin_WidgetField( //********************************************************************************** void CollectionPlugin_WidgetField::appendStepControls() { - QWidget *aWidget = new QWidget(myStepWgt); - QGridLayout *aStepLayout = new QGridLayout(aWidget); + auto *aWidget = new QWidget(myStepWgt); + auto *aStepLayout = new QGridLayout(aWidget); aStepLayout->setContentsMargins(0, 0, 0, 0); aStepLayout->addWidget(new QLabel(tr("Stamp"), aWidget), 0, 0); - QSpinBox *aStampSpn = new QSpinBox(aWidget); + auto *aStampSpn = new QSpinBox(aWidget); aStepLayout->addWidget(aStampSpn, 0, 1); myStampSpnList.append(aStampSpn); // Data table - QTableWidget *aDataTbl = - new QTableWidget(1, myCompNamesList.count() + 1, aWidget); + auto *aDataTbl = new QTableWidget(1, myCompNamesList.count() + 1, aWidget); aDataTbl->installEventFilter(this); aDataTbl->setItemDelegate(myDelegate); @@ -258,7 +257,7 @@ void CollectionPlugin_WidgetField::appendStepControls() { updateHeaders(aDataTbl); - QTableWidgetItem *aItem = new QTableWidgetItem("Default value"); + auto *aItem = new QTableWidgetItem("Default value"); aItem->setBackgroundColor(Qt::lightGray); aItem->setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled); aDataTbl->setItem(0, 0, aItem); @@ -301,7 +300,7 @@ void CollectionPlugin_WidgetField::deactivate() { //********************************************************************************** bool CollectionPlugin_WidgetField::eventFilter(QObject *theObject, QEvent *theEvent) { - QObject *aObject = 0; + QObject *aObject = nullptr; foreach (QTableWidget *aTable, myDataTblList) { if (aTable->horizontalHeader()->viewport() == theObject) { aObject = theObject; @@ -312,12 +311,11 @@ bool CollectionPlugin_WidgetField::eventFilter(QObject *theObject, if (theEvent->type() == QEvent::MouseButtonDblClick) { if (myHeaderEditor) { // delete previous editor myHeaderEditor->deleteLater(); - myHeaderEditor = 0; + myHeaderEditor = nullptr; } - QMouseEvent *aMouseEvent = static_cast(theEvent); - QHeaderView *aHeader = static_cast(aObject->parent()); - QTableWidget *aTable = - static_cast(aHeader->parentWidget()); + auto *aMouseEvent = static_cast(theEvent); + auto *aHeader = static_cast(aObject->parent()); + auto *aTable = static_cast(aHeader->parentWidget()); int aShift = aTable->horizontalScrollBar()->value(); int aPos = aMouseEvent->x(); @@ -355,7 +353,7 @@ bool CollectionPlugin_WidgetField::eventFilter(QObject *theObject, // save item text myCompNamesList.replace(myEditIndex - 1, aNewTitle); myHeaderEditor->deleteLater(); // safely delete editor - myHeaderEditor = 0; + myHeaderEditor = nullptr; // Store into data model AttributeStringArrayPtr aStringsAttr = myFeature->data()->stringArray( CollectionPlugin_Field::COMPONENTS_NAMES_ID()); @@ -364,7 +362,7 @@ bool CollectionPlugin_WidgetField::eventFilter(QObject *theObject, updateHeaders(aTable); } } else if (theEvent->type() == QEvent::FocusIn) { - QTableWidget *aTable = dynamic_cast(theObject); + auto *aTable = dynamic_cast(theObject); if (aTable) { ModuleBase_IPropertyPanel *aPanel = myWorkshop->propertyPanel(); if (aPanel->activeWidget() != this) { @@ -378,7 +376,7 @@ bool CollectionPlugin_WidgetField::eventFilter(QObject *theObject, //********************************************************************************** QTableWidgetItem *CollectionPlugin_WidgetField::createDefaultItem() const { - QTableWidgetItem *aItem = new QTableWidgetItem(); + auto *aItem = new QTableWidgetItem(); switch (myFieldTypeCombo->currentIndex()) { case ModelAPI_AttributeTables::DOUBLE: case ModelAPI_AttributeTables::INTEGER: @@ -397,7 +395,7 @@ QTableWidgetItem *CollectionPlugin_WidgetField::createDefaultItem() const { //********************************************************************************** QTableWidgetItem *CollectionPlugin_WidgetField::createValueItem( ModelAPI_AttributeTables::Value &theVal) const { - QTableWidgetItem *aItem = new QTableWidgetItem(); + auto *aItem = new QTableWidgetItem(); aItem->setText(getValueText(theVal)); return aItem; } @@ -561,7 +559,7 @@ bool CollectionPlugin_WidgetField::restoreValueCustom() { for (int i = 0; i < aFirstTable->columnCount(); i++) aColWidth.append(aFirstTable->columnWidth(i)); - QTableWidgetItem *aItem = 0; + QTableWidgetItem *aItem = nullptr; for (int i = 0; i < aNbSteps; i++) { myStampSpnList.at(i)->setValue(aStampsAttr->value(i)); QTableWidget *aTable = myDataTblList.at(i); @@ -698,7 +696,7 @@ void CollectionPlugin_WidgetField::onNbCompChanged(int theVal) { int aOldCol = myCompNamesList.count(); int aNbRows = myDataTblList.first()->rowCount(); int aDif = theVal - aOldCol; - QTableWidgetItem *aItem = 0; + QTableWidgetItem *aItem = nullptr; while (myCompNamesList.count() != theVal) { if (aDif > 0) @@ -756,7 +754,7 @@ void CollectionPlugin_WidgetField::onAddStep() { int aRows = aSelNb + 1; QTableWidget *aTable = myDataTblList.last(); aTable->setRowCount(aRows); - QTableWidgetItem *aItem = 0; + QTableWidgetItem *aItem = nullptr; for (int i = 0; i < aColumns; i++) { if (i == 0) { for (int j = 1; j < aRows; j++) { @@ -814,7 +812,7 @@ void CollectionPlugin_WidgetField::onStepMove(int theStep) { //********************************************************************************** bool CollectionPlugin_WidgetField::isValidSelectionCustom( - const std::shared_ptr &thePrs) { + const std::shared_ptr & /*thePrs*/) { return (myShapeTypeCombo->currentIndex() == 5) ? false : true; } @@ -869,7 +867,7 @@ bool CollectionPlugin_WidgetField::setSelection( myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID()); aTablesAttr->setSize(aNewRows, aColumns - 1, myDataTblList.size()); - QTableWidgetItem *aItem = 0; + QTableWidgetItem *aItem = nullptr; foreach (QTableWidget *aTable, myDataTblList) { aTable->setRowCount(aNewRows); if (aNewRows > aRows) { @@ -948,7 +946,7 @@ void CollectionPlugin_WidgetField::onTableEdited(int theRow, int theCol) { return; if (!myFeature.get()) return; - QTableWidget *aTable = static_cast(sender()); + auto *aTable = static_cast(sender()); int aNb = myDataTblList.indexOf(aTable); if (aNb == -1) return; @@ -1007,20 +1005,20 @@ bool CollectionPlugin_WidgetField::processEnter() { } //********************************************************************************** -void CollectionPlugin_WidgetField::onFocusChanged(QWidget *theOld, +void CollectionPlugin_WidgetField::onFocusChanged(QWidget * /*theOld*/, QWidget *theNew) { if (theNew && (!myIsTabEdit)) myIsTabEdit = dynamic_cast(theNew); } //********************************************************************************** -void CollectionPlugin_WidgetField::onRangeChanged(int theMin, int theMax) { +void CollectionPlugin_WidgetField::onRangeChanged(int /*theMin*/, int theMax) { myMaxLbl->setText(QString::number(theMax)); myRemoveBtn->setEnabled(theMax > 1); } //********************************************************************************** -void CollectionPlugin_WidgetField::onColumnResize(int theIndex, int theOld, +void CollectionPlugin_WidgetField::onColumnResize(int theIndex, int /*theOld*/, int theNew) { if (myDataTblList.count() < 2) return; @@ -1044,7 +1042,7 @@ CollectionPlugin_WidgetField::getAttributeSelection() const { for (int i = 0; i < aSelList->size(); i++) { aAttr = aSelList->value(i); ModuleBase_ViewerPrsPtr aPrs( - new ModuleBase_ViewerPrs(aAttr->context(), aAttr->value(), NULL)); + new ModuleBase_ViewerPrs(aAttr->context(), aAttr->value(), nullptr)); aList.append(aPrs); } } diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetField.h b/src/CollectionPlugin/CollectionPlugin_WidgetField.h index eddb85aa9..f7b954f8c 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetField.h +++ b/src/CollectionPlugin/CollectionPlugin_WidgetField.h @@ -47,9 +47,9 @@ class DataTableItemDelegate : public QStyledItemDelegate { public: DataTableItemDelegate(ModelAPI_AttributeTables::ValueType theType); - virtual QWidget *createEditor(QWidget *theParent, - const QStyleOptionViewItem &theOption, - const QModelIndex &theIndex) const; + QWidget *createEditor(QWidget *theParent, + const QStyleOptionViewItem &theOption, + const QModelIndex &theIndex) const override; ModelAPI_AttributeTables::ValueType dataType() const { return myType; } @@ -76,56 +76,55 @@ public: ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); - virtual ~CollectionPlugin_WidgetField() {} + ~CollectionPlugin_WidgetField() override = default; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// Checks the widget validity. By default, it returns true. /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool - isValidSelectionCustom(const std::shared_ptr &theValue); + bool isValidSelectionCustom( + const std::shared_ptr &theValue) override; /// Returns true if the event is processed. - virtual bool processEnter(); + bool processEnter() override; /// The methiod called when widget is deactivated - virtual void deactivate(); + void deactivate() override; /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs /// \param theValues the wrapped selection values /// \param theToValidate a validation of the values flag - virtual bool - setSelection(QList> &theValues, - const bool theToValidate); + bool setSelection(QList> &theValues, + const bool theToValidate) override; protected: /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Restore value from attribute data to the widget's control - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// Retunrs a list of possible shape types /// \return a list of shapes - virtual QIntList shapeTypes() const; + QIntList shapeTypes() const override; /// Redefinition of virtual function /// \param theObject an object for the event /// \param theEvent an event - virtual bool eventFilter(QObject *theObject, QEvent *theEvent); + bool eventFilter(QObject *theObject, QEvent *theEvent) override; // virtual void showEvent(QShowEvent* theEvent); /// Return the attribute values wrapped in a list of viewer presentations /// \return a list of viewer presentations, which contains an attribute result /// and a shape. If the attribute do not uses the shape, it is empty - virtual QList> - getAttributeSelection() const; + QList> + getAttributeSelection() const override; private slots: /// Slot called on number of component changed diff --git a/src/Config/Config_AttributeMessage.cpp b/src/Config/Config_AttributeMessage.cpp index b163e079c..5ecd8e8a6 100644 --- a/src/Config/Config_AttributeMessage.cpp +++ b/src/Config/Config_AttributeMessage.cpp @@ -30,7 +30,7 @@ Config_AttributeMessage::Config_AttributeMessage(const Events_ID theId, myIsGeometricalSelection = false; } -Config_AttributeMessage::~Config_AttributeMessage() {} +Config_AttributeMessage::~Config_AttributeMessage() = default; const std::string &Config_AttributeMessage::featureId() const { return myFeatureId; diff --git a/src/Config/Config_AttributeMessage.h b/src/Config/Config_AttributeMessage.h index 4131a4d4a..bc74f9b6a 100644 --- a/src/Config/Config_AttributeMessage.h +++ b/src/Config/Config_AttributeMessage.h @@ -54,9 +54,9 @@ public: /// Constructor CONFIG_EXPORT Config_AttributeMessage(const Events_ID theId, - const void *theParent = 0); + const void *theParent = nullptr); /// Destructor - CONFIG_EXPORT virtual ~Config_AttributeMessage(); + CONFIG_EXPORT ~Config_AttributeMessage() override; // Auto-generated getters/setters /// Returns attribute's unique id diff --git a/src/Config/Config_DataModelReader.cpp b/src/Config/Config_DataModelReader.cpp index e8e5d807c..81d8ad0b1 100644 --- a/src/Config/Config_DataModelReader.cpp +++ b/src/Config/Config_DataModelReader.cpp @@ -29,10 +29,9 @@ // used only for GUI xml data reading // LCOV_EXCL_START Config_DataModelReader::Config_DataModelReader() - : Config_XMLReader(DATAMODEL_FILE), isRootReading(true), - myIsResultLink(false) {} + : Config_XMLReader(DATAMODEL_FILE) {} -Config_DataModelReader::~Config_DataModelReader() {} +Config_DataModelReader::~Config_DataModelReader() = default; void Config_DataModelReader::processNode(xmlNodePtr theNode) { if (isNode(theNode, NODE_FOLDER, NULL)) { diff --git a/src/Config/Config_DataModelReader.h b/src/Config/Config_DataModelReader.h index 9298e34c8..4d5e08bb8 100644 --- a/src/Config/Config_DataModelReader.h +++ b/src/Config/Config_DataModelReader.h @@ -39,7 +39,7 @@ public: * Constructor */ CONFIG_EXPORT Config_DataModelReader(); - CONFIG_EXPORT virtual ~Config_DataModelReader(); + CONFIG_EXPORT ~Config_DataModelReader() override; // ROOT folders propertiues ***************** /// Returns name of type of tree items in root @@ -131,10 +131,10 @@ public: protected: /// Overloaded method. Defines how to process each node - virtual void processNode(xmlNodePtr theNode); + void processNode(xmlNodePtr theNode) override; private: - bool isRootReading; + bool isRootReading{true}; /// Root document data std::vector myRootFolderNames; @@ -152,7 +152,7 @@ private: std::vector mySubFeaturesList; std::vector mySubFolderShowEmpty; - bool myIsResultLink; + bool myIsResultLink{false}; std::string mySubTypes; }; diff --git a/src/Config/Config_FeatureMessage.cpp b/src/Config/Config_FeatureMessage.cpp index af52224c1..259f84f16 100644 --- a/src/Config/Config_FeatureMessage.cpp +++ b/src/Config/Config_FeatureMessage.cpp @@ -45,7 +45,7 @@ Config_FeatureMessage::Config_FeatureMessage(const Events_ID theId, myAbortConfirmation = true; } -Config_FeatureMessage::~Config_FeatureMessage() {} +Config_FeatureMessage::~Config_FeatureMessage() = default; const std::string &Config_FeatureMessage::icon() const { return myIcon; } diff --git a/src/Config/Config_FeatureReader.cpp b/src/Config/Config_FeatureReader.cpp index 7d30db913..4d931e412 100644 --- a/src/Config/Config_FeatureReader.cpp +++ b/src/Config/Config_FeatureReader.cpp @@ -47,9 +47,9 @@ Config_FeatureReader::Config_FeatureReader(const std::string &theXmlFile, myLibraryDocSection(theDocSection), myEventGenerated(theEventGenerated ? theEventGenerated : Config_FeatureMessage::GUI_EVENT()), - myIsProcessWidgets(theEventGenerated != NULL) {} + myIsProcessWidgets(theEventGenerated != nullptr) {} -Config_FeatureReader::~Config_FeatureReader() {} +Config_FeatureReader::~Config_FeatureReader() = default; std::list Config_FeatureReader::features() const { return myFeatures; @@ -100,7 +100,7 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode) { std::string aCaseNodeID = getProperty(aCaseNode, _ID); std::string aSwitchNodeID = ""; const xmlChar *aName = aCaseNode->name; - xmlNodePtr aSwitchNode = 0; + xmlNodePtr aSwitchNode = nullptr; if (!xmlStrcmp(aName, (const xmlChar *)WDG_SWITCH_CASE)) { aSwitchNode = hasParentRecursive(aCaseNode, WDG_SWITCH, NULL); } else if (!xmlStrcmp(aName, (const xmlChar *)WDG_TOOLBOX_BOX)) { diff --git a/src/Config/Config_FeatureReader.h b/src/Config/Config_FeatureReader.h index c72283a40..4e16d6f1d 100644 --- a/src/Config/Config_FeatureReader.h +++ b/src/Config/Config_FeatureReader.h @@ -41,20 +41,20 @@ public: Config_FeatureReader(const std::string &theXmlFile, const std::string &theLibraryName, const std::string &theDocSection = std::string(), - const char *theEventGenerated = 0); - virtual ~Config_FeatureReader(); + const char *theEventGenerated = nullptr); + ~Config_FeatureReader() override; /// Returns list of all features defined in reader's file std::list features() const; protected: /// Overloaded method. Defines how to process each node - virtual void processNode(xmlNodePtr aNode); + void processNode(xmlNodePtr aNode) override; /// Overloaded method. Clears attribute cache on exit from attribute's node - virtual void cleanup(xmlNodePtr aNode); + void cleanup(xmlNodePtr aNode) override; /// Overloaded method. Defines if the given node should be parsed recursively - virtual bool processChildren(xmlNodePtr aNode); + bool processChildren(xmlNodePtr aNode) override; /// Fills feature message void diff --git a/src/Config/Config_ModuleReader.cpp b/src/Config/Config_ModuleReader.cpp index 0b81a8e85..090865f68 100644 --- a/src/Config/Config_ModuleReader.cpp +++ b/src/Config/Config_ModuleReader.cpp @@ -52,7 +52,7 @@ std::set Config_ModuleReader::myDependencyModules; Config_ModuleReader::Config_ModuleReader(const char *theEventGenerated) : Config_XMLReader(PLUGIN_FILE), myEventGenerated(theEventGenerated) {} -Config_ModuleReader::~Config_ModuleReader() {} +Config_ModuleReader::~Config_ModuleReader() = default; const std::map & Config_ModuleReader::featuresInFiles() const { @@ -147,7 +147,7 @@ void Config_ModuleReader::processNode(xmlNodePtr theNode) { std::list aFeatures = importPlugin(aPluginName, aPluginConf, aPluginDocSection); - std::list::iterator it = aFeatures.begin(); + auto it = aFeatures.begin(); for (; it != aFeatures.end(); it++) { if (isLicensed) addFeatureRequireLicense(*it, aPluginConf); @@ -166,7 +166,7 @@ bool Config_ModuleReader::hasRequiredModules(xmlNodePtr theNode) const { normalize(getProperty(theNode, PLUGIN_DEPENDENCY)); if (aRequiredModule.empty()) return true; - std::set::iterator it = myDependencyModules.begin(); + auto it = myDependencyModules.begin(); for (; it != myDependencyModules.end(); it++) { if (*it == aRequiredModule) return true; @@ -248,7 +248,7 @@ static void PyStdOut_dealloc(PyStdOut *self) { PyObject_Del(self); } static PyObject *PyStdOut_write(PyStdOut *self, PyObject *args) { char *c; if (!PyArg_ParseTuple(args, "s", &c)) - return NULL; + return nullptr; *(self->out) = *(self->out) + c; @@ -259,19 +259,19 @@ static PyObject *PyStdOut_write(PyStdOut *self, PyObject *args) { static PyMethodDef PyStdOut_methods[] = { {"write", (PyCFunction)PyStdOut_write, METH_VARARGS, PyDoc_STR("write(string) -> None")}, - {0, 0, 0, 0} /* sentinel */ + {nullptr, nullptr, 0, nullptr} /* sentinel */ }; static PyMemberDef PyStdOut_memberlist[] = { {(char *)"softspace", T_INT, offsetof(PyStdOut, softspace), 0, (char *)"flag indicating that a space needs to be printed; used by print"}, - {0, 0, 0, 0, 0} /* sentinel */ + {nullptr, 0, 0, 0, nullptr} /* sentinel */ }; static PyTypeObject PyStdOut_Type = { /* The ob_type field must be initialized in the module init function * to be portable to Windows without using C++. */ - PyVarObject_HEAD_INIT(NULL, 0) + PyVarObject_HEAD_INIT(nullptr, 0) /* 0, */ /*ob_size*/ "PyOut", /*tp_name*/ sizeof(PyStdOut), /*tp_basicsize*/ @@ -279,49 +279,49 @@ static PyTypeObject PyStdOut_Type = { /* methods */ (destructor)PyStdOut_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ + nullptr, /*tp_getattr*/ + nullptr, /*tp_setattr*/ + nullptr, /*tp_compare*/ + nullptr, /*tp_repr*/ + nullptr, /*tp_as_number*/ + nullptr, /*tp_as_sequence*/ + nullptr, /*tp_as_mapping*/ + nullptr, /*tp_hash*/ + nullptr, /*tp_call*/ + nullptr, /*tp_str*/ PyObject_GenericGetAttr, /*tp_getattro*/ /* softspace is writable: we must supply tp_setattro */ PyObject_GenericSetAttr, /* tp_setattro */ - 0, /*tp_as_buffer*/ + nullptr, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ + nullptr, /*tp_doc*/ + nullptr, /*tp_traverse*/ + nullptr, /*tp_clear*/ + nullptr, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ + nullptr, /*tp_iter*/ + nullptr, /*tp_iternext*/ PyStdOut_methods, /*tp_methods*/ PyStdOut_memberlist, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ + nullptr, /*tp_getset*/ + nullptr, /*tp_base*/ + nullptr, /*tp_dict*/ + nullptr, /*tp_descr_get*/ + nullptr, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - 0, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ + nullptr, /*tp_init*/ + nullptr, /*tp_alloc*/ + nullptr, /*tp_new*/ + nullptr, /*tp_free*/ + nullptr, /*tp_is_gc*/ + nullptr, /*tp_bases*/ + nullptr, /*tp_mro*/ + nullptr, /*tp_cache*/ + nullptr, /*tp_subclasses*/ + nullptr, /*tp_weaklist*/ + nullptr, /*tp_del*/ 0, /*tp_version_tag*/ - 0, /*tp_finalize*/ + nullptr, /*tp_finalize*/ }; PyObject *newPyStdOut(std::string &out) { diff --git a/src/Config/Config_PluginMessage.cpp b/src/Config/Config_PluginMessage.cpp index 1469c313a..8730557c1 100644 --- a/src/Config/Config_PluginMessage.cpp +++ b/src/Config/Config_PluginMessage.cpp @@ -27,7 +27,7 @@ Config_PluginMessage::Config_PluginMessage(const Events_ID theId, myPluginId = thePluginId; } -Config_PluginMessage::~Config_PluginMessage() {} +Config_PluginMessage::~Config_PluginMessage() = default; const std::string &Config_PluginMessage::pluginId() const { return myPluginId; } diff --git a/src/Config/Config_PluginMessage.h b/src/Config/Config_PluginMessage.h index f17faf72b..34d5e1502 100644 --- a/src/Config/Config_PluginMessage.h +++ b/src/Config/Config_PluginMessage.h @@ -48,9 +48,9 @@ public: /// Constructs Config_PluginMessage CONFIG_EXPORT Config_PluginMessage(const Events_ID theId, const std::string &thePluginId, - const void *theParent = 0); + const void *theParent = nullptr); /// Deletes Config_PluginMessage - CONFIG_EXPORT virtual ~Config_PluginMessage(); + CONFIG_EXPORT ~Config_PluginMessage() override; /// Plugin Id CONFIG_EXPORT const std::string &pluginId() const; diff --git a/src/Config/Config_PointerMessage.cpp b/src/Config/Config_PointerMessage.cpp index f3152ee7e..fc4ed9f5c 100644 --- a/src/Config/Config_PointerMessage.cpp +++ b/src/Config/Config_PointerMessage.cpp @@ -23,9 +23,9 @@ // LCOV_EXCL_START Config_PointerMessage::Config_PointerMessage(const Events_ID theId, const void *theParent) - : Events_Message(theId, theParent), myPointer(0) {} + : Events_Message(theId, theParent), myPointer(nullptr) {} -Config_PointerMessage::~Config_PointerMessage() {} +Config_PointerMessage::~Config_PointerMessage() = default; void *Config_PointerMessage::pointer() const { return myPointer; } diff --git a/src/Config/Config_PointerMessage.h b/src/Config/Config_PointerMessage.h index 5c512d331..bafd34d31 100644 --- a/src/Config/Config_PointerMessage.h +++ b/src/Config/Config_PointerMessage.h @@ -32,8 +32,8 @@ class CONFIG_EXPORT Config_PointerMessage : public Events_Message { public: /// Constructor - Config_PointerMessage(const Events_ID theId, const void *theParent = 0); - virtual ~Config_PointerMessage(); + Config_PointerMessage(const Events_ID theId, const void *theParent = nullptr); + ~Config_PointerMessage() override; /// Returns pointer to an object void *pointer() const; diff --git a/src/Config/Config_PropManager.cpp b/src/Config/Config_PropManager.cpp index fb320c559..c30ea09f8 100644 --- a/src/Config/Config_PropManager.cpp +++ b/src/Config/Config_PropManager.cpp @@ -27,7 +27,7 @@ int stringToInteger(const std::string &theInt); bool stringToBoolean(const std::string &theInt); Config_Properties &Config_PropManager::props() { - static Config_Properties *confProps = new Config_Properties(); + static auto *confProps = new Config_Properties(); return *confProps; } @@ -78,7 +78,7 @@ Config_Prop *Config_PropManager::findProp(const std::string &theSection, if ((aProp->section() == theSection) && (aProp->name() == theName)) return aProp; } - return NULL; + return nullptr; } Config_Properties Config_PropManager::getProperties() { @@ -206,7 +206,7 @@ double Config_PropManager::stringToDouble(const std::string &theDouble) { std::string aStr = theDouble; // change locale and convert "," to "." if exists - std::string aCurLocale = setlocale(LC_NUMERIC, 0); + std::string aCurLocale = setlocale(LC_NUMERIC, nullptr); setlocale(LC_NUMERIC, "C"); size_t dotpos = aStr.find(','); if (dotpos != std::string::npos) diff --git a/src/Config/Config_Translator.cpp b/src/Config/Config_Translator.cpp index e14545fca..eeb238240 100644 --- a/src/Config/Config_Translator.cpp +++ b/src/Config/Config_Translator.cpp @@ -51,7 +51,7 @@ public: protected: /// Overloaded method. Defines how to process each node - virtual void processNode(xmlNodePtr theNode); + void processNode(xmlNodePtr theNode) override; private: Config_Translator::Translator myTranslator; diff --git a/src/Config/Config_Translator.h b/src/Config/Config_Translator.h index 54186372a..330b7747e 100644 --- a/src/Config/Config_Translator.h +++ b/src/Config/Config_Translator.h @@ -40,10 +40,10 @@ class Config_Translator { public: /// A data type of dictionary - typedef std::map Dictionary; + using Dictionary = std::map; /// A data type of Translator with structure - typedef std::map Translator; + using Translator = std::map; /** * Load translations from TS file diff --git a/src/Config/Config_ValidatorMessage.cpp b/src/Config/Config_ValidatorMessage.cpp index 72b31cd33..00b29cc69 100644 --- a/src/Config/Config_ValidatorMessage.cpp +++ b/src/Config/Config_ValidatorMessage.cpp @@ -28,7 +28,7 @@ Config_ValidatorMessage::Config_ValidatorMessage(const Events_ID theId, myAttributeId = ""; } -Config_ValidatorMessage::~Config_ValidatorMessage() {} +Config_ValidatorMessage::~Config_ValidatorMessage() = default; const std::string &Config_ValidatorMessage::validatorId() const { return myValidatorId; diff --git a/src/Config/Config_ValidatorMessage.h b/src/Config/Config_ValidatorMessage.h index d3c352840..e43380af0 100644 --- a/src/Config/Config_ValidatorMessage.h +++ b/src/Config/Config_ValidatorMessage.h @@ -48,8 +48,8 @@ public: * \param theParent - pointer to the sender */ CONFIG_EXPORT Config_ValidatorMessage(const Events_ID theId, - const void *theParent = 0); - CONFIG_EXPORT virtual ~Config_ValidatorMessage(); + const void *theParent = nullptr); + CONFIG_EXPORT ~Config_ValidatorMessage() override; //! Get id of the filter CONFIG_EXPORT const std::string &validatorId() const; diff --git a/src/Config/Config_ValidatorReader.cpp b/src/Config/Config_ValidatorReader.cpp index 20b2c01e1..5f7c3944b 100644 --- a/src/Config/Config_ValidatorReader.cpp +++ b/src/Config/Config_ValidatorReader.cpp @@ -38,7 +38,7 @@ Config_ValidatorReader::Config_ValidatorReader( const std::string &theXmlFileName, bool isXMLContent) : Config_XMLReader(theXmlFileName, isXMLContent) {} -Config_ValidatorReader::~Config_ValidatorReader() {} +Config_ValidatorReader::~Config_ValidatorReader() = default; void Config_ValidatorReader::processNode(xmlNodePtr theNode) { if (isNode(theNode, NODE_VALIDATOR, NULL)) { diff --git a/src/Config/Config_ValidatorReader.h b/src/Config/Config_ValidatorReader.h index deed3da0b..9d5f121ac 100644 --- a/src/Config/Config_ValidatorReader.h +++ b/src/Config/Config_ValidatorReader.h @@ -42,7 +42,7 @@ public: */ CONFIG_EXPORT Config_ValidatorReader(const std::string &theXmlFile, bool isXMLContent = false); - CONFIG_EXPORT virtual ~Config_ValidatorReader(); + CONFIG_EXPORT ~Config_ValidatorReader() override; /// Set feature ID for cases when XML for validators is parsed from memory CONFIG_EXPORT void setFeatureId(const std::string &theId) { @@ -57,17 +57,17 @@ protected: * \brief Allows to customize reader's behavior for a node. Virtual. * The default implementation process "source" and "validator" nodes. */ - virtual void processNode(xmlNodePtr aNode); + void processNode(xmlNodePtr aNode) override; /*! * \brief Defines which nodes should be processed recursively. Virtual. * The default impl is to read all nodes. */ - virtual bool processChildren(xmlNodePtr aNode); + bool processChildren(xmlNodePtr aNode) override; /*! * Cleans the cached information about parent feature or attribute (widget) */ - virtual void cleanup(xmlNodePtr theNode); + void cleanup(xmlNodePtr theNode) override; /*! * \brief Retrieves all the necessary info from the validator node. diff --git a/src/Config/Config_WidgetAPI.cpp b/src/Config/Config_WidgetAPI.cpp index 193bec12b..0fceec38b 100644 --- a/src/Config/Config_WidgetAPI.cpp +++ b/src/Config/Config_WidgetAPI.cpp @@ -62,7 +62,7 @@ bool Config_WidgetAPI::toChildWidget() { while (aChildNode && !isElementNode(aChildNode)) { aChildNode = aChildNode->next; } - if (aChildNode != NULL) { + if (aChildNode != nullptr) { myCurrentNode = aChildNode; return true; } @@ -74,7 +74,7 @@ bool Config_WidgetAPI::toParentWidget() { if (myCurrentNode) { myCurrentNode = myCurrentNode->parent; } - return myCurrentNode != NULL; + return myCurrentNode != nullptr; } std::string Config_WidgetAPI::widgetType() const { diff --git a/src/Config/Config_WidgetReader.cpp b/src/Config/Config_WidgetReader.cpp index 2612fdfb6..1a22d8888 100644 --- a/src/Config/Config_WidgetReader.cpp +++ b/src/Config/Config_WidgetReader.cpp @@ -38,7 +38,7 @@ Config_WidgetReader::Config_WidgetReader(const std::string &theXmlFile) {} -Config_WidgetReader::~Config_WidgetReader() {} +Config_WidgetReader::~Config_WidgetReader() = default; std::string Config_WidgetReader::featureWidgetCfg(const std::string &theFeatureName) { @@ -68,7 +68,7 @@ bool Config_WidgetReader::processChildren(xmlNodePtr theNode) { void Config_WidgetReader::resolveSourceNodes(xmlNodePtr theNode) { xmlNodePtr aNode = xmlFirstElementChild(theNode); std::list aSourceNodes; - while (aNode != NULL) { + while (aNode != nullptr) { if (isNode(aNode, NODE_SOURCE, NULL)) { Config_XMLReader aSourceReader = Config_XMLReader(getProperty(aNode, SOURCE_FILE)); @@ -76,7 +76,7 @@ void Config_WidgetReader::resolveSourceNodes(xmlNodePtr theNode) { if (aSourceRoot) { xmlNodePtr aSourceNode = xmlFirstElementChild(aSourceRoot); xmlNodePtr aTargetNode = xmlDocCopyNodeList(aNode->doc, aSourceNode); - while (aTargetNode != NULL) { + while (aTargetNode != nullptr) { xmlNodePtr aNextNode = xmlNextElementSibling(aTargetNode); xmlAddPrevSibling(aNode, aTargetNode); aTargetNode = aNextNode; @@ -87,7 +87,7 @@ void Config_WidgetReader::resolveSourceNodes(xmlNodePtr theNode) { aNode = xmlNextElementSibling(aNode); } // Remove "SOURCE" node. - std::list::iterator it = aSourceNodes.begin(); + auto it = aSourceNodes.begin(); for (; it != aSourceNodes.end(); it++) { xmlUnlinkNode(*it); xmlFreeNode(*it); diff --git a/src/Config/Config_WidgetReader.h b/src/Config/Config_WidgetReader.h index c5218a28a..ea20e092c 100644 --- a/src/Config/Config_WidgetReader.h +++ b/src/Config/Config_WidgetReader.h @@ -41,7 +41,7 @@ public: * the reader */ CONFIG_EXPORT Config_WidgetReader(const std::string &theXmlFile); - CONFIG_EXPORT virtual ~Config_WidgetReader(); + CONFIG_EXPORT ~Config_WidgetReader() override; /// Extract feature's widget configuration from local cache, stored on node /// processing @@ -52,9 +52,9 @@ public: protected: /// Overloaded method. Defines how to process each node - void processNode(xmlNodePtr theNode); + void processNode(xmlNodePtr theNode) override; /// Overloaded method. Defines if the given node should be parsed recursively - bool processChildren(xmlNodePtr theNode); + bool processChildren(xmlNodePtr theNode) override; /// Extracts xml definition of the given node and it's children std::string dumpNode(xmlNodePtr theNode); /// Replace all "source" nodes with their content (used before dumping nodes) diff --git a/src/ConstructionAPI/ConstructionAPI_Axis.cpp b/src/ConstructionAPI/ConstructionAPI_Axis.cpp index 8c10c548f..70eb6f528 100644 --- a/src/ConstructionAPI/ConstructionAPI_Axis.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Axis.cpp @@ -126,7 +126,7 @@ ConstructionAPI_Axis::ConstructionAPI_Axis( } //================================================================================================== -ConstructionAPI_Axis::~ConstructionAPI_Axis() {} +ConstructionAPI_Axis::~ConstructionAPI_Axis() = default; //================================================================================================== void ConstructionAPI_Axis::setByPoints( diff --git a/src/ConstructionAPI/ConstructionAPI_Axis.h b/src/ConstructionAPI/ConstructionAPI_Axis.h index 21fb527a9..d9e0b42ee 100644 --- a/src/ConstructionAPI/ConstructionAPI_Axis.h +++ b/src/ConstructionAPI/ConstructionAPI_Axis.h @@ -95,7 +95,7 @@ public: /// Destructor CONSTRUCTIONAPI_EXPORT - virtual ~ConstructionAPI_Axis(); + ~ConstructionAPI_Axis() override; INTERFACE_21( ConstructionPlugin_Axis::ID(), creationMethod, @@ -194,7 +194,7 @@ public: /// Dump wrapped feature CONSTRUCTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Axis object diff --git a/src/ConstructionAPI/ConstructionAPI_Plane.cpp b/src/ConstructionAPI/ConstructionAPI_Plane.cpp index 61bac7f7e..664e137bc 100644 --- a/src/ConstructionAPI/ConstructionAPI_Plane.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Plane.cpp @@ -106,7 +106,7 @@ ConstructionAPI_Plane::ConstructionAPI_Plane( } //================================================================================================== -ConstructionAPI_Plane::~ConstructionAPI_Plane() {} +ConstructionAPI_Plane::~ConstructionAPI_Plane() = default; //================================================================================================== void ConstructionAPI_Plane::setByFaceAndDistance( diff --git a/src/ConstructionAPI/ConstructionAPI_Plane.h b/src/ConstructionAPI/ConstructionAPI_Plane.h index 154973922..1dc8258e8 100644 --- a/src/ConstructionAPI/ConstructionAPI_Plane.h +++ b/src/ConstructionAPI/ConstructionAPI_Plane.h @@ -89,7 +89,7 @@ public: /// Destructor CONSTRUCTIONAPI_EXPORT - virtual ~ConstructionAPI_Plane(); + ~ConstructionAPI_Plane() override; INTERFACE_21( ConstructionPlugin_Plane::ID(), creationMethod, @@ -175,7 +175,7 @@ public: /// Dump wrapped feature CONSTRUCTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Plane object diff --git a/src/ConstructionAPI/ConstructionAPI_Point.cpp b/src/ConstructionAPI/ConstructionAPI_Point.cpp index 1e2f665c1..78fcab3bb 100644 --- a/src/ConstructionAPI/ConstructionAPI_Point.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Point.cpp @@ -153,7 +153,7 @@ ConstructionAPI_Point::ConstructionAPI_Point( } //================================================================================================== -ConstructionAPI_Point::~ConstructionAPI_Point() {} +ConstructionAPI_Point::~ConstructionAPI_Point() = default; //================================================================================================== void ConstructionAPI_Point::setByXYZ(const ModelHighAPI_Double &theX, diff --git a/src/ConstructionAPI/ConstructionAPI_Point.h b/src/ConstructionAPI/ConstructionAPI_Point.h index 320b41edf..e6d45753a 100644 --- a/src/ConstructionAPI/ConstructionAPI_Point.h +++ b/src/ConstructionAPI/ConstructionAPI_Point.h @@ -80,7 +80,7 @@ public: /// Destructor. CONSTRUCTIONAPI_EXPORT - virtual ~ConstructionAPI_Point(); + ~ConstructionAPI_Point() override; INTERFACE_25( ConstructionPlugin_Point::ID(), point, @@ -186,7 +186,7 @@ public: /// Dump wrapped feature CONSTRUCTIONAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Point object. diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.h b/src/ConstructionPlugin/ConstructionPlugin_Axis.h index 78ba16e16..6305ba0b0 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.h @@ -209,7 +209,7 @@ public: } /// Returns a minimal length for axis - inline static const double MINIMAL_LENGTH() { return 1.e-5; } + inline static double MINIMAL_LENGTH() { return 1.e-5; } /// Creates a new part document if needed CONSTRUCTIONPLUGIN_EXPORT void execute() override; diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp index 8fb4a14bf..724803570 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp @@ -59,7 +59,7 @@ makeRectangularFace(const std::shared_ptr theFace, const std::shared_ptr thePln); //================================================================================================== -ConstructionPlugin_Plane::ConstructionPlugin_Plane() {} +ConstructionPlugin_Plane::ConstructionPlugin_Plane() = default; //================================================================================================== void ConstructionPlugin_Plane::initAttributes() { @@ -167,8 +167,9 @@ bool ConstructionPlugin_Plane::customisePresentation(ResultPtr theResult, AISObjectPtr thePrs) { std::vector aColor; // get color from the attribute of the result - if (theResult.get() != NULL && - theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) { + if (theResult.get() != nullptr && + theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != + nullptr) { AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); if (aColorAttr.get() && aColorAttr->size()) { @@ -197,8 +198,8 @@ ConstructionPlugin_Plane::createByGeneralEquation() { AttributeDoublePtr anAttrC = real(ConstructionPlugin_Plane::C()); AttributeDoublePtr anAttrD = real(ConstructionPlugin_Plane::D()); std::shared_ptr aPlaneFace; - if ((anAttrA.get() != NULL) && (anAttrB.get() != NULL) && - (anAttrC.get() != NULL) && (anAttrD.get() != NULL) && + if ((anAttrA.get() != nullptr) && (anAttrB.get() != nullptr) && + (anAttrC.get() != nullptr) && (anAttrD.get() != nullptr) && anAttrA->isInitialized() && anAttrB->isInitialized() && anAttrC->isInitialized() && anAttrD->isInitialized()) { double aA = anAttrA->value(), aB = anAttrB->value(), aC = anAttrC->value(), @@ -305,8 +306,8 @@ void ConstructionPlugin_Plane::createByDistanceFromOther( data()->real(ConstructionPlugin_Plane::DISTANCE()); AttributeIntegerPtr aNbCopyAttr = data()->integer(ConstructionPlugin_Plane::NB_COPIES()); - if ((aFaceAttr.get() != NULL) && (aDistAttr.get() != NULL) && - (aNbCopyAttr.get() != NULL) && aFaceAttr->isInitialized() && + if ((aFaceAttr.get() != nullptr) && (aDistAttr.get() != nullptr) && + (aNbCopyAttr.get() != nullptr) && aFaceAttr->isInitialized() && aDistAttr->isInitialized()) { double aDist = aDistAttr->value(); diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.h b/src/ConstructionPlugin/ConstructionPlugin_Plane.h index 39af4dda3..93f2142a9 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.h @@ -35,7 +35,7 @@ class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustomPrs { public: /// \return the kind of a feature. - CONSTRUCTIONPLUGIN_EXPORT virtual const std::string &getKind() { + CONSTRUCTIONPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = ConstructionPlugin_Plane::ID(); return MY_KIND; } @@ -231,17 +231,17 @@ public: } /// Creates a new part document if needed - CONSTRUCTIONPLUGIN_EXPORT virtual void execute(); + CONSTRUCTIONPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes(); + CONSTRUCTIONPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation ConstructionPlugin_Plane(); /// Customize presentation of the feature - virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs); + bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs) override; protected: /// Creates a new plane by general equation. diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.h b/src/ConstructionPlugin/ConstructionPlugin_Plugin.h index 6b128b60c..6dccb9493 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plugin.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.h @@ -33,7 +33,7 @@ class CONSTRUCTIONPLUGIN_EXPORT ConstructionPlugin_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - virtual FeaturePtr createFeature(std::string theFeatureID); + FeaturePtr createFeature(std::string theFeatureID) override; /// Default constructor ConstructionPlugin_Plugin(); diff --git a/src/ConstructionPlugin/ConstructionPlugin_Validators.h b/src/ConstructionPlugin/ConstructionPlugin_Validators.h index c2396c1a9..29bf2962b 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Validators.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Validators.h @@ -33,9 +33,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel @@ -48,9 +48,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class ConstructionPlugin_ValidatorPlaneThreePoints @@ -63,9 +63,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class ConstructionPlugin_ValidatorPlaneLinePoint @@ -78,9 +78,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class ConstructionPlugin_ValidatorPlaneTwoParallelPlanes @@ -93,9 +93,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes @@ -108,9 +108,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class ConstructionPlugin_ValidatorPointThreeNonParallelPlanes @@ -123,9 +123,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class ConstructionPlugin_ValidatorNotFeature @@ -138,9 +138,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/Events/Events_Listener.cpp b/src/Events/Events_Listener.cpp index cc2f88bf3..0802a5796 100644 --- a/src/Events/Events_Listener.cpp +++ b/src/Events/Events_Listener.cpp @@ -27,8 +27,7 @@ void Events_Listener::groupWhileFlush( std::shared_ptr aGroup = std::dynamic_pointer_cast(theMessage); if (aGroup) { - std::map>::iterator aMyGroup = - myGroups.find(aGroup->eventID().eventText()); + auto aMyGroup = myGroups.find(aGroup->eventID().eventText()); if (aMyGroup == myGroups.end()) { // create a new group of messages for accumulation myGroups[aGroup->eventID().eventText()] = aGroup->newEmpty(); @@ -43,8 +42,7 @@ void Events_Listener::groupWhileFlush( } void Events_Listener::flushGrouped(const Events_ID &theID) { - std::map>::iterator aMyGroup = - myGroups.find(theID.eventText()); + auto aMyGroup = myGroups.find(theID.eventText()); if (aMyGroup != myGroups.end()) { std::shared_ptr aMessage = aMyGroup->second; myGroups.erase(aMyGroup); diff --git a/src/Events/Events_LongOp.cpp b/src/Events/Events_LongOp.cpp index ecbb4c451..1ae030d71 100644 --- a/src/Events/Events_LongOp.cpp +++ b/src/Events/Events_LongOp.cpp @@ -28,7 +28,7 @@ std::map MY_SENDERS; Events_LongOp::Events_LongOp(void *theSender) : Events_Message(Events_LongOp::eventID(), theSender) {} -Events_LongOp::~Events_LongOp() {} +Events_LongOp::~Events_LongOp() = default; Events_ID Events_LongOp::eventID() { Events_Loop *aLoop = Events_Loop::loop(); diff --git a/src/Events/Events_LongOp.h b/src/Events/Events_LongOp.h index 74dea23b2..0af5f9f41 100644 --- a/src/Events/Events_LongOp.h +++ b/src/Events/Events_LongOp.h @@ -31,19 +31,19 @@ class EVENTS_EXPORT Events_LongOp : public Events_Message { public: /// Default destructor - virtual ~Events_LongOp(); + ~Events_LongOp() override; /// Returns the identifier of this event static Events_ID eventID(); /// Starts the long operation - static void start(void *theSender = 0); + static void start(void *theSender = nullptr); /// Stops the long operation - static void end(void *theSender = 0); + static void end(void *theSender = nullptr); /// Returns true if the long operation is performed static bool isPerformed(); protected: /// Default constructor. Use "start" and "end" for generation. - Events_LongOp(void *theSender = 0); + Events_LongOp(void *theSender = nullptr); }; #endif /* EVENTS_ERROR_H_ */ diff --git a/src/Events/Events_Loop.cpp b/src/Events/Events_Loop.cpp index 3180c0322..162f227cb 100644 --- a/src/Events/Events_Loop.cpp +++ b/src/Events/Events_Loop.cpp @@ -36,7 +36,7 @@ Events_ID Events_Loop::eventByName(const char *theName) { static std::map CREATED_EVENTS; char *aResult; std::string aName(theName); - std::map::iterator aFound = CREATED_EVENTS.find(aName); + auto aFound = CREATED_EVENTS.find(aName); if (aFound == CREATED_EVENTS.end()) { // not created yet #ifdef WIN32 aResult = _strdup(theName); // copy to make unique internal pointer @@ -53,7 +53,7 @@ Events_ID Events_Loop::eventByName(const char *theName) { void Events_Loop::sendProcessEvent( const std::shared_ptr &theMessage, std::list &theListeners, const bool theFlushedNow) { - std::list::iterator aL = theListeners.begin(); + auto aL = theListeners.begin(); for (; aL != theListeners.end(); aL++) { if (theFlushedNow && (*aL)->groupMessages()) { (*aL)->groupWhileFlush(theMessage); @@ -77,8 +77,7 @@ void Events_Loop::send(const std::shared_ptr &theMessage, std::shared_ptr aGroup = std::dynamic_pointer_cast(theMessage); if (aGroup) { - std::map>::iterator aMyGroup = - myGroups.find(aGroup->eventID().eventText()); + auto aMyGroup = myGroups.find(aGroup->eventID().eventText()); if (aMyGroup == myGroups.end()) { // create a new group of messages for accumulation myGroups[aGroup->eventID().eventText()] = aGroup->newEmpty(); @@ -91,17 +90,15 @@ void Events_Loop::send(const std::shared_ptr &theMessage, } } // send - std::map>>::iterator - aFindID = myListeners.find(theMessage->eventID().eventText()); + auto aFindID = myListeners.find(theMessage->eventID().eventText()); if (aFindID != myListeners.end()) { - std::map>::iterator aFindSender = - aFindID->second.find(theMessage->sender()); + auto aFindSender = aFindID->second.find(theMessage->sender()); if (aFindSender != aFindID->second.end()) { sendProcessEvent(theMessage, aFindSender->second, isFlushedNow && isGroup); } if (theMessage->sender()) { // also call for NULL senders registered - aFindSender = aFindID->second.find(NULL); + aFindSender = aFindID->second.find(nullptr); if (aFindSender != aFindID->second.end()) { sendProcessEvent(theMessage, aFindSender->second, isFlushedNow && isGroup); @@ -117,16 +114,14 @@ void Events_Loop::registerListener(Events_Listener *theListener, myImmediateListeners[theID.eventText()] = theListener; return; } - std::map>>::iterator - aFindID = myListeners.find(theID.eventText()); + auto aFindID = myListeners.find(theID.eventText()); if (aFindID == myListeners.end()) { // create container associated with ID myListeners[theID.eventText()] = std::map>(); aFindID = myListeners.find(theID.eventText()); } - std::map>::iterator aFindSender = - aFindID->second.find(theSender); + auto aFindSender = aFindID->second.find(theSender); if (aFindSender == aFindID->second.end()) { // create container associated with sender aFindID->second[theSender] = std::list(); @@ -134,9 +129,8 @@ void Events_Loop::registerListener(Events_Listener *theListener, } // check that listener was not registered with such parameters before std::list &aListeners = aFindSender->second; - for (std::list::iterator aL = aListeners.begin(); - aL != aListeners.end(); aL++) - if (*aL == theListener) + for (auto &aListener : aListeners) + if (aListener == theListener) return; // avoid duplicates aListeners.push_back(theListener); @@ -218,14 +212,11 @@ void Events_Loop::flush(const Events_ID &theID) { #endif } // send accumulated messages to "groupListeners" - std::map>>::iterator - aFindID = myListeners.find(theID.eventText()); + auto aFindID = myListeners.find(theID.eventText()); if (aFindID != myListeners.end()) { - std::map>::iterator aFindSender = - aFindID->second.begin(); + auto aFindSender = aFindID->second.begin(); for (; aFindSender != aFindID->second.end(); aFindSender++) { - std::list::iterator aListener = - aFindSender->second.begin(); + auto aListener = aFindSender->second.begin(); for (; aListener != aFindSender->second.end(); aListener++) { if ((*aListener)->groupMessages()) { (*aListener)->flushGrouped(theID); @@ -243,8 +234,7 @@ void Events_Loop::flush(const Events_ID &theID) { } void Events_Loop::eraseMessages(const Events_ID &theID) { - std::map>::iterator aMyGroup = - myGroups.find(theID.eventText()); + auto aMyGroup = myGroups.find(theID.eventText()); if (aMyGroup != myGroups.end()) { myGroups.erase(aMyGroup); } @@ -257,8 +247,7 @@ bool Events_Loop::activateFlushes(const bool theActivate) { } void Events_Loop::clear(const Events_ID &theID) { - std::map>::iterator aMyGroup = - myGroups.find(theID.eventText()); + auto aMyGroup = myGroups.find(theID.eventText()); if (aMyGroup != myGroups.end()) { // really sends myGroups.erase(aMyGroup); } diff --git a/src/Events/Events_Loop.h b/src/Events/Events_Loop.h index 2fee2471f..773e9ecf8 100644 --- a/src/Events/Events_Loop.h +++ b/src/Events/Events_Loop.h @@ -60,7 +60,7 @@ class Events_Loop { //! The empty constructor, will be called at startup of the application, only //! once - Events_Loop() {} + Events_Loop() = default; public: ///! Returns the main object of the loop, one per application. diff --git a/src/Events/Events_MessageBool.h b/src/Events/Events_MessageBool.h index 583d6eeb0..a3ef21b9f 100644 --- a/src/Events/Events_MessageBool.h +++ b/src/Events/Events_MessageBool.h @@ -40,14 +40,14 @@ public: /// \param theValue a Boolean value to send /// \param theSender a pointer on sender object Events_MessageBool(const Events_ID theEventID, const bool theValue, - const void *theSender = 0) + const void *theSender = nullptr) : Events_Message(theEventID, theSender), myValue(theValue) {} /// Default destructor - virtual ~Events_MessageBool() {} + ~Events_MessageBool() override = default; /// Returns the value stored in this message. - const bool value() const { return myValue; } + bool value() const { return myValue; } /// Sends the message EVENTS_EXPORT void send(); diff --git a/src/Events/Events_MessageGroup.cpp b/src/Events/Events_MessageGroup.cpp index 14a10e78b..c53df4dc8 100644 --- a/src/Events/Events_MessageGroup.cpp +++ b/src/Events/Events_MessageGroup.cpp @@ -24,4 +24,4 @@ Events_MessageGroup::Events_MessageGroup(const Events_ID theID, const void *theSender) : Events_Message(theID, theSender) {} -Events_MessageGroup::~Events_MessageGroup() {} +Events_MessageGroup::~Events_MessageGroup() = default; diff --git a/src/ExchangeAPI/ExchangeAPI_Export.cpp b/src/ExchangeAPI/ExchangeAPI_Export.cpp index 6b5bae013..f19b837b4 100644 --- a/src/ExchangeAPI/ExchangeAPI_Export.cpp +++ b/src/ExchangeAPI/ExchangeAPI_Export.cpp @@ -194,7 +194,7 @@ ExchangeAPI_Export::ExchangeAPI_Export( // state of the history } -ExchangeAPI_Export::~ExchangeAPI_Export() {} +ExchangeAPI_Export::~ExchangeAPI_Export() = default; // this method is needed on Windows because back-slashes in python may cause // error diff --git a/src/ExchangeAPI/ExchangeAPI_Export.h b/src/ExchangeAPI/ExchangeAPI_Export.h index c6bc52c81..c4893a30c 100644 --- a/src/ExchangeAPI/ExchangeAPI_Export.h +++ b/src/ExchangeAPI/ExchangeAPI_Export.h @@ -93,7 +93,7 @@ public: /// Destructor. EXCHANGEAPI_EXPORT - virtual ~ExchangeAPI_Export(); + ~ExchangeAPI_Export() override; INTERFACE_16( ExchangePlugin_ExportFeature::ID(), exportType, @@ -132,7 +132,7 @@ public: /// Dump wrapped feature EXCHANGEAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Export object diff --git a/src/ExchangeAPI/ExchangeAPI_Import.cpp b/src/ExchangeAPI/ExchangeAPI_Import.cpp index 8f11c518a..b659f2dc9 100644 --- a/src/ExchangeAPI/ExchangeAPI_Import.cpp +++ b/src/ExchangeAPI/ExchangeAPI_Import.cpp @@ -75,7 +75,7 @@ ExchangeAPI_Import::ExchangeAPI_Import( setParameters(theFilePath, theScalInterUnits, theMaterials, theColor); } -ExchangeAPI_Import::~ExchangeAPI_Import() {} +ExchangeAPI_Import::~ExchangeAPI_Import() = default; //-------------------------------------------------------------------------------------- void ExchangeAPI_Import::setParameters(const std::string &theFilePath, @@ -289,7 +289,7 @@ void ExchangeAPI_Import_Image::dump(ModelHighAPI_Dumper &theDumper) const { anImageAttr->texture(aWidth, aHeight, aByteList, aFormat); // convert image data to QPixmap - uchar *arr = new uchar[aByteList.size()]; + auto *arr = new uchar[aByteList.size()]; std::copy(aByteList.begin(), aByteList.end(), arr); QImage image(arr, aWidth, aHeight, QImage::Format_ARGB32); QPixmap pixmap = QPixmap::fromImage(image); diff --git a/src/ExchangeAPI/ExchangeAPI_Import.h b/src/ExchangeAPI/ExchangeAPI_Import.h index df5095dc7..bb99e4baf 100644 --- a/src/ExchangeAPI/ExchangeAPI_Import.h +++ b/src/ExchangeAPI/ExchangeAPI_Import.h @@ -66,7 +66,7 @@ public: const bool theColor); /// Destructor EXCHANGEAPI_EXPORT - virtual ~ExchangeAPI_Import(); + ~ExchangeAPI_Import() override; INTERFACE_7(ExchangePlugin_ImportFeature::ID(), filePath, ExchangePlugin_ImportFeature::FILE_PATH_ID(), @@ -96,7 +96,7 @@ public: /// Dump wrapped feature EXCHANGEAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; //! Pointer on Import object @@ -153,7 +153,7 @@ public: /// Destructor EXCHANGEAPI_EXPORT - virtual ~ExchangeAPI_Import_Image() = default; + ~ExchangeAPI_Import_Image() override = default; INTERFACE_1(ExchangePlugin_Import_ImageFeature::ID(), filePath, ExchangePlugin_Import_ImageFeature::FILE_PATH_ID(), @@ -166,11 +166,11 @@ public: /// Dump wrapped feature EXCHANGEAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; //! Pointer on Import object -typedef std::shared_ptr ImportImagePtr; +using ImportImagePtr = std::shared_ptr; EXCHANGEAPI_EXPORT ImportImagePtr addImportImage(const std::shared_ptr &thePart, diff --git a/src/ExchangePlugin/ExchangePlugin_Dump.cpp b/src/ExchangePlugin/ExchangePlugin_Dump.cpp index 3e4b89081..aa0dae169 100644 --- a/src/ExchangePlugin/ExchangePlugin_Dump.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Dump.cpp @@ -51,9 +51,9 @@ static const bool THE_DUMP_WEAK = true; static const bool THE_DUMP_WEAK = false; #endif -ExchangePlugin_Dump::ExchangePlugin_Dump() {} +ExchangePlugin_Dump::ExchangePlugin_Dump() = default; -ExchangePlugin_Dump::~ExchangePlugin_Dump() {} +ExchangePlugin_Dump::~ExchangePlugin_Dump() = default; void ExchangePlugin_Dump::initAttributes() { data()->addAttribute(FILE_PATH_ID(), ModelAPI_AttributeString::typeId()); @@ -143,8 +143,8 @@ void ExchangePlugin_Dump::dump(const std::string &theFileName) { boolean(GEOMETRIC_DUMP_ID())->value(), boolean(WEAK_NAMING_DUMP_ID())->value()}; int aNbSelectedTypes = 0; - for (int i = 0; i < THE_TYPES_SIZE; ++i) - if (aTypes[i]) + for (bool aType : aTypes) + if (aType) ++aNbSelectedTypes; if (boolean(TOPOLOGICAL_NAMING_DUMP_ID())->value()) { diff --git a/src/ExchangePlugin/ExchangePlugin_Dump.h b/src/ExchangePlugin/ExchangePlugin_Dump.h index 3a31cf1c7..7b3b18f3d 100644 --- a/src/ExchangePlugin/ExchangePlugin_Dump.h +++ b/src/ExchangePlugin/ExchangePlugin_Dump.h @@ -80,25 +80,25 @@ public: /// Default constructor EXCHANGEPLUGIN_EXPORT ExchangePlugin_Dump(); /// Default destructor - EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Dump(); + EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_Dump() override; /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() { + EXCHANGEPLUGIN_EXPORT const std::string &getKind() override { return ExchangePlugin_Dump::ID(); } /// Request for initialization of data model of the feature: adding all /// attributes - EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); + EXCHANGEPLUGIN_EXPORT void initAttributes() override; /// Computes or recomputes the results - EXCHANGEPLUGIN_EXPORT virtual void execute(); + EXCHANGEPLUGIN_EXPORT void execute() override; /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. - EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; } + EXCHANGEPLUGIN_EXPORT bool isMacro() const override { return true; } /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. - EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + EXCHANGEPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } protected: /// Performs dump to the file diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp index 94cd7b882..109a10529 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp @@ -72,7 +72,7 @@ #include -ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature() {} +ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature() = default; ExchangePlugin_ExportFeature::~ExchangePlugin_ExportFeature() { // TODO Auto-generated destructor stub @@ -230,9 +230,9 @@ void ExchangePlugin_ExportFeature::exportFile(const std::string &theFileName, continue; std::shared_ptr aCurShape = anAttrSelection->value(); - if (aCurShape.get() == NULL) + if (aCurShape.get() == nullptr) aCurShape = anAttrSelection->context()->shape(); - if (aCurShape.get() != NULL) { + if (aCurShape.get() != nullptr) { aShapes.push_back(aCurShape); aContexts.push_back(anAttrSelection->context()); } @@ -434,7 +434,7 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string &theFileName, // iterate all documents used if (aDocuments.empty()) aDocuments.push_back(document()); - std::list::iterator aDoc = aDocuments.begin(); + auto aDoc = aDocuments.begin(); for (; aDoc != aDocuments.end(); aDoc++) { // groups int aGroupCount = (*aDoc)->size(ModelAPI_ResultGroup::group()); @@ -582,8 +582,7 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string &theFileName, } } if (!isWholePart) { // fill the rest values by default ones - XAO::GeometricElementList::iterator allElem = - aXao.getGeometry()->begin(aFieldDimension); + auto allElem = aXao.getGeometry()->begin(aFieldDimension); for (; allElem != aXao.getGeometry()->end(aFieldDimension); allElem++) { if (aFilledIDs.find(allElem->first) != aFilledIDs.end()) diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.h b/src/ExchangePlugin/ExchangePlugin_ExportFeature.h index db7ed4086..4a578115c 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.h +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.h @@ -140,34 +140,35 @@ public: /// Default constructor EXCHANGEPLUGIN_EXPORT ExchangePlugin_ExportFeature(); /// Default destructor - EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ExportFeature(); + EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_ExportFeature() override; /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() { + EXCHANGEPLUGIN_EXPORT const std::string &getKind() override { return ExchangePlugin_ExportFeature::ID(); } /// Request for initialization of data model of the feature: adding all /// attributes - EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); + EXCHANGEPLUGIN_EXPORT void initAttributes() override; /// Reimplemented from ModelAPI_Feature::attributeChanged() - EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + EXCHANGEPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Computes or recomputes the results - EXCHANGEPLUGIN_EXPORT virtual void execute(); + EXCHANGEPLUGIN_EXPORT void execute() override; /// Reimplemented from ModelAPI_Feature::isMacro(). Returns false. // It is macro for not-XAO export. For XAO the feature is kept invisible in // the tree for the export to GEOM functionality correct working. - EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const; + EXCHANGEPLUGIN_EXPORT bool isMacro() const override; /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. - EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + EXCHANGEPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } /// Do not put in history. /// Since it is not a macro, it is not deleted, but we don't want to see it. - bool isInHistory() { return false; } + bool isInHistory() override { return false; } protected: /// Performs export of the file diff --git a/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp b/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp index 61473458d..ea6c76bb8 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp @@ -54,7 +54,7 @@ static bool verifyExport(const std::list &theFeatures, // Collect names of features as a single string static std::wstring namesOfFeatures(const std::list &theFeatures); -ExchangePlugin_ExportPart::ExchangePlugin_ExportPart() {} +ExchangePlugin_ExportPart::ExchangePlugin_ExportPart() = default; void ExchangePlugin_ExportPart::initAttributes() { data()->addAttribute(FILE_PATH_ID(), ModelAPI_AttributeString::typeId()); @@ -151,18 +151,15 @@ static bool isCoordinate(FeaturePtr theFeature) { static void allReferencedFeatures(const std::set &theFeatures, std::set &theReferencedFeatures) { std::set aReferences; - for (std::set::const_iterator anIt = theFeatures.begin(); - anIt != theFeatures.end(); ++anIt) { - theReferencedFeatures.insert(*anIt); + for (const auto &theFeature : theFeatures) { + theReferencedFeatures.insert(theFeature); std::list>> aRefs; - (*anIt)->data()->referencesToObjects(aRefs); + theFeature->data()->referencesToObjects(aRefs); - for (std::list>>::iterator - aRIt = aRefs.begin(); - aRIt != aRefs.end(); ++aRIt) { - for (std::list::iterator anObjIt = aRIt->second.begin(); - anObjIt != aRIt->second.end(); ++anObjIt) { + for (auto &aRef : aRefs) { + for (auto anObjIt = aRef.second.begin(); anObjIt != aRef.second.end(); + ++anObjIt) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anObjIt); if (aFeature && !isCoordinate(aFeature) && theReferencedFeatures.find(aFeature) == theReferencedFeatures.end()) @@ -182,7 +179,7 @@ void collectFeatures(DocumentPtr theDocument, // remove all features after the current one FeaturePtr aCurrentFeature = theDocument->currentFeature(false); - std::list::iterator anIt = theExport.begin(); + auto anIt = theExport.begin(); for (; anIt != theExport.end(); ++anIt) if (*anIt == aCurrentFeature) { theExport.erase(++anIt, theExport.end()); @@ -210,7 +207,7 @@ void collectFeatures(DocumentPtr theDocument, anIt = theExport.begin(); while (anIt != theExport.end()) { if (aFeaturesToExport.find(*anIt) == aFeaturesToExport.end()) { - std::list::iterator aRemoveIt = anIt++; + auto aRemoveIt = anIt++; theExport.erase(aRemoveIt); } else ++anIt; @@ -221,7 +218,7 @@ void collectConstructions(DocumentPtr theDocument, std::list &theExport) { theExport = theDocument->allFeatures(); // keep constructions only - std::list::iterator anIt = theExport.begin(); + auto anIt = theExport.begin(); while (anIt != theExport.end()) { FeaturePtr aCurFeature = *anIt; ResultPtr aCurResult = aCurFeature->lastResult(); @@ -234,7 +231,7 @@ void collectConstructions(DocumentPtr theDocument, if (isApplicable) ++anIt; else { - std::list::iterator aRemoveIt = anIt++; + auto aRemoveIt = anIt++; theExport.erase(aRemoveIt); } } @@ -244,30 +241,27 @@ bool verifyExport(const std::list &theFeatures, std::list &theExternalReferences, std::list &theExportedParts, std::list &theReferredParts) { - for (std::list::const_iterator anIt = theFeatures.begin(); - anIt != theFeatures.end(); ++anIt) { + for (const auto &theFeature : theFeatures) { // full part should not be exported - if ((*anIt)->getKind() == PartSetPlugin_Part::ID()) - theExportedParts.push_back(*anIt); + if (theFeature->getKind() == PartSetPlugin_Part::ID()) + theExportedParts.push_back(theFeature); - DocumentPtr aDoc = (*anIt)->document(); + DocumentPtr aDoc = theFeature->document(); std::list>> aRefs; - (*anIt)->data()->referencesToObjects(aRefs); - std::list>>::iterator aRIt = - aRefs.begin(); + theFeature->data()->referencesToObjects(aRefs); + auto aRIt = aRefs.begin(); for (; aRIt != aRefs.end(); ++aRIt) { - for (std::list::iterator anObjIt = aRIt->second.begin(); - anObjIt != aRIt->second.end(); ++anObjIt) { - FeaturePtr aFeature = ModelAPI_Feature::feature(*anObjIt); + for (auto &anObjIt : aRIt->second) { + FeaturePtr aFeature = ModelAPI_Feature::feature(anObjIt); if (aFeature) { // feature refers to external entity, // which is neither the Origin nor coordinate axis or plane if (aFeature->document() != aDoc && !isCoordinate(aFeature)) - theExternalReferences.push_back(*anIt); + theExternalReferences.push_back(theFeature); // feature refers to result of a part if (aFeature->getKind() == PartSetPlugin_Part::ID()) - theReferredParts.push_back(*anIt); + theReferredParts.push_back(theFeature); } } } @@ -279,8 +273,7 @@ bool verifyExport(const std::list &theFeatures, std::wstring namesOfFeatures(const std::list &theFeatures) { std::wostringstream aListOfFeatures; - for (std::list::const_iterator anIt = theFeatures.begin(); - anIt != theFeatures.end(); ++anIt) { + for (auto anIt = theFeatures.begin(); anIt != theFeatures.end(); ++anIt) { if (anIt != theFeatures.begin()) aListOfFeatures << ", "; aListOfFeatures << "'" << (*anIt)->name() << "'"; diff --git a/src/ExchangePlugin/ExchangePlugin_ExportPart.h b/src/ExchangePlugin/ExchangePlugin_ExportPart.h index fb5fb8d14..c9409545c 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportPart.h +++ b/src/ExchangePlugin/ExchangePlugin_ExportPart.h @@ -56,27 +56,27 @@ public: ExchangePlugin_ExportPart(); /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() { + EXCHANGEPLUGIN_EXPORT const std::string &getKind() override { return ExchangePlugin_ExportPart::ID(); } /// Request for initialization of data model of the feature: adding all /// attributes - EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); + EXCHANGEPLUGIN_EXPORT void initAttributes() override; /// Computes or recomputes the results - EXCHANGEPLUGIN_EXPORT virtual void execute(); + EXCHANGEPLUGIN_EXPORT void execute() override; /// Returns true if this feature is used as macro: creates other features and /// then removed. - EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; } + EXCHANGEPLUGIN_EXPORT bool isMacro() const override { return true; } /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. - EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + EXCHANGEPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } /// Do not put in history. /// Since it is not a macro, it is not deleted, but we don't want to see it. - bool isInHistory() { return false; } + bool isInHistory() override { return false; } }; #endif /* EXCHANGEPLUGIN_EXPORTPART_H_ */ diff --git a/src/ExchangePlugin/ExchangePlugin_Import.cpp b/src/ExchangePlugin/ExchangePlugin_Import.cpp index 25d42adcb..2655ec00b 100644 --- a/src/ExchangePlugin/ExchangePlugin_Import.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Import.cpp @@ -48,11 +48,10 @@ DocumentPtr findDocument(DocumentPtr thePartSetDoc, } else { // find existing part by its name std::list aSubFeatures = thePartSetDoc->allFeatures(); - for (std::list::iterator aFIt = aSubFeatures.begin(); - aFIt != aSubFeatures.end(); ++aFIt) { - if ((*aFIt)->getKind() == PartSetPlugin_Part::ID() && - (*aFIt)->name() == thePartName) { - aPartFeature = *aFIt; + for (auto &aSubFeature : aSubFeatures) { + if (aSubFeature->getKind() == PartSetPlugin_Part::ID() && + aSubFeature->name() == thePartName) { + aPartFeature = aSubFeature; break; } } @@ -252,17 +251,16 @@ void ExchangePlugin_ImportBase::updatePart(AttributeStringArrayPtr &aPartsAttr, // append names of all parts std::list aSubFeatures = aDoc->allFeatures(); - for (std::list::iterator aFIt = aSubFeatures.begin(); - aFIt != aSubFeatures.end(); ++aFIt) { - if ((*aFIt)->getKind() == PartSetPlugin_Part::ID()) - anAcceptedValues.push_back((*aFIt)->name()); + for (auto &aSubFeature : aSubFeatures) { + if (aSubFeature->getKind() == PartSetPlugin_Part::ID()) + anAcceptedValues.push_back(aSubFeature->name()); } if ((size_t)aPartsAttr->size() != anAcceptedValues.size()) aTargetAttr->setValue(0); aPartsAttr->setSize((int)anAcceptedValues.size()); - std::list::iterator anIt = anAcceptedValues.begin(); + auto anIt = anAcceptedValues.begin(); for (int anInd = 0; anIt != anAcceptedValues.end(); ++anIt, ++anInd) aPartsAttr->setValue(anInd, Locale::Convert::toString(*anIt)); } else { diff --git a/src/ExchangePlugin/ExchangePlugin_Import.h b/src/ExchangePlugin/ExchangePlugin_Import.h index b897c9123..0ada4a1d6 100644 --- a/src/ExchangePlugin/ExchangePlugin_Import.h +++ b/src/ExchangePlugin/ExchangePlugin_Import.h @@ -56,26 +56,26 @@ public: /// Default constructor EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportBase() = default; /// Default destructor - EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportBase() = default; + EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_ImportBase() override = default; /// Request for initialization of data model of the feature: adding all /// attributes - EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); + EXCHANGEPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - EXCHANGEPLUGIN_EXPORT virtual void - attributeChanged(const std::string &theID) = 0; + EXCHANGEPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override = 0; /// Computes or recomputes the results - EXCHANGEPLUGIN_EXPORT virtual void execute() = 0; + EXCHANGEPLUGIN_EXPORT void execute() override = 0; /// Returns true if this feature is used as macro: creates other features and /// then removed. - EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; } + EXCHANGEPLUGIN_EXPORT bool isMacro() const override { return true; } /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. - EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + EXCHANGEPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } protected: EXCHANGEPLUGIN_EXPORT void updatePart(AttributeStringArrayPtr &aPartsAttr, @@ -129,22 +129,22 @@ public: /// Default constructor EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import() = default; /// Default destructor - EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import() = default; + EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_Import() override = default; /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() override { + EXCHANGEPLUGIN_EXPORT const std::string &getKind() override { return ExchangePlugin_Import::ID(); } /// Computes or recomputes the results - EXCHANGEPLUGIN_EXPORT virtual void execute() override; + EXCHANGEPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); + EXCHANGEPLUGIN_EXPORT void initAttributes() override; // Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - EXCHANGEPLUGIN_EXPORT virtual void + EXCHANGEPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; }; @@ -159,19 +159,19 @@ public: /// Default constructor EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import_Image() = default; /// Default destructor - EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import_Image() = default; + EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_Import_Image() override = default; /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() override { + EXCHANGEPLUGIN_EXPORT const std::string &getKind() override { return ExchangePlugin_Import_Image::ID(); } /// Computes or recomputes the results - EXCHANGEPLUGIN_EXPORT virtual void execute() override; + EXCHANGEPLUGIN_EXPORT void execute() override; // Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - EXCHANGEPLUGIN_EXPORT virtual void + EXCHANGEPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; }; diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index 2b6a73650..f3d469f45 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -213,7 +213,7 @@ void ExchangePlugin_ImportFeature::importFile(const std::string &theFileName) { // Remove previous groups/fields stored in RefList std::list anGroupList = aRefListOfGroups->list(); - std::list::iterator anGroupIt = anGroupList.begin(); + auto anGroupIt = anGroupList.begin(); for (; anGroupIt != anGroupList.end(); ++anGroupIt) { std::shared_ptr aFeature = ModelAPI_Feature::feature(*anGroupIt); @@ -273,9 +273,8 @@ void ExchangePlugin_ImportFeature::setColorGroups( std::list allRes; ModelAPI_Tools::allSubs(theResultBody, allRes); - for (std::list::iterator aRes = allRes.begin(); - aRes != allRes.end(); ++aRes) { - ModelAPI_Tools::getColor(*aRes, aColor); + for (auto &allRe : allRes) { + ModelAPI_Tools::getColor(allRe, aColor); if (!aColor.empty()) { auto it = std::find(aColorsRead.begin(), aColorsRead.end(), aColor); if (it == aColorsRead.end()) { @@ -313,13 +312,12 @@ void ExchangePlugin_ImportFeature::setColorGroup( // add element with the same color std::list allRes; ModelAPI_Tools::allSubs(theResultBody, allRes); - for (std::list::iterator aRes = allRes.begin(); - aRes != allRes.end(); ++aRes) { - ModelAPI_Tools::getColor(*aRes, aColor); - GeomShapePtr aShape = (*aRes)->shape(); + for (auto &allRe : allRes) { + ModelAPI_Tools::getColor(allRe, aColor); + GeomShapePtr aShape = allRe->shape(); if (!aColor.empty()) { - if (aRes->get() && aColor == theColor) { + if (allRe.get() && aColor == theColor) { if (aShape->isCompound() || aShape->isCompSolid()) { GeomAPI_ShapeIterator anIt(aShape); for (; anIt.more(); anIt.next()) { @@ -362,13 +360,11 @@ void ExchangePlugin_ImportFeature::setMaterielGroup( std::list allRes; ModelAPI_Tools::allSubs(theResultBody, allRes); - for (std::list::iterator aRes = allRes.begin(); - aRes != allRes.end(); ++aRes) { + for (auto &allRe : allRes) { - GeomShapePtr aShape = (*aRes)->shape(); - for (std::list::iterator aResMat = anIt->second.begin(); - aResMat != anIt->second.end(); ++aResMat) { - if (aRes->get() && ((*aRes)->data()->name() == (*aResMat))) { + GeomShapePtr aShape = allRe->shape(); + for (auto &aResMat : anIt->second) { + if (allRe.get() && (allRe->data()->name() == aResMat)) { if (aShape->isCompound() || aShape->isCompSolid()) { GeomAPI_ShapeIterator aShapeIt(aShape); for (; aShapeIt.more(); aShapeIt.next()) { @@ -434,7 +430,7 @@ void ExchangePlugin_ImportFeature::importXAO(const std::string &theFileName, // Remove previous groups/fields stored in RefList std::list anGroupList = aRefListOfGroups->list(); - std::list::iterator anGroupIt = anGroupList.begin(); + auto anGroupIt = anGroupList.begin(); for (; anGroupIt != anGroupList.end(); ++anGroupIt) { std::shared_ptr aFeature = ModelAPI_Feature::feature(*anGroupIt); @@ -500,7 +496,7 @@ void ExchangePlugin_ImportFeature::importXAO(const std::string &theFileName, // limitation: now in XAO fields are related to everything, so, iterate // all sub-shapes to fill int aCountSelected = aXaoField->countElements(); - std::list::const_iterator aResIter = results().begin(); + auto aResIter = results().begin(); for (; aResIter != results().end() && aCountSelected; aResIter++) { ResultBodyPtr aBody = std::dynamic_pointer_cast(*aResIter); @@ -544,7 +540,7 @@ void ExchangePlugin_ImportFeature::importXAO(const std::string &theFileName, aXaoField->countComponents(), aXaoField->countSteps()); aTables->setType(aType); // iterate steps - XAO::stepIterator aStepIter = aXaoField->begin(); + auto aStepIter = aXaoField->begin(); for (int aStepIndex = 0; aStepIter != aXaoField->end(); aStepIter++, aStepIndex++) { aStamps->setValue(aStepIndex, (*aStepIter)->getStamp()); @@ -742,7 +738,7 @@ void ExchangePlugin_Import_ImageFeature::importFile( // Store image in result body attribute AttributeImagePtr anImageAttr = resultBody->data()->image(ModelAPI_ResultBody::IMAGE_ID()); - if (anImageAttr.get() != NULL) { + if (anImageAttr.get() != nullptr) { QImage aQImage = px.toImage(); const uchar *aImageBytes = aQImage.bits(); std::list aByteArray(aImageBytes, diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.h b/src/ExchangePlugin/ExchangePlugin_ImportFeature.h index 7d55f9b19..607e61273 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.h +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.h @@ -56,39 +56,39 @@ public: /// Default constructor EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeatureBase() = default; /// Default destructor - EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeatureBase() = default; + EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_ImportFeatureBase() override = default; /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() = 0; + EXCHANGEPLUGIN_EXPORT const std::string &getKind() override = 0; /// Request for initialization of data model of the feature: adding all /// attributes - EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); + EXCHANGEPLUGIN_EXPORT void initAttributes() override; /// Computes or recomputes the results - EXCHANGEPLUGIN_EXPORT virtual void execute() = 0; + EXCHANGEPLUGIN_EXPORT void execute() override = 0; /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. - EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + EXCHANGEPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } /// Reimplemented from ModelAPI_CompositeFeature::addFeature() - virtual std::shared_ptr addFeature(std::string theID); + std::shared_ptr addFeature(std::string theID) override; /// Reimplemented from ModelAPI_CompositeFeature::numberOfSubs() - virtual int numberOfSubs(bool forTree = false) const; + int numberOfSubs(bool forTree = false) const override; /// Reimplemented from ModelAPI_CompositeFeature::subFeature() - virtual std::shared_ptr subFeature(const int theIndex, - bool forTree = false); + std::shared_ptr subFeature(const int theIndex, + bool forTree = false) override; /// Reimplemented from ModelAPI_CompositeFeature::subFeatureId() - virtual int subFeatureId(const int theIndex) const; + int subFeatureId(const int theIndex) const override; /// Reimplemented from ModelAPI_CompositeFeature::isSub() - virtual bool isSub(ObjectPtr theObject) const; + bool isSub(ObjectPtr theObject) const override; /// Reimplemented from ModelAPI_CompositeFeature::removeFeature() - virtual void removeFeature(std::shared_ptr theFeature); + void removeFeature(std::shared_ptr theFeature) override; protected: /// Performs the import of the file @@ -125,7 +125,7 @@ public: /// Default constructor EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature() = default; /// Default destructor - EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature() = default; + EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_ImportFeature() override = default; /// attribute name of step Scale to International System Units inline static const std::string &STEP_SCALE_INTER_UNITS_ID() { @@ -149,19 +149,19 @@ public: return MY_MEMORY_BUFFER_ID; } /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() override { + EXCHANGEPLUGIN_EXPORT const std::string &getKind() override { return ExchangePlugin_ImportFeature::ID(); } /// Computes or recomputes the results - EXCHANGEPLUGIN_EXPORT virtual void execute() override; + EXCHANGEPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); + EXCHANGEPLUGIN_EXPORT void initAttributes() override; /// Return false in case of XAOMem import. - EXCHANGEPLUGIN_EXPORT virtual bool isEditable(); + EXCHANGEPLUGIN_EXPORT bool isEditable() override; protected: /// Performs the import of the file @@ -200,15 +200,16 @@ public: /// Default constructor EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import_ImageFeature() = default; /// Default destructor - EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import_ImageFeature() = default; + EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_Import_ImageFeature() override = + default; /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() override { + EXCHANGEPLUGIN_EXPORT const std::string &getKind() override { return ExchangePlugin_Import_ImageFeature::ID(); } /// Computes or recomputes the results - EXCHANGEPLUGIN_EXPORT virtual void execute() override; + EXCHANGEPLUGIN_EXPORT void execute() override; protected: /// Performs the import of the file diff --git a/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp b/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp index bfa4a64ae..fa6a74d26 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp @@ -45,7 +45,7 @@ static void correntNonUniqueNames(DocumentPtr theDocument, static DocumentPtr findDocument(DocumentPtr thePartSetDoc, const std::string &thePartName); -ExchangePlugin_ImportPart::ExchangePlugin_ImportPart() {} +ExchangePlugin_ImportPart::ExchangePlugin_ImportPart() = default; void ExchangePlugin_ImportPart::initAttributes() { data()->addAttribute(FILE_PATH_ID(), ModelAPI_AttributeString::typeId()); @@ -101,18 +101,17 @@ void ExchangePlugin_ImportPart::attributeChanged(const std::string &theID) { // append names of all parts std::list aSubFeatures = aDoc->allFeatures(); - for (std::list::iterator aFIt = aSubFeatures.begin(); - aFIt != aSubFeatures.end(); ++aFIt) { - if ((*aFIt)->getKind() == PartSetPlugin_Part::ID()) + for (auto &aSubFeature : aSubFeatures) { + if (aSubFeature->getKind() == PartSetPlugin_Part::ID()) anAcceptedValues.push_back( - Locale::Convert::toString((*aFIt)->name())); + Locale::Convert::toString(aSubFeature->name())); } if ((size_t)aPartsAttr->size() != anAcceptedValues.size()) aTargetAttr->setValue(0); aPartsAttr->setSize((int)anAcceptedValues.size()); - std::list::iterator anIt = anAcceptedValues.begin(); + auto anIt = anAcceptedValues.begin(); for (int anInd = 0; anIt != anAcceptedValues.end(); ++anIt, ++anInd) aPartsAttr->setValue(anInd, *anIt); } else { @@ -148,11 +147,10 @@ DocumentPtr findDocument(DocumentPtr thePartSetDoc, } else { // find existing part by its name std::list aSubFeatures = thePartSetDoc->allFeatures(); - for (std::list::iterator aFIt = aSubFeatures.begin(); - aFIt != aSubFeatures.end(); ++aFIt) { - if ((*aFIt)->getKind() == PartSetPlugin_Part::ID() && - Locale::Convert::toString((*aFIt)->name()) == thePartName) { - aPartFeature = *aFIt; + for (auto &aSubFeature : aSubFeatures) { + if (aSubFeature->getKind() == PartSetPlugin_Part::ID() && + Locale::Convert::toString(aSubFeature->name()) == thePartName) { + aPartFeature = aSubFeature; break; } } @@ -206,8 +204,8 @@ static void collectOldNames(DocumentPtr theDocument, std::list &theAvoided, ObjectNameMap &theIndexedNames) { std::list anAllFeatures = theDocument->allFeatures(); - std::list::iterator aFIt = anAllFeatures.begin(); - std::list::iterator anAvoidIt = theAvoided.begin(); + auto aFIt = anAllFeatures.begin(); + auto anAvoidIt = theAvoided.begin(); for (; aFIt != anAllFeatures.end(); ++aFIt) { if (anAvoidIt != theAvoided.end() && *aFIt == *anAvoidIt) { // skip this feature @@ -219,9 +217,8 @@ static void collectOldNames(DocumentPtr theDocument, addIndexedName(*aFIt, theIndexedNames); // store names of results const std::list &aResults = (*aFIt)->results(); - for (std::list::const_iterator aRIt = aResults.begin(); - aRIt != aResults.end(); ++aRIt) - addIndexedName(*aRIt, theIndexedNames); + for (const auto &aResult : aResults) + addIndexedName(aResult, theIndexedNames); } } @@ -232,7 +229,7 @@ static std::wstring uniqueName(const ObjectPtr &theObject, int anIndex = 1; splitName(aName, anIndex); - ObjectNameMap::iterator aFoundGroup = theExistingNames.find(aGroup); + auto aFoundGroup = theExistingNames.find(aGroup); bool isUnique = aFoundGroup == theExistingNames.end(); std::map>::iterator aFound; @@ -247,7 +244,7 @@ static std::wstring uniqueName(const ObjectPtr &theObject, addIndexedName(theObject, theExistingNames); } else { // search the appropriate index - std::set::iterator aFoundIndex = aFound->second.find(anIndex); + auto aFoundIndex = aFound->second.find(anIndex); for (; aFoundIndex != aFound->second.end(); ++aFoundIndex, ++anIndex) if (anIndex != *aFoundIndex) break; @@ -267,17 +264,15 @@ void correntNonUniqueNames(DocumentPtr theDocument, ObjectNameMap aNames; collectOldNames(theDocument, theImported, aNames); - for (std::list::iterator anIt = theImported.begin(); - anIt != theImported.end(); ++anIt) { + for (auto &anIt : theImported) { // update name of feature - std::wstring aNewName = uniqueName(*anIt, aNames); - (*anIt)->data()->setName(aNewName); + std::wstring aNewName = uniqueName(anIt, aNames); + anIt->data()->setName(aNewName); // update names of results - const std::list &aResults = (*anIt)->results(); - for (std::list::const_iterator aRIt = aResults.begin(); - aRIt != aResults.end(); ++aRIt) { - aNewName = uniqueName(*aRIt, aNames); - (*aRIt)->data()->setName(aNewName); + const std::list &aResults = anIt->results(); + for (const auto &aResult : aResults) { + aNewName = uniqueName(aResult, aNames); + aResult->data()->setName(aNewName); } } } diff --git a/src/ExchangePlugin/ExchangePlugin_ImportPart.h b/src/ExchangePlugin/ExchangePlugin_ImportPart.h index 123043579..6374b8a56 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportPart.h +++ b/src/ExchangePlugin/ExchangePlugin_ImportPart.h @@ -55,27 +55,28 @@ public: ExchangePlugin_ImportPart(); /// Returns the unique kind of a feature - EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() { + EXCHANGEPLUGIN_EXPORT const std::string &getKind() override { return ExchangePlugin_ImportPart::ID(); } /// Request for initialization of data model of the feature: adding all /// attributes - EXCHANGEPLUGIN_EXPORT virtual void initAttributes(); + EXCHANGEPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + EXCHANGEPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Computes or recomputes the results - EXCHANGEPLUGIN_EXPORT virtual void execute(); + EXCHANGEPLUGIN_EXPORT void execute() override; /// Returns true if this feature is used as macro: creates other features and /// then removed. - EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; } + EXCHANGEPLUGIN_EXPORT bool isMacro() const override { return true; } /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. - EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + EXCHANGEPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } }; #endif /* EXCHANGEPLUGIN_IMPORTPART_H_ */ diff --git a/src/ExchangePlugin/ExchangePlugin_Plugin.h b/src/ExchangePlugin/ExchangePlugin_Plugin.h index 0a139c81e..c9602071d 100644 --- a/src/ExchangePlugin/ExchangePlugin_Plugin.h +++ b/src/ExchangePlugin/ExchangePlugin_Plugin.h @@ -33,7 +33,7 @@ class EXCHANGEPLUGIN_EXPORT ExchangePlugin_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - virtual FeaturePtr createFeature(std::string theFeatureID); + FeaturePtr createFeature(std::string theFeatureID) override; public: ExchangePlugin_Plugin(); diff --git a/src/ExchangePlugin/ExchangePlugin_Validators.cpp b/src/ExchangePlugin/ExchangePlugin_Validators.cpp index e5935942a..6a41060a8 100644 --- a/src/ExchangePlugin/ExchangePlugin_Validators.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Validators.cpp @@ -37,7 +37,7 @@ bool ExchangePlugin_FormatValidator::parseFormats( const std::list &theArguments, std::list &outFormats) { - std::list::const_iterator it = theArguments.begin(); + auto it = theArguments.begin(); bool result = true; for (; it != theArguments.end(); ++it) { std::string anArg = *it; diff --git a/src/ExchangePlugin/ExchangePlugin_Validators.h b/src/ExchangePlugin/ExchangePlugin_Validators.h index 96be13a0c..a0b5d916b 100644 --- a/src/ExchangePlugin/ExchangePlugin_Validators.h +++ b/src/ExchangePlugin/ExchangePlugin_Validators.h @@ -47,9 +47,9 @@ public: * Returns true is the file-name attribute correctly corresponds to the set of * allowed formats. */ - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /** @@ -79,9 +79,9 @@ public: /// \param[in] theAttribute an attribute to check /// \param[in] theArguments a filter parameters /// \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp index 1fdabbed3..d117582df 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp @@ -84,7 +84,7 @@ FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon( } //================================================================================================== -FeaturesAPI_BooleanCommon::~FeaturesAPI_BooleanCommon() {} +FeaturesAPI_BooleanCommon::~FeaturesAPI_BooleanCommon() = default; //================================================================================================== void FeaturesAPI_BooleanCommon::setMainObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h index bc5222b95..6d092c4bc 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h @@ -59,7 +59,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_BooleanCommon(); + ~FeaturesAPI_BooleanCommon() override; INTERFACE_5(FeaturesPlugin_BooleanCommon::ID(), creationMethod, FeaturesPlugin_BooleanCommon::CREATION_METHOD(), @@ -96,7 +96,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Boolean object. diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp index d6d98a987..951921983 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp @@ -58,7 +58,7 @@ FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut( } //================================================================================================== -FeaturesAPI_BooleanCut::~FeaturesAPI_BooleanCut() {} +FeaturesAPI_BooleanCut::~FeaturesAPI_BooleanCut() = default; //================================================================================================== void FeaturesAPI_BooleanCut::setMainObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCut.h b/src/FeaturesAPI/FeaturesAPI_BooleanCut.h index 47b3aaeb3..4e536a8d9 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanCut.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanCut.h @@ -52,7 +52,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_BooleanCut(); + ~FeaturesAPI_BooleanCut() override; INTERFACE_4(FeaturesPlugin_BooleanCut::ID(), mainObjects, FeaturesPlugin_BooleanCut::OBJECT_LIST_ID(), @@ -83,7 +83,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Boolean object. diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp index 38caf1c46..106304491 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp @@ -58,7 +58,7 @@ FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill( } //================================================================================================== -FeaturesAPI_BooleanFill::~FeaturesAPI_BooleanFill() {} +FeaturesAPI_BooleanFill::~FeaturesAPI_BooleanFill() = default; //================================================================================================== void FeaturesAPI_BooleanFill::setMainObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFill.h b/src/FeaturesAPI/FeaturesAPI_BooleanFill.h index f3f913220..c1f953691 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFill.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFill.h @@ -52,7 +52,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_BooleanFill(); + ~FeaturesAPI_BooleanFill() override; INTERFACE_4(FeaturesPlugin_BooleanFill::ID(), mainObjects, FeaturesPlugin_BooleanFill::OBJECT_LIST_ID(), @@ -83,7 +83,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Boolean object. diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp index 4b989d0a9..5343ce023 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp @@ -86,7 +86,7 @@ FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse( } //================================================================================================== -FeaturesAPI_BooleanFuse::~FeaturesAPI_BooleanFuse() {} +FeaturesAPI_BooleanFuse::~FeaturesAPI_BooleanFuse() = default; //================================================================================================== void FeaturesAPI_BooleanFuse::setMainObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h index c91e952a7..16d575a64 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h @@ -61,7 +61,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_BooleanFuse(); + ~FeaturesAPI_BooleanFuse() override; INTERFACE_6(FeaturesPlugin_BooleanFuse::ID(), creationMethod, FeaturesPlugin_BooleanFuse::CREATION_METHOD(), @@ -104,7 +104,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Boolean object. diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp index b03f187de..de1ce0181 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp @@ -58,7 +58,7 @@ FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash( } //================================================================================================== -FeaturesAPI_BooleanSmash::~FeaturesAPI_BooleanSmash() {} +FeaturesAPI_BooleanSmash::~FeaturesAPI_BooleanSmash() = default; //================================================================================================== void FeaturesAPI_BooleanSmash::setMainObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h index 0837d4d74..8bc8f30c8 100644 --- a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h +++ b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h @@ -52,7 +52,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_BooleanSmash(); + ~FeaturesAPI_BooleanSmash() override; INTERFACE_4(FeaturesPlugin_BooleanSmash::ID(), mainObjects, FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID(), @@ -83,7 +83,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Boolean object. diff --git a/src/FeaturesAPI/FeaturesAPI_BoundingBox.cpp b/src/FeaturesAPI/FeaturesAPI_BoundingBox.cpp index e629ae671..476bfd528 100644 --- a/src/FeaturesAPI/FeaturesAPI_BoundingBox.cpp +++ b/src/FeaturesAPI/FeaturesAPI_BoundingBox.cpp @@ -48,7 +48,7 @@ FeaturesAPI_BoundingBox::FeaturesAPI_BoundingBox( } //================================================================================================= -FeaturesAPI_BoundingBox::~FeaturesAPI_BoundingBox() {} +FeaturesAPI_BoundingBox::~FeaturesAPI_BoundingBox() = default; //================================================================================================= void FeaturesAPI_BoundingBox::dump(ModelHighAPI_Dumper &theDumper) const { diff --git a/src/FeaturesAPI/FeaturesAPI_BoundingBox.h b/src/FeaturesAPI/FeaturesAPI_BoundingBox.h index 737001dfd..839044447 100644 --- a/src/FeaturesAPI/FeaturesAPI_BoundingBox.h +++ b/src/FeaturesAPI/FeaturesAPI_BoundingBox.h @@ -50,7 +50,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_BoundingBox(); + ~FeaturesAPI_BoundingBox() override; INTERFACE_1(FeaturesPlugin_BoundingBox::ID(), objectSelected, FeaturesPlugin_BoundingBox::OBJECT_ID(), @@ -59,7 +59,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on the NormalToface object. diff --git a/src/FeaturesAPI/FeaturesAPI_Chamfer.cpp b/src/FeaturesAPI/FeaturesAPI_Chamfer.cpp index f067a3795..79fcf01cc 100644 --- a/src/FeaturesAPI/FeaturesAPI_Chamfer.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Chamfer.cpp @@ -54,7 +54,7 @@ FeaturesAPI_Chamfer::FeaturesAPI_Chamfer( } } -FeaturesAPI_Chamfer::~FeaturesAPI_Chamfer() {} +FeaturesAPI_Chamfer::~FeaturesAPI_Chamfer() = default; //================================================================================================== void FeaturesAPI_Chamfer::setBase( diff --git a/src/FeaturesAPI/FeaturesAPI_Chamfer.h b/src/FeaturesAPI/FeaturesAPI_Chamfer.h index 45cc3c20b..b846e0681 100644 --- a/src/FeaturesAPI/FeaturesAPI_Chamfer.h +++ b/src/FeaturesAPI/FeaturesAPI_Chamfer.h @@ -51,7 +51,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Chamfer(); + ~FeaturesAPI_Chamfer() override; INTERFACE_6(FeaturesPlugin_Chamfer::ID(), creationMethod, FeaturesPlugin_Chamfer::CREATION_METHOD(), @@ -85,7 +85,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; private: void execIfBaseNotEmpty(); diff --git a/src/FeaturesAPI/FeaturesAPI_Copy.cpp b/src/FeaturesAPI/FeaturesAPI_Copy.cpp index b9406b79e..9f8499e42 100644 --- a/src/FeaturesAPI/FeaturesAPI_Copy.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Copy.cpp @@ -42,7 +42,7 @@ FeaturesAPI_Copy::FeaturesAPI_Copy( } //================================================================================================ -FeaturesAPI_Copy::~FeaturesAPI_Copy() {} +FeaturesAPI_Copy::~FeaturesAPI_Copy() = default; //================================================================================================= void FeaturesAPI_Copy::setObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_Copy.h b/src/FeaturesAPI/FeaturesAPI_Copy.h index 683d96aa7..09462cd6d 100644 --- a/src/FeaturesAPI/FeaturesAPI_Copy.h +++ b/src/FeaturesAPI/FeaturesAPI_Copy.h @@ -49,7 +49,7 @@ public: const int theNumber); /// Destructor. - FEATURESAPI_EXPORT virtual ~FeaturesAPI_Copy(); + FEATURESAPI_EXPORT ~FeaturesAPI_Copy() override; INTERFACE_2(FeaturesPlugin_Copy::ID(), objects, FeaturesPlugin_Copy::OBJECTS(), ModelAPI_AttributeSelectionList, @@ -65,7 +65,7 @@ public: FEATURESAPI_EXPORT void setNumber(const int theNumber); /// Dump wrapped feature - FEATURESAPI_EXPORT virtual void dump(ModelHighAPI_Dumper &theDumper) const; + FEATURESAPI_EXPORT void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Copy object. diff --git a/src/FeaturesAPI/FeaturesAPI_Defeaturing.cpp b/src/FeaturesAPI/FeaturesAPI_Defeaturing.cpp index 13966c878..7ed1d5400 100644 --- a/src/FeaturesAPI/FeaturesAPI_Defeaturing.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Defeaturing.cpp @@ -37,7 +37,7 @@ FeaturesAPI_Defeaturing::FeaturesAPI_Defeaturing( setFaces(theFacesToRemove); } -FeaturesAPI_Defeaturing::~FeaturesAPI_Defeaturing() {} +FeaturesAPI_Defeaturing::~FeaturesAPI_Defeaturing() = default; void FeaturesAPI_Defeaturing::setFaces( const std::list &theFacesToRemove) { diff --git a/src/FeaturesAPI/FeaturesAPI_Defeaturing.h b/src/FeaturesAPI/FeaturesAPI_Defeaturing.h index 9df51a1ea..4670b0872 100644 --- a/src/FeaturesAPI/FeaturesAPI_Defeaturing.h +++ b/src/FeaturesAPI/FeaturesAPI_Defeaturing.h @@ -48,7 +48,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Defeaturing(); + ~FeaturesAPI_Defeaturing() override; INTERFACE_1(FeaturesPlugin_Defeaturing::ID(), baseObjects, FeaturesPlugin_Defeaturing::OBJECT_LIST_ID(), @@ -61,7 +61,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; private: void execIfBaseNotEmpty(); diff --git a/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp b/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp index 461713249..0e1587c06 100644 --- a/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Extrusion.cpp @@ -124,7 +124,7 @@ FeaturesAPI_Extrusion::FeaturesAPI_Extrusion( } //================================================================================================== -FeaturesAPI_Extrusion::~FeaturesAPI_Extrusion() {} +FeaturesAPI_Extrusion::~FeaturesAPI_Extrusion() = default; //================================================================================================== void FeaturesAPI_Extrusion::setNestedSketch( diff --git a/src/FeaturesAPI/FeaturesAPI_Extrusion.h b/src/FeaturesAPI/FeaturesAPI_Extrusion.h index 820aec6e5..e6ce7b87c 100644 --- a/src/FeaturesAPI/FeaturesAPI_Extrusion.h +++ b/src/FeaturesAPI/FeaturesAPI_Extrusion.h @@ -98,7 +98,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Extrusion(); + ~FeaturesAPI_Extrusion() override; INTERFACE_10( FeaturesPlugin_Extrusion::ID(), sketch, @@ -151,7 +151,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; private: void execIfBaseNotEmpty(); diff --git a/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.cpp b/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.cpp index e60fb1f98..0a06c0268 100644 --- a/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.cpp +++ b/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.cpp @@ -31,7 +31,7 @@ FeaturesAPI_ExtrusionBoolean::FeaturesAPI_ExtrusionBoolean( : ModelHighAPI_Interface(theFeature) {} //================================================================================================== -FeaturesAPI_ExtrusionBoolean::~FeaturesAPI_ExtrusionBoolean() {} +FeaturesAPI_ExtrusionBoolean::~FeaturesAPI_ExtrusionBoolean() = default; //================================================================================================== void FeaturesAPI_ExtrusionBoolean::setNestedSketch( diff --git a/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.h b/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.h index a60e6b1c9..111b9fa1f 100644 --- a/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.h +++ b/src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.h @@ -40,7 +40,7 @@ class FeaturesAPI_ExtrusionBoolean : public ModelHighAPI_Interface { public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_ExtrusionBoolean(); + ~FeaturesAPI_ExtrusionBoolean() override; INTERFACE_11("", sketch, FeaturesPlugin_Extrusion::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch launcher */, baseObjects, @@ -102,7 +102,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; protected: /// Constructor without values. @@ -120,7 +120,7 @@ private: class FeaturesAPI_ExtrusionCut : public FeaturesAPI_ExtrusionBoolean { public: static std::string ID() { return FeaturesPlugin_ExtrusionCut::ID(); } - virtual std::string getID() { return ID(); } + std::string getID() override { return ID(); } // FEATURESAPI_EXPORT // virtual std::string getID() { @@ -298,7 +298,7 @@ addExtrusionCut(const std::shared_ptr &thePart, class FeaturesAPI_ExtrusionFuse : public FeaturesAPI_ExtrusionBoolean { public: static std::string ID() { return FeaturesPlugin_ExtrusionFuse::ID(); } - virtual std::string getID() { return ID(); } + std::string getID() override { return ID(); } /// Constructor without values. FEATURESAPI_EXPORT @@ -381,7 +381,7 @@ public: }; /// Pointer on ExtrusionFuse object. -typedef std::shared_ptr ExtrusionFusePtr; +using ExtrusionFusePtr = std::shared_ptr; /// \ingroup CPPHighAPI /// \brief Create ExtrusionFuse feature. diff --git a/src/FeaturesAPI/FeaturesAPI_Fillet.cpp b/src/FeaturesAPI/FeaturesAPI_Fillet.cpp index bb282bb7b..9c557eadb 100644 --- a/src/FeaturesAPI/FeaturesAPI_Fillet.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Fillet.cpp @@ -59,7 +59,7 @@ FeaturesAPI_Fillet1D::FeaturesAPI_Fillet1D( } } -FeaturesAPI_Fillet1D::~FeaturesAPI_Fillet1D() {} +FeaturesAPI_Fillet1D::~FeaturesAPI_Fillet1D() = default; void FeaturesAPI_Fillet1D::setBase( const std::list &theBaseObjects) { @@ -154,7 +154,7 @@ FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D( } } -FeaturesAPI_Fillet2D::~FeaturesAPI_Fillet2D() {} +FeaturesAPI_Fillet2D::~FeaturesAPI_Fillet2D() = default; void FeaturesAPI_Fillet2D::setBase( const std::list &theBaseObjects) { diff --git a/src/FeaturesAPI/FeaturesAPI_Fillet.h b/src/FeaturesAPI/FeaturesAPI_Fillet.h index ad9964c21..b01b8e2dc 100644 --- a/src/FeaturesAPI/FeaturesAPI_Fillet.h +++ b/src/FeaturesAPI/FeaturesAPI_Fillet.h @@ -38,7 +38,7 @@ class ModelHighAPI_Selection; class FeaturesAPI_Fillet : public ModelHighAPI_Interface { public: /// Destructor. - virtual ~FeaturesAPI_Fillet() {} + ~FeaturesAPI_Fillet() override = default; virtual std::shared_ptr radius() const = 0; @@ -75,7 +75,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Fillet1D(); + ~FeaturesAPI_Fillet1D() override; INTERFACE_4(FeaturesPlugin_Fillet1D::ID(), creationMethod, FeaturesPlugin_Fillet1D::CREATION_METHOD(), @@ -92,15 +92,16 @@ public: /// Modify base objects of the fillet. FEATURESAPI_EXPORT - virtual void setBase(const std::list &theBaseObjects); + void + setBase(const std::list &theBaseObjects) override; /// Modify fillet to have fixed radius FEATURESAPI_EXPORT - virtual void setRadius(const ModelHighAPI_Double &theRadius); + void setRadius(const ModelHighAPI_Double &theRadius) override; /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; private: void execIfBaseNotEmpty(); @@ -133,7 +134,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Fillet2D(); + ~FeaturesAPI_Fillet2D() override; INTERFACE_5(FeaturesPlugin_Fillet::ID(), creationMethod, FeaturesPlugin_Fillet::CREATION_METHOD(), @@ -152,11 +153,12 @@ public: /// Modify base objects of the fillet. FEATURESAPI_EXPORT - virtual void setBase(const std::list &theBaseObjects); + void + setBase(const std::list &theBaseObjects) override; /// Modify fillet to have fixed radius FEATURESAPI_EXPORT - virtual void setRadius(const ModelHighAPI_Double &theRadius); + void setRadius(const ModelHighAPI_Double &theRadius) override; /// Modify fillet to have varying radius FEATURESAPI_EXPORT @@ -165,7 +167,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; private: void execIfBaseNotEmpty(); diff --git a/src/FeaturesAPI/FeaturesAPI_FusionFaces.cpp b/src/FeaturesAPI/FeaturesAPI_FusionFaces.cpp index 5589c3679..e13856ff6 100644 --- a/src/FeaturesAPI/FeaturesAPI_FusionFaces.cpp +++ b/src/FeaturesAPI/FeaturesAPI_FusionFaces.cpp @@ -41,7 +41,7 @@ FeaturesAPI_FusionFaces::FeaturesAPI_FusionFaces( } //================================================================================================== -FeaturesAPI_FusionFaces::~FeaturesAPI_FusionFaces() {} +FeaturesAPI_FusionFaces::~FeaturesAPI_FusionFaces() = default; //================================================================================================== void FeaturesAPI_FusionFaces::setBase(const ModelHighAPI_Selection &theBase) { diff --git a/src/FeaturesAPI/FeaturesAPI_FusionFaces.h b/src/FeaturesAPI/FeaturesAPI_FusionFaces.h index b82aaa190..3a40ed5d0 100644 --- a/src/FeaturesAPI/FeaturesAPI_FusionFaces.h +++ b/src/FeaturesAPI/FeaturesAPI_FusionFaces.h @@ -49,7 +49,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_FusionFaces(); + ~FeaturesAPI_FusionFaces() override; INTERFACE_1(FeaturesPlugin_FusionFaces::ID(), base, FeaturesPlugin_FusionFaces::BASE_SHAPE_ID(), @@ -62,7 +62,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on FusionFaces object. diff --git a/src/FeaturesAPI/FeaturesAPI_GlueFaces.cpp b/src/FeaturesAPI/FeaturesAPI_GlueFaces.cpp index 2166dabd3..4c3f17c39 100644 --- a/src/FeaturesAPI/FeaturesAPI_GlueFaces.cpp +++ b/src/FeaturesAPI/FeaturesAPI_GlueFaces.cpp @@ -45,7 +45,7 @@ FeaturesAPI_GlueFaces::FeaturesAPI_GlueFaces( } //================================================================================================== -FeaturesAPI_GlueFaces::~FeaturesAPI_GlueFaces() {} +FeaturesAPI_GlueFaces::~FeaturesAPI_GlueFaces() = default; //================================================================================================== void FeaturesAPI_GlueFaces::setMainObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_GlueFaces.h b/src/FeaturesAPI/FeaturesAPI_GlueFaces.h index 2942fbc1d..a153ffed5 100644 --- a/src/FeaturesAPI/FeaturesAPI_GlueFaces.h +++ b/src/FeaturesAPI/FeaturesAPI_GlueFaces.h @@ -51,7 +51,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_GlueFaces(); + ~FeaturesAPI_GlueFaces() override; INTERFACE_3(FeaturesPlugin_GlueFaces::ID(), mainObjects, FeaturesPlugin_GlueFaces::OBJECTS_LIST_ID(), @@ -76,7 +76,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Glue Faces object. diff --git a/src/FeaturesAPI/FeaturesAPI_ImportResult.cpp b/src/FeaturesAPI/FeaturesAPI_ImportResult.cpp index cd5517494..33524c9e3 100644 --- a/src/FeaturesAPI/FeaturesAPI_ImportResult.cpp +++ b/src/FeaturesAPI/FeaturesAPI_ImportResult.cpp @@ -41,7 +41,7 @@ FeaturesAPI_ImportResult::FeaturesAPI_ImportResult( } //================================================================================================= -FeaturesAPI_ImportResult::~FeaturesAPI_ImportResult() {} +FeaturesAPI_ImportResult::~FeaturesAPI_ImportResult() = default; //================================================================================================= void FeaturesAPI_ImportResult::setObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_ImportResult.h b/src/FeaturesAPI/FeaturesAPI_ImportResult.h index a9e160732..3d2e05a3a 100644 --- a/src/FeaturesAPI/FeaturesAPI_ImportResult.h +++ b/src/FeaturesAPI/FeaturesAPI_ImportResult.h @@ -48,7 +48,7 @@ public: const std::list &theBaseObjects); /// Destructor. - FEATURESAPI_EXPORT virtual ~FeaturesAPI_ImportResult(); + FEATURESAPI_EXPORT ~FeaturesAPI_ImportResult() override; INTERFACE_1(FeaturesPlugin_ImportResult::ID(), objects, FeaturesPlugin_ImportResult::OBJECTS(), @@ -60,7 +60,7 @@ public: setObjects(const std::list &theBaseObjects); /// Dump wrapped feature - FEATURESAPI_EXPORT virtual void dump(ModelHighAPI_Dumper &theDumper) const; + FEATURESAPI_EXPORT void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on ImportResult object. diff --git a/src/FeaturesAPI/FeaturesAPI_Intersection.cpp b/src/FeaturesAPI/FeaturesAPI_Intersection.cpp index 056e4e698..678b8e60a 100644 --- a/src/FeaturesAPI/FeaturesAPI_Intersection.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Intersection.cpp @@ -55,7 +55,7 @@ FeaturesAPI_Intersection::FeaturesAPI_Intersection( } //================================================================================================== -FeaturesAPI_Intersection::~FeaturesAPI_Intersection() {} +FeaturesAPI_Intersection::~FeaturesAPI_Intersection() = default; //================================================================================================== void FeaturesAPI_Intersection::setObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_Intersection.h b/src/FeaturesAPI/FeaturesAPI_Intersection.h index 40810ac53..b1c62b5af 100644 --- a/src/FeaturesAPI/FeaturesAPI_Intersection.h +++ b/src/FeaturesAPI/FeaturesAPI_Intersection.h @@ -51,7 +51,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Intersection(); + ~FeaturesAPI_Intersection() override; INTERFACE_3(FeaturesPlugin_Intersection::ID(), objects, FeaturesPlugin_Intersection::OBJECT_LIST_ID(), @@ -76,7 +76,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Intersection object. diff --git a/src/FeaturesAPI/FeaturesAPI_LimitTolerance.cpp b/src/FeaturesAPI/FeaturesAPI_LimitTolerance.cpp index 3d80ac377..92d49f4f4 100644 --- a/src/FeaturesAPI/FeaturesAPI_LimitTolerance.cpp +++ b/src/FeaturesAPI/FeaturesAPI_LimitTolerance.cpp @@ -44,7 +44,7 @@ FeaturesAPI_LimitTolerance::FeaturesAPI_LimitTolerance( } //================================================================================================== -FeaturesAPI_LimitTolerance::~FeaturesAPI_LimitTolerance() {} +FeaturesAPI_LimitTolerance::~FeaturesAPI_LimitTolerance() = default; //================================================================================================== void FeaturesAPI_LimitTolerance::setMainObject( diff --git a/src/FeaturesAPI/FeaturesAPI_LimitTolerance.h b/src/FeaturesAPI/FeaturesAPI_LimitTolerance.h index b6388b75c..999a7e7d8 100644 --- a/src/FeaturesAPI/FeaturesAPI_LimitTolerance.h +++ b/src/FeaturesAPI/FeaturesAPI_LimitTolerance.h @@ -51,7 +51,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_LimitTolerance(); + ~FeaturesAPI_LimitTolerance() override; INTERFACE_2(FeaturesPlugin_LimitTolerance::ID(), mainObject, FeaturesPlugin_LimitTolerance::OBJECT_ID(), @@ -70,7 +70,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on LimitTolerance object. diff --git a/src/FeaturesAPI/FeaturesAPI_Loft.cpp b/src/FeaturesAPI/FeaturesAPI_Loft.cpp index 5b4454530..0e3031012 100644 --- a/src/FeaturesAPI/FeaturesAPI_Loft.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Loft.cpp @@ -44,7 +44,7 @@ FeaturesAPI_Loft::FeaturesAPI_Loft( } //================================================================================================== -FeaturesAPI_Loft::~FeaturesAPI_Loft() {} +FeaturesAPI_Loft::~FeaturesAPI_Loft() = default; //================================================================================================== void FeaturesAPI_Loft::dump(ModelHighAPI_Dumper &theDumper) const { diff --git a/src/FeaturesAPI/FeaturesAPI_Loft.h b/src/FeaturesAPI/FeaturesAPI_Loft.h index e64c23e6e..3d17df130 100644 --- a/src/FeaturesAPI/FeaturesAPI_Loft.h +++ b/src/FeaturesAPI/FeaturesAPI_Loft.h @@ -49,7 +49,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Loft(); + ~FeaturesAPI_Loft() override; INTERFACE_2(FeaturesPlugin_Loft::ID(), fisrstObject, FeaturesPlugin_Loft::FIRST_OBJECT_ID(), @@ -60,7 +60,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Loft object. diff --git a/src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp b/src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp index 073fc401d..0bfdc8a3d 100644 --- a/src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_MultiRotation.cpp @@ -68,7 +68,7 @@ FeaturesAPI_MultiRotation::FeaturesAPI_MultiRotation( } //================================================================================================== -FeaturesAPI_MultiRotation::~FeaturesAPI_MultiRotation() {} +FeaturesAPI_MultiRotation::~FeaturesAPI_MultiRotation() = default; //================================================================================================== void FeaturesAPI_MultiRotation::setMainObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_MultiRotation.h b/src/FeaturesAPI/FeaturesAPI_MultiRotation.h index 3bfe6c2b8..49185756e 100644 --- a/src/FeaturesAPI/FeaturesAPI_MultiRotation.h +++ b/src/FeaturesAPI/FeaturesAPI_MultiRotation.h @@ -65,7 +65,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_MultiRotation(); + ~FeaturesAPI_MultiRotation() override; INTERFACE_5(FeaturesPlugin_MultiRotation::ID(), mainObjects, FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID(), @@ -99,7 +99,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Multirotation object. diff --git a/src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp b/src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp index fbf8057c1..a4ba8b32d 100644 --- a/src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_MultiTranslation.cpp @@ -71,7 +71,7 @@ FeaturesAPI_MultiTranslation::FeaturesAPI_MultiTranslation( } //================================================================================================== -FeaturesAPI_MultiTranslation::~FeaturesAPI_MultiTranslation() {} +FeaturesAPI_MultiTranslation::~FeaturesAPI_MultiTranslation() = default; //================================================================================================== void FeaturesAPI_MultiTranslation::setMainObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_MultiTranslation.h b/src/FeaturesAPI/FeaturesAPI_MultiTranslation.h index 6336a8f8b..32d1278b2 100644 --- a/src/FeaturesAPI/FeaturesAPI_MultiTranslation.h +++ b/src/FeaturesAPI/FeaturesAPI_MultiTranslation.h @@ -66,7 +66,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_MultiTranslation(); + ~FeaturesAPI_MultiTranslation() override; INTERFACE_8(FeaturesPlugin_MultiTranslation::ID(), mainObjects, FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID(), @@ -116,7 +116,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on MultiTranslation object. diff --git a/src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp b/src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp index 4bed8aceb..1bbf2dedb 100644 --- a/src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp +++ b/src/FeaturesAPI/FeaturesAPI_NormalToFace.cpp @@ -62,7 +62,7 @@ FeaturesAPI_NormalToFace::FeaturesAPI_NormalToFace( } //================================================================================================= -FeaturesAPI_NormalToFace::~FeaturesAPI_NormalToFace() {} +FeaturesAPI_NormalToFace::~FeaturesAPI_NormalToFace() = default; //================================================================================================= void FeaturesAPI_NormalToFace::dump(ModelHighAPI_Dumper &theDumper) const { diff --git a/src/FeaturesAPI/FeaturesAPI_NormalToFace.h b/src/FeaturesAPI/FeaturesAPI_NormalToFace.h index 7f435a34e..d20923d2f 100644 --- a/src/FeaturesAPI/FeaturesAPI_NormalToFace.h +++ b/src/FeaturesAPI/FeaturesAPI_NormalToFace.h @@ -55,7 +55,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_NormalToFace(); + ~FeaturesAPI_NormalToFace() override; INTERFACE_3(FeaturesPlugin_NormalToFace::ID(), faceSelected, FeaturesPlugin_NormalToFace::FACE_SELECTED_ID(), @@ -68,7 +68,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on the NormalToface object. diff --git a/src/FeaturesAPI/FeaturesAPI_Partition.cpp b/src/FeaturesAPI/FeaturesAPI_Partition.cpp index fd67b8b50..1abbb6fe0 100644 --- a/src/FeaturesAPI/FeaturesAPI_Partition.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Partition.cpp @@ -55,7 +55,7 @@ FeaturesAPI_Partition::FeaturesAPI_Partition( } //================================================================================================== -FeaturesAPI_Partition::~FeaturesAPI_Partition() {} +FeaturesAPI_Partition::~FeaturesAPI_Partition() = default; //================================================================================================== void FeaturesAPI_Partition::setBase( diff --git a/src/FeaturesAPI/FeaturesAPI_Partition.h b/src/FeaturesAPI/FeaturesAPI_Partition.h index 63fe5c253..0a7f54fe9 100644 --- a/src/FeaturesAPI/FeaturesAPI_Partition.h +++ b/src/FeaturesAPI/FeaturesAPI_Partition.h @@ -51,7 +51,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Partition(); + ~FeaturesAPI_Partition() override; INTERFACE_3(FeaturesPlugin_Partition::ID(), baseObjects, FeaturesPlugin_Partition::BASE_OBJECTS_ID(), @@ -76,7 +76,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Partition object. diff --git a/src/FeaturesAPI/FeaturesAPI_Placement.cpp b/src/FeaturesAPI/FeaturesAPI_Placement.cpp index 48ff8854d..6c8a5be15 100644 --- a/src/FeaturesAPI/FeaturesAPI_Placement.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Placement.cpp @@ -48,7 +48,7 @@ FeaturesAPI_Placement::FeaturesAPI_Placement( } //================================================================================================== -FeaturesAPI_Placement::~FeaturesAPI_Placement() {} +FeaturesAPI_Placement::~FeaturesAPI_Placement() = default; //================================================================================================== void FeaturesAPI_Placement::setObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_Placement.h b/src/FeaturesAPI/FeaturesAPI_Placement.h index 5b6d4a445..daa5698e1 100644 --- a/src/FeaturesAPI/FeaturesAPI_Placement.h +++ b/src/FeaturesAPI/FeaturesAPI_Placement.h @@ -52,7 +52,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Placement(); + ~FeaturesAPI_Placement() override; INTERFACE_5(FeaturesPlugin_Placement::ID(), objects, FeaturesPlugin_Placement::OBJECTS_LIST_ID(), @@ -89,7 +89,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Placement object. diff --git a/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.cpp b/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.cpp index 81517a348..1382deb70 100644 --- a/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.cpp +++ b/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.cpp @@ -44,7 +44,7 @@ FeaturesAPI_PointCloudOnFace::FeaturesAPI_PointCloudOnFace( } //================================================================================================= -FeaturesAPI_PointCloudOnFace::~FeaturesAPI_PointCloudOnFace() {} +FeaturesAPI_PointCloudOnFace::~FeaturesAPI_PointCloudOnFace() = default; //================================================================================================== void FeaturesAPI_PointCloudOnFace::setNumberOfPoints( diff --git a/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.h b/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.h index 848f36622..75bd05301 100644 --- a/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.h +++ b/src/FeaturesAPI/FeaturesAPI_PointCloudOnFace.h @@ -50,7 +50,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_PointCloudOnFace(); + ~FeaturesAPI_PointCloudOnFace() override; INTERFACE_2(FeaturesPlugin_PointCloudOnFace::ID(), faceSelected, FeaturesPlugin_PointCloudOnFace::FACE_SELECTED_ID(), @@ -65,7 +65,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on the PointCloudOnFace object. diff --git a/src/FeaturesAPI/FeaturesAPI_RemoveResults.cpp b/src/FeaturesAPI/FeaturesAPI_RemoveResults.cpp index 851426322..28fbd8e17 100644 --- a/src/FeaturesAPI/FeaturesAPI_RemoveResults.cpp +++ b/src/FeaturesAPI/FeaturesAPI_RemoveResults.cpp @@ -39,7 +39,7 @@ FeaturesAPI_RemoveResults::FeaturesAPI_RemoveResults( } //================================================================================================== -FeaturesAPI_RemoveResults::~FeaturesAPI_RemoveResults() {} +FeaturesAPI_RemoveResults::~FeaturesAPI_RemoveResults() = default; //================================================================================================== void FeaturesAPI_RemoveResults::setRemoved( diff --git a/src/FeaturesAPI/FeaturesAPI_RemoveResults.h b/src/FeaturesAPI/FeaturesAPI_RemoveResults.h index b549649de..5b76d4c83 100644 --- a/src/FeaturesAPI/FeaturesAPI_RemoveResults.h +++ b/src/FeaturesAPI/FeaturesAPI_RemoveResults.h @@ -48,7 +48,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_RemoveResults(); + ~FeaturesAPI_RemoveResults() override; INTERFACE_1(FeaturesPlugin_RemoveResults::ID(), removed, FeaturesPlugin_RemoveResults::RESULTS_ID(), @@ -61,7 +61,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on RemoveResults object. diff --git a/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp b/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp index 22ced69a8..a0332140a 100644 --- a/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp +++ b/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.cpp @@ -43,7 +43,7 @@ FeaturesAPI_RemoveSubShapes::FeaturesAPI_RemoveSubShapes( } //================================================================================================== -FeaturesAPI_RemoveSubShapes::~FeaturesAPI_RemoveSubShapes() {} +FeaturesAPI_RemoveSubShapes::~FeaturesAPI_RemoveSubShapes() = default; //================================================================================================== void FeaturesAPI_RemoveSubShapes::setBase( diff --git a/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.h b/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.h index 63d3f5317..af0a36d99 100644 --- a/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.h +++ b/src/FeaturesAPI/FeaturesAPI_RemoveSubShapes.h @@ -49,7 +49,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_RemoveSubShapes(); + ~FeaturesAPI_RemoveSubShapes() override; INTERFACE_4(FeaturesPlugin_RemoveSubShapes::ID(), base, FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID(), @@ -79,7 +79,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on RemoveSubShapes object. diff --git a/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.cpp b/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.cpp index 3c685ad90..3ace5577b 100644 --- a/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.cpp +++ b/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.cpp @@ -31,7 +31,7 @@ FeaturesAPI_RevolutionBoolean::FeaturesAPI_RevolutionBoolean( : ModelHighAPI_Interface(theFeature) {} //================================================================================================== -FeaturesAPI_RevolutionBoolean::~FeaturesAPI_RevolutionBoolean() {} +FeaturesAPI_RevolutionBoolean::~FeaturesAPI_RevolutionBoolean() = default; //================================================================================================== void FeaturesAPI_RevolutionBoolean::setNestedSketch( diff --git a/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.h b/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.h index 0aabc238d..5d870deee 100644 --- a/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.h +++ b/src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.h @@ -42,7 +42,7 @@ class FeaturesAPI_RevolutionBoolean : public ModelHighAPI_Interface { public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_RevolutionBoolean(); + ~FeaturesAPI_RevolutionBoolean() override; INTERFACE_11("", sketch, FeaturesPlugin_Revolution::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch launcher */, baseObjects, @@ -104,7 +104,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; protected: /// Constructor without values. @@ -122,7 +122,7 @@ private: class FeaturesAPI_RevolutionCut : public FeaturesAPI_RevolutionBoolean { public: static std::string ID() { return FeaturesPlugin_RevolutionCut::ID(); } - virtual std::string getID() { return ID(); } + std::string getID() override { return ID(); } /// Constructor without values. FEATURESAPI_EXPORT @@ -221,7 +221,7 @@ addRevolutionCut(const std::shared_ptr &thePart, class FeaturesAPI_RevolutionFuse : public FeaturesAPI_RevolutionBoolean { public: static std::string ID() { return FeaturesPlugin_RevolutionFuse::ID(); } - virtual std::string getID() { return ID(); } + std::string getID() override { return ID(); } /// Constructor without values. FEATURESAPI_EXPORT @@ -269,7 +269,7 @@ public: }; /// Pointer on RevolutionFuse object. -typedef std::shared_ptr RevolutionFusePtr; +using RevolutionFusePtr = std::shared_ptr; /// \ingroup CPPHighAPI /// \brief Create RevolutionFuse feature. diff --git a/src/FeaturesAPI/FeaturesAPI_Rotation.cpp b/src/FeaturesAPI/FeaturesAPI_Rotation.cpp index f974b2483..a8d600656 100644 --- a/src/FeaturesAPI/FeaturesAPI_Rotation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Rotation.cpp @@ -59,7 +59,7 @@ FeaturesAPI_Rotation::FeaturesAPI_Rotation( } //================================================================================================== -FeaturesAPI_Rotation::~FeaturesAPI_Rotation() {} +FeaturesAPI_Rotation::~FeaturesAPI_Rotation() = default; //================================================================================================== void FeaturesAPI_Rotation::setMainObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_Rotation.h b/src/FeaturesAPI/FeaturesAPI_Rotation.h index afa6f6618..cea2c0d88 100644 --- a/src/FeaturesAPI/FeaturesAPI_Rotation.h +++ b/src/FeaturesAPI/FeaturesAPI_Rotation.h @@ -59,7 +59,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Rotation(); + ~FeaturesAPI_Rotation() override; INTERFACE_7(FeaturesPlugin_Rotation::ID(), creationMethod, FeaturesPlugin_Rotation::CREATION_METHOD(), @@ -98,7 +98,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Rotation object. diff --git a/src/FeaturesAPI/FeaturesAPI_Scale.cpp b/src/FeaturesAPI/FeaturesAPI_Scale.cpp index e13463f83..bf0c91c0e 100644 --- a/src/FeaturesAPI/FeaturesAPI_Scale.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Scale.cpp @@ -61,7 +61,7 @@ FeaturesAPI_Scale::FeaturesAPI_Scale( } //================================================================================================== -FeaturesAPI_Scale::~FeaturesAPI_Scale() {} +FeaturesAPI_Scale::~FeaturesAPI_Scale() = default; //================================================================================================== void FeaturesAPI_Scale::setMainObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_Scale.h b/src/FeaturesAPI/FeaturesAPI_Scale.h index 8011960be..96e1bc447 100644 --- a/src/FeaturesAPI/FeaturesAPI_Scale.h +++ b/src/FeaturesAPI/FeaturesAPI_Scale.h @@ -62,7 +62,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Scale(); + ~FeaturesAPI_Scale() override; INTERFACE_7(FeaturesPlugin_Scale::ID(), creationMethod, FeaturesPlugin_Scale::CREATION_METHOD(), ModelAPI_AttributeString, @@ -102,7 +102,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Scale object. diff --git a/src/FeaturesAPI/FeaturesAPI_Sewing.cpp b/src/FeaturesAPI/FeaturesAPI_Sewing.cpp index e13f47d04..3cd7da7ad 100644 --- a/src/FeaturesAPI/FeaturesAPI_Sewing.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Sewing.cpp @@ -48,7 +48,7 @@ FeaturesAPI_Sewing::FeaturesAPI_Sewing( } //================================================================================================== -FeaturesAPI_Sewing::~FeaturesAPI_Sewing() {} +FeaturesAPI_Sewing::~FeaturesAPI_Sewing() = default; //================================================================================================== void FeaturesAPI_Sewing::setMainObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_Sewing.h b/src/FeaturesAPI/FeaturesAPI_Sewing.h index 8c78adbf9..22a63c7d9 100644 --- a/src/FeaturesAPI/FeaturesAPI_Sewing.h +++ b/src/FeaturesAPI/FeaturesAPI_Sewing.h @@ -52,7 +52,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Sewing(); + ~FeaturesAPI_Sewing() override; INTERFACE_4(FeaturesPlugin_Sewing::ID(), mainObjects, FeaturesPlugin_Sewing::OBJECTS_LIST_ID(), @@ -84,7 +84,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Sewing object. diff --git a/src/FeaturesAPI/FeaturesAPI_SharedFaces.cpp b/src/FeaturesAPI/FeaturesAPI_SharedFaces.cpp index feb9249be..8f825e188 100644 --- a/src/FeaturesAPI/FeaturesAPI_SharedFaces.cpp +++ b/src/FeaturesAPI/FeaturesAPI_SharedFaces.cpp @@ -47,7 +47,7 @@ FeaturesAPI_SharedFaces::FeaturesAPI_SharedFaces( } //================================================================================================= -FeaturesAPI_SharedFaces::~FeaturesAPI_SharedFaces() {} +FeaturesAPI_SharedFaces::~FeaturesAPI_SharedFaces() = default; //================================================================================================= void FeaturesAPI_SharedFaces::dump(ModelHighAPI_Dumper &theDumper) const { diff --git a/src/FeaturesAPI/FeaturesAPI_SharedFaces.h b/src/FeaturesAPI/FeaturesAPI_SharedFaces.h index 9d03435ae..32b724642 100644 --- a/src/FeaturesAPI/FeaturesAPI_SharedFaces.h +++ b/src/FeaturesAPI/FeaturesAPI_SharedFaces.h @@ -49,7 +49,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_SharedFaces(); + ~FeaturesAPI_SharedFaces() override; INTERFACE_2(FeaturesPlugin_GroupSharedFaces::ID(), objectselected, FeaturesPlugin_GroupSharedFaces::OBJECT_ID(), @@ -60,7 +60,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on the SharedFaces object. diff --git a/src/FeaturesAPI/FeaturesAPI_Symmetry.cpp b/src/FeaturesAPI/FeaturesAPI_Symmetry.cpp index dd94e99e4..c0f5cdd17 100644 --- a/src/FeaturesAPI/FeaturesAPI_Symmetry.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Symmetry.cpp @@ -51,7 +51,7 @@ FeaturesAPI_Symmetry::FeaturesAPI_Symmetry( } //================================================================================================== -FeaturesAPI_Symmetry::~FeaturesAPI_Symmetry() {} +FeaturesAPI_Symmetry::~FeaturesAPI_Symmetry() = default; //================================================================================================== void FeaturesAPI_Symmetry::setMainObjects( diff --git a/src/FeaturesAPI/FeaturesAPI_Symmetry.h b/src/FeaturesAPI/FeaturesAPI_Symmetry.h index 103982903..aa467875e 100644 --- a/src/FeaturesAPI/FeaturesAPI_Symmetry.h +++ b/src/FeaturesAPI/FeaturesAPI_Symmetry.h @@ -51,7 +51,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Symmetry(); + ~FeaturesAPI_Symmetry() override; INTERFACE_6(FeaturesPlugin_Symmetry::ID(), creationMethod, FeaturesPlugin_Symmetry::CREATION_METHOD(), @@ -86,7 +86,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Symmetry object. diff --git a/src/FeaturesAPI/FeaturesAPI_Translation.cpp b/src/FeaturesAPI/FeaturesAPI_Translation.cpp index a2bc3b062..df55d89d1 100644 --- a/src/FeaturesAPI/FeaturesAPI_Translation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Translation.cpp @@ -70,7 +70,7 @@ FeaturesAPI_Translation::FeaturesAPI_Translation( } //================================================================================================== -FeaturesAPI_Translation::~FeaturesAPI_Translation() {} +FeaturesAPI_Translation::~FeaturesAPI_Translation() = default; //================================================================================================== void FeaturesAPI_Translation::setMainObjects( @@ -193,7 +193,7 @@ TranslationPtr addTranslation( firstSel = axis; values[0] = distance; } else if (byVector) { - std::list::const_iterator it = vector.begin(); + auto it = vector.begin(); for (ModelHighAPI_Double *vIt = values; it != vector.end(); ++vIt, ++it) *vIt = *it; } else if (byPoints) { diff --git a/src/FeaturesAPI/FeaturesAPI_Translation.h b/src/FeaturesAPI/FeaturesAPI_Translation.h index f63ba966c..b2b95645b 100644 --- a/src/FeaturesAPI/FeaturesAPI_Translation.h +++ b/src/FeaturesAPI/FeaturesAPI_Translation.h @@ -68,7 +68,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Translation(); + ~FeaturesAPI_Translation() override; INTERFACE_9(FeaturesPlugin_Translation::ID(), creationMethod, FeaturesPlugin_Translation::CREATION_METHOD(), @@ -112,7 +112,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Translation object. diff --git a/src/FeaturesAPI/FeaturesAPI_Union.cpp b/src/FeaturesAPI/FeaturesAPI_Union.cpp index 30532c968..7c7adefbe 100644 --- a/src/FeaturesAPI/FeaturesAPI_Union.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Union.cpp @@ -55,7 +55,7 @@ FeaturesAPI_Union::FeaturesAPI_Union( } //================================================================================================ -FeaturesAPI_Union::~FeaturesAPI_Union() {} +FeaturesAPI_Union::~FeaturesAPI_Union() = default; //================================================================================================== void FeaturesAPI_Union::setBase( diff --git a/src/FeaturesAPI/FeaturesAPI_Union.h b/src/FeaturesAPI/FeaturesAPI_Union.h index bf38add5d..c53ad070f 100644 --- a/src/FeaturesAPI/FeaturesAPI_Union.h +++ b/src/FeaturesAPI/FeaturesAPI_Union.h @@ -51,7 +51,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Union(); + ~FeaturesAPI_Union() override; INTERFACE_3(FeaturesPlugin_Union::ID(), baseObjects, FeaturesPlugin_Union::BASE_OBJECTS_ID(), @@ -75,7 +75,7 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Union object. diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp index fdc44461e..0bdaf7df3 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp @@ -104,14 +104,13 @@ void FeaturesPlugin_Boolean::loadNamingDS( theResultBody->loadDeletedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE); - for (ListOfShape::const_iterator anIter = theTools.begin(); - anIter != theTools.end(); ++anIter) { + for (const auto &theTool : theTools) { GeomAPI_Shape::ShapeType aShapeType = - (*anIter)->shapeType() <= GeomAPI_Shape::FACE ? GeomAPI_Shape::FACE - : GeomAPI_Shape::EDGE; - theResultBody->loadModifiedShapes(theMakeShape, *anIter, aShapeType); + theTool->shapeType() <= GeomAPI_Shape::FACE ? GeomAPI_Shape::FACE + : GeomAPI_Shape::EDGE; + theResultBody->loadModifiedShapes(theMakeShape, theTool, aShapeType); - theResultBody->loadDeletedShapes(theMakeShape, *anIter, + theResultBody->loadDeletedShapes(theMakeShape, theTool, GeomAPI_Shape::FACE); } } @@ -136,10 +135,8 @@ void FeaturesPlugin_Boolean::storeResult( ModelAPI_Tools::ResultBaseAlgo aRBA; aRBA.resultBody = aResultBody; aRBA.baseShape = theObjects.front(); - for (std::vector::iterator aRBAIt = - theResultBaseAlgoList.begin(); - aRBAIt != theResultBaseAlgoList.end(); ++aRBAIt) { - theMakeShapeList->appendAlgo(aRBAIt->makeShape); + for (auto &aRBAIt : theResultBaseAlgoList) { + theMakeShapeList->appendAlgo(aRBAIt.makeShape); } aRBA.makeShape = theMakeShapeList; theResultBaseAlgoList.clear(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.h b/src/FeaturesPlugin/FeaturesPlugin_Boolean.h index a3074732f..13f9100d2 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.h @@ -66,7 +66,7 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; protected: /// Use plugin manager for features creation. diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h index 68cb5b9a6..16ea758e6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h @@ -37,7 +37,7 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_BooleanCommon::ID(); return MY_KIND; } @@ -62,10 +62,10 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; public: /// Use plugin manager for features creation. diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp index 33695bd8e..c2333a741 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.cpp @@ -38,15 +38,15 @@ static const ListOfShape ExplodeCompounds(const ListOfShape &aList) { ListOfShape subShapes; - for (auto shp = aList.cbegin(); shp != aList.cend(); ++shp) { - if ((*shp).get() && (*shp)->isCompound()) { + for (const auto &shp : aList) { + if (shp.get() && shp->isCompound()) { // Use all sub shapes of the compound - for (GeomAPI_ShapeIterator anExp(*shp); anExp.more(); anExp.next()) { + for (GeomAPI_ShapeIterator anExp(shp); anExp.more(); anExp.next()) { GeomShapePtr aCurrent = anExp.current(); subShapes.push_back(aCurrent); } } else - subShapes.push_back(*shp); + subShapes.push_back(shp); } return subShapes; diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h index 9180f36de..0603b9340 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h @@ -38,17 +38,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_BooleanCut::ID(); return MY_KIND; } /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; public: /// Use plugin manager for features creation. diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h index f483f9ca7..ea10ff004 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h @@ -35,17 +35,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_BooleanFill::ID(); return MY_KIND; } /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; public: /// Use plugin manager for features creation. diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp index 2dd93d5bb..8aebe92de 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.cpp @@ -56,9 +56,8 @@ static void explodeCompound(const GeomShapePtr &theShape, static void collectSolids(const ListOfShape &theShapes, ListOfShape &theResult) { - for (ListOfShape::const_iterator it = theShapes.begin(); - it != theShapes.end(); ++it) - explodeCompound(*it, theResult); + for (const auto &theShape : theShapes) + explodeCompound(theShape, theResult); } //================================================================================================== @@ -250,10 +249,9 @@ void FeaturesPlugin_BooleanFuse::execute() { // If we have compsolids then cut with not used solids all others. if (!aShapesToAdd.empty() && !isSingleCompsolid) { aSolidsToFuse.clear(); - for (ListOfShape::iterator anIt = anOriginalShapes.begin(); - anIt != anOriginalShapes.end(); anIt++) { + for (auto &anOriginalShape : anOriginalShapes) { ListOfShape aOneObjectList; - aOneObjectList.push_back(*anIt); + aOneObjectList.push_back(anOriginalShape); std::shared_ptr aCutAlgo(new GeomAlgoAPI_Boolean( aOneObjectList, aShapesToAdd, GeomAlgoAPI_Tools::BOOL_CUT, aFuzzy)); diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h index de47261cf..60f1b684c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h @@ -35,7 +35,7 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_BooleanFuse::ID(); return MY_KIND; } @@ -78,10 +78,10 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; public: /// Use plugin manager for features creation. diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp index 4910dc56d..894e51d7c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.cpp @@ -106,9 +106,8 @@ void FeaturesPlugin_BooleanSmash::execute() { // to avoid treating them as unused later when constructing a compound // containing the result of Smash and all unused sub-shapes of multi-level // compounds - for (ListOfShape::iterator aNUIt = aNotUsed.begin(); - aNUIt != aNotUsed.end(); ++aNUIt) - anObjectsHistory.addObject(*aNUIt); + for (auto &aNUIt : aNotUsed) + anObjectsHistory.addObject(aNUIt); } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h index bea982bd1..5266d13e5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h @@ -37,7 +37,7 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_BooleanSmash::ID(); return MY_KIND; } @@ -56,10 +56,10 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; public: /// Use plugin manager for features creation. diff --git a/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.cpp b/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.cpp index 4770f036d..a3ecb2f7a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.cpp @@ -38,7 +38,7 @@ #include //================================================================================================= -FeaturesPlugin_BoundingBox::FeaturesPlugin_BoundingBox() {} +FeaturesPlugin_BoundingBox::FeaturesPlugin_BoundingBox() = default; //================================================================================================= void FeaturesPlugin_BoundingBox::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.h b/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.h index e60cfc5c7..cb5d380a1 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BoundingBox.h @@ -90,21 +90,22 @@ public: } /// \return the kind of a feature. - virtual const std::string &getKind() { return ID(); } + const std::string &getKind() override { return ID(); } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + FEATURESPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Return Attribut values of result. - FEATURESPLUGIN_EXPORT virtual AttributePtr attributResultValues(); + FEATURESPLUGIN_EXPORT AttributePtr attributResultValues() override; /// Use plugin manager for features creation FeaturesPlugin_BoundingBox(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.cpp b/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.cpp index 31bc75cc1..2faf86e3b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.cpp @@ -101,9 +101,7 @@ void FeaturesPlugin_BoundingBoxBase::loadNamingDS( // Insert to faces std::map> listOfFaces = theBoxAlgo->getCreatedFaces(); - for (std::map>::iterator it = - listOfFaces.begin(); - it != listOfFaces.end(); ++it) { - theResultBox->generated((*it).second, (*it).first); + for (auto &listOfFace : listOfFaces) { + theResultBox->generated(listOfFace.second, listOfFace.first); } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.h b/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.h index a9ef58191..6883c3142 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.h +++ b/src/FeaturesPlugin/FeaturesPlugin_BoundingBoxBase.h @@ -38,13 +38,13 @@ class FeaturesPlugin_BoundingBoxBase : public ModelAPI_Feature { public: /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(){}; + FEATURESPLUGIN_EXPORT void execute() override{}; /// Return Attribut values of result. virtual AttributePtr attributResultValues() = 0; protected: - FeaturesPlugin_BoundingBoxBase() {} + FeaturesPlugin_BoundingBoxBase() = default; /// Create box with two points void createBoxByTwoPoints(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Chamfer.cpp b/src/FeaturesPlugin/FeaturesPlugin_Chamfer.cpp index d6d937407..d6e9530c5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Chamfer.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Chamfer.cpp @@ -56,21 +56,20 @@ static void extractEdgesAndFaces(const ListOfShape &theShapes, ListOfShape &theEdges, std::map &theMapEdgeFace) { - for (ListOfShape::const_iterator anIt = theShapes.begin(); - anIt != theShapes.end(); ++anIt) - if ((*anIt)->isEdge()) - theEdges.push_back(*anIt); + for (const auto &theShape : theShapes) + if (theShape->isEdge()) + theEdges.push_back(theShape); else { - for (GeomAPI_ShapeExplorer anExp(*anIt, GeomAPI_Shape::EDGE); + for (GeomAPI_ShapeExplorer anExp(theShape, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { GeomShapePtr aCurrent = anExp.current(); theEdges.push_back(aCurrent); - theMapEdgeFace[aCurrent] = *anIt; + theMapEdgeFace[aCurrent] = theShape; } } } -FeaturesPlugin_Chamfer::FeaturesPlugin_Chamfer() {} +FeaturesPlugin_Chamfer::FeaturesPlugin_Chamfer() = default; void FeaturesPlugin_Chamfer::initAttributes() { data()->addAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD(), diff --git a/src/FeaturesPlugin/FeaturesPlugin_Chamfer.h b/src/FeaturesPlugin/FeaturesPlugin_Chamfer.h index 0dc642664..ce23c8095 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Chamfer.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Chamfer.h @@ -36,7 +36,7 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Chamfer::ID(); return MY_KIND; } @@ -88,22 +88,23 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation. FeaturesPlugin_Chamfer(); private: /// Return attribute storing the selected objects of the operation. - virtual std::shared_ptr objectsAttribute(); + std::shared_ptr objectsAttribute() override; /// Return name of modified shape prefix name - virtual const std::string &modifiedShapePrefix() const; + const std::string &modifiedShapePrefix() const override; /// Run chamfer/fillet operation and returns the modification algorithm if /// succeed. - virtual std::shared_ptr - performOperation(const GeomShapePtr &theSolid, const ListOfShape &theEdges); + std::shared_ptr + performOperation(const GeomShapePtr &theSolid, + const ListOfShape &theEdges) override; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.cpp b/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.cpp index d412e1b35..f7e23577a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.cpp @@ -56,7 +56,7 @@ void FeaturesPlugin_CommonSharedFaces::updateFaces() { ListOfShape aFaces = GeomAlgoAPI_ShapeTools::getSharedFaces(aShape); myShape = aShape; aFacesListAttr->setSelectionType("face"); - ListOfShape::const_iterator anIt = aFaces.cbegin(); + auto anIt = aFaces.cbegin(); for (; anIt != aFaces.cend(); ++anIt) { GeomShapePtr aFacePtr = *anIt; if (!(aFacesListAttr->isInList(aCompSolidAttr->context(), aFacePtr))) { diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp index 09b483f65..a1190a336 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp @@ -51,9 +51,8 @@ void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean() { // Getting tools. ListOfShape aTools; - for (ListOfMakeShape::const_iterator anIt = aGenMakeShapes.cbegin(); - anIt != aGenMakeShapes.cend(); ++anIt) { - aTools.push_back((*anIt)->shape()); + for (const auto &aGenMakeShape : aGenMakeShapes) { + aTools.push_back(aGenMakeShape->shape()); } // Make boolean. @@ -72,8 +71,8 @@ void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean() { int aResultIndex = 0; std::vector aResultBaseAlgoList; ListOfShape aResultShapesList; - ListOfShape::const_iterator aBoolObjIt = aBooleanObjects.cbegin(); - ListOfMakeShape::const_iterator aBoolMSIt = aBooleanMakeShapes.cbegin(); + auto aBoolObjIt = aBooleanObjects.cbegin(); + auto aBoolMSIt = aBooleanMakeShapes.cbegin(); for (; aBoolObjIt != aBooleanObjects.cend() && aBoolMSIt != aBooleanMakeShapes.cend(); ++aBoolObjIt, ++aBoolMSIt) { @@ -87,8 +86,8 @@ void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean() { aResultBody->storeModified(*aBoolObjIt, (*aBoolMSIt)->shape()); // Store generation history. - ListOfShape::const_iterator aGenBaseIt = aGenBaseShapes.cbegin(); - ListOfMakeShape::const_iterator aGenMSIt = aGenMakeShapes.cbegin(); + auto aGenBaseIt = aGenBaseShapes.cbegin(); + auto aGenMSIt = aGenMakeShapes.cbegin(); for (; aGenBaseIt != aGenBaseShapes.cend() && aGenMSIt != aGenMakeShapes.cend(); ++aGenBaseIt, ++aGenMSIt) { @@ -213,7 +212,7 @@ void FeaturesPlugin_CompositeBoolean::addSubShapes( for (GeomAPI_ShapeIterator aCompoundIt(theCompound); aCompoundIt.more(); aCompoundIt.next()) { GeomShapePtr aCompoundSS = aCompoundIt.current(); - ListOfShape::const_iterator aUseIt = theSubShapesToAvoid.cbegin(); + auto aUseIt = theSubShapesToAvoid.cbegin(); for (; aUseIt != theSubShapesToAvoid.cend(); aUseIt++) { if (aCompoundSS->isEqual(*aUseIt)) { break; @@ -278,8 +277,7 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean( if (!aCompoundsMap.isBound(aResRootPtr->shape())) { // Compsolid or a simple (one-level) compound GeomShapePtr aContextShape = aResCompSolidPtr->shape(); - std::map::iterator anIt = - aCompSolidsObjects.begin(); + auto anIt = aCompSolidsObjects.begin(); for (; anIt != aCompSolidsObjects.end(); anIt++) { if (anIt->first->isEqual(aContextShape)) { aCompSolidsObjects[anIt->first].push_back(anObject); @@ -313,9 +311,7 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean( } // For solids cut each object with all tools. - for (ListOfShape::const_iterator anIt = anObjects.cbegin(); - anIt != anObjects.cend(); ++anIt) { - GeomShapePtr anObject = *anIt; + for (auto anObject : anObjects) { ListOfShape aListWithObject; aListWithObject.push_back(anObject); std::shared_ptr aBoolAlgo(new GeomAlgoAPI_Boolean( @@ -335,11 +331,9 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean( } // Compsolids handling - for (std::map::const_iterator anIt = - aCompSolidsObjects.cbegin(); - anIt != aCompSolidsObjects.cend(); ++anIt) { - GeomShapePtr aCompSolid = anIt->first; - const ListOfShape &aUsedShapes = anIt->second; + for (const auto &aCompSolidsObject : aCompSolidsObjects) { + GeomShapePtr aCompSolid = aCompSolidsObject.first; + const ListOfShape &aUsedShapes = aCompSolidsObject.second; // Collecting solids from compsolids which will not be modified in boolean // operation. @@ -347,7 +341,7 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean( for (GeomAPI_ShapeIterator aCompSolidIt(aCompSolid); aCompSolidIt.more(); aCompSolidIt.next()) { GeomShapePtr aSolidInCompSolid = aCompSolidIt.current(); - ListOfShape::const_iterator aUsedShapesIt = aUsedShapes.cbegin(); + auto aUsedShapesIt = aUsedShapes.cbegin(); for (; aUsedShapesIt != aUsedShapes.cend(); ++aUsedShapesIt) { if (aSolidInCompSolid->isEqual(*aUsedShapesIt)) { break; @@ -382,9 +376,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean( std::shared_ptr aCompMkr( new GeomAlgoAPI_MakeShapeCustom); aCompMkr->setResult(aBoolRes); - for (ListOfShape::iterator aCS = aCompSolids.begin(); - aCS != aCompSolids.end(); aCS++) - aCompMkr->addModified(*aCS, aBoolRes); + for (auto &aCompSolid : aCompSolids) + aCompMkr->addModified(aCompSolid, aBoolRes); aMakeShapeList->appendAlgo(aCompMkr); } else { std::shared_ptr aFillerAlgo( @@ -406,9 +399,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean( } // Complex (recursive) compounds handling - for (ListOfShape::const_iterator anIt = aCompounds.cbegin(); - anIt != aCompounds.cend(); ++anIt) { - GeomShapePtr aCompound = (*anIt); + for (const auto &anIt : aCompounds) { + GeomShapePtr aCompound = anIt; GeomShapePtr aRes; std::shared_ptr aMakeShapeList( new GeomAlgoAPI_MakeShapeList()); @@ -429,13 +421,12 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean( // Filter edges and faces in tools. ListOfShape aTools; - for (ListOfShape::const_iterator anIt = theTools.cbegin(); - anIt != theTools.cend(); ++anIt) { - if ((*anIt)->shapeType() == GeomAPI_Shape::EDGE || - (*anIt)->shapeType() == GeomAPI_Shape::FACE) { - anEdgesAndFaces.push_back(*anIt); + for (const auto &theTool : theTools) { + if (theTool->shapeType() == GeomAPI_Shape::EDGE || + theTool->shapeType() == GeomAPI_Shape::FACE) { + anEdgesAndFaces.push_back(theTool); } else { - aTools.push_back(*anIt); + aTools.push_back(theTool); } } @@ -454,19 +445,16 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean( // Collecting solids and compsolids from compounds which will not be // modified in boolean operation and will be added to result. ListOfShape aShapesToAdd; - for (ListOfShape::iterator anIt = aCompounds.begin(); - anIt != aCompounds.end(); anIt++) { - GeomShapePtr aCompound = (*anIt); + for (auto &anIt : aCompounds) { + GeomShapePtr aCompound = anIt; addSubShapes(aCompound, anObjects, aShapesToAdd); } // Collecting solids from compsolids which will not be // modified in boolean operation and will be added to result. - for (std::map::iterator anIt = - aCompSolidsObjects.begin(); - anIt != aCompSolidsObjects.end(); anIt++) { - GeomShapePtr aCompSolid = anIt->first; - ListOfShape &aUsedShapes = anIt->second; + for (auto &aCompSolidsObject : aCompSolidsObjects) { + GeomShapePtr aCompSolid = aCompSolidsObject.first; + ListOfShape &aUsedShapes = aCompSolidsObject.second; aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedShapes.begin(), aUsedShapes.end()); //??? addSubShapes(aCompSolid, aUsedShapes, aShapesToAdd); @@ -578,17 +566,13 @@ void FeaturesPlugin_CompositeBoolean::storeModificationHistory( void FeaturesPlugin_CompositeBoolean::storeDeletedShapes( std::vector &theResultBaseAlgoList, const ListOfShape &theTools, const GeomShapePtr theResultShapesCompound) { - for (std::vector::iterator anIt = - theResultBaseAlgoList.begin(); - anIt != theResultBaseAlgoList.end(); ++anIt) { - ResultBaseAlgo &aRCA = *anIt; + for (auto &aRCA : theResultBaseAlgoList) { aRCA.resultBody->loadDeletedShapes(aRCA.makeShape, aRCA.baseShape, GeomAPI_Shape::FACE, theResultShapesCompound); - for (ListOfShape::const_iterator anIter = theTools.begin(); - anIter != theTools.end(); anIter++) { - aRCA.resultBody->loadDeletedShapes(aRCA.makeShape, *anIter, + for (const auto &theTool : theTools) { + aRCA.resultBody->loadDeletedShapes(aRCA.makeShape, theTool, GeomAPI_Shape::FACE, theResultShapesCompound); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h index f42958ccc..0de7b710a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h @@ -54,7 +54,8 @@ protected: }; protected: - FeaturesPlugin_CompositeBoolean(){}; + FeaturesPlugin_CompositeBoolean() = default; + ; /// Initializes boolean attributes. void initBooleanAttributes(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp index 7a6de460d..530491876 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp @@ -124,7 +124,7 @@ bool FeaturesPlugin_CompositeSketch::isSub(ObjectPtr theObject) const { //================================================================================================= void FeaturesPlugin_CompositeSketch::removeFeature( - std::shared_ptr theFeature) { + std::shared_ptr /*theFeature*/) { AttributeSelectionListPtr aBaseObjectsSelectionList = selectionList(BASE_OBJECTS_ID()); if (aBaseObjectsSelectionList.get() && @@ -212,7 +212,7 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory( std::shared_ptr aMakeList = std::dynamic_pointer_cast(theMakeShape); if (aMakeList.get()) { - ListOfMakeShape::const_iterator anIter = aMakeList->list().cbegin(); + auto anIter = aMakeList->list().cbegin(); for (; anIter != aMakeList->list().cend(); anIter++) { std::shared_ptr aSweep = std::dynamic_pointer_cast(*anIter); @@ -221,8 +221,7 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory( } } } - std::list>::iterator aSweep = - aSweeps.begin(); + auto aSweep = aSweeps.begin(); for (; aSweep != aSweeps.end(); aSweep++) { // Store from shapes. storeShapes(theMakeShape, theResultBody, aBaseShapeType, @@ -269,10 +268,7 @@ void FeaturesPlugin_CompositeSketch::storeShapes( } // Store shapes. - for (ListOfShape::const_iterator anIt = theShapes.cbegin(); - anIt != theShapes.cend(); ++anIt) { - GeomShapePtr aShape = *anIt; - + for (auto aShape : theShapes) { if (aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) { std::string aName = theName + @@ -309,7 +305,7 @@ void storeSubShape(const std::shared_ptr theMakeShape, for (int i = 0; i < aNbSubs; ++i) { ResultBodyPtr aSubRes = theResultBody->subResult(i); GeomShapePtr aShape = aSubRes->shape(); - ListOfShape::iterator aNewIt = aNewShapes.begin(); + auto aNewIt = aNewShapes.begin(); for (; aNewIt != aNewShapes.end(); ++aNewIt) if (aShape->isSubShape(*aNewIt, false)) break; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Copy.cpp b/src/FeaturesPlugin/FeaturesPlugin_Copy.cpp index b4425f36b..e5ef020e1 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Copy.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Copy.cpp @@ -116,7 +116,7 @@ void FeaturesPlugin_Copy::getCopies( GeomShapePtr aGroupValue = theValue.get() ? theValue : aContextRes->shape(); AttributeSelectionListPtr aList = selectionList(OBJECTS()); - std::list::const_iterator aResIter = results().cbegin(); + auto aResIter = results().cbegin(); while (aResIter != results().cend()) { // do as long as many iterations for (int aSelIndex = 0; aSelIndex < aList->size(); aSelIndex++) { if (aResIter == @@ -147,7 +147,7 @@ void FeaturesPlugin_Copy::getCopies( if (aResBody.get()) { std::list aSubs; ModelAPI_Tools::allSubs(aResBody, aSubs, true); - std::list::iterator aSubIter = aSubs.begin(); + auto aSubIter = aSubs.begin(); for (; aSubIter != aSubs.end(); aSubIter++) { GeomShapePtr aSubShape = (*aSubIter)->shape(); if (aSubShape.get() && diff --git a/src/FeaturesPlugin/FeaturesPlugin_Copy.h b/src/FeaturesPlugin/FeaturesPlugin_Copy.h index 10de826b1..f40873f17 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Copy.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Copy.h @@ -45,7 +45,7 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Copy::ID(); return MY_KIND; } @@ -62,21 +62,21 @@ public: } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// To update the group feature which is moved over this copy feature (to add /// copies to selection) - FEATURESPLUGIN_EXPORT virtual void + FEATURESPLUGIN_EXPORT void getCopies(ObjectPtr theContext, std::shared_ptr theValue, std::list &theCopyContext, - std::list> &theCopyVals); + std::list> &theCopyVals) override; /// Use plugin manager for features creation. - FeaturesPlugin_Copy() {} + FeaturesPlugin_Copy() = default; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.cpp b/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.cpp index 8db92f508..678e1afb3 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.cpp @@ -32,7 +32,7 @@ #include -FeaturesPlugin_Defeaturing::FeaturesPlugin_Defeaturing() {} +FeaturesPlugin_Defeaturing::FeaturesPlugin_Defeaturing() = default; void FeaturesPlugin_Defeaturing::initAttributes() { data()->addAttribute(OBJECT_LIST_ID(), @@ -73,10 +73,9 @@ void FeaturesPlugin_Defeaturing::execute() { std::vector aResultBaseAlgoList; ListOfShape anOriginalShapesList, aResultShapesList; - for (SolidFaces::iterator anIt = aBodiesAndFacesToRemove.begin(); - anIt != aBodiesAndFacesToRemove.end(); ++anIt) { - GeomShapePtr aParent = anIt->first; - anAlgo.reset(new GeomAlgoAPI_Defeaturing(aParent, anIt->second)); + for (auto &anIt : aBodiesAndFacesToRemove) { + GeomShapePtr aParent = anIt.first; + anAlgo.reset(new GeomAlgoAPI_Defeaturing(aParent, anIt.second)); if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgo, getKind(), anError)) { setError(anError); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.h b/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.h index 8b0817c90..50f2565e5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Defeaturing.h @@ -41,7 +41,7 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Defeaturing::ID(); return MY_KIND; } @@ -53,11 +53,11 @@ public: } /// Performs the defeaturing algorithm and stores it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation. FeaturesPlugin_Defeaturing(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp index 86a4731f9..9d6c13de0 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp @@ -36,7 +36,7 @@ #include //================================================================================================= -FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion() {} +FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion() = default; //================================================================================================= void FeaturesPlugin_Extrusion::initAttributes() { @@ -78,8 +78,8 @@ void FeaturesPlugin_Extrusion::execute() { // Store results. int aResultIndex = 0; - ListOfShape::const_iterator aBaseIt = aBaseShapesList.cbegin(); - ListOfMakeShape::const_iterator anAlgoIt = aMakeShapesList.cbegin(); + auto aBaseIt = aBaseShapesList.cbegin(); + auto anAlgoIt = aMakeShapesList.cbegin(); for (; aBaseIt != aBaseShapesList.cend() && anAlgoIt != aMakeShapesList.cend(); ++aBaseIt, ++anAlgoIt) { @@ -147,10 +147,7 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape &theBaseShapes, // Generating result for each base shape. std::string anError; - for (ListOfShape::const_iterator anIter = theBaseShapes.cbegin(); - anIter != theBaseShapes.cend(); anIter++) { - std::shared_ptr aBaseShape = *anIter; - + for (auto aBaseShape : theBaseShapes) { std::shared_ptr aPrismAlgo(new GeomAlgoAPI_Prism( aBaseShape, aDir, aToShape, aToSize, aFromShape, aFromSize)); if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPrismAlgo, getKind(), diff --git a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h index f55afcaf5..1f7680909 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h @@ -113,17 +113,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Extrusion::ID(); return MY_KIND; } /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; protected: /// Generates extrusions. diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h index cca1e98ab..728fcb3b0 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h @@ -32,23 +32,24 @@ class FeaturesPlugin_ExtrusionBoolean : public FeaturesPlugin_Extrusion, public: /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; protected: - FeaturesPlugin_ExtrusionBoolean(){}; + FeaturesPlugin_ExtrusionBoolean() = default; + ; // Creates extrusions. bool makeGeneration(ListOfShape &theBaseShapes, - ListOfMakeShape &theMakeShapes); + ListOfMakeShape &theMakeShapes) override; /// Stores generation history. void storeGenerationHistory( ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape); + const std::shared_ptr theMakeShape) override; /// Calculate prism sizes to ensure that it passes through all objects /// Redefined from FeaturesPlugin_Extrusion - virtual void getSizes(double &theToSize, double &theFromSize); + void getSizes(double &theToSize, double &theFromSize) override; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h index 294011aef..eed72ca69 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h @@ -40,13 +40,13 @@ public: } /// \return the kind of a feature - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_ExtrusionCut::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.cpp index 5596730a7..ce96c58c0 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.cpp @@ -71,9 +71,8 @@ void FeaturesPlugin_ExtrusionFuse::executeFuseThroughAll() { // Getting tools. ListOfShape aNewTools; ListOfMakeShape aToolsMakeShapes; - for (ListOfMakeShape::const_iterator anIt = aGenMakeShapes.cbegin(); - anIt != aGenMakeShapes.cend(); ++anIt) { - GeomMakeShapePtr anAlgo = (*anIt); + for (const auto &aGenMakeShape : aGenMakeShapes) { + GeomMakeShapePtr anAlgo = aGenMakeShape; std::shared_ptr aPrismAlgo = std::dynamic_pointer_cast(anAlgo); @@ -111,8 +110,8 @@ void FeaturesPlugin_ExtrusionFuse::executeFuseThroughAll() { int aResultIndex = 0; std::vector aResultBaseAlgoList; ListOfShape aResultShapesList; - ListOfShape::const_iterator aBoolObjIt = aBooleanObjects.cbegin(); - ListOfMakeShape::const_iterator aBoolMSIt = aBooleanMakeShapes.cbegin(); + auto aBoolObjIt = aBooleanObjects.cbegin(); + auto aBoolMSIt = aBooleanMakeShapes.cbegin(); for (; aBoolObjIt != aBooleanObjects.cend() && aBoolMSIt != aBooleanMakeShapes.cend(); ++aBoolObjIt, ++aBoolMSIt) { @@ -126,14 +125,14 @@ void FeaturesPlugin_ExtrusionFuse::executeFuseThroughAll() { aResultBody->storeModified(*aBoolObjIt, (*aBoolMSIt)->shape()); // Store generation history. - ListOfShape::const_iterator aGenBaseIt = aGenBaseShapes.cbegin(); - ListOfMakeShape::const_iterator aGenMSIt = aGenMakeShapes.cbegin(); + auto aGenBaseIt = aGenBaseShapes.cbegin(); + auto aGenMSIt = aGenMakeShapes.cbegin(); for (; aGenBaseIt != aGenBaseShapes.cend() && aGenMSIt != aGenMakeShapes.cend(); ++aGenBaseIt, ++aGenMSIt) { // ??? - ListOfMakeShape::const_iterator aToolsMSIt = aToolsMakeShapes.cbegin(); + auto aToolsMSIt = aToolsMakeShapes.cbegin(); for (; aToolsMSIt != aToolsMakeShapes.cend(); ++aToolsMSIt) { std::shared_ptr aMSList( new GeomAlgoAPI_MakeShapeList()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h index 9c9768e30..41b0c8f19 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h @@ -40,13 +40,13 @@ public: } /// \return the kind of a feature - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_ExtrusionFuse::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; private: void executeFuseThroughAll(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp b/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp index e87842b67..d9605cbad 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp @@ -35,15 +35,14 @@ // Extract edges from the list static ListOfShape extractEdges(const ListOfShape &theShapes) { ListOfShape anEdges; - for (ListOfShape::const_iterator anIt = theShapes.begin(); - anIt != theShapes.end(); ++anIt) - for (GeomAPI_ShapeExplorer anExp(*anIt, GeomAPI_Shape::EDGE); anExp.more(); - anExp.next()) + for (const auto &theShape : theShapes) + for (GeomAPI_ShapeExplorer anExp(theShape, GeomAPI_Shape::EDGE); + anExp.more(); anExp.next()) anEdges.push_back(anExp.current()); return anEdges; } -FeaturesPlugin_Fillet::FeaturesPlugin_Fillet() {} +FeaturesPlugin_Fillet::FeaturesPlugin_Fillet() = default; void FeaturesPlugin_Fillet::initAttributes() { data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet.h b/src/FeaturesPlugin/FeaturesPlugin_Fillet.h index 2a943a197..08f0c064e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet.h @@ -36,7 +36,7 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Fillet::ID(); return MY_KIND; } @@ -79,22 +79,23 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation. FeaturesPlugin_Fillet(); private: /// Return attribute storing the selected objects of the operation. - virtual std::shared_ptr objectsAttribute(); + std::shared_ptr objectsAttribute() override; /// Return name of modified shape prefix name - virtual const std::string &modifiedShapePrefix() const; + const std::string &modifiedShapePrefix() const override; /// Run chamfer/fillet operation and returns the modification algorithm if /// succeed. - virtual std::shared_ptr - performOperation(const GeomShapePtr &theSolid, const ListOfShape &theEdges); + std::shared_ptr + performOperation(const GeomShapePtr &theSolid, + const ListOfShape &theEdges) override; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp index 6ef6857c2..f329691f5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.cpp @@ -43,7 +43,7 @@ void sendMessageWithFailedShapes(const ListOfShape &theVertices) { Events_Loop::loop()->send(aMessage); } -FeaturesPlugin_Fillet1D::FeaturesPlugin_Fillet1D() {} +FeaturesPlugin_Fillet1D::FeaturesPlugin_Fillet1D() = default; void FeaturesPlugin_Fillet1D::initAttributes() { data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId()); @@ -61,9 +61,8 @@ void FeaturesPlugin_Fillet1D::execute() { return; int aResultIndex = 0; - for (ListOfShape::iterator anIt = aWires.begin(); anIt != aWires.end(); - ++anIt) - if (!performFillet(*anIt, aVertices[*anIt], aResultIndex++)) + for (auto &aWire : aWires) + if (!performFillet(aWire, aVertices[aWire], aResultIndex++)) break; removeResults(aResultIndex); } @@ -98,15 +97,15 @@ bool FeaturesPlugin_Fillet1D::baseShapes(ListOfShape &theWires, GeomAPI_Shape::EDGE); const MapShapeToShapes &aSubshapes = aMapVE.map(); std::set aFilletVertices; - for (MapShapeToShapes::const_iterator anIt = aSubshapes.begin(); - anIt != aSubshapes.end(); ++anIt) { + for (const auto &aSubshape : aSubshapes) { // vertex should have 2 adjacent edges - if (anIt->second.size() != 2) + if (aSubshape.second.size() != 2) continue; // skip vertices, which adjacent edges are not on the same plane ListOfShape anEdges; - anEdges.insert(anEdges.end(), anIt->second.begin(), anIt->second.end()); + anEdges.insert(anEdges.end(), aSubshape.second.begin(), + aSubshape.second.end()); GeomPlanePtr aPlane = GeomAlgoAPI_ShapeTools::findPlane(anEdges); if (!aPlane) continue; @@ -114,11 +113,11 @@ bool FeaturesPlugin_Fillet1D::baseShapes(ListOfShape &theWires, // skip vertices, which smoothly connect adjacent edges GeomEdgePtr anEdge1(new GeomAPI_Edge(anEdges.front())); GeomEdgePtr anEdge2(new GeomAPI_Edge(anEdges.back())); - GeomVertexPtr aSharedVertex(new GeomAPI_Vertex(anIt->first)); + GeomVertexPtr aSharedVertex(new GeomAPI_Vertex(aSubshape.first)); if (GeomAlgoAPI_ShapeTools::isTangent(anEdge1, anEdge2, aSharedVertex)) continue; - aFilletVertices.insert(anIt->first); + aFilletVertices.insert(aSubshape.first); } if (aFilletVertices.empty()) { @@ -197,10 +196,9 @@ bool FeaturesPlugin_Fillet1D::performFillet(const GeomShapePtr &theWire, THE_PREFIX); setResult(aResult, theResultIndex); // store new edges generated from vertices - for (ListOfShape::const_iterator anIt = theVertices.begin(); - anIt != theVertices.end(); ++anIt) - aResult->loadGeneratedShapes(aFilletBuilder, *anIt, GeomAPI_Shape::VERTEX, - THE_PREFIX, true); + for (const auto &theVertice : theVertices) + aResult->loadGeneratedShapes(aFilletBuilder, theVertice, + GeomAPI_Shape::VERTEX, THE_PREFIX, true); return isOk; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h index fe60924d0..a95a5e35a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet1D.h @@ -32,8 +32,8 @@ /// \ingroup Plugins /// \brief Feature for appling fillet on vertices of 3D wire. class FeaturesPlugin_Fillet1D : public ModelAPI_Feature { - typedef std::map - MapShapeSubs; + using MapShapeSubs = + std::map; public: /// Feature kind. @@ -43,7 +43,7 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Fillet1D::ID(); return MY_KIND; } @@ -83,14 +83,15 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + FEATURESPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Performs the fillet algorithm and stores it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Use plugin manager for features creation. FeaturesPlugin_Fillet1D(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp b/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp index e04f543ab..72238dd7b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp @@ -35,7 +35,7 @@ #include //================================================================================================== -FeaturesPlugin_FusionFaces::FeaturesPlugin_FusionFaces() {} +FeaturesPlugin_FusionFaces::FeaturesPlugin_FusionFaces() = default; //================================================================================================== void FeaturesPlugin_FusionFaces::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.h b/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.h index ca10c7904..3aa1aee9c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.h +++ b/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.h @@ -46,17 +46,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_FusionFaces::ID(); return MY_KIND; } /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Executes the faces fusion and stores the modififed shape. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp index 464fc5b61..01bf36933 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.cpp @@ -36,7 +36,8 @@ #include //================================================================================================= -FeaturesPlugin_GeometryCalculation::FeaturesPlugin_GeometryCalculation() {} +FeaturesPlugin_GeometryCalculation::FeaturesPlugin_GeometryCalculation() = + default; //================================================================================================= void FeaturesPlugin_GeometryCalculation::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h index f4857bba9..964b9f87e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_GeometryCalculation.h @@ -39,7 +39,7 @@ public: } /// \return the kind of a feature. - virtual const std::string &getKind() { return ID(); } + const std::string &getKind() override { return ID(); } /// Attribute name for object selected. inline static const std::string &OBJECT_SELECTED_ID() { @@ -72,18 +72,19 @@ public: } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + FEATURESPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. - FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; } + FEATURESPLUGIN_EXPORT bool isMacro() const override { return true; } /// Use plugin manager for features creation FeaturesPlugin_GeometryCalculation(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.cpp b/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.cpp index 4df5fcaca..5bef25f8b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.cpp @@ -40,7 +40,7 @@ #include //================================================================================================== -FeaturesPlugin_GlueFaces::FeaturesPlugin_GlueFaces() {} +FeaturesPlugin_GlueFaces::FeaturesPlugin_GlueFaces() = default; //================================================================================================== void FeaturesPlugin_GlueFaces::initAttributes() { @@ -138,9 +138,7 @@ bool FeaturesPlugin_GlueFaces::isGlued(const ListOfShape &theInputs, // Consider the list of input shapes the same as the result, if // * the total number of faces did NOT change. int nbInputFaces = 0, nbInputEdges = 0; - for (ListOfShape::const_iterator anIt = theInputs.cbegin(); - anIt != theInputs.cend(); ++anIt) { - GeomShapePtr aShape = *anIt; + for (auto aShape : theInputs) { if (aShape.get()) { nbInputFaces += aShape->subShapes(GeomAPI_Shape::FACE, true).size(); nbInputEdges += aShape->subShapes(GeomAPI_Shape::EDGE, true).size(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.h b/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.h index b3d9f4112..525b33fa6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.h +++ b/src/FeaturesPlugin/FeaturesPlugin_GlueFaces.h @@ -41,7 +41,7 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_GlueFaces::ID(); return MY_KIND; } @@ -66,10 +66,10 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Executes the faces fusion and stores the modififed shape. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; private: /// Retrieve all shapes from the selection list diff --git a/src/FeaturesPlugin/FeaturesPlugin_ImportResult.cpp b/src/FeaturesPlugin/FeaturesPlugin_ImportResult.cpp index d2748ab1b..6e1a8272f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ImportResult.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ImportResult.cpp @@ -51,7 +51,7 @@ void FeaturesPlugin_ImportResult::execute() { // std::list anGroupList = aRefListOfGroups->list(); // std::list::iterator anGroupIt = anGroupList.begin(); const std::list &anGroupList = aRefListOfGroups->list(); - std::list::const_iterator anGroupIt = anGroupList.begin(); + auto anGroupIt = anGroupList.begin(); for (; anGroupIt != anGroupList.end(); ++anGroupIt) { std::shared_ptr aFeature = ModelAPI_Feature::feature(*anGroupIt); @@ -84,7 +84,7 @@ void FeaturesPlugin_ImportResult::execute() { } } - std::list::iterator aResIter = aResults.begin(); + auto aResIter = aResults.begin(); for (; aResIter != aResults.end(); aResIter++) { GeomShapePtr aShape = (*aResIter)->shape(); if (!aShape.get() || aShape->isNull()) @@ -103,7 +103,7 @@ void FeaturesPlugin_ImportResult::execute() { std::list aDocuments; /// documents of Parts aDocuments.push_back((*aResIter)->document()); - std::list::iterator aDoc = aDocuments.begin(); + auto aDoc = aDocuments.begin(); for (; aDoc != aDocuments.end(); aDoc++) { // groups int aGroupCount = (*aDoc)->size(ModelAPI_ResultGroup::group()); @@ -130,7 +130,7 @@ void FeaturesPlugin_ImportResult::execute() { // Check: may be this group already exists in the list bool anIsFound = false; - std::list::iterator anIter = aGroups.begin(); + auto anIter = aGroups.begin(); for (; anIter != aGroups.end(); anIter++) { if (*anIter == aResultGroup) { anIsFound = true; @@ -143,7 +143,7 @@ void FeaturesPlugin_ImportResult::execute() { } } - std::list::iterator anIter = aGroups.begin(); + auto anIter = aGroups.begin(); for (; anIter != aGroups.end(); anIter++) { DocumentPtr aDoc = (*anIter)->document(); @@ -173,8 +173,7 @@ void FeaturesPlugin_ImportResult::execute() { GeomAPI_ShapeExplorer anExplo(aLocalShape, aTypeOfShape); for (; anExplo.more(); anExplo.next()) { GeomShapePtr anExploredShape = anExplo.current(); - std::set::iterator aResultIter = - aGlobalResultsCashed.begin(); + auto aResultIter = aGlobalResultsCashed.begin(); for (; aResultIter != aGlobalResultsCashed.end(); aResultIter++) { GeomShapePtr aCashedShape = (*aResultIter)->shape(); if (aCashedShape->isSubShape(anExploredShape)) diff --git a/src/FeaturesPlugin/FeaturesPlugin_ImportResult.h b/src/FeaturesPlugin/FeaturesPlugin_ImportResult.h index 713900851..dd15a925f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ImportResult.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ImportResult.h @@ -46,7 +46,7 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_ImportResult::ID(); return MY_KIND; } @@ -58,39 +58,39 @@ public: } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Appends a feature - FEATURESPLUGIN_EXPORT virtual std::shared_ptr - addFeature(std::string theID); + FEATURESPLUGIN_EXPORT std::shared_ptr + addFeature(std::string theID) override; /// \return the number of sub-elements. - FEATURESPLUGIN_EXPORT virtual int numberOfSubs(bool forTree = false) const; + FEATURESPLUGIN_EXPORT int numberOfSubs(bool forTree = false) const override; /// \return the sub-feature by zero-base index. - FEATURESPLUGIN_EXPORT virtual std::shared_ptr - subFeature(const int theIndex, bool forTree = false); + FEATURESPLUGIN_EXPORT std::shared_ptr + subFeature(const int theIndex, bool forTree = false) override; /// \return the sub-feature unique identifier in this composite feature by /// zero-base index. - FEATURESPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const; + FEATURESPLUGIN_EXPORT int subFeatureId(const int theIndex) const override; /// \return true if feature or result belong to this composite feature as /// subs. - FEATURESPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const; + FEATURESPLUGIN_EXPORT bool isSub(ObjectPtr theObject) const override; /// This method to inform that sub-feature is removed and must be removed from /// the internal data structures of the owner (the remove from the document /// will be done outside just after). - FEATURESPLUGIN_EXPORT virtual void - removeFeature(std::shared_ptr theFeature); + FEATURESPLUGIN_EXPORT void + removeFeature(std::shared_ptr theFeature) override; /// Use plugin manager for features creation. - FeaturesPlugin_ImportResult() {} + FeaturesPlugin_ImportResult() = default; }; /// \class FeaturesPlugin_ValidatorImportResults @@ -104,9 +104,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.cpp b/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.cpp index 9d5e27635..d9abcf170 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.cpp @@ -38,7 +38,8 @@ #include //================================================================================================= -FeaturesPlugin_InspectBoundingBox::FeaturesPlugin_InspectBoundingBox() {} +FeaturesPlugin_InspectBoundingBox::FeaturesPlugin_InspectBoundingBox() = + default; //================================================================================================= void FeaturesPlugin_InspectBoundingBox::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.h b/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.h index 14b864667..08b187379 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.h +++ b/src/FeaturesPlugin/FeaturesPlugin_InspectBoundingBox.h @@ -91,28 +91,29 @@ public: } /// \return the kind of a feature. - virtual const std::string &getKind() { return ID(); } + const std::string &getKind() override { return ID(); } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + FEATURESPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. - FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; } + FEATURESPLUGIN_EXPORT bool isMacro() const override { return true; } /// Use plugin manager for features creation FeaturesPlugin_InspectBoundingBox(); private: /// Return Attribut values of result. - virtual AttributePtr attributResultValues(); + AttributePtr attributResultValues() override; /// Update values displayed. bool updateValues(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.cpp b/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.cpp index e0d01aa4c..f75ffe5a6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.cpp @@ -45,7 +45,8 @@ #include //================================================================================================= -FeaturesPlugin_InspectNormalToFace::FeaturesPlugin_InspectNormalToFace() {} +FeaturesPlugin_InspectNormalToFace::FeaturesPlugin_InspectNormalToFace() = + default; //================================================================================================= void FeaturesPlugin_InspectNormalToFace::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.h b/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.h index e159f17a8..f799858e5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.h +++ b/src/FeaturesPlugin/FeaturesPlugin_InspectNormalToFace.h @@ -64,21 +64,22 @@ public: } /// \return the kind of a feature. - virtual const std::string &getKind() { return ID(); } + const std::string &getKind() override { return ID(); } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + FEATURESPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. - FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; } + FEATURESPLUGIN_EXPORT bool isMacro() const override { return true; } /// Use plugin manager for features creation FeaturesPlugin_InspectNormalToFace(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp b/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp index bf84ae45e..20dda6b64 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp @@ -40,7 +40,7 @@ static const std::string INTERSECTION_VERSION_1("v9.5"); static const double DEFAULT_FUZZY = 1.e-5; //================================================================================================= -FeaturesPlugin_Intersection::FeaturesPlugin_Intersection() {} +FeaturesPlugin_Intersection::FeaturesPlugin_Intersection() = default; //================================================================================================= void FeaturesPlugin_Intersection::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Intersection.h b/src/FeaturesPlugin/FeaturesPlugin_Intersection.h index e5a79609c..c3b3bb6be 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Intersection.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Intersection.h @@ -59,17 +59,17 @@ public: } /// Returns the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Intersection::ID(); return MY_KIND; } /// Executes feature. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation. FeaturesPlugin_Intersection(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.cpp b/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.cpp index aa5dad597..14d7c6937 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.cpp @@ -30,7 +30,7 @@ #include //================================================================================================= -FeaturesPlugin_LimitTolerance::FeaturesPlugin_LimitTolerance() {} +FeaturesPlugin_LimitTolerance::FeaturesPlugin_LimitTolerance() = default; //================================================================================================= void FeaturesPlugin_LimitTolerance::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.h b/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.h index 644ad2819..a861c0325 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.h +++ b/src/FeaturesPlugin/FeaturesPlugin_LimitTolerance.h @@ -39,7 +39,7 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_LimitTolerance::ID(); return MY_KIND; } @@ -58,10 +58,10 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Performs the algorithm and stores results in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; public: /// Use plugin manager for features creation. diff --git a/src/FeaturesPlugin/FeaturesPlugin_Loft.cpp b/src/FeaturesPlugin/FeaturesPlugin_Loft.cpp index 21d53686b..4b26d3a13 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Loft.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Loft.cpp @@ -33,7 +33,7 @@ #include //================================================================================================== -FeaturesPlugin_Loft::FeaturesPlugin_Loft() {} +FeaturesPlugin_Loft::FeaturesPlugin_Loft() = default; //================================================================================================== void FeaturesPlugin_Loft::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Loft.h b/src/FeaturesPlugin/FeaturesPlugin_Loft.h index 273457be3..84ac21050 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Loft.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Loft.h @@ -60,17 +60,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Loft::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation FeaturesPlugin_Loft(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp index 4e21f8886..7f3df9557 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp @@ -54,7 +54,7 @@ #include #include -FeaturesPlugin_Measurement::FeaturesPlugin_Measurement() : mySceenScale(1) {} +FeaturesPlugin_Measurement::FeaturesPlugin_Measurement() {} void FeaturesPlugin_Measurement::initAttributes() { data()->addAttribute(FeaturesPlugin_Measurement::MEASURE_KIND(), @@ -335,9 +335,8 @@ void FeaturesPlugin_Measurement::computeAngle() { attribute(RESULT_VALUES_ID())); aValues->setSize((int)aValuesList.size()); int anIndex = 0; - for (std::list::iterator anIt = aValuesList.begin(); - anIt != aValuesList.end(); ++anIt) - aValues->setValue(anIndex++, *anIt); + for (double &anIt : aValuesList) + aValues->setValue(anIndex++, anIt); } static GeomVertexPtr @@ -489,8 +488,8 @@ FeaturesPlugin_Measurement::distanceDimension(AISObjectPtr thePrevious) { } if (aShape1 && aShape2) { - const TopoDS_Shape &aShp1 = aShape1->impl(); - const TopoDS_Shape &aShp2 = aShape2->impl(); + const auto &aShp1 = aShape1->impl(); + const auto &aShp2 = aShape2->impl(); BRepExtrema_DistShapeShape aDist(aShp1, aShp2); aDist.Perform(); if (aDist.IsDone()) { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Measurement.h b/src/FeaturesPlugin/FeaturesPlugin_Measurement.h index 3f976b371..667481d9f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Measurement.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Measurement.h @@ -47,7 +47,7 @@ public: } /// \return the kind of a feature. - virtual const std::string &getKind() { return ID(); } + const std::string &getKind() override { return ID(); } /// Attribute name for measurement method. inline static const std::string &MEASURE_KIND() { @@ -158,34 +158,35 @@ public: } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + FEATURESPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. - virtual bool isMacro() const { return true; } + bool isMacro() const override { return true; } /** Returns the AIS preview * \param thePrevious - defines a presentation if it was created previously */ - FEATURESPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + FEATURESPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// Set current screen plane /// \param theScreenPlane the screen plane - virtual void setScreenPlane(GeomPlanePtr theScreenPlane) { + void setScreenPlane(GeomPlanePtr theScreenPlane) override { myScreenPlane = theScreenPlane; } /// Set current view scale /// \param theScale the view scale - virtual void setViewScale(double theScale) { mySceenScale = theScale; } + void setViewScale(double theScale) override { mySceenScale = theScale; } /// Use plugin manager for features creation FeaturesPlugin_Measurement(); @@ -229,7 +230,7 @@ private: void setupDimension(AISObjectPtr theDim); GeomPlanePtr myScreenPlane; //< a plane of current screen - double mySceenScale; //< a scale of current view + double mySceenScale{1}; //< a scale of current view }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp index 05a812878..0fcbaf36d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp @@ -53,7 +53,7 @@ static const std::string MULTIROTATION_VERSION_1("v9.5"); //================================================================================================= -FeaturesPlugin_MultiRotation::FeaturesPlugin_MultiRotation() {} +FeaturesPlugin_MultiRotation::FeaturesPlugin_MultiRotation() = default; //================================================================================================= void FeaturesPlugin_MultiRotation::initAttributes() { @@ -181,10 +181,9 @@ void FeaturesPlugin_MultiRotation::performRotation1D() { std::string anError; int aResultIndex = 0; // Moving each part. - for (std::list::iterator aPRes = aParts.begin(); - aPRes != aParts.end(); ++aPRes) { + for (auto &aPart : aParts) { ResultPartPtr anOrigin = - std::dynamic_pointer_cast(*aPRes); + std::dynamic_pointer_cast(aPart); std::shared_ptr aTrsf(new GeomAPI_Trsf()); for (int i = 0; i < nbCopies; ++i) { aTrsf->setRotation(anAxis, i * anAngle); @@ -226,11 +225,10 @@ void FeaturesPlugin_MultiRotation::performRotation1D() { const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); - ++anIt) { + for (auto &anIt : aTopLevel) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, - ListOfShape(), aMakeShapeList, *anIt, + ListOfShape(), aMakeShapeList, anIt, "Rotated"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h index 681c27bec..d78cb41dc 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h @@ -95,17 +95,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_MultiRotation::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation. FeaturesPlugin_MultiRotation(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp index f1b7c02d9..5a4c7bc84 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp @@ -45,7 +45,7 @@ static const std::string MULTITRANSLATION_VERSION_1("v9.5"); //================================================================================================= -FeaturesPlugin_MultiTranslation::FeaturesPlugin_MultiTranslation() {} +FeaturesPlugin_MultiTranslation::FeaturesPlugin_MultiTranslation() = default; //================================================================================================= void FeaturesPlugin_MultiTranslation::initAttributes() { @@ -116,10 +116,9 @@ void FeaturesPlugin_MultiTranslation::execute() { std::string anError; int aResultIndex = 0; // Moving each part. - for (std::list::iterator aPRes = aParts.begin(); - aPRes != aParts.end(); ++aPRes) { + for (auto &aPart : aParts) { ResultPartPtr anOrigin = - std::dynamic_pointer_cast(*aPRes); + std::dynamic_pointer_cast(aPart); std::shared_ptr aTrsf(new GeomAPI_Trsf()); for (int j = 0; j < aSecondNbCopies; j++) { for (int i = 0; i < aFirstNbCopies; i++) { @@ -178,11 +177,10 @@ void FeaturesPlugin_MultiTranslation::execute() { const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); - ++anIt) { + for (auto &anIt : aTopLevel) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, - ListOfShape(), aMakeShapeList, *anIt, + ListOfShape(), aMakeShapeList, anIt, "Translated"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h index 444326679..e8062f198 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h @@ -89,17 +89,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_MultiTranslation::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation. FeaturesPlugin_MultiTranslation(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp index 899045aac..a9fc66652 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.cpp @@ -38,7 +38,7 @@ #include //================================================================================================= -FeaturesPlugin_NormalToFace::FeaturesPlugin_NormalToFace() {} +FeaturesPlugin_NormalToFace::FeaturesPlugin_NormalToFace() = default; //================================================================================================= void FeaturesPlugin_NormalToFace::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.h b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.h index cbd8cb459..e990b83c6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.h +++ b/src/FeaturesPlugin/FeaturesPlugin_NormalToFace.h @@ -57,18 +57,19 @@ public: } /// \return the kind of a feature. - virtual const std::string &getKind() { return ID(); } + const std::string &getKind() override { return ID(); } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + FEATURESPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Use plugin manager for features creation FeaturesPlugin_NormalToFace(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp b/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp index cc379b87c..8d9dff517 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp @@ -53,7 +53,7 @@ static const double DEFAULT_FUZZY = 1.e-5; //================================================================================================= -FeaturesPlugin_Partition::FeaturesPlugin_Partition() {} +FeaturesPlugin_Partition::FeaturesPlugin_Partition() = default; //================================================================================================= void FeaturesPlugin_Partition::initAttributes() { @@ -204,9 +204,8 @@ void FeaturesPlugin_Partition::storeResult( ResultBodyPtr aResultBody = document()->createBody(data(), theIndex); // if result is same as one of the base object, no modification was performed - for (ListOfShape::const_iterator anObj = theObjects.cbegin(); - anObj != theObjects.cend(); ++anObj) { - if (anObj->get() && (*anObj)->isSame(theResultShape)) { + for (const auto &theObject : theObjects) { + if (theObject.get() && theObject->isSame(theResultShape)) { aResultBody->store(theResultShape, false); setResult(aResultBody, theIndex); return; @@ -218,9 +217,7 @@ void FeaturesPlugin_Partition::storeResult( std::shared_ptr aMapOfSubShapes = theMakeShape->mapOfSubShapes(); theObjects.insert(theObjects.end(), thePlanes.begin(), thePlanes.end()); - for (ListOfShape::const_iterator anIt = theObjects.cbegin(); - anIt != theObjects.cend(); ++anIt) { - GeomShapePtr aShape = *anIt; + for (auto aShape : theObjects) { aResultBody->loadModifiedShapes(theMakeShape, aShape, GeomAPI_Shape::EDGE); aResultBody->loadModifiedShapes(theMakeShape, aShape, GeomAPI_Shape::FACE); aResultBody->loadDeletedShapes(theMakeShape, aShape, GeomAPI_Shape::FACE); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Partition.h b/src/FeaturesPlugin/FeaturesPlugin_Partition.h index cc8ef67b7..5f5cfeba8 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Partition.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Partition.h @@ -58,17 +58,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Partition::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation FeaturesPlugin_Partition(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp b/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp index 68bc727c4..c4ed63002 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp @@ -44,7 +44,7 @@ static void storeSubShape(ResultBodyPtr theResultBody, const std::string theName, int &theShapeIndex); //================================================================================================== -FeaturesPlugin_Pipe::FeaturesPlugin_Pipe() {} +FeaturesPlugin_Pipe::FeaturesPlugin_Pipe() = default; //================================================================================================== void FeaturesPlugin_Pipe::initAttributes() { @@ -137,12 +137,10 @@ void FeaturesPlugin_Pipe::execute() { } // Make faces from sketch wires. - for (std::map::const_iterator anIt = - aSketchWiresMap.cbegin(); - anIt != aSketchWiresMap.cend(); ++anIt) { + for (const auto &anIt : aSketchWiresMap) { const std::shared_ptr aSketchPlanarEdges = - std::dynamic_pointer_cast((*anIt).first->shape()); - const ListOfShape &aWiresList = (*anIt).second; + std::dynamic_pointer_cast(anIt.first->shape()); + const ListOfShape &aWiresList = anIt.second; ListOfShape aFaces; GeomAlgoAPI_ShapeTools::makeFacesWithHoles(aSketchPlanarEdges->origin(), aSketchPlanarEdges->norm(), @@ -234,10 +232,7 @@ void FeaturesPlugin_Pipe::execute() { std::string anError; if (aCreationMethod == CREATION_METHOD_SIMPLE() || aCreationMethod == CREATION_METHOD_BINORMAL()) { - for (ListOfShape::const_iterator anIter = aBaseShapesList.cbegin(); - anIter != aBaseShapesList.cend(); anIter++) { - std::shared_ptr aBaseShape = *anIter; - + for (auto aBaseShape : aBaseShapesList) { std::shared_ptr aPipeAlgo( aCreationMethod == CREATION_METHOD_SIMPLE() ? new GeomAlgoAPI_Pipe(aBaseShape, aPathShape) @@ -356,9 +351,7 @@ void FeaturesPlugin_Pipe::storeResult( aResultBody->storeGenerated(theBaseShapes.front(), thePipeAlgo->shape()); // Store generated edges/faces. - for (ListOfShape::const_iterator anIter = theBaseShapes.cbegin(); - anIter != theBaseShapes.cend(); ++anIter) { - GeomShapePtr aBaseShape = *anIter; + for (auto aBaseShape : theBaseShapes) { GeomAPI_Shape::ShapeType aBaseShapeType = aBaseShape->shapeType(); GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE; switch (aBaseShapeType) { @@ -441,10 +434,7 @@ void FeaturesPlugin_Pipe::storeShapes( // Store shapes. int aShapeIndex = 1; int aFaceIndex = 1; - for (ListOfShape::const_iterator anIt = theShapes.cbegin(); - anIt != theShapes.cend(); ++anIt) { - GeomShapePtr aShape = *anIt; - + for (auto aShape : theShapes) { if (aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) { std::string aName = theName + diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp index 8fa1b744b..0378c0b6f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp @@ -44,7 +44,7 @@ static const std::string PLACEMENT_VERSION_1("v9.5"); -FeaturesPlugin_Placement::FeaturesPlugin_Placement() {} +FeaturesPlugin_Placement::FeaturesPlugin_Placement() = default; void FeaturesPlugin_Placement::initAttributes() { AttributeSelectionListPtr aSelection = @@ -124,8 +124,8 @@ void FeaturesPlugin_Placement::execute() { // Verify planarity of faces and linearity of edges std::shared_ptr aShapes[2] = {aStartShape, anEndShape}; - for (int i = 0; i < 2; i++) { - if (!isShapeValid(aShapes[i])) { + for (auto &aShape : aShapes) { + if (!isShapeValid(aShape)) { return; } } @@ -148,11 +148,10 @@ void FeaturesPlugin_Placement::execute() { int aResultIndex = 0; std::string anError; - for (std::list::iterator aPRes = aParts.begin(); - aPRes != aParts.end(); ++aPRes) { + for (auto &aPart : aParts) { // Applying transformation to each part. ResultPartPtr anOrigin = - std::dynamic_pointer_cast(*aPRes); + std::dynamic_pointer_cast(aPart); ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex); aResultPart->setTrsf(aContextRes, aTrsf); @@ -184,12 +183,11 @@ void FeaturesPlugin_Placement::execute() { const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); - ++anIt) { + for (auto &anIt : aTopLevel) { // LoadNamingDS ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, - ListOfShape(), aMakeShapeList, *anIt, + ListOfShape(), aMakeShapeList, anIt, "Placed"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.h b/src/FeaturesPlugin/FeaturesPlugin_Placement.h index d2040e198..1bb605c60 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.h @@ -76,17 +76,17 @@ public: } /// Returns the kind of a feature - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Placement::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation FeaturesPlugin_Placement(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Plugin.h b/src/FeaturesPlugin/FeaturesPlugin_Plugin.h index 76aed2eac..b996f8bee 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Plugin.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Plugin.h @@ -32,7 +32,7 @@ class FEATURESPLUGIN_EXPORT FeaturesPlugin_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - virtual FeaturePtr createFeature(std::string theFeatureID); + FeaturePtr createFeature(std::string theFeatureID) override; public: /// Default constructor diff --git a/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.cpp b/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.cpp index 085d7ac0b..fe67577e4 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.cpp @@ -34,7 +34,7 @@ #include //================================================================================================= -FeaturesPlugin_PointCloudOnFace::FeaturesPlugin_PointCloudOnFace() {} +FeaturesPlugin_PointCloudOnFace::FeaturesPlugin_PointCloudOnFace() = default; //================================================================================================= void FeaturesPlugin_PointCloudOnFace::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.h b/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.h index 59e6c3db9..46f09a823 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.h +++ b/src/FeaturesPlugin/FeaturesPlugin_PointCloudOnFace.h @@ -45,7 +45,7 @@ public: } /// \return the kind of a feature. - virtual const std::string &getKind() { return ID(); } + const std::string &getKind() override { return ID(); } /// Attribute name of number of points in the point cloud. inline static const std::string &NUMBER_ID() { @@ -54,15 +54,16 @@ public: } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + FEATURESPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Use plugin manager for features creation FeaturesPlugin_PointCloudOnFace(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.cpp b/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.cpp index b77ed10a1..7f0a3e5e5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.cpp @@ -38,7 +38,7 @@ #include #include -FeaturesPlugin_PointCoordinates::FeaturesPlugin_PointCoordinates() {} +FeaturesPlugin_PointCoordinates::FeaturesPlugin_PointCoordinates() = default; void FeaturesPlugin_PointCoordinates::initAttributes() { // attribute for point selected diff --git a/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.h b/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.h index 6c74ae210..941741ccf 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.h +++ b/src/FeaturesPlugin/FeaturesPlugin_PointCoordinates.h @@ -69,21 +69,22 @@ public: } /// \return the kind of a feature. - virtual const std::string &getKind() { return ID(); } + const std::string &getKind() override { return ID(); } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + FEATURESPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. - FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; } + FEATURESPLUGIN_EXPORT bool isMacro() const override { return true; } /// Use plugin manager for features creation FeaturesPlugin_PointCoordinates(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp b/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp index c2a2eac4e..a8d1415a5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp @@ -34,8 +34,7 @@ #include #include -FeaturesPlugin_Recover::FeaturesPlugin_Recover() - : myClearListOnTypeChange(true) {} +FeaturesPlugin_Recover::FeaturesPlugin_Recover() {} void FeaturesPlugin_Recover::initAttributes() { data()->addAttribute(BASE_FEATURE(), ModelAPI_AttributeReference::typeId()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Recover.h b/src/FeaturesPlugin/FeaturesPlugin_Recover.h index 5f1bc2c35..a29bac759 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Recover.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Recover.h @@ -40,7 +40,7 @@ class FeaturesPlugin_Recover : public ModelAPI_Feature { /// previous state of persistent flag bool myPersistent; /// necessity to clean recovered list while changing the type of recover - bool myClearListOnTypeChange; + bool myClearListOnTypeChange{true}; public: /// Extrusion kind diff --git a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp index 860954e66..b8ffe41e6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp @@ -37,7 +37,7 @@ #include //================================================================================================== -FeaturesPlugin_RemoveSubShapes::FeaturesPlugin_RemoveSubShapes() {} +FeaturesPlugin_RemoveSubShapes::FeaturesPlugin_RemoveSubShapes() = default; //================================================================================================== void FeaturesPlugin_RemoveSubShapes::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp b/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp index e79e62e65..77736856f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp @@ -34,7 +34,7 @@ #include //================================================================================================= -FeaturesPlugin_Revolution::FeaturesPlugin_Revolution() {} +FeaturesPlugin_Revolution::FeaturesPlugin_Revolution() = default; //================================================================================================= void FeaturesPlugin_Revolution::initAttributes() { @@ -73,8 +73,8 @@ void FeaturesPlugin_Revolution::execute() { // Store results. int aResultIndex = 0; - ListOfShape::const_iterator aBaseIt = aBaseShapesList.cbegin(); - ListOfMakeShape::const_iterator anAlgoIt = aMakeShapesList.cbegin(); + auto aBaseIt = aBaseShapesList.cbegin(); + auto anAlgoIt = aMakeShapesList.cbegin(); for (; aBaseIt != aBaseShapesList.cend() && anAlgoIt != aMakeShapesList.cend(); ++aBaseIt, ++anAlgoIt) { @@ -180,10 +180,7 @@ bool FeaturesPlugin_Revolution::makeRevolutions( // Generating result for each base shape. std::string anError; - for (ListOfShape::const_iterator anIter = theBaseShapes.cbegin(); - anIter != theBaseShapes.cend(); anIter++) { - GeomShapePtr aBaseShape = *anIter; - + for (auto aBaseShape : theBaseShapes) { std::shared_ptr aRevolAlgo( new GeomAlgoAPI_Revolution(aBaseShape, anAxis, aToShape, aToAngle, aFromShape, aFromAngle)); diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h index cf9badf99..12f9f7f60 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h @@ -33,19 +33,20 @@ class FeaturesPlugin_RevolutionBoolean public: /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; protected: - FeaturesPlugin_RevolutionBoolean(){}; + FeaturesPlugin_RevolutionBoolean() = default; + ; // Creates revolutions. bool makeGeneration(ListOfShape &theBaseShapes, - ListOfMakeShape &theMakeShapes); + ListOfMakeShape &theMakeShapes) override; /// Stores generation history. void storeGenerationHistory( ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape); + const std::shared_ptr theMakeShape) override; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h index db77a0adb..2f0fcbe57 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h @@ -40,13 +40,13 @@ public: } /// \return the kind of a feature - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_RevolutionCut::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h index 2f6baf22e..8651ae98e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h @@ -40,13 +40,13 @@ public: } /// \return the kind of a feature - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_RevolutionFuse::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp index a5f030b35..e110e424b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp @@ -44,7 +44,7 @@ static const std::string ROTATION_VERSION_1("v9.5"); //================================================================================================= -FeaturesPlugin_Rotation::FeaturesPlugin_Rotation() {} +FeaturesPlugin_Rotation::FeaturesPlugin_Rotation() = default; //================================================================================================= void FeaturesPlugin_Rotation::initAttributes() { @@ -140,8 +140,8 @@ GeomTrsfPtr FeaturesPlugin_Rotation::rotationByThreePoints() { selection(FeaturesPlugin_Rotation::START_POINT_ID()); std::shared_ptr anEndPointRef = selection(FeaturesPlugin_Rotation::END_POINT_ID()); - if ((aCenterRef.get() != NULL) && (aStartPointRef.get() != NULL) && - (anEndPointRef.get() != NULL)) { + if ((aCenterRef.get() != nullptr) && (aStartPointRef.get() != nullptr) && + (anEndPointRef.get() != nullptr)) { GeomShapePtr aCenterShape = aCenterRef->value(); if (!aCenterShape.get() && aCenterRef->context().get()) aCenterShape = aCenterRef->context()->shape(); @@ -187,10 +187,9 @@ void FeaturesPlugin_Rotation::performRotation(const GeomTrsfPtr &theTrsf) { std::string anError; int aResultIndex = 0; // Rotating each part. - for (std::list::iterator aPRes = aParts.begin(); - aPRes != aParts.end(); ++aPRes) { + for (auto &aPart : aParts) { ResultPartPtr anOriginal = - std::dynamic_pointer_cast(*aPRes); + std::dynamic_pointer_cast(aPart); ResultPartPtr aResultPart = document()->copyPart(anOriginal, data(), aResultIndex); aResultPart->setTrsf(anOriginal, theTrsf); @@ -221,11 +220,10 @@ void FeaturesPlugin_Rotation::performRotation(const GeomTrsfPtr &theTrsf) { const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); - ++anIt) { + for (auto &anIt : aTopLevel) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, - ListOfShape(), aMakeShapeList, *anIt, + ListOfShape(), aMakeShapeList, anIt, "Rotated"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Rotation.h b/src/FeaturesPlugin/FeaturesPlugin_Rotation.h index a21998b37..5043488a5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Rotation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Rotation.h @@ -93,17 +93,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Rotation::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation. FeaturesPlugin_Rotation(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp b/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp index f62a42a9e..02ed93585 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Scale.cpp @@ -38,7 +38,7 @@ static const std::string SCALE_VERSION_1("v9.5"); //================================================================================================= -FeaturesPlugin_Scale::FeaturesPlugin_Scale() {} +FeaturesPlugin_Scale::FeaturesPlugin_Scale() = default; //================================================================================================= void FeaturesPlugin_Scale::initAttributes() { @@ -100,7 +100,7 @@ void FeaturesPlugin_Scale::performScaleByFactor() { std::shared_ptr aCenterPoint; std::shared_ptr anObjRef = selection(FeaturesPlugin_Scale::CENTER_POINT_ID()); - if (anObjRef.get() != NULL) { + if (anObjRef.get() != nullptr) { GeomShapePtr aShape = anObjRef->value(); if (!aShape.get()) { aShape = anObjRef->context()->shape(); @@ -139,11 +139,10 @@ void FeaturesPlugin_Scale::performScaleByFactor() { const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); - ++anIt) { + for (auto &anIt : aTopLevel) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, - ListOfShape(), aMakeShapeList, *anIt, + ListOfShape(), aMakeShapeList, anIt, "Scaled"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); @@ -171,7 +170,7 @@ void FeaturesPlugin_Scale::performScaleByDimensions() { std::shared_ptr aCenterPoint; std::shared_ptr anObjRef = selection(FeaturesPlugin_Scale::CENTER_POINT_ID()); - if (anObjRef.get() != NULL) { + if (anObjRef.get() != nullptr) { GeomShapePtr aShape = anObjRef->value(); if (!aShape.get()) { aShape = anObjRef->context()->shape(); @@ -215,11 +214,10 @@ void FeaturesPlugin_Scale::performScaleByDimensions() { const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); - ++anIt) { + for (auto &anIt : aTopLevel) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, - ListOfShape(), aMakeShapeList, *anIt, + ListOfShape(), aMakeShapeList, anIt, "Scaled"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Scale.h b/src/FeaturesPlugin/FeaturesPlugin_Scale.h index f51363387..68cdb23ba 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Scale.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Scale.h @@ -92,17 +92,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Scale::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation. FeaturesPlugin_Scale(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Sewing.cpp b/src/FeaturesPlugin/FeaturesPlugin_Sewing.cpp index d22910403..d413049da 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Sewing.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Sewing.cpp @@ -31,7 +31,7 @@ #include //================================================================================================= -FeaturesPlugin_Sewing::FeaturesPlugin_Sewing() {} +FeaturesPlugin_Sewing::FeaturesPlugin_Sewing() = default; //================================================================================================= void FeaturesPlugin_Sewing::initAttributes() { @@ -106,9 +106,7 @@ bool FeaturesPlugin_Sewing::isSewn(const ListOfShape &theInputs, // * both arguments have the same number of shells // * the total number of faces in these shells did NOT change. int nbInputShells = 0, nbInputFaces = 0; - for (ListOfShape::const_iterator anIt = theInputs.cbegin(); - anIt != theInputs.cend(); ++anIt) { - GeomShapePtr aShape = *anIt; + for (auto aShape : theInputs) { if (aShape.get()) { if (aShape->isShell()) nbInputShells++; @@ -120,9 +118,7 @@ bool FeaturesPlugin_Sewing::isSewn(const ListOfShape &theInputs, if (theResult->isCompound()) { ListOfShape shells = theResult->subShapes(GeomAPI_Shape::SHELL, true); nbResultShells = shells.size(); - for (ListOfShape::const_iterator anIt = shells.cbegin(); - anIt != shells.cend(); ++anIt) { - GeomShapePtr aShape = *anIt; + for (auto aShape : shells) { if (aShape.get() && aShape->isShell()) { nbInputFaces += aShape->subShapes(GeomAPI_Shape::FACE, true).size(); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Sewing.h b/src/FeaturesPlugin/FeaturesPlugin_Sewing.h index 9a7647405..4a48b2c68 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Sewing.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Sewing.h @@ -39,7 +39,7 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Sewing::ID(); return MY_KIND; } @@ -70,10 +70,10 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Performs the algorithm and stores results in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; public: /// Use plugin manager for features creation. diff --git a/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.cpp b/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.cpp index 6ce3e7b10..3673ba10d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.cpp @@ -34,7 +34,7 @@ #include //================================================================================================= -FeaturesPlugin_SharedFaces::FeaturesPlugin_SharedFaces() {} +FeaturesPlugin_SharedFaces::FeaturesPlugin_SharedFaces() = default; //================================================================================================= void FeaturesPlugin_SharedFaces::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.h b/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.h index 79a7972f2..a3ef51c4a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.h +++ b/src/FeaturesPlugin/FeaturesPlugin_SharedFaces.h @@ -78,37 +78,38 @@ public: } /// \return the kind of a feature. - virtual const std::string &getKind() { return ID(); } + const std::string &getKind() override { return ID(); } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + FEATURESPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. - FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; } + FEATURESPLUGIN_EXPORT bool isMacro() const override { return true; } /// Use plugin manager for features creation FeaturesPlugin_SharedFaces(); private: /// Return attribut values of object. - virtual AttributePtr attributObject(); + AttributePtr attributObject() override; /// Return attribut values of list of faces. - virtual AttributePtr attributListFaces(); + AttributePtr attributListFaces() override; /// Return attribut values of number of faces. - virtual AttributePtr attributNumberFaces(); + AttributePtr attributNumberFaces() override; /// Return attribut values of IsCompute. - virtual AttributePtr attributIsCompute(); + AttributePtr attributIsCompute() override; /// Create group void createGroup(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp index 8c29205c7..728b76a37 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp @@ -49,7 +49,7 @@ static const std::string SYMMETRY_VERSION_1("v9.5"); //================================================================================================= -FeaturesPlugin_Symmetry::FeaturesPlugin_Symmetry() {} +FeaturesPlugin_Symmetry::FeaturesPlugin_Symmetry() = default; //================================================================================================= void FeaturesPlugin_Symmetry::initAttributes() { @@ -102,7 +102,7 @@ GeomTrsfPtr FeaturesPlugin_Symmetry::symmetryByPoint() { std::shared_ptr aPoint; AttributeSelectionPtr anObjRef = selection(FeaturesPlugin_Symmetry::POINT_OBJECT_ID()); - if (anObjRef.get() != NULL) { + if (anObjRef.get() != nullptr) { GeomShapePtr aShape1 = anObjRef->value(); if (!aShape1.get()) { aShape1 = anObjRef->context()->shape(); @@ -283,10 +283,9 @@ void FeaturesPlugin_Symmetry::performSymmetry(GeomTrsfPtr theTrsf) { std::string anError; int aResultIndex = 0; // Symmetrying parts. - for (std::list::iterator aPRes = aParts.begin(); - aPRes != aParts.end(); ++aPRes) { + for (auto &aPart : aParts) { ResultPartPtr anOriginal = - std::dynamic_pointer_cast(*aPRes); + std::dynamic_pointer_cast(aPart); buildResult(anOriginal, theTrsf, aResultIndex); } @@ -307,9 +306,8 @@ void FeaturesPlugin_Symmetry::performSymmetry(GeomTrsfPtr theTrsf) { const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); - ++anIt) - buildResult(aMakeShapeList, anOriginalShapes, *anIt, aResultIndex, + for (auto &anIt : aTopLevel) + buildResult(aMakeShapeList, anOriginalShapes, anIt, aResultIndex, aTextureSource); // Remove the rest results if there were produced in the previous pass. diff --git a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h index 85a1d3592..e20902950 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h @@ -97,17 +97,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Symmetry::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation. FeaturesPlugin_Symmetry(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp b/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp index ecd01451d..f56c29258 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp @@ -119,12 +119,10 @@ bool FeaturesPlugin_Tools::getShape( } // Make faces from sketch wires. - for (std::map::const_iterator anIt = - aSketchWiresMap.cbegin(); - anIt != aSketchWiresMap.cend(); ++anIt) { + for (const auto &anIt : aSketchWiresMap) { const std::shared_ptr aSketchPlanarEdges = - std::dynamic_pointer_cast((*anIt).first->shape()); - const ListOfShape &aWiresList = (*anIt).second; + std::dynamic_pointer_cast(anIt.first->shape()); + const ListOfShape &aWiresList = anIt.second; ListOfShape aFaces; GeomAlgoAPI_ShapeTools::makeFacesWithHoles(aSketchPlanarEdges->origin(), aSketchPlanarEdges->norm(), diff --git a/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp index 0d4381f74..47ee555af 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Translation.cpp @@ -46,7 +46,7 @@ static const std::string TRANSLATION_VERSION_1("v9.5"); //================================================================================================= -FeaturesPlugin_Translation::FeaturesPlugin_Translation() {} +FeaturesPlugin_Translation::FeaturesPlugin_Translation() = default; //================================================================================================= void FeaturesPlugin_Translation::initAttributes() { @@ -160,7 +160,7 @@ GeomTrsfPtr FeaturesPlugin_Translation::translationByTwoPoints() { data()->selection(FeaturesPlugin_Translation::END_POINT_ID()); std::shared_ptr aFirstPoint; std::shared_ptr aSecondPoint; - if ((aRef1.get() != NULL) && (aRef2.get() != NULL)) { + if ((aRef1.get() != nullptr) && (aRef2.get() != nullptr)) { GeomShapePtr aShape1 = aRef1->value(); if (!aShape1.get()) // If we can't get the points directly, try getting them // from the context @@ -203,10 +203,9 @@ void FeaturesPlugin_Translation::performTranslation( std::string anError; int aResultIndex = 0; // Moving each part. - for (std::list::iterator aPRes = aParts.begin(); - aPRes != aParts.end(); ++aPRes) { + for (auto &aPart : aParts) { ResultPartPtr anOrigin = - std::dynamic_pointer_cast(*aPRes); + std::dynamic_pointer_cast(aPart); ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex); aResultPart->setTrsf(anOrigin, theTrsf); @@ -238,12 +237,11 @@ void FeaturesPlugin_Translation::performTranslation( const ListOfShape &anOriginalShapes = anObjects.objects(); ListOfShape aTopLevel; anObjects.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); - ++anIt) { + for (auto &anIt : aTopLevel) { // LoadNamingDS ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, - ListOfShape(), aMakeShapeList, *anIt, + ListOfShape(), aMakeShapeList, anIt, "Translated"); // Copy image data, if any ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Translation.h b/src/FeaturesPlugin/FeaturesPlugin_Translation.h index fac9d3f50..27cc5279c 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Translation.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Translation.h @@ -111,17 +111,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Translation::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes. - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation. FeaturesPlugin_Translation(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Union.cpp b/src/FeaturesPlugin/FeaturesPlugin_Union.cpp index 96aad491a..80a854482 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Union.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Union.cpp @@ -30,7 +30,7 @@ #include #include -#include > +#include //> #include #include #include @@ -39,7 +39,7 @@ static const double DEFAULT_FUZZY = 1.e-5; //================================================================================================= -FeaturesPlugin_Union::FeaturesPlugin_Union() {} +FeaturesPlugin_Union::FeaturesPlugin_Union() = default; //================================================================================================= void FeaturesPlugin_Union::initAttributes() { @@ -110,10 +110,8 @@ void FeaturesPlugin_Union::execute() { std::shared_ptr aMakeShapeList( new GeomAlgoAPI_MakeShapeList()); - for (std::vector::iterator aRBAIt = - aResultBaseAlgoList.begin(); - aRBAIt != aResultBaseAlgoList.end(); ++aRBAIt) { - aMakeShapeList->appendAlgo(aRBAIt->makeShape); + for (auto &aRBAIt : aResultBaseAlgoList) { + aMakeShapeList->appendAlgo(aRBAIt.makeShape); } GeomShapePtr aShape; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Union.h b/src/FeaturesPlugin/FeaturesPlugin_Union.h index 8039ccd1e..35d4f681a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Union.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Union.h @@ -55,17 +55,17 @@ public: } /// \return the kind of a feature. - FEATURESPLUGIN_EXPORT virtual const std::string &getKind() { + FEATURESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = FeaturesPlugin_Union::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + FEATURESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation FeaturesPlugin_Union(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.h b/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.h index 39f291250..548c43f59 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.h @@ -34,9 +34,9 @@ public: * \param theArguments arguments of the attribute * \param theError error message */ - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp index 97e0800d0..39781e87d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp @@ -74,7 +74,7 @@ //================================================================================================== bool FeaturesPlugin_ValidatorPipePath::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeSelectionPtr aPathAttrSelection = std::dynamic_pointer_cast(theAttribute); @@ -105,7 +105,7 @@ bool FeaturesPlugin_ValidatorPipePath::isValid( //================================================================================================== bool FeaturesPlugin_ValidatorPipeLocations::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); @@ -183,7 +183,7 @@ bool FeaturesPlugin_ValidatorPipeLocations::isValid( // LCOV_EXCL_START bool FeaturesPlugin_ValidatorPipeLocationsNumber::isValid( const std::shared_ptr &theFeature, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { static const std::string aCreationMethodID = "creation_method"; static const std::string aBaseObjectsID = "base_objects"; @@ -236,7 +236,7 @@ bool FeaturesPlugin_ValidatorPipeLocationsNumber::isValid( //================================================================================================== bool FeaturesPlugin_ValidatorLoftSameTypeShape::isValid( const std::shared_ptr &theFeature, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { static const std::string aFirstObjetcID = "first_object"; static const std::string aSecondObjetcID = "second_object"; @@ -431,10 +431,7 @@ bool FeaturesPlugin_ValidatorBaseForGenerationSketchOrSketchObjects::isValid( } } - for (std::set::const_iterator anIt = - aSelectedSketches.cbegin(); - anIt != aSelectedSketches.cend(); ++anIt) { - ResultConstructionPtr aResultConstruction = *anIt; + for (auto aResultConstruction : aSelectedSketches) { if (aSelectedSketchesFromObjects.find(aResultConstruction) != aSelectedSketchesFromObjects.cend()) { theError = @@ -568,11 +565,10 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute( "wires on sketch, whole sketch (if it has at least one face), " "and whole objects with shape types: %1"; std::string anArgumentString; - for (auto anIt = theArguments.cbegin(); anIt != theArguments.cend(); - ++anIt) { + for (const auto &theArgument : theArguments) { if (!anArgumentString.empty()) anArgumentString += ", "; - anArgumentString += *anIt; + anArgumentString += theArgument; } theError.arg(anArgumentString); return false; @@ -607,7 +603,7 @@ bool FeaturesPlugin_ValidatorCompositeLauncher::isValid( } // first argument is for the base attribute, second - for skipping feature // kind - std::list::const_iterator anIt = theArguments.begin(); + auto anIt = theArguments.begin(); std::string aBaseAttributeId = *anIt; FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); AttributePtr aBaseAttribute = aFeature->attribute(aBaseAttributeId); @@ -623,7 +619,7 @@ bool FeaturesPlugin_ValidatorCompositeLauncher::isValid( anIt++; std::string aFeatureAttributeKind = *anIt; - GeomValidators_FeatureKind *aValidator = new GeomValidators_FeatureKind(); + auto *aValidator = new GeomValidators_FeatureKind(); // check whether the selection is on the sketch std::list anArguments; anArguments.push_back(aFeatureAttributeKind); @@ -631,7 +627,7 @@ bool FeaturesPlugin_ValidatorCompositeLauncher::isValid( bool aFeatureKind = aValidator->isValid(theAttribute, theArguments, theError); bool aPlanarFace = false; // check if selection has Face selected - GeomValidators_ShapeType *aShapeType = new GeomValidators_ShapeType(); + auto *aShapeType = new GeomValidators_ShapeType(); anArguments.clear(); anArguments.push_back("face"); aPlanarFace = aShapeType->isValid(theAttribute, anArguments, theError); @@ -654,7 +650,7 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( // LCOV_EXCL_STOP } - std::list::const_iterator anArgsIt = theArguments.begin(); + auto anArgsIt = theArguments.begin(); AttributePtr aCheckAttribute = theFeature->attribute(*anArgsIt); ++anArgsIt; @@ -800,7 +796,7 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isShapesCanBeEmpty( //================================================================================================== bool FeaturesPlugin_ValidatorExtrusionBoundaryFace::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); @@ -875,10 +871,7 @@ bool FeaturesPlugin_ValidatorExtrusionBoundaryFace::isValid( aFeature->real(FeaturesPlugin_Extrusion::FROM_OFFSET_ID())->value(); // check extrusion - for (ListOfShape::iterator anIt = aBaseShapeList.begin(); - anIt != aBaseShapeList.end(); anIt++) { - std::shared_ptr aBaseShape = *anIt; - + for (auto aBaseShape : aBaseShapeList) { std::shared_ptr aPrismAlgo(new GeomAlgoAPI_Prism( aBaseShape, aDir, aToShape, aToSize, aFromShape, aFromSize)); bool isFailed = GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed( @@ -895,7 +888,7 @@ bool FeaturesPlugin_ValidatorExtrusionBoundaryFace::isValid( //================================================================================================== bool FeaturesPlugin_ValidatorBooleanSelection::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); @@ -985,7 +978,7 @@ bool FeaturesPlugin_ValidatorBooleanSelection::isValid( //================================================================================================== bool FeaturesPlugin_ValidatorFilletSelection::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); @@ -1090,8 +1083,7 @@ bool FeaturesPlugin_ValidatorFillet1DSelection::isValid( GeomShapePtr aVertex = aCurSel->value(); // check wire already processed, if not, store all vertices and edges, // sharing them - std::map::iterator aProcessed = - aWireSubshapes.find(aContext); + auto aProcessed = aWireSubshapes.find(aContext); if (aProcessed == aWireSubshapes.end()) { if (aContext->shapeType() != GeomAPI_Shape::WIRE) { theError = "Selected vertex is not a wire corner"; @@ -1109,7 +1101,7 @@ bool FeaturesPlugin_ValidatorFillet1DSelection::isValid( } // check the vertex - MapShapeToShapes::iterator aFound = aProcessed->second.find(aVertex); + auto aFound = aProcessed->second.find(aVertex); if (aFound == aProcessed->second.end()) { theError = "Selected vertex does not exist in the wire"; return true; @@ -1183,8 +1175,7 @@ bool FeaturesPlugin_ValidatorPartitionSelection::isValid( FeaturePtr aResultFeature = aSelectAttr->contextFeature(); if (aResultFeature.get()) { bool aOkRes = false; - std::list::const_iterator aFRes = - aResultFeature->results().cbegin(); + auto aFRes = aResultFeature->results().cbegin(); for (; aFRes != aResultFeature->results().cend() && !aOkRes; aFRes++) { ResultBodyPtr aBody = std::dynamic_pointer_cast(*aFRes); @@ -1207,7 +1198,7 @@ bool FeaturesPlugin_ValidatorPartitionSelection::isValid( //================================================================================================== bool FeaturesPlugin_ValidatorRemoveSubShapesSelection::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeSelectionListPtr aSubShapesAttrList = std::dynamic_pointer_cast(theAttribute); @@ -1253,9 +1244,8 @@ bool FeaturesPlugin_ValidatorRemoveSubShapesSelection::isValid( AttributeSelectionPtr anAttrSelectionInList = aSubShapesAttrList->value(anIndex); GeomShapePtr aShapeToAdd = anAttrSelectionInList->value(); - for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); - anIt != aSubShapes.cend(); ++anIt) { - if ((*anIt)->isEqual(aShapeToAdd)) { + for (const auto &aSubShape : aSubShapes) { + if (aSubShape->isEqual(aShapeToAdd)) { isSameFound = true; break; } @@ -1273,7 +1263,7 @@ bool FeaturesPlugin_ValidatorRemoveSubShapesSelection::isValid( //================================================================================================== bool FeaturesPlugin_ValidatorRemoveSubShapesResult::isValid( const std::shared_ptr &theFeature, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { static const std::string aBaseShapeID = "base_shape"; static const std::string aSubShapesID = "subshapes_to_keep"; @@ -1336,7 +1326,7 @@ bool FeaturesPlugin_ValidatorRemoveSubShapesResult::isValid( // LCOV_EXCL_START bool FeaturesPlugin_ValidatorUnionSelection::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeSelectionListPtr aBaseObjectsAttrList = std::dynamic_pointer_cast(theAttribute); @@ -1390,7 +1380,7 @@ bool FeaturesPlugin_ValidatorUnionSelection::isValid( //================================================================================================== bool FeaturesPlugin_ValidatorUnionArguments::isValid( const std::shared_ptr &theFeature, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { // LCOV_EXCL_START // Check feature kind. @@ -1473,7 +1463,7 @@ bool FeaturesPlugin_ValidatorConcealedResult::isValid( size_t aConcealedResults = aResults.size(); if (!aConcealedResults && !theArguments.empty()) { // find if these results are touched by the feature in another attribute - std::list::const_iterator anIt = theArguments.begin(); + auto anIt = theArguments.begin(); std::string aRecoveredList = *anIt; if (!aRecoveredList.empty()) { std::shared_ptr aParameterList = @@ -1491,7 +1481,7 @@ bool FeaturesPlugin_ValidatorConcealedResult::isValid( bool FeaturesPlugin_ValidatorCircular::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { static std::list aEdgeArg(1, "circle"); static std::list aFaceArg(1, "cylinder"); @@ -1521,8 +1511,7 @@ bool FeaturesPlugin_ValidatorBooleanArguments::isValid( int anObjectsToolsNb[2] = {0, 0}; - std::list::const_iterator anIt = theArguments.begin(), - aLast = theArguments.end(); + auto anIt = theArguments.begin(), aLast = theArguments.end(); bool isAllInSameCompSolid = true; ResultBodyPtr aCompSolid; @@ -1590,7 +1579,7 @@ bool FeaturesPlugin_ValidatorBooleanArguments::isValid( //================================================================================================= // LCOV_EXCL_START bool FeaturesPlugin_ValidatorBooleanArguments::isNotObligatory( - std::string theFeature, std::string theAttribute) { + std::string /*theFeature*/, std::string theAttribute) { if (theAttribute == "main_objects" || theAttribute == "tool_objects") { return true; } @@ -1602,7 +1591,7 @@ bool FeaturesPlugin_ValidatorBooleanArguments::isNotObligatory( //================================================================================================== bool FeaturesPlugin_ValidatorBooleanSmashSelection::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { std::shared_ptr aFeature = std::dynamic_pointer_cast( @@ -1750,7 +1739,7 @@ bool FeaturesPlugin_ValidatorBooleanSmashSelection::isValid( // LCOV_EXCL_START bool FeaturesPlugin_IntersectionSelection::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { if (!theAttribute.get()) { theError = "Error: empty selection."; @@ -1823,7 +1812,7 @@ bool FeaturesPlugin_IntersectionSelection::isValid( // LCOV_EXCL_START bool FeaturesPlugin_ValidatorBooleanFuseSelection::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); @@ -1891,7 +1880,7 @@ bool FeaturesPlugin_ValidatorBooleanFuseArguments::isValid( int anObjectsNb = 0, aToolsNb = 0; - std::list::const_iterator anIt = theArguments.begin(); + auto anIt = theArguments.begin(); bool isAllInSameCompSolid = true; ResultBodyPtr aCompSolid; @@ -1953,7 +1942,7 @@ bool FeaturesPlugin_ValidatorBooleanFuseArguments::isValid( //================================================================================================= // LCOV_EXCL_START bool FeaturesPlugin_ValidatorBooleanFuseArguments::isNotObligatory( - std::string theFeature, std::string theAttribute) { + std::string /*theFeature*/, std::string theAttribute) { if (theAttribute == "main_objects" || theAttribute == "tool_objects") { return true; } @@ -1966,7 +1955,7 @@ bool FeaturesPlugin_ValidatorBooleanFuseArguments::isNotObligatory( // LCOV_EXCL_START bool FeaturesPlugin_ValidatorBooleanCommonSelection::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); @@ -2040,7 +2029,7 @@ bool FeaturesPlugin_ValidatorBooleanCommonArguments::isValid( int anObjectsNb = 0, aToolsNb = 0; - std::list::const_iterator anIt = theArguments.begin(); + auto anIt = theArguments.begin(); ResultBodyPtr aCompSolid; @@ -2071,7 +2060,7 @@ bool FeaturesPlugin_ValidatorBooleanCommonArguments::isValid( //================================================================================================= // LCOV_EXCL_START bool FeaturesPlugin_ValidatorBooleanCommonArguments::isNotObligatory( - std::string theFeature, std::string theAttribute) { + std::string /*theFeature*/, std::string /*theAttribute*/) { return false; } // LCOV_EXCL_STOP @@ -2079,7 +2068,7 @@ bool FeaturesPlugin_ValidatorBooleanCommonArguments::isNotObligatory( //================================================================================================== bool FeaturesPlugin_ValidatorDefeaturingSelection::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); @@ -2126,7 +2115,7 @@ bool FeaturesPlugin_ValidatorDefeaturingSelection::isValid( //================================================================================================== bool FeaturesPlugin_ValidatorSewingSelection::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); @@ -2178,7 +2167,7 @@ bool FeaturesPlugin_ValidatorSewingSelection::isValid( //================================================================================================== bool FeaturesPlugin_ValidatorGlueFacesSelection::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast(theAttribute); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.h b/src/FeaturesPlugin/FeaturesPlugin_Validators.h index f86f56bb3..12a8f5dca 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.h @@ -33,9 +33,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorPipeLocations @@ -48,9 +48,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorPipeLocationsNumber @@ -63,9 +63,9 @@ public: //! selected bases, or empty. \param theFeature the checked feature \param //! theArguments arguments of the feature (not used) \param theError error //! message - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorLoftSameTypeShape @@ -78,9 +78,9 @@ public: //! \param theFeature the checked feature //! \param theArguments arguments of the feature (not used) //! \param theError error message - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorBaseForGeneration @@ -95,9 +95,9 @@ public: //! arguments. \param[in] theAttribute the checked attribute. \param[in] //! theArguments arguments of the attribute. \param[out] theError error //! message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; private: bool isValidAttribute(const AttributePtr &theAttribute, @@ -117,9 +117,9 @@ public: //! \param theFeature the checked feature //! \param theArguments arguments of the feature (not used) //! \param theError error message - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorCompositeLauncher @@ -132,9 +132,9 @@ public: //! arguments. \param[in] theAttribute the checked attribute. \param[in] //! theArguments arguments of the attribute. \param[out] theError error //! message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorExtrusionDir @@ -148,9 +148,9 @@ public: //! \param[in] theFeature the checked feature. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; private: bool isShapesCanBeEmpty(const AttributePtr &theAttribute, @@ -167,9 +167,9 @@ public: //! \param[in] theFeature the checked feature. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorBooleanSelection @@ -183,9 +183,9 @@ public: /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorFilletSelection @@ -199,9 +199,9 @@ public: /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorFillet1DSelection @@ -215,9 +215,9 @@ public: /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorPartitionSelection @@ -231,9 +231,9 @@ public: /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorRemoveSubShapesSelection @@ -247,9 +247,9 @@ public: /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorRemoveSubShapesResult @@ -262,9 +262,9 @@ public: //! \param theFeature the checked feature //! \param theArguments arguments of the feature (not used) //! \param theError error message - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorUnionSelection @@ -278,9 +278,9 @@ public: /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorUnionArguments @@ -293,9 +293,9 @@ public: //! \param theFeature the checked feature //! \param theArguments arguments of the feature (not used) //! \param theError error message - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorConcealedResult @@ -308,9 +308,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorCircular @@ -322,9 +322,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /** \class FeaturesPlugin_ValidatorBooleanArguments @@ -340,14 +340,14 @@ public: * validator. \param[out] theError error message. \returns true if feature is * valid. */ - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; /// \return true if the attribute in feature is not obligatory for the feature /// execution. - virtual bool isNotObligatory(std::string theFeature, - std::string theAttribute); + bool isNotObligatory(std::string theFeature, + std::string theAttribute) override; }; /// \class FeaturesPlugin_ValidatorBooleanSmashSelection @@ -360,9 +360,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_IntersectionSelection @@ -375,9 +375,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorBooleanFuseSelection @@ -390,9 +390,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /** \class FeaturesPlugin_ValidatorBooleanFuseArguments @@ -408,14 +408,14 @@ public: * validator. \param[out] theError error message. \returns true if feature is * valid. */ - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; /// \return true if the attribute in feature is not obligatory for the feature /// execution. - virtual bool isNotObligatory(std::string theFeature, - std::string theAttribute); + bool isNotObligatory(std::string theFeature, + std::string theAttribute) override; }; /// \class FeaturesPlugin_ValidatorBooleanCommonSelection @@ -428,9 +428,9 @@ public: //! \param[in] theAttribute the checked attribute. //! \param[in] theArguments arguments of the attribute. //! \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /** \class FeaturesPlugin_ValidatorBooleanCommonArguments @@ -446,14 +446,14 @@ public: * validator. \param[out] theError error message. \returns true if feature is * valid. */ - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; /// \return true if the attribute in feature is not obligatory for the feature /// execution. - virtual bool isNotObligatory(std::string theFeature, - std::string theAttribute); + bool isNotObligatory(std::string theFeature, + std::string theAttribute) override; }; /// \class FeaturesPlugin_ValidatorDefeaturingSelection @@ -467,9 +467,9 @@ public: /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorSewingSelection @@ -483,9 +483,9 @@ public: /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /// \class FeaturesPlugin_ValidatorGlueFacesSelection @@ -499,9 +499,9 @@ public: /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.cpp index 012534451..264dd7771 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.cpp @@ -421,15 +421,14 @@ void FeaturesPlugin_VersionedBoolean::resizePlanes( GeomAlgoAPI_ShapeTools::getBoundingBox(theObjects, 1.0); // Resize planes to fit in bounding box - for (ListOfShape::iterator anIt = thePlanes.begin(); anIt != thePlanes.end(); - ++anIt) { - GeomShapePtr aPlane = *anIt; + for (auto &thePlane : thePlanes) { + GeomShapePtr aPlane = thePlane; GeomShapePtr aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints); std::shared_ptr aMkShCustom( new GeomAlgoAPI_MakeShapeCustom); aMkShCustom->addModified(aPlane, aTool); theMakeShapeList->appendAlgo(aMkShCustom); - *anIt = aTool; + thePlane = aTool; } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.h index d53f13c10..2d12b4ad2 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_VersionedBoolean.h @@ -45,7 +45,7 @@ protected: } /// Use plugin manager for features creation. - FeaturesPlugin_VersionedBoolean() {} + FeaturesPlugin_VersionedBoolean() = default; /// Initialize version field of the Boolean feature. /// The version is initialized for newly created features, diff --git a/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.cpp b/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.cpp index ab2dc3547..55c1fd04e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.cpp @@ -84,24 +84,21 @@ void FeaturesPlugin_VersionedChFi::execute() { const std::string &aPrefix = modifiedShapePrefix(); ListOfShape aTopLevel; anObjectHierarchy.topLevelObjects(aTopLevel); - for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); - ++anIt) { + for (auto &anIt : aTopLevel) { ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalSolids, - ListOfShape(), aMakeShapeList, *anIt, + ListOfShape(), aMakeShapeList, anIt, aPrefix); setResult(aResultBody, aResultIndex++); - for (ListOfShape::iterator aEIt = anEdges.begin(); aEIt != anEdges.end(); - ++aEIt) { - GeomShapePtr aBase = *aEIt; + for (auto aBase : anEdges) { // Store new faces generated from edges and vertices aResultBody->loadGeneratedShapes(aMakeShapeList, aBase, GeomAPI_Shape::EDGE, aPrefix, true); } ModelAPI_Tools::loadDeletedShapes(aResultBody, GeomShapePtr(), - anOriginalSolids, aMakeShapeList, *anIt); + anOriginalSolids, aMakeShapeList, anIt); } removeResults(aResultIndex); @@ -146,10 +143,9 @@ bool FeaturesPlugin_VersionedChFi::processAttribute( ListOfShape anEdges; collectSubs(aParent, anEdges, GeomAPI_Shape::EDGE); - for (ListOfShape::iterator anIt = anEdges.begin(); - anIt != anEdges.end(); ++anIt) { - theObjects.addObject(*anIt); - theObjects.addParent(*anIt, aParent); + for (auto &anEdge : anEdges) { + theObjects.addObject(anEdge); + theObjects.addParent(anEdge, aParent); } } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.h b/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.h index 1134289fb..447737145 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.h +++ b/src/FeaturesPlugin/FeaturesPlugin_VersionedChFi.h @@ -37,10 +37,10 @@ class GeomAlgoAPI_MakeShape; class FeaturesPlugin_VersionedChFi : public ModelAPI_Feature { public: /// Performs the fillet algorithm and stores it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; protected: - FeaturesPlugin_VersionedChFi() {} + FeaturesPlugin_VersionedChFi() = default; /// Intialize the version for the newly created feature. void initVersion(const std::shared_ptr &theObjectsAttr); diff --git a/src/FiltersAPI/FiltersAPI_Argument.cpp b/src/FiltersAPI/FiltersAPI_Argument.cpp index b71755df1..22db82cd1 100644 --- a/src/FiltersAPI/FiltersAPI_Argument.cpp +++ b/src/FiltersAPI/FiltersAPI_Argument.cpp @@ -20,7 +20,7 @@ #include "FiltersAPI_Argument.h" -FiltersAPI_Argument::FiltersAPI_Argument() {} +FiltersAPI_Argument::FiltersAPI_Argument() = default; FiltersAPI_Argument::FiltersAPI_Argument(const bool theValue) : myBoolean(theValue) {} @@ -43,7 +43,7 @@ FiltersAPI_Argument::FiltersAPI_Argument( const AttributeSelectionPtr &theSelection) : mySelectionAttr(theSelection) {} -FiltersAPI_Argument::~FiltersAPI_Argument() {} +FiltersAPI_Argument::~FiltersAPI_Argument() = default; void FiltersAPI_Argument::dump(ModelHighAPI_Dumper &theDumper) const { if (mySelectionAttr) { diff --git a/src/FiltersAPI/FiltersAPI_Feature.cpp b/src/FiltersAPI/FiltersAPI_Feature.cpp index a85c750c5..e1b3000b0 100644 --- a/src/FiltersAPI/FiltersAPI_Feature.cpp +++ b/src/FiltersAPI/FiltersAPI_Feature.cpp @@ -35,7 +35,7 @@ FiltersAPI_Feature::FiltersAPI_Feature( ->initAttributes(); } -FiltersAPI_Feature::~FiltersAPI_Feature() {} +FiltersAPI_Feature::~FiltersAPI_Feature() = default; static void separateArguments(const std::list &theArguments, @@ -43,7 +43,7 @@ separateArguments(const std::list &theArguments, std::list &theTextArgs, std::list &theBoolArgs, std::list &theDoubleArgs) { - std::list::const_iterator anIt = theArguments.begin(); + auto anIt = theArguments.begin(); for (; anIt != theArguments.end(); ++anIt) { if (anIt->selection().variantType() != ModelHighAPI_Selection::VT_Empty) theSelections.push_back(anIt->selection()); @@ -59,12 +59,11 @@ separateArguments(const std::list &theArguments, void FiltersAPI_Feature::setFilters(const std::list &theFilters) { FiltersFeaturePtr aBase = std::dynamic_pointer_cast(feature()); - for (std::list::const_iterator anIt = theFilters.begin(); - anIt != theFilters.end(); ++anIt) { - std::string aFilterID = aBase->addFilter((*anIt)->name()); - aBase->setReversed(aFilterID, (*anIt)->isReversed()); + for (const auto &theFilter : theFilters) { + std::string aFilterID = aBase->addFilter(theFilter->name()); + aBase->setReversed(aFilterID, theFilter->isReversed()); - const std::list &anArgs = (*anIt)->arguments(); + const std::list &anArgs = theFilter->arguments(); if (!anArgs.empty()) { // separate selection arguments and strings std::list aSelections; @@ -74,7 +73,7 @@ void FiltersAPI_Feature::setFilters(const std::list &theFilters) { separateArguments(anArgs, aSelections, aTexts, aBools, aDoubles); std::list aFilterArgs = aBase->filterArgs(aFilterID); - std::list::iterator aFIt = aFilterArgs.begin(); + auto aFIt = aFilterArgs.begin(); // first boolean argument is always "Reversed" flag AttributeBooleanPtr aReversedFlag = std::dynamic_pointer_cast(*aFIt); @@ -131,8 +130,7 @@ void FiltersAPI_Feature::dump(ModelHighAPI_Dumper &theDumper) const { ModelAPI_FiltersFactory *aFFactory = ModelAPI_Session::get()->filters(); std::list aFilters = aBase->filters(); - for (std::list::iterator aFIt = aFilters.begin(); - aFIt != aFilters.end(); ++aFIt) { + for (auto aFIt = aFilters.begin(); aFIt != aFilters.end(); ++aFIt) { // for multiple filters get original id std::string aFilterKind = aFFactory->id(aFFactory->filter(*aFIt)); FiltersAPI_Filter aFilter(aFilterKind, aBase->filterArgs(*aFIt)); diff --git a/src/FiltersAPI/FiltersAPI_Feature.h b/src/FiltersAPI/FiltersAPI_Feature.h index c1c846ae1..eacbe52b8 100644 --- a/src/FiltersAPI/FiltersAPI_Feature.h +++ b/src/FiltersAPI/FiltersAPI_Feature.h @@ -44,7 +44,7 @@ public: /// Destructor FILTERSAPI_EXPORT - virtual ~FiltersAPI_Feature(); + ~FiltersAPI_Feature() override; INTERFACE_0(FiltersPlugin_Selection::ID()) @@ -54,7 +54,7 @@ public: /// Dump wrapped feature FILTERSAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; typedef std::shared_ptr FiltersPtr; diff --git a/src/FiltersAPI/FiltersAPI_Filter.cpp b/src/FiltersAPI/FiltersAPI_Filter.cpp index 678fc3ffb..1d557d80a 100644 --- a/src/FiltersAPI/FiltersAPI_Filter.cpp +++ b/src/FiltersAPI/FiltersAPI_Filter.cpp @@ -37,7 +37,7 @@ FiltersAPI_Filter::FiltersAPI_Filter( FiltersAPI_Filter::FiltersAPI_Filter( const std::string &theName, const std::list &theArguments) : myName(theName) { - std::list::const_iterator anArgIt = theArguments.begin(); + auto anArgIt = theArguments.begin(); // first attribute is usually for reversing the filter AttributeBooleanPtr aBoolAttr = std::dynamic_pointer_cast(*anArgIt); @@ -88,7 +88,7 @@ FiltersAPI_Filter::FiltersAPI_Filter( } } -FiltersAPI_Filter::~FiltersAPI_Filter() {} +FiltersAPI_Filter::~FiltersAPI_Filter() = default; void FiltersAPI_Filter::dump(ModelHighAPI_Dumper &theDumper) const { theDumper << "model.addFilter(name = \"" << myName << "\""; @@ -97,14 +97,12 @@ void FiltersAPI_Filter::dump(ModelHighAPI_Dumper &theDumper) const { if (!myFilterArguments.empty()) { theDumper << ", args = ["; bool isFirstArg = true; - for (std::list::const_iterator anIt = - myFilterArguments.begin(); - anIt != myFilterArguments.end(); ++anIt) { + for (const auto &myFilterArgument : myFilterArguments) { if (isFirstArg) isFirstArg = false; else theDumper << ", "; - anIt->dump(theDumper); + myFilterArgument.dump(theDumper); } theDumper << "]"; } diff --git a/src/FiltersAPI/FiltersAPI_Selection.cpp b/src/FiltersAPI/FiltersAPI_Selection.cpp index 28c91ef2b..1aeaf7674 100644 --- a/src/FiltersAPI/FiltersAPI_Selection.cpp +++ b/src/FiltersAPI/FiltersAPI_Selection.cpp @@ -31,7 +31,7 @@ FiltersAPI_Selection::FiltersAPI_Selection(const FiltersPtr &theFeature) { std::dynamic_pointer_cast(theFeature->feature()); } -FiltersAPI_Selection::~FiltersAPI_Selection() {} +FiltersAPI_Selection::~FiltersAPI_Selection() = default; FiltersFeaturePtr FiltersAPI_Selection::feature() const { return myFilterFeature; @@ -53,8 +53,7 @@ std::list FiltersAPI_Selection::select( std::list> aResList = aSession->filters()->select(myFilterFeature, theShapeType); - std::list>::const_iterator itSelected = - aResList.cbegin(); + auto itSelected = aResList.cbegin(); for (; itSelected != aResList.cend(); itSelected++) { ResultPtr aCurRes = (*itSelected).first; GeomShapePtr aSubShape = (*itSelected).second; diff --git a/src/FiltersAPI/FiltersAPI_Selection.h b/src/FiltersAPI/FiltersAPI_Selection.h index 76b7c5ceb..2995fe07f 100644 --- a/src/FiltersAPI/FiltersAPI_Selection.h +++ b/src/FiltersAPI/FiltersAPI_Selection.h @@ -38,7 +38,7 @@ public: /// Destructor FILTERSAPI_EXPORT - virtual ~FiltersAPI_Selection(); + ~FiltersAPI_Selection() override; /// Return filters feature FILTERSAPI_EXPORT diff --git a/src/FiltersPlugin/FiltersPlugin_BelongsTo.h b/src/FiltersPlugin/FiltersPlugin_BelongsTo.h index 322d32bc7..df2e023c0 100644 --- a/src/FiltersPlugin/FiltersPlugin_BelongsTo.h +++ b/src/FiltersPlugin/FiltersPlugin_BelongsTo.h @@ -33,25 +33,25 @@ class FiltersPlugin_BelongsTo : public ModelAPI_Filter { public: FiltersPlugin_BelongsTo() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("Belongs to"); return kName; } /// Returns true for any type because it supports all selection types - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; + void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.cpp b/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.cpp index 318fab8dc..ddc14d7d1 100644 --- a/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.cpp +++ b/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.cpp @@ -67,15 +67,14 @@ static void cacheContinuousFace(const GeomShapePtr theFace, GeomEdgePtr anEdge; anEdge = GeomEdgePtr(new GeomAPI_Edge(aEExp.current())); - for (SetOfShapes::const_iterator aFIt = aFound->second.begin(); - aFIt != aFound->second.end(); ++aFIt) { + for (const auto &aFIt : aFound->second) { std::string anError = ""; - if (theCache.find(*aFIt) == theCache.end()) { + if (theCache.find(aFIt) == theCache.end()) { GeomPointPtr aPoint = anEdge->middlePoint(); - if (GeomAlgoAPI_ShapeTools::isContinuousFaces(theFace, *aFIt, aPoint, + if (GeomAlgoAPI_ShapeTools::isContinuousFaces(theFace, aFIt, aPoint, theAngle, anError)) { - theCache.insert(*aFIt); - cacheContinuousFace(*aFIt, theEdgeToFaces, theCache, theAngle); + theCache.insert(aFIt); + cacheContinuousFace(aFIt, theEdgeToFaces, theCache, theAngle); } } } @@ -93,12 +92,11 @@ static void cacheContinuousFaces(const GeomShapePtr theTopLevelShape, MapShapeAndAncestors anEdgesToFaces; mapEdgesAndFaces(theTopLevelShape, anEdgesToFaces); - for (SetOfShapes::const_iterator aFIt = theFaces.begin(); - aFIt != theFaces.end(); ++aFIt) { + for (const auto &theFace : theFaces) { // keep the original face - theCache.insert(*aFIt); + theCache.insert(theFace); // cache continuous face - cacheContinuousFace(*aFIt, anEdgesToFaces, theCache, theAngle); + cacheContinuousFace(theFace, anEdgesToFaces, theCache, theAngle); } } diff --git a/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.h b/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.h index 50bbb3adf..84dc2df6e 100644 --- a/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.h +++ b/src/FiltersPlugin/FiltersPlugin_ContinuousFaces.h @@ -28,7 +28,7 @@ #include -typedef std::set SetOfShapes; +using SetOfShapes = std::set; /**\class FiltersPlugin_ContinuousFaces * \ingroup DataModel @@ -38,25 +38,25 @@ class FiltersPlugin_ContinuousFaces : public ModelAPI_Filter { public: FiltersPlugin_ContinuousFaces() : ModelAPI_Filter() { myAngle = 0.0; } - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("Continuous faces"); return kName; } /// Returns true for face type - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; + void initAttributes(ModelAPI_FiltersArgs &theArguments) override; private: /// Original faces selected for filtering diff --git a/src/FiltersPlugin/FiltersPlugin_EdgeSize.h b/src/FiltersPlugin/FiltersPlugin_EdgeSize.h index 14cb8b4aa..e67b1f529 100644 --- a/src/FiltersPlugin/FiltersPlugin_EdgeSize.h +++ b/src/FiltersPlugin/FiltersPlugin_EdgeSize.h @@ -34,25 +34,25 @@ class FiltersPlugin_EdgeSize : public ModelAPI_Filter { public: FiltersPlugin_EdgeSize() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("Edge size"); return kName; } /// Returns true for edge type - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; + void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_ExternalFaces.h b/src/FiltersPlugin/FiltersPlugin_ExternalFaces.h index af6399cf9..0a08d5aed 100644 --- a/src/FiltersPlugin/FiltersPlugin_ExternalFaces.h +++ b/src/FiltersPlugin/FiltersPlugin_ExternalFaces.h @@ -33,20 +33,20 @@ class FiltersPlugin_ExternalFaces : public ModelAPI_Filter { public: FiltersPlugin_ExternalFaces() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("External faces"); return kName; } /// Returns true for any type because it supports all selection types - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theResult parent result of the shape to be checked \param theArgs /// arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &theResult, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &theResult, + const ModelAPI_FiltersArgs &theArgs) const override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_FaceSize.h b/src/FiltersPlugin/FiltersPlugin_FaceSize.h index 6911d15a9..40657a181 100644 --- a/src/FiltersPlugin/FiltersPlugin_FaceSize.h +++ b/src/FiltersPlugin/FiltersPlugin_FaceSize.h @@ -34,25 +34,25 @@ class FiltersPlugin_FaceSize : public ModelAPI_Filter { public: FiltersPlugin_FaceSize() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("Face size"); return kName; } /// Returns true for face type - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; + void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_FeatureEdges.cpp b/src/FiltersPlugin/FiltersPlugin_FeatureEdges.cpp index ffd6807d1..f4c35964b 100644 --- a/src/FiltersPlugin/FiltersPlugin_FeatureEdges.cpp +++ b/src/FiltersPlugin/FiltersPlugin_FeatureEdges.cpp @@ -67,9 +67,8 @@ static void cacheFeatureEdge(const GeomShapePtr theTopLevelShape, GeomEdgePtr anEdge; anEdge = GeomEdgePtr(new GeomAPI_Edge(aIt->first)); - for (SetOfShapes::const_iterator aFIt = aIt->second.begin(); - aFIt != aIt->second.end(); ++aFIt) { - SetOfShapes::const_iterator aFIt2 = aFIt; + for (auto aFIt = aIt->second.begin(); aFIt != aIt->second.end(); ++aFIt) { + auto aFIt2 = aFIt; ++aFIt2; for (; aFIt2 != aIt->second.end(); ++aFIt2) { std::string anError; diff --git a/src/FiltersPlugin/FiltersPlugin_FeatureEdges.h b/src/FiltersPlugin/FiltersPlugin_FeatureEdges.h index 8d7453fab..2406c62ef 100644 --- a/src/FiltersPlugin/FiltersPlugin_FeatureEdges.h +++ b/src/FiltersPlugin/FiltersPlugin_FeatureEdges.h @@ -28,7 +28,7 @@ #include -typedef std::set SetOfShapes; +using SetOfShapes = std::set; /**\class FiltersPlugin_FeatureEdges * \ingroup DataModel @@ -38,25 +38,25 @@ class FiltersPlugin_FeatureEdges : public ModelAPI_Filter { public: FiltersPlugin_FeatureEdges() : ModelAPI_Filter() { myAngle = 0.0; } - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("Feature edges"); return kName; } /// Returns true for edge type - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; + void initAttributes(ModelAPI_FiltersArgs &theArguments) override; private: /// Shapes applicable for the filter diff --git a/src/FiltersPlugin/FiltersPlugin_HorizontalFace.h b/src/FiltersPlugin/FiltersPlugin_HorizontalFace.h index df3172cb2..a9cf1ec1e 100644 --- a/src/FiltersPlugin/FiltersPlugin_HorizontalFace.h +++ b/src/FiltersPlugin/FiltersPlugin_HorizontalFace.h @@ -33,19 +33,19 @@ class FiltersPlugin_HorizontalFace : public ModelAPI_Filter { public: FiltersPlugin_HorizontalFace() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("Horizontal faces"); return kName; } /// Returns true if the given shape type is supported - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_OnGeometry.h b/src/FiltersPlugin/FiltersPlugin_OnGeometry.h index 844e6ec57..90f27417b 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnGeometry.h +++ b/src/FiltersPlugin/FiltersPlugin_OnGeometry.h @@ -34,25 +34,25 @@ class FiltersPlugin_OnGeometry : public ModelAPI_Filter { public: FiltersPlugin_OnGeometry() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("On geometry"); return kName; } /// Returns true for any type because it supports all selection types - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; + void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_OnPlane.h b/src/FiltersPlugin/FiltersPlugin_OnPlane.h index f15abaca6..d2c4ca8d4 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnPlane.h +++ b/src/FiltersPlugin/FiltersPlugin_OnPlane.h @@ -33,28 +33,28 @@ class FiltersPlugin_OnPlane : public ModelAPI_Filter { public: FiltersPlugin_OnPlane() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("On plane"); return kName; } /// Returns true for any type because it supports all selection types - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// Returns True if the filter can be used several times within one selection - virtual bool isMultiple() const { return true; } + bool isMultiple() const override { return true; } /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; + void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_OnPlaneSide.h b/src/FiltersPlugin/FiltersPlugin_OnPlaneSide.h index 9aaea2017..9650adf58 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnPlaneSide.h +++ b/src/FiltersPlugin/FiltersPlugin_OnPlaneSide.h @@ -33,28 +33,28 @@ class FiltersPlugin_OnPlaneSide : public ModelAPI_Filter { public: FiltersPlugin_OnPlaneSide() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("On plane side"); return kName; } /// Returns true for any type because it supports all selection types - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// Returns True if the filter can be used several times within one selection - virtual bool isMultiple() const { return true; } + bool isMultiple() const override { return true; } /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; + void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_OnShapeName.cpp b/src/FiltersPlugin/FiltersPlugin_OnShapeName.cpp index 781caf85f..d0f12354e 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnShapeName.cpp +++ b/src/FiltersPlugin/FiltersPlugin_OnShapeName.cpp @@ -32,7 +32,7 @@ bool FiltersPlugin_OnShapeName::isSupported( //======================================================================= bool FiltersPlugin_OnShapeName::isOk( - const GeomShapePtr &theShape, const ResultPtr &theResult, + const GeomShapePtr & /*theShape*/, const ResultPtr &theResult, const ModelAPI_FiltersArgs &theArgs) const { if (!theResult) return false; diff --git a/src/FiltersPlugin/FiltersPlugin_OnShapeName.h b/src/FiltersPlugin/FiltersPlugin_OnShapeName.h index ca1e96130..6407ee34d 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnShapeName.h +++ b/src/FiltersPlugin/FiltersPlugin_OnShapeName.h @@ -33,25 +33,25 @@ class FiltersPlugin_OnShapeName : public ModelAPI_Filter { public: FiltersPlugin_OnShapeName() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("On shape name"); return kName; } /// Returns true for face type - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &theResult, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &theResult, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; + void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.cpp b/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.cpp index 1de71f2b5..e9871fff8 100644 --- a/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.cpp +++ b/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.cpp @@ -93,13 +93,12 @@ static GeomShapePtr oppositeEdgeInQuadFace(const GeomShapePtr theEdge, static void cacheOppositeEdge(const GeomShapePtr theEdge, const MapShapeAndAncestors &theEdgeToFaces, SetOfShapes &theCache) { - MapShapeAndAncestors::const_iterator aFound = theEdgeToFaces.find(theEdge); + auto aFound = theEdgeToFaces.find(theEdge); if (aFound == theEdgeToFaces.end()) return; - for (SetOfShapes::const_iterator aFIt = aFound->second.begin(); - aFIt != aFound->second.end(); ++aFIt) { - GeomShapePtr anOpposite = oppositeEdgeInQuadFace(theEdge, *aFIt); + for (const auto &aFIt : aFound->second) { + GeomShapePtr anOpposite = oppositeEdgeInQuadFace(theEdge, aFIt); if (anOpposite && theCache.find(anOpposite) == theCache.end()) { theCache.insert(anOpposite); cacheOppositeEdge(anOpposite, theEdgeToFaces, theCache); diff --git a/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.h b/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.h index fb50b0d3d..b7cd4f8fd 100644 --- a/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.h +++ b/src/FiltersPlugin/FiltersPlugin_OppositeToEdge.h @@ -28,7 +28,7 @@ #include -typedef std::set SetOfShapes; +using SetOfShapes = std::set; /**\class FiltersPlugin_OppositeToEdge * \ingroup DataModel @@ -38,25 +38,25 @@ class FiltersPlugin_OppositeToEdge : public ModelAPI_Filter { public: FiltersPlugin_OppositeToEdge() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("Opposite to an edge"); return kName; } /// Returns true for any type because it supports all selection types - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; + void initAttributes(ModelAPI_FiltersArgs &theArguments) override; private: /// Original edge selected for filtering diff --git a/src/FiltersPlugin/FiltersPlugin_Plugin.h b/src/FiltersPlugin/FiltersPlugin_Plugin.h index e628f12ee..ef9a0ffb7 100644 --- a/src/FiltersPlugin/FiltersPlugin_Plugin.h +++ b/src/FiltersPlugin/FiltersPlugin_Plugin.h @@ -33,7 +33,7 @@ class FILTERS_EXPORT FiltersPlugin_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - virtual FeaturePtr createFeature(std::string theFeatureID); + FeaturePtr createFeature(std::string theFeatureID) override; public: FiltersPlugin_Plugin(); diff --git a/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.h b/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.h index 7260cdae1..c4822ac1f 100644 --- a/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.h +++ b/src/FiltersPlugin/FiltersPlugin_RelativeToSolid.h @@ -33,28 +33,28 @@ class FiltersPlugin_RelativeToSolid : public ModelAPI_Filter { public: FiltersPlugin_RelativeToSolid() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("On/In/Out a solid"); return kName; } /// Returns true for any type because it supports all selection types - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// Returns True if the filter can be used several times within one selection - virtual bool isMultiple() const { return true; } + bool isMultiple() const override { return true; } /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; + void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_Selection.cpp b/src/FiltersPlugin/FiltersPlugin_Selection.cpp index b20c23eda..fbfba6650 100644 --- a/src/FiltersPlugin/FiltersPlugin_Selection.cpp +++ b/src/FiltersPlugin/FiltersPlugin_Selection.cpp @@ -44,7 +44,7 @@ std::string FiltersPlugin_Selection::addFilter(const std::string theFilterID) { aStream << "_" << anID << "_" << theFilterID; aFilterID = aStream.str(); } - std::list::iterator aFiltersIDs = aFilters.begin(); + auto aFiltersIDs = aFilters.begin(); for (; aFiltersIDs != aFilters.end(); aFiltersIDs++) { if (*aFiltersIDs == aFilterID) break; @@ -120,7 +120,7 @@ void FiltersPlugin_Selection::setAttribute(const AttributePtr &theAttr) { std::list aFilters; data()->allGroups(aFilters); ModelAPI_FiltersFactory *aFactory = ModelAPI_Session::get()->filters(); - std::list::iterator aFIter = aFilters.begin(); + auto aFIter = aFilters.begin(); for (; aFIter != aFilters.end(); aFIter++) { FilterPtr aFilter = aFactory->filter(*aFIter); if (aFilter.get() && !aFilter->isSupported(aType)) { @@ -139,20 +139,19 @@ void FiltersPlugin_Selection::initAttributes() { ModelAPI_FiltersFactory *aFactory = ModelAPI_Session::get()->filters(); std::list aFilters; data()->allGroups(aFilters); - for (std::list::iterator aFIt = aFilters.begin(); - aFIt != aFilters.end(); aFIt++) { - FilterPtr aFilter = aFactory->filter(*aFIt); + for (auto &aFIt : aFilters) { + FilterPtr aFilter = aFactory->filter(aFIt); if (aFilter.get()) { std::shared_ptr aBool = std::dynamic_pointer_cast( data()->addFloatingAttribute( - kReverseAttrID, ModelAPI_AttributeBoolean::typeId(), *aFIt)); + kReverseAttrID, ModelAPI_AttributeBoolean::typeId(), aFIt)); if (!aBool->isInitialized()) aBool->setValue(false); // not reversed by default ModelAPI_FiltersArgs anArgs; anArgs.setFeature( std::dynamic_pointer_cast(data()->owner())); - anArgs.setFilter(*aFIt); + anArgs.setFilter(aFIt); aFilter->initAttributes(anArgs); } } diff --git a/src/FiltersPlugin/FiltersPlugin_Selection.h b/src/FiltersPlugin/FiltersPlugin_Selection.h index 9dabee461..f5852f44f 100644 --- a/src/FiltersPlugin/FiltersPlugin_Selection.h +++ b/src/FiltersPlugin/FiltersPlugin_Selection.h @@ -39,54 +39,50 @@ public: } /// Returns the kind of a feature - FILTERS_EXPORT virtual const std::string &getKind() { return ID(); } + FILTERS_EXPORT const std::string &getKind() override { return ID(); } /// This feature does not displayed in the data tree - virtual bool isInHistory() { return false; } + bool isInHistory() override { return false; } /// Computes a selection? - FILTERS_EXPORT virtual void execute() {} + FILTERS_EXPORT void execute() override {} /// Feature is created in the plugin manager - FiltersPlugin_Selection() {} + FiltersPlugin_Selection() = default; /// This method initializes all filters on open of document - FILTERS_EXPORT virtual void initAttributes() override; + FILTERS_EXPORT void initAttributes() override; // methods related to the filters management /// Adds a filter to the feature. Also initializes arguments of this filter. /// Returns the real identifier of the filter. - FILTERS_EXPORT virtual std::string - addFilter(const std::string theFilterID) override; + FILTERS_EXPORT std::string addFilter(const std::string theFilterID) override; /// Removes an existing filter from the feature. - FILTERS_EXPORT virtual void - removeFilter(const std::string theFilterID) override; + FILTERS_EXPORT void removeFilter(const std::string theFilterID) override; /// Returns the list of existing filters in the feature. - FILTERS_EXPORT virtual std::list filters() const override; + FILTERS_EXPORT std::list filters() const override; /// Stores the reversed flag for the filter. - FILTERS_EXPORT virtual void setReversed(const std::string theFilterID, - const bool theReversed) override; + FILTERS_EXPORT void setReversed(const std::string theFilterID, + const bool theReversed) override; /// Returns the reversed flag value for the filter. - FILTERS_EXPORT virtual bool - isReversed(const std::string theFilterID) override; + FILTERS_EXPORT bool isReversed(const std::string theFilterID) override; /// Returns the ordered list of attributes related to the filter. - FILTERS_EXPORT virtual std::list + FILTERS_EXPORT std::list filterArgs(const std::string theFilterID) const override; /// Sets the attribute (not-persistent field) that contains this filters /// feature. The filter feature may make synchronization by this method call. - FILTERS_EXPORT virtual void - setAttribute(const AttributePtr &theAttr) override; + FILTERS_EXPORT void setAttribute(const AttributePtr &theAttr) override; /// Returns the attribute (not-persistent field) that contains this filters /// feature. - FILTERS_EXPORT virtual const AttributePtr &baseAttribute() const override; + FILTERS_EXPORT const AttributePtr &baseAttribute() const override; protected: AttributePtr myBase; ///< the attribute related to this filter diff --git a/src/FiltersPlugin/FiltersPlugin_Validators.cpp b/src/FiltersPlugin/FiltersPlugin_Validators.cpp index 7eed19425..ec5534ae3 100644 --- a/src/FiltersPlugin/FiltersPlugin_Validators.cpp +++ b/src/FiltersPlugin/FiltersPlugin_Validators.cpp @@ -38,11 +38,10 @@ bool FiltersPlugin_ShapeTypeValidator::isValid( // iterate on groups and find the one having the current filters feature DocumentPtr aCurDoc = ModelAPI_Session::get()->activeDocument(); std::list aFeatList = aCurDoc->allFeatures(); - for (std::list::iterator anIt = aFeatList.begin(); - anIt != aFeatList.end(); ++anIt) - if ((*anIt)->getKind() == CollectionPlugin_Group::ID()) { + for (auto &anIt : aFeatList) + if (anIt->getKind() == CollectionPlugin_Group::ID()) { AttributeSelectionListPtr aSelList = - (*anIt)->selectionList(CollectionPlugin_Group::LIST_ID()); + anIt->selectionList(CollectionPlugin_Group::LIST_ID()); if (aSelList->filters() == aFilterFeature) { TypeOfShape aType = shapeType(aSelList->selectionType()); if (isValidAttribute(theAttribute, aType, theError)) diff --git a/src/FiltersPlugin/FiltersPlugin_Validators.h b/src/FiltersPlugin/FiltersPlugin_Validators.h index 80d1d20f8..39fa599e0 100644 --- a/src/FiltersPlugin/FiltersPlugin_Validators.h +++ b/src/FiltersPlugin/FiltersPlugin_Validators.h @@ -36,10 +36,9 @@ public: /// \param[in] theAttribute an attribute to check /// \param[in] theArguments a filter parameters /// \param[out] theError error message. - FILTERS_EXPORT virtual bool - isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + FILTERS_EXPORT bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_VerticalFace.h b/src/FiltersPlugin/FiltersPlugin_VerticalFace.h index 6c4b2d964..00c121d1c 100644 --- a/src/FiltersPlugin/FiltersPlugin_VerticalFace.h +++ b/src/FiltersPlugin/FiltersPlugin_VerticalFace.h @@ -33,19 +33,19 @@ class FiltersPlugin_VerticalFace : public ModelAPI_Filter { public: FiltersPlugin_VerticalFace() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("Vertical faces"); return kName; } /// Returns true if the given shape type is supported - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; }; #endif diff --git a/src/FiltersPlugin/FiltersPlugin_VolumeSize.h b/src/FiltersPlugin/FiltersPlugin_VolumeSize.h index b53f4c5e0..1e23ea890 100644 --- a/src/FiltersPlugin/FiltersPlugin_VolumeSize.h +++ b/src/FiltersPlugin/FiltersPlugin_VolumeSize.h @@ -34,25 +34,25 @@ class FiltersPlugin_VolumeSize : public ModelAPI_Filter { public: FiltersPlugin_VolumeSize() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("Volume size"); return kName; } /// Returns true for solid type - virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override; + bool isSupported(GeomAPI_Shape::ShapeType theType) const override; /// This method should contain the filter logic. It returns true if the given /// shape is accepted by the filter. \param theShape the given shape \param /// theArgs arguments of the filter - virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &, - const ModelAPI_FiltersArgs &theArgs) const override; + bool isOk(const GeomShapePtr &theShape, const ResultPtr &, + const ModelAPI_FiltersArgs &theArgs) const override; /// Returns XML string which represents GUI of the filter - virtual std::string xmlRepresentation() const override; + std::string xmlRepresentation() const override; /// Initializes arguments of a filter. - virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override; + void initAttributes(ModelAPI_FiltersArgs &theArguments) override; }; #endif diff --git a/src/GDMLAPI/GDMLAPI_ConeSegment.cpp b/src/GDMLAPI/GDMLAPI_ConeSegment.cpp index 1bdf81186..403dfeb4c 100644 --- a/src/GDMLAPI/GDMLAPI_ConeSegment.cpp +++ b/src/GDMLAPI/GDMLAPI_ConeSegment.cpp @@ -44,7 +44,7 @@ GDMLAPI_ConeSegment::GDMLAPI_ConeSegment( } //================================================================================================== -GDMLAPI_ConeSegment::~GDMLAPI_ConeSegment() {} +GDMLAPI_ConeSegment::~GDMLAPI_ConeSegment() = default; //================================================================================================== void GDMLAPI_ConeSegment::setAttributes( diff --git a/src/GDMLAPI/GDMLAPI_ConeSegment.h b/src/GDMLAPI/GDMLAPI_ConeSegment.h index fb9a7fd53..2c82ed979 100644 --- a/src/GDMLAPI/GDMLAPI_ConeSegment.h +++ b/src/GDMLAPI/GDMLAPI_ConeSegment.h @@ -51,7 +51,7 @@ public: /// Destructor. GDMLAPI_EXPORT - virtual ~GDMLAPI_ConeSegment(); + ~GDMLAPI_ConeSegment() override; INTERFACE_7(GDMLPlugin_ConeSegment::ID(), rmin1, GDMLPlugin_ConeSegment::RMIN1_ID(), ModelAPI_AttributeDouble, @@ -81,7 +81,7 @@ public: /// Dump wrapped feature GDMLAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on primitive ConeSegment object diff --git a/src/GDMLAPI/GDMLAPI_Ellipsoid.cpp b/src/GDMLAPI/GDMLAPI_Ellipsoid.cpp index 0ea9e943d..1aa14f8d4 100644 --- a/src/GDMLAPI/GDMLAPI_Ellipsoid.cpp +++ b/src/GDMLAPI/GDMLAPI_Ellipsoid.cpp @@ -54,7 +54,7 @@ GDMLAPI_Ellipsoid::GDMLAPI_Ellipsoid( } } -GDMLAPI_Ellipsoid::~GDMLAPI_Ellipsoid() {} +GDMLAPI_Ellipsoid::~GDMLAPI_Ellipsoid() = default; void GDMLAPI_Ellipsoid::setSizes(const ModelHighAPI_Double &theAX, const ModelHighAPI_Double &theBY, diff --git a/src/GDMLAPI/GDMLAPI_Ellipsoid.h b/src/GDMLAPI/GDMLAPI_Ellipsoid.h index 5c9048b3b..ac2a28a7d 100644 --- a/src/GDMLAPI/GDMLAPI_Ellipsoid.h +++ b/src/GDMLAPI/GDMLAPI_Ellipsoid.h @@ -57,7 +57,7 @@ public: /// Destructor. GDMLAPI_EXPORT - virtual ~GDMLAPI_Ellipsoid(); + ~GDMLAPI_Ellipsoid() override; INTERFACE_7(GDMLPlugin_Ellipsoid::ID(), ax, GDMLPlugin_Ellipsoid::AX_ID(), ModelAPI_AttributeDouble, @@ -91,7 +91,7 @@ public: /// Dump wrapped feature GDMLAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on primitive Ellipsoid object diff --git a/src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp b/src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp index 817319afd..e77aa7e5b 100644 --- a/src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp +++ b/src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp @@ -27,7 +27,7 @@ //================================================================================================= GDMLPlugin_ConeSegment::GDMLPlugin_ConeSegment() // Nothing to do during // instantiation -{} + = default; //================================================================================================= void GDMLPlugin_ConeSegment::initAttributes() { @@ -99,9 +99,7 @@ void GDMLPlugin_ConeSegment::loadNamingDS( // Insert to faces std::map> listOfFaces = theConeSegmentAlgo->getCreatedFaces(); - for (std::map>::iterator it = - listOfFaces.begin(); - it != listOfFaces.end(); ++it) { - theResultConeSegment->generated((*it).second, (*it).first); + for (auto &listOfFace : listOfFaces) { + theResultConeSegment->generated(listOfFace.second, listOfFace.first); } } diff --git a/src/GDMLPlugin/GDMLPlugin_ConeSegment.h b/src/GDMLPlugin/GDMLPlugin_ConeSegment.h index c3c22345a..1791a1431 100644 --- a/src/GDMLPlugin/GDMLPlugin_ConeSegment.h +++ b/src/GDMLPlugin/GDMLPlugin_ConeSegment.h @@ -76,17 +76,17 @@ public: } /// Returns the kind of a feature - GDMLPLUGIN_EXPORT virtual const std::string &getKind() { + GDMLPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = GDMLPlugin_ConeSegment::ID(); return MY_KIND; } /// Creates a new part document if needed - GDMLPLUGIN_EXPORT virtual void execute(); + GDMLPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - GDMLPLUGIN_EXPORT virtual void initAttributes(); + GDMLPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation GDMLPlugin_ConeSegment(); diff --git a/src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp b/src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp index 5136509dd..e6c472831 100644 --- a/src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp +++ b/src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp @@ -32,7 +32,7 @@ //================================================================================================= GDMLPlugin_Ellipsoid::GDMLPlugin_Ellipsoid() // Nothing to do during // instantiation -{} + = default; //================================================================================================= void GDMLPlugin_Ellipsoid::initAttributes() { @@ -119,10 +119,8 @@ void GDMLPlugin_Ellipsoid::loadNamingDS( // Naming for faces and edges std::map> listOfFaces = theEllipsoidAlgo->getCreatedFaces(); - for (std::map>::iterator it = - listOfFaces.begin(); - it != listOfFaces.end(); ++it) { - theResultEllipsoid->generated((*it).second, (*it).first); + for (auto &listOfFace : listOfFaces) { + theResultEllipsoid->generated(listOfFace.second, listOfFace.first); } // Naming vertices diff --git a/src/GDMLPlugin/GDMLPlugin_Ellipsoid.h b/src/GDMLPlugin/GDMLPlugin_Ellipsoid.h index 76bbd6871..4b6896704 100644 --- a/src/GDMLPlugin/GDMLPlugin_Ellipsoid.h +++ b/src/GDMLPlugin/GDMLPlugin_Ellipsoid.h @@ -76,17 +76,17 @@ public: } /// Returns the kind of a feature - GDMLPLUGIN_EXPORT virtual const std::string &getKind() { + GDMLPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = GDMLPlugin_Ellipsoid::ID(); return MY_KIND; } /// Creates a new part document if needed - GDMLPLUGIN_EXPORT virtual void execute(); + GDMLPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - GDMLPLUGIN_EXPORT virtual void initAttributes(); + GDMLPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation GDMLPlugin_Ellipsoid(); diff --git a/src/GDMLPlugin/GDMLPlugin_Plugin.h b/src/GDMLPlugin/GDMLPlugin_Plugin.h index 6da72206c..b82e2ab45 100644 --- a/src/GDMLPlugin/GDMLPlugin_Plugin.h +++ b/src/GDMLPlugin/GDMLPlugin_Plugin.h @@ -32,7 +32,7 @@ class GDMLPLUGIN_EXPORT GDMLPlugin_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - virtual FeaturePtr createFeature(std::string theFeatureID); + FeaturePtr createFeature(std::string theFeatureID) override; public: /// Default constructor diff --git a/src/GeomAPI/GeomAPI_AISObject.cpp b/src/GeomAPI/GeomAPI_AISObject.cpp index 211c1a024..c8da86d68 100644 --- a/src/GeomAPI/GeomAPI_AISObject.cpp +++ b/src/GeomAPI/GeomAPI_AISObject.cpp @@ -59,8 +59,7 @@ GeomAPI_AISObject::~GeomAPI_AISObject() { if (!empty()) { // This is necessary for correct deletion of Handle entity. // Without this Handle does not decremented counter to 0 - Handle(AIS_InteractiveObject) *anAIS = - implPtr(); + auto *anAIS = implPtr(); anAIS->Nullify(); } } @@ -516,7 +515,7 @@ bool GeomAPI_AISObject::setLineStyle(int theStyle) { Handle(Prs3d_Drawer) aDrawer = anAIS->Attributes(); Handle(Prs3d_LineAspect) aLineAspect; - Aspect_TypeOfLine aType = (Aspect_TypeOfLine)theStyle; + auto aType = (Aspect_TypeOfLine)theStyle; if (aDrawer->HasOwnLineAspect()) { aLineAspect = aDrawer->LineAspect(); } diff --git a/src/GeomAPI/GeomAPI_Angle.cpp b/src/GeomAPI/GeomAPI_Angle.cpp index 7ed47481c..7e298ea0a 100644 --- a/src/GeomAPI/GeomAPI_Angle.cpp +++ b/src/GeomAPI/GeomAPI_Angle.cpp @@ -44,15 +44,15 @@ GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr &theEdge1, const std::shared_ptr &theEdge2, const std::shared_ptr &thePoint) { gp_Pnt aPoint = thePoint->impl(); - const TopoDS_Edge &anEdge1 = theEdge1->impl(); - const TopoDS_Edge &anEdge2 = theEdge2->impl(); + const auto &anEdge1 = theEdge1->impl(); + const auto &anEdge2 = theEdge2->impl(); double aF1, aL1; Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(anEdge1, aF1, aL1); double aF2, aL2; Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(anEdge2, aF2, aL2); - AngleDirections *anAngle = new AngleDirections; + auto *anAngle = new AngleDirections; gp_Pnt aP; GeomAPI_ProjectPointOnCurve aProj1(aPoint, aCurve1); @@ -81,7 +81,7 @@ GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr &thePoint1, gp_Pnt aPoint2 = thePoint2->impl(); gp_Pnt aPoint3 = thePoint3->impl(); - AngleDirections *anAngle = new AngleDirections; + auto *anAngle = new AngleDirections; anAngle->myDir1.SetXYZ(aPoint1.XYZ() - aPoint2.XYZ()); anAngle->myDir2.SetXYZ(aPoint3.XYZ() - aPoint2.XYZ()); setImpl(anAngle); @@ -90,7 +90,7 @@ GeomAPI_Angle::GeomAPI_Angle(const std::shared_ptr &thePoint1, double GeomAPI_Angle::angleDegree() { return angleRadian() * 180.0 / PI; } double GeomAPI_Angle::angleRadian() { - AngleDirections *anAngle = MY_ANGLE; + auto *anAngle = MY_ANGLE; if (anAngle->myDir1.SquareMagnitude() < Precision::SquareConfusion() || anAngle->myDir2.SquareMagnitude() < Precision::SquareConfusion()) return 0.0; diff --git a/src/GeomAPI/GeomAPI_Angle2d.cpp b/src/GeomAPI/GeomAPI_Angle2d.cpp index da10b5203..1bfd378f3 100644 --- a/src/GeomAPI/GeomAPI_Angle2d.cpp +++ b/src/GeomAPI/GeomAPI_Angle2d.cpp @@ -44,7 +44,7 @@ static ThreePoints2d * newAngle(const std::shared_ptr &theCenter, const std::shared_ptr &theFirst, const std::shared_ptr &theSecond) { - ThreePoints2d *aResult = new ThreePoints2d; + auto *aResult = new ThreePoints2d; aResult->myCenter = gp_Pnt2d(theCenter->x(), theCenter->y()); aResult->myFirst = gp_Pnt2d(theFirst->x(), theFirst->y()); aResult->mySecond = gp_Pnt2d(theSecond->x(), theSecond->y()); @@ -137,7 +137,7 @@ std::shared_ptr GeomAPI_Angle2d::secondPoint() { double GeomAPI_Angle2d::angleDegree() { return angleRadian() * 180.0 / PI; } double GeomAPI_Angle2d::angleRadian() { - ThreePoints2d *anAngle = MY_ANGLE; + auto *anAngle = MY_ANGLE; gp_Dir2d aDir1(anAngle->myFirst.XY() - anAngle->myCenter.XY()); gp_Dir2d aDir2(anAngle->mySecond.XY() - anAngle->myCenter.XY()); return aDir1.Angle(aDir2); diff --git a/src/GeomAPI/GeomAPI_Ax2.h b/src/GeomAPI/GeomAPI_Ax2.h index a0bd65980..110132154 100644 --- a/src/GeomAPI/GeomAPI_Ax2.h +++ b/src/GeomAPI/GeomAPI_Ax2.h @@ -70,6 +70,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomAx2Ptr; +using GeomAx2Ptr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_BSpline2d.cpp b/src/GeomAPI/GeomAPI_BSpline2d.cpp index 641861bce..fa3b31579 100644 --- a/src/GeomAPI/GeomAPI_BSpline2d.cpp +++ b/src/GeomAPI/GeomAPI_BSpline2d.cpp @@ -48,7 +48,7 @@ newBSpline2d(const std::list> &thePoles, // additionally check the number of poles is greater than needed for th // periodic B-spline int aNbPoles = 0; - std::list::const_iterator it = theMults.begin(); + auto it = theMults.begin(); for (++it; it != theMults.end(); ++it) aNbPoles += *it; if ((int)thePoles.size() > aNbPoles) @@ -62,21 +62,19 @@ newBSpline2d(const std::list> &thePoles, TColStd_Array1OfInteger aMults(1, (int)theMults.size()); int anIndex = 1; - for (std::list::const_iterator aPIt = thePoles.begin(); + for (auto aPIt = thePoles.begin(); aPIt != thePoles.end() && anIndex <= aPoles.Upper(); ++aPIt, ++anIndex) aPoles.SetValue(anIndex, gp_Pnt2d((*aPIt)->x(), (*aPIt)->y())); anIndex = 1; - for (std::list::const_iterator aWIt = theWeights.begin(); + for (auto aWIt = theWeights.begin(); aWIt != theWeights.end() && anIndex <= aWeights.Upper(); ++aWIt, ++anIndex) aWeights.SetValue(anIndex, *aWIt); anIndex = 1; - for (std::list::const_iterator aKIt = theKnots.begin(); - aKIt != theKnots.end(); ++aKIt, ++anIndex) + for (auto aKIt = theKnots.begin(); aKIt != theKnots.end(); ++aKIt, ++anIndex) aKnots.SetValue(anIndex, *aKIt); anIndex = 1; - for (std::list::const_iterator aMIt = theMults.begin(); - aMIt != theMults.end(); ++aMIt, ++anIndex) + for (auto aMIt = theMults.begin(); aMIt != theMults.end(); ++aMIt, ++anIndex) aMults.SetValue(anIndex, *aMIt); Handle(Geom2d_BSplineCurve) aCurve = new Geom2d_BSplineCurve( @@ -167,11 +165,10 @@ std::list GeomAPI_BSpline2d::mults() const { return std::list(aBSplMults.begin(), aBSplMults.end()); } -const bool -GeomAPI_BSpline2d::parameter(const std::shared_ptr thePoint, - const double theTolerance, - double &theParameter) const { - const gp_Pnt2d &aPoint = thePoint->impl(); +bool GeomAPI_BSpline2d::parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const { + const auto &aPoint = thePoint->impl(); bool isOk = GeomLib_Tool::Parameter(MY_BSPLINE, aPoint, theTolerance, theParameter) == Standard_True; if (!isOk) { diff --git a/src/GeomAPI/GeomAPI_BSpline2d.h b/src/GeomAPI/GeomAPI_BSpline2d.h index 72c5ac783..ff33bb767 100644 --- a/src/GeomAPI/GeomAPI_BSpline2d.h +++ b/src/GeomAPI/GeomAPI_BSpline2d.h @@ -71,9 +71,9 @@ public: /// \param[in] thePoint point of origin. /// \param[in] theTolerance tolerance of computation. /// \param[out] theParameter resulting parameter. - GEOMAPI_EXPORT const bool - parameter(const std::shared_ptr thePoint, - const double theTolerance, double &theParameter) const; + GEOMAPI_EXPORT bool parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const; /// \brief Calculate point on B-spline curve accrding to the given parameter GEOMAPI_EXPORT void D0(const double theU, diff --git a/src/GeomAPI/GeomAPI_Box.h b/src/GeomAPI/GeomAPI_Box.h index fd79431cb..f7e76ccfb 100644 --- a/src/GeomAPI/GeomAPI_Box.h +++ b/src/GeomAPI/GeomAPI_Box.h @@ -59,6 +59,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomBoxPtr; +using GeomBoxPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Circ.cpp b/src/GeomAPI/GeomAPI_Circ.cpp index 8201aecf9..56258c67f 100644 --- a/src/GeomAPI/GeomAPI_Circ.cpp +++ b/src/GeomAPI/GeomAPI_Circ.cpp @@ -81,7 +81,7 @@ GeomAPI_Circ::project(const std::shared_ptr &thePoint) const { Handle(Geom_Circle) aCircle = new Geom_Circle(*MY_CIRC); - const gp_Pnt &aPoint = thePoint->impl(); + const auto &aPoint = thePoint->impl(); GeomAPI_ProjectPointOnCurve aProj(aPoint, aCircle); Standard_Integer aNbPoint = aProj.NbPoints(); diff --git a/src/GeomAPI/GeomAPI_Circ2d.cpp b/src/GeomAPI/GeomAPI_Circ2d.cpp index f88c68645..9a12a7d2e 100644 --- a/src/GeomAPI/GeomAPI_Circ2d.cpp +++ b/src/GeomAPI/GeomAPI_Circ2d.cpp @@ -44,7 +44,7 @@ static gp_Circ2d *newCirc2d(const double theCenterX, const double theCenterY, double aRadius = aCenter.Distance(aPoint); if (aCenter.IsEqual(aPoint, Precision::Confusion())) - return NULL; + return nullptr; gp_Dir2d aDir(thePointX - theCenterX, thePointY - theCenterY); @@ -75,7 +75,7 @@ GeomAPI_Circ2d::project(const std::shared_ptr &thePoint) const { return aResult; const gp_Pnt2d &aCenter = MY_CIRC2D->Location(); - const gp_Pnt2d &aPoint = thePoint->impl(); + const auto &aPoint = thePoint->impl(); double aDist = aCenter.Distance(aPoint); if (aDist < Precision::Confusion()) @@ -110,10 +110,9 @@ double GeomAPI_Circ2d::radius() const { } //================================================================================================= -const bool -GeomAPI_Circ2d::parameter(const std::shared_ptr thePoint, - const double theTolerance, - double &theParameter) const { +bool GeomAPI_Circ2d::parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const { Handle(Geom2d_Circle) aCurve = new Geom2d_Circle(*MY_CIRC2D); return GeomLib_Tool::Parameter(aCurve, thePoint->impl(), theTolerance, theParameter) == Standard_True; diff --git a/src/GeomAPI/GeomAPI_Circ2d.h b/src/GeomAPI/GeomAPI_Circ2d.h index d0bbd6d01..e9ed0ad70 100644 --- a/src/GeomAPI/GeomAPI_Circ2d.h +++ b/src/GeomAPI/GeomAPI_Circ2d.h @@ -73,9 +73,9 @@ public: * theTolerance tolerance of computation. \param[out] theParameter resulting * parameter. */ - GEOMAPI_EXPORT const bool - parameter(const std::shared_ptr thePoint, - const double theTolerance, double &theParameter) const; + GEOMAPI_EXPORT bool parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const; /** \brief Returns in thePoint the point of parameter theU. * P = C + R * Cos (U) * XDir + R * Sin (U) * YDir where C is the center of diff --git a/src/GeomAPI/GeomAPI_Cone.h b/src/GeomAPI/GeomAPI_Cone.h index ac36550cb..967c256fd 100644 --- a/src/GeomAPI/GeomAPI_Cone.h +++ b/src/GeomAPI/GeomAPI_Cone.h @@ -86,6 +86,6 @@ private: }; //! Pointer on the object -typedef std::shared_ptr GeomConePtr; +using GeomConePtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Curve.cpp b/src/GeomAPI/GeomAPI_Curve.cpp index 8419719f6..6b8e14190 100644 --- a/src/GeomAPI/GeomAPI_Curve.cpp +++ b/src/GeomAPI/GeomAPI_Curve.cpp @@ -42,7 +42,7 @@ GeomAPI_Curve::GeomAPI_Curve() GeomAPI_Curve::GeomAPI_Curve(const std::shared_ptr &theShape) : GeomAPI_Interface(new Handle_Geom_Curve()) // initially it is null { - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); TopoDS_Edge anEdge = TopoDS::Edge(aShape); if (!anEdge.IsNull()) { Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, myStart, myEnd); @@ -131,7 +131,7 @@ GeomAPI_Curve::project(const std::shared_ptr &thePoint) const { if (MY_CURVE.IsNull()) return aResult; - const gp_Pnt &aPoint = thePoint->impl(); + const auto &aPoint = thePoint->impl(); GeomAPI_ProjectPointOnCurve aProj(aPoint, MY_CURVE); Standard_Integer aNbPoint = aProj.NbPoints(); @@ -147,7 +147,7 @@ GeomAPI_Curve::project(const std::shared_ptr &thePoint) const { bool GeomAPI_Curve::Comparator::operator()( const GeomCurvePtr &theCurve1, const GeomCurvePtr &theCurve2) const { - const Handle(Geom_Curve) &aCurve1 = theCurve1->impl(); - const Handle(Geom_Curve) &aCurve2 = theCurve2->impl(); + const auto &aCurve1 = theCurve1->impl(); + const auto &aCurve2 = theCurve2->impl(); return aCurve1.get() < aCurve2.get(); } diff --git a/src/GeomAPI/GeomAPI_Cylinder.cpp b/src/GeomAPI/GeomAPI_Cylinder.cpp index db0e6ca5b..0b5cf7122 100644 --- a/src/GeomAPI/GeomAPI_Cylinder.cpp +++ b/src/GeomAPI/GeomAPI_Cylinder.cpp @@ -80,7 +80,7 @@ bool GeomAPI_Cylinder::isCoincident(const GeomCylinderPtr theCylinder, if (!theCylinder) return false; - gp_Cylinder *anOther = theCylinder->implPtr(); + auto *anOther = theCylinder->implPtr(); if (fabs(MY_CYL->Radius() - anOther->Radius()) < theTolerance) { gp_Dir aDir1 = MY_CYL->Position().Direction(); gp_Dir aDir2 = anOther->Position().Direction(); diff --git a/src/GeomAPI/GeomAPI_Cylinder.h b/src/GeomAPI/GeomAPI_Cylinder.h index 16dee4ca7..88df670d2 100644 --- a/src/GeomAPI/GeomAPI_Cylinder.h +++ b/src/GeomAPI/GeomAPI_Cylinder.h @@ -71,6 +71,6 @@ private: }; //! Pointer on the object -typedef std::shared_ptr GeomCylinderPtr; +using GeomCylinderPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.cpp b/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.cpp index 0aea27c0a..17af37b6c 100644 --- a/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.cpp +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.cpp @@ -36,13 +36,12 @@ GeomAPI_DataMapOfShapeMapOfShapes::GeomAPI_DataMapOfShapeMapOfShapes() //================================================================================================= bool GeomAPI_DataMapOfShapeMapOfShapes::bind( const std::shared_ptr theKey, const ListOfShape &theItems) { - const TopoDS_Shape &aKey = theKey->impl(); + const auto &aKey = theKey->impl(); if (MY_MAP->IsBound(aKey)) { MY_MAP->ChangeFind(aKey).Clear(); } - for (ListOfShape::const_iterator anIt = theItems.cbegin(); - anIt != theItems.cend(); anIt++) { - const TopoDS_Shape &anItem = (*anIt)->impl(); + for (const auto &theItem : theItems) { + const auto &anItem = theItem->impl(); if (MY_MAP->IsBound(aKey)) { MY_MAP->ChangeFind(aKey).Add(anItem); } else { @@ -59,8 +58,8 @@ bool GeomAPI_DataMapOfShapeMapOfShapes::bind( bool GeomAPI_DataMapOfShapeMapOfShapes::add( const std::shared_ptr theKey, const std::shared_ptr theItem) { - const TopoDS_Shape &aKey = theKey->impl(); - const TopoDS_Shape &anItem = theItem->impl(); + const auto &aKey = theKey->impl(); + const auto &anItem = theItem->impl(); if (MY_MAP->IsBound(aKey)) { return MY_MAP->ChangeFind(aKey).Add(anItem) == Standard_True; } else { @@ -73,14 +72,14 @@ bool GeomAPI_DataMapOfShapeMapOfShapes::add( //================================================================================================= bool GeomAPI_DataMapOfShapeMapOfShapes::isBound( const std::shared_ptr theKey) const { - const TopoDS_Shape &aKey = theKey->impl(); + const auto &aKey = theKey->impl(); return MY_MAP->IsBound(aKey) == Standard_True; } //================================================================================================= bool GeomAPI_DataMapOfShapeMapOfShapes::find( const std::shared_ptr theKey, ListOfShape &theItems) const { - const TopoDS_Shape &aKey = theKey->impl(); + const auto &aKey = theKey->impl(); if (MY_MAP->IsBound(aKey) == Standard_False) { return false; @@ -100,7 +99,7 @@ bool GeomAPI_DataMapOfShapeMapOfShapes::find( //================================================================================================= bool GeomAPI_DataMapOfShapeMapOfShapes::unBind( const std::shared_ptr theKey) { - const TopoDS_Shape &aKey = theKey->impl(); + const auto &aKey = theKey->impl(); return MY_MAP->UnBind(aKey) == Standard_True; } @@ -118,7 +117,7 @@ int GeomAPI_DataMapOfShapeMapOfShapes::size() const { return MY_MAP->Size(); } class IteratorImpl : public GeomAPI_DataMapOfShapeMapOfShapes::iterator { public: - IteratorImpl() {} + IteratorImpl() = default; IteratorImpl(const MAP::Iterator &theIterator) : myIterator(theIterator) {} @@ -134,11 +133,11 @@ public: return !myIterator.More(); } - virtual iterator &operator++() { + iterator &operator++() override { myIterator.Next(); return *this; } - virtual iterator operator++(int) { + iterator operator++(int) override { std::shared_ptr aSelf = std::dynamic_pointer_cast(mySelf); std::shared_ptr aCopy(new IteratorImpl(aSelf->myIterator)); @@ -146,7 +145,7 @@ public: return IteratorImpl(aCopy); } - virtual key_type first() const { + key_type first() const override { if (mySelf) return iterator::first(); @@ -155,7 +154,7 @@ public: return aShape; } - virtual mapped_type second() const { + mapped_type second() const override { if (mySelf) return iterator::second(); @@ -174,11 +173,10 @@ private: MAP::Iterator myIterator; }; -GeomAPI_DataMapOfShapeMapOfShapes::iterator::iterator() {} +GeomAPI_DataMapOfShapeMapOfShapes::iterator::iterator() = default; GeomAPI_DataMapOfShapeMapOfShapes::iterator::iterator( - const GeomAPI_DataMapOfShapeMapOfShapes::iterator &theOther) - : mySelf(theOther.mySelf) {} + const GeomAPI_DataMapOfShapeMapOfShapes::iterator &theOther) = default; const GeomAPI_DataMapOfShapeMapOfShapes::iterator & GeomAPI_DataMapOfShapeMapOfShapes::iterator::operator=( diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp index 1f1bd0aaa..d8ada80f2 100644 --- a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp @@ -46,10 +46,8 @@ bool GeomAPI_DataMapOfShapeShape::bind(std::shared_ptr theKey, void GeomAPI_DataMapOfShapeShape::merge( const GeomAPI_DataMapOfShapeShape &theDataMap) { - const TopTools_DataMapOfShapeShape &aDataMap = - theDataMap.impl(); - TopTools_DataMapOfShapeShape *myDataMap = - implPtr(); + const auto &aDataMap = theDataMap.impl(); + auto *myDataMap = implPtr(); for (TopTools_DataMapIteratorOfDataMapOfShapeShape anIt(aDataMap); anIt.More(); anIt.Next()) { myDataMap->Bind(anIt.Key(), anIt.Value()); diff --git a/src/GeomAPI/GeomAPI_Dir2d.h b/src/GeomAPI/GeomAPI_Dir2d.h index b40eca165..98e813adc 100644 --- a/src/GeomAPI/GeomAPI_Dir2d.h +++ b/src/GeomAPI/GeomAPI_Dir2d.h @@ -67,6 +67,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomDir2dPtr; +using GeomDir2dPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Edge.cpp b/src/GeomAPI/GeomAPI_Edge.cpp index 87871ac0b..c2257e116 100644 --- a/src/GeomAPI/GeomAPI_Edge.cpp +++ b/src/GeomAPI/GeomAPI_Edge.cpp @@ -56,7 +56,7 @@ #include GeomAPI_Edge::GeomAPI_Edge() { - TopoDS_Edge *anEdge = new TopoDS_Edge; + auto *anEdge = new TopoDS_Edge; BRep_Builder aBuilder; aBuilder.MakeEdge(*anEdge); @@ -73,7 +73,7 @@ GeomAPI_Edge::GeomAPI_Edge(const std::shared_ptr &theShape) { void GeomAPI_Edge::vertices( std::shared_ptr &theStartVertex, std::shared_ptr &theEndVertex) const { - const TopoDS_Edge &anEdge = impl(); + const auto &anEdge = impl(); TopoDS_Vertex aStart, aEnd; TopExp::Vertices(anEdge, aStart, aEnd); theStartVertex.reset(new GeomAPI_Vertex); @@ -112,8 +112,7 @@ bool GeomAPI_Edge::isSameGeometry( } bool GeomAPI_Edge::isLine() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); @@ -143,8 +142,7 @@ static Handle(Geom_Circle) circ(const Handle(Geom_Curve) theCurve) { } bool GeomAPI_Edge::isCircle() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); @@ -158,8 +156,7 @@ bool GeomAPI_Edge::isCircle() const { } bool GeomAPI_Edge::isArc() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); @@ -173,8 +170,7 @@ bool GeomAPI_Edge::isArc() const { } bool GeomAPI_Edge::isEllipse() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); @@ -186,8 +182,7 @@ bool GeomAPI_Edge::isEllipse() const { } bool GeomAPI_Edge::isBSpline() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); @@ -199,8 +194,7 @@ bool GeomAPI_Edge::isBSpline() const { } std::shared_ptr GeomAPI_Edge::firstPoint() { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); @@ -211,8 +205,7 @@ std::shared_ptr GeomAPI_Edge::firstPoint() { } std::shared_ptr GeomAPI_Edge::lastPoint() { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); @@ -223,8 +216,7 @@ std::shared_ptr GeomAPI_Edge::lastPoint() { } std::shared_ptr GeomAPI_Edge::circle() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); @@ -243,8 +235,7 @@ std::shared_ptr GeomAPI_Edge::circle() const { } std::shared_ptr GeomAPI_Edge::ellipse() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); @@ -263,8 +254,7 @@ std::shared_ptr GeomAPI_Edge::ellipse() const { } std::shared_ptr GeomAPI_Edge::line() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); @@ -286,9 +276,8 @@ std::shared_ptr GeomAPI_Edge::line() const { bool GeomAPI_Edge::isEqual(const std::shared_ptr theEdge) const { if (!theEdge.get() || !theEdge->isEdge()) return false; - const TopoDS_Shape &aMyShape = - const_cast(this)->impl(); - const TopoDS_Shape &aInShape = theEdge->impl(); + const auto &aMyShape = const_cast(this)->impl(); + const auto &aInShape = theEdge->impl(); if (aMyShape.IsNull() || aInShape.IsNull()) return false; @@ -339,8 +328,7 @@ void GeomAPI_Edge::setRange(const double &theFirst, const double &theLast) { } void GeomAPI_Edge::getRange(double &theFirst, double &theLast) const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, theFirst, theLast); } @@ -348,8 +336,7 @@ void GeomAPI_Edge::getRange(double &theFirst, double &theLast) const { // LCOV_EXCL_START bool GeomAPI_Edge::isInPlane(std::shared_ptr thePlane) const { double aFirst, aLast; - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); if (aCurve.IsNull()) @@ -393,8 +380,7 @@ void GeomAPI_Edge::intersectWithPlane( const std::shared_ptr thePlane, std::list> &theResult) const { double aFirst, aLast; - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast); if (!aCurve.IsNull()) { @@ -448,8 +434,7 @@ double GeomAPI_Edge::length() const { } bool GeomAPI_Edge::isClosed() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); if (aShape.IsNull()) return false; double aFirst, aLast; @@ -464,8 +449,7 @@ bool GeomAPI_Edge::isClosed() const { } bool GeomAPI_Edge::isDegenerated() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); if (aShape.IsNull() || aShape.ShapeType() != TopAbs_EDGE) return false; return BRep_Tool::Degenerated(TopoDS::Edge(aShape)); @@ -502,7 +486,7 @@ double GeomAPI_Edge::lastPointTolerance() const { GeomPointPtr GeomAPI_Edge::middlePoint() const { GeomPointPtr aMiddlePoint; - const TopoDS_Edge &anEdge = impl(); + const auto &anEdge = impl(); if (anEdge.IsNull()) return aMiddlePoint; double aFirst, aLast; diff --git a/src/GeomAPI/GeomAPI_Ellipse.cpp b/src/GeomAPI/GeomAPI_Ellipse.cpp index 13a8777a5..3f85f65e2 100644 --- a/src/GeomAPI/GeomAPI_Ellipse.cpp +++ b/src/GeomAPI/GeomAPI_Ellipse.cpp @@ -86,7 +86,7 @@ GeomAPI_Ellipse::project(const std::shared_ptr &thePoint) const { Handle(Geom_Ellipse) aEllipse = new Geom_Ellipse(*MY_ELIPS); - const gp_Pnt &aPoint = thePoint->impl(); + const auto &aPoint = thePoint->impl(); GeomAPI_ProjectPointOnCurve aProj(aPoint, aEllipse); Standard_Integer aNbPoint = aProj.NbPoints(); @@ -98,10 +98,9 @@ GeomAPI_Ellipse::project(const std::shared_ptr &thePoint) const { return aResult; } -const bool -GeomAPI_Ellipse::parameter(const std::shared_ptr thePoint, - const double theTolerance, - double &theParameter) const { +bool GeomAPI_Ellipse::parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const { Handle(Geom_Ellipse) aCurve = new Geom_Ellipse(*MY_ELIPS); return GeomLib_Tool::Parameter(aCurve, thePoint->impl(), theTolerance, theParameter) == Standard_True; diff --git a/src/GeomAPI/GeomAPI_Ellipse.h b/src/GeomAPI/GeomAPI_Ellipse.h index 5add41e4b..45c579a9a 100644 --- a/src/GeomAPI/GeomAPI_Ellipse.h +++ b/src/GeomAPI/GeomAPI_Ellipse.h @@ -87,9 +87,9 @@ public: * theTolerance tolerance of computation. \param[out] theParameter resulting * parameter. */ - GEOMAPI_EXPORT const bool - parameter(const std::shared_ptr thePoint, - const double theTolerance, double &theParameter) const; + GEOMAPI_EXPORT bool parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const; }; //! Pointer on the object diff --git a/src/GeomAPI/GeomAPI_Ellipse2d.cpp b/src/GeomAPI/GeomAPI_Ellipse2d.cpp index f13d6b616..29c8a89e9 100644 --- a/src/GeomAPI/GeomAPI_Ellipse2d.cpp +++ b/src/GeomAPI/GeomAPI_Ellipse2d.cpp @@ -59,9 +59,9 @@ static gp_Elips2d * newEllipse(const std::shared_ptr &theCenter, const std::shared_ptr &theAxisPoint, const std::shared_ptr &thePassingPoint) { - const gp_Pnt2d &aCenter = theCenter->impl(); - const gp_Pnt2d &anAxisPnt = theAxisPoint->impl(); - const gp_Pnt2d &aPassedPnt = thePassingPoint->impl(); + const auto &aCenter = theCenter->impl(); + const auto &anAxisPnt = theAxisPoint->impl(); + const auto &aPassedPnt = thePassingPoint->impl(); gp_Dir2d aXAxis(anAxisPnt.XY() - aCenter.XY()); double aMajorRadius = anAxisPnt.Distance(aCenter); @@ -70,7 +70,7 @@ newEllipse(const std::shared_ptr &theCenter, double X = aPassedDir.Dot(aXAxis.XY()) / aMajorRadius; if (Abs(X) > 1.0 - Precision::Confusion()) - return 0; // ellipse cannot be created for such parameters + return nullptr; // ellipse cannot be created for such parameters double Y = aPassedDir.CrossMagnitude(aXAxis.XY()); double aMinorRadius = Y / Sqrt(1. - X * X); @@ -200,8 +200,8 @@ double GeomAPI_Ellipse2d::distance( IntAna2d_AnaIntersection anInter(theEllipse->impl(), IntAna2d_Conic(*MY_ELLIPSE)); - Extrema_ExtCC2d *anExtema = new Extrema_ExtCC2d( - Geom2dAdaptor_Curve(anEllipse1), Geom2dAdaptor_Curve(anEllipse2)); + auto *anExtema = new Extrema_ExtCC2d(Geom2dAdaptor_Curve(anEllipse1), + Geom2dAdaptor_Curve(anEllipse2)); double aDistance = extrema(&anInter, anExtema, theEllipse->firstFocus(), thePointOnEllipse, thePointOnMe); delete anExtema; @@ -216,7 +216,7 @@ const std::shared_ptr GeomAPI_Ellipse2d::project( Handle(Geom2d_Ellipse) aEllipse = new Geom2d_Ellipse(*MY_ELLIPSE); - const gp_Pnt2d &aPoint = thePoint->impl(); + const auto &aPoint = thePoint->impl(); Geom2dAPI_ProjectPointOnCurve aProj(aPoint, aEllipse); Standard_Integer aNbPoint = aProj.NbPoints(); @@ -227,10 +227,9 @@ const std::shared_ptr GeomAPI_Ellipse2d::project( return aResult; } -const bool -GeomAPI_Ellipse2d::parameter(const std::shared_ptr thePoint, - const double theTolerance, - double &theParameter) const { +bool GeomAPI_Ellipse2d::parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const { Handle(Geom2d_Ellipse) aCurve = new Geom2d_Ellipse(*MY_ELLIPSE); return GeomLib_Tool::Parameter(aCurve, thePoint->impl(), theTolerance, theParameter) == Standard_True; diff --git a/src/GeomAPI/GeomAPI_Ellipse2d.h b/src/GeomAPI/GeomAPI_Ellipse2d.h index 4e09994ab..67621ff97 100644 --- a/src/GeomAPI/GeomAPI_Ellipse2d.h +++ b/src/GeomAPI/GeomAPI_Ellipse2d.h @@ -79,9 +79,9 @@ public: * theTolerance tolerance of computation. \param[out] theParameter resulting * parameter. */ - GEOMAPI_EXPORT const bool - parameter(const std::shared_ptr thePoint, - const double theTolerance, double &theParameter) const; + GEOMAPI_EXPORT bool parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const; /// Calculate minimal distance between the ellipse and a line. /// Return corresponding points on the ellipse and on the line. diff --git a/src/GeomAPI/GeomAPI_Face.cpp b/src/GeomAPI/GeomAPI_Face.cpp index 3a0ba894b..2d183a321 100644 --- a/src/GeomAPI/GeomAPI_Face.cpp +++ b/src/GeomAPI/GeomAPI_Face.cpp @@ -87,9 +87,8 @@ bool GeomAPI_Face::isEqual(std::shared_ptr theFace) const { if (!theFace->isFace()) return false; - const TopoDS_Shape &aMyShape = - const_cast(this)->impl(); - const TopoDS_Shape &aInShape = theFace->impl(); + const auto &aMyShape = const_cast(this)->impl(); + const auto &aInShape = theFace->impl(); TopoDS_Face aMyFace = TopoDS::Face(aMyShape); TopoDS_Face aInFace = TopoDS::Face(aInShape); @@ -221,8 +220,7 @@ bool GeomAPI_Face::isSameGeometry( } bool GeomAPI_Face::isCylindrical() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape)); Handle(Geom_RectangularTrimmedSurface) aTrimmed = Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf); @@ -369,7 +367,7 @@ std::shared_ptr GeomAPI_Face::getTorus() const { GeomPointPtr GeomAPI_Face::middlePoint() const { GeomPointPtr anInnerPoint; - const TopoDS_Face &aFace = impl(); + const auto &aFace = impl(); if (aFace.IsNull()) return anInnerPoint; diff --git a/src/GeomAPI/GeomAPI_ICustomPrs.cpp b/src/GeomAPI/GeomAPI_ICustomPrs.cpp index 8519efdd4..a5b505925 100644 --- a/src/GeomAPI/GeomAPI_ICustomPrs.cpp +++ b/src/GeomAPI/GeomAPI_ICustomPrs.cpp @@ -20,4 +20,4 @@ #include -GeomAPI_ICustomPrs::~GeomAPI_ICustomPrs() {} +GeomAPI_ICustomPrs::~GeomAPI_ICustomPrs() = default; diff --git a/src/GeomAPI/GeomAPI_IPresentable.cpp b/src/GeomAPI/GeomAPI_IPresentable.cpp index 5df092b54..203dd7c60 100644 --- a/src/GeomAPI/GeomAPI_IPresentable.cpp +++ b/src/GeomAPI/GeomAPI_IPresentable.cpp @@ -24,4 +24,4 @@ #include "GeomAPI_IPresentable.h" -GeomAPI_IPresentable::~GeomAPI_IPresentable() {} +GeomAPI_IPresentable::~GeomAPI_IPresentable() = default; diff --git a/src/GeomAPI/GeomAPI_IScreenParams.h b/src/GeomAPI/GeomAPI_IScreenParams.h index 2a5022d3f..e333a9366 100644 --- a/src/GeomAPI/GeomAPI_IScreenParams.h +++ b/src/GeomAPI/GeomAPI_IScreenParams.h @@ -29,7 +29,7 @@ */ class GeomAPI_IScreenParams { public: - virtual ~GeomAPI_IScreenParams() {} + virtual ~GeomAPI_IScreenParams() = default; /** * Set plane of active view screen @@ -44,6 +44,6 @@ public: virtual void setViewScale(double theScale) = 0; }; -typedef std::shared_ptr GeomScreenParamsPtr; +using GeomScreenParamsPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Interface.cpp b/src/GeomAPI/GeomAPI_Interface.cpp index 07e02e687..3bd892187 100644 --- a/src/GeomAPI/GeomAPI_Interface.cpp +++ b/src/GeomAPI/GeomAPI_Interface.cpp @@ -20,8 +20,8 @@ #include -GeomAPI_Interface::GeomAPI_Interface() {} +GeomAPI_Interface::GeomAPI_Interface() = default; -GeomAPI_Interface::~GeomAPI_Interface() {} +GeomAPI_Interface::~GeomAPI_Interface() = default; -bool GeomAPI_Interface::empty() const { return myImpl.get() == 0; } +bool GeomAPI_Interface::empty() const { return myImpl.get() == nullptr; } diff --git a/src/GeomAPI/GeomAPI_PlanarEdges.cpp b/src/GeomAPI/GeomAPI_PlanarEdges.cpp index b40ab6d9f..f84d6b9f7 100644 --- a/src/GeomAPI/GeomAPI_PlanarEdges.cpp +++ b/src/GeomAPI/GeomAPI_PlanarEdges.cpp @@ -41,16 +41,16 @@ GeomAPI_PlanarEdges::GeomAPI_PlanarEdges() : GeomAPI_Shape() { } void GeomAPI_PlanarEdges::addEdge(std::shared_ptr theEdge) { - const TopoDS_Edge &anEdge = theEdge->impl(); + const auto &anEdge = theEdge->impl(); if (anEdge.ShapeType() != TopAbs_EDGE) return; - TopoDS_Shape &aWire = const_cast(impl()); + auto &aWire = const_cast(impl()); BRep_Builder aBuilder; aBuilder.Add(aWire, anEdge); } std::list> GeomAPI_PlanarEdges::getEdges() { - TopoDS_Shape &aShape = const_cast(impl()); + auto &aShape = const_cast(impl()); TopExp_Explorer aWireExp(aShape, TopAbs_EDGE); std::list> aResult; for (; aWireExp.More(); aWireExp.Next()) { @@ -61,7 +61,7 @@ std::list> GeomAPI_PlanarEdges::getEdges() { return aResult; } -bool GeomAPI_PlanarEdges::hasPlane() const { return myPlane.get() != NULL; } +bool GeomAPI_PlanarEdges::hasPlane() const { return myPlane.get() != nullptr; } bool GeomAPI_PlanarEdges::isVertex() const { return false; } @@ -105,7 +105,7 @@ bool GeomAPI_PlanarEdges::isEqual( const std::shared_ptr theShape) const { if (!theShape.get()) return false; - TopoDS_Shape &aMyShape = const_cast(impl()); + auto &aMyShape = const_cast(impl()); TopoDS_Shape aTheShape = theShape->impl(); if (aMyShape.ShapeType() != aTheShape.ShapeType()) // to don't confuse by the face of same edges diff --git a/src/GeomAPI/GeomAPI_PlanarEdges.h b/src/GeomAPI/GeomAPI_PlanarEdges.h index c19dce461..517b68dc9 100644 --- a/src/GeomAPI/GeomAPI_PlanarEdges.h +++ b/src/GeomAPI/GeomAPI_PlanarEdges.h @@ -43,10 +43,10 @@ public: GEOMAPI_EXPORT GeomAPI_PlanarEdges(); /// Returns whether the shape is alone vertex - GEOMAPI_EXPORT virtual bool isVertex() const; + GEOMAPI_EXPORT bool isVertex() const override; /// Returns whether the shape is alone edge - GEOMAPI_EXPORT virtual bool isEdge() const; + GEOMAPI_EXPORT bool isEdge() const override; /// Appends the edge to the set GEOMAPI_EXPORT void addEdge(std::shared_ptr theEdge); /// Returns the list of edges in this interface @@ -68,7 +68,7 @@ public: GEOMAPI_EXPORT std::shared_ptr norm() const; /// Returns whether the shape is planar - GEOMAPI_EXPORT virtual bool isPlanar() const; + GEOMAPI_EXPORT bool isPlanar() const override; /// Set working plane /// \param theOrigin origin of the plane axis @@ -80,7 +80,7 @@ public: /// Returns whether the shapes are equal GEOMAPI_EXPORT - virtual bool isEqual(const std::shared_ptr theShape) const; + bool isEqual(const std::shared_ptr theShape) const override; private: std::shared_ptr myPlane; diff --git a/src/GeomAPI/GeomAPI_Pln.cpp b/src/GeomAPI/GeomAPI_Pln.cpp index c9f2ce3e6..770db459c 100644 --- a/src/GeomAPI/GeomAPI_Pln.cpp +++ b/src/GeomAPI/GeomAPI_Pln.cpp @@ -70,8 +70,8 @@ bool GeomAPI_Pln::isCoincident(const std::shared_ptr thePlane, return false; } - const gp_Pln &aMyPln = impl(); - const gp_Pln &anOtherPln = thePlane->impl(); + const auto &aMyPln = impl(); + const auto &anOtherPln = thePlane->impl(); return (aMyPln.Contains(anOtherPln.Location(), theTolerance) && aMyPln.Axis().IsParallel(anOtherPln.Axis(), theTolerance)); } @@ -107,16 +107,16 @@ GeomAPI_Pln::project(const std::shared_ptr &thePoint) const { double GeomAPI_Pln::distance(const std::shared_ptr thePlane) const { - const gp_Pln &aMyPln = impl(); - const gp_Pln &anOtherPln = thePlane->impl(); + const auto &aMyPln = impl(); + const auto &anOtherPln = thePlane->impl(); return aMyPln.Distance(anOtherPln); } double GeomAPI_Pln::distance(const std::shared_ptr thePoint) const { - const gp_Pln &aMyPln = impl(); - const gp_Pnt &aPnt = thePoint->impl(); + const auto &aMyPln = impl(); + const auto &aPnt = thePoint->impl(); return aMyPln.Distance(aPnt); } @@ -136,8 +136,8 @@ GeomAPI_Pln::intersect(const std::shared_ptr thePlane) const { return aRes; } - const gp_Pln &aMyPln = impl(); - const gp_Pln &anOtherPln = thePlane->impl(); + const auto &aMyPln = impl(); + const auto &anOtherPln = thePlane->impl(); IntAna_QuadQuadGeo aQuad(aMyPln, anOtherPln, Precision::Confusion(), Precision::Confusion()); diff --git a/src/GeomAPI/GeomAPI_Shape.cpp b/src/GeomAPI/GeomAPI_Shape.cpp index 087f65bc7..a6b9e6e96 100644 --- a/src/GeomAPI/GeomAPI_Shape.cpp +++ b/src/GeomAPI/GeomAPI_Shape.cpp @@ -111,44 +111,37 @@ bool GeomAPI_Shape::isSameGeometry( } bool GeomAPI_Shape::isVertex() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX; } bool GeomAPI_Shape::isEdge() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE; } bool GeomAPI_Shape::isWire() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_WIRE; } bool GeomAPI_Shape::isFace() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_FACE; } bool GeomAPI_Shape::isShell() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_SHELL; } bool GeomAPI_Shape::isCompound() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND; } bool GeomAPI_Shape::isCollectionOfSolids() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); if (aShape.IsNull()) return false; @@ -172,8 +165,7 @@ bool GeomAPI_Shape::isCollectionOfSolids() const { } bool GeomAPI_Shape::isCompoundOfSolids() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) return false; bool isAtLeastOne = false; @@ -187,8 +179,7 @@ bool GeomAPI_Shape::isCompoundOfSolids() const { // LCOV_EXCL_START GeomAPI_Shape::ShapeType GeomAPI_Shape::typeOfCompoundShapes() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) return SHAPE; int aType = -1; @@ -219,8 +210,7 @@ static void addSimpleToList(const TopoDS_Shape &theShape, } bool GeomAPI_Shape::isConnectedTopology() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) return false; // list of simple elements that are not detected in connection to others @@ -277,14 +267,12 @@ bool GeomAPI_Shape::isConnectedTopology() const { } bool GeomAPI_Shape::isSolid() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_SOLID; } bool GeomAPI_Shape::isCompSolid() const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); return !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPSOLID; } @@ -381,7 +369,7 @@ bool GeomAPI_Shape::isPlanar() const { std::shared_ptr GeomAPI_Shape::vertex() const { GeomVertexPtr aVertex; if (isVertex()) { - const TopoDS_Shape &aShape = + const auto &aShape = const_cast(this)->impl(); aVertex = GeomVertexPtr(new GeomAPI_Vertex); aVertex->setImpl(new TopoDS_Shape(aShape)); @@ -392,7 +380,7 @@ std::shared_ptr GeomAPI_Shape::vertex() const { std::shared_ptr GeomAPI_Shape::edge() const { GeomEdgePtr anEdge; if (isEdge()) { - const TopoDS_Shape &aShape = + const auto &aShape = const_cast(this)->impl(); anEdge = GeomEdgePtr(new GeomAPI_Edge); anEdge->setImpl(new TopoDS_Shape(aShape)); @@ -403,7 +391,7 @@ std::shared_ptr GeomAPI_Shape::edge() const { std::shared_ptr GeomAPI_Shape::wire() const { GeomWirePtr aWire; if (isWire()) { - const TopoDS_Shape &aShape = + const auto &aShape = const_cast(this)->impl(); aWire = GeomWirePtr(new GeomAPI_Wire); aWire->setImpl(new TopoDS_Shape(aShape)); @@ -414,7 +402,7 @@ std::shared_ptr GeomAPI_Shape::wire() const { std::shared_ptr GeomAPI_Shape::face() const { GeomFacePtr aFace; if (isFace()) { - const TopoDS_Shape &aShape = + const auto &aShape = const_cast(this)->impl(); aFace = GeomFacePtr(new GeomAPI_Face); aFace->setImpl(new TopoDS_Shape(aShape)); @@ -425,7 +413,7 @@ std::shared_ptr GeomAPI_Shape::face() const { std::shared_ptr GeomAPI_Shape::shell() const { GeomShellPtr aShell; if (isShell()) { - const TopoDS_Shape &aShape = + const auto &aShape = const_cast(this)->impl(); aShell = GeomShellPtr(new GeomAPI_Shell); aShell->setImpl(new TopoDS_Shape(aShape)); @@ -436,7 +424,7 @@ std::shared_ptr GeomAPI_Shape::shell() const { std::shared_ptr GeomAPI_Shape::solid() const { GeomSolidPtr aSolid; if (isSolid()) { - const TopoDS_Shape &aShape = + const auto &aShape = const_cast(this)->impl(); aSolid = GeomSolidPtr(new GeomAPI_Solid); aSolid->setImpl(new TopoDS_Shape(aShape)); @@ -448,7 +436,7 @@ std::list> GeomAPI_Shape::subShapes(const ShapeType theSubShapeType, const bool theOnlyUnique) const { ListOfShape aSubs; - const TopoDS_Shape &aShape = impl(); + const auto &aShape = impl(); if (aShape.IsNull()) return aSubs; @@ -484,7 +472,7 @@ GeomAPI_Shape::subShapes(const ShapeType theSubShapeType, } GeomAPI_Shape::ShapeType GeomAPI_Shape::shapeType() const { - const TopoDS_Shape &aShape = impl(); + const auto &aShape = impl(); if (aShape.IsNull()) return GeomAPI_Shape::SHAPE; @@ -634,7 +622,7 @@ bool GeomAPI_Shape::isSubShape(const std::shared_ptr theShape, return false; } - const TopoDS_Shape &aShapeToSearch = theShape->impl(); + const auto &aShapeToSearch = theShape->impl(); if (aShapeToSearch.IsNull()) { return false; } @@ -653,8 +641,7 @@ bool GeomAPI_Shape::isSubShape(const std::shared_ptr theShape, bool GeomAPI_Shape::computeSize(double &theXmin, double &theYmin, double &theZmin, double &theXmax, double &theYmax, double &theZmax) const { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); if (aShape.IsNull()) return false; Bnd_Box aBndBox; @@ -716,8 +703,7 @@ GeomPointPtr GeomAPI_Shape::middlePoint() const { std::string GeomAPI_Shape::getShapeStream(const bool theWithTriangulation) const { std::ostringstream aStream; - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); if (!theWithTriangulation) { // make a copy of shape without triangulation BRepBuilderAPI_Copy aCopy(aShape, Standard_False, Standard_False); const TopoDS_Shape &aCopyShape = aCopy.Shape(); @@ -735,9 +721,8 @@ GeomAPI_Shape::getShapeStream(const bool theWithTriangulation) const { // LCOV_EXCL_STOP GeomShapePtr GeomAPI_Shape::intersect(const GeomShapePtr theShape) const { - const TopoDS_Shape &aShape1 = - const_cast(this)->impl(); - const TopoDS_Shape &aShape2 = theShape->impl(); + const auto &aShape1 = const_cast(this)->impl(); + const auto &aShape2 = theShape->impl(); BRepAlgoAPI_Section aCommon(aShape1, aShape2); if (!aCommon.IsDone()) @@ -764,9 +749,8 @@ bool GeomAPI_Shape::isIntersect(const GeomShapePtr theShape) const { return false; } - const TopoDS_Shape &aShape1 = - const_cast(this)->impl(); - const TopoDS_Shape &aShape2 = theShape->impl(); + const auto &aShape1 = const_cast(this)->impl(); + const auto &aShape2 = theShape->impl(); BRepExtrema_DistShapeShape aDist(aShape1, aShape2); aDist.Perform(); @@ -797,7 +781,7 @@ bool GeomAPI_Shape::isSelfIntersected(const int theLevelOfCheck) const { BOPAlgo_CheckerSI aCSI; // checker of self-interferences aCSI.SetLevelOfCheck(theLevelOfCheck); TopTools_ListOfShape aList; - const TopoDS_Shape &aThisShape = + const auto &aThisShape = const_cast(this)->impl(); aList.Append(aThisShape); aCSI.SetArguments(aList); @@ -812,8 +796,8 @@ bool GeomAPI_Shape::isSelfIntersected(const int theLevelOfCheck) const { bool GeomAPI_Shape::Comparator::operator()( const std::shared_ptr &theShape1, const std::shared_ptr &theShape2) const { - const TopoDS_Shape &aShape1 = theShape1->impl(); - const TopoDS_Shape &aShape2 = theShape2->impl(); + const auto &aShape1 = theShape1->impl(); + const auto &aShape2 = theShape2->impl(); bool isLess = aShape1.TShape() < aShape2.TShape(); if (aShape1.TShape() == aShape2.TShape()) { Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast()); @@ -826,8 +810,8 @@ bool GeomAPI_Shape::Comparator::operator()( bool GeomAPI_Shape::ComparatorWithOri::operator()( const std::shared_ptr &theShape1, const std::shared_ptr &theShape2) const { - const TopoDS_Shape &aShape1 = theShape1->impl(); - const TopoDS_Shape &aShape2 = theShape2->impl(); + const auto &aShape1 = theShape1->impl(); + const auto &aShape2 = theShape2->impl(); bool isLess = aShape1.TShape() < aShape2.TShape(); if (aShape1.TShape() == aShape2.TShape()) { Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast()); @@ -841,15 +825,15 @@ bool GeomAPI_Shape::ComparatorWithOri::operator()( int GeomAPI_Shape::Hash::operator()( const std::shared_ptr &theShape) const { - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); return aShape.HashCode(IntegerLast()); } bool GeomAPI_Shape::Equal::operator()( const std::shared_ptr &theShape1, const std::shared_ptr &theShape2) const { - const TopoDS_Shape &aShape1 = theShape1->impl(); - const TopoDS_Shape &aShape2 = theShape2->impl(); + const auto &aShape1 = theShape1->impl(); + const auto &aShape2 = theShape2->impl(); Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast()); Standard_Integer aHash2 = aShape2.Location().HashCode(IntegerLast()); diff --git a/src/GeomAPI/GeomAPI_ShapeHierarchy.cpp b/src/GeomAPI/GeomAPI_ShapeHierarchy.cpp index db9152c05..8368260b1 100644 --- a/src/GeomAPI/GeomAPI_ShapeHierarchy.cpp +++ b/src/GeomAPI/GeomAPI_ShapeHierarchy.cpp @@ -33,7 +33,7 @@ void GeomAPI_ShapeHierarchy::addParent(const GeomShapePtr &theShape, const GeomShapePtr &theParent) { myParent[theShape] = theParent; - MapShapeToIndex::iterator aFound = myParentIndices.find(theParent); + auto aFound = myParentIndices.find(theParent); size_t anIndex = myParentIndices.size(); if (aFound == myParentIndices.end()) { myParentIndices[theParent] = anIndex; @@ -73,19 +73,17 @@ GeomShapePtr GeomAPI_ShapeHierarchy::root(const GeomShapePtr &theShape, void GeomAPI_ShapeHierarchy::markProcessed(const GeomShapePtr &theShape) { myProcessedObjects.insert(theShape); // mark sub-shapes of the compound as processed too - MapShapeToIndex::iterator aFoundInd = myParentIndices.find(theShape); + auto aFoundInd = myParentIndices.find(theShape); if (aFoundInd != myParentIndices.end()) { const ListOfShape &aSubs = mySubshapes[aFoundInd->second].second; - for (ListOfShape::const_iterator anIt = aSubs.begin(); anIt != aSubs.end(); - ++anIt) - markProcessed(*anIt); + for (const auto &aSub : aSubs) + markProcessed(aSub); } } void GeomAPI_ShapeHierarchy::markProcessed(const ListOfShape &theShapes) { - for (ListOfShape::const_iterator anIt = theShapes.begin(); - anIt != theShapes.end(); ++anIt) - markProcessed(*anIt); + for (const auto &theShape : theShapes) + markProcessed(theShape); } void GeomAPI_ShapeHierarchy::markModified(const GeomShapePtr &theSource, @@ -95,7 +93,7 @@ void GeomAPI_ShapeHierarchy::markModified(const GeomShapePtr &theSource, const ListOfShape & GeomAPI_ShapeHierarchy::objects(GeomShapePtr theParent) const { - MapShapeToIndex::const_iterator aFoundIndex = myParentIndices.find(theParent); + auto aFoundIndex = myParentIndices.find(theParent); if (aFoundIndex == myParentIndices.end()) { static const ListOfShape THE_DUMMY = ListOfShape(); return THE_DUMMY; // no such shape @@ -120,13 +118,12 @@ void GeomAPI_ShapeHierarchy::objectsByType( return; } - for (ListOfShape::const_iterator anIt = myObjects.begin(); - anIt != myObjects.end(); ++anIt) { - GeomAPI_Shape::ShapeType aType = (*anIt)->shapeType(); + for (const auto &myObject : myObjects) { + GeomAPI_Shape::ShapeType aType = myObject->shapeType(); if (aType >= theMinType && aType <= theMaxType) - theShapesByType.push_back(*anIt); + theShapesByType.push_back(myObject); else - theOtherShapes.push_back(*anIt); + theOtherShapes.push_back(myObject); } } @@ -136,8 +133,7 @@ void GeomAPI_ShapeHierarchy::splitCompound(const GeomShapePtr &theCompShape, theUsed.clear(); theNotUsed.clear(); - MapShapeToIndex::const_iterator aFoundIndex = - myParentIndices.find(theCompShape); + auto aFoundIndex = myParentIndices.find(theCompShape); if (aFoundIndex == myParentIndices.end()) return; // no such shape @@ -156,7 +152,7 @@ bool GeomAPI_ShapeHierarchy::empty() const { return myObjects.empty(); } void GeomAPI_ShapeHierarchy::topLevelObjects( ListOfShape &theDestination) const { - GeomAPI_ShapeHierarchy *aThis = const_cast(this); + auto *aThis = const_cast(this); SetOfShape aProcessed = myProcessedObjects; aThis->myProcessedObjects.clear(); @@ -166,7 +162,7 @@ void GeomAPI_ShapeHierarchy::topLevelObjects( GeomShapePtr aRoot = aThis->root(aShape); if (aRoot) { // check the current shape was modified - MapShapeToShape::const_iterator aFound = myModifiedObjects.find(aRoot); + auto aFound = myModifiedObjects.find(aRoot); if (aFound != myModifiedObjects.end()) aShape = aFound->second; else { @@ -175,7 +171,7 @@ void GeomAPI_ShapeHierarchy::topLevelObjects( } } else { // check the current shape was modified - MapShapeToShape::const_iterator aFound = myModifiedObjects.find(aShape); + auto aFound = myModifiedObjects.find(aShape); if (aFound != myModifiedObjects.end()) aShape = aFound->second; } @@ -191,14 +187,12 @@ void GeomAPI_ShapeHierarchy::compoundsOfUnusedObjects( SetOfShape aUsedObjects = myProcessedObjects; aUsedObjects.insert(myObjects.begin(), myObjects.end()); - for (std::vector::const_iterator anIt = - mySubshapes.begin(); - anIt != mySubshapes.end(); ++anIt) { - MapShapeToShape::const_iterator aParent = myParent.find(anIt->first); + for (const auto &mySubshape : mySubshapes) { + auto aParent = myParent.find(mySubshape.first); if ((aParent == myParent.end() || !aParent->second) && - anIt->first->shapeType() == GeomAPI_Shape::COMPOUND) { + mySubshape.first->shapeType() == GeomAPI_Shape::COMPOUND) { // this is a top-level compound - GeomShapePtr aCompound = collectSubs(anIt->first, aUsedObjects); + GeomShapePtr aCompound = collectSubs(mySubshape.first, aUsedObjects); // add to destination non-empty compounds only if (aCompound) theDestination.push_back(aCompound); @@ -213,12 +207,10 @@ static void addSubShape( if (!theTarget.get() || !theSub.get()) return; - TopoDS_Shape *aShape = theTarget->implPtr(); + auto *aShape = theTarget->implPtr(); - std::map::const_iterator aFound = - theModified.find(theSub); - const TopoDS_Shape &aShapeToAdd = + auto aFound = theModified.find(theSub); + const auto &aShapeToAdd = (aFound == theModified.end() ? theSub : aFound->second) ->impl(); @@ -239,8 +231,7 @@ GeomAPI_ShapeHierarchy::collectSubs(GeomShapePtr theTopLevelCompound, if (theExcluded.find(aCurrent) != theExcluded.end()) continue; // already used - MapShapeToIndex::const_iterator aFoundIndex = - myParentIndices.find(aCurrent); + auto aFoundIndex = myParentIndices.find(aCurrent); if (aCurrent->shapeType() > GeomAPI_Shape::COMPOUND || aFoundIndex == myParentIndices.end()) { bool isAddShape = true; diff --git a/src/GeomAPI/GeomAPI_ShapeHierarchy.h b/src/GeomAPI/GeomAPI_ShapeHierarchy.h index 647514f53..814961b20 100644 --- a/src/GeomAPI/GeomAPI_ShapeHierarchy.h +++ b/src/GeomAPI/GeomAPI_ShapeHierarchy.h @@ -33,12 +33,12 @@ /// \brief Storage for the hierarchy of shapes and their parents (compounds or /// compsolids) class GeomAPI_ShapeHierarchy { - typedef std::pair ShapeAndSubshapes; - typedef std::map - MapShapeToShape; - typedef std::map - MapShapeToIndex; - typedef std::set SetOfShape; + using ShapeAndSubshapes = std::pair; + using MapShapeToShape = + std::map; + using MapShapeToIndex = + std::map; + using SetOfShape = std::set; ListOfShape myObjects; ///< list of objects of some operation MapShapeToShape @@ -123,7 +123,7 @@ public: class iterator : public std::iterator { public: - GEOMAPI_EXPORT iterator() {} + GEOMAPI_EXPORT iterator() = default; protected: iterator(GeomAPI_ShapeHierarchy *theHierarchy, bool isBegin = true); diff --git a/src/GeomAPI/GeomAPI_Shell.cpp b/src/GeomAPI/GeomAPI_Shell.cpp index d6c4a25bf..e4a07f425 100644 --- a/src/GeomAPI/GeomAPI_Shell.cpp +++ b/src/GeomAPI/GeomAPI_Shell.cpp @@ -42,7 +42,7 @@ //================================================================================================= GeomAPI_Shell::GeomAPI_Shell() { - TopoDS_Shell *aShell = new TopoDS_Shell(); + auto *aShell = new TopoDS_Shell(); BRep_Builder aBuilder; aBuilder.MakeShell(*aShell); @@ -302,7 +302,7 @@ std::shared_ptr GeomAPI_Shell::getParallelepiped() const { // find corner with the smallest coordinates std::list::const_iterator aPrev = --aCorners.end(); - std::list::const_iterator aCur = aPrev--; + auto aCur = aPrev--; std::list::const_iterator aNext = aCorners.begin(); GeomPointPtr anOrigin = *aCur; GeomPointPtr aFront = *aNext; @@ -354,14 +354,14 @@ std::shared_ptr GeomAPI_Shell::getParallelepiped() const { return GeomBoxPtr(); // calculate heights for planes computed by rectangles - for (std::map::iterator it = aParallelPlanes.begin(); - it != aParallelPlanes.end(); ++it) { - GeomDirPtr aNormal = aPlanes[it->first].myAxes->normal(); - GeomPointPtr anOrigin = aPlanes[it->first].myAxes->origin(); - GeomPointPtr aNeighbor = aPlanes[it->second].myAxes->origin(); - - aPlanes[it->first].myHeight = aPlanes[it->second].myHeight = - aNormal->xyz()->dot(aNeighbor->xyz()->decreased(anOrigin->xyz())); + for (auto &aParallelPlane : aParallelPlanes) { + GeomDirPtr aNormal = aPlanes[aParallelPlane.first].myAxes->normal(); + GeomPointPtr anOrigin = aPlanes[aParallelPlane.first].myAxes->origin(); + GeomPointPtr aNeighbor = aPlanes[aParallelPlane.second].myAxes->origin(); + + aPlanes[aParallelPlane.first].myHeight = + aPlanes[aParallelPlane.second].myHeight = + aNormal->xyz()->dot(aNeighbor->xyz()->decreased(anOrigin->xyz())); } // check if the box is oriented in the main axes @@ -385,7 +385,7 @@ std::shared_ptr GeomAPI_Shell::getParallelepiped() const { GeomPointPtr GeomAPI_Shell::middlePoint() const { GeomPointPtr anInnerPoint; - const TopoDS_Shell &aShell = impl(); + const auto &aShell = impl(); if (aShell.IsNull()) return anInnerPoint; diff --git a/src/GeomAPI/GeomAPI_Shell.h b/src/GeomAPI/GeomAPI_Shell.h index 3e74748fe..020d8c34c 100644 --- a/src/GeomAPI/GeomAPI_Shell.h +++ b/src/GeomAPI/GeomAPI_Shell.h @@ -60,9 +60,9 @@ public: GEOMAPI_EXPORT std::shared_ptr getParallelepiped() const; /// Return middle point on the shell - GEOMAPI_EXPORT virtual std::shared_ptr middlePoint() const; + GEOMAPI_EXPORT std::shared_ptr middlePoint() const override; }; -typedef std::shared_ptr GeomShellPtr; +using GeomShellPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Solid.cpp b/src/GeomAPI/GeomAPI_Solid.cpp index 6762e9dc9..eb2582317 100644 --- a/src/GeomAPI/GeomAPI_Solid.cpp +++ b/src/GeomAPI/GeomAPI_Solid.cpp @@ -301,7 +301,7 @@ std::shared_ptr GeomAPI_Solid::getParallelepiped() const { GeomPointPtr GeomAPI_Solid::middlePoint() const { GeomPointPtr anInnerPoint; - const TopoDS_Solid &aSolid = impl(); + const auto &aSolid = impl(); if (aSolid.IsNull()) return anInnerPoint; diff --git a/src/GeomAPI/GeomAPI_Solid.h b/src/GeomAPI/GeomAPI_Solid.h index e65b9a499..48a07b930 100644 --- a/src/GeomAPI/GeomAPI_Solid.h +++ b/src/GeomAPI/GeomAPI_Solid.h @@ -60,9 +60,9 @@ public: GEOMAPI_EXPORT std::shared_ptr getParallelepiped() const; /// Return inner point in the solid - GEOMAPI_EXPORT virtual std::shared_ptr middlePoint() const; + GEOMAPI_EXPORT std::shared_ptr middlePoint() const override; }; -typedef std::shared_ptr GeomSolidPtr; +using GeomSolidPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Sphere.h b/src/GeomAPI/GeomAPI_Sphere.h index 91d18b3c1..2c8bef19c 100644 --- a/src/GeomAPI/GeomAPI_Sphere.h +++ b/src/GeomAPI/GeomAPI_Sphere.h @@ -44,6 +44,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomSpherePtr; +using GeomSpherePtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Torus.h b/src/GeomAPI/GeomAPI_Torus.h index d3de2dd90..3e0eb48e7 100644 --- a/src/GeomAPI/GeomAPI_Torus.h +++ b/src/GeomAPI/GeomAPI_Torus.h @@ -54,6 +54,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomTorusPtr; +using GeomTorusPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Trsf.h b/src/GeomAPI/GeomAPI_Trsf.h index 0de3d7b6e..03ed17d9e 100644 --- a/src/GeomAPI/GeomAPI_Trsf.h +++ b/src/GeomAPI/GeomAPI_Trsf.h @@ -104,6 +104,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomTrsfPtr; +using GeomTrsfPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Vertex.cpp b/src/GeomAPI/GeomAPI_Vertex.cpp index 9417314ab..85af2abf4 100644 --- a/src/GeomAPI/GeomAPI_Vertex.cpp +++ b/src/GeomAPI/GeomAPI_Vertex.cpp @@ -54,8 +54,7 @@ GeomAPI_Vertex::GeomAPI_Vertex(double theX, double theY, double theZ) { } std::shared_ptr GeomAPI_Vertex::point() { - const TopoDS_Shape &aShape = - const_cast(this)->impl(); + const auto &aShape = const_cast(this)->impl(); TopoDS_Vertex aVertex = TopoDS::Vertex(aShape); gp_Pnt aPoint = BRep_Tool::Pnt(aVertex); return std::shared_ptr( @@ -66,9 +65,9 @@ bool GeomAPI_Vertex::isEqual( const std::shared_ptr theVert) const { if (!theVert.get() || !theVert->isVertex()) return false; - const TopoDS_Shape &aMyShape = + const auto &aMyShape = const_cast(this)->impl(); - const TopoDS_Shape &aInShape = theVert->impl(); + const auto &aInShape = theVert->impl(); if (aMyShape.ShapeType() != aInShape.ShapeType()) return false; @@ -84,8 +83,8 @@ bool GeomAPI_Vertex::isEqual( bool GeomAPI_Vertex::GeometricComparator::operator()( const GeomVertexPtr &theVertex1, const GeomVertexPtr &theVertex2) const { - const TopoDS_Vertex &aVertex1 = theVertex1->impl(); - const TopoDS_Vertex &aVertex2 = theVertex2->impl(); + const auto &aVertex1 = theVertex1->impl(); + const auto &aVertex2 = theVertex2->impl(); gp_Pnt aPnt1 = BRep_Tool::Pnt(aVertex1); gp_Pnt aPnt2 = BRep_Tool::Pnt(aVertex2); diff --git a/src/GeomAPI/GeomAPI_Wire.cpp b/src/GeomAPI/GeomAPI_Wire.cpp index d130c6266..5a05607aa 100644 --- a/src/GeomAPI/GeomAPI_Wire.cpp +++ b/src/GeomAPI/GeomAPI_Wire.cpp @@ -32,7 +32,7 @@ //================================================================================================== GeomAPI_Wire::GeomAPI_Wire() { - TopoDS_Wire *aWire = new TopoDS_Wire(); + auto *aWire = new TopoDS_Wire(); BRep_Builder aBuilder; aBuilder.MakeWire(*aWire); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp index 9b8c02553..ade7cd350 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.cpp @@ -67,20 +67,18 @@ void GeomAlgoAPI_Boolean::build( // Getting objects. TopTools_ListOfShape anObjects; - for (ListOfShape::const_iterator anObjectsIt = theObjects.begin(); - anObjectsIt != theObjects.end(); anObjectsIt++) { - anObjects.Append((*anObjectsIt)->impl()); + for (const auto &theObject : theObjects) { + anObjects.Append(theObject->impl()); } // Getting tools. TopTools_ListOfShape aTools; - for (ListOfShape::const_iterator aToolsIt = theTools.begin(); - aToolsIt != theTools.end(); aToolsIt++) { - aTools.Append((*aToolsIt)->impl()); + for (const auto &theTool : theTools) { + aTools.Append(theTool->impl()); } // Creating boolean operation. - BOPAlgo_BOP *aBuilder = new BOPAlgo_BOP(); + auto *aBuilder = new BOPAlgo_BOP(); switch (theOperationType) { case GeomAlgoAPI_Tools::BOOL_CUT: { aBuilder->SetOperation(BOPAlgo_CUT); @@ -155,7 +153,7 @@ static void searchResult(const TopoDS_Shape &theOld, return; } // searching for new result by sub-shapes of aSubType type - TopAbs_ShapeEnum aSubType = TopAbs_ShapeEnum(int(theOld.ShapeType()) + 1); + auto aSubType = TopAbs_ShapeEnum(int(theOld.ShapeType()) + 1); while (aSubType < TopAbs_VERTEX && !isHistoryType(aSubType)) aSubType = TopAbs_ShapeEnum(int(aSubType) + 1); if (aSubType == TopAbs_SHAPE) @@ -203,7 +201,7 @@ bool isInComp(const TopoDS_Shape &theComp, const TopoDS_Shape &theShape) { /// make arguments of Fuse produce result shapes with "modified" evolution void GeomAlgoAPI_Boolean::modified(const GeomShapePtr theOldShape, ListOfShape &theNewShapes) { - BOPAlgo_BOP *aBuilder = this->implPtr(); + auto *aBuilder = this->implPtr(); if (aBuilder->Operation() == BOPAlgo_FUSE) { // only for fuse and when old is and argument TopoDS_Shape anOld = theOldShape->impl(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h index e5181efa9..73c210a17 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Boolean.h @@ -73,8 +73,8 @@ public: const double theFuzzy = -1); /// Redefinition of the generic method for the Fuse problem: OCCT 30481 - GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape, - ListOfShape &theNewShapes); + GEOMALGOAPI_EXPORT void modified(const GeomShapePtr theOldShape, + ListOfShape &theNewShapes) override; private: /// Builds resulting shape. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Box.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Box.cpp index a6d32e796..afeda68cb 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Box.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Box.cpp @@ -24,7 +24,7 @@ #include //================================================================================================= -GeomAlgoAPI_Box::GeomAlgoAPI_Box() {} +GeomAlgoAPI_Box::GeomAlgoAPI_Box() = default; //================================================================================================= GeomAlgoAPI_Box::GeomAlgoAPI_Box(const double theDx, const double theDy, @@ -123,7 +123,7 @@ void GeomAlgoAPI_Box::buildWithDimensions() { myCreatedFaces.clear(); // Construct the box - BRepPrimAPI_MakeBox *aBoxMaker = new BRepPrimAPI_MakeBox(myDx, myDy, myDz); + auto *aBoxMaker = new BRepPrimAPI_MakeBox(myDx, myDy, myDz); aBoxMaker->Build(); // Test the algorithm @@ -152,12 +152,11 @@ void GeomAlgoAPI_Box::buildWithDimensions() { void GeomAlgoAPI_Box::buildWithPoints() { myCreatedFaces.clear(); - const gp_Pnt &aFirstPoint = myFirstPoint->impl(); - const gp_Pnt &aSecondPoint = mySecondPoint->impl(); + const auto &aFirstPoint = myFirstPoint->impl(); + const auto &aSecondPoint = mySecondPoint->impl(); // Construct the box - BRepPrimAPI_MakeBox *aBoxMaker = - new BRepPrimAPI_MakeBox(aFirstPoint, aSecondPoint); + auto *aBoxMaker = new BRepPrimAPI_MakeBox(aFirstPoint, aSecondPoint); aBoxMaker->Build(); // Test the algorithm diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Box.h b/src/GeomAlgoAPI/GeomAlgoAPI_Box.h index af376df82..9ee3ceb50 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Box.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Box.h @@ -63,13 +63,13 @@ public: const double theDy, const double theDz); /// Checks if data for the box construction is OK. - GEOMALGOAPI_EXPORT bool check(); + GEOMALGOAPI_EXPORT bool check() override; /// Builds the box. - GEOMALGOAPI_EXPORT void build(); + GEOMALGOAPI_EXPORT void build() override; /// Prepare the naming (redifined because it is specific for a box). - GEOMALGOAPI_EXPORT void prepareNamingFaces(); + GEOMALGOAPI_EXPORT void prepareNamingFaces() override; private: /// Builds the box with the dimensions "Dx", "Dy" and "Dz". diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CanonicalRecognition.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_CanonicalRecognition.cpp index e0278b03e..a2bb9f0ce 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_CanonicalRecognition.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_CanonicalRecognition.cpp @@ -64,7 +64,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isPlane(const GeomShapePtr &theShape, if (!theShape.get()) return false; - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); if (aShape.IsNull()) return false; @@ -112,7 +112,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isSphere(const GeomShapePtr &theShape, if (!theShape.get()) return false; - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); if (aShape.IsNull()) return false; @@ -156,7 +156,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isCone(const GeomShapePtr &theShape, if (!theShape.get()) return false; - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); if (aShape.IsNull()) return false; @@ -209,7 +209,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isCylinder( if (!theShape.get()) return false; - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); if (aShape.IsNull()) return false; @@ -263,7 +263,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isLine(const GeomShapePtr &theEdge, if (!theEdge.get()) return false; - const TopoDS_Shape &aShape = theEdge->impl(); + const auto &aShape = theEdge->impl(); if (aShape.IsNull()) return false; @@ -312,7 +312,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isCircle(const GeomShapePtr &theEdge, if (!theEdge.get()) return false; - const TopoDS_Shape &aShape = theEdge->impl(); + const auto &aShape = theEdge->impl(); if (aShape.IsNull()) return false; @@ -367,7 +367,7 @@ bool GeomAlgoAPI_CanonicalRecognition::isEllipse(const GeomShapePtr &theEdge, if (!theEdge.get()) return false; - const TopoDS_Shape &aShape = theEdge->impl(); + const auto &aShape = theEdge->impl(); if (aShape.IsNull()) return false; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.cpp index 5a4aad84d..48e67a6a3 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.cpp @@ -48,18 +48,17 @@ void GeomAlgoAPI_Chamfer::build( TopExp::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M); // create chamfer builder - BRepFilletAPI_MakeChamfer *aChamferBuilder = - new BRepFilletAPI_MakeChamfer(aShapeBase); + auto *aChamferBuilder = new BRepFilletAPI_MakeChamfer(aShapeBase); setImpl(aChamferBuilder); setBuilderType(OCCT_BRepBuilderAPI_MakeShape); - for (ListOfShape::const_iterator anIt = theChamferShapes.begin(); - anIt != theChamferShapes.end(); ++anIt) { - if ((*anIt)->isEdge()) { - TopoDS_Edge E = (*anIt)->impl(); - if (theMapEdgeFace.find(*anIt) != theMapEdgeFace.end()) { + for (const auto &theChamferShape : theChamferShapes) { + if (theChamferShape->isEdge()) { + TopoDS_Edge E = theChamferShape->impl(); + if (theMapEdgeFace.find(theChamferShape) != theMapEdgeFace.end()) { // TopoDS_Face F = (theMapEdgeFace[*anIt])->impl(); - TopoDS_Face F = (theMapEdgeFace.at(*anIt))->impl(); + TopoDS_Face F = + (theMapEdgeFace.at(theChamferShape))->impl(); if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E) && M.FindFromKey(E).Extent() == 2) { if (performDistances) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.cpp index d28ed3eca..252deca2b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Circ2dBuilder.cpp @@ -42,9 +42,9 @@ #include typedef std::shared_ptr Circ2dPtr; -typedef std::shared_ptr CurveAdaptorPtr; -typedef std::vector> VectorOfGccCirc; -typedef std::vector> VectorOfGccLine; +using CurveAdaptorPtr = std::shared_ptr; +using VectorOfGccCirc = std::vector>; +using VectorOfGccLine = std::vector>; // Provide different mechanisms to create circle: // * by passing points @@ -149,12 +149,12 @@ public: private: Circ2dPtr circleByCenterAndRadius() { - const gp_Pnt2d &aCenter = myCenter->impl(); + const auto &aCenter = myCenter->impl(); return Circ2dPtr(new gp_Circ2d(gp_Ax2d(aCenter, gp::DX2d()), myRadius)); } Circ2dPtr circleByCenterAndPassingPoint() { - const gp_Pnt2d &aCenter = myCenter->impl(); + const auto &aCenter = myCenter->impl(); if (aCenter.SquareDistance(myPassingPoints[0]) > Precision::SquareConfusion()) { GccAna_Circ2dTanCen aBuilder(myPassingPoints[0], aCenter); @@ -165,7 +165,7 @@ private: } Circ2dPtr circleByCenterAndTangent() { - const gp_Pnt2d &aCenter = myCenter->impl(); + const auto &aCenter = myCenter->impl(); CurveAdaptorPtr aCurve = myTangentShapes[0]; std::shared_ptr aCircleBuilder; @@ -451,7 +451,7 @@ private: theTangentCircles.reserve(3); theTangentLines.reserve(3); - std::vector::iterator anIt = myTangentShapes.begin(); + auto anIt = myTangentShapes.begin(); for (; anIt != myTangentShapes.end(); ++anIt) { switch ((*anIt)->GetType()) { case GeomAbs_Line: diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp index 062286e21..fe2a58728 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp @@ -63,7 +63,7 @@ int GeomAlgoAPI_CompoundBuilder::id(std::shared_ptr theContext, std::shared_ptr theSub) { int anID = 0; TopoDS_Shape aMainShape = theContext->impl(); - const TopoDS_Shape &aSubShape = theSub->impl(); + const auto &aSubShape = theSub->impl(); if (!aMainShape.IsNull() && !aSubShape.IsNull()) { TopTools_IndexedMapOfShape aSubShapesMap; TopExp::MapShapes(aMainShape, aSubShapesMap); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Cone.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Cone.cpp index 6fc15bb91..5fbefc05d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Cone.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Cone.cpp @@ -69,10 +69,10 @@ bool GeomAlgoAPI_Cone::check() { void GeomAlgoAPI_Cone::build() { myCreatedFaces.clear(); - const gp_Ax2 &anAxis = myAxis->impl(); + const auto &anAxis = myAxis->impl(); // Construct the torus - BRepPrimAPI_MakeCone *aConeMaker = + auto *aConeMaker = new BRepPrimAPI_MakeCone(anAxis, myBaseRadius, myTopRadius, myHeight); aConeMaker->Build(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Cone.h b/src/GeomAlgoAPI/GeomAlgoAPI_Cone.h index 52edf1171..aa4c9f270 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Cone.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Cone.h @@ -46,10 +46,10 @@ public: const double theHeight); /// Checks if data for the cone construction is OK. - GEOMALGOAPI_EXPORT bool check(); + GEOMALGOAPI_EXPORT bool check() override; /// Builds the cone. - GEOMALGOAPI_EXPORT void build(); + GEOMALGOAPI_EXPORT void build() override; private: std::shared_ptr myAxis; /// Axis of the cone. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.cpp index c5d0d5085..b65a7d499 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.cpp @@ -130,7 +130,7 @@ void GeomAlgoAPI_ConeSegment::build() { gp_Dir aZDir(0., 0., 1.); gp_Pnt anOrigin(0., 0., 0.); gp_Ax1 aZAxis(anOrigin, aZDir); - BRepPrimAPI_MakeRevol *aRevolBuilder = new BRepPrimAPI_MakeRevol( + auto *aRevolBuilder = new BRepPrimAPI_MakeRevol( aFaceBuilder.Face(), aZAxis, myDeltaPhi * M_PI / 180., Standard_True); if (!aRevolBuilder) { myError = "Cone Segment builder :: section revolution did not succeed"; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.h b/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.h index d2b7132c3..2b4172a23 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ConeSegment.h @@ -44,10 +44,10 @@ public: const double theDeltaPhi); /// Checks if the set of parameters used to define the cone segment are OK. - GEOMALGOAPI_EXPORT bool check(); + GEOMALGOAPI_EXPORT bool check() override; /// Builds the cone segment based on the parameters given in the constructor. - GEOMALGOAPI_EXPORT void build(); + GEOMALGOAPI_EXPORT void build() override; private: double myRMin1; /// Cone base inner radius. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Copy.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Copy.cpp index bd51c4d37..387d1ce81 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Copy.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Copy.cpp @@ -37,10 +37,10 @@ void GeomAlgoAPI_Copy::build(const std::shared_ptr theShape, } // Getting shape. - const TopoDS_Shape &aBaseShape = theShape->impl(); + const auto &aBaseShape = theShape->impl(); // Creating copy. - BRepBuilderAPI_Copy *aBuilder = + auto *aBuilder = new BRepBuilderAPI_Copy(aBaseShape, theCopyGeom, theCopyMesh); this->setImpl(aBuilder); this->setBuilderType(OCCT_BRepBuilderAPI_MakeShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp index c902020bc..1bd618566 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp @@ -111,9 +111,9 @@ GeomAlgoAPI_CurveBuilder::approximate(const std::list &thePoints, gp_Pnt aPlaneBase[3]; // base points to calculate the normal direction int aNbPlanePoints = 0; gp_Dir aNormal; - std::list::const_iterator anIt = thePoints.begin(); + auto anIt = thePoints.begin(); for (int i = 1; anIt != thePoints.end(); anIt++, i++) { - const gp_Pnt &aPoint = (*anIt)->impl(); + const auto &aPoint = (*anIt)->impl(); aPoints.SetValue(i, 1, aPoint); aPoints.SetValue(i, 2, aPoint); if (aNbPlanePoints < 3) { @@ -175,18 +175,18 @@ void GeomAlgoAPI_CurveBuilder::reorderPoints( return; } - std::list::iterator aPIt = thePoints.begin(); + auto aPIt = thePoints.begin(); GeomPointPtr aPrevPnt = *aPIt; for (; aPIt != thePoints.end(); ++aPIt) { GeomPointPtr aPnt = *aPIt; - std::list::iterator aNextIt = aPIt; - std::list::iterator aNearestIt = ++aNextIt; + auto aNextIt = aPIt; + auto aNearestIt = ++aNextIt; double aMinDist = RealLast(); while (aNextIt != thePoints.end()) { double aDist = aPnt->distance(*aNextIt); if (aDist < Precision::Confusion()) { // remove duplicates - std::list::iterator aRemoveIt = aNextIt++; + auto aRemoveIt = aNextIt++; thePoints.erase(aRemoveIt); // update iterator showing the nearest point, because it may become // invalid diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.cpp index 0c023a10d..044d88333 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.cpp @@ -80,7 +80,7 @@ bool GeomAlgoAPI_Cylinder::check() { void GeomAlgoAPI_Cylinder::build() { myCreatedFaces.clear(); - const gp_Ax2 &anAxis = myAxis->impl(); + const auto &anAxis = myAxis->impl(); // Construct the cylinder BRepPrimAPI_MakeCylinder *aCylinderMaker; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.h b/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.h index ad9d00957..f9f43b5e6 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Cylinder.h @@ -51,10 +51,10 @@ public: const double theAngle); /// Checks if data for the cylinder construction is OK. - GEOMALGOAPI_EXPORT bool check(); + GEOMALGOAPI_EXPORT bool check() override; /// Builds the cylinder. - GEOMALGOAPI_EXPORT void build(); + GEOMALGOAPI_EXPORT void build() override; private: bool withAngle; /// Boolean indicating if the type of cylinder (full or diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp index b0eb19d30..b147c87fc 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp @@ -59,8 +59,8 @@ static GeomEdgePtr createLine(const gp_Pnt &theStart, const gp_Pnt &theEnd) { std::shared_ptr GeomAlgoAPI_EdgeBuilder::line(std::shared_ptr theStart, std::shared_ptr theEnd) { - const gp_Pnt &aStart = theStart->impl(); - const gp_Pnt &anEnd = theEnd->impl(); + const auto &aStart = theStart->impl(); + const auto &anEnd = theEnd->impl(); return createLine(aStart, anEnd); } std::shared_ptr @@ -74,7 +74,7 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::line(const std::shared_ptr theLin) { GeomEdgePtr aRes; if (theLin.get()) { - const gp_Lin &aLin = theLin->impl(); + const auto &aLin = theLin->impl(); BRepBuilderAPI_MakeEdge anEdgeBuilder(aLin); TopoDS_Edge anEdge = anEdgeBuilder.Edge(); aRes = GeomEdgePtr(new GeomAPI_Edge); @@ -86,7 +86,7 @@ GeomAlgoAPI_EdgeBuilder::line(const std::shared_ptr theLin) { std::shared_ptr GeomAlgoAPI_EdgeBuilder::cylinderAxis( std::shared_ptr theCylindricalFace) { std::shared_ptr aResult; - const TopoDS_Shape &aShape = theCylindricalFace->impl(); + const auto &aShape = theCylindricalFace->impl(); if (aShape.IsNull()) return aResult; TopoDS_Face aFace = TopoDS::Face(aShape); @@ -164,8 +164,8 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircle(std::shared_ptr theCenter, std::shared_ptr theNormal, double theRadius) { - const gp_Pnt &aCenter = theCenter->impl(); - const gp_Dir &aDir = theNormal->impl(); + const auto &aCenter = theCenter->impl(); + const auto &aDir = theNormal->impl(); gp_Circ aCircle(gp_Ax2(aCenter, aDir), theRadius); @@ -180,7 +180,7 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircle(std::shared_ptr theCircle) { GeomEdgePtr aRes; if (theCircle.get()) { - const gp_Circ &aCirc = theCircle->impl(); + const auto &aCirc = theCircle->impl(); BRepBuilderAPI_MakeEdge anEdgeBuilder(aCirc); TopoDS_Edge anEdge = anEdgeBuilder.Edge(); aRes = GeomEdgePtr(new GeomAPI_Edge); @@ -196,8 +196,8 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircleArc( std::shared_ptr theNormal) { std::shared_ptr aRes; - const gp_Pnt &aCenter = theCenter->impl(); - const gp_Dir &aDir = theNormal->impl(); + const auto &aCenter = theCenter->impl(); + const auto &aDir = theNormal->impl(); /// OCCT creates an edge on a circle with empty radius, but visualization /// is not able to process it @@ -207,8 +207,8 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircleArc( double aRadius = theCenter->distance(theStartPoint); gp_Circ aCircle(gp_Ax2(aCenter, aDir), aRadius); - const gp_Pnt &aStart = theStartPoint->impl(); - const gp_Pnt &anEndInter = theEndPoint->impl(); + const auto &aStart = theStartPoint->impl(); + const auto &anEndInter = theEndPoint->impl(); // project end point to a circle gp_XYZ aEndDir = anEndInter.XYZ() - aCenter.XYZ(); @@ -231,9 +231,9 @@ std::shared_ptr GeomAlgoAPI_EdgeBuilder::ellipse( const std::shared_ptr &theNormal, const std::shared_ptr &theMajorAxis, const double theMajorRadius, const double theMinorRadius) { - const gp_Pnt &aCenter = theCenter->impl(); - const gp_Dir &aNormal = theNormal->impl(); - const gp_Dir &aMajorAxis = theMajorAxis->impl(); + const auto &aCenter = theCenter->impl(); + const auto &aNormal = theNormal->impl(); + const auto &aMajorAxis = theMajorAxis->impl(); gp_Elips anEllipse(gp_Ax2(aCenter, aNormal, aMajorAxis), theMajorRadius, theMinorRadius); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.cpp index eff6891bb..f951ccdc8 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.cpp @@ -199,8 +199,7 @@ void GeomAlgoAPI_Ellipsoid::build() { aBuilder.Add(aShell, aSewer.SewedShape()); } - BRepBuilderAPI_MakeSolid *anEllipsoidMk = - new BRepBuilderAPI_MakeSolid(aShell); + auto *anEllipsoidMk = new BRepBuilderAPI_MakeSolid(aShell); anEllipsoidMk->Build(); // Store and publish the results diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.h b/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.h index e72762d58..1ada10342 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.h @@ -42,10 +42,10 @@ public: const double theZCut2); /// Checks if the set of parameters used to define the ellipsoid are OK. - GEOMALGOAPI_EXPORT bool check(); + GEOMALGOAPI_EXPORT bool check() override; /// Builds the ellipsoid based on the parameters given in the constructor. - GEOMALGOAPI_EXPORT void build(); + GEOMALGOAPI_EXPORT void build() override; private: double myAx; /// X dimension of the ellipsoid. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Exception.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Exception.cpp index d07877fca..f6577bc6c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Exception.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Exception.cpp @@ -25,7 +25,7 @@ GeomAlgoAPI_Exception::GeomAlgoAPI_Exception(std::string theMessageError) : myMessageError(theMessageError) {} //================================================================================================= -GeomAlgoAPI_Exception::~GeomAlgoAPI_Exception() noexcept {} +GeomAlgoAPI_Exception::~GeomAlgoAPI_Exception() noexcept = default; //================================================================================================= const char *GeomAlgoAPI_Exception::what() const noexcept { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Exception.h b/src/GeomAlgoAPI/GeomAlgoAPI_Exception.h index 6e88d5cb1..929965f0c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Exception.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Exception.h @@ -35,9 +35,9 @@ public: /// \param theMessageError Error message to be displayed GEOMALGOAPI_EXPORT GeomAlgoAPI_Exception(std::string theMessageError); /// Destroyer - GEOMALGOAPI_EXPORT ~GeomAlgoAPI_Exception() noexcept; + GEOMALGOAPI_EXPORT ~GeomAlgoAPI_Exception() noexcept override; /// Allows to collet the error - GEOMALGOAPI_EXPORT const char *what() const noexcept; + GEOMALGOAPI_EXPORT const char *what() const noexcept override; private: std::string myMessageError; /// Error message to be displayed. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp index 9b240c8a9..0623a1de5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp @@ -39,8 +39,8 @@ std::shared_ptr GeomAlgoAPI_FaceBuilder::squareFace( const std::shared_ptr theCenter, const std::shared_ptr theNormal, const double theSize) { - const gp_Pnt &aCenter = theCenter->impl(); - const gp_Dir &aDir = theNormal->impl(); + const auto &aCenter = theCenter->impl(); + const auto &aDir = theNormal->impl(); gp_Pln aPlane(aCenter, aDir); // half of the size in each direction from the center BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, -theSize / 2., theSize / 2., @@ -68,8 +68,8 @@ GeomAlgoAPI_FaceBuilder::squareFace(const std::shared_ptr thePlane, std::shared_ptr GeomAlgoAPI_FaceBuilder::planarFace( const std::shared_ptr theCenter, const std::shared_ptr theNormal) { - const gp_Pnt &aCenter = theCenter->impl(); - const gp_Dir &aDir = theNormal->impl(); + const auto &aCenter = theCenter->impl(); + const auto &aDir = theNormal->impl(); gp_Pln aPlane(aCenter, aDir); BRepBuilderAPI_MakeFace aFaceBuilder(aPlane); std::shared_ptr aRes(new GeomAPI_Face()); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet.cpp index 439c04fb8..3c0b13787 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet.cpp @@ -49,16 +49,15 @@ void GeomAlgoAPI_Fillet::build(const GeomShapePtr &theBaseSolid, return; // create fillet builder - BRepFilletAPI_MakeFillet *aFilletBuilder = + auto *aFilletBuilder = new BRepFilletAPI_MakeFillet(theBaseSolid->impl()); setImpl(aFilletBuilder); setBuilderType(OCCT_BRepBuilderAPI_MakeShape); // assign filleting edges - for (ListOfShape::const_iterator anIt = theFilletEdges.begin(); - anIt != theFilletEdges.end(); ++anIt) { - if ((*anIt)->isEdge()) - aFilletBuilder->Add((*anIt)->impl()); + for (const auto &theFilletEdge : theFilletEdges) { + if (theFilletEdge->isEdge()) + aFilletBuilder->Add(theFilletEdge->impl()); } // assign fillet radii for each contour of filleting edges diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp index 3f09506f3..9e5732feb 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp @@ -49,14 +49,12 @@ static GeomShapePtr convert(const TopoDS_Shape &theShape) { static void substituteNewEdge( GeomEdgePtr theEdge, std::map &theMap) { - std::map::iterator - anIt = theMap.begin(); + auto anIt = theMap.begin(); for (; anIt != theMap.end(); ++anIt) { - for (ListOfShape::iterator aEIt = anIt->second.begin(); - aEIt != anIt->second.end(); ++aEIt) - if (theEdge->isEqual(*aEIt)) { + for (auto &aEIt : anIt->second) + if (theEdge->isEqual(aEIt)) { // substitute edge and stop iteration - *aEIt = theEdge; + aEIt = theEdge; return; } } @@ -97,7 +95,7 @@ void GeomAlgoAPI_Fillet1D::build(const GeomShapePtr &theBaseShape, GeomShapePtr aShape_i = buildWire(aSubShape, aFilletVertices, theRadius); - if (aShape_i.get() != NULL) + if (aShape_i.get() != nullptr) aShapes.push_back(aShape_i); else aShapes.push_back(aSubShape); @@ -140,19 +138,17 @@ GeomAlgoAPI_Fillet1D::buildWire(const GeomShapePtr &theBaseWire, GeomAlgoAPI_MapShapesAndAncestors aMapVE(theBaseWire, GeomAPI_Shape::VERTEX, GeomAPI_Shape::EDGE); - for (ListOfShape::const_iterator aVIt = theFilletVertices.begin(); - aVIt != theFilletVertices.end(); ++aVIt) { + for (const auto &theFilletVertice : theFilletVertices) { // get edges to perform fillet - MapShapeToShapes::const_iterator aVE = aMapVE.map().find(*aVIt); + auto aVE = aMapVE.map().find(theFilletVertice); if (aVE == aMapVE.map().end()) continue; ListOfShape anEdges; - for (SetOfShapes::const_iterator aEIt = aVE->second.begin(); - aEIt != aVE->second.end(); ++aEIt) { + for (const auto &aEIt : aVE->second) { ListOfShape aNewEdges; - modified(*aEIt, aNewEdges); + modified(aEIt, aNewEdges); if (aNewEdges.empty()) - anEdges.push_back(*aEIt); + anEdges.push_back(aEIt); else anEdges.insert(anEdges.end(), aNewEdges.begin(), aNewEdges.end()); } @@ -178,13 +174,13 @@ GeomAlgoAPI_Fillet1D::buildWire(const GeomShapePtr &theBaseWire, if (!isOk) { // something gone wrong and the fillet edge is not constructed, // just store the failed vertex and continue - myFailedVertices.push_back(*aVIt); + myFailedVertices.push_back(theFilletVertice); continue; } // store modified shapes myGenerated[aVE->first].push_back(convert(aFilletEdge)); - SetOfShapes::const_iterator aEIt = aVE->second.begin(); + auto aEIt = aVE->second.begin(); myModified[*aEIt].clear(); myModified[*aEIt].push_back(convert(anEdge1)); myModified[*(++aEIt)].clear(); @@ -203,15 +199,13 @@ GeomAlgoAPI_Fillet1D::buildWire(const GeomShapePtr &theBaseWire, modified(aWExp.current(), aNewEdges); if (aNewEdges.empty()) aNewEdges.push_back(aWExp.current()); - for (ListOfShape::iterator anIt = aNewEdges.begin(); - anIt != aNewEdges.end(); ++anIt) - aBuilder.Add(aNewWire, TopoDS::Edge((*anIt)->impl())); + for (auto &aNewEdge : aNewEdges) + aBuilder.Add(aNewWire, TopoDS::Edge(aNewEdge->impl())); ListOfShape aNewEdges1; generated(aWExp.currentVertex(), aNewEdges1); - for (ListOfShape::iterator anIt = aNewEdges1.begin(); - anIt != aNewEdges1.end(); ++anIt) - aBuilder.Add(aNewWire, TopoDS::Edge((*anIt)->impl())); + for (auto &anIt : aNewEdges1) + aBuilder.Add(aNewWire, TopoDS::Edge(anIt->impl())); } // fix the wire connectivity ShapeFix_Wire aFixWire; @@ -266,14 +260,14 @@ GeomAlgoAPI_Fillet1D::buildWire(const GeomShapePtr &theBaseWire, void GeomAlgoAPI_Fillet1D::generated(const GeomShapePtr theOldShape, ListOfShape &theNewShapes) { - MapModified::iterator aFound = myGenerated.find(theOldShape); + auto aFound = myGenerated.find(theOldShape); if (aFound != myGenerated.end()) theNewShapes = aFound->second; } void GeomAlgoAPI_Fillet1D::modified(const GeomShapePtr theOldShape, ListOfShape &theNewShapes) { - MapModified::iterator aFound = myModified.find(theOldShape); + auto aFound = myModified.find(theOldShape); if (aFound != myModified.end()) theNewShapes = aFound->second; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.cpp index 21c82781f..0bdab0db6 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_GlueFaces.cpp @@ -51,9 +51,9 @@ void GeomAlgoAPI_GlueFaces::build(const ListOfShape &theShapes, TopoDS_Compound aCompound; BRep_Builder aBuilder; aBuilder.MakeCompound(aCompound); - ListOfShape::const_iterator anIt = theShapes.cbegin(); + auto anIt = theShapes.cbegin(); for (; anIt != theShapes.cend(); ++anIt) { - const TopoDS_Shape &aShape = (*anIt)->impl(); + const auto &aShape = (*anIt)->impl(); if (aShape.IsNull()) break; aBuilder.Add(aCompound, aShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp index 9e68bb973..996ff1f36 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.cpp @@ -28,7 +28,7 @@ //================================================================================================== GeomAlgoAPI_Intersection::GeomAlgoAPI_Intersection( const ListOfShape &theObjects, const double theFuzzy) - : myFiller(0) { + : myFiller(nullptr) { build(theObjects, theFuzzy); } @@ -46,21 +46,20 @@ void GeomAlgoAPI_Intersection::build(const ListOfShape &theObjects, } // Creating partition operation. - BOPAlgo_Section *anOperation = new BOPAlgo_Section; + auto *anOperation = new BOPAlgo_Section; this->setImpl(anOperation); this->setBuilderType(OCCT_BOPAlgo_Builder); // Getting objects. TopTools_ListOfShape anObjects; - for (ListOfShape::const_iterator anObjectsIt = theObjects.begin(); - anObjectsIt != theObjects.end(); anObjectsIt++) { - const TopoDS_Shape &aShape = (*anObjectsIt)->impl(); + for (const auto &theObject : theObjects) { + const auto &aShape = theObject->impl(); if (!aShape.IsNull()) { anObjects.Append(aShape); } } - BOPAlgo_PaveFiller *aDSFiller = new BOPAlgo_PaveFiller; + auto *aDSFiller = new BOPAlgo_PaveFiller; myFiller = aDSFiller; aDSFiller->SetArguments(anObjects); @@ -88,7 +87,7 @@ void GeomAlgoAPI_Intersection::build(const ListOfShape &theObjects, anOperation->PerformWithFiller( *aDSFiller); // it references a filler fields, so keep the filler - myFiller = 0; + myFiller = nullptr; if (anOperation->HasErrors()) { return; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.h b/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.h index f33acee09..9b023eaa8 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Intersection.h @@ -42,7 +42,7 @@ public: const double theFuzzy = 1.e-8); /// Destructor to erase the filler - GEOMALGOAPI_EXPORT virtual ~GeomAlgoAPI_Intersection(); + GEOMALGOAPI_EXPORT ~GeomAlgoAPI_Intersection() override; private: /// Builds resulting shape. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.cpp index 87019dd3f..eec10a63c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_LimitTolerance.cpp @@ -41,7 +41,7 @@ void GeomAlgoAPI_LimitTolerance::build(const GeomShapePtr theShape, return; } - const TopoDS_Shape &aOriginalShape = theShape->impl(); + const auto &aOriginalShape = theShape->impl(); Standard_Real aTol = theTolerance; TopAbs_ShapeEnum aType = TopAbs_SHAPE; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Loft.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Loft.cpp index c4bbb2683..5acf0df37 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Loft.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Loft.cpp @@ -85,8 +85,7 @@ void GeomAlgoAPI_Loft::build(const GeomShapePtr theFirstShape, } // Initialize and build - BRepOffsetAPI_ThruSections *ThruSections = - new BRepOffsetAPI_ThruSections(anIsSolid); + auto *ThruSections = new BRepOffsetAPI_ThruSections(anIsSolid); ThruSections->AddWire(TopoDS::Wire(aFirstShapeOut)); ThruSections->AddWire(TopoDS::Wire(aSecondShapeOut)); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.cpp index db4f8c1f5..2eb19e699 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.cpp @@ -21,7 +21,7 @@ #include //================================================================================================== -GeomAlgoAPI_MakeShapeCustom::GeomAlgoAPI_MakeShapeCustom() {} +GeomAlgoAPI_MakeShapeCustom::GeomAlgoAPI_MakeShapeCustom() = default; //================================================================================================== void GeomAlgoAPI_MakeShapeCustom::setResult(const GeomShapePtr theShape) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp index 295b3c943..ebf9b0120 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.cpp @@ -45,9 +45,8 @@ void GeomAlgoAPI_MakeShapeList::init(const ListOfMakeShape &theMakeShapeList) { myListOfMakeShape = theMakeShapeList; - for (ListOfMakeShape::const_iterator anIt = theMakeShapeList.cbegin(); - anIt != theMakeShapeList.cend(); ++anIt) { - myMap->merge((*anIt)->mapOfSubShapes()); + for (const auto &anIt : theMakeShapeList) { + myMap->merge(anIt->mapOfSubShapes()); } } @@ -90,9 +89,7 @@ void GeomAlgoAPI_MakeShapeList::modified(const GeomShapePtr theOldShape, //================================================================================================== bool GeomAlgoAPI_MakeShapeList::isDeleted(const GeomShapePtr theOldShape) { - for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); - aBuilderIt != myListOfMakeShape.end(); ++aBuilderIt) { - GeomMakeShapePtr aMakeShape = *aBuilderIt; + for (auto aMakeShape : myListOfMakeShape) { if (aMakeShape->isDeleted(theOldShape)) { return true; } @@ -115,9 +112,7 @@ void GeomAlgoAPI_MakeShapeList::result(const GeomShapePtr theOldShape, aResultShapesMap.Add(theOldShape->impl()); aResultShapesList.Append(theOldShape->impl()); - for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); - aBuilderIt != myListOfMakeShape.end(); ++aBuilderIt) { - GeomMakeShapePtr aMakeShape = *aBuilderIt; + for (auto aMakeShape : myListOfMakeShape) { NCollection_Map aTempShapes; for (NCollection_Map::Iterator aShapeIt(anAlgoShapes); aShapeIt.More(); aShapeIt.Next()) { @@ -127,9 +122,8 @@ void GeomAlgoAPI_MakeShapeList::result(const GeomShapePtr theOldShape, aShape->setImpl(new TopoDS_Shape(aShapeIt.Value())); ListOfShape aGeneratedShapes; aMakeShape->generated(aShape, aGeneratedShapes); - for (ListOfShape::const_iterator anIt = aGeneratedShapes.cbegin(); - anIt != aGeneratedShapes.cend(); ++anIt) { - const TopoDS_Shape &anItShape = (*anIt)->impl(); + for (const auto &aGeneratedShape : aGeneratedShapes) { + const auto &anItShape = aGeneratedShape->impl(); if (anItShape.IsSame(aShapeIt.Value())) { anArgumentIsInResult = true; continue; @@ -142,9 +136,8 @@ void GeomAlgoAPI_MakeShapeList::result(const GeomShapePtr theOldShape, } ListOfShape aModifiedShapes; aMakeShape->modified(aShape, aModifiedShapes); - for (ListOfShape::const_iterator anIt = aModifiedShapes.cbegin(); - anIt != aModifiedShapes.cend(); ++anIt) { - const TopoDS_Shape &anItShape = (*anIt)->impl(); + for (const auto &aModifiedShape : aModifiedShapes) { + const auto &anItShape = aModifiedShape->impl(); if (anItShape.IsSame(aShapeIt.Value())) { anArgumentIsInResult = true; continue; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.cpp index 3bac6c51b..8e6f38f21 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.cpp @@ -40,9 +40,7 @@ void GeomAlgoAPI_MakeShapeSet::generated(const GeomShapePtr theOldShape, return; } - for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); - aBuilderIt != myListOfMakeShape.end(); ++aBuilderIt) { - GeomMakeShapePtr aMakeShape = *aBuilderIt; + for (auto aMakeShape : myListOfMakeShape) { aMakeShape->generated(theOldShape, theNewShapes); } } @@ -54,9 +52,7 @@ void GeomAlgoAPI_MakeShapeSet::modified(const GeomShapePtr theOldShape, return; } - for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin(); - aBuilderIt != myListOfMakeShape.end(); ++aBuilderIt) { - GeomMakeShapePtr aMakeShape = *aBuilderIt; + for (auto aMakeShape : myListOfMakeShape) { ListOfShape aModifiedShapes; aMakeShape->modified(theOldShape, theNewShapes); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.h index 7f0248de9..0c840cb16 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeSet.h @@ -41,12 +41,12 @@ public: GeomAlgoAPI_MakeShapeSet(const ListOfMakeShape &theMakeShapeSet); /// \return the list of shapes generated from the shape \a theShape - GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theShape, - ListOfShape &theHistory); + GEOMALGOAPI_EXPORT void generated(const GeomShapePtr theShape, + ListOfShape &theHistory) override; /// \return the list of shapes modified from the shape \a theShape - GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theShape, - ListOfShape &theHistory); + GEOMALGOAPI_EXPORT void modified(const GeomShapePtr theShape, + ListOfShape &theHistory) override; }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.cpp index eaf08f914..fe2ff4861 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.cpp @@ -46,9 +46,8 @@ GeomAlgoAPI_MakeVolume::GeomAlgoAPI_MakeVolume(const ListOfShape &theFaces, static void convertToTopoDS(const ListOfShape &theShapes, TopTools_ListOfShape &theTopoDSShapes) { - for (ListOfShape::const_iterator anIt = theShapes.begin(); - anIt != theShapes.end(); ++anIt) - theTopoDSShapes.Append((*anIt)->impl()); + for (const auto &theShape : theShapes) + theTopoDSShapes.Append(theShape->impl()); } //================================================================================================= @@ -58,7 +57,7 @@ void GeomAlgoAPI_MakeVolume::build(const ListOfShape &theFaces) { } // create make volume opration - BOPAlgo_MakerVolume *aVolumeMaker = new BOPAlgo_MakerVolume; + auto *aVolumeMaker = new BOPAlgo_MakerVolume; this->setImpl(aVolumeMaker); this->setBuilderType(OCCT_BOPAlgo_Builder); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.h index a9a7eb870..138b29ff2 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeVolume.h @@ -48,8 +48,8 @@ public: /// \param[in] theOldShape base shape. /// \param[out] theNewShapes shapes modified from \a theShape. Does not /// cleared! - GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape, - ListOfShape &theNewShapes); + GEOMALGOAPI_EXPORT void modified(const GeomShapePtr theOldShape, + ListOfShape &theNewShapes) override; private: /// Builds resulting shape. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_NExplode.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_NExplode.cpp index 03ed7afa4..ac83bc31c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_NExplode.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_NExplode.cpp @@ -177,7 +177,7 @@ GeomAlgoAPI_NExplode::GeomAlgoAPI_NExplode(const ListOfShape &theShapes, } int GeomAlgoAPI_NExplode::index(const GeomShapePtr theSubShape) { - std::vector::iterator anIter = mySorted.begin(); + auto anIter = mySorted.begin(); for (int anIndex = 1; anIter != mySorted.end(); anIter++, anIndex++) { if ((*anIter)->isSame(theSubShape)) return anIndex; @@ -186,7 +186,7 @@ int GeomAlgoAPI_NExplode::index(const GeomShapePtr theSubShape) { } GeomShapePtr GeomAlgoAPI_NExplode::shape(const int theIndex) { - std::vector::iterator anIter = mySorted.begin(); + auto anIter = mySorted.begin(); for (int anIndex = 1; anIter != mySorted.end(); anIter++, anIndex++) { if (anIndex == theIndex) return *anIter; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.cpp index af095b42a..08807a0f6 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_NonPlanarFace.cpp @@ -61,7 +61,7 @@ void GeomAlgoAPI_NonPlanarFace::build(const ListOfShape &theEdges) { TColStd_IndexedDataMapOfTransientTransient aMapTShapes; TopTools_MapOfShape aMapEdges; for (auto anEdge : theEdges) { - const TopoDS_Edge &aTEdge = anEdge->impl(); + const auto &aTEdge = anEdge->impl(); if (aMapEdges.Add(aTEdge)) { BRepBuilderAPI_Copy aCopy(aTEdge, Standard_False, Standard_False); const TopoDS_Shape &aCopyEdge = aCopy.Shape(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Offset.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Offset.cpp index 3d0180139..d49ead209 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Offset.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Offset.cpp @@ -38,8 +38,7 @@ GeomAlgoAPI_Offset::GeomAlgoAPI_Offset(const GeomShapePtr &theShape, void GeomAlgoAPI_Offset::build(const GeomShapePtr &theShape, const double theOffsetValue) { - BRepOffsetAPI_MakeOffsetShape *anOffsetAlgo = - new BRepOffsetAPI_MakeOffsetShape; + auto *anOffsetAlgo = new BRepOffsetAPI_MakeOffsetShape; anOffsetAlgo->PerformBySimple(theShape->impl(), theOffsetValue); setImpl(anOffsetAlgo); setBuilderType(OCCT_BRepBuilderAPI_MakeShape); @@ -89,7 +88,7 @@ GeomAlgoAPI_Offset::GeomAlgoAPI_Offset(const GeomPlanePtr &thePlane, const TopoDS_Face &aFace = aFaceBuilder.Face(); // 3. Make Offset - BRepOffsetAPI_MakeOffset *aParal = new BRepOffsetAPI_MakeOffset; + auto *aParal = new BRepOffsetAPI_MakeOffset; setImpl(aParal); setBuilderType(OCCT_BRepBuilderAPI_MakeShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp index 9cb8ddd1d..753bf41cc 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp @@ -127,9 +127,8 @@ static void sortCompound(TopoDS_Shape &theCompound, // results GeomAlgoAPI_SortListOfShapes::sort(aCombiningShapes); - for (ListOfShape::iterator anIt = aCombiningShapes.begin(); - anIt != aCombiningShapes.end(); ++anIt) - aBuilder.Add(aResCompound, (*anIt)->impl()); + for (auto &aCombiningShape : aCombiningShapes) + aBuilder.Add(aResCompound, aCombiningShape->impl()); } theCompound = aResCompound; @@ -166,15 +165,14 @@ void GeomAlgoAPI_Partition::build(const ListOfShape &theObjects, } // Creating partition operation. - GEOMAlgo_Splitter *anOperation = new GEOMAlgo_Splitter; + auto *anOperation = new GEOMAlgo_Splitter; this->setImpl(anOperation); this->setBuilderType(OCCT_BOPAlgo_Builder); TopTools_MapOfShape ShapesMap; // Getting objects. - for (ListOfShape::const_iterator anObjectsIt = theObjects.begin(); - anObjectsIt != theObjects.end(); anObjectsIt++) { - const TopoDS_Shape &aShape = (*anObjectsIt)->impl(); + for (const auto &theObject : theObjects) { + const auto &aShape = theObject->impl(); // #2240: decompose compounds to get the valid result TopTools_ListOfShape aSimpleShapes; prepareShapes(aShape, aSimpleShapes); @@ -188,9 +186,8 @@ void GeomAlgoAPI_Partition::build(const ListOfShape &theObjects, } // Getting tools. - for (ListOfShape::const_iterator aToolsIt = theTools.begin(); - aToolsIt != theTools.end(); aToolsIt++) { - const TopoDS_Shape &aShape = (*aToolsIt)->impl(); + for (const auto &theTool : theTools) { + const auto &aShape = theTool->impl(); // #2419: decompose compounds to get the valid result TopTools_ListOfShape aSimpleShapes; prepareShapes(aShape, aSimpleShapes); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp index 27c82ac2d..449f2f494 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PaveFiller.cpp @@ -39,11 +39,10 @@ GeomAlgoAPI_PaveFiller::GeomAlgoAPI_PaveFiller( void GeomAlgoAPI_PaveFiller::build(const ListOfShape &theListOfShape, const bool theIsMakeCompSolids, const double theFuzzy) { - BOPAlgo_PaveFiller *aPaveFiller = new BOPAlgo_PaveFiller; + auto *aPaveFiller = new BOPAlgo_PaveFiller; TopTools_ListOfShape aListOfShape; - for (ListOfShape::const_iterator anIt = theListOfShape.cbegin(); - anIt != theListOfShape.cend(); anIt++) { - const TopoDS_Shape &aShape = (*anIt)->impl(); + for (const auto &anIt : theListOfShape) { + const auto &aShape = anIt->impl(); if (aShape.ShapeType() == TopAbs_COMPOUND) { for (TopoDS_Iterator anIter(aShape); anIter.More(); anIter.Next()) { aListOfShape.Append(anIter.Value()); @@ -59,7 +58,7 @@ void GeomAlgoAPI_PaveFiller::build(const ListOfShape &theListOfShape, if (aPaveFiller->HasErrors()) return; - BOPAlgo_Builder *aBuilder = new BOPAlgo_Builder(); + auto *aBuilder = new BOPAlgo_Builder(); this->setImpl(aBuilder); this->setBuilderType(OCCT_BOPAlgo_Builder); aBuilder->SetArguments(aListOfShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp index 33a26d35e..3fc205307 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.cpp @@ -102,7 +102,7 @@ void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape, addMovedPath(anOldPath, aNewPath); // Making pipe. - BRepOffsetAPI_MakePipe *aPipeBuilder = NULL; + BRepOffsetAPI_MakePipe *aPipeBuilder = nullptr; try { aPipeBuilder = new BRepOffsetAPI_MakePipe(aPathWire, aBaseShape); } catch (...) { @@ -202,8 +202,7 @@ void GeomAlgoAPI_Pipe::build(const GeomShapePtr theBaseShape, gp_Dir aBiNormalDir = aBiNormalLine->Lin().Direction(); // Making pipe. - BRepOffsetAPI_MakePipeShell *aPipeBuilder = - new BRepOffsetAPI_MakePipeShell(aPathWire); + auto *aPipeBuilder = new BRepOffsetAPI_MakePipeShell(aPathWire); if (!aPipeBuilder) { return; } @@ -266,9 +265,7 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape &theBaseShapes, // Get locations after moving path shape. std::list aLocations; - for (ListOfShape::const_iterator aLocIt = theLocations.cbegin(); - aLocIt != theLocations.cend(); ++aLocIt) { - GeomShapePtr aLocation = *aLocIt; + for (auto aLocation : theLocations) { if (!aLocation.get() || aLocation->shapeType() != GeomAPI_Shape::VERTEX) { return; } @@ -303,8 +300,8 @@ void GeomAlgoAPI_Pipe::build(const ListOfShape &theBaseShapes, if (!aPipeBuilder) { return; } - ListOfShape::const_iterator aBaseIt = theBaseShapes.cbegin(); - std::list::const_iterator aLocationsIt = aLocations.cbegin(); + auto aBaseIt = theBaseShapes.cbegin(); + auto aLocationsIt = aLocations.cbegin(); while (aBaseIt != theBaseShapes.cend()) { GeomShapePtr aBase = *aBaseIt; if (!getBase(aBaseShape, aBaseShapeType, aBase)) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp index e0c4c44c4..d912f2d16 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp @@ -123,8 +123,8 @@ void GeomAlgoAPI_Placement::build( } // Initial shapes - const TopoDS_Shape &aSourceShape = theSourceSolid->impl(); - const TopoDS_Shape &aDestShape = theDestSolid->impl(); + const auto &aSourceShape = theSourceSolid->impl(); + const auto &aDestShape = theDestSolid->impl(); // Check the material of the solids to be on the correct side BRepClass3d_SolidClassifier aClassifier; static const double aTransStep = 10. * Precision::Confusion(); @@ -250,8 +250,7 @@ void GeomAlgoAPI_Placement::build( true); // it is allways true for simple transformation generation } else { // internal rebuild of the shape // Transform the shape with copying it - BRepBuilderAPI_Transform *aBuilder = - new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true); + auto *aBuilder = new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true); if (!aBuilder) { return; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp index 3914bb524..cfd698e23 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp @@ -44,7 +44,7 @@ //================================================================================================== std::shared_ptr GeomAlgoAPI_PointBuilder::vertex(const std::shared_ptr thePoint) { - const gp_Pnt &aPnt = thePoint->impl(); + const auto &aPnt = thePoint->impl(); BRepBuilderAPI_MakeVertex aMaker(aPnt); TopoDS_Vertex aVertex = aMaker.Vertex(); std::shared_ptr aRes(new GeomAPI_Vertex); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PointCloudOnFace.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PointCloudOnFace.cpp index 728a6d4d2..6a001bd75 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PointCloudOnFace.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PointCloudOnFace.cpp @@ -209,7 +209,7 @@ void ModifyFacesForGlobalResult( GeomAbs_SurfaceType aType = aBAsurf.GetType(); BRep_Builder aBB; - const Standard_Integer aNbFaces = (Standard_Integer)theFacesAndAreas.size(); + const auto aNbFaces = (Standard_Integer)theFacesAndAreas.size(); const Standard_Integer aDiff = theNbExtremalFaces - theRemovedFaces.Extent(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp index 817d156e1..97dd9e9aa 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp @@ -145,7 +145,7 @@ GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, } // Getting base shape. - const TopoDS_Shape &aBaseShape = theBaseShape->impl(); + const auto &aBaseShape = theBaseShape->impl(); GeomAPI_Shape::ShapeType aShapeTypeToExp; switch (aBaseShape.ShapeType()) { case TopAbs_VERTEX: @@ -275,14 +275,13 @@ void GeomAlgoAPI_Prism::buildBySizes( const GeomShapePtr theBaseShape, const GeomDirPtr theDirection, const double theToSize, const double theFromSize, const GeomAPI_Shape::ShapeType theTypeToExp) { - const TopoDS_Shape &aBaseShape = theBaseShape->impl(); + const auto &aBaseShape = theBaseShape->impl(); gp_Vec anExtVec = theDirection->impl(); // Moving base shape. gp_Trsf aTrsf; aTrsf.SetTranslation(anExtVec * -theFromSize); - BRepBuilderAPI_Transform *aTransformBuilder = - new BRepBuilderAPI_Transform(aBaseShape, aTrsf); + auto *aTransformBuilder = new BRepBuilderAPI_Transform(aBaseShape, aTrsf); if (!aTransformBuilder || !aTransformBuilder->IsDone()) { return; } @@ -291,7 +290,7 @@ void GeomAlgoAPI_Prism::buildBySizes( TopoDS_Shape aMovedBase = aTransformBuilder->Shape(); // Making prism. - BRepPrimAPI_MakePrism *aPrismBuilder = new BRepPrimAPI_MakePrism( + auto *aPrismBuilder = new BRepPrimAPI_MakePrism( aMovedBase, anExtVec * (theFromSize + theToSize)); if (!aPrismBuilder || !aPrismBuilder->IsDone()) { return; @@ -323,7 +322,7 @@ void GeomAlgoAPI_Prism::buildByPlanes( const GeomPlanePtr theToPlane, const double theToSize, const GeomPlanePtr theFromPlane, const double theFromSize, const GeomAPI_Shape::ShapeType theTypeToExp) { - const TopoDS_Shape &aBaseShape = theBaseShape->impl(); + const auto &aBaseShape = theBaseShape->impl(); gp_Vec anExtVec = theDirection->impl(); // Moving prism bounding faces according to "from" and "to" sizes. @@ -350,10 +349,10 @@ void GeomAlgoAPI_Prism::buildByPlanes( Standard_Real aZArr[2] = {aBndBox.CornerMin().Z(), aBndBox.CornerMax().Z()}; gp_Pnt aPoints[8]; int aNum = 0; - for (int i = 0; i < 2; i++) { - for (int j = 0; j < 2; j++) { - for (int k = 0; k < 2; k++) { - aPoints[aNum] = gp_Pnt(aXArr[i], aYArr[j], aZArr[k]); + for (double i : aXArr) { + for (double j : aYArr) { + for (double k : aZArr) { + aPoints[aNum] = gp_Pnt(i, j, k); aNum++; } } @@ -365,8 +364,8 @@ void GeomAlgoAPI_Prism::buildByPlanes( IntAna_Quadric aBndFromQuadric( gp_Pln(aFromPnt->impl(), aFromDir->impl())); Standard_Real aMaxToDist = 0, aMaxFromDist = 0; - for (int i = 0; i < 8; i++) { - gp_Lin aLine(aPoints[i], anExtVec); + for (const auto &aPoint : aPoints) { + gp_Lin aLine(aPoint, anExtVec); IntAna_IntConicQuad aToIntAna(aLine, aBndToQuadric); IntAna_IntConicQuad aFromIntAna(aLine, aBndFromQuadric); if (aToIntAna.NbPoints() == 0 || aFromIntAna.NbPoints() == 0) { @@ -374,11 +373,11 @@ void GeomAlgoAPI_Prism::buildByPlanes( } const gp_Pnt &aPntOnToFace = aToIntAna.Point(1); const gp_Pnt &aPntOnFromFace = aFromIntAna.Point(1); - if (aPoints[i].Distance(aPntOnToFace) > aMaxToDist) { - aMaxToDist = aPoints[i].Distance(aPntOnToFace); + if (aPoint.Distance(aPntOnToFace) > aMaxToDist) { + aMaxToDist = aPoint.Distance(aPntOnToFace); } - if (aPoints[i].Distance(aPntOnFromFace) > aMaxFromDist) { - aMaxFromDist = aPoints[i].Distance(aPntOnFromFace); + if (aPoint.Distance(aPntOnFromFace) > aMaxFromDist) { + aMaxFromDist = aPoint.Distance(aPntOnFromFace); } } @@ -388,8 +387,7 @@ void GeomAlgoAPI_Prism::buildByPlanes( // Moving base shape. gp_Trsf aTrsf; aTrsf.SetTranslation(anExtVec * -aPrismLength); - BRepBuilderAPI_Transform *aTransformBuilder = - new BRepBuilderAPI_Transform(aBaseShape, aTrsf); + auto *aTransformBuilder = new BRepBuilderAPI_Transform(aBaseShape, aTrsf); if (!aTransformBuilder || !aTransformBuilder->IsDone()) { return; } @@ -398,7 +396,7 @@ void GeomAlgoAPI_Prism::buildByPlanes( TopoDS_Shape aMovedBase = aTransformBuilder->Shape(); // Making prism. - BRepPrimAPI_MakePrism *aPrismBuilder = + auto *aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength); if (!aPrismBuilder || !aPrismBuilder->IsDone()) { return; @@ -415,7 +413,7 @@ void GeomAlgoAPI_Prism::buildByPlanes( // Orienting bounding planes. std::shared_ptr aCentreOfMass = GeomAlgoAPI_ShapeTools::centreOfMass(theBaseShape); - const gp_Pnt &aCentrePnt = aCentreOfMass->impl(); + const auto &aCentrePnt = aCentreOfMass->impl(); gp_Lin aLine(aCentrePnt, anExtVec); IntAna_IntConicQuad aToIntAna(aLine, aBndToQuadric); IntAna_IntConicQuad aFromIntAna(aLine, aBndFromQuadric); @@ -444,14 +442,14 @@ void GeomAlgoAPI_Prism::buildByPlanes( aToPnt, aToDir, THE_FACE_SIZE_COEFF * aBndBoxSize); // bounding planes - const TopoDS_Shape &aToShape = aBoundingToShape->impl(); - const TopoDS_Shape &aFromShape = aBoundingFromShape->impl(); + const auto &aToShape = aBoundingToShape->impl(); + const auto &aFromShape = aBoundingFromShape->impl(); TopoDS_Face aToFace = TopoDS::Face(aToShape); TopoDS_Face aFromFace = TopoDS::Face(aFromShape); // Solid based on "To" bounding plane gp_Vec aNormal = aToDir->impl(); - BRepPrimAPI_MakePrism *aToPrismBuilder = + auto *aToPrismBuilder = new BRepPrimAPI_MakePrism(aToShape, aNormal * (-2.0 * aBndBoxSize)); if (!aToPrismBuilder || !aToPrismBuilder->IsDone()) { return; @@ -461,7 +459,7 @@ void GeomAlgoAPI_Prism::buildByPlanes( TopoDS_Shape aToSolid = aToPrismBuilder->Shape(); // Cutting with to plane. - BRepAlgoAPI_Cut *aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid); + auto *aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid); aToCutBuilder->Build(); if (!aToCutBuilder->IsDone()) { return; @@ -492,7 +490,7 @@ void GeomAlgoAPI_Prism::buildByPlanes( // Solid based on "From" bounding plane aNormal = aFromDir->impl(); - BRepPrimAPI_MakePrism *aFromPrismBuilder = + auto *aFromPrismBuilder = new BRepPrimAPI_MakePrism(aFromShape, aNormal * (-2.0 * aBndBoxSize)); if (!aFromPrismBuilder || !aFromPrismBuilder->IsDone()) { return; @@ -502,7 +500,7 @@ void GeomAlgoAPI_Prism::buildByPlanes( TopoDS_Shape aFromSolid = aFromPrismBuilder->Shape(); // Cutting with from plane. - BRepAlgoAPI_Cut *aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid); + auto *aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid); aFromCutBuilder->Build(); if (!aFromCutBuilder->IsDone()) { return; @@ -567,7 +565,7 @@ void GeomAlgoAPI_Prism::buildByFaces( const bool theToIsPlanar, const GeomShapePtr theFromShape, const double theFromSize, const bool theFromIsPlanar, const GeomAPI_Shape::ShapeType theTypeToExp) { - const TopoDS_Shape &aBaseShape = theBaseShape->impl(); + const auto &aBaseShape = theBaseShape->impl(); gp_Vec anExtVec = theDirection->impl(); // Moving prism bounding faces according to "from" and "to" sizes. @@ -586,8 +584,7 @@ void GeomAlgoAPI_Prism::buildByFaces( // Prism building. gp_Trsf aTrsf; aTrsf.SetTranslation(anExtVec * -aPrismLength); - BRepBuilderAPI_Transform *aTransformBuilder = - new BRepBuilderAPI_Transform(aBaseShape, aTrsf); + auto *aTransformBuilder = new BRepBuilderAPI_Transform(aBaseShape, aTrsf); if (!aTransformBuilder || !aTransformBuilder->IsDone()) { return; } @@ -596,7 +593,7 @@ void GeomAlgoAPI_Prism::buildByFaces( TopoDS_Shape aMovedBase = aTransformBuilder->Shape(); // Making prism. - BRepPrimAPI_MakePrism *aPrismBuilder = + auto *aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength); if (!aPrismBuilder || !aPrismBuilder->IsDone()) { return; @@ -631,17 +628,15 @@ void GeomAlgoAPI_Prism::buildByFaces( if (theFromIsPlanar) { ListOfShape anImagesFrom; aPartition->modified(aBoundingFromShape, anImagesFrom); - for (ListOfShape::iterator anIt = anImagesFrom.begin(); - anIt != anImagesFrom.end(); ++anIt) - addFromShape(*anIt); + for (auto &anIt : anImagesFrom) + addFromShape(anIt); } if (theToIsPlanar) { ListOfShape anImagesTo; aPartition->modified(aBoundingToShape, anImagesTo); - for (ListOfShape::iterator anIt = anImagesTo.begin(); - anIt != anImagesTo.end(); ++anIt) - addToShape(*anIt); + for (auto &anIt : anImagesTo) + addToShape(anIt); } // Collect results which have both boundaries, selected for extrusion, @@ -756,9 +751,9 @@ bool isShapeApplicable(const GeomShapePtr &theSolid, // check all faces are in solid bool isApplicable = true; - for (std::list::const_iterator it1 = theShapesToExist.begin(); + for (auto it1 = theShapesToExist.begin(); it1 != theShapesToExist.end() && isApplicable; ++it1) { - ListOfShape::const_iterator it2 = it1->begin(); + auto it2 = it1->begin(); for (; it2 != it1->end(); ++it2) if (aFaces.find(*it2) != aFaces.end()) break; @@ -770,12 +765,11 @@ bool isShapeApplicable(const GeomShapePtr &theSolid, void collectModified(const GeomMakeShapePtr &theOperation, const ListOfShape &theShapes, std::list &theModified) { - for (ListOfShape::const_iterator anIt = theShapes.begin(); - anIt != theShapes.end(); ++anIt) { + for (const auto &theShape : theShapes) { theModified.push_back(ListOfShape()); - theOperation->modified(*anIt, theModified.back()); - theOperation->generated(*anIt, theModified.back()); - theModified.back().push_back(*anIt); + theOperation->modified(theShape, theModified.back()); + theOperation->generated(theShape, theModified.back()); + theModified.back().push_back(theShape); } } @@ -792,9 +786,8 @@ GeomShapePtr collectResults(const GeomMakeShapePtr &theOperation, std::list aModifiedExclude; collectModified(theOperation, theShapesToExclude, aModifiedExclude); SetOfShape aTabooShapes; - for (std::list::iterator anIt = aModifiedExclude.begin(); - anIt != aModifiedExclude.end(); ++anIt) - aTabooShapes.insert(anIt->begin(), anIt->end()); + for (auto &anIt : aModifiedExclude) + aTabooShapes.insert(anIt.begin(), anIt.end()); // type of sub-shapes to explode GeomAPI_Shape::ShapeType aSubshapeType; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp index da1d7f5b9..c27eb47f5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Projection.cpp @@ -51,7 +51,7 @@ GeomCurvePtr GeomAlgoAPI_Projection::project(const GeomCurvePtr &theCurve) { GeomCurvePtr GeomAlgoAPI_Projection::project(const GeomEdgePtr &theEdge) { GeomCurvePtr aCurve(new GeomAPI_Curve); - const TopoDS_Shape &aShape = theEdge->impl(); + const auto &aShape = theEdge->impl(); TopoDS_Edge anEdge = TopoDS::Edge(aShape); if (!anEdge.IsNull()) { double aStart, aEnd; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp index 5a7b0db5d..12903b23e 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp @@ -118,7 +118,7 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr &theBaseShape, } // Getting base shape. - const TopoDS_Shape &aBaseShape = theBaseShape->impl(); + const auto &aBaseShape = theBaseShape->impl(); TopAbs_ShapeEnum aShapeTypeToExp; switch (aBaseShape.ShapeType()) { case TopAbs_VERTEX: @@ -182,7 +182,7 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr &theBaseShape, // Rotating base face with the negative value of "from angle". gp_Trsf aBaseTrsf; aBaseTrsf.SetRotation(anAxis, -theFromAngle / 180.0 * M_PI); - BRepBuilderAPI_Transform *aBaseTransform = + auto *aBaseTransform = new BRepBuilderAPI_Transform(aBaseShape, aBaseTrsf, true); if (!aBaseTransform) { return; @@ -196,7 +196,7 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr &theBaseShape, // Making revolution to the angle equal to the sum of "from angle" and "to // angle". - BRepPrimAPI_MakeRevol *aRevolBuilder = new BRepPrimAPI_MakeRevol( + auto *aRevolBuilder = new BRepPrimAPI_MakeRevol( aRotatedBase, anAxis, (theFromAngle + theToAngle) / 180 * M_PI, Standard_True); if (!aRevolBuilder) { @@ -220,7 +220,7 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr &theBaseShape, } else if (theFromShape && theToShape) { // Case 2: When both bounding planes were set. // Making revolution to the 360 angle. - BRepPrimAPI_MakeRevol *aRevolBuilder = + auto *aRevolBuilder = new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True); if (!aRevolBuilder) { return; @@ -280,7 +280,7 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr &theBaseShape, aToSolid = aToTransform.Shape(); // Cutting revolution with from plane. - BRepAlgoAPI_Cut *aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid); + auto *aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid); aFromCutBuilder->Build(); if (!aFromCutBuilder->IsDone()) { return; @@ -293,7 +293,7 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr &theBaseShape, } // Cutting revolution with to plane. - BRepAlgoAPI_Cut *aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid); + auto *aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid); aToCutBuilder->Build(); if (!aToCutBuilder->IsDone()) { return; @@ -333,7 +333,7 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr &theBaseShape, } } else { // Case 3: When only one bounding plane was set. // Making revolution to the 360 angle. - BRepPrimAPI_MakeRevol *aRevolBuilder = + auto *aRevolBuilder = new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True); if (!aRevolBuilder) { return; @@ -396,8 +396,7 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr &theBaseShape, aBoundingSolid = aBoundingTransform.Shape(); // Cutting revolution with bounding plane. - BRepAlgoAPI_Cut *aBoundingCutBuilder = - new BRepAlgoAPI_Cut(aResult, aBoundingSolid); + auto *aBoundingCutBuilder = new BRepAlgoAPI_Cut(aResult, aBoundingSolid); aBoundingCutBuilder->Build(); if (!aBoundingCutBuilder->IsDone()) { return; @@ -469,7 +468,7 @@ void GeomAlgoAPI_Revolution::build(const GeomShapePtr &theBaseShape, aBaseSolid = aBaseTransform.Shape(); // Cutting revolution with base. - BRepAlgoAPI_Cut *aBaseCutBuilder = new BRepAlgoAPI_Cut(aResult, aBaseSolid); + auto *aBaseCutBuilder = new BRepAlgoAPI_Cut(aResult, aBaseSolid); aBaseCutBuilder->Build(); if (aBaseCutBuilder->IsDone()) { TopoDS_Shape aCutResult = aBaseCutBuilder->Shape(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp index e6ff52a40..98e8eb16e 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp @@ -137,10 +137,8 @@ bool STEPExport(const std::string &theFileName, GeomAlgoAPI_STEPAttributes anAttrs(aDoc->Main()); - std::list>::const_iterator aShape = - theShapes.cbegin(); - std::list>::const_iterator aResult = - theResults.cbegin(); + auto aShape = theShapes.cbegin(); + auto aResult = theResults.cbegin(); for (; aShape != theShapes.cend(); aShape++, aResult++) { TDF_Label aNullLab; if (aResult->get() && diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STLImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_STLImport.h index ae9334f1f..78746b4ee 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STLImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STLImport.h @@ -19,7 +19,7 @@ // #ifndef GEOMALGOAPI_STLIMPORT_H_ -#define GEOMALGOAPI_STLPIMPORT_H_ +#define GEOMALGOAPI_STLIMPORT_H_ #include #include diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp index 5658d1e57..7a227c0f8 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Scale.cpp @@ -79,7 +79,7 @@ void GeomAlgoAPI_Scale::buildByDimensions( return; } - const gp_Pnt &aCenterPoint = theCenterPoint->impl(); + const auto &aCenterPoint = theCenterPoint->impl(); // Perform the rotation matrix gp_Mat aMatRot(theScaleFactorX, 0., 0., 0., theScaleFactorY, 0., 0., 0., @@ -95,7 +95,7 @@ void GeomAlgoAPI_Scale::buildByDimensions( aGTrsf = aGTrsf0P.Multiplied(aGTrsf); aGTrsf = aGTrsf.Multiplied(aGTrsfP0); - const TopoDS_Shape &aSourceShape = theSourceShape->impl(); + const auto &aSourceShape = theSourceShape->impl(); if (aSourceShape.IsNull()) { myError = @@ -104,8 +104,7 @@ void GeomAlgoAPI_Scale::buildByDimensions( } // Transform the shape while copying it. - BRepBuilderAPI_GTransform *aBuilder = - new BRepBuilderAPI_GTransform(aSourceShape, aGTrsf, true); + auto *aBuilder = new BRepBuilderAPI_GTransform(aSourceShape, aGTrsf, true); if (!aBuilder) { myError = "Scale builder :: transform initialization failed."; return; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp index 197c253f5..64b189457 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp @@ -47,7 +47,7 @@ void GeomAlgoAPI_Sewing::build(const ListOfShape &theShapes, return; } - BRepBuilderAPI_Sewing *aSewingBuilder = new BRepBuilderAPI_Sewing(); + auto *aSewingBuilder = new BRepBuilderAPI_Sewing(); this->setImpl(aSewingBuilder); if (!myBuildShell) { @@ -57,9 +57,8 @@ void GeomAlgoAPI_Sewing::build(const ListOfShape &theShapes, aSewingBuilder->SetNonManifoldMode(theAllowNonManifold); } - for (ListOfShape::const_iterator anIt = theShapes.cbegin(); - anIt != theShapes.cend(); ++anIt) { - const TopoDS_Shape &aShape = (*anIt)->impl(); + for (const auto &theShape : theShapes) { + const auto &aShape = theShape->impl(); aSewingBuilder->Add(aShape); } @@ -106,9 +105,8 @@ void GeomAlgoAPI_Sewing::modified(const std::shared_ptr theShape, return; } - const TopoDS_Shape &aShape = theShape->impl(); - const BRepBuilderAPI_Sewing &aSewingBuilder = - this->impl(); + const auto &aShape = theShape->impl(); + const auto &aSewingBuilder = this->impl(); TopoDS_Shape aModifiedShape = aSewingBuilder.Modified(aShape); if (aModifiedShape.IsEqual(aShape)) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h index b19cf79b5..4e2b7ad16 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.h @@ -47,9 +47,9 @@ public: /// \return the list of shapes modified from the shape \a theShape. /// \param[in] theShape base shape. /// \param[out] theHistory modified shapes. - GEOMALGOAPI_EXPORT virtual void + GEOMALGOAPI_EXPORT void modified(const std::shared_ptr theShape, - ListOfShape &theHistory); + ListOfShape &theHistory) override; protected: bool myBuildShell; // whether algorithm is used by MakeShell or by Sewing diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp index d7d546e5d..c3bd53944 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeBuilder.cpp @@ -43,8 +43,8 @@ void GeomAlgoAPI_ShapeBuilder::add( return; } - TopoDS_Shape *aShape = theShape->implPtr(); - const TopoDS_Shape &aShapeToAdd = theShapeToAdd->impl(); + auto *aShape = theShape->implPtr(); + const auto &aShapeToAdd = theShapeToAdd->impl(); BRep_Builder aBuilder; aBuilder.Add(*aShape, aShapeToAdd); @@ -58,15 +58,15 @@ void GeomAlgoAPI_ShapeBuilder::remove( return; } - TopoDS_Shape *aShape = theShape->implPtr(); - const TopoDS_Shape &aShapeToRemove = theShapeToRemove->impl(); + auto *aShape = theShape->implPtr(); + const auto &aShapeToRemove = theShapeToRemove->impl(); BRep_Builder aBuilder; aBuilder.Remove(*aShape, aShapeToRemove); } //================================================================================================== -GeomAlgoAPI_ShapeBuilder::GeomAlgoAPI_ShapeBuilder() {} +GeomAlgoAPI_ShapeBuilder::GeomAlgoAPI_ShapeBuilder() = default; //================================================================================================== void GeomAlgoAPI_ShapeBuilder::removeInternal( @@ -93,8 +93,8 @@ void GeomAlgoAPI_ShapeBuilder::removeInternal( } this->appendAlgo(aMakeShapeCustom); } else if (aBaseShapeType == GeomAPI_Shape::FACE) { - const TopoDS_Shape &aBaseShape = theShape->impl(); - BRepBuilderAPI_Copy *aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape); + const auto &aBaseShape = theShape->impl(); + auto *aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape); this->appendAlgo(std::shared_ptr( new GeomAlgoAPI_MakeShape(aCopyBuilder))); if (!aCopyBuilder->IsDone()) { @@ -126,11 +126,11 @@ void GeomAlgoAPI_ShapeBuilder::addInternal( if (!theShape.get()) { return; } - const TopoDS_Shape &aBaseShape = theShape->impl(); + const auto &aBaseShape = theShape->impl(); TopAbs_ShapeEnum aBaseShapeType = aBaseShape.ShapeType(); // Copy base shape. - BRepBuilderAPI_Copy *aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape); + auto *aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape); this->appendAlgo(std::shared_ptr( new GeomAlgoAPI_MakeShape(aCopyBuilder))); if (!aCopyBuilder->IsDone()) { @@ -142,9 +142,8 @@ void GeomAlgoAPI_ShapeBuilder::addInternal( BRep_Builder aBuilder; std::shared_ptr aMakeShapeCustom( new GeomAlgoAPI_MakeShapeCustom()); - for (ListOfShape::const_iterator anIt = theShapesToAdd.cbegin(); - anIt != theShapesToAdd.cend(); ++anIt) { - TopoDS_Shape aShapeToAdd = (*anIt)->impl(); + for (const auto &anIt : theShapesToAdd) { + TopoDS_Shape aShapeToAdd = anIt->impl(); TopoDS_Shape aModShapeToAdd = aShapeToAdd; aModShapeToAdd.Orientation(TopAbs_INTERNAL); for (TopExp_Explorer aResExp(aResultShape, TopAbs_VERTEX); aResExp.More(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.cpp index 215aac622..4ef53b948 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.cpp @@ -261,8 +261,7 @@ void GeomAlgoAPI_ShapeInfo::processFace(Values &theVals, GeomFacePtr theFace) { GeomAlgoAPI_ShapeInfo::Values::Values( const GeomAlgoAPI_ShapeInfo::InfoType theType) : myType(theType) { - static GeomAlgoAPI_ShapeInfo::Translator *kDefaultTr = - new GeomAlgoAPI_ShapeInfo::Translator; + static auto *kDefaultTr = new GeomAlgoAPI_ShapeInfo::Translator; myTr = kDefaultTr; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h index 80f5cf5c1..8985f2d87 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h @@ -33,13 +33,13 @@ /// Keeps values of different possible types, used in python shapeInfo. class GeomAlgoAPI_InfoValue { - int myType; //< type stored in this Value + int myType{-1}; //< type stored in this Value std::string myStr; //< type 0 double myDouble; //< type 1 bool myBool; //< type 2 public: - GeomAlgoAPI_InfoValue() : myType(-1) {} // invalid case + GeomAlgoAPI_InfoValue() {} // invalid case GeomAlgoAPI_InfoValue(const char *theVal) : myType(0), myStr(theVal) {} GeomAlgoAPI_InfoValue(const std::string theVal) : myType(0), myStr(theVal) {} GeomAlgoAPI_InfoValue(const double theVal) : myType(1), myDouble(theVal) {} @@ -79,7 +79,7 @@ public: /// It is provided by a caller of this class. class Translator { public: - Translator() {} + Translator() = default; GEOMALGOAPI_EXPORT virtual std::string translate(const char *theSource) { return theSource; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index df5dd60af..31e12bb2c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -147,7 +147,7 @@ GeomAlgoAPI_ShapeTools::length(const std::shared_ptr theShape) { if (!theShape.get()) { return 0.0; } - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); if (aShape.IsNull()) { return 0.0; } @@ -162,7 +162,7 @@ GeomAlgoAPI_ShapeTools::volume(const std::shared_ptr theShape) { if (!theShape.get()) { return 0.0; } - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); if (aShape.IsNull()) { return 0.0; } @@ -184,7 +184,7 @@ GeomAlgoAPI_ShapeTools::area(const std::shared_ptr theShape) { if (!theShape.get()) { return 0.0; } - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); if (aShape.IsNull()) { return 0.0; } @@ -209,7 +209,7 @@ bool GeomAlgoAPI_ShapeTools::isContinuousFaces(const GeomShapePtr &theFace1, theError = "isContinuousFaces : An invalid argument"; return false; } - const gp_Pnt &aPoint = thePoint->impl(); + const auto &aPoint = thePoint->impl(); // Getting base shape. if (!theFace1.get()) { @@ -295,7 +295,7 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::centreOfMass( if (!theShape) { return std::shared_ptr(); } - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); if (aShape.IsNull()) { return std::shared_ptr(); } @@ -316,7 +316,7 @@ double GeomAlgoAPI_ShapeTools::radius( const std::shared_ptr &theCylinder) { double aRadius = -1.0; if (theCylinder->isCylindrical()) { - const TopoDS_Shape &aShape = theCylinder->impl(); + const auto &aShape = theCylinder->impl(); Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape)); Handle(Geom_CylindricalSurface) aCyl = Handle(Geom_CylindricalSurface)::DownCast(aSurf); @@ -332,8 +332,8 @@ namespace { auto getExtemaDistShape = [](const GeomShapePtr &theShape1, const GeomShapePtr &theShape2) -> BRepExtrema_DistShapeShape { - const TopoDS_Shape &aShape1 = theShape1->impl(); - const TopoDS_Shape &aShape2 = theShape2->impl(); + const auto &aShape1 = theShape1->impl(); + const auto &aShape2 = theShape2->impl(); BRepExtrema_DistShapeShape aDist(aShape1, aShape2); aDist.Perform(); @@ -541,8 +541,8 @@ double GeomAlgoAPI_ShapeTools::shapeProximity(const GeomShapePtr &theShape1, if (!theShape1.get() || !theShape2.get()) return aResult; - const TopoDS_Shape &aShape1 = theShape1->impl(); - const TopoDS_Shape &aShape2 = theShape2->impl(); + const auto &aShape1 = theShape1->impl(); + const auto &aShape2 = theShape2->impl(); TopAbs_ShapeEnum aType1 = aShape1.ShapeType(); TopAbs_ShapeEnum aType2 = aShape2.ShapeType(); @@ -676,7 +676,7 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes( // Get free shapes. int anOrder = 0; - const TopoDS_Shape &aShapesComp = theCompound->impl(); + const auto &aShapesComp = theCompound->impl(); for (TopoDS_Iterator anIter(aShapesComp); anIter.More(); anIter.Next(), anOrder++) { const TopoDS_Shape &aShape = anIter.Value(); @@ -811,11 +811,11 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes( TopoDS_Builder aBuilder; aBuilder.MakeCompound(aResultComp); // put to result compound and result list in accordance to the order numbers - std::map::iterator anInputIter = anInputOrder.begin(); + auto anInputIter = anInputOrder.begin(); std::map aNums; for (; anInputIter != anInputOrder.end(); anInputIter++) aNums[anInputIter->second] = anInputIter->first; - std::map::iterator aNumsIter = aNums.begin(); + auto aNumsIter = aNums.begin(); for (; aNumsIter != aNums.end(); aNumsIter++) { aBuilder.Add(aResultComp, (aNumsIter->second)->impl()); theResuts.push_back(aNumsIter->second); @@ -988,10 +988,9 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::groupSharedTopology( bool GeomAlgoAPI_ShapeTools::hasSharedTopology( const ListOfShape &theShapes, const GeomAPI_Shape::ShapeType theShapeType) { TopTools_IndexedMapOfShape aSubs; - for (ListOfShape::const_iterator anIt = theShapes.begin(); - anIt != theShapes.end(); ++anIt) { + for (const auto &theShape : theShapes) { TopTools_IndexedMapOfShape aCurSubs; - TopExp::MapShapes((*anIt)->impl(), + TopExp::MapShapes(theShape->impl(), (TopAbs_ShapeEnum)theShapeType, aCurSubs); for (TopTools_IndexedMapOfShape::Iterator aSubIt(aCurSubs); aSubIt.More(); aSubIt.Next()) { @@ -1012,9 +1011,8 @@ GeomAlgoAPI_ShapeTools::getBoundingBox(const ListOfShape &theShapes, Bnd_Box aBndBox; // Getting box. - for (ListOfShape::const_iterator anObjectsIt = theShapes.begin(); - anObjectsIt != theShapes.end(); anObjectsIt++) { - const TopoDS_Shape &aShape = (*anObjectsIt)->impl(); + for (const auto &theShape : theShapes) { + const auto &aShape = theShape->impl(); BRepBndLib::Add(aShape, aBndBox); } @@ -1028,11 +1026,10 @@ GeomAlgoAPI_ShapeTools::getBoundingBox(const ListOfShape &theShapes, Standard_Real aYArr[2] = {aBndBox.CornerMin().Y(), aBndBox.CornerMax().Y()}; Standard_Real aZArr[2] = {aBndBox.CornerMin().Z(), aBndBox.CornerMax().Z()}; std::list> aResultPoints; - for (int i = 0; i < 2; i++) { - for (int j = 0; j < 2; j++) { - for (int k = 0; k < 2; k++) { - std::shared_ptr aPnt( - new GeomAPI_Pnt(aXArr[i], aYArr[j], aZArr[k])); + for (double i : aXArr) { + for (double j : aYArr) { + for (double k : aZArr) { + std::shared_ptr aPnt(new GeomAPI_Pnt(i, j, k)); aResultPoints.push_back(aPnt); } } @@ -1051,7 +1048,7 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::fitPlaneToBox( return aResultFace; } - const TopoDS_Shape &aShape = thePlane->impl(); + const auto &aShape = thePlane->impl(); if (aShape.ShapeType() != TopAbs_FACE) { return aResultFace; } @@ -1076,10 +1073,8 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::fitPlaneToBox( IntAna_Quadric aQuadric(aFacePln); Standard_Real UMin, UMax, VMin, VMax; UMin = UMax = VMin = VMax = 0; - for (std::list>::const_iterator aPointsIt = - thePoints.begin(); - aPointsIt != thePoints.end(); aPointsIt++) { - const gp_Pnt &aPnt = (*aPointsIt)->impl(); + for (const auto &thePoint : thePoints) { + const auto &aPnt = thePoint->impl(); gp_Lin aLin(aPnt, aFacePln.Axis().Direction()); IntAna_IntConicQuad anIntAna(aLin, aQuadric); const gp_Pnt &aPntOnFace = anIntAna.Point(1); @@ -1117,7 +1112,7 @@ void GeomAlgoAPI_ShapeTools::findBounds( theV2 = aVertex; if (theShape) { - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); TopoDS_Vertex aV1, aV2; ShapeAnalysis::FindBounds(aShape, aV1, aV2); @@ -1141,9 +1136,8 @@ void GeomAlgoAPI_ShapeTools::makeFacesWithHoles( BRepAlgo_FaceRestrictor aFRestrictor; aFRestrictor.Init(aFace, Standard_False, Standard_True); - for (ListOfShape::const_iterator anIt = theWires.cbegin(); - anIt != theWires.cend(); ++anIt) { - TopoDS_Wire aWire = TopoDS::Wire((*anIt)->impl()); + for (const auto &theWire : theWires) { + TopoDS_Wire aWire = TopoDS::Wire(theWire->impl()); aFRestrictor.Add(aWire); } @@ -1167,9 +1161,8 @@ GeomAlgoAPI_ShapeTools::findPlane(const ListOfShape &theShapes) { BRep_Builder aBuilder; aBuilder.MakeCompound(aCompound); - for (ListOfShape::const_iterator anIt = theShapes.cbegin(); - anIt != theShapes.cend(); ++anIt) { - aBuilder.Add(aCompound, (*anIt)->impl()); + for (const auto &theShape : theShapes) { + aBuilder.Add(aCompound, theShape->impl()); } BRepBuilderAPI_FindPlane aFindPlane(aCompound); @@ -1199,8 +1192,8 @@ bool GeomAlgoAPI_ShapeTools::isSubShapeInsideShape( return false; } - const TopoDS_Shape &aSubShape = theSubShape->impl(); - const TopoDS_Shape &aBaseShape = theBaseShape->impl(); + const auto &aSubShape = theSubShape->impl(); + const auto &aBaseShape = theBaseShape->impl(); if (aSubShape.ShapeType() == TopAbs_VERTEX) { // If sub-shape is a vertex check distance to shape. If it is <= @@ -1408,7 +1401,7 @@ void GeomAlgoAPI_ShapeTools::splitShape( Standard_Real aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aBaseEdge, aFirst, aLast); - PointToRefsMap::const_iterator aPIt = thePointsInfo.begin(); + auto aPIt = thePointsInfo.begin(); std::shared_ptr aPnt = aPIt->first; gp_Pnt aPoint(aPnt->x(), aPnt->y(), aPnt->z()); @@ -1418,7 +1411,7 @@ void GeomAlgoAPI_ShapeTools::splitShape( } aBOP.AddArgument(aBaseEdge); - PointToRefsMap::const_iterator aPIt = thePointsInfo.begin(); + auto aPIt = thePointsInfo.begin(); for (; aPIt != thePointsInfo.end(); ++aPIt) { std::shared_ptr aPnt = aPIt->first; TopoDS_Vertex aV = @@ -1454,8 +1447,7 @@ void GeomAlgoAPI_ShapeTools::splitShape_p( Standard_Real aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aBaseEdge, aFirst, aLast); - std::list>::const_iterator aPIt = - thePoints.begin(); + auto aPIt = thePoints.begin(); gp_Pnt aPoint((*aPIt)->x(), (*aPIt)->y(), (*aPIt)->z()); TopAbs_Orientation anOrientation = aBaseEdge.Orientation(); @@ -1464,8 +1456,7 @@ void GeomAlgoAPI_ShapeTools::splitShape_p( } aBOP.AddArgument(aBaseEdge); - std::list>::const_iterator aPtIt = - thePoints.begin(); + auto aPtIt = thePoints.begin(); for (; aPtIt != thePoints.end(); ++aPtIt) { std::shared_ptr aPnt = *aPtIt; TopoDS_Vertex aV = @@ -1494,15 +1485,12 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::findShape( std::shared_ptr aResultShape; if (thePoints.size() == 2) { - std::list>::const_iterator aPntIt = - thePoints.begin(); + auto aPntIt = thePoints.begin(); std::shared_ptr aFirstPoint = *aPntIt; aPntIt++; std::shared_ptr aLastPoint = *aPntIt; - std::set>::const_iterator - anIt = theShapes.begin(), - aLast = theShapes.end(); + auto anIt = theShapes.begin(), aLast = theShapes.end(); for (; anIt != aLast; anIt++) { GeomShapePtr aShape = *anIt; std::shared_ptr anEdge(new GeomAPI_Edge(aShape)); @@ -1668,10 +1656,8 @@ getMinMaxPointsOnLine(const std::list> &thePoints, theMin = RealLast(); theMax = RealFirst(); // Project bounding points on theDir - for (std::list>::const_iterator aPointsIt = - thePoints.begin(); - aPointsIt != thePoints.end(); aPointsIt++) { - const gp_Pnt &aPnt = (*aPointsIt)->impl(); + for (const auto &thePoint : thePoints) { + const auto &aPnt = thePoint->impl(); gp_Dir aPntDir(aPnt.XYZ()); Standard_Real proj = (theDir * aPntDir) * aPnt.XYZ().Modulus(); if (proj < theMin) @@ -1729,9 +1715,7 @@ void GeomAlgoAPI_ShapeTools::computeThroughAll( theToSize = 0.0; theFromSize = 0.0; - for (ListOfShape::const_iterator anIt = theBaseShapes.begin(); - anIt != theBaseShapes.end(); ++anIt) { - const GeomShapePtr &aBaseShape_i = (*anIt); + for (const auto &aBaseShape_i : theBaseShapes) { ListOfShape aBaseShapes_i; aBaseShapes_i.push_back(aBaseShape_i); @@ -1745,7 +1729,7 @@ void GeomAlgoAPI_ShapeTools::computeThroughAll( // Direction (normal to aBaseShapes_i) // Code like in GeomAlgoAPI_Prism gp_Dir aDir; - const TopoDS_Shape &aBaseShape = aBaseShape_i->impl(); + const auto &aBaseShape = aBaseShape_i->impl(); BRepBuilderAPI_FindPlane aFindPlane(aBaseShape); if (aFindPlane.Found() == Standard_True) { Handle(Geom_Plane) aPlane; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp index ab8c65317..5f7be4df4 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp @@ -72,11 +72,10 @@ static TopoDS_Vertex findStartVertex( const std::list> &theInitialShapes) { // Try to find edge lying on the one of original edges. // First found edge will be taken as a start edge for the result wire - std::list>::const_iterator aFeatIt = - theInitialShapes.begin(); + auto aFeatIt = theInitialShapes.begin(); for (; aFeatIt != theInitialShapes.end(); aFeatIt++) { std::shared_ptr aShape(*aFeatIt); - const TopoDS_Edge &anEdge = aShape->impl(); + const auto &anEdge = aShape->impl(); if (anEdge.ShapeType() != TopAbs_EDGE) continue; @@ -185,11 +184,10 @@ sortAreas(TopTools_ListOfShape &theAreas, // collect indices of all edges to operate them quickly NCollection_DataMap aCurveToIndex; // curve -> index in initial shapes - std::list>::const_iterator aFeatIt = - theInitialShapes.begin(); + auto aFeatIt = theInitialShapes.begin(); for (int anIndex = 0; aFeatIt != theInitialShapes.end(); aFeatIt++) { std::shared_ptr aShape(*aFeatIt); - const TopoDS_Edge &anEdge = aShape->impl(); + const auto &anEdge = aShape->impl(); if (anEdge.ShapeType() != TopAbs_EDGE) continue; @@ -237,7 +235,7 @@ void GeomAlgoAPI_SketchBuilder::build( // Use General Fuse algorithm to prepare all subfaces, bounded by given list // of edges - BOPAlgo_Builder *aBB = new BOPAlgo_Builder; + auto *aBB = new BOPAlgo_Builder; aBB->AddArgument(aPlnFace); // Set fuzzy value for BOP, because PlaneGCS can solve the set of constraints // with the precision up to 5.e-5 if the sketch contains arcs. @@ -249,11 +247,10 @@ void GeomAlgoAPI_SketchBuilder::build( NCollection_List anEdges; NCollection_List::Iterator aShapeIt; - std::list>::const_iterator aFeatIt = - theEdges.begin(); + auto aFeatIt = theEdges.begin(); for (; aFeatIt != theEdges.end(); aFeatIt++) { std::shared_ptr aShape(*aFeatIt); - const TopoDS_Edge &anEdge = aShape->impl(); + const auto &anEdge = aShape->impl(); if (anEdge.ShapeType() == TopAbs_EDGE) aBB->AddArgument(anEdge); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.cpp index ca759b71c..3cdec6a78 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.cpp @@ -61,7 +61,7 @@ classifyMiddlePoint(BRepClass3d_SolidClassifier &theClassifier, if (theShape->shapeType() == GeomAPI_Shape::FACE) { // middle point may be out of face (within a hole), // in this case, find the nearest point on the face - const TopoDS_Face &aFace = theShape->impl(); + const auto &aFace = theShape->impl(); BRepClass_FaceClassifier aFaceClassifier(aFace, aPointOnFace, theTolerance); if (aFaceClassifier.State() == TopAbs_OUT) { BRepBuilderAPI_MakeVertex aVertex(aPointOnFace); @@ -159,8 +159,8 @@ classifyByDistance(BRepClass3d_SolidClassifier &theClassifier, GeomAlgoAPI_SolidClassifier::State aResult = GeomAlgoAPI_SolidClassifier::State_UNKNOWN; - const TopoDS_Shape &aSolid = theSolid->impl(); - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aSolid = theSolid->impl(); + const auto &aShape = theShape->impl(); for (TopExp_Explorer anExp(aSolid, TopAbs_SHELL); anExp.More(); anExp.Next()) { // compare distance from the shape to the solid's shells diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.h b/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.h index f2ac961e4..dc8682f6c 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SolidClassifier.h @@ -33,7 +33,7 @@ class GeomAPI_Solid; /// \brief Classify shape according to the given solid. class GeomAlgoAPI_SolidClassifier { public: - typedef int State; + using State = int; static const State State_UNKNOWN = 0x0; static const State State_IN = 0x1; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SortListOfShapes.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SortListOfShapes.cpp index aeed4a33a..3cf14170a 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SortListOfShapes.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SortListOfShapes.cpp @@ -127,9 +127,9 @@ class CompareShapes { } Bnd_Box boundingBox(const GeomShapePtr &theShape) { - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); TopoDS_TShape *aS = aShape.TShape().get(); - std::map::iterator aFound = myShapes.find(aS); + auto aFound = myShapes.find(aS); if (aFound == myShapes.end()) { Bnd_Box aBB; BRepBndLib::AddOptimal(aShape, aBB, false); @@ -141,8 +141,7 @@ class CompareShapes { Bnd_Box2d boundingBoxUV(const TopoDS_Face &theFace) { TopoDS_TShape *aFacePtr = theFace.TShape().get(); - std::map::iterator aFound = - myUVBounds.find(aFacePtr); + auto aFound = myUVBounds.find(aFacePtr); if (aFound == myUVBounds.end()) { Bnd_Box2d aBB; BRepTools::AddUVBounds(theFace, aBB); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.cpp index 774519521..b820f4142 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.cpp @@ -83,11 +83,10 @@ void GeomAlgoAPI_Sphere::build() { if (isRootGeo) { buildRootSphere(); } else { - const gp_Pnt &aCenterPoint = myCenterPoint->impl(); + const auto &aCenterPoint = myCenterPoint->impl(); // Construct the sphere - BRepPrimAPI_MakeSphere *aSphereMaker = - new BRepPrimAPI_MakeSphere(aCenterPoint, myRadius); + auto *aSphereMaker = new BRepPrimAPI_MakeSphere(aCenterPoint, myRadius); aSphereMaker->Build(); @@ -200,7 +199,7 @@ void GeomAlgoAPI_Sphere::buildRootSphere() { // Build the solid using the section face we've created and a revolution // builder - BRepPrimAPI_MakeRevol *aRevolBuilder = new BRepPrimAPI_MakeRevol( + auto *aRevolBuilder = new BRepPrimAPI_MakeRevol( aFaceBuilder.Face(), aZAxis, myPhiMax * M_PI / 180., Standard_True); if (!aRevolBuilder) { return; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp index a7f814318..a938c006b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Tools.cpp @@ -29,7 +29,7 @@ using namespace GeomAlgoAPI_Tools; Localizer::Localizer() { - myCurLocale = std::setlocale(LC_NUMERIC, 0); + myCurLocale = std::setlocale(LC_NUMERIC, nullptr); std::setlocale(LC_NUMERIC, "C"); } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Torus.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Torus.cpp index 492383ff8..a03438e62 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Torus.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Torus.cpp @@ -59,11 +59,10 @@ bool GeomAlgoAPI_Torus::check() { void GeomAlgoAPI_Torus::build() { myCreatedFaces.clear(); - const gp_Ax2 &anAxis = myAxis->impl(); + const auto &anAxis = myAxis->impl(); // Construct the torus - BRepPrimAPI_MakeTorus *aTorusMaker = - new BRepPrimAPI_MakeTorus(anAxis, myRadius, myRingRadius); + auto *aTorusMaker = new BRepPrimAPI_MakeTorus(anAxis, myRadius, myRingRadius); aTorusMaker->Build(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Torus.h b/src/GeomAlgoAPI/GeomAlgoAPI_Torus.h index a3833ba23..cf2623a21 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Torus.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Torus.h @@ -44,10 +44,10 @@ public: const double theRingRadius); /// Checks if data for the torus construction is OK. - GEOMALGOAPI_EXPORT bool check(); + GEOMALGOAPI_EXPORT bool check() override; /// Builds the torus. - GEOMALGOAPI_EXPORT void build(); + GEOMALGOAPI_EXPORT void build() override; private: std::shared_ptr myAxis; /// Axis of the torus. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp index 4d82d8fbe..760c1e13b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.cpp @@ -42,8 +42,8 @@ void GeomAlgoAPI_Transform::build(std::shared_ptr theSourceShape, return; } - const TopoDS_Shape &aSourceShape = theSourceShape->impl(); - const gp_Trsf &aTrsf = theTrsf->impl(); + const auto &aSourceShape = theSourceShape->impl(); + const auto &aTrsf = theTrsf->impl(); if (aSourceShape.IsNull()) { myError = @@ -51,8 +51,7 @@ void GeomAlgoAPI_Transform::build(std::shared_ptr theSourceShape, return; } - BRepBuilderAPI_Transform *aBuilder = - new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true); + auto *aBuilder = new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true); if (!aBuilder) return; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h index 541d58abc..c3b37a84d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Transform.h @@ -41,7 +41,7 @@ public: protected: /// \brief Default constructor (to be used in the derived classes) - GeomAlgoAPI_Transform() {} + GeomAlgoAPI_Transform() = default; /// Builds resulting shape. void build(std::shared_ptr theSourceShape, diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Tube.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Tube.cpp index 804e41e8f..1ef623d3d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Tube.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Tube.cpp @@ -35,7 +35,7 @@ #include //================================================================================================= -GeomAlgoAPI_Tube::GeomAlgoAPI_Tube() {} +GeomAlgoAPI_Tube::GeomAlgoAPI_Tube() = default; //================================================================================================= GeomAlgoAPI_Tube::GeomAlgoAPI_Tube(const double theRMin, const double theRMax, @@ -107,15 +107,13 @@ void GeomAlgoAPI_Tube::buildTube() { gp_Vec aVec(aNormal); gp_Trsf aTrsf; aTrsf.SetTranslation(aVec * -myZ / 2); - BRepBuilderAPI_Transform *aTranformBuilder = - new BRepBuilderAPI_Transform(aFace, aTrsf); + auto *aTranformBuilder = new BRepBuilderAPI_Transform(aFace, aTrsf); if (!aTranformBuilder || !aTranformBuilder->IsDone()) { myError = "Tube builder :: algorithm failed"; return; } TopoDS_Shape aMovedBase = aTranformBuilder->Shape(); - BRepPrimAPI_MakePrism *aPrismBuilder = - new BRepPrimAPI_MakePrism(aMovedBase, aVec * myZ); + auto *aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, aVec * myZ); std::shared_ptr aShape = std::shared_ptr(new GeomAPI_Shape()); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Tube.h b/src/GeomAlgoAPI/GeomAlgoAPI_Tube.h index 7c6506658..c64aabedd 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Tube.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Tube.h @@ -39,10 +39,10 @@ public: const double theRMax, const double theZ); /// Checks if data for the torus construction is OK. - GEOMALGOAPI_EXPORT bool check(); + GEOMALGOAPI_EXPORT bool check() override; /// Builds the torus. - GEOMALGOAPI_EXPORT void build(); + GEOMALGOAPI_EXPORT void build() override; private: /// Builds the the tube with the inside radius, the outside radius and the diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp index 0b52f0151..cca18df68 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.cpp @@ -64,7 +64,7 @@ void GeomAlgoAPI_UnifySameDomain::build(const ListOfShape &theShapes) { return; } - const TopoDS_Shape &aShell = aResults.front()->impl(); + const auto &aShell = aResults.front()->impl(); std::shared_ptr aShape(new GeomAPI_Shape()); aShape->setImpl(new TopoDS_Shape(aShell)); @@ -87,10 +87,10 @@ static Standard_Real defineLinearTolerance(const TopoDS_Shape &theShape) { //================================================================================================== void GeomAlgoAPI_UnifySameDomain::build(const GeomShapePtr &theShape, const bool theIsToSimplifyShell) { - ShapeUpgrade_UnifySameDomain *aUnifyAlgo = new ShapeUpgrade_UnifySameDomain(); + auto *aUnifyAlgo = new ShapeUpgrade_UnifySameDomain(); this->setImpl(aUnifyAlgo); - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); aUnifyAlgo->Initialize(aShape, Standard_True, Standard_True, Standard_True); aUnifyAlgo->SetLinearTolerance(defineLinearTolerance(aShape)); aUnifyAlgo->SetAngularTolerance(1.e-5); // for #32443 @@ -131,9 +131,8 @@ void GeomAlgoAPI_UnifySameDomain::modified( return; } - const TopoDS_Shape &aShape = theShape->impl(); - const ShapeUpgrade_UnifySameDomain &aUnifyAlgo = - this->impl(); + const auto &aShape = theShape->impl(); + const auto &aUnifyAlgo = this->impl(); for (int aIsModified = 0; aIsModified <= 1; aIsModified++) { if (!aUnifyAlgo.History()->IsSupportedType( diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.h b/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.h index 47e102a53..462e229b5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_UnifySameDomain.h @@ -41,9 +41,9 @@ public: /// \return the list of shapes modified from the shape \a theShape. /// \param[in] theShape base shape. /// \param[out] theHistory modified shapes. - GEOMALGOAPI_EXPORT virtual void + GEOMALGOAPI_EXPORT void modified(const std::shared_ptr theShape, - ListOfShape &theHistory); + ListOfShape &theHistory) override; private: /// Builds resulting shape from list of shapes. diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp index fd8d7d724..03e3d0d32 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp @@ -62,12 +62,11 @@ public: Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast); bool isAdded = true; - std::map::iterator aFound = - myShapes.find(aCurve); + auto aFound = myShapes.find(aCurve); if (aFound == myShapes.end()) myShapes[aCurve][aFirst].insert(aLast); else { - ParamMap::iterator aFoundPar = aFound->second.find(aFirst); + auto aFoundPar = aFound->second.find(aFirst); if (aFoundPar == aFound->second.end()) aFound->second[aFirst].insert(aLast); else if (aFoundPar->second.find(aLast) == aFoundPar->second.end()) @@ -106,7 +105,7 @@ GeomAlgoAPI_WireBuilder::GeomAlgoAPI_WireBuilder(const ListOfShape &theShapes, TopTools_ListOfShape aListOfEdges; SetOfEdges aProcessedEdges; - ListOfShape::const_iterator anIt = theShapes.cbegin(); + auto anIt = theShapes.cbegin(); for (; anIt != theShapes.cend(); ++anIt) { TopoDS_Shape aShape = (*anIt)->impl(); switch (aShape.ShapeType()) { @@ -160,7 +159,7 @@ GeomAlgoAPI_WireBuilder::GeomAlgoAPI_WireBuilder(const ListOfShape &theShapes, } } - BRepBuilderAPI_MakeWire *aWireBuilder = new BRepBuilderAPI_MakeWire; + auto *aWireBuilder = new BRepBuilderAPI_MakeWire; aWireBuilder->Add(aListOfEdges); if (aWireBuilder->Error() == BRepBuilderAPI_WireDone) { setImpl(aWireBuilder); @@ -249,8 +248,7 @@ bool GeomAlgoAPI_WireBuilder::isSelfIntersected(const GeomShapePtr &theWire) { for (int i = 0; anEdgesIt != anEdges.end(); ++anEdgesIt, i++) { GeomEdgePtr anEdge1(new GeomAPI_Edge(*anEdgesIt)); - std::list::const_iterator anOtherEdgesIt = - std::next(anEdgesIt); + auto anOtherEdgesIt = std::next(anEdgesIt); for (int j = i + 1; anOtherEdgesIt != anEdges.end(); ++anOtherEdgesIt, j++) { GeomEdgePtr anEdge2(new GeomAPI_Edge(*anOtherEdgesIt)); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.cpp index 4887e84b9..566cff66a 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_XAOExport.cpp @@ -37,7 +37,7 @@ bool SetShapeToXAO(const std::shared_ptr &theShape, TopoDS_Shape aShape = theShape->impl(); try { - XAO::BrepGeometry *aGeometry = new XAO::BrepGeometry; + auto *aGeometry = new XAO::BrepGeometry; theXao->setGeometry(aGeometry); aGeometry->setTopoDS_Shape(aShape); } catch (XAO::XAO_Exception &e) { @@ -64,8 +64,7 @@ bool XAOExport(const std::string &theFileName, XAO::Xao *theXao, } try { - XAO::BrepGeometry *aGeometry = - dynamic_cast(theXao->getGeometry()); + auto *aGeometry = dynamic_cast(theXao->getGeometry()); TopoDS_Shape aShape = aGeometry->getTopoDS_Shape(); bool aWasFree = aShape.Free(); // make top level topology free, same as imported @@ -99,8 +98,7 @@ const std::string XAOExportMem(XAO::Xao *theXao, std::string &theError) { } try { - XAO::BrepGeometry *aGeometry = - dynamic_cast(theXao->getGeometry()); + auto *aGeometry = dynamic_cast(theXao->getGeometry()); TopoDS_Shape aShape = aGeometry->getTopoDS_Shape(); bool aWasFree = aShape.Free(); // make top level topology free, same as imported diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.cpp index 927711e0c..a609b1b61 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_XAOImport.cpp @@ -47,8 +47,7 @@ std::shared_ptr XAOImport(const std::string &theFileName, XAO::Geometry *aGeometry = theXao->getGeometry(); XAO::Format aFormat = aGeometry->getFormat(); if (aFormat == XAO::BREP) { - if (XAO::BrepGeometry *aBrepGeometry = - dynamic_cast(aGeometry)) + if (auto *aBrepGeometry = dynamic_cast(aGeometry)) aShape = aBrepGeometry->getTopoDS_Shape(); } else { theError = "Unsupported XAO geometry format:" + @@ -91,8 +90,7 @@ std::shared_ptr XAOImportMem(const std::string &theMemoryBuff, XAO::Geometry *aGeometry = theXao->getGeometry(); XAO::Format aFormat = aGeometry->getFormat(); if (aFormat == XAO::BREP) { - if (XAO::BrepGeometry *aBrepGeometry = - dynamic_cast(aGeometry)) + if (auto *aBrepGeometry = dynamic_cast(aGeometry)) aShape = aBrepGeometry->getTopoDS_Shape(); } else { theError = "Unsupported XAO geometry format:" + diff --git a/src/GeomAlgoImpl/GEOMAlgo_Algo.cxx b/src/GeomAlgoImpl/GEOMAlgo_Algo.cxx index 9404795c3..a76caa311 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Algo.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Algo.cxx @@ -33,14 +33,14 @@ // purpose: //======================================================================= GEOMAlgo_Algo::GEOMAlgo_Algo() - : myErrorStatus(1), myWarningStatus(0), - myComputeInternalShapes(Standard_True) {} + +{} //======================================================================= // function: ~ // purpose: //======================================================================= -GEOMAlgo_Algo::~GEOMAlgo_Algo() {} +GEOMAlgo_Algo::~GEOMAlgo_Algo() = default; //======================================================================= // function: CheckData diff --git a/src/GeomAlgoImpl/GEOMAlgo_Algo.hxx b/src/GeomAlgoImpl/GEOMAlgo_Algo.hxx index 8625f784a..54ff16db4 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Algo.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Algo.hxx @@ -62,9 +62,9 @@ protected: GEOMALGOIMPL_EXPORT virtual void CheckResult(); - Standard_Integer myErrorStatus; - Standard_Integer myWarningStatus; - Standard_Boolean myComputeInternalShapes; + Standard_Integer myErrorStatus{1}; + Standard_Integer myWarningStatus{0}; + Standard_Boolean myComputeInternalShapes{Standard_True}; }; #endif diff --git a/src/GeomAlgoImpl/GEOMAlgo_AlgoTools.cxx b/src/GeomAlgoImpl/GEOMAlgo_AlgoTools.cxx index 17ecd2d53..df6ba96b8 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_AlgoTools.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_AlgoTools.cxx @@ -1264,7 +1264,7 @@ void ModifyFacesForGlobalResult( TopoDS_Shape &theRes, TopoDS_Shape &theGlobalRes, TopTools_MapOfShape &theRemovedFaces) { BRep_Builder aBB; - const Standard_Integer aNbFaces = (Standard_Integer)theFacesAndAreas.size(); + const auto aNbFaces = (Standard_Integer)theFacesAndAreas.size(); const Standard_Integer aDiff = theNbExtremalFaces - theRemovedFaces.Extent(); diff --git a/src/GeomAlgoImpl/GEOMAlgo_BndSphere.cxx b/src/GeomAlgoImpl/GEOMAlgo_BndSphere.cxx index 6d4d0ff52..045bef760 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_BndSphere.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_BndSphere.cxx @@ -38,7 +38,7 @@ GEOMAlgo_BndSphere::GEOMAlgo_BndSphere() { // function : ~ // purpose : //======================================================================= -GEOMAlgo_BndSphere::~GEOMAlgo_BndSphere() {} +GEOMAlgo_BndSphere::~GEOMAlgo_BndSphere() = default; //======================================================================= // function : IsOut // purpose : diff --git a/src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.cxx b/src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.cxx index 32072dcaa..115d90e4e 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_CoupleOfShapes.cxx @@ -30,7 +30,7 @@ // function : GEOMAlgo_CoupleOfShapes // purpose : //======================================================================= -GEOMAlgo_CoupleOfShapes::GEOMAlgo_CoupleOfShapes() {} +GEOMAlgo_CoupleOfShapes::GEOMAlgo_CoupleOfShapes() = default; //======================================================================= // function : SetShapes // purpose : diff --git a/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.cxx b/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.cxx index 0d48f6c44..f42fb5dcc 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.cxx @@ -84,7 +84,7 @@ GEOMAlgo_GlueDetector::GEOMAlgo_GlueDetector() // function : ~ // purpose : //======================================================================= -GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector() {} +GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector() = default; //======================================================================= // function : StickedShapes diff --git a/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.hxx b/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.hxx index 4a01e621b..eff3442eb 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_GlueDetector.hxx @@ -47,9 +47,9 @@ class GEOMAlgo_GlueDetector : public GEOMAlgo_GluerAlgo, public GEOMAlgo_Algo { public: GEOMALGOIMPL_EXPORT GEOMAlgo_GlueDetector(); - GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_GlueDetector(); + GEOMALGOIMPL_EXPORT ~GEOMAlgo_GlueDetector() override; - GEOMALGOIMPL_EXPORT virtual void Perform(); + GEOMALGOIMPL_EXPORT void Perform() override; GEOMALGOIMPL_EXPORT const TopTools_IndexedDataMapOfShapeListOfShape & StickedShapes(); diff --git a/src/GeomAlgoImpl/GEOMAlgo_Gluer2.cxx b/src/GeomAlgoImpl/GEOMAlgo_Gluer2.cxx index efee615c8..f51bc6246 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Gluer2.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Gluer2.cxx @@ -63,7 +63,7 @@ GEOMAlgo_Gluer2::GEOMAlgo_Gluer2() // function : ~GEOMAlgo_Gluer2 // purpose : //======================================================================= -GEOMAlgo_Gluer2::~GEOMAlgo_Gluer2() {} +GEOMAlgo_Gluer2::~GEOMAlgo_Gluer2() = default; //======================================================================= // function : Clear diff --git a/src/GeomAlgoImpl/GEOMAlgo_Gluer2.hxx b/src/GeomAlgoImpl/GEOMAlgo_Gluer2.hxx index a89e431cd..7c6dd83c6 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Gluer2.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Gluer2.hxx @@ -53,7 +53,7 @@ class GEOMAlgo_Gluer2 : public GEOMAlgo_GluerAlgo, public: GEOMALGOIMPL_EXPORT GEOMAlgo_Gluer2(); - GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_Gluer2(); + GEOMALGOIMPL_EXPORT ~GEOMAlgo_Gluer2() override; GEOMALGOIMPL_EXPORT void SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape &aM); @@ -65,11 +65,11 @@ public: GEOMALGOIMPL_EXPORT Standard_Boolean KeepNonSolids() const; - GEOMALGOIMPL_EXPORT virtual void Clear(); + GEOMALGOIMPL_EXPORT void Clear() override; - GEOMALGOIMPL_EXPORT virtual void Perform(); + GEOMALGOIMPL_EXPORT void Perform() override; - GEOMALGOIMPL_EXPORT virtual void CheckData(); + GEOMALGOIMPL_EXPORT void CheckData() override; GEOMALGOIMPL_EXPORT void Detect(); @@ -79,14 +79,14 @@ public: GEOMALGOIMPL_EXPORT const TopTools_DataMapOfShapeListOfShape & ImagesToWork() const; - GEOMALGOIMPL_EXPORT virtual const TopTools_ListOfShape & - Generated(const TopoDS_Shape &theS); + GEOMALGOIMPL_EXPORT const TopTools_ListOfShape & + Generated(const TopoDS_Shape &theS) override; - GEOMALGOIMPL_EXPORT virtual const TopTools_ListOfShape & - Modified(const TopoDS_Shape &theS); + GEOMALGOIMPL_EXPORT const TopTools_ListOfShape & + Modified(const TopoDS_Shape &theS) override; - GEOMALGOIMPL_EXPORT virtual Standard_Boolean - IsDeleted(const TopoDS_Shape &theS); + GEOMALGOIMPL_EXPORT Standard_Boolean + IsDeleted(const TopoDS_Shape &theS) override; GEOMALGOIMPL_EXPORT static void MakeVertex(const TopTools_ListOfShape &theLV, TopoDS_Vertex &theV); @@ -120,7 +120,7 @@ protected: GEOMALGOIMPL_EXPORT void FillContainers(const TopAbs_ShapeEnum theType); GEOMALGOIMPL_EXPORT void FillCompound(const TopoDS_Shape &theC); - GEOMALGOIMPL_EXPORT virtual void PrepareHistory(); + GEOMALGOIMPL_EXPORT void PrepareHistory() override; GEOMALGOIMPL_EXPORT Standard_Boolean HasImage(const TopoDS_Shape &theC); diff --git a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx index 64253af36..9f4f59fcd 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfIntegerShape.hxx @@ -32,9 +32,9 @@ #define _NCollection_MapHasher #include -typedef NCollection_IndexedDataMap - GEOMAlgo_IndexedDataMapOfIntegerShape; +using GEOMAlgo_IndexedDataMapOfIntegerShape = + NCollection_IndexedDataMap; #undef _NCollection_MapHasher diff --git a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx index bcbe2dc4e..c99c0f737 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx @@ -32,9 +32,9 @@ #define _NCollection_MapHasher #include -typedef NCollection_IndexedDataMap - GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape; +using GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape = + NCollection_IndexedDataMap; #undef _NCollection_MapHasher diff --git a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx index 597c9876f..d7f187497 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx @@ -33,9 +33,9 @@ #define _NCollection_MapHasher #include -typedef NCollection_IndexedDataMap - GEOMAlgo_IndexedDataMapOfShapeBndSphere; +using GEOMAlgo_IndexedDataMapOfShapeBndSphere = + NCollection_IndexedDataMap; #undef _NCollection_MapHasher diff --git a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx index 4b9da8973..cb5b700d4 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx @@ -36,9 +36,9 @@ #define _NCollection_MapHasher #include -typedef NCollection_IndexedDataMap - GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape; +using GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape = + NCollection_IndexedDataMap; #undef _NCollection_MapHasher diff --git a/src/GeomAlgoImpl/GEOMAlgo_ListOfCoupleOfShapes.hxx b/src/GeomAlgoImpl/GEOMAlgo_ListOfCoupleOfShapes.hxx index ca4a36780..c8ea32362 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_ListOfCoupleOfShapes.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_ListOfCoupleOfShapes.hxx @@ -29,8 +29,8 @@ #include #include -typedef NCollection_List GEOMAlgo_ListOfCoupleOfShapes; -typedef GEOMAlgo_ListOfCoupleOfShapes::Iterator - GEOMAlgo_ListIteratorOfListOfCoupleOfShapes; +using GEOMAlgo_ListOfCoupleOfShapes = NCollection_List; +using GEOMAlgo_ListIteratorOfListOfCoupleOfShapes = + GEOMAlgo_ListOfCoupleOfShapes::Iterator; #endif diff --git a/src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.cxx b/src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.cxx index cf654f03a..2f83178ca 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_PassKeyShape.cxx @@ -53,7 +53,7 @@ GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape( // function :~ // purpose : //======================================================================= -GEOMAlgo_PassKeyShape::~GEOMAlgo_PassKeyShape() {} +GEOMAlgo_PassKeyShape::~GEOMAlgo_PassKeyShape() = default; //======================================================================= // function :Assign // purpose : diff --git a/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx b/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx index 4fe4902f9..8d3992f98 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Splitter.cxx @@ -55,7 +55,7 @@ GEOMAlgo_Splitter::GEOMAlgo_Splitter(const Handle(NCollection_BaseAllocator) & // function : ~ // purpose : //======================================================================= -GEOMAlgo_Splitter::~GEOMAlgo_Splitter() {} +GEOMAlgo_Splitter::~GEOMAlgo_Splitter() = default; //======================================================================= // function : AddTool // purpose : @@ -268,7 +268,7 @@ void TreatCompound(const TopoDS_Shape &aC1, TopoDS_Iterator aItC; // aLC.Append(aC1); - while (1) { + while (true) { aLC1.Clear(); aIt.Initialize(aLC); for (; aIt.More(); aIt.Next()) { diff --git a/src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx b/src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx index db34aad7f..05245fd78 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Splitter.hxx @@ -57,7 +57,7 @@ public: GEOMALGOIMPL_EXPORT GEOMAlgo_Splitter(const Handle(NCollection_BaseAllocator) & theAllocator); - GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_Splitter(); + GEOMALGOIMPL_EXPORT ~GEOMAlgo_Splitter() override; /// Add a tool shape /// \param theShape a tool shape @@ -81,16 +81,16 @@ public: GEOMALGOIMPL_EXPORT Standard_Integer LimitMode() const; /// Clears all tool shapes - GEOMALGOIMPL_EXPORT virtual void Clear(); + GEOMALGOIMPL_EXPORT void Clear() override; protected: /// Build result. /// \param theType a type of limit - GEOMALGOIMPL_EXPORT virtual void BuildResult(const TopAbs_ShapeEnum theType); + GEOMALGOIMPL_EXPORT void BuildResult(const TopAbs_ShapeEnum theType) override; /// Post processing of the calculation #if OCC_VERSION_LARGE < 0x07070000 - GEOMALGOIMPL_EXPORT virtual void PostTreat(); + GEOMALGOIMPL_EXPORT void PostTreat() override; #else GEOMALGOIMPL_EXPORT virtual void PostTreat(const Message_ProgressRange &theRange); diff --git a/src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx b/src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx index 451049894..125998daa 100644 --- a/src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx +++ b/src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx @@ -238,7 +238,7 @@ void GEOMImpl_Fillet1d::fillPoint(GEOMImpl_Fillet1dPoint *thePoint) { void GEOMImpl_Fillet1d::fillDiff(GEOMImpl_Fillet1dPoint *thePoint, Standard_Real theDiffStep, Standard_Boolean theFront) { - GEOMImpl_Fillet1dPoint *aDiff = new GEOMImpl_Fillet1dPoint( + auto *aDiff = new GEOMImpl_Fillet1dPoint( thePoint->GetParam() + (theFront ? (theDiffStep) : (-theDiffStep))); fillPoint(aDiff); if (!thePoint->ComputeDifference(aDiff)) { @@ -387,7 +387,7 @@ void GEOMImpl_Fillet1d::performInterval(const Standard_Real theStart, Standard_Integer aCycle; for (aCycle = 2, myStartSide = Standard_False; aCycle; myStartSide = !myStartSide, aCycle--) { - GEOMImpl_Fillet1dPoint *aLeft = NULL, *aRight = NULL; + GEOMImpl_Fillet1dPoint *aLeft = nullptr, *aRight = nullptr; for (aParam = theStart + aStep; aParam < theEnd || fabs(theEnd - aParam) < Precision::Confusion(); @@ -444,7 +444,7 @@ GEOMImpl_Fillet1d::processPoint(GEOMImpl_Fillet1dPoint *theLeft, } GEOMImpl_Fillet1dPoint *aPoint1 = theLeft->Copy(); - GEOMImpl_Fillet1dPoint *aPoint2 = new GEOMImpl_Fillet1dPoint(theParameter); + auto *aPoint2 = new GEOMImpl_Fillet1dPoint(theParameter); fillPoint(aPoint2); fillDiff(aPoint2, diffx, Standard_True); @@ -564,10 +564,10 @@ TopoDS_Edge GEOMImpl_Fillet1d::Result(const gp_Pnt &thePoint, GEOMImpl_Fillet1dPoint *aNearest; Standard_Integer a; TColStd_ListIteratorOfListOfReal anIter(myResultParams); - for (aNearest = NULL, a = 1; anIter.More(); anIter.Next(), a++) { + for (aNearest = nullptr, a = 1; anIter.More(); anIter.Next(), a++) { myStartSide = (myResultOrientation.Value(a)) ? Standard_True : Standard_False; - GEOMImpl_Fillet1dPoint *aPoint = new GEOMImpl_Fillet1dPoint(anIter.Value()); + auto *aPoint = new GEOMImpl_Fillet1dPoint(anIter.Value()); fillPoint(aPoint); if (!aPoint->HasSolution(myRadius)) continue; @@ -826,7 +826,7 @@ void GEOMImpl_Fillet1dPoint::FilterPoints(GEOMImpl_Fillet1dPoint *thePoint) { // purpose : //======================================================================= GEOMImpl_Fillet1dPoint *GEOMImpl_Fillet1dPoint::Copy() { - GEOMImpl_Fillet1dPoint *aCopy = new GEOMImpl_Fillet1dPoint(myParam); + auto *aCopy = new GEOMImpl_Fillet1dPoint(myParam); Standard_Integer a; for (a = 1; a <= myV.Length(); a++) { aCopy->myV.Append(myV.Value(a)); diff --git a/src/GeomData/GeomData_Dir.h b/src/GeomData/GeomData_Dir.h index f2bd302b8..4633d750f 100644 --- a/src/GeomData/GeomData_Dir.h +++ b/src/GeomData/GeomData_Dir.h @@ -40,35 +40,35 @@ class GeomData_Dir : public GeomDataAPI_Dir { myCoords; ///< X, Y and Z doubles as real array attribute [0; 2] public: /// Defines the double value - GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, - const double theZ); + GEOMDATA_EXPORT void setValue(const double theX, const double theY, + const double theZ) override; /// Defines the direction - GEOMDATA_EXPORT virtual void - setValue(const std::shared_ptr &theDir); + GEOMDATA_EXPORT void + setValue(const std::shared_ptr &theDir) override; /// Returns the X double value - GEOMDATA_EXPORT virtual double x() const; + GEOMDATA_EXPORT double x() const override; /// Returns the Y double value - GEOMDATA_EXPORT virtual double y() const; + GEOMDATA_EXPORT double y() const override; /// Returns the Z double value - GEOMDATA_EXPORT virtual double z() const; + GEOMDATA_EXPORT double z() const override; /// Returns the direction of this attribute - GEOMDATA_EXPORT virtual std::shared_ptr dir(); + GEOMDATA_EXPORT std::shared_ptr dir() override; /// Returns the coordinates of this attribute - GEOMDATA_EXPORT virtual std::shared_ptr xyz(); + GEOMDATA_EXPORT std::shared_ptr xyz() override; /// Returns \c ture if the direction is initialized - GEOMDATA_EXPORT virtual bool isInitialized(); + GEOMDATA_EXPORT bool isInitialized() override; /// Resets attribute to default state. - GEOMDATA_EXPORT virtual void reset(); + GEOMDATA_EXPORT void reset() override; protected: /// Initializes attributes GEOMDATA_EXPORT GeomData_Dir(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_Data; }; diff --git a/src/GeomData/GeomData_Point.cpp b/src/GeomData/GeomData_Point.cpp index 35945e623..5489d1cc0 100644 --- a/src/GeomData/GeomData_Point.cpp +++ b/src/GeomData/GeomData_Point.cpp @@ -33,10 +33,9 @@ GeomData_Point::GeomData_Point() { myIsInitialized = false; } void GeomData_Point::reinit() { myIsInitialized = true; - for (int aComponent = 0; aComponent < NUM_COMPONENTS; ++aComponent) { - myExpression[aComponent]->reinit(); - myIsInitialized = - myIsInitialized && myExpression[aComponent]->isInitialized(); + for (auto &aComponent : myExpression) { + aComponent->reinit(); + myIsInitialized = myIsInitialized && aComponent->isInitialized(); } } diff --git a/src/GeomData/GeomData_Point.h b/src/GeomData/GeomData_Point.h index 9f266d77f..565ac83fc 100644 --- a/src/GeomData/GeomData_Point.h +++ b/src/GeomData/GeomData_Point.h @@ -39,78 +39,78 @@ class GeomData_Point : public GeomDataAPI_Point { public: /// Defines the double value - GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, - const double theZ); + GEOMDATA_EXPORT void setValue(const double theX, const double theY, + const double theZ) override; /// Defines the point - GEOMDATA_EXPORT virtual void - setValue(const std::shared_ptr &thePoint); + GEOMDATA_EXPORT void + setValue(const std::shared_ptr &thePoint) override; /// Returns the X double value - GEOMDATA_EXPORT virtual double x() const; + GEOMDATA_EXPORT double x() const override; /// Returns the Y double value - GEOMDATA_EXPORT virtual double y() const; + GEOMDATA_EXPORT double y() const override; /// Returns the Z double value - GEOMDATA_EXPORT virtual double z() const; + GEOMDATA_EXPORT double z() const override; /// Defines the X coordinate value - GEOMDATA_EXPORT void setX(const double theX); + GEOMDATA_EXPORT void setX(const double theX) override; /// Defines the Y coordinate value - GEOMDATA_EXPORT void setY(const double theY); + GEOMDATA_EXPORT void setY(const double theY) override; /// Defines the Z coordinate value - GEOMDATA_EXPORT void setZ(const double theZ); + GEOMDATA_EXPORT void setZ(const double theZ) override; /// Returns the 3D point - GEOMDATA_EXPORT virtual std::shared_ptr pnt(); + GEOMDATA_EXPORT std::shared_ptr pnt() override; /// Defines the calculated double value - GEOMDATA_EXPORT virtual void - setCalculatedValue(const double theX, const double theY, const double theZ); + GEOMDATA_EXPORT void setCalculatedValue(const double theX, const double theY, + const double theZ) override; /// Defines the text values - GEOMDATA_EXPORT virtual void setText(const std::wstring &theX, - const std::wstring &theY, - const std::wstring &theZ); + GEOMDATA_EXPORT void setText(const std::wstring &theX, + const std::wstring &theY, + const std::wstring &theZ) override; /// Defines the X text value - GEOMDATA_EXPORT virtual void setTextX(const std::wstring &theX); + GEOMDATA_EXPORT void setTextX(const std::wstring &theX) override; /// Defines the Y text value - GEOMDATA_EXPORT virtual void setTextY(const std::wstring &theY); + GEOMDATA_EXPORT void setTextY(const std::wstring &theY) override; /// Defines the Z text value - GEOMDATA_EXPORT virtual void setTextZ(const std::wstring &theZ); + GEOMDATA_EXPORT void setTextZ(const std::wstring &theZ) override; /// Returns the X text value - GEOMDATA_EXPORT virtual std::wstring textX(); + GEOMDATA_EXPORT std::wstring textX() override; /// Returns the Y text value - GEOMDATA_EXPORT virtual std::wstring textY(); + GEOMDATA_EXPORT std::wstring textY() override; /// Returns the Z text value - GEOMDATA_EXPORT virtual std::wstring textZ(); + GEOMDATA_EXPORT std::wstring textZ() override; /// Allows to set expression (text) as invalid (by the parameters listener) - GEOMDATA_EXPORT virtual void setExpressionInvalid(int, const bool theFlag); + GEOMDATA_EXPORT void setExpressionInvalid(int, const bool theFlag) override; /// Returns true if text is invalid - GEOMDATA_EXPORT virtual bool expressionInvalid(int); + GEOMDATA_EXPORT bool expressionInvalid(int) override; /// Allows to set expression (text) error (by the parameters listener) - GEOMDATA_EXPORT virtual void setExpressionError(int theComponent, - const std::string &theError); + GEOMDATA_EXPORT void setExpressionError(int theComponent, + const std::string &theError) override; /// Returns an expression error - GEOMDATA_EXPORT virtual std::string expressionError(int theComponent); + GEOMDATA_EXPORT std::string expressionError(int theComponent) override; /// Defines the used parameters - GEOMDATA_EXPORT virtual void + GEOMDATA_EXPORT void setUsedParameters(int theComponent, - const std::set &theUsedParameters); + const std::set &theUsedParameters) override; /// Returns the used parameters - GEOMDATA_EXPORT virtual std::set - usedParameters(int theComponent) const; + GEOMDATA_EXPORT std::set + usedParameters(int theComponent) const override; protected: /// Initializes attributes GEOMDATA_EXPORT GeomData_Point(); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_Data; }; diff --git a/src/GeomData/GeomData_Point2D.cpp b/src/GeomData/GeomData_Point2D.cpp index 766c1adec..c898f3b5d 100644 --- a/src/GeomData/GeomData_Point2D.cpp +++ b/src/GeomData/GeomData_Point2D.cpp @@ -33,17 +33,16 @@ GeomData_Point2D::GeomData_Point2D() { myIsInitialized = false; } void GeomData_Point2D::reinit() { myIsInitialized = true; - for (int aComponent = 0; aComponent < NUM_COMPONENTS; ++aComponent) { - myExpression[aComponent]->reinit(); - myIsInitialized = - myIsInitialized && myExpression[aComponent]->isInitialized(); + for (auto &aComponent : myExpression) { + aComponent->reinit(); + myIsInitialized = myIsInitialized && aComponent->isInitialized(); } } void GeomData_Point2D::reset() { myIsInitialized = false; - for (int aComponent = 0; aComponent < NUM_COMPONENTS; ++aComponent) { - myExpression[aComponent]->reset(); + for (auto &aComponent : myExpression) { + aComponent->reset(); } } diff --git a/src/GeomData/GeomData_Point2D.h b/src/GeomData/GeomData_Point2D.h index f2aa69f81..fd5133974 100644 --- a/src/GeomData/GeomData_Point2D.h +++ b/src/GeomData/GeomData_Point2D.h @@ -39,61 +39,61 @@ class GeomData_Point2D : public GeomDataAPI_Point2D { myExpression[NUM_COMPONENTS]; ///< Expressions for X, Y public: /// Defines the double value - GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY); + GEOMDATA_EXPORT void setValue(const double theX, const double theY) override; /// Defines the point - GEOMDATA_EXPORT virtual void - setValue(const std::shared_ptr &thePoint); + GEOMDATA_EXPORT void + setValue(const std::shared_ptr &thePoint) override; /// Returns the X double value - GEOMDATA_EXPORT virtual double x() const; + GEOMDATA_EXPORT double x() const override; /// Returns the Y double value - GEOMDATA_EXPORT virtual double y() const; + GEOMDATA_EXPORT double y() const override; /// Returns the 2D point - GEOMDATA_EXPORT virtual std::shared_ptr pnt(); + GEOMDATA_EXPORT std::shared_ptr pnt() override; /// Defines the calculated double value - GEOMDATA_EXPORT virtual void setCalculatedValue(const double theX, - const double theY); + GEOMDATA_EXPORT void setCalculatedValue(const double theX, + const double theY) override; /// Defines the text values - GEOMDATA_EXPORT virtual void setText(const std::wstring &theX, - const std::wstring &theY); + GEOMDATA_EXPORT void setText(const std::wstring &theX, + const std::wstring &theY) override; /// Returns the text values - GEOMDATA_EXPORT virtual std::wstring textX(); - GEOMDATA_EXPORT virtual std::wstring textY(); + GEOMDATA_EXPORT std::wstring textX() override; + GEOMDATA_EXPORT std::wstring textY() override; /// Allows to set expression (text) as invalid (by the parameters listener) - GEOMDATA_EXPORT virtual void setExpressionInvalid(int, const bool theFlag); + GEOMDATA_EXPORT void setExpressionInvalid(int, const bool theFlag) override; /// Returns true if text is invalid - GEOMDATA_EXPORT virtual bool expressionInvalid(int); + GEOMDATA_EXPORT bool expressionInvalid(int) override; /// Allows to set expression (text) error (by the parameters listener) - GEOMDATA_EXPORT virtual void setExpressionError(int theComponent, - const std::string &theError); + GEOMDATA_EXPORT void setExpressionError(int theComponent, + const std::string &theError) override; /// Returns an expression error - GEOMDATA_EXPORT virtual std::string expressionError(int theComponent); + GEOMDATA_EXPORT std::string expressionError(int theComponent) override; /// Defines the used parameters - GEOMDATA_EXPORT virtual void + GEOMDATA_EXPORT void setUsedParameters(int theComponent, - const std::set &theUsedParameters); + const std::set &theUsedParameters) override; /// Returns the used parameters - GEOMDATA_EXPORT virtual std::set - usedParameters(int theComponent) const; + GEOMDATA_EXPORT std::set + usedParameters(int theComponent) const override; protected: /// Initializes attributes GEOMDATA_EXPORT GeomData_Point2D(); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; /// Resets attribute to deafult state. - virtual void reset(); + void reset() override; friend class Model_Data; }; diff --git a/src/GeomData/GeomData_Point2DArray.h b/src/GeomData/GeomData_Point2DArray.h index 9d785cc4c..de1faf120 100644 --- a/src/GeomData/GeomData_Point2DArray.h +++ b/src/GeomData/GeomData_Point2DArray.h @@ -40,33 +40,34 @@ class GeomData_Point2DArray : public GeomDataAPI_Point2DArray { public: /// Copy values from another array /// \return \c true if the copy was successful - GEOMDATA_EXPORT virtual bool - assign(std::shared_ptr theOther); + GEOMDATA_EXPORT bool + assign(std::shared_ptr theOther) override; /// Returns the size of the array (zero means that it is empty) - GEOMDATA_EXPORT virtual int size(); + GEOMDATA_EXPORT int size() override; /// Sets the new size of the array. The previous data is erased. - GEOMDATA_EXPORT virtual void setSize(const int theSize); + GEOMDATA_EXPORT void setSize(const int theSize) override; /// Defines the value of the array by index [0; size-1] - GEOMDATA_EXPORT virtual void setPnt(const int theIndex, const double theX, - const double theY); + GEOMDATA_EXPORT void setPnt(const int theIndex, const double theX, + const double theY) override; /// Defines the value of the array by index [0; size-1] - GEOMDATA_EXPORT virtual void - setPnt(const int theIndex, const std::shared_ptr &thePoint); + GEOMDATA_EXPORT void + setPnt(const int theIndex, + const std::shared_ptr &thePoint) override; /// Returns the value by the index - GEOMDATA_EXPORT virtual std::shared_ptr - pnt(const int theIndex); + GEOMDATA_EXPORT std::shared_ptr + pnt(const int theIndex) override; protected: /// Initializes attributes GEOMDATA_EXPORT GeomData_Point2DArray(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_Data; }; diff --git a/src/GeomDataAPI/GeomDataAPI_Dir.cpp b/src/GeomDataAPI/GeomDataAPI_Dir.cpp index 99273806e..d6959f630 100644 --- a/src/GeomDataAPI/GeomDataAPI_Dir.cpp +++ b/src/GeomDataAPI/GeomDataAPI_Dir.cpp @@ -22,6 +22,6 @@ std::string GeomDataAPI_Dir::attributeType() { return typeId(); } -GeomDataAPI_Dir::GeomDataAPI_Dir() {} +GeomDataAPI_Dir::GeomDataAPI_Dir() = default; -GeomDataAPI_Dir::~GeomDataAPI_Dir() {} +GeomDataAPI_Dir::~GeomDataAPI_Dir() = default; diff --git a/src/GeomDataAPI/GeomDataAPI_Point2D.cpp b/src/GeomDataAPI/GeomDataAPI_Point2D.cpp index 802687794..a6b3893d5 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point2D.cpp +++ b/src/GeomDataAPI/GeomDataAPI_Point2D.cpp @@ -43,6 +43,6 @@ GeomDataAPI_Point2D::getPoint2D(const DataPtr &theData, return aPointAttr; } -GeomDataAPI_Point2D::GeomDataAPI_Point2D() {} +GeomDataAPI_Point2D::GeomDataAPI_Point2D() = default; -GeomDataAPI_Point2D::~GeomDataAPI_Point2D() {} +GeomDataAPI_Point2D::~GeomDataAPI_Point2D() = default; diff --git a/src/GeomDataAPI/GeomDataAPI_Point2DArray.cpp b/src/GeomDataAPI/GeomDataAPI_Point2DArray.cpp index 18acc15de..9b5570b8d 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point2DArray.cpp +++ b/src/GeomDataAPI/GeomDataAPI_Point2DArray.cpp @@ -22,6 +22,6 @@ std::string GeomDataAPI_Point2DArray::attributeType() { return typeId(); } -GeomDataAPI_Point2DArray::GeomDataAPI_Point2DArray() {} +GeomDataAPI_Point2DArray::GeomDataAPI_Point2DArray() = default; -GeomDataAPI_Point2DArray::~GeomDataAPI_Point2DArray() {} +GeomDataAPI_Point2DArray::~GeomDataAPI_Point2DArray() = default; diff --git a/src/GeomValidators/GeomValidators_BodyShapes.h b/src/GeomValidators/GeomValidators_BodyShapes.h index 0db55c9bb..b72910ebe 100644 --- a/src/GeomValidators/GeomValidators_BodyShapes.h +++ b/src/GeomValidators/GeomValidators_BodyShapes.h @@ -36,10 +36,10 @@ public: /// \param[in] theAttribute an attribute to check /// \param[in] theArguments a filter parameters /// \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/GeomValidators/GeomValidators_ConstructionComposite.h b/src/GeomValidators/GeomValidators_ConstructionComposite.h index f540d436a..24bac55d5 100644 --- a/src/GeomValidators/GeomValidators_ConstructionComposite.h +++ b/src/GeomValidators/GeomValidators_ConstructionComposite.h @@ -31,15 +31,15 @@ class GeomValidators_ConstructionComposite : public ModelAPI_AttributeValidator { public: - GEOMVALIDATORS_EXPORT GeomValidators_ConstructionComposite() {} + GEOMVALIDATORS_EXPORT GeomValidators_ConstructionComposite() = default; //! returns true if attribute is valid //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/GeomValidators/GeomValidators_Different.cpp b/src/GeomValidators/GeomValidators_Different.cpp index b9a7191fe..6bdb67f6a 100644 --- a/src/GeomValidators/GeomValidators_Different.cpp +++ b/src/GeomValidators/GeomValidators_Different.cpp @@ -77,7 +77,7 @@ bool GeomValidators_Different::isValid( std::map> anAttributesMap; // For all attributes referred by theArguments // sort it using attributeType() and store into anAttributesMap - std::list::const_iterator anArgumentIt = theArguments.begin(); + auto anArgumentIt = theArguments.begin(); for (; anArgumentIt != theArguments.end(); ++anArgumentIt) { AttributePtr anAttribute = theFeature->attribute(*anArgumentIt); anAttributesMap[anAttribute->attributeType()].push_back(anAttribute); @@ -89,14 +89,13 @@ bool GeomValidators_Different::isValid( for (; anAttributesMapIt != anAttributesMap.end(); ++anAttributesMapIt) { const std::list &anAttributes = anAttributesMapIt->second; // for the list of attributes check that all elements are unique - std::list::const_iterator anAttributeIt = - anAttributes.begin(); + auto anAttributeIt = anAttributes.begin(); if (anAttributeIt != anAttributes.end()) { - std::list::const_iterator aNextIt = anAttributeIt; + auto aNextIt = anAttributeIt; ++aNextIt; while (aNextIt != anAttributes.end()) { // if equal attribute is found then all attributes are not different - std::list::const_iterator aFindIt = + auto aFindIt = std::find_if(aNextIt, anAttributes.end(), IsEqual(*anAttributeIt)); if (aFindIt != anAttributes.end()) { theError = "Attributes " + (*anAttributeIt)->id() + " and " + @@ -113,8 +112,8 @@ bool GeomValidators_Different::isValid( } // LCOV_EXCL_START -bool GeomValidators_Different::isNotObligatory(std::string theFeature, - std::string theAttribute) { +bool GeomValidators_Different::isNotObligatory(std::string /*theFeature*/, + std::string /*theAttribute*/) { return true; } // LCOV_EXCL_STOP diff --git a/src/GeomValidators/GeomValidators_Different.h b/src/GeomValidators/GeomValidators_Different.h index 65f9a574a..212ca4e58 100644 --- a/src/GeomValidators/GeomValidators_Different.h +++ b/src/GeomValidators/GeomValidators_Different.h @@ -37,13 +37,13 @@ public: * validator. \param[out] theError error message. \returns true if feature is * valid. */ - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const std::shared_ptr &theFeature, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; - GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, - std::string theAttribute); + GEOMVALIDATORS_EXPORT bool isNotObligatory(std::string theFeature, + std::string theAttribute) override; }; #endif diff --git a/src/GeomValidators/GeomValidators_DifferentShapes.cpp b/src/GeomValidators/GeomValidators_DifferentShapes.cpp index a415393a1..5de43cdd7 100644 --- a/src/GeomValidators/GeomValidators_DifferentShapes.cpp +++ b/src/GeomValidators/GeomValidators_DifferentShapes.cpp @@ -72,11 +72,11 @@ bool GeomValidators_DifferentShapes::isValid( //================================================================================================= bool GeomValidators_DifferentShapes::checkEquals( std::list &theAttributes) { - std::list::iterator anIt = theAttributes.begin(); + auto anIt = theAttributes.begin(); for (; anIt != theAttributes.end(); anIt++) { AttributePtr anAttribute = *anIt; - std::list::iterator anOthersIt = std::next(anIt); + auto anOthersIt = std::next(anIt); for (; anOthersIt != theAttributes.end(); anOthersIt++) { AttributePtr anOtherAttribute = *anOthersIt; if (isAttrShapesEqual(anAttribute, anOtherAttribute)) { @@ -106,17 +106,17 @@ bool GeomValidators_DifferentShapes::checkEqualToCurrent( FeaturePtr aFeature = aSelectionAttribute->contextFeature(); std::string aCurrentAttributeId = theCurrentAttribute->id(); - if (theAttributes.size() > 0 && aShape.get() != NULL) { - std::list::iterator anAttr = theAttributes.begin(); + if (theAttributes.size() > 0 && aShape.get() != nullptr) { + auto anAttr = theAttributes.begin(); for (; anAttr != theAttributes.end(); anAttr++) { AttributePtr anAttribute = *anAttr; // take into concideration only other attributes - if (anAttribute.get() != NULL && + if (anAttribute.get() != nullptr && anAttribute->id() != aCurrentAttributeId) { aSelectionAttribute = std::dynamic_pointer_cast(anAttribute); // the shape of the attribute should be not the same - if (aSelectionAttribute.get() != NULL) { + if (aSelectionAttribute.get() != nullptr) { GeomShapePtr anAttrShape = aSelectionAttribute->value(); ResultPtr aResult = aSelectionAttribute->context(); if (!anAttrShape.get()) { diff --git a/src/GeomValidators/GeomValidators_DifferentShapes.h b/src/GeomValidators/GeomValidators_DifferentShapes.h index 98a6fda48..315bbd618 100644 --- a/src/GeomValidators/GeomValidators_DifferentShapes.h +++ b/src/GeomValidators/GeomValidators_DifferentShapes.h @@ -35,10 +35,10 @@ public: /// the attribute does not contain a selection attribute filled with the same /// shape \param[in] theAttribute an attribute to check \param[in] /// theArguments a filter parameters \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; private: /// Check if the list contains equal shape selection. diff --git a/src/GeomValidators/GeomValidators_Face.h b/src/GeomValidators/GeomValidators_Face.h index 45d6d93dc..698c29891 100644 --- a/src/GeomValidators/GeomValidators_Face.h +++ b/src/GeomValidators/GeomValidators_Face.h @@ -30,15 +30,15 @@ */ class GeomValidators_Face : public ModelAPI_AttributeValidator { public: - GEOMVALIDATORS_EXPORT GeomValidators_Face() {} + GEOMVALIDATORS_EXPORT GeomValidators_Face() = default; //! returns true if attribute is valid //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/GeomValidators/GeomValidators_FeatureKind.cpp b/src/GeomValidators/GeomValidators_FeatureKind.cpp index d94febb55..7e660dcaa 100644 --- a/src/GeomValidators/GeomValidators_FeatureKind.cpp +++ b/src/GeomValidators/GeomValidators_FeatureKind.cpp @@ -40,8 +40,7 @@ bool GeomValidators_FeatureKind::isValid( bool isSketchEntities = true; std::set anEntityKinds; std::string anEntityKindsStr; - std::list::const_iterator anIt = theArguments.begin(), - aLast = theArguments.end(); + auto anIt = theArguments.begin(), aLast = theArguments.end(); for (; anIt != aLast; anIt++) { anEntityKinds.insert(*anIt); if (!anEntityKindsStr.empty()) diff --git a/src/GeomValidators/GeomValidators_FeatureKind.h b/src/GeomValidators/GeomValidators_FeatureKind.h index e2ca50bcf..b67f02862 100644 --- a/src/GeomValidators/GeomValidators_FeatureKind.h +++ b/src/GeomValidators/GeomValidators_FeatureKind.h @@ -36,10 +36,10 @@ public: /// \param[in] theAttribute an attribute to check /// \param[in] theArguments a filter parameters /// \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/GeomValidators/GeomValidators_GlobalSelection.h b/src/GeomValidators/GeomValidators_GlobalSelection.h index 5695a7b9d..ad2ed7b04 100644 --- a/src/GeomValidators/GeomValidators_GlobalSelection.h +++ b/src/GeomValidators/GeomValidators_GlobalSelection.h @@ -36,10 +36,10 @@ public: /// \param[in] theAttribute an attribute to check /// \param[in] theArguments a filter parameters /// \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/GeomValidators/GeomValidators_Intersected.cpp b/src/GeomValidators/GeomValidators_Intersected.cpp index 8208f7d39..01c4ccd9f 100644 --- a/src/GeomValidators/GeomValidators_Intersected.cpp +++ b/src/GeomValidators/GeomValidators_Intersected.cpp @@ -58,8 +58,8 @@ bool GeomValidators_Intersected::isValid( // check intersection with all arguments bool isOk = true; - for (std::list::const_iterator anIt = theArguments.begin(); - anIt != theArguments.end() && isOk; ++anIt) { + for (auto anIt = theArguments.begin(); anIt != theArguments.end() && isOk; + ++anIt) { aSelection = aFeature->selection(*anIt); // LCOV_EXCL_START if (!aSelection) { diff --git a/src/GeomValidators/GeomValidators_Intersected.h b/src/GeomValidators/GeomValidators_Intersected.h index af010c08c..17cc705f1 100644 --- a/src/GeomValidators/GeomValidators_Intersected.h +++ b/src/GeomValidators/GeomValidators_Intersected.h @@ -36,10 +36,10 @@ public: /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/GeomValidators/GeomValidators_MinObjectsSelected.h b/src/GeomValidators/GeomValidators_MinObjectsSelected.h index 0362c2be7..68942d007 100644 --- a/src/GeomValidators/GeomValidators_MinObjectsSelected.h +++ b/src/GeomValidators/GeomValidators_MinObjectsSelected.h @@ -35,10 +35,10 @@ public: /// \param[in] theArguments the arguments in the configuration file for this /// validator. \param[out] theError error message. \returns true if feature is /// valid. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const std::shared_ptr &theFeature, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp b/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp index 53e37739c..e3d6b18cb 100644 --- a/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp +++ b/src/GeomValidators/GeomValidators_NotSelfIntersected.cpp @@ -39,9 +39,7 @@ bool GeomValidators_NotSelfIntersected::isValid( } // LCOV_EXCL_STOP - for (std::list::const_iterator anIt = theArguments.cbegin(); - anIt != theArguments.cend(); ++anIt) { - std::string anArgument = *anIt; + for (auto anArgument : theArguments) { AttributePtr anAttribute = theFeature->attribute(anArgument); if (!anAttribute.get()) { // LCOV_EXCL_START diff --git a/src/GeomValidators/GeomValidators_NotSelfIntersected.h b/src/GeomValidators/GeomValidators_NotSelfIntersected.h index 82e7e60c8..6e48913c2 100644 --- a/src/GeomValidators/GeomValidators_NotSelfIntersected.h +++ b/src/GeomValidators/GeomValidators_NotSelfIntersected.h @@ -36,15 +36,15 @@ public: /// \param[in] theAttribute an attribute to check. /// \param[in] theArguments a filter parameters. /// \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const std::shared_ptr &theFeature, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; /// \return true if the attribute in feature is not obligatory for the feature /// execution. - GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, - std::string theAttribute); + GEOMVALIDATORS_EXPORT bool isNotObligatory(std::string theFeature, + std::string theAttribute) override; }; #endif diff --git a/src/GeomValidators/GeomValidators_Plugin.cpp b/src/GeomValidators/GeomValidators_Plugin.cpp index 5f25dbfc4..87f445f7a 100644 --- a/src/GeomValidators/GeomValidators_Plugin.cpp +++ b/src/GeomValidators/GeomValidators_Plugin.cpp @@ -76,7 +76,7 @@ GeomValidators_Plugin::GeomValidators_Plugin() { // ModelAPI_Session::get()->registerPlugin(this); } -FeaturePtr GeomValidators_Plugin::createFeature(std::string theFeatureID) { +FeaturePtr GeomValidators_Plugin::createFeature(std::string /*theFeatureID*/) { // feature of such kind is not found return FeaturePtr(); } diff --git a/src/GeomValidators/GeomValidators_Plugin.h b/src/GeomValidators/GeomValidators_Plugin.h index f7170eeef..3c0efc3bb 100644 --- a/src/GeomValidators/GeomValidators_Plugin.h +++ b/src/GeomValidators/GeomValidators_Plugin.h @@ -33,7 +33,7 @@ class GEOMVALIDATORS_EXPORT GeomValidators_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - virtual FeaturePtr createFeature(std::string theFeatureID); + FeaturePtr createFeature(std::string theFeatureID) override; public: GeomValidators_Plugin(); diff --git a/src/GeomValidators/GeomValidators_Positive.cpp b/src/GeomValidators/GeomValidators_Positive.cpp index 523501f08..62cb39501 100644 --- a/src/GeomValidators/GeomValidators_Positive.cpp +++ b/src/GeomValidators/GeomValidators_Positive.cpp @@ -46,7 +46,7 @@ bool GeomValidators_Positive::isValid( Events_InfoMessage &theError) const { double aMinValue = 1.e-12; if (theArguments.size() == 1) { - std::list::const_iterator anIt = theArguments.begin(); + auto anIt = theArguments.begin(); double aValue = Config_PropManager::stringToDouble((*anIt).c_str()); if (aValue != 0) { // very probably ok diff --git a/src/GeomValidators/GeomValidators_Positive.h b/src/GeomValidators/GeomValidators_Positive.h index 002e42fee..b4afa39cc 100644 --- a/src/GeomValidators/GeomValidators_Positive.h +++ b/src/GeomValidators/GeomValidators_Positive.h @@ -36,10 +36,10 @@ public: //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/GeomValidators/GeomValidators_ShapeType.cpp b/src/GeomValidators/GeomValidators_ShapeType.cpp index eeb014060..59a7473eb 100644 --- a/src/GeomValidators/GeomValidators_ShapeType.cpp +++ b/src/GeomValidators/GeomValidators_ShapeType.cpp @@ -98,8 +98,7 @@ bool GeomValidators_ShapeType::isValid( Events_InfoMessage &theError) const { bool aValid = false; - std::list::const_iterator anIt = theArguments.begin(), - aLast = theArguments.end(); + auto anIt = theArguments.begin(), aLast = theArguments.end(); // returns true if the attribute satisfies at least one of given arguments for (; anIt != aLast; anIt++) { TypeOfShape aShapeType = shapeType(*anIt); @@ -221,7 +220,7 @@ bool GeomValidators_ShapeType::isValidObject( std::dynamic_pointer_cast(theObject); FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); const std::string &aKind = aFeature->getKind(); - return aResult.get() != NULL && aKind == "Plane"; + return aResult.get() != nullptr && aKind == "Plane"; } if (!aResult.get()) { aValid = false; diff --git a/src/GeomValidators/GeomValidators_ShapeType.h b/src/GeomValidators/GeomValidators_ShapeType.h index 0cd991c73..4eee8edf4 100644 --- a/src/GeomValidators/GeomValidators_ShapeType.h +++ b/src/GeomValidators/GeomValidators_ShapeType.h @@ -54,15 +54,15 @@ public: }; public: - GEOMVALIDATORS_EXPORT GeomValidators_ShapeType() {} + GEOMVALIDATORS_EXPORT GeomValidators_ShapeType() = default; //! Returns true if attribute has shape type listed in the parameter arguments //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; /// Convert string to TypeOfShape value /// \param theType a string value diff --git a/src/GeomValidators/GeomValidators_Tools.cpp b/src/GeomValidators/GeomValidators_Tools.cpp index 977e3ef5f..18f2c6894 100644 --- a/src/GeomValidators/GeomValidators_Tools.cpp +++ b/src/GeomValidators/GeomValidators_Tools.cpp @@ -34,19 +34,19 @@ ObjectPtr getObject(const AttributePtr &theAttribute) { if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) { AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast(theAttribute); - if (anAttr != NULL && anAttr->isObject()) + if (anAttr != nullptr && anAttr->isObject()) anObject = anAttr->object(); } if (anAttrType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr anAttr = std::dynamic_pointer_cast(theAttribute); - if (anAttr != NULL) + if (anAttr != nullptr) anObject = anAttr->context(); } if (anAttrType == ModelAPI_AttributeReference::typeId()) { AttributeReferencePtr anAttr = std::dynamic_pointer_cast(theAttribute); - if (anAttr.get() != NULL) + if (anAttr.get() != nullptr) anObject = anAttr->value(); } return anObject; diff --git a/src/GeomValidators/GeomValidators_ValueOrder.cpp b/src/GeomValidators/GeomValidators_ValueOrder.cpp index 7d5f6b362..f5e0fb763 100644 --- a/src/GeomValidators/GeomValidators_ValueOrder.cpp +++ b/src/GeomValidators/GeomValidators_ValueOrder.cpp @@ -74,10 +74,9 @@ static bool isValidOrder(const AttributePtr &theAttribute, return false; } - for (std::list::const_iterator anIt = theArguments.begin(); - anIt != theArguments.end(); ++anIt) { + for (const auto &theArgument : theArguments) { // check the argument links to the attribute of the current feature - AttributePtr aCurAttr = anOwner->attribute(*anIt); + AttributePtr aCurAttr = anOwner->attribute(theArgument); if (!aCurAttr) { theError = "Arguments should be names of attributes of current feature"; return false; diff --git a/src/GeomValidators/GeomValidators_ValueOrder.h b/src/GeomValidators/GeomValidators_ValueOrder.h index d49aa941d..b12e58477 100644 --- a/src/GeomValidators/GeomValidators_ValueOrder.h +++ b/src/GeomValidators/GeomValidators_ValueOrder.h @@ -37,10 +37,10 @@ public: //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; }; /** @@ -56,10 +56,10 @@ public: //! \param[in] theAttribute the checked attribute //! \param[in] theArguments arguments of the attribute //! \param[out] theError error message. - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/GeomValidators/GeomValidators_ZeroOffset.cpp b/src/GeomValidators/GeomValidators_ZeroOffset.cpp index 98b4c4386..a76252e25 100644 --- a/src/GeomValidators/GeomValidators_ZeroOffset.cpp +++ b/src/GeomValidators/GeomValidators_ZeroOffset.cpp @@ -47,7 +47,7 @@ bool GeomValidators_ZeroOffset::isValid( } // LCOV_EXCL_STOP - std::list::const_iterator anIt = theArguments.begin(); + auto anIt = theArguments.begin(); std::string aSelectedMethod; if (theFeature->string(*anIt)) { @@ -142,7 +142,7 @@ bool GeomValidators_ZeroOffset::isValid( theFeature->selection(*anIt); if (anAttrSel && anAttrSel->isInitialized()) { aToShape = std::dynamic_pointer_cast(anAttrSel->value()); - if (aToShape.get() == NULL && anAttrSel->context().get() != NULL) { + if (aToShape.get() == nullptr && anAttrSel->context().get() != nullptr) { aToShape = anAttrSel->context()->shape(); } if (aToShape->isCompound()) { @@ -162,7 +162,7 @@ bool GeomValidators_ZeroOffset::isValid( anAttrSel = theFeature->selection(*anIt); if (anAttrSel && anAttrSel->isInitialized()) { aFromShape = std::dynamic_pointer_cast(anAttrSel->value()); - if (aFromShape.get() == NULL && anAttrSel->context().get() != NULL) { + if (aFromShape.get() == nullptr && anAttrSel->context().get() != nullptr) { aFromShape = anAttrSel->context()->shape(); } if (aFromShape->isCompound()) { @@ -215,9 +215,7 @@ bool GeomValidators_ZeroOffset::isValid( } std::shared_ptr aPln = aFace->getPlane(); if (aPln.get()) { - for (ListOfShape::const_iterator anIter = aFacesList.cbegin(); - anIter != aFacesList.cend(); anIter++) { - std::shared_ptr aSketchShape = *anIter; + for (auto aSketchShape : aFacesList) { std::shared_ptr aSketchFace( new GeomAPI_Face(aSketchShape)); std::shared_ptr aSketchPln = aSketchFace->getPlane(); @@ -239,7 +237,7 @@ bool GeomValidators_ZeroOffset::isValid( //================================================================================================= // LCOV_EXCL_START -bool GeomValidators_ZeroOffset::isNotObligatory(std::string theFeature, +bool GeomValidators_ZeroOffset::isNotObligatory(std::string /*theFeature*/, std::string theAttribute) { if (theAttribute == "from_object" || theAttribute == "to_object") { return true; diff --git a/src/GeomValidators/GeomValidators_ZeroOffset.h b/src/GeomValidators/GeomValidators_ZeroOffset.h index 0b1f382cb..d8c24e9fa 100644 --- a/src/GeomValidators/GeomValidators_ZeroOffset.h +++ b/src/GeomValidators/GeomValidators_ZeroOffset.h @@ -37,15 +37,15 @@ public: * validator. \param[out] theError error message. \return true if feature is * valid. */ - GEOMVALIDATORS_EXPORT virtual bool + GEOMVALIDATORS_EXPORT bool isValid(const std::shared_ptr &theFeature, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; /// \return true if the attribute in feature is not obligatory for the feature /// execution. - GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, - std::string theAttribute); + GEOMVALIDATORS_EXPORT bool isNotObligatory(std::string theFeature, + std::string theAttribute) override; }; #endif diff --git a/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp b/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp index 8a92f0025..a65bc4471 100644 --- a/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp +++ b/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp @@ -72,16 +72,16 @@ std::set toSet(const std::list &theContainer) { InitializationPlugin_EvalListener::InitializationPlugin_EvalListener() { Events_Loop *aLoop = Events_Loop::loop(); - aLoop->registerListener(this, ModelAPI_AttributeEvalMessage::eventId(), NULL, - true); - aLoop->registerListener(this, ModelAPI_ParameterEvalMessage::eventId(), NULL, - true); - aLoop->registerListener(this, ModelAPI_BuildEvalMessage::eventId(), NULL, + aLoop->registerListener(this, ModelAPI_AttributeEvalMessage::eventId(), + nullptr, true); + aLoop->registerListener(this, ModelAPI_ParameterEvalMessage::eventId(), + nullptr, true); + aLoop->registerListener(this, ModelAPI_BuildEvalMessage::eventId(), nullptr, true); aLoop->registerListener(this, ModelAPI_ComputePositionsMessage::eventId(), - NULL, true); + nullptr, true); aLoop->registerListener(this, ModelAPI_ImportParametersMessage::eventId(), - NULL, true); + nullptr, true); myInterp = std::shared_ptr( new InitializationPlugin_PyInterp()); @@ -89,7 +89,8 @@ InitializationPlugin_EvalListener::InitializationPlugin_EvalListener() { } //================================================================================================= -InitializationPlugin_EvalListener::~InitializationPlugin_EvalListener() {} +InitializationPlugin_EvalListener::~InitializationPlugin_EvalListener() = + default; //================================================================================================= void InitializationPlugin_EvalListener::processEvent( @@ -204,7 +205,7 @@ double InitializationPlugin_EvalListener::evaluate( std::list anExprParams = myInterp->compile(theExpression); // find expression's params in the model - std::list::iterator it = anExprParams.begin(); + auto it = anExprParams.begin(); for (; it != anExprParams.end(); it++) { double aValue; ResultParameterPtr aParamRes; @@ -214,7 +215,7 @@ double InitializationPlugin_EvalListener::evaluate( continue; if (theIsFirstTime) { - std::list::iterator anIter = + auto anIter = std::find(theParamsList.begin(), theParamsList.end(), aParamRes); if (anIter == theParamsList.end()) theParamsList.push_back(aParamRes); @@ -237,7 +238,7 @@ double InitializationPlugin_EvalListener::evaluate( std::list anExprParams = myInterp->compile(theExpression); // find expression's params in the model std::list aContext; - std::list::iterator it = anExprParams.begin(); + auto it = anExprParams.begin(); for (; it != anExprParams.end(); it++) { double aValue; ResultParameterPtr aParamRes; diff --git a/src/InitializationPlugin/InitializationPlugin_EvalListener.h b/src/InitializationPlugin/InitializationPlugin_EvalListener.h index fd4a9f4e9..467ccb0b7 100644 --- a/src/InitializationPlugin/InitializationPlugin_EvalListener.h +++ b/src/InitializationPlugin/InitializationPlugin_EvalListener.h @@ -39,11 +39,11 @@ class InitializationPlugin_PyInterp; class InitializationPlugin_EvalListener : public Events_Listener { public: INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_EvalListener(); - INITIALIZATIONPLUGIN_EXPORT virtual ~InitializationPlugin_EvalListener(); + INITIALIZATIONPLUGIN_EXPORT ~InitializationPlugin_EvalListener() override; /// Reimplemented from Events_Listener::processEvent(). INITIALIZATIONPLUGIN_EXPORT - virtual void processEvent(const std::shared_ptr &theMessage); + void processEvent(const std::shared_ptr &theMessage) override; // performs the python call to initialize high level data model on internal // data model creation diff --git a/src/InitializationPlugin/InitializationPlugin_Plugin.cpp b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp index 12e904791..d45fd62a9 100644 --- a/src/InitializationPlugin/InitializationPlugin_Plugin.cpp +++ b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp @@ -43,8 +43,7 @@ static InitializationPlugin_Plugin *MY_INITIALIZATIONPLUGIN_INSTANCE = new InitializationPlugin_Plugin(); InitializationPlugin_Plugin::InitializationPlugin_Plugin() - : myCreatePartOnStart(false) // by default in TUI mode part is not created - // on start of PartSet + { char *isUnitTest = getenv("SHAPER_UNIT_TEST_IN_PROGRESS"); myInitDataModel = (!isUnitTest || isUnitTest[0] != '1'); @@ -52,10 +51,10 @@ InitializationPlugin_Plugin::InitializationPlugin_Plugin() Events_Loop *aLoop = Events_Loop::loop(); static const Events_ID kDocCreatedEvent = ModelAPI_DocumentCreatedMessage::eventId(); - aLoop->registerListener(this, kDocCreatedEvent, NULL, true); + aLoop->registerListener(this, kDocCreatedEvent, nullptr, true); static const Events_ID kCreatePartEvent = Events_Loop::eventByName(EVENT_CREATE_PART_ON_START); - aLoop->registerListener(this, kCreatePartEvent, NULL, true); + aLoop->registerListener(this, kCreatePartEvent, nullptr, true); myEvalListener = std::shared_ptr( new InitializationPlugin_EvalListener()); @@ -114,7 +113,7 @@ void InitializationPlugin_Plugin::processEvent( FeaturePtr aPlane = *aFIter; const std::list> &aResults = aPlane->results(); - std::list::const_iterator aRIter = aResults.begin(); + auto aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { (*aRIter)->setDisplayed(false); } diff --git a/src/InitializationPlugin/InitializationPlugin_Plugin.h b/src/InitializationPlugin/InitializationPlugin_Plugin.h index 064bc00a1..6c798956c 100644 --- a/src/InitializationPlugin/InitializationPlugin_Plugin.h +++ b/src/InitializationPlugin/InitializationPlugin_Plugin.h @@ -39,11 +39,11 @@ public: /// Creates plug-in and registers it in the Event Loop INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_Plugin(); /// Destructs the plugin - INITIALIZATIONPLUGIN_EXPORT virtual ~InitializationPlugin_Plugin() {} + INITIALIZATIONPLUGIN_EXPORT ~InitializationPlugin_Plugin() override = default; /// Process the ModelAPI_DocumentCreatedMessage to fulfill a document /// from the message with origin and planes - INITIALIZATIONPLUGIN_EXPORT virtual void - processEvent(const std::shared_ptr &theMessage); + INITIALIZATIONPLUGIN_EXPORT void + processEvent(const std::shared_ptr &theMessage) override; protected: /// Creates a plane by given parameters A, B, C @@ -77,7 +77,7 @@ protected: private: std::shared_ptr myEvalListener; bool myInitDataModel; - bool myCreatePartOnStart; + bool myCreatePartOnStart{false}; }; #endif diff --git a/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp b/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp index 5be85434d..be8065d22 100644 --- a/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp +++ b/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp @@ -30,7 +30,7 @@ InitializationPlugin_PyInterp::InitializationPlugin_PyInterp() : PyInterp_Interp() {} -InitializationPlugin_PyInterp::~InitializationPlugin_PyInterp() {} +InitializationPlugin_PyInterp::~InitializationPlugin_PyInterp() = default; const char *aSearchCode = "import ast\n" @@ -116,7 +116,7 @@ InitializationPlugin_PyInterp::compile(const std::wstring &theExpression) { return aResult; } - PyCodeObject *aCodeObj = (PyCodeObject *)aCodePyObj; + auto *aCodeObj = (PyCodeObject *)aCodePyObj; #if PY_VERSION_HEX >= 0x030B0000 std::string aCodeName(PyBytes_AsString( PyObject_GetAttrString((PyObject *)(aCodeObj), "co_code"))); @@ -149,7 +149,7 @@ void InitializationPlugin_PyInterp::extendLocalContext( PyLockWrapper lck; // Acquire GIL until the end of the method if (theParameters.empty()) return; - std::list::const_iterator it = theParameters.begin(); + auto it = theParameters.begin(); for (; it != theParameters.cend(); it++) { std::string aParamValue = Locale::Convert::toString(*it); simpleRun(aParamValue.c_str(), false); @@ -196,7 +196,7 @@ InitializationPlugin_PyInterp::evaluate(const std::wstring &theExpression, double result = 0.; try { // set locale due to the #2485 - std::string aCurLocale = std::setlocale(LC_NUMERIC, 0); + std::string aCurLocale = std::setlocale(LC_NUMERIC, nullptr); std::setlocale(LC_NUMERIC, "C"); result = std::stod(anEvalStr); std::setlocale(LC_NUMERIC, aCurLocale.c_str()); diff --git a/src/InitializationPlugin/InitializationPlugin_PyInterp.h b/src/InitializationPlugin/InitializationPlugin_PyInterp.h index bef1710e4..a68c7c4c0 100644 --- a/src/InitializationPlugin/InitializationPlugin_PyInterp.h +++ b/src/InitializationPlugin/InitializationPlugin_PyInterp.h @@ -37,7 +37,7 @@ class INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_PyInterp : public PyInterp_Interp { public: InitializationPlugin_PyInterp(); - virtual ~InitializationPlugin_PyInterp(); + ~InitializationPlugin_PyInterp() override; /// Returns a list of positions for theName in theExpression. std::list> positions(const std::wstring &theExpression, @@ -60,9 +60,9 @@ protected: /// Returns error message. std::string errorMessage(); /// Overrides PyInterp_Interp. - virtual bool initContext(); + bool initContext() override; /// Reimplemented from PyInterp_Interp::closeContext(). - virtual void closeContext(); + void closeContext() override; }; #endif /* INITIALIZATIONPLUGIN_PYINTERP_H_ */ diff --git a/src/Model/Model_Application.cpp b/src/Model/Model_Application.cpp index f28504194..af4ae1c7b 100644 --- a/src/Model/Model_Application.cpp +++ b/src/Model/Model_Application.cpp @@ -97,8 +97,7 @@ void Model_Application::deleteDocument(const int theDocID) { //======================================================================= void Model_Application::deleteAllDocuments() { - std::map>::iterator aDoc = - myDocs.begin(); + auto aDoc = myDocs.begin(); for (; aDoc != myDocs.end(); aDoc++) { if (aDoc->second->isOpened()) // here is main document was closed before // subs and closed subs @@ -147,7 +146,7 @@ int Model_Application::generateDocumentId() { for (aResult = int(myDocs.size()); true; aResult++) { if (myDocs.find(aResult) == myDocs.end()) { bool aFound = false; - std::map::iterator aLBDIter = myLoadedByDemand.begin(); + auto aLBDIter = myLoadedByDemand.begin(); for (; aLBDIter != myLoadedByDemand.end(); aLBDIter++) { if (aLBDIter->second == aResult) { aFound = true; diff --git a/src/Model/Model_Application.h b/src/Model/Model_Application.h index d43a05bab..421326aa2 100644 --- a/src/Model/Model_Application.h +++ b/src/Model/Model_Application.h @@ -86,7 +86,7 @@ public: public: // Redefined OCAF methods //! Return name of resource (i.e. "Standard") - Standard_CString ResourcesName(); + Standard_CString ResourcesName() override; //! Return format (i.e "MDTV-Standard") //! \param theFormats sequence of allowed formats for input/output virtual void Formats(TColStd_SequenceOfExtendedString &theFormats); diff --git a/src/Model/Model_AttributeBoolean.h b/src/Model/Model_AttributeBoolean.h index 5ae926ec8..c04966521 100644 --- a/src/Model/Model_AttributeBoolean.h +++ b/src/Model/Model_AttributeBoolean.h @@ -36,10 +36,10 @@ class Model_AttributeBoolean : public ModelAPI_AttributeBoolean { TDF_Label myLab; ///< if attribute is not initialized, store label here public: /// Defines the double value - MODEL_EXPORT virtual void setValue(bool theValue); + MODEL_EXPORT void setValue(bool theValue) override; /// Returns the double value - MODEL_EXPORT virtual bool value(); + MODEL_EXPORT bool value() override; protected: /// Initializes attibutes @@ -47,7 +47,7 @@ protected: /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_Data; }; diff --git a/src/Model/Model_AttributeDocRef.h b/src/Model/Model_AttributeDocRef.h index c2e02714b..017533f1f 100644 --- a/src/Model/Model_AttributeDocRef.h +++ b/src/Model/Model_AttributeDocRef.h @@ -37,13 +37,14 @@ class Model_AttributeDocRef : public ModelAPI_AttributeDocRef { public: /// Defines the document referenced from this attribute - MODEL_EXPORT virtual void setValue(std::shared_ptr theDoc); + MODEL_EXPORT void + setValue(std::shared_ptr theDoc) override; /// Returns document referenced from this attribute - MODEL_EXPORT virtual std::shared_ptr value(); + MODEL_EXPORT std::shared_ptr value() override; /// Returns the persisten ID of the document - MODEL_EXPORT virtual int docId(); + MODEL_EXPORT int docId() override; protected: /// Initializes attibutes @@ -51,7 +52,7 @@ protected: /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_Data; }; diff --git a/src/Model/Model_AttributeDouble.h b/src/Model/Model_AttributeDouble.h index d1cf638e5..bdfdc9468 100644 --- a/src/Model/Model_AttributeDouble.h +++ b/src/Model/Model_AttributeDouble.h @@ -38,48 +38,48 @@ class Model_AttributeDouble : public ModelAPI_AttributeDouble { public: /// Defines the double value - MODEL_EXPORT virtual void setValue(const double theValue); + MODEL_EXPORT void setValue(const double theValue) override; /// Returns the double value - MODEL_EXPORT virtual double value(); + MODEL_EXPORT double value() override; /// Defines the calculated double value - MODEL_EXPORT virtual void setCalculatedValue(const double theValue); + MODEL_EXPORT void setCalculatedValue(const double theValue) override; /// Defines the text value - MODEL_EXPORT virtual void setText(const std::wstring &theText); + MODEL_EXPORT void setText(const std::wstring &theText) override; /// Returns the text value - MODEL_EXPORT virtual std::wstring text(); + MODEL_EXPORT std::wstring text() override; /// Allows to set expression (text) as invalid (by the parameters listener) - MODEL_EXPORT virtual void setExpressionInvalid(const bool theFlag); + MODEL_EXPORT void setExpressionInvalid(const bool theFlag) override; /// Returns true if text is invalid - MODEL_EXPORT virtual bool expressionInvalid(); + MODEL_EXPORT bool expressionInvalid() override; /// Allows to set expression (text) error (by the parameters listener) - MODEL_EXPORT virtual void setExpressionError(const std::string &theError); + MODEL_EXPORT void setExpressionError(const std::string &theError) override; /// Returns an expression error - MODEL_EXPORT virtual std::string expressionError(); + MODEL_EXPORT std::string expressionError() override; /// Defines the used parameters - MODEL_EXPORT virtual void - setUsedParameters(const std::set &theUsedParameters); + MODEL_EXPORT void + setUsedParameters(const std::set &theUsedParameters) override; /// Returns the used parameters - MODEL_EXPORT virtual std::set usedParameters() const; + MODEL_EXPORT std::set usedParameters() const override; protected: /// Initializes attributes Model_AttributeDouble(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; /// Resets attribute to deafult state. - virtual void reset(); + void reset() override; friend class Model_Data; }; diff --git a/src/Model/Model_AttributeDoubleArray.h b/src/Model/Model_AttributeDoubleArray.h index 112178757..2726ab058 100644 --- a/src/Model/Model_AttributeDoubleArray.h +++ b/src/Model/Model_AttributeDoubleArray.h @@ -37,23 +37,24 @@ class Model_AttributeDoubleArray : public ModelAPI_AttributeDoubleArray { public: /// Returns the size of the array (zero means that it is empty) - MODEL_EXPORT virtual int size(); + MODEL_EXPORT int size() override; /// Sets the new size of the array. The previous data is erased. - MODEL_EXPORT virtual void setSize(const int theSize); + MODEL_EXPORT void setSize(const int theSize) override; /// Defines the value of the array by index [0; size-1] - MODEL_EXPORT virtual void setValue(const int theIndex, const double theValue); + MODEL_EXPORT void setValue(const int theIndex, + const double theValue) override; /// Returns the value by the index - MODEL_EXPORT virtual double value(const int theIndex); + MODEL_EXPORT double value(const int theIndex) override; protected: /// Initializes attibutes Model_AttributeDoubleArray(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; private: /// The OCCT array that keeps all values. diff --git a/src/Model/Model_AttributeImage.cpp b/src/Model/Model_AttributeImage.cpp index 6292b29c4..fef1e5b42 100644 --- a/src/Model/Model_AttributeImage.cpp +++ b/src/Model/Model_AttributeImage.cpp @@ -54,7 +54,7 @@ void Model_AttributeImage::setTexture( // Texture Handle(TColStd_HArray1OfByte) aNewArray = new TColStd_HArray1OfByte(0, int(theByteArray.size()) - 1); - std::list::const_iterator itBA = theByteArray.begin(); + auto itBA = theByteArray.begin(); for (int j = 0; itBA != theByteArray.end(); ++itBA, ++j) { aNewArray->SetValue(j, (Standard_Byte)(*itBA)); } diff --git a/src/Model/Model_AttributeImage.h b/src/Model/Model_AttributeImage.h index 2beff9602..3f0be7d7b 100644 --- a/src/Model/Model_AttributeImage.h +++ b/src/Model/Model_AttributeImage.h @@ -43,28 +43,29 @@ class Model_AttributeImage : public ModelAPI_AttributeImage { public: /// Defines the value of the image attribute - MODEL_EXPORT virtual void - setTexture(const int theWidth, const int theHeight, - const std::list &theByteArray, - const std::string &theFormat, const bool sendUpdated = true); + MODEL_EXPORT void setTexture(const int theWidth, const int theHeight, + const std::list &theByteArray, + const std::string &theFormat, + const bool sendUpdated = true) override; /// Returns true, if texture width and height are non-zero - MODEL_EXPORT virtual bool hasTexture(); + MODEL_EXPORT bool hasTexture() override; /// Returns the value of the image attribute - MODEL_EXPORT virtual bool texture(int &theWidth, int &theHeight, - std::list &theByteArray, - std::string &theFormat); + MODEL_EXPORT bool texture(int &theWidth, int &theHeight, + std::list &theByteArray, + std::string &theFormat) override; /// Copy the image data to the destination attribute - virtual void copyTo(std::shared_ptr theTarget) const; + void + copyTo(std::shared_ptr theTarget) const override; protected: /// Initializes attibutes Model_AttributeImage(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_Data; }; diff --git a/src/Model/Model_AttributeIntArray.h b/src/Model/Model_AttributeIntArray.h index dd6d19b38..d6e145a2e 100644 --- a/src/Model/Model_AttributeIntArray.h +++ b/src/Model/Model_AttributeIntArray.h @@ -46,24 +46,25 @@ class Model_AttributeIntArray : public ModelAPI_AttributeIntArray { public: /// Returns the size of the array (zero means that it is empty) - MODEL_EXPORT virtual int size(); + MODEL_EXPORT int size() override; /// Sets the new size of the array. The previous data is erased. - MODEL_EXPORT virtual void setSize(const int theSize, bool sendUpdated = true); + MODEL_EXPORT void setSize(const int theSize, + bool sendUpdated = true) override; /// Defines the value of the array by index [0; size-1] - MODEL_EXPORT virtual void setValue(const int theIndex, const int theValue, - bool sendUpdated = true); + MODEL_EXPORT void setValue(const int theIndex, const int theValue, + bool sendUpdated = true) override; /// Returns the value by the index - MODEL_EXPORT virtual int value(const int theIndex); + MODEL_EXPORT int value(const int theIndex) override; protected: /// Initializes attibutes Model_AttributeIntArray(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_Data; }; diff --git a/src/Model/Model_AttributeInteger.h b/src/Model/Model_AttributeInteger.h index 35c6f96fa..6f17e71ab 100644 --- a/src/Model/Model_AttributeInteger.h +++ b/src/Model/Model_AttributeInteger.h @@ -36,45 +36,45 @@ class ModelAPI_ExpressionInteger; class Model_AttributeInteger : public ModelAPI_AttributeInteger { public: /// Defines the integer value - MODEL_EXPORT virtual void setValue(const int theValue); + MODEL_EXPORT void setValue(const int theValue) override; /// Returns the integer value - MODEL_EXPORT virtual int value(); + MODEL_EXPORT int value() override; /// Defines the calculated value - MODEL_EXPORT virtual void setCalculatedValue(const int theValue); + MODEL_EXPORT void setCalculatedValue(const int theValue) override; /// Defines the text value - MODEL_EXPORT virtual void setText(const std::wstring &theText); + MODEL_EXPORT void setText(const std::wstring &theText) override; /// Returns the text value - MODEL_EXPORT virtual std::wstring text(); + MODEL_EXPORT std::wstring text() override; /// Allows to set expression (text) as invalid (by the parameters listener) - MODEL_EXPORT virtual void setExpressionInvalid(const bool theFlag); + MODEL_EXPORT void setExpressionInvalid(const bool theFlag) override; /// Returns true if text is invalid - MODEL_EXPORT virtual bool expressionInvalid(); + MODEL_EXPORT bool expressionInvalid() override; /// Allows to set expression (text) error (by the parameters listener) - MODEL_EXPORT virtual void setExpressionError(const std::string &theError); + MODEL_EXPORT void setExpressionError(const std::string &theError) override; /// Returns an expression error - MODEL_EXPORT virtual std::string expressionError(); + MODEL_EXPORT std::string expressionError() override; /// Defines the used parameters - MODEL_EXPORT virtual void - setUsedParameters(const std::set &theUsedParameters); + MODEL_EXPORT void + setUsedParameters(const std::set &theUsedParameters) override; /// Returns the used parameters - MODEL_EXPORT virtual std::set usedParameters() const; + MODEL_EXPORT std::set usedParameters() const override; protected: /// Initializes attributes Model_AttributeInteger(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_Data; diff --git a/src/Model/Model_AttributeRefAttr.cpp b/src/Model/Model_AttributeRefAttr.cpp index dc1eb2d70..6df8138ca 100644 --- a/src/Model/Model_AttributeRefAttr.cpp +++ b/src/Model/Model_AttributeRefAttr.cpp @@ -76,7 +76,7 @@ void Model_AttributeRefAttr::setObject(ObjectPtr theObject) { } ADD_BACK_REF(theObject); owner()->data()->sendAttributeUpdated(this); - } else if (theObject.get() == NULL) { + } else if (theObject.get() == nullptr) { REMOVE_BACK_REF(anObject); myRef->Set(myRef->Label()); // reference to itself means that object is null myID->Set(""); // feature is identified by the empty ID diff --git a/src/Model/Model_AttributeRefAttr.h b/src/Model/Model_AttributeRefAttr.h index af39238f5..e5b6c8d36 100644 --- a/src/Model/Model_AttributeRefAttr.h +++ b/src/Model/Model_AttributeRefAttr.h @@ -43,30 +43,30 @@ class Model_AttributeRefAttr : public ModelAPI_AttributeRefAttr { public: /// Returns true if this attribute references to a object (not to the /// attribute) - MODEL_EXPORT virtual bool isObject(); + MODEL_EXPORT bool isObject() override; /// Defines the reference to the attribute - MODEL_EXPORT virtual void - setAttr(std::shared_ptr theAttr); + MODEL_EXPORT void + setAttr(std::shared_ptr theAttr) override; /// Returns attribute referenced from this attribute - MODEL_EXPORT virtual std::shared_ptr attr(); + MODEL_EXPORT std::shared_ptr attr() override; /// Defines the reference to the object - MODEL_EXPORT virtual void setObject(ObjectPtr theFeature); + MODEL_EXPORT void setObject(ObjectPtr theFeature) override; /// Returns object referenced from this attribute - MODEL_EXPORT virtual ObjectPtr object(); + MODEL_EXPORT ObjectPtr object() override; /// Returns true if attribute was initialized by some value - MODEL_EXPORT virtual bool isInitialized(); + MODEL_EXPORT bool isInitialized() override; protected: /// Objects are created for features automatically MODEL_EXPORT Model_AttributeRefAttr(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_Data; }; diff --git a/src/Model/Model_AttributeRefAttrList.cpp b/src/Model/Model_AttributeRefAttrList.cpp index 8a42d38dc..d3badd6f4 100644 --- a/src/Model/Model_AttributeRefAttrList.cpp +++ b/src/Model/Model_AttributeRefAttrList.cpp @@ -60,7 +60,7 @@ void Model_AttributeRefAttrList::append(AttributePtr theAttr) { void Model_AttributeRefAttrList::remove(ObjectPtr theObject) { TDF_Label aTheObjLab; - if (theObject.get() != NULL) { + if (theObject.get() != nullptr) { aTheObjLab = std::dynamic_pointer_cast(theObject->data()) ->label() .Father(); @@ -83,11 +83,11 @@ void Model_AttributeRefAttrList::remove(ObjectPtr theObject) { if (aOneisDeleted || aRefIter.Value() != aTheObjLab || !anIDIter.Value().IsEmpty() || (aTheObjLab.IsNull() && - aDoc->objects()->object(aRefIter.Value()) != NULL)) { + aDoc->objects()->object(aRefIter.Value()) != nullptr)) { myRef->Append(aRefIter.Value()); myIDs->Append(anIDIter.Value()); } else if (aTheObjLab.IsNull() && - aDoc->objects()->object(aRefIter.Value()) != NULL) { + aDoc->objects()->object(aRefIter.Value()) != nullptr) { aOneisDeleted = true; } } @@ -99,7 +99,7 @@ void Model_AttributeRefAttrList::remove(ObjectPtr theObject) { void Model_AttributeRefAttrList::remove(AttributePtr theAttr) { TDF_Label aTheObjLab; - if (theAttr->owner().get() != NULL) { + if (theAttr->owner().get() != nullptr) { aTheObjLab = std::dynamic_pointer_cast(theAttr->owner()->data()) ->label() .Father(); @@ -122,7 +122,7 @@ void Model_AttributeRefAttrList::remove(AttributePtr theAttr) { // append now only not removed aRefIter.Value() != aTheObjLab || // append now only not removed (aTheObjLab.IsNull() && - aDoc->objects()->object(aRefIter.Value()) != NULL)) { + aDoc->objects()->object(aRefIter.Value()) != nullptr)) { myRef->Append(aRefIter.Value()); myIDs->Append(anIDIter.Value()); } else { @@ -139,8 +139,7 @@ void Model_AttributeRefAttrList::clear() { std::list> anOldList = list(); myRef->Clear(); myIDs->Clear(); - std::list>::iterator anOldIter = - anOldList.begin(); + auto anOldIter = anOldList.begin(); for (; anOldIter != anOldList.end(); anOldIter++) { REMOVE_BACK_REF((anOldIter->first)); } diff --git a/src/Model/Model_AttributeRefAttrList.h b/src/Model/Model_AttributeRefAttrList.h index 81b6d2e91..e5e7ee166 100644 --- a/src/Model/Model_AttributeRefAttrList.h +++ b/src/Model/Model_AttributeRefAttrList.h @@ -43,56 +43,56 @@ class Model_AttributeRefAttrList : public ModelAPI_AttributeRefAttrList { myIDs; ///< the referenced attributes IDs (empty for just object) public: /// Appends the feature to the end of a list - MODEL_EXPORT virtual void append(ObjectPtr theObject); + MODEL_EXPORT void append(ObjectPtr theObject) override; /// Appends the attribute to the end of a list - MODEL_EXPORT virtual void append(AttributePtr theAttr); + MODEL_EXPORT void append(AttributePtr theAttr) override; /// Erases the first meet of the feature in the list - MODEL_EXPORT virtual void remove(ObjectPtr theObject); + MODEL_EXPORT void remove(ObjectPtr theObject) override; /// Erases the first meet of the attribute in the list - MODEL_EXPORT virtual void remove(AttributePtr theAttr); + MODEL_EXPORT void remove(AttributePtr theAttr) override; /// Removes all references from the list - MODEL_EXPORT virtual void clear(); + MODEL_EXPORT void clear() override; /// Returns number of features in the list - MODEL_EXPORT virtual int size() const; + MODEL_EXPORT int size() const override; /// Returns the list of features and attributes (if it is reference to the /// attribute) - MODEL_EXPORT virtual std::list> list(); + MODEL_EXPORT std::list> list() override; /// Returns true if the object is in list - MODEL_EXPORT virtual bool isInList(const ObjectPtr &theObj); + MODEL_EXPORT bool isInList(const ObjectPtr &theObj) override; /// Returns true if the attribute is in list - MODEL_EXPORT virtual bool isInList(const AttributePtr &theObj); + MODEL_EXPORT bool isInList(const AttributePtr &theObj) override; /// Returns true if this is reference to an attribute, not just object - MODEL_EXPORT virtual bool isAttribute(const int theIndex) const; + MODEL_EXPORT bool isAttribute(const int theIndex) const override; /// Returns the referenced object by the zero-based index ///\param theIndex zero-based index in the list - MODEL_EXPORT virtual ObjectPtr object(const int theIndex) const; + MODEL_EXPORT ObjectPtr object(const int theIndex) const override; /// Returns the referenced attribute by the zero-based index ///\param theIndex zero-based index in the list - MODEL_EXPORT virtual AttributePtr attribute(const int theIndex) const; + MODEL_EXPORT AttributePtr attribute(const int theIndex) const override; /// Removes the last element in the list. - MODEL_EXPORT virtual void removeLast(); + MODEL_EXPORT void removeLast() override; /// Removes the elements from the list. /// \param theIndices a list of indices of elements to be removed - MODEL_EXPORT virtual void remove(const std::set &theIndices); + MODEL_EXPORT void remove(const std::set &theIndices) override; /// Returns true if attribute was initialized by some value - MODEL_EXPORT virtual bool isInitialized(); + MODEL_EXPORT bool isInitialized() override; protected: /// Objects are created for features automatically MODEL_EXPORT Model_AttributeRefAttrList(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_Data; }; diff --git a/src/Model/Model_AttributeRefList.cpp b/src/Model/Model_AttributeRefList.cpp index 8337e14f3..9f51ce014 100644 --- a/src/Model/Model_AttributeRefList.cpp +++ b/src/Model/Model_AttributeRefList.cpp @@ -63,7 +63,7 @@ void Model_AttributeRefList::append(ObjectPtr theObject) { void Model_AttributeRefList::remove(ObjectPtr theObject) { eraseHash(); - if (theObject.get() != NULL) { + if (theObject.get() != nullptr) { if (owner()->document() == theObject->document()) { std::shared_ptr aData; aData = std::dynamic_pointer_cast(theObject->data()); @@ -121,7 +121,7 @@ void Model_AttributeRefList::remove(ObjectPtr theObject) { for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) { ObjectPtr anObj = aDoc->objects()->object(aLIter.Value()); - if (anObj.get() == NULL) { + if (anObj.get() == nullptr) { myRef->Remove(aLIter.Value()); REMOVE_BACK_REF(theObject); owner()->data()->sendAttributeUpdated(this); @@ -135,7 +135,7 @@ void Model_AttributeRefList::remove(ObjectPtr theObject) { void Model_AttributeRefList::clear() { std::list anOldList = list(); myRef->Clear(); - std::list::iterator anOldIter = anOldList.begin(); + auto anOldIter = anOldList.begin(); for (; anOldIter != anOldList.end(); anOldIter++) { REMOVE_BACK_REF((*anOldIter)); } @@ -204,7 +204,7 @@ ObjectPtr Model_AttributeRefList::iteratedObject( std::list Model_AttributeRefList::list() { createHash(); std::list aResult; - std::map::iterator aHashIter = myHashIndex.begin(); + auto aHashIter = myHashIndex.begin(); for (; aHashIter != myHashIndex.end(); aHashIter++) { aResult.push_back(aHashIter->second); } diff --git a/src/Model/Model_AttributeRefList.h b/src/Model/Model_AttributeRefList.h index 59e418449..5984b3361 100644 --- a/src/Model/Model_AttributeRefList.h +++ b/src/Model/Model_AttributeRefList.h @@ -50,48 +50,48 @@ class Model_AttributeRefList : public ModelAPI_AttributeRefList { myHashIndexNoEmpty; ///< index to not empty object in the list public: /// Appends the feature to the end of a list - MODEL_EXPORT virtual void append(ObjectPtr theObject); + MODEL_EXPORT void append(ObjectPtr theObject) override; /// Erases the first meet of the feature in the list - MODEL_EXPORT virtual void remove(ObjectPtr theObject); + MODEL_EXPORT void remove(ObjectPtr theObject) override; /// Returns number of features in the list ///\param theWithEmpty if it is false, returns the number of not-empty /// referenced objects - MODEL_EXPORT virtual int size(const bool theWithEmpty = true) const; + MODEL_EXPORT int size(const bool theWithEmpty = true) const override; /// Removes all references from the list - MODEL_EXPORT virtual void clear(); + MODEL_EXPORT void clear() override; /// Returns the list of features - MODEL_EXPORT virtual std::list list(); + MODEL_EXPORT std::list list() override; /// Returns true if the object is in list - MODEL_EXPORT virtual bool isInList(const ObjectPtr &theObj); + MODEL_EXPORT bool isInList(const ObjectPtr &theObj) override; /// Returns the list of features ///\param theIndex zero-based index in the list ///\param theWithEmpty if it is false, counts the not-empty referenced objects /// only - MODEL_EXPORT virtual ObjectPtr object(const int theIndex, - const bool theWithEmpty = true); + MODEL_EXPORT ObjectPtr object(const int theIndex, + const bool theWithEmpty = true) override; /// Substitutes the feature by another one. Does nothing if such object is not /// found. Does not support the external documents objects yet. - MODEL_EXPORT virtual void substitute(const ObjectPtr &theCurrent, - const ObjectPtr &theNew); + MODEL_EXPORT void substitute(const ObjectPtr &theCurrent, + const ObjectPtr &theNew) override; /// Removes the last element in the list. /// Does not support the external documents objects yet. - MODEL_EXPORT virtual void removeLast(); + MODEL_EXPORT void removeLast() override; /// Removes the elements from the list. /// Does not support the external documents objects yet. /// \param theIndices a list of indices of elements to be removed - MODEL_EXPORT virtual void remove(const std::set &theIndices); + MODEL_EXPORT void remove(const std::set &theIndices) override; /// Returns true if attribute was initialized by some value - MODEL_EXPORT virtual bool isInitialized(); + MODEL_EXPORT bool isInitialized() override; /// Erases the hashed objects caused by complicated modifications in the list void eraseHash(); @@ -101,7 +101,7 @@ protected: MODEL_EXPORT Model_AttributeRefList(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; /// Returns the object by iterators (theExtIter is iterated if necessary) ObjectPtr iteratedObject(TDF_ListIteratorOfLabelList &theLIter, diff --git a/src/Model/Model_AttributeReference.cpp b/src/Model/Model_AttributeReference.cpp index 98512382c..991c90855 100644 --- a/src/Model/Model_AttributeReference.cpp +++ b/src/Model/Model_AttributeReference.cpp @@ -150,4 +150,4 @@ void Model_AttributeReference::setObject( } } -Model_AttributeReference::~Model_AttributeReference() {} +Model_AttributeReference::~Model_AttributeReference() = default; diff --git a/src/Model/Model_AttributeReference.h b/src/Model/Model_AttributeReference.h index 35b930e94..55555574a 100644 --- a/src/Model/Model_AttributeReference.h +++ b/src/Model/Model_AttributeReference.h @@ -38,25 +38,25 @@ class Model_AttributeReference : public ModelAPI_AttributeReference { Handle_TDF_Reference myRef; ///< references to the feature label public: /// Defines the object referenced from this attribute - MODEL_EXPORT virtual void setValue(ObjectPtr theObject); + MODEL_EXPORT void setValue(ObjectPtr theObject) override; /// Returns object referenced from this attribute - MODEL_EXPORT virtual ObjectPtr value(); + MODEL_EXPORT ObjectPtr value() override; - MODEL_EXPORT ~Model_AttributeReference(); + MODEL_EXPORT ~Model_AttributeReference() override; - MODEL_EXPORT virtual void - setObject(const std::shared_ptr &theObject); + MODEL_EXPORT void + setObject(const std::shared_ptr &theObject) override; /// Returns true if attribute was initialized by some value - MODEL_EXPORT virtual bool isInitialized(); + MODEL_EXPORT bool isInitialized() override; protected: /// Objects are created for features automatically MODEL_EXPORT Model_AttributeReference(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_Data; friend class Model_AttributeSelection; diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index f6779ad55..364895a1d 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -148,7 +148,7 @@ bool Model_AttributeSelection::setValue( // do not use the degenerated edge as a shape, a null context and shape is // used in the case if (theSubShape.get() && !theSubShape->isNull() && theSubShape->isEdge()) { - const TopoDS_Shape &aSubShape = theSubShape->impl(); + const auto &aSubShape = theSubShape->impl(); if (aSubShape.ShapeType() == TopAbs_EDGE) isDegeneratedEdge = BRep_Tool::Degenerated(TopoDS::Edge(aSubShape)) == Standard_True; @@ -280,7 +280,7 @@ void Model_AttributeSelection::removeTemporaryValues() { GeomShapePtr centerByEdge(GeomShapePtr theEdge, ModelAPI_AttributeSelection::CenterType theType) { if (theType != ModelAPI_AttributeSelection::NOT_CENTER && - theEdge.get() != NULL) { + theEdge.get() != nullptr) { TopoDS_Shape aShape = theEdge->impl(); if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE) { TopoDS_Edge anEdge = TopoDS::Edge(aShape); @@ -416,8 +416,7 @@ Model_AttributeSelection::internalValue(CenterType &theType) { FeaturePtr aFeature = contextFeature(); if (aFeature.get()) { std::list allShapes; - std::list::const_iterator aRes = - aFeature->results().cbegin(); + auto aRes = aFeature->results().cbegin(); for (; aRes != aFeature->results().cend(); aRes++) { if (aRes->get() && !(*aRes)->isDisabled()) { GeomShapePtr aShape = (*aRes)->shape(); @@ -459,7 +458,7 @@ bool Model_AttributeSelection::isInitialized() { if (aSelLab.IsAttribute(kSIMPLE_REF_ID) || aSelLab.IsAttribute(kPART_REF_ID)) { ResultPtr aContext = context(); - return aContext.get() != NULL; + return aContext.get() != nullptr; } Handle(TNaming_NamedShape) aSelection; if (selectionLabel().FindAttribute(TNaming_NamedShape::GetID(), @@ -479,14 +478,14 @@ bool Model_AttributeSelection::isInitialized() { if (!aMyDoc.get()) return false; // check at least the feature exists - return aMyDoc->featureByLab(aRefLab).get() != NULL; + return aMyDoc->featureByLab(aRefLab).get() != nullptr; } } return false; } Model_AttributeSelection::Model_AttributeSelection(TDF_Label &theLabel) - : myRef(theLabel), myTmpCenterType(NOT_CENTER), myParent(NULL), + : myRef(theLabel), myTmpCenterType(NOT_CENTER), myParent(nullptr), myIsGeometricalSelection(false) { myIsInitialized = myRef.isInitialized(); } @@ -901,8 +900,7 @@ Model_AttributeSelection::namingName(const std::wstring &theDefaultName) { // center-name static ModelAPI_AttributeSelection::CenterType centerTypeByName(std::wstring &theShapeName) { - std::map::iterator - aPrefixIter = centersMap().begin(); + auto aPrefixIter = centersMap().begin(); for (; aPrefixIter != centersMap().end(); aPrefixIter++) { std::size_t aFound = theShapeName.find(aPrefixIter->second); if (aFound != std::wstring::npos && @@ -1120,12 +1118,12 @@ void Model_AttributeSelection::selectSubShape(const std::string &theType, // too. std::list aPartSetFeatures = aFeatures; aFeatures.clear(); - for (std::list::iterator it = aPartSetFeatures.begin(); - it != aPartSetFeatures.end(); ++it) { - aFeatures.push_back(*it); - if ((*it)->firstResult()->groupName() == ModelAPI_ResultPart::group()) { + for (auto &aPartSetFeature : aPartSetFeatures) { + aFeatures.push_back(aPartSetFeature); + if (aPartSetFeature->firstResult()->groupName() == + ModelAPI_ResultPart::group()) { ResultPartPtr aPart = std::dynamic_pointer_cast( - (*it)->firstResult()); + aPartSetFeature->firstResult()); std::list aPartFeatures = aPart->partDoc()->allFeatures(); aFeatures.insert(aFeatures.end(), aPartFeatures.begin(), aPartFeatures.end()); @@ -1148,7 +1146,7 @@ void Model_AttributeSelection::selectSubShape(const std::string &theType, // feature bool isSubOfComposite = false; const std::set &aRefs = (*anIt)->data()->refsToMe(); - for (std::set::const_iterator aRefIt = aRefs.begin(); + for (auto aRefIt = aRefs.begin(); aRefIt != aRefs.end() && !isSubOfComposite; ++aRefIt) { FeaturePtr aFeature = ModelAPI_Feature::feature((*aRefIt)->owner()); CompositeFeaturePtr aCompFeature = @@ -1161,8 +1159,7 @@ void Model_AttributeSelection::selectSubShape(const std::string &theType, // process results of the current feature to find appropriate sub-shape if (ModelGeomAlgo_Shape::findSubshapeByPoint(*anIt, thePoint, aType, anAppropriate)) { - std::list::iterator anApIt = - anAppropriate.begin(); + auto anApIt = anAppropriate.begin(); for (; aSelectionIndex > 0 && anApIt != anAppropriate.end(); --aSelectionIndex) ++anApIt; // skip this shape, because one of the previous is selected @@ -1285,7 +1282,7 @@ void Model_AttributeSelection::computeValues(ResultPtr theOldContext, if (aComp.get()) { std::list allNewContextSubs; ModelAPI_Tools::allSubs(aComp, allNewContextSubs); - std::list::iterator aSub = allNewContextSubs.begin(); + auto aSub = allNewContextSubs.begin(); for (; aSub != allNewContextSubs.end(); aSub++) { ResultBodyPtr aBody = std::dynamic_pointer_cast(*aSub); @@ -1303,7 +1300,7 @@ void Model_AttributeSelection::computeValues(ResultPtr theOldContext, aNewToOld; // map from new containers to old containers (with val) TopTools_MapOfShape anOlds; // to know how many olds produced new containers for (; aToFindPart != 2 && theShapes.IsEmpty(); aToFindPart++) { - std::list::iterator aNewContIter = aNewToIterate.begin(); + auto aNewContIter = aNewToIterate.begin(); for (; aNewContIter != aNewToIterate.end(); aNewContIter++) { std::shared_ptr aNewData = std::dynamic_pointer_cast((*aNewContIter)->data()); @@ -1466,7 +1463,7 @@ void Model_AttributeSelection::concealedFeature( } else { // all results of a feature aRootRes = theFeature->results(); } - std::list::const_iterator aRootIter = aRootRes.cbegin(); + auto aRootIter = aRootRes.cbegin(); for (; aRootIter != aRootRes.cend(); aRootIter++) { std::list allRes; allRes.push_back((*aRootIter)->data()); @@ -1476,16 +1473,14 @@ void Model_AttributeSelection::concealedFeature( if (aRootBody.get()) { std::list allSub; ModelAPI_Tools::allSubs(aRootBody, allSub); - for (std::list::iterator anIt = allSub.begin(); - anIt != allSub.end(); anIt++) - allRes.push_back((*anIt)->data()); + for (auto &anIt : allSub) + allRes.push_back(anIt->data()); } if (theCheckWholeFeature) allRes.push_back(theFeature->data()); - for (std::list::iterator aRIter = allRes.begin(); - aRIter != allRes.end(); aRIter++) { - const std::set &aRefs = (*aRIter)->refsToMe(); - std::set::const_iterator aRef = aRefs.cbegin(); + for (auto &allRe : allRes) { + const std::set &aRefs = allRe->refsToMe(); + auto aRef = aRefs.cbegin(); for (; aRef != aRefs.cend(); aRef++) { if (!aRef->get() || !(*aRef)->owner().get()) continue; @@ -1587,16 +1582,14 @@ bool Model_AttributeSelection::searchNewContext( } } // if there exist context composite and sub-result(s), leave only sub(s) - for (std::list::iterator aResIter = aResults.begin(); - aResIter != aResults.end();) { + for (auto aResIter = aResults.begin(); aResIter != aResults.end();) { ResultPtr aParent = ModelAPI_Tools::bodyOwner(*aResIter); for (; aParent.get(); aParent = ModelAPI_Tools::bodyOwner(aParent)) if (aResultsSet.count(aParent)) break; if (aParent.get()) { aResultsSet.erase(aParent); - for (std::list::iterator anIt = aResults.begin(); - anIt != aResults.end(); anIt++) { + for (auto anIt = aResults.begin(); anIt != aResults.end(); anIt++) { if (*anIt == aParent) { aResults.erase(anIt); aResIter = aResults.begin(); // erase from set, so, restart iteration @@ -1617,11 +1610,11 @@ bool Model_AttributeSelection::searchNewContext( std::list aConcealers; concealedFeature(aContextOwner, aThisFeature, false, aConcealers, theContext); - std::list::iterator aConcealer = aConcealers.begin(); + auto aConcealer = aConcealers.begin(); for (; aConcealer != aConcealers.end(); aConcealer++) { std::list aRefResults; ModelAPI_Tools::allResults(*aConcealer, aRefResults); - std::list::iterator aRefIter = aRefResults.begin(); + auto aRefIter = aRefResults.begin(); for (; aRefIter != aRefResults.end(); aRefIter++) { ResultBodyPtr aRefBody = std::dynamic_pointer_cast(*aRefIter); @@ -1671,8 +1664,8 @@ bool Model_AttributeSelection::searchNewContext( } } // check for the further modifications of the copy contexts and values - std::list::iterator aCopyContIter = aCopyContext.begin(); - std::list::iterator aCopyValIter = aCopyVals.begin(); + auto aCopyContIter = aCopyContext.begin(); + auto aCopyValIter = aCopyVals.begin(); for (; aCopyContIter != aCopyContext.end(); aCopyContIter++, aCopyValIter++) { ResultPtr aNewCont = @@ -1687,7 +1680,7 @@ bool Model_AttributeSelection::searchNewContext( if (searchNewContext(theDoc, aNewContShape, aNewCont, aNewValShape, theAccessLabel, aNewRes, aNewUpdatedVal)) { // append new results instead of the current ones - std::list::iterator aNewIter = aNewRes.begin(); + auto aNewIter = aNewRes.begin(); TopTools_ListIteratorOfListOfShape aNewUpdVal(aNewUpdatedVal); for (; aNewIter != aNewRes.end(); aNewIter++, aNewUpdVal.Next()) { theResults.push_back(*aNewIter); @@ -1710,9 +1703,9 @@ bool Model_AttributeSelection::searchNewContext( return false; // iterate all results to find further modifications - std::list::iterator aResIter = aResults.begin(); + auto aResIter = aResults.begin(); for (aResIter = aResults.begin(); aResIter != aResults.end(); aResIter++) { - if (aResIter->get() != NULL) { + if (aResIter->get() != nullptr) { ResultPtr aNewResObj = *aResIter; // compute new values by two contexts: the old and the new TopTools_ListOfShape aValShapes; @@ -1730,7 +1723,7 @@ bool Model_AttributeSelection::searchNewContext( if (searchNewContext(theDoc, aNewContShape, aNewResObj, aNewValSh, theAccessLabel, aNewRes, aNewUpdatedVal)) { // append new results instead of the current ones - std::list::iterator aNewIter = aNewRes.begin(); + auto aNewIter = aNewRes.begin(); TopTools_ListIteratorOfListOfShape aNewUpdVal(aNewUpdatedVal); for (; aNewIter != aNewRes.end(); aNewIter++, aNewUpdVal.Next()) { theResults.push_back(*aNewIter); @@ -1771,7 +1764,7 @@ void Model_AttributeSelection::updateInHistory(bool &theRemove) { // if there are copies, but no direct modification, keep the original bool aKeepOrigin = false; if (aCopyPossible) { - std::list::iterator aConcealer = aConcealers.begin(); + auto aConcealer = aConcealers.begin(); for (aKeepOrigin = true; aConcealer != aConcealers.end(); aConcealer++) if (!std::dynamic_pointer_cast( @@ -1785,7 +1778,7 @@ void Model_AttributeSelection::updateInHistory(bool &theRemove) { } } bool aChanged = false; - std::list::iterator aConcealer = aConcealers.begin(); + auto aConcealer = aConcealers.begin(); for (; aConcealer != aConcealers.end(); aConcealer++) if (aChanged) { if (aKeepOrigin || !myParent->isInList(*aConcealer, anEmptyShape)) @@ -1843,7 +1836,7 @@ void Model_AttributeSelection::updateInHistory(bool &theRemove) { // the referenced cont const std::set &aRefs = aPartContext->data()->refsToMe(); - std::set::const_iterator aRef = aRefs.begin(); + auto aRef = aRefs.begin(); for (; aRef != aRefs.end(); aRef++) { // to avoid detection of part changes by local selection only AttributeSelectionPtr aSel = @@ -1907,7 +1900,7 @@ void Model_AttributeSelection::updateInHistory(bool &theRemove) { std::set aSkippedContext; // if there exist context composite and sub-result(s), leave only sub(s) - std::set::iterator aResIter = allContexts.begin(); + auto aResIter = allContexts.begin(); for (; aResIter != allContexts.end(); aResIter++) { ResultPtr aParent = ModelAPI_Tools::bodyOwner(*aResIter); for (; aParent.get(); aParent = ModelAPI_Tools::bodyOwner(aParent)) @@ -1934,7 +1927,7 @@ void Model_AttributeSelection::updateInHistory(bool &theRemove) { myParent && myParent->isWholeResultAllowed() && !aSubShape.get(); GeomAPI_Shape::ShapeType allowedType = GeomAPI_Shape::SHAPE; if (isWholeResult) { - std::list::iterator aNewCont = aNewContexts.begin(); + auto aNewCont = aNewContexts.begin(); TopTools_ListIteratorOfListOfShape aNewValues(aValShapes); for (; aNewCont != aNewContexts.end(); aNewCont++, aNewValues.Next()) { if (aNewValues.Value().IsNull()) { // only for the whole context @@ -1948,11 +1941,11 @@ void Model_AttributeSelection::updateInHistory(bool &theRemove) { aShapeType) { // select the best, nearest to the origin GeomAPI_Shape::ShapeType anOldShapeType = aContext->shape()->shapeType(); - GeomAPI_Shape::ShapeType aDeltaAllowed = + auto aDeltaAllowed = (GeomAPI_Shape::ShapeType)(anOldShapeType - anAllowed); if (aDeltaAllowed < 0) aDeltaAllowed = (GeomAPI_Shape::ShapeType)(-aDeltaAllowed); - GeomAPI_Shape::ShapeType aDeltaThis = + auto aDeltaThis = (GeomAPI_Shape::ShapeType)(anOldShapeType - aShapeType); if (aDeltaThis < 0) aDeltaThis = (GeomAPI_Shape::ShapeType)(-aDeltaThis); @@ -1969,7 +1962,7 @@ void Model_AttributeSelection::updateInHistory(bool &theRemove) { } } - std::list::iterator aNewCont = aNewContexts.begin(); + auto aNewCont = aNewContexts.begin(); TopTools_ListIteratorOfListOfShape aNewValues(aValShapes); bool aFirst = true; // first is set to this, next are appended to parent for (; aNewCont != aNewContexts.end(); aNewCont++, aNewValues.Next()) { @@ -2011,12 +2004,11 @@ void Model_AttributeSelection::updateInHistory(bool &theRemove) { if (aBodyContext.get() && aBodyContext->numberOfSubs() != 0) { std::list aLower; ModelAPI_Tools::allSubs(aBodyContext, aLower, true); - for (std::list::iterator aL = aLower.begin(); - aL != aLower.end(); aL++) { - GeomShapePtr aLShape = (*aL)->shape(); + for (auto &aL : aLower) { + GeomShapePtr aLShape = aL->shape(); if (aLShape.get() && !aLShape->isNull()) { if (aLShape->isSubShape(aValueShape, false)) { - aNewContext = *aL; + aNewContext = aL; break; } } @@ -2170,8 +2162,7 @@ bool Model_AttributeSelection::restoreContext(std::wstring theName, FeaturePtr aSub = aComposite->subFeature(a); const std::list> &aResults = aSub->results(); - std::list>::const_iterator aRes = - aResults.cbegin(); + auto aRes = aResults.cbegin(); for (; aRes != aResults.cend() && theValue.IsNull(); aRes++) { if ((*aRes)->data()->name() == aCompName) { theValue = std::dynamic_pointer_cast((*aRes)->data()) @@ -2283,9 +2274,8 @@ ResultPtr Model_AttributeSelection::newestContext(const ResultPtr theCurrent, if (aCompBody.get()) { std::list allSub; ModelAPI_Tools::allSubs(aCompBody, allSub); - for (std::list::iterator anIt = allSub.begin(); - anIt != allSub.end(); anIt++) - allRes.push_back((*anIt)->data()); + for (auto &anIt : allSub) + allRes.push_back(anIt->data()); allRes.push_back(aCompBody->data()); aCompContext = aCompBody; } @@ -2294,16 +2284,14 @@ ResultPtr Model_AttributeSelection::newestContext(const ResultPtr theCurrent, allRes.push_back(aResult->document()->feature(aResult)->data()); bool aFoundReferernce = false; - for (std::list::iterator aSub = allRes.begin(); - aSub != allRes.end(); aSub++) { - DataPtr aResCont = *aSub; + for (auto aResCont : allRes) { ResultBodyPtr aResBody = std::dynamic_pointer_cast(aResCont->owner()); if (aResBody.get() && aResBody->numberOfSubs() > 0 && aResBody != aCompContext) continue; // only lower and higher level subs are counted const std::set &aRefs = aResCont->refsToMe(); - std::set::const_iterator aRef = aRefs.begin(); + auto aRef = aRefs.begin(); for (; !aFindNewContext && aRef != aRefs.end(); aRef++) { if (!aRef->get() || !(*aRef)->owner().get()) continue; @@ -2319,7 +2307,7 @@ ResultPtr Model_AttributeSelection::newestContext(const ResultPtr theCurrent, // take all sub-results or one result std::list aRefFeatResults; ModelAPI_Tools::allResults(aRefFeat, aRefFeatResults); - std::list::iterator aRefResIter = aRefFeatResults.begin(); + auto aRefResIter = aRefFeatResults.begin(); for (; aRefResIter != aRefFeatResults.end(); aRefResIter++) { ResultBodyPtr aBody = std::dynamic_pointer_cast(*aRefResIter); @@ -2327,8 +2315,7 @@ ResultPtr Model_AttributeSelection::newestContext(const ResultPtr theCurrent, aBody->numberOfSubs() == 0) // add only lower level subs aResults.push_back(aBody); } - std::list>::iterator aResIter = - aResults.begin(); + auto aResIter = aResults.begin(); // searching by sub-shape for (; aResIter != aResults.end(); aResIter++) { @@ -2358,7 +2345,7 @@ ResultPtr Model_AttributeSelection::newestContext(const ResultPtr theCurrent, if (aComp && aComp->numberOfSubs()) { std::list allSubs; ModelAPI_Tools::allSubs(aComp, allSubs); - std::list::iterator aS = allSubs.begin(); + auto aS = allSubs.begin(); for (; aS != allSubs.end(); aS++) { ResultBodyPtr aSub = std::dynamic_pointer_cast(*aS); if (aSub && aSub->numberOfSubs() == 0 && aSub->shape().get() && diff --git a/src/Model/Model_AttributeSelection.h b/src/Model/Model_AttributeSelection.h index b6df06497..b9a3e2c64 100644 --- a/src/Model/Model_AttributeSelection.h +++ b/src/Model/Model_AttributeSelection.h @@ -63,105 +63,105 @@ public: /// added in the data framework /// (used to remove immediately, without the following updates) /// \returns true if attribute was updated - MODEL_EXPORT virtual bool - setValue(const ObjectPtr &theContext, - const std::shared_ptr &theSubShape, - const bool theTemporarily = false); + MODEL_EXPORT bool setValue(const ObjectPtr &theContext, + const std::shared_ptr &theSubShape, + const bool theTemporarily = false) override; /// Same as SetValue, but it takes an edge (on circular or elliptic curve) /// and stores the vertex of the central point (for ellipse the first or the /// second focus point) - MODEL_EXPORT virtual void setValueCenter( - const ObjectPtr &theContext, const std::shared_ptr &theEdge, - const CenterType theCenterType, const bool theTemporarily = false); + MODEL_EXPORT void setValueCenter(const ObjectPtr &theContext, + const std::shared_ptr &theEdge, + const CenterType theCenterType, + const bool theTemporarily = false) override; /// Makes this selection attribute selects the same as in theSource selection - MODEL_EXPORT virtual void - selectValue(const std::shared_ptr &theSource); + MODEL_EXPORT void selectValue( + const std::shared_ptr &theSource) override; /// Reset temporary stored values - virtual void removeTemporaryValues(); + void removeTemporaryValues() override; /// Returns the selected subshape - MODEL_EXPORT virtual std::shared_ptr value(); + MODEL_EXPORT std::shared_ptr value() override; /// Returns the context of the selection (the whole shape owner) - MODEL_EXPORT virtual ResultPtr context(); + MODEL_EXPORT ResultPtr context() override; /// Returns the context of the selection if the whole feature was selected - MODEL_EXPORT virtual FeaturePtr contextFeature(); + MODEL_EXPORT FeaturePtr contextFeature() override; /// Returns the context of the selection : result or feature - MODEL_EXPORT virtual std::shared_ptr contextObject(); + MODEL_EXPORT std::shared_ptr contextObject() override; /// Sets the feature object - MODEL_EXPORT virtual void - setObject(const std::shared_ptr &theObject); + MODEL_EXPORT void + setObject(const std::shared_ptr &theObject) override; /// Updates the selection due to the changes in the referenced objects /// \returns false if update is failed - MODEL_EXPORT virtual bool update(); + MODEL_EXPORT bool update() override; /// Returns a textual string of the selection /// \param theDefaultValue a name, which is returned if the naming name can /// not be obtained - MODEL_EXPORT virtual std::wstring - namingName(const std::wstring &theDefaultValue = L""); + MODEL_EXPORT std::wstring + namingName(const std::wstring &theDefaultValue = L"") override; /// Defines the sub-shape by Id - MODEL_EXPORT virtual void setId(int theID); + MODEL_EXPORT void setId(int theID) override; /// Selects (i.e. creates Naming data structure) of sub-shape specified by /// textual name - MODEL_EXPORT virtual void selectSubShape(const std::string &theType, - const std::wstring &theSubShapeName); + MODEL_EXPORT void + selectSubShape(const std::string &theType, + const std::wstring &theSubShapeName) override; /// Selects sub-shape by its inner point - MODEL_EXPORT virtual void + MODEL_EXPORT void selectSubShape(const std::string &theType, - const std::shared_ptr &thePoint); + const std::shared_ptr &thePoint) override; /// Selects sub-shape by weak naming index - MODEL_EXPORT virtual void selectSubShape(const std::string &theType, - const std::wstring &theContextName, - const int theIndex); + MODEL_EXPORT void selectSubShape(const std::string &theType, + const std::wstring &theContextName, + const int theIndex) override; /// Returns true if attribute was initialized by some value - MODEL_EXPORT virtual bool isInitialized(); + MODEL_EXPORT bool isInitialized() override; /// Returns true if recompute of selection become impossible - MODEL_EXPORT virtual bool isInvalid(); + MODEL_EXPORT bool isInvalid() override; /// Updates the arguments of selection if something was affected by creation /// or reorder of features upper in the history line (issue #1757) /// Returns theRemove true if this attribute must be removed (become deleted) - MODEL_EXPORT virtual void updateInHistory(bool &theRemove) override; + MODEL_EXPORT void updateInHistory(bool &theRemove) override; // Implementation of the name generator method from the Selector package // This method returns the context name by the label of the sub-selected shape - MODEL_EXPORT virtual std::wstring + MODEL_EXPORT std::wstring contextName(const TDF_Label theSelectionLab) override; /// This method restores by the context and value name the context label and /// sub-label where the value is. Returns true if it is valid. - MODEL_EXPORT virtual bool restoreContext(std::wstring theName, - TDF_Label &theContext, - TDF_Label &theValue) override; + MODEL_EXPORT bool restoreContext(std::wstring theName, TDF_Label &theContext, + TDF_Label &theValue) override; /// Returns true if the first result is newer than the second one in the tree /// of features - MODEL_EXPORT virtual bool isLater(const TDF_Label theResult1, - const TDF_Label theResult2) const override; + MODEL_EXPORT bool isLater(const TDF_Label theResult1, + const TDF_Label theResult2) const override; /// Returns the name by context. Adds the part name if the context is located /// in other document - MODEL_EXPORT virtual std::wstring - contextName(const ResultPtr &theContext) const; + MODEL_EXPORT std::wstring + contextName(const ResultPtr &theContext) const override; /// Makes the current local selection becomes all sub-shapes with same base /// geometry. - MODEL_EXPORT virtual void combineGeometrical(); + MODEL_EXPORT void combineGeometrical() override; /// Resets attribute to deafult state - MODEL_EXPORT virtual void reset(); + MODEL_EXPORT void reset() override; protected: /// Objects are created for features automatically @@ -193,7 +193,7 @@ protected: /// Sets the ID of the attribute in Data (called from Data): here it is used /// for myRef ID setting - MODEL_EXPORT virtual void setID(const std::string theID); + MODEL_EXPORT void setID(const std::string theID) override; /// Sets the parent attribute void setParent(Model_AttributeSelectionList *theParent); @@ -221,7 +221,7 @@ protected: TopoDS_Shape theValShape, TopTools_ListOfShape &theShapes); /// Returns true if is geometrical selection. - virtual bool isGeometricalSelection() const { + bool isGeometricalSelection() const override { return myIsGeometricalSelection; }; diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index 6bce6cc6f..471ba4ae0 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -62,7 +62,7 @@ void Model_AttributeSelectionList::append( // do not use the degenerated edge as a shape, a list is not incremented in // this case if (theSubShape.get() && !theSubShape->isNull() && theSubShape->isEdge()) { - const TopoDS_Shape &aSubShape = theSubShape->impl(); + const auto &aSubShape = theSubShape->impl(); if (aSubShape.ShapeType() == TopAbs_EDGE && BRep_Tool::Degenerated(TopoDS::Edge(aSubShape))) { return; @@ -317,12 +317,10 @@ bool Model_AttributeSelectionList::isInList( const bool /*theTemporarily*/) { if (myIsCashed) { // the cashing is active if (theContext.get()) { - std::map>>::iterator - aContext = myCash.find(theContext); + auto aContext = myCash.find(theContext); if (aContext != myCash.end()) { // iterate shapes because "isSame" method must be called for each shape - std::list>::iterator aShapes = - aContext->second.begin(); + auto aShapes = aContext->second.begin(); for (; aShapes != aContext->second.end(); aShapes++) { if (!theSubShape.get()) { if (!aShapes->get()) @@ -347,7 +345,7 @@ bool Model_AttributeSelectionList::isInList( } // no-cash method bool isFeature = - std::dynamic_pointer_cast(theContext).get() != NULL; + std::dynamic_pointer_cast(theContext).get() != nullptr; ResultPtr aRes; if (!isFeature) aRes = std::dynamic_pointer_cast(theContext); @@ -493,8 +491,7 @@ void Model_AttributeSelectionList::setGeometricalSelection( anAttr->value()->shapeType() != GeomAPI_Shape::COMPOUND) continue; // check it is equal to some other attribute already presented in the list - std::list::iterator anAttrIter = - anAttributes.begin(); + auto anAttrIter = anAttributes.begin(); for (; anAttrIter != anAttributes.end(); anAttrIter++) { if (anAttr->context() == (*anAttrIter)->context() && anAttr->namingName() == (*anAttrIter)->namingName()) { diff --git a/src/Model/Model_AttributeSelectionList.h b/src/Model/Model_AttributeSelectionList.h index d107ffbe9..542e72ccf 100644 --- a/src/Model/Model_AttributeSelectionList.h +++ b/src/Model/Model_AttributeSelectionList.h @@ -53,96 +53,94 @@ public: /// selected) \param theTemporarily if it is true, do not store and name the /// added in the data framework /// (used to remove immediately, without the following updates) - MODEL_EXPORT virtual void - append(const ObjectPtr &theContext, - const std::shared_ptr &theSubShape, - const bool theTemporarily = false); + MODEL_EXPORT void append(const ObjectPtr &theContext, + const std::shared_ptr &theSubShape, + const bool theTemporarily = false) override; /// Adds the new reference to the end of the list by the naming name of the /// selected shape The type of shape is taken from the current selection type /// if the given is empty - MODEL_EXPORT virtual void append(const std::wstring &theNamingName, - const std::string &theType = ""); + MODEL_EXPORT void append(const std::wstring &theNamingName, + const std::string &theType = "") override; /// Adds the new reference to the end of the list by inner point on the /// selected shape - MODEL_EXPORT virtual void append(const std::shared_ptr &thePoint, - const std::string &theType); + MODEL_EXPORT void append(const std::shared_ptr &thePoint, + const std::string &theType) override; /// Adds the new reference to the end of the list by weak naming index - MODEL_EXPORT virtual void append(const std::string &theType, - const std::wstring &theContextName, - const int theIndex); + MODEL_EXPORT void append(const std::string &theType, + const std::wstring &theContextName, + const int theIndex) override; /// Copy the selection list to the destination attribute - MODEL_EXPORT virtual void copyTo(AttributeSelectionListPtr theTarget) const; + MODEL_EXPORT void copyTo(AttributeSelectionListPtr theTarget) const override; /// Reset temporary stored values - virtual void removeTemporaryValues(); + void removeTemporaryValues() override; /// Removes the last element in the list - MODEL_EXPORT virtual void removeLast(); + MODEL_EXPORT void removeLast() override; /// Removes the elements from the list. /// \param theIndices a list of indices of elements to be removed - MODEL_EXPORT virtual void remove(const std::set &theIndices); + MODEL_EXPORT void remove(const std::set &theIndices) override; /// Returns the number of selection attributes in the list - MODEL_EXPORT virtual int size(); + MODEL_EXPORT int size() override; /// Returns true if the object with the shape are in list /// \param theContext object where the sub-shape was selected /// \param theSubShape selected sub-shape (if null, the whole context is /// selected) \param theTemporarily if it is true, it checks also the /// temporary added item \returns true if the pair is found in the attribute - MODEL_EXPORT virtual bool - isInList(const ObjectPtr &theContext, - const std::shared_ptr &theSubShape, - const bool theTemporarily = false); + MODEL_EXPORT bool isInList(const ObjectPtr &theContext, + const std::shared_ptr &theSubShape, + const bool theTemporarily = false) override; /// The type of all elements selection /// \returns the index of the OCCT enumeration of the type of shape - MODEL_EXPORT virtual const std::string selectionType() const; + MODEL_EXPORT const std::string selectionType() const override; /// Sets the type of all elements selection /// \param theType the index of the OCCT enumeration of the type of shape - MODEL_EXPORT virtual void setSelectionType(const std::string &theType); + MODEL_EXPORT void setSelectionType(const std::string &theType) override; /// Returns the attribute selection by the index (zero based) - MODEL_EXPORT virtual std::shared_ptr - value(const int theIndex); + MODEL_EXPORT std::shared_ptr + value(const int theIndex) override; /// Returns all attributes - MODEL_EXPORT virtual void clear(); + MODEL_EXPORT void clear() override; /// Returns true if attribute was initialized by some value - MODEL_EXPORT virtual bool isInitialized(); + MODEL_EXPORT bool isInitialized() override; /// Starts or stops cashing of the values in the attribute (the cash may /// become invalid on modification of the attribute or sub-elements, so the /// cash must be enabled only during non-modification operations with this /// attribute) - MODEL_EXPORT virtual void cashValues(const bool theEnabled); + MODEL_EXPORT void cashValues(const bool theEnabled) override; - MODEL_EXPORT virtual void + MODEL_EXPORT void setGeometricalSelection(const bool theIsGeometricalSelection) override; /// Returns true if is geometrical selection. - MODEL_EXPORT virtual bool isGeometricalSelection() const override; + MODEL_EXPORT bool isGeometricalSelection() const override; /// Returns a selection filters feature if it is defined for this selection /// list - MODEL_EXPORT virtual FiltersFeaturePtr filters() const; + MODEL_EXPORT FiltersFeaturePtr filters() const override; /// Sets a selection filters feature if it is defined for this selection list - MODEL_EXPORT virtual void setFilters(FiltersFeaturePtr theFeature); + MODEL_EXPORT void setFilters(FiltersFeaturePtr theFeature) override; protected: /// Objects are created for features automatically MODEL_EXPORT Model_AttributeSelectionList(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; /// Tries to merge attributes in this list with the same result shape. Returns /// true if theStart matches with some later attribute and theStart is removed diff --git a/src/Model/Model_AttributeStringArray.h b/src/Model/Model_AttributeStringArray.h index 6217f62df..c25e5b557 100644 --- a/src/Model/Model_AttributeStringArray.h +++ b/src/Model/Model_AttributeStringArray.h @@ -33,17 +33,17 @@ class Model_AttributeStringArray : public ModelAPI_AttributeStringArray { public: /// Returns the size of the array (zero means that it is empty) - MODEL_EXPORT virtual int size(); + MODEL_EXPORT int size() override; /// Sets the new size of the array. The previous data is erased. - MODEL_EXPORT virtual void setSize(const int theSize); + MODEL_EXPORT void setSize(const int theSize) override; /// Defines the value of the array by index [0; size-1] - MODEL_EXPORT virtual void setValue(const int theIndex, - const std::string theValue); + MODEL_EXPORT void setValue(const int theIndex, + const std::string theValue) override; /// Returns the value by the index - MODEL_EXPORT virtual std::string value(const int theIndex); + MODEL_EXPORT std::string value(const int theIndex) override; protected: /// Objects are created for features automatically diff --git a/src/Model/Model_AttributeTables.cpp b/src/Model/Model_AttributeTables.cpp index acfea2c5e..d158fb721 100644 --- a/src/Model/Model_AttributeTables.cpp +++ b/src/Model/Model_AttributeTables.cpp @@ -69,8 +69,8 @@ void Model_AttributeTables::setSize(const int theRows, const int theColumns, aNewDouble = (myType == ModelAPI_AttributeTables::DOUBLE) ? new TColStd_HArray1OfReal(0, aNewSize - 1) : Handle(TColStd_HArray1OfReal)(); - bool *anOldBool = - 0; // an not work with internal arrays because of different indexing + bool *anOldBool = nullptr; // an not work with internal arrays because of + // different indexing Handle(TDataStd_BooleanArray) aBoolArray; // an existing array Handle(TColStd_HArray1OfInteger) anOldInt, aNewInt = (myType == ModelAPI_AttributeTables::INTEGER) diff --git a/src/Model/Model_AttributeTables.h b/src/Model/Model_AttributeTables.h index e3816214a..4703e6956 100644 --- a/src/Model/Model_AttributeTables.h +++ b/src/Model/Model_AttributeTables.h @@ -44,42 +44,42 @@ class Model_AttributeTables : public ModelAPI_AttributeTables { public: /// Returns the number of rows in the table - MODEL_EXPORT virtual int rows(); + MODEL_EXPORT int rows() override; /// Returns the number of columns in the table - MODEL_EXPORT virtual int columns(); + MODEL_EXPORT int columns() override; /// Returns the number of tables - MODEL_EXPORT virtual int tables(); + MODEL_EXPORT int tables() override; /// Sets the new size of the tables set. This method tries to keep old values /// if number of rows, columns or tables is increased. - MODEL_EXPORT virtual void setSize(const int theRows, const int theColumns, - const int theTables = 1); + MODEL_EXPORT void setSize(const int theRows, const int theColumns, + const int theTables = 1) override; /// Defines the tyoe of values in the table. If it differs from the current, /// erases the content. - MODEL_EXPORT virtual void setType(ValueType theType); + MODEL_EXPORT void setType(ValueType theType) override; /// Defines the tyoe of values in the table. If it differs from the current, /// erases the content. - MODEL_EXPORT virtual const ValueType &type() const; + MODEL_EXPORT const ValueType &type() const override; /// Defines the value by the index in the tables set (indexes are zero-based). - MODEL_EXPORT virtual void setValue(const Value theValue, const int theRow, - const int theColumn, - const int theTable = 0); + MODEL_EXPORT void setValue(const Value theValue, const int theRow, + const int theColumn, + const int theTable = 0) override; /// Returns the value by the index (indexes are zero-based). - MODEL_EXPORT virtual Value value(const int theRow, const int theColumn, - const int theTable = 0); + MODEL_EXPORT Value value(const int theRow, const int theColumn, + const int theTable = 0) override; /// Returns the value in the format of string (usefull for the python /// connection) - MODEL_EXPORT virtual std::string - valueStr(const int theRow, const int theColumn, const int theTable = 0); + MODEL_EXPORT std::string valueStr(const int theRow, const int theColumn, + const int theTable = 0) override; protected: /// Objects are created for features automatically MODEL_EXPORT Model_AttributeTables(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; private: /// The OCCT array that keeps all values. Indexes are computed as: diff --git a/src/Model/Model_AttributeValidator.cpp b/src/Model/Model_AttributeValidator.cpp index 2b7265655..273199940 100644 --- a/src/Model/Model_AttributeValidator.cpp +++ b/src/Model/Model_AttributeValidator.cpp @@ -99,13 +99,11 @@ bool Model_AttributeValidator::isValid( aFeat->getKind(), theAttribute->id())) { std::list>> allRefs; aFeat->data()->referencesToObjects(allRefs); - std::list>>::iterator anIter = - allRefs.begin(); + auto anIter = allRefs.begin(); for (; anIter != allRefs.end(); anIter++) { if (anIter->first == theAttribute->id()) { const std::list &aReferencedList = anIter->second; - std::list::const_iterator aRefIter = - aReferencedList.cbegin(); + auto aRefIter = aReferencedList.cbegin(); for (; aRefIter != aReferencedList.cend(); aRefIter++) { const ObjectPtr &aReferenced = *aRefIter; if (!aReferenced.get()) @@ -140,7 +138,7 @@ bool Model_AttributeValidator::isValid( aReferencedResults.push_back(aRefBody); } - std::list::iterator aRefRes = aReferencedResults.begin(); + auto aRefRes = aReferencedResults.begin(); bool aCheckFeature = true; // the last iteration to check the feature while (aRefRes != aReferencedResults.end() || aCheckFeature) { @@ -161,7 +159,7 @@ bool Model_AttributeValidator::isValid( continue; const std::set &aRefsToRef = aRefd->data()->refsToMe(); - std::set::const_iterator aRR = aRefsToRef.cbegin(); + auto aRR = aRefsToRef.cbegin(); for (; aRR != aRefsToRef.cend(); aRR++) { FeaturePtr aRefFeat = std::dynamic_pointer_cast( diff --git a/src/Model/Model_AttributeValidator.h b/src/Model/Model_AttributeValidator.h index 533b92e6e..fbd8ff2bd 100644 --- a/src/Model/Model_AttributeValidator.h +++ b/src/Model/Model_AttributeValidator.h @@ -38,9 +38,9 @@ public: /// \param theArguments arguments of the attribute /// \param theError erros message produced by validator to the user if it /// fails \returns true if attribute is valid - MODEL_EXPORT virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + MODEL_EXPORT bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; #endif // Model_AttributeValidator_H diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 801f0f3ba..1595af9b4 100644 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -292,14 +292,14 @@ void Model_BodyBuilder::storeGenerated( const GeomShapePtr &theToShape, const std::shared_ptr theMakeShape) { bool aStored = false; - std::list::const_iterator anOldIter = theFromShapes.cbegin(); + auto anOldIter = theFromShapes.cbegin(); for (; anOldIter != theFromShapes.cend(); anOldIter++) { bool aStore = (*anOldIter)->isCompound() || (*anOldIter)->isShell() || (*anOldIter)->isWire(); if (!aStore) { ListOfShape aNews; // check this old really generates theToShape theMakeShape->generated(*anOldIter, aNews); - ListOfShape::iterator aNewIter = aNews.begin(); + auto aNewIter = aNews.begin(); for (; aNewIter != aNews.end(); aNewIter++) { if (theToShape->isSame(*aNewIter)) break; @@ -325,7 +325,7 @@ static TDF_Label builderLabel(DataPtr theData, const int theTag) { } TNaming_Builder *Model_BodyBuilder::builder(const int theTag) { - std::map::iterator aFind = myBuilders.find(theTag); + auto aFind = myBuilders.find(theTag); if (aFind == myBuilders.end()) { myBuilders[theTag] = new TNaming_Builder(builderLabel(data(), theTag)); aFind = myBuilders.find(theTag); @@ -419,7 +419,7 @@ void Model_BodyBuilder::storeModified( const GeomShapePtr &theNewShape, const std::shared_ptr theMakeShape) { bool aStored = false; - std::list::const_iterator anOldIter = theOldShapes.cbegin(); + auto anOldIter = theOldShapes.cbegin(); for (; anOldIter != theOldShapes.cend(); anOldIter++) { // compounds may cause crash if call "modified" bool aStore = (*anOldIter)->isCompound() || (*anOldIter)->isShell() || @@ -427,7 +427,7 @@ void Model_BodyBuilder::storeModified( if (!aStore) { ListOfShape aNews; // check this old really modifies theNewShape theMakeShape->modified(*anOldIter, aNews); - ListOfShape::iterator aNewIter = aNews.begin(); + auto aNewIter = aNews.begin(); for (; aNewIter != aNews.end(); aNewIter++) { if (theNewShape->isSame(*aNewIter)) break; @@ -471,7 +471,7 @@ void Model_BodyBuilder::clean() { TDF_Label aLab = std::dynamic_pointer_cast(data())->shapeLab(); if (aLab.IsNull()) return; - std::map::iterator aBuilder = myBuilders.begin(); + auto aBuilder = myBuilders.begin(); for (; aBuilder != myBuilders.end(); aBuilder++) { Handle(TNaming_NamedShape) aNS = aBuilder->second->NamedShape(); delete aBuilder->second; @@ -607,7 +607,7 @@ void Model_BodyBuilder::loadDeletedShapes( for (GeomAPI_ShapeExplorer anExp(theOldShape, theShapeTypeToExplore); anExp.more(); anExp.next()) { GeomShapePtr anOldSubShape = anExp.current(); - const TopoDS_Shape &anOldSubShape_ = anOldSubShape->impl(); + const auto &anOldSubShape_ = anOldSubShape->impl(); if (!anAlreadyProcessedShapes.Add(anOldSubShape_) || !theAlgo->isDeleted(anOldSubShape) || aResultShape->isSubShape(anOldSubShape, false) || @@ -634,7 +634,7 @@ static void keepTopLevelShapes(ListOfShape &theShapes, const TopoDS_Shape &theRoot, const GeomShapePtr &theResultShape = GeomShapePtr()) { GeomAPI_Shape::ShapeType aKeepShapeType = GeomAPI_Shape::SHAPE; - ListOfShape::iterator anIt = theShapes.begin(); + auto anIt = theShapes.begin(); while (anIt != theShapes.end()) { TopoDS_Shape aNewShape = (*anIt)->impl(); bool aSkip = @@ -643,7 +643,7 @@ keepTopLevelShapes(ListOfShape &theShapes, const TopoDS_Shape &theRoot, if (aSkip || theRoot.IsSame(aNewShape) || (theResultShape && (!theResultShape->isSubShape(*anIt, false) || theResultShape->isSame(*anIt)))) { - ListOfShape::iterator aRemoveIt = anIt++; + auto aRemoveIt = anIt++; theShapes.erase(aRemoveIt); } else { GeomAPI_Shape::ShapeType aType = (*anIt)->shapeType(); @@ -654,7 +654,7 @@ keepTopLevelShapes(ListOfShape &theShapes, const TopoDS_Shape &theRoot, ++anIt; } else if (aType > aKeepShapeType) { // shapes with greater shape type should be removed from the list - ListOfShape::iterator aRemoveIt = anIt++; + auto aRemoveIt = anIt++; theShapes.erase(aRemoveIt); } else ++anIt; @@ -683,7 +683,7 @@ void Model_BodyBuilder::loadModifiedShapes( theShapeTypeToExplore); anOldShapeExp.more(); anOldShapeExp.next()) { GeomShapePtr anOldSubShape = anOldShapeExp.current(); - const TopoDS_Shape &anOldSubShape_ = anOldSubShape->impl(); + const auto &anOldSubShape_ = anOldSubShape->impl(); // There is no sense to write history if shape already processed // or old shape does not exist in the document. @@ -703,10 +703,8 @@ void Model_BodyBuilder::loadModifiedShapes( ListOfShape aNewShapes; theAlgo->modified(anOldSubShape, aNewShapes); - for (ListOfShape::const_iterator aNewShapesIt = aNewShapes.cbegin(); - aNewShapesIt != aNewShapes.cend(); ++aNewShapesIt) { - GeomShapePtr aNewShape = *aNewShapesIt; - const TopoDS_Shape &aNewShape_ = aNewShape->impl(); + for (auto aNewShape : aNewShapes) { + const auto &aNewShape_ = aNewShape->impl(); bool isGenerated = anOldSubShape_.ShapeType() != aNewShape_.ShapeType(); bool aNewShapeIsSameAsOldShape = anOldSubShape->isSame(aNewShape); @@ -746,7 +744,7 @@ void Model_BodyBuilder::loadGeneratedShapes( for (GeomAPI_ShapeExplorer anOldShapeExp(theOldShape, theShapeTypeToExplore); anOldShapeExp.more(); anOldShapeExp.next()) { GeomShapePtr anOldSubShape = anOldShapeExp.current(); - const TopoDS_Shape &anOldSubShape_ = anOldSubShape->impl(); + const auto &anOldSubShape_ = anOldSubShape->impl(); // There is no sense to write history if shape already processed // or old shape does not exist in the document. @@ -776,10 +774,8 @@ void Model_BodyBuilder::loadGeneratedShapes( keepTopLevelShapes(aNewShapes, anOldSubShape_); - for (ListOfShape::const_iterator aNewShapesIt = aNewShapes.cbegin(); - aNewShapesIt != aNewShapes.cend(); ++aNewShapesIt) { - GeomShapePtr aNewShape = *aNewShapesIt; - const TopoDS_Shape &aNewShape_ = aNewShape->impl(); + for (auto aNewShape : aNewShapes) { + const auto &aNewShape_ = aNewShape->impl(); bool aNewShapeIsSameAsOldShape = anOldSubShape->isSame(aNewShape); bool aNewShapeIsNotInResultShape = diff --git a/src/Model/Model_BodyBuilder.h b/src/Model/Model_BodyBuilder.h index 6a3588cea..12a9f084d 100644 --- a/src/Model/Model_BodyBuilder.h +++ b/src/Model/Model_BodyBuilder.h @@ -41,18 +41,16 @@ class Model_BodyBuilder : public ModelAPI_BodyBuilder { public: /// Stores the shape (called by the execution method). - MODEL_EXPORT virtual void - store(const GeomShapePtr &theShape, - const bool theIsStoreSameShapes = true) override; + MODEL_EXPORT void store(const GeomShapePtr &theShape, + const bool theIsStoreSameShapes = true) override; /// Stores the generated shape (called by the execution method). - MODEL_EXPORT virtual void - storeGenerated(const GeomShapePtr &theFromShape, - const GeomShapePtr &theToShape, - const bool theIsCleanStored = true) override; + MODEL_EXPORT void storeGenerated(const GeomShapePtr &theFromShape, + const GeomShapePtr &theToShape, + const bool theIsCleanStored = true) override; /// Stores the root generated shapes (called by the execution method). - MODEL_EXPORT virtual void storeGenerated( + MODEL_EXPORT void storeGenerated( const std::list &theFromShapes, const GeomShapePtr &theToShape, const std::shared_ptr theMakeShape) override; @@ -62,79 +60,76 @@ public: /// \param theNewShape resulting shape /// \param theIsCleanStored erases all previous data structure of this body if /// true - MODEL_EXPORT virtual void - storeModified(const GeomShapePtr &theOldShape, - const GeomShapePtr &theNewShape, - const bool theIsCleanStored = true) override; + MODEL_EXPORT void storeModified(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const bool theIsCleanStored = true) override; /// Stores the root modified shape (called by the execution method). /// \param theOldShapes all shapes that produce result /// \param theNewShape resulting shape /// \param theIsCleanStored erases all previous data structure of this body if /// true - MODEL_EXPORT virtual void storeModified( + MODEL_EXPORT void storeModified( const std::list &theOldShapes, const GeomShapePtr &theNewShape, const std::shared_ptr theMakeShape) override; /// Returns the shape-result produced by this feature - MODEL_EXPORT virtual GeomShapePtr shape(); + MODEL_EXPORT GeomShapePtr shape() override; /// Records the subshape newShape which was generated during a topological /// construction. As an example, consider the case of a face generated in /// construction of a box. Returns true if it is stored correctly (the final /// shape contains this new sub-shape) - MODEL_EXPORT virtual bool - generated(const GeomShapePtr &theNewShape, const std::string &theName, - const bool theCheckIsInResult = true) override; + MODEL_EXPORT bool generated(const GeomShapePtr &theNewShape, + const std::string &theName, + const bool theCheckIsInResult = true) override; /// Records the shape newShape which was generated from the shape oldShape /// during a topological construction. As an example, consider the case of a /// face generated from an edge in construction of a prism. - MODEL_EXPORT virtual void generated(const GeomShapePtr &theOldShape, - const GeomShapePtr &theNewShape, - const std::string &theName = "") override; + MODEL_EXPORT void generated(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const std::string &theName = "") override; /// Records the shape newShape which is a modification of the shape oldShape. /// As an example, consider the case of a face split or merged in a Boolean /// operation. - MODEL_EXPORT virtual void modified(const GeomShapePtr &theOldShape, - const GeomShapePtr &theNewShape, - const std::string &theName = "") override; + MODEL_EXPORT void modified(const GeomShapePtr &theOldShape, + const GeomShapePtr &theNewShape, + const std::string &theName = "") override; /// load deleted shapes MODEL_EXPORT - virtual void loadDeletedShapes( + void loadDeletedShapes( const GeomMakeShapePtr &theAlgo, const GeomShapePtr &theOldShape, const GeomAPI_Shape::ShapeType theShapeTypeToExplore, const GeomShapePtr &theShapesToExclude = GeomShapePtr()) override; /// load and orient modified shapes MODEL_EXPORT - virtual void - loadModifiedShapes(const GeomMakeShapePtr &theAlgo, - const GeomShapePtr &theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string &theName = "") override; + void loadModifiedShapes(const GeomMakeShapePtr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName = "") override; /// load and orient generated shapes MODEL_EXPORT - virtual void - loadGeneratedShapes(const GeomMakeShapePtr &theAlgo, - const GeomShapePtr &theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string &theName = "", - const bool theSaveOldIfNotInTree = false) override; + void loadGeneratedShapes(const GeomMakeShapePtr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName = "", + const bool theSaveOldIfNotInTree = false) override; /// Loads shapes of the first level (to be used during shape import) - MODEL_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape, - const std::string &theName) override; + MODEL_EXPORT void loadFirstLevel(GeomShapePtr theShape, + const std::string &theName) override; /// Removes the stored builders - MODEL_EXPORT virtual ~Model_BodyBuilder(); + MODEL_EXPORT ~Model_BodyBuilder() override; /// Cleans cash related to the already stored elements - MODEL_EXPORT virtual void cleanCash() override; + MODEL_EXPORT void cleanCash() override; protected: /// Default constructor accessible only by Model_Objects diff --git a/src/Model/Model_Data.cpp b/src/Model/Model_Data.cpp index 8d5234d46..c0dfd319c 100644 --- a/src/Model/Model_Data.cpp +++ b/src/Model/Model_Data.cpp @@ -95,8 +95,7 @@ static const Standard_GUID // id of attribute to store the version of the feature static const Standard_GUID kVERSION_ID("61cdb78a-1ba7-4942-976f-63bea7f4a2b1"); -Model_Data::Model_Data() - : mySendAttributeUpdated(true), myWasChangedButBlocked(false) {} +Model_Data::Model_Data() : myWasChangedButBlocked(false) {} void Model_Data::setLabel(TDF_Label theLab) { myLab = theLab; @@ -190,7 +189,7 @@ AttributePtr Model_Data::addAttribute(const std::string &theID, AttributePtr aResult; int anAttrIndex = theIndex == -1 ? int(myAttrs.size()) + 1 : theIndex; TDF_Label anAttrLab = myLab.FindChild(anAttrIndex); - ModelAPI_Attribute *anAttr = 0; + ModelAPI_Attribute *anAttr = nullptr; if (theAttrType == ModelAPI_AttributeDocRef::typeId()) { anAttr = new Model_AttributeDocRef(anAttrLab); } else if (theAttrType == Model_AttributeInteger::typeId()) { @@ -227,7 +226,7 @@ AttributePtr Model_Data::addAttribute(const std::string &theID, // create also GeomData attributes here because only here the OCAF structure // is known else if (theAttrType == GeomData_Point::typeId()) { - GeomData_Point *anAttribute = new GeomData_Point(); + auto *anAttribute = new GeomData_Point(); bool anAllInitialized = true; for (int aComponent = 0; aComponent < GeomData_Point::NUM_COMPONENTS; ++aComponent) { @@ -242,7 +241,7 @@ AttributePtr Model_Data::addAttribute(const std::string &theID, } else if (theAttrType == GeomData_Dir::typeId()) { anAttr = new GeomData_Dir(anAttrLab); } else if (theAttrType == GeomData_Point2D::typeId()) { - GeomData_Point2D *anAttribute = new GeomData_Point2D(); + auto *anAttribute = new GeomData_Point2D(); bool anAllInitialized = true; for (int aComponent = 0; aComponent < GeomData_Point2D::NUM_COMPONENTS; ++aComponent) { @@ -409,7 +408,7 @@ Model_Data::attribute(const std::string &theID) { const std::string & Model_Data::id(const std::shared_ptr &theAttr) { - AttributeMap::iterator anAttr = myAttrs.begin(); + auto anAttr = myAttrs.begin(); for (; anAttr != myAttrs.end(); anAttr++) { if (anAttr->second.first == theAttr) return anAttr->first; @@ -432,7 +431,7 @@ bool Model_Data::isValid() { return !myLab.IsNull() && myLab.HasAttribute(); } std::list> Model_Data::attributes(const std::string &theType) { std::list> aResult; - AttributeMap::iterator anAttrsIter = myAttrs.begin(); + auto anAttrsIter = myAttrs.begin(); for (; anAttrsIter != myAttrs.end(); anAttrsIter++) { AttributePtr anAttr = anAttrsIter->second.first; if (theType.empty() || anAttr->attributeType() == theType) { @@ -444,7 +443,7 @@ Model_Data::attributes(const std::string &theType) { std::list Model_Data::attributesIDs(const std::string &theType) { std::list aResult; - AttributeMap::iterator anAttrsIter = myAttrs.begin(); + auto anAttrsIter = myAttrs.begin(); for (; anAttrsIter != myAttrs.end(); anAttrsIter++) { AttributePtr anAttr = anAttrsIter->second.first; if (theType.empty() || anAttr->attributeType() == theType) { @@ -507,8 +506,7 @@ bool Model_Data::blockSendAttributeUpdated(const bool theBlock, std::list aWasChangedButBlocked = myWasChangedButBlocked; myWasChangedButBlocked.clear(); - std::list::iterator aChangedIter = - aWasChangedButBlocked.begin(); + auto aChangedIter = aWasChangedButBlocked.begin(); for (; aChangedIter != aWasChangedButBlocked.end(); aChangedIter++) { try { myObject->attributeChanged((*aChangedIter)->id()); @@ -539,10 +537,9 @@ void Model_Data::erase() { // remove in order to clear back references in other objects std::list>> aRefs; referencesToObjects(aRefs); - std::list>>::iterator - anAttrIter = aRefs.begin(); + auto anAttrIter = aRefs.begin(); for (; anAttrIter != aRefs.end(); anAttrIter++) { - std::list::iterator aReferenced = anAttrIter->second.begin(); + auto aReferenced = anAttrIter->second.begin(); for (; aReferenced != anAttrIter->second.end(); aReferenced++) { if (aReferenced->get() && (*aReferenced)->data()->isValid()) { std::shared_ptr aData = @@ -669,7 +666,7 @@ void Model_Data::addBackReference(ObjectPtr theObject, std::string theAttrID) { } void Model_Data::updateConcealmentFlag() { - std::set::iterator aRefsIter = myRefsToMe.begin(); + auto aRefsIter = myRefsToMe.begin(); for (; aRefsIter != myRefsToMe.end(); aRefsIter++) { if (aRefsIter->get()) { FeaturePtr aFeature = @@ -731,7 +728,7 @@ std::list findVariables(const std::set &theParameters, const DocumentPtr &theDocument) { std::list aResult; - std::set::const_iterator aParamIt = theParameters.cbegin(); + auto aParamIt = theParameters.cbegin(); for (; aParamIt != theParameters.cend(); ++aParamIt) { const std::wstring &aName = *aParamIt; double aValue; @@ -752,7 +749,7 @@ void Model_Data::referencesToObjects( ModelAPI_Session::get()->validators()); FeaturePtr aMyFeature = std::dynamic_pointer_cast(myObject); - AttributeMap::iterator anAttrIt = myAttrs.begin(); + auto anAttrIt = myAttrs.begin(); std::list aReferenced; // not inside of cycle to avoid excess memory management for (; anAttrIt != myAttrs.end(); anAttrIt++) { @@ -791,7 +788,7 @@ void Model_Data::referencesToObjects( if (aRefFeat .get()) { // reference to all results of the referenced feature const std::list &allRes = aRefFeat->results(); - std::list::const_iterator aRefRes = allRes.cbegin(); + auto aRefRes = allRes.cbegin(); for (; aRefRes != allRes.cend(); aRefRes++) { aReferenced.push_back(*aRefRes); } @@ -808,7 +805,7 @@ void Model_Data::referencesToObjects( if (aRefFeat .get()) { // reference to all results of the referenced feature const std::list &allRes = aRefFeat->results(); - std::list::const_iterator aRefRes = allRes.cbegin(); + auto aRefRes = allRes.cbegin(); for (; aRefRes != allRes.cend(); aRefRes++) { aReferenced.push_back(*aRefRes); } @@ -932,8 +929,8 @@ std::shared_ptr Model_Data::owner() { return myObject; } bool Model_Data::isPrecedingAttribute(const std::string &theAttribute1, const std::string &theAttribute2) const { - AttributeMap::const_iterator aFound1 = myAttrs.find(theAttribute1); - AttributeMap::const_iterator aFound2 = myAttrs.find(theAttribute2); + auto aFound1 = myAttrs.find(theAttribute1); + auto aFound2 = myAttrs.find(theAttribute2); if (aFound2 == myAttrs.end()) return true; else if (aFound1 == myAttrs.end()) diff --git a/src/Model/Model_Data.h b/src/Model/Model_Data.h index 76973358f..0f3d79601 100644 --- a/src/Model/Model_Data.h +++ b/src/Model/Model_Data.h @@ -77,7 +77,7 @@ class Model_Data : public ModelAPI_Data { /// transaction change) std::set myRefsToMe; /// flag that may block the "attribute updated" sending - bool mySendAttributeUpdated; + bool mySendAttributeUpdated{true}; /// if some attribute was changed, but mySendAttributeUpdated was false, this /// stores this std::list myWasChangedButBlocked; @@ -105,87 +105,87 @@ public: /// initialize correctly. Model_Data(); /// Returns the name of the feature visible by the user in the object browser - MODEL_EXPORT virtual std::wstring name(); + MODEL_EXPORT std::wstring name() override; /// Defines the name of the feature visible by the user in the object browser - MODEL_EXPORT virtual void setName(const std::wstring &theName); + MODEL_EXPORT void setName(const std::wstring &theName) override; /// Return \c true if the object has been renamed by the user - MODEL_EXPORT virtual bool hasUserDefinedName() const; + MODEL_EXPORT bool hasUserDefinedName() const override; /// Returns version of the feature (empty string if not applicable) - MODEL_EXPORT virtual std::string version(); + MODEL_EXPORT std::string version() override; /// Initialize the version of the feature - MODEL_EXPORT virtual void setVersion(const std::string &theVersion); + MODEL_EXPORT void setVersion(const std::string &theVersion) override; /// Returns the attribute that references to another document - MODEL_EXPORT virtual std::shared_ptr - document(const std::string &theID); + MODEL_EXPORT std::shared_ptr + document(const std::string &theID) override; /// Returns the attribute that contains real value with double precision - MODEL_EXPORT virtual std::shared_ptr - real(const std::string &theID); + MODEL_EXPORT std::shared_ptr + real(const std::string &theID) override; /// Returns the attribute that contains double values array - MODEL_EXPORT virtual std::shared_ptr - realArray(const std::string &theID); + MODEL_EXPORT std::shared_ptr + realArray(const std::string &theID) override; /// Returns the attribute that contains integer value - MODEL_EXPORT virtual std::shared_ptr - integer(const std::string &theID); + MODEL_EXPORT std::shared_ptr + integer(const std::string &theID) override; /// Returns the attribute that contains reference to a feature - MODEL_EXPORT virtual std::shared_ptr - reference(const std::string &theID); + MODEL_EXPORT std::shared_ptr + reference(const std::string &theID) override; /// Returns the attribute that contains selection to a shape - MODEL_EXPORT virtual std::shared_ptr - selection(const std::string &theID); + MODEL_EXPORT std::shared_ptr + selection(const std::string &theID) override; /// Returns the attribute that contains selection to a shape - MODEL_EXPORT virtual std::shared_ptr - selectionList(const std::string &theID); + MODEL_EXPORT std::shared_ptr + selectionList(const std::string &theID) override; /// Returns the attribute that contains reference to an attribute of a feature - MODEL_EXPORT virtual std::shared_ptr - refattr(const std::string &theID); + MODEL_EXPORT std::shared_ptr + refattr(const std::string &theID) override; /// Returns the attribute that contains list of references to features - MODEL_EXPORT virtual std::shared_ptr - reflist(const std::string &theID); + MODEL_EXPORT std::shared_ptr + reflist(const std::string &theID) override; /// Returns the attribute that contains list of references to features /// or reference to an attribute of a feature - MODEL_EXPORT virtual std::shared_ptr - refattrlist(const std::string &theID); + MODEL_EXPORT std::shared_ptr + refattrlist(const std::string &theID) override; /// Returns the attribute that contains boolean value - MODEL_EXPORT virtual std::shared_ptr - boolean(const std::string &theID); + MODEL_EXPORT std::shared_ptr + boolean(const std::string &theID) override; /// Returns the attribute that contains real value with double precision - MODEL_EXPORT virtual std::shared_ptr - string(const std::string &theID); + MODEL_EXPORT std::shared_ptr + string(const std::string &theID) override; /// Returns the attribute that contains integer values array - MODEL_EXPORT virtual std::shared_ptr - intArray(const std::string &theID); + MODEL_EXPORT std::shared_ptr + intArray(const std::string &theID) override; /// Returns the attribute that contains string values array - MODEL_EXPORT virtual std::shared_ptr - stringArray(const std::string &theID); + MODEL_EXPORT std::shared_ptr + stringArray(const std::string &theID) override; /// Returns the attribute that contains string values array - MODEL_EXPORT virtual std::shared_ptr - tables(const std::string &theID); + MODEL_EXPORT std::shared_ptr + tables(const std::string &theID) override; /// Returns the attribute that contains image - MODEL_EXPORT virtual std::shared_ptr - image(const std::string &theID); + MODEL_EXPORT std::shared_ptr + image(const std::string &theID) override; /// Returns the generic attribute by identifier /// \param theID identifier of the attribute - MODEL_EXPORT virtual std::shared_ptr - attribute(const std::string &theID); + MODEL_EXPORT std::shared_ptr + attribute(const std::string &theID) override; /// Returns all attributes of the feature of the given type /// or all attributes if "theType" is empty - MODEL_EXPORT virtual std::list> - attributes(const std::string &theType); + MODEL_EXPORT std::list> + attributes(const std::string &theType) override; /// Returns all attributes ids of the feature of the given type /// or all attributes if "theType" is empty - MODEL_EXPORT virtual std::list - attributesIDs(const std::string &theType); + MODEL_EXPORT std::list + attributesIDs(const std::string &theType) override; /// Identifier by the id (not fast, iteration by map) /// \param theAttr attribute already created in this data - MODEL_EXPORT virtual const std::string & - id(const std::shared_ptr &theAttr); + MODEL_EXPORT const std::string & + id(const std::shared_ptr &theAttr) override; /// Returns true if data belongs to same features - MODEL_EXPORT virtual bool - isEqual(const std::shared_ptr &theData); + MODEL_EXPORT bool + isEqual(const std::shared_ptr &theData) override; /// Returns true if it is correctly connected to the data model - MODEL_EXPORT virtual bool isValid(); + MODEL_EXPORT bool isValid() override; /// Returns the label where the shape must be stored (used in ResultBody) TDF_Label shapeLab() const { @@ -199,33 +199,33 @@ public: /// index of the attribute in the internal data structure, for not-floating /// attributes it is -1 to let it automatically be added /// \returns the just created attribute - MODEL_EXPORT virtual AttributePtr addAttribute(const std::string &theID, - const std::string theAttrType, - const int theIndex = -1); + MODEL_EXPORT AttributePtr addAttribute(const std::string &theID, + const std::string theAttrType, + const int theIndex = -1) override; /// Adds a floating attribute (that may be added/removed during the data life) /// \param theID identifier of the attribute that can be referenced by this ID /// later \param theAttrType type of the created attribute (received from the /// type method) \param theGroup identifier of the group this attribute /// belongs to, may be an empty string - MODEL_EXPORT virtual AttributePtr + MODEL_EXPORT AttributePtr addFloatingAttribute(const std::string &theID, const std::string theAttrType, - const std::string &theGroup); + const std::string &theGroup) override; /// Returns all groups of this data (ordered). - MODEL_EXPORT virtual void allGroups(std::list &theGroups); + MODEL_EXPORT void allGroups(std::list &theGroups) override; /// Returns an ordered list of attributes that belong to the given group - MODEL_EXPORT virtual void - attributesOfGroup(const std::string &theGroup, - std::list> &theAttrs); + MODEL_EXPORT void attributesOfGroup( + const std::string &theGroup, + std::list> &theAttrs) override; /// Remove all attributes of the given group - MODEL_EXPORT virtual void removeAttributes(const std::string &theGroup); + MODEL_EXPORT void removeAttributes(const std::string &theGroup) override; /// Useful method for "set" methods of the attributes: sends an UPDATE event /// and makes attribute initialized - MODEL_EXPORT virtual void sendAttributeUpdated(ModelAPI_Attribute *theAttr); + MODEL_EXPORT void sendAttributeUpdated(ModelAPI_Attribute *theAttr) override; /// Blocks sending "attribute updated" if theBlock is true /// \param theBlock allows switching on/off the blocking state /// \param theSendMessage if false, it does not send the update message @@ -233,9 +233,9 @@ public: /// (normally is it used in attributeChanged because this message /// will be sent anyway) /// \returns the previous state of block - MODEL_EXPORT virtual bool + MODEL_EXPORT bool blockSendAttributeUpdated(const bool theBlock, - const bool theSendMessage = true); + const bool theSendMessage = true) override; /// Puts feature to the document data sub-structure MODEL_EXPORT void setLabel(TDF_Label theLab); @@ -246,74 +246,75 @@ public: } /// Erases all the data from the data model - MODEL_EXPORT virtual void erase(); + MODEL_EXPORT void erase() override; /// Stores the state of the object to execute it later accordingly - MODEL_EXPORT virtual void execState(const ModelAPI_ExecState theState); + MODEL_EXPORT void execState(const ModelAPI_ExecState theState) override; /// Returns the state of the latest execution of the feature - MODEL_EXPORT virtual ModelAPI_ExecState execState(); + MODEL_EXPORT ModelAPI_ExecState execState() override; /// Registers error during the execution, causes the ExecutionFailed state - MODEL_EXPORT virtual void setError(const std::string &theError, - bool theSend = true); + MODEL_EXPORT void setError(const std::string &theError, + bool theSend = true) override; /// Erases the error string if it is not empty void eraseErrorString(); /// Registers error during the execution, causes the ExecutionFailed state - MODEL_EXPORT virtual std::string error() const; + MODEL_EXPORT std::string error() const override; /// Returns the identifier of feature-owner, unique in this document - MODEL_EXPORT virtual int featureId() const; + MODEL_EXPORT int featureId() const override; /// returns all objects referenced to this - MODEL_EXPORT virtual const std::set &refsToMe() { + MODEL_EXPORT const std::set &refsToMe() override { return myRefsToMe; } /// returns all references by attributes of this data /// \param theRefs returned list of pairs: /// id of referenced attribute and list of referenced objects - MODEL_EXPORT virtual void referencesToObjects( - std::list>> &theRefs); + MODEL_EXPORT void referencesToObjects( + std::list>> &theRefs) + override; /// Copies all attributes content into theTarget data - MODEL_EXPORT virtual void copyTo(std::shared_ptr theTarget); + MODEL_EXPORT void copyTo(std::shared_ptr theTarget) override; /// Returns the invalid data pointer (to avoid working with NULL shared /// pointers in swig) - MODEL_EXPORT virtual std::shared_ptr invalidPtr(); + MODEL_EXPORT std::shared_ptr invalidPtr() override; /// Returns the invalid data pointer: static method static std::shared_ptr invalidData(); /// Identifier of the transaction when object (feature or result) was updated /// last time. - MODEL_EXPORT virtual int updateID(); + MODEL_EXPORT int updateID() override; /// Identifier of the transaction when object (feature or result) was updated /// last time. This method is called by the updater. - MODEL_EXPORT virtual void setUpdateID(const int theID); + MODEL_EXPORT void setUpdateID(const int theID) override; /// Returns true if the given object is owner of this data (needed for correct /// erase of object with duplicated data) - MODEL_EXPORT virtual std::shared_ptr owner(); + MODEL_EXPORT std::shared_ptr owner() override; protected: /// Returns true if "is in history" custom behaviors is defined for the /// feature - MODEL_EXPORT virtual bool isInHistory(); + MODEL_EXPORT bool isInHistory() override; /// Defines the custom "is in history" behavior - MODEL_EXPORT virtual void setIsInHistory(const bool theFlag); + MODEL_EXPORT void setIsInHistory(const bool theFlag) override; /// Returns true if the object is deleted, but some data is still kept in /// memory - MODEL_EXPORT virtual bool isDeleted(); + MODEL_EXPORT bool isDeleted() override; /// Sets true if the object is deleted, but some data is still kept in memory - MODEL_EXPORT virtual void setIsDeleted(const bool theFlag); + MODEL_EXPORT void setIsDeleted(const bool theFlag) override; /// Erases all attributes from myAttrs, but keeping them in the data structure void clearAttributes(); @@ -344,17 +345,17 @@ private: /// Returns true if object must be displayed in the viewer: flag is stored in /// the data model, so on undo/redo, open/save or recreation of object by /// history-playing it keeps the original state in the current transaction. - MODEL_EXPORT virtual bool isDisplayed(); + MODEL_EXPORT bool isDisplayed() override; /// Sets the displayed/hidden state of the object. If it is changed, sends the /// "redisplay" signal. - MODEL_EXPORT virtual void setDisplayed(const bool theDisplay); + MODEL_EXPORT void setDisplayed(const bool theDisplay) override; /// Returns \c true if theAttribute1 is going earlier than theAttribute2 in /// the data - MODEL_EXPORT virtual bool + MODEL_EXPORT bool isPrecedingAttribute(const std::string &theAttribute1, - const std::string &theAttribute2) const; + const std::string &theAttribute2) const override; }; /// Generic method to register back reference, used in referencing attributes. diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index b1aa727a5..6762d31e1 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -241,7 +241,7 @@ static void updateShapesFromRoot(const TDF_Label theThisAccess, static bool loadDocument(Handle(Model_Application) theApp, Handle(TDocStd_Document) & theDoc, const TCollection_ExtendedString &theFilename) { - PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus)-1; + auto aStatus = (PCDM_ReaderStatus)-1; try { aStatus = theApp->Open(theFilename, theDoc); } catch (Standard_Failure const &anException) { @@ -378,7 +378,7 @@ bool Model_Document::load(const char *theDirName, const char *theFileName, // make sub-parts as loaded by demand std::list aPartResults; myObjs->allResults(ModelAPI_ResultPart::group(), aPartResults); - std::list::iterator aPartRes = aPartResults.begin(); + auto aPartRes = aPartResults.begin(); for (; aPartRes != aPartResults.end(); aPartRes++) { ResultPartPtr aPart = std::dynamic_pointer_cast(*aPartRes); @@ -577,7 +577,7 @@ bool Model_Document::save(const char *theDirName, const char *theFileName, // iterate all result parts to find all loaded or not yet loaded documents std::list aPartResults; myObjs->allResults(ModelAPI_ResultPart::group(), aPartResults); - std::list::iterator aPartRes = aPartResults.begin(); + auto aPartRes = aPartResults.begin(); for (; aPartRes != aPartResults.end(); aPartRes++) { ResultPartPtr aPart = std::dynamic_pointer_cast(*aPartRes); @@ -625,7 +625,7 @@ bool Model_Document::save( TDF_Label aMain = aTempDoc->Main(); Handle(TDF_RelocationTable) aRelocTable = new TDF_RelocationTable(); - std::list::const_iterator anIt = theExportFeatures.begin(); + auto anIt = theExportFeatures.begin(); // Perform the copying twice for correct references: // 1. copy labels hierarchy and fill the relocation table for (; anIt != theExportFeatures.end(); ++anIt) { @@ -664,7 +664,7 @@ void Model_Document::close(const bool theForever) { } // close all subs const std::set aSubs = subDocuments(); - std::set::iterator aSubIter = aSubs.begin(); + auto aSubIter = aSubs.begin(); for (; aSubIter != aSubs.end(); aSubIter++) { std::shared_ptr aSub = subDoc(*aSubIter); if (aSub->myObjs) // if it was not closed before @@ -679,7 +679,7 @@ void Model_Document::close(const bool theForever) { if (theForever) { // flush everything to avoid messages with bad objects delete myObjs; - myObjs = 0; + myObjs = nullptr; if (myDoc->CanClose() == CDM_CCS_OK) myDoc->Close(); mySelectionFeature.reset(); @@ -718,7 +718,7 @@ void Model_Document::startOperation() { myRedos.clear(); // new command for all subs const std::set aSubs = subDocuments(); - std::set::iterator aSubIter = aSubs.begin(); + auto aSubIter = aSubs.begin(); for (; aSubIter != aSubs.end(); aSubIter++) subDoc(*aSubIter)->startOperation(); } @@ -958,7 +958,7 @@ bool Model_Document::finishOperation() { // calls problems inside bool aResult = false; const std::set aSubs = subDocuments(); - std::set::iterator aSubIter = aSubs.begin(); + auto aSubIter = aSubs.begin(); for (; aSubIter != aSubs.end(); aSubIter++) if (subDoc(*aSubIter)->finishOperation()) aResult = true; @@ -1086,7 +1086,7 @@ void Model_Document::abortOperation() { } // abort for all subs, flushes will be later, in the end of root abort const std::set aSubs = subDocuments(); - std::set::iterator aSubIter = aSubs.begin(); + auto aSubIter = aSubs.begin(); for (; aSubIter != aSubs.end(); aSubIter++) subDoc(*aSubIter)->abortOperation(); // references may be changed because they are set in attributes on the fly @@ -1115,7 +1115,7 @@ bool Model_Document::canUndo() { return true; // check other subs contains operation that can be undone const std::set aSubs = subDocuments(); - std::set::iterator aSubIter = aSubs.begin(); + auto aSubIter = aSubs.begin(); for (; aSubIter != aSubs.end(); aSubIter++) { std::shared_ptr aSub = subDoc(*aSubIter); if (aSub->myObjs) { // if it was not closed before @@ -1148,7 +1148,7 @@ void Model_Document::undoInternal(const bool theWithSubs, if (theWithSubs) { // undo for all subs aSubs = subDocuments(); - std::set::iterator aSubIter = aSubs.begin(); + auto aSubIter = aSubs.begin(); for (; aSubIter != aSubs.end(); aSubIter++) { if (!subDoc(*aSubIter)->myObjs) continue; @@ -1165,7 +1165,7 @@ void Model_Document::undoInternal(const bool theWithSubs, if (theWithSubs) { // undo for all subs const std::set aNewSubs = subDocuments(); - std::set::iterator aNewSubIter = aNewSubs.begin(); + auto aNewSubIter = aNewSubs.begin(); for (; aNewSubIter != aNewSubs.end(); aNewSubIter++) { // synchronize only newly appeared documents if (!subDoc(*aNewSubIter)->myObjs || @@ -1187,7 +1187,7 @@ bool Model_Document::canRedo() { return true; // check other subs contains operation that can be redone const std::set aSubs = subDocuments(); - std::set::iterator aSubIter = aSubs.begin(); + auto aSubIter = aSubs.begin(); for (; aSubIter != aSubs.end(); aSubIter++) { if (!subDoc(*aSubIter)->myObjs) continue; @@ -1211,7 +1211,7 @@ void Model_Document::redo() { // redo for all subs const std::set aSubs = subDocuments(); - std::set::iterator aSubIter = aSubs.begin(); + auto aSubIter = aSubs.begin(); for (; aSubIter != aSubs.end(); aSubIter++) subDoc(*aSubIter)->redo(); @@ -1231,9 +1231,8 @@ void Model_Document::clearUndoRedo() { myDoc->ClearRedos(); // clear for all subs const std::set aSubs = subDocuments(); - for (std::set::iterator aSubIter = aSubs.begin(); - aSubIter != aSubs.end(); aSubIter++) - subDoc(*aSubIter)->clearUndoRedo(); + for (int aSub : aSubs) + subDoc(aSub)->clearUndoRedo(); } // this is used for creation of undo/redo1-list by GUI @@ -1242,8 +1241,7 @@ std::list Model_Document::undoList() const { std::list aResult; // the number of skipped current operations (on undo they will be aborted) int aSkipCurrent = isOperation() ? 1 : 0; - std::list::const_reverse_iterator aTrIter = - myTransactions.crbegin(); + auto aTrIter = myTransactions.crbegin(); int aNumUndo = int(myTransactions.size()); if (!myNestedNum.empty()) aNumUndo = *myNestedNum.rbegin(); @@ -1258,7 +1256,7 @@ std::list Model_Document::undoList() const { std::list Model_Document::redoList() const { std::list aResult; - std::list::const_reverse_iterator aTrIter = myRedos.crbegin(); + auto aTrIter = myRedos.crbegin(); for (; aTrIter != myRedos.crend(); aTrIter++) { aResult.push_back(aTrIter->myId); } @@ -1351,7 +1349,7 @@ void Model_Document::removeFeature(FeaturePtr theFeature) { ModelAPI_Session::get()->moduleDocument()); std::list allParts; aRoot->objects()->allResults(ModelAPI_ResultPart::group(), allParts); - std::list::iterator aParts = allParts.begin(); + auto aParts = allParts.begin(); for (; aParts != allParts.end(); aParts++) { ResultPartPtr aPart = std::dynamic_pointer_cast(*aParts); @@ -1440,7 +1438,7 @@ const std::set Model_Document::subDocuments() const { std::set aResult; std::list aPartResults; myObjs->allResults(ModelAPI_ResultPart::group(), aPartResults); - std::list::iterator aPartRes = aPartResults.begin(); + auto aPartRes = aPartResults.begin(); for (; aPartRes != aPartResults.end(); aPartRes++) { ResultPartPtr aPart = std::dynamic_pointer_cast(*aPartRes); @@ -1476,14 +1474,14 @@ int Model_Document::index(std::shared_ptr theObject, int Model_Document::size(const std::string &theGroupID, const bool theAllowFolder) { - if (myObjs == 0) // may be on close + if (myObjs == nullptr) // may be on close return 0; return myObjs->size(theGroupID, theAllowFolder); } std::shared_ptr Model_Document::parent(const std::shared_ptr theChild) { - if (myObjs == 0) // may be on close + if (myObjs == nullptr) // may be on close return ObjectPtr(); return myObjs->parent(theChild); } @@ -1770,7 +1768,7 @@ bool Model_Document::removeFromFolder( std::shared_ptr Model_Document::feature(const std::shared_ptr &theResult) { - if (myObjs == 0) // may be on close + if (myObjs == nullptr) // may be on close return std::shared_ptr(); return myObjs->feature(theResult); } @@ -1797,17 +1795,16 @@ ResultPtr Model_Document::resultByLab(const TDF_Label &theLab) { void Model_Document::addNamingName(const TDF_Label theLabel, std::wstring theName) { - std::map>::iterator aFind = - myNamingNames.find(theName); + auto aFind = myNamingNames.find(theName); if (aFind != myNamingNames.end()) { // to avoid duplicate-labels // to keep correct order in spite of history line management - std::list::iterator anAddAfterThis = aFind->second.end(); + auto anAddAfterThis = aFind->second.end(); FeaturePtr anAddedFeature = featureByLab(theLabel); - std::list::iterator aLabIter = aFind->second.begin(); + auto aLabIter = aFind->second.begin(); while (aLabIter != aFind->second.end()) { if (theLabel.IsEqual(*aLabIter)) { - std::list::iterator aTmpIter = aLabIter; + auto aTmpIter = aLabIter; aLabIter++; aFind->second.erase(aTmpIter); } else { @@ -1834,10 +1831,9 @@ void Model_Document::addNamingName(const TDF_Label theLabel, void Model_Document::changeNamingName(const std::wstring theOldName, const std::wstring theNewName, const TDF_Label &theLabel) { - std::map>::iterator aFind = - myNamingNames.find(theOldName); + auto aFind = myNamingNames.find(theOldName); if (aFind != myNamingNames.end()) { - std::list::iterator aLabIter = aFind->second.begin(); + auto aLabIter = aFind->second.begin(); for (; aLabIter != aFind->second.end(); aLabIter++) { if (theLabel.IsEqual(*aLabIter)) { // found the label myNamingNames[theNewName].push_back(theLabel); @@ -1915,10 +1911,9 @@ static bool IsExchangedName(const TCollection_ExtendedString &theName1, TDF_Label Model_Document::findNamingName(std::wstring theName, ResultPtr theContext) { - std::map>::iterator aFind = - myNamingNames.find(theName); + auto aFind = myNamingNames.find(theName); if (aFind != myNamingNames.end()) { - std::list::reverse_iterator aLabIter = aFind->second.rbegin(); + auto aLabIter = aFind->second.rbegin(); for (; aLabIter != aFind->second.rend(); aLabIter++) { if (theContext.get()) { // context is defined and not like this, so, skip @@ -1937,7 +1932,7 @@ TDF_Label Model_Document::findNamingName(std::wstring theName, TCollection_ExtendedString aSubName(theName.substr(aSlash + 1).c_str()); // iterate all possible same-named labels starting from the last one (the // recent) - std::list::reverse_iterator aLabIter = aFind->second.rbegin(); + auto aLabIter = aFind->second.rbegin(); for (; aLabIter != aFind->second.rend(); aLabIter++) { if (theContext.get()) { // context is defined and not like this, so, skip @@ -2003,11 +1998,9 @@ bool Model_Document::isLaterByDep(FeaturePtr theThis, FeaturePtr theOther) { std::list>>> aRefs; theOther->data()->referencesToObjects(aRefs); - std::list>>>::iterator - aRefIt = aRefs.begin(); + auto aRefIt = aRefs.begin(); for (; aRefIt != aRefs.end(); aRefIt++) { - std::list::iterator aRefObjIt = aRefIt->second.begin(); + auto aRefObjIt = aRefIt->second.begin(); for (; aRefObjIt != aRefIt->second.end(); aRefObjIt++) { ObjectPtr aRefObj = *aRefObjIt; if (aRefObj.get()) { @@ -2042,8 +2035,7 @@ bool Model_Document::isLaterByDep(FeaturePtr theThis, FeaturePtr theOther) { int Model_Document::numberOfNameInHistory(const ObjectPtr &theNameObject, const TDF_Label &theStartFrom) { - std::map>::iterator aFind = - myNamingNames.find(theNameObject->data()->name()); + auto aFind = myNamingNames.find(theNameObject->data()->name()); if (aFind == myNamingNames.end() || aFind->second.size() < 2) { return 1; // no need to specify the name by additional identifiers } @@ -2061,7 +2053,7 @@ int Model_Document::numberOfNameInHistory(const ObjectPtr &theNameObject, aNameFeature = std::dynamic_pointer_cast(theNameObject); // iterate all labels with this name to find the nearest just before or equal // relative - std::list::reverse_iterator aLabIter = aFind->second.rbegin(); + auto aLabIter = aFind->second.rbegin(); for (; aLabIter != aFind->second.rend(); aLabIter++) { FeaturePtr aLabFeat = featureByLab(*aLabIter); if (!aLabFeat.get()) @@ -2097,11 +2089,10 @@ ResultPtr Model_Document::findByName(std::wstring &theName, aRes = myObjs->findByName(aName); } if (aNumInHistory) { - std::map>::iterator aFind = - myNamingNames.find(aName); + auto aFind = myNamingNames.find(aName); if (aFind != myNamingNames.end() && (int)aFind->second.size() > aNumInHistory) { - std::list::reverse_iterator aLibIt = aFind->second.rbegin(); + auto aLibIt = aFind->second.rbegin(); for (; aNumInHistory != 0; aNumInHistory--) aLibIt++; const TDF_Label &aResultLab = *aLibIt; @@ -2140,9 +2131,8 @@ void Model_Document::setActive(const bool theFlag) { if (aFeature.get() && aFeature->data()->isValid()) { std::list aResults; ModelAPI_Tools::allResults(aFeature, aResults); - for (std::list::iterator aRes = aResults.begin(); - aRes != aResults.end(); aRes++) { - ModelAPI_EventCreator::get()->sendUpdated(*aRes, aRedispEvent); + for (auto &aResult : aResults) { + ModelAPI_EventCreator::get()->sendUpdated(aResult, aRedispEvent); } } } @@ -2211,18 +2201,18 @@ public: Model_SelectionInPartFeature() : ModelAPI_Feature() {} /// Returns the unique kind of a feature - virtual const std::string &getKind() { + const std::string &getKind() override { static std::string MY_KIND("InternalSelectionInPartFeature"); return MY_KIND; } /// Request for initialization of data model of the object: adding all /// attributes - virtual void initAttributes() { + void initAttributes() override { data()->addAttribute("selection", ModelAPI_AttributeSelectionList::typeId()); } /// Nothing to do in the execution function - virtual void execute() {} + void execute() override {} }; //! Returns the feature that is used for calculation of selection externally @@ -2428,7 +2418,7 @@ void Model_Document::storeNodesState(const std::list &theStates) { if (!theStates.empty()) { Handle(TDataStd_BooleanArray) anArray = TDataStd_BooleanArray::Set(aLab, 0, int(theStates.size()) - 1); - std::list::const_iterator aState = theStates.begin(); + auto aState = theStates.begin(); for (int anIndex = 0; aState != theStates.end(); aState++, anIndex++) { anArray->SetValue(anIndex, *aState); } @@ -2465,7 +2455,7 @@ Model_Document::nextFeature(std::shared_ptr theCurrent, void Model_Document::setExecuteFeatures(const bool theFlag) { myExecuteFeatures = theFlag; const std::set aSubs = subDocuments(); - std::set::iterator aSubIter = aSubs.begin(); + auto aSubIter = aSubs.begin(); for (; aSubIter != aSubs.end(); aSubIter++) { if (!subDoc(*aSubIter)->myObjs) continue; @@ -2483,9 +2473,8 @@ void Model_Document::appendTransactionToPrevious() { } // propagate the same action to sub-documents const std::set aSubs = subDocuments(); - for (std::set::iterator aSubIter = aSubs.begin(); - aSubIter != aSubs.end(); aSubIter++) { - subDoc(*aSubIter)->appendTransactionToPrevious(); + for (int aSub : aSubs) { + subDoc(aSub)->appendTransactionToPrevious(); } } diff --git a/src/Model/Model_Events.cpp b/src/Model/Model_Events.cpp index 435f0a69a..694cdef1b 100644 --- a/src/Model/Model_Events.cpp +++ b/src/Model/Model_Events.cpp @@ -38,7 +38,7 @@ void Model_EventCreator::sendUpdated(const std::list &theObjects, const bool isGroupped) const { if (theObjects.empty()) return; - std::list::const_iterator anObj = theObjects.cbegin(); + auto anObj = theObjects.cbegin(); std::shared_ptr aMsg( new Model_ObjectUpdatedMessage(*anObj, theEvent)); for (anObj++; anObj != theObjects.cend(); anObj++) { @@ -69,7 +69,7 @@ Model_EventCreator::Model_EventCreator() { ModelAPI_EventCreator::set(this); } /////////////////////// UPDATED MESSAGE ///////////////////////////// Model_ObjectUpdatedMessage::Model_ObjectUpdatedMessage( const ObjectPtr &theObject, const Events_ID &theEvent) - : ModelAPI_ObjectUpdatedMessage(theEvent, 0) { + : ModelAPI_ObjectUpdatedMessage(theEvent, nullptr) { if (theObject) { myObjects.insert(theObject); } @@ -89,7 +89,7 @@ void Model_ObjectUpdatedMessage::Join( const std::shared_ptr &theJoined) { std::shared_ptr aJoined = std::dynamic_pointer_cast(theJoined); - std::set::iterator aFIter = aJoined->myObjects.begin(); + auto aFIter = aJoined->myObjects.begin(); for (; aFIter != aJoined->myObjects.end(); aFIter++) { myObjects.insert(*aFIter); } @@ -99,7 +99,7 @@ void Model_ObjectUpdatedMessage::Join( Model_ObjectDeletedMessage::Model_ObjectDeletedMessage( const std::shared_ptr &theDoc, const std::string &theGroup) - : ModelAPI_ObjectDeletedMessage(messageId(), 0) { + : ModelAPI_ObjectDeletedMessage(messageId(), nullptr) { if (!theGroup.empty()) { myGroups.push_back( std::pair, std::string>(theDoc, diff --git a/src/Model/Model_Events.h b/src/Model/Model_Events.h index d2cf0ba8e..86ebe0eae 100644 --- a/src/Model/Model_Events.h +++ b/src/Model/Model_Events.h @@ -30,22 +30,21 @@ class Model_EventCreator : public ModelAPI_EventCreator { public: /// creates created, updated or moved messages and sends to the loop - virtual void sendUpdated(const ObjectPtr &theObject, - const Events_ID &theEvent, - const bool isGroupped = true) const; + void sendUpdated(const ObjectPtr &theObject, const Events_ID &theEvent, + const bool isGroupped = true) const override; /// creates created, updated or moved messages with the objects collection and /// sends to the loop - virtual void sendUpdated(const std::list &theObjects, - const Events_ID &theEvent, - const bool isGroupped = true) const; + void sendUpdated(const std::list &theObjects, + const Events_ID &theEvent, + const bool isGroupped = true) const override; /// creates deleted message and sends to the loop - virtual void sendDeleted(const std::shared_ptr &theDoc, - const std::string &theGroup) const; + void sendDeleted(const std::shared_ptr &theDoc, + const std::string &theGroup) const override; /// creates reordered message and sends to the loop - virtual void - sendReordered(const std::shared_ptr &theReordered) const; + void sendReordered( + const std::shared_ptr &theReordered) const override; /// must be one per application, the constructor for internal usage only Model_EventCreator(); @@ -66,13 +65,13 @@ class Model_ObjectUpdatedMessage : public ModelAPI_ObjectUpdatedMessage { public: /// Returns the feature that has been updated - virtual const std::set &objects() const; + const std::set &objects() const override; //! Creates a new empty group (to store it in the loop before flush) - virtual std::shared_ptr newEmpty(); + std::shared_ptr newEmpty() override; //! Allows to join the given message with the current one - virtual void Join(const std::shared_ptr &theJoined); + void Join(const std::shared_ptr &theJoined) override; }; /// Message that feature was deleted (used for Object Browser update) @@ -90,20 +89,19 @@ class Model_ObjectDeletedMessage : public ModelAPI_ObjectDeletedMessage { public: /// Returns the group where the objects were deleted - virtual const std::list< - std::pair, std::string>> & - groups() const { + const std::list, std::string>> & + groups() const override { return myGroups; } /// Returns the new empty message of this type - virtual std::shared_ptr newEmpty(); + std::shared_ptr newEmpty() override; /// Returns the identifier of this message - virtual const Events_ID messageId(); + const Events_ID messageId() override; /// Appends to this message the given one - virtual void Join(const std::shared_ptr &theJoined); + void Join(const std::shared_ptr &theJoined) override; }; /// Message that feature was deleted (used for Object Browser update) @@ -111,16 +109,17 @@ class Model_OrderUpdatedMessage : public ModelAPI_OrderUpdatedMessage { std::shared_ptr myReordered; ///< the feature that was moved /// Use ModelAPI for creation of this event. - Model_OrderUpdatedMessage(FeaturePtr theReordered, const void *theSender = 0); + Model_OrderUpdatedMessage(FeaturePtr theReordered, + const void *theSender = nullptr); friend class Model_EventCreator; public: /// Returns the document that has been updated - virtual std::shared_ptr reordered() { return myReordered; } + std::shared_ptr reordered() override { return myReordered; } /// Returns the identifier of this message - virtual const Events_ID messageId(); + const Events_ID messageId() override; }; #endif diff --git a/src/Model/Model_Expression.cpp b/src/Model/Model_Expression.cpp index f47962bad..a7c51b8bd 100644 --- a/src/Model/Model_Expression.cpp +++ b/src/Model/Model_Expression.cpp @@ -72,7 +72,7 @@ std::string Model_Expression::error() { void Model_Expression::setUsedParameters( const std::set &theUsedParameters) { myUsedParameters->Clear(); - std::set::const_iterator anIt = theUsedParameters.begin(); + auto anIt = theUsedParameters.begin(); for (; anIt != theUsedParameters.end(); ++anIt) myUsedParameters->Append(TCollection_ExtendedString(anIt->c_str())); } diff --git a/src/Model/Model_Expression.h b/src/Model/Model_Expression.h index 43d167aff..5c027562c 100644 --- a/src/Model/Model_Expression.h +++ b/src/Model/Model_Expression.h @@ -39,23 +39,23 @@ class Model_Expression : public virtual ModelAPI_Expression { public: /// Sets the text of this Expression - MODEL_EXPORT virtual void setText(const std::wstring &theText); + MODEL_EXPORT void setText(const std::wstring &theText) override; /// Returns the text of this Expression - MODEL_EXPORT virtual std::wstring text() const; + MODEL_EXPORT std::wstring text() const override; /// Allows to set expression (text) error (by the parameters listener) - MODEL_EXPORT virtual void setError(const std::string &theError); + MODEL_EXPORT void setError(const std::string &theError) override; /// Returns an expression error - MODEL_EXPORT virtual std::string error(); + MODEL_EXPORT std::string error() override; /// Defines the used parameters (by the parameters listener) - MODEL_EXPORT virtual void - setUsedParameters(const std::set &theUsedParameters); + MODEL_EXPORT void + setUsedParameters(const std::set &theUsedParameters) override; /// Returns the used parameters - MODEL_EXPORT virtual std::set usedParameters() const; + MODEL_EXPORT std::set usedParameters() const override; protected: /// Initializes attributes @@ -79,54 +79,54 @@ class Model_ExpressionDouble public ModelAPI_ExpressionDouble { public: /// Sets the text of this Expression - MODEL_EXPORT virtual void setText(const std::wstring &theText) { + MODEL_EXPORT void setText(const std::wstring &theText) override { Model_Expression::setText(theText); }; /// Returns the text of this Expression - MODEL_EXPORT virtual std::wstring text() const { + MODEL_EXPORT std::wstring text() const override { return Model_Expression::text(); }; /// Allows to set expression (text) error (by the parameters listener) - MODEL_EXPORT virtual void setError(const std::string &theError) { + MODEL_EXPORT void setError(const std::string &theError) override { Model_Expression::setError(theError); }; /// Returns an expression error - MODEL_EXPORT virtual std::string error() { + MODEL_EXPORT std::string error() override { return Model_Expression::error(); }; /// Defines the used parameters (by the parameters listener) - MODEL_EXPORT virtual void - setUsedParameters(const std::set &theUsedParameters) { + MODEL_EXPORT void + setUsedParameters(const std::set &theUsedParameters) override { Model_Expression::setUsedParameters(theUsedParameters); }; /// Returns the used parameters - MODEL_EXPORT virtual std::set usedParameters() const { + MODEL_EXPORT std::set usedParameters() const override { return Model_Expression::usedParameters(); }; /// Defines the double value - MODEL_EXPORT virtual void setValue(const double theValue); + MODEL_EXPORT void setValue(const double theValue) override; /// Returns the double value - MODEL_EXPORT virtual double value(); + MODEL_EXPORT double value() override; /// Allows to set expression (text) as invalid (by the parameters listener) - MODEL_EXPORT virtual void setInvalid(const bool theFlag); + MODEL_EXPORT void setInvalid(const bool theFlag) override; /// Returns true if text is invalid - MODEL_EXPORT virtual bool isInvalid(); + MODEL_EXPORT bool isInvalid() override; protected: /// Initializes attributes Model_ExpressionDouble(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_AttributeDouble; friend class Model_Data; @@ -144,54 +144,54 @@ class Model_ExpressionInteger public ModelAPI_ExpressionInteger { public: /// Sets the text of this Expression - MODEL_EXPORT virtual void setText(const std::wstring &theText) { + MODEL_EXPORT void setText(const std::wstring &theText) override { Model_Expression::setText(theText); }; /// Returns the text of this Expression - MODEL_EXPORT virtual std::wstring text() const { + MODEL_EXPORT std::wstring text() const override { return Model_Expression::text(); }; /// Allows to set expression (text) error (by the parameters listener) - MODEL_EXPORT virtual void setError(const std::string &theError) { + MODEL_EXPORT void setError(const std::string &theError) override { Model_Expression::setError(theError); }; /// Returns an expression error - MODEL_EXPORT virtual std::string error() { + MODEL_EXPORT std::string error() override { return Model_Expression::error(); }; /// Defines the used parameters (by the parameters listener) - MODEL_EXPORT virtual void - setUsedParameters(const std::set &theUsedParameters) { + MODEL_EXPORT void + setUsedParameters(const std::set &theUsedParameters) override { Model_Expression::setUsedParameters(theUsedParameters); }; /// Returns the used parameters - MODEL_EXPORT virtual std::set usedParameters() const { + MODEL_EXPORT std::set usedParameters() const override { return Model_Expression::usedParameters(); }; /// Defines the integer value - MODEL_EXPORT virtual void setValue(const int theValue); + MODEL_EXPORT void setValue(const int theValue) override; /// Returns the integer value - MODEL_EXPORT virtual int value(); + MODEL_EXPORT int value() override; /// Allows to set expression (text) as invalid (by the parameters listener) - MODEL_EXPORT virtual void setInvalid(const bool theFlag); + MODEL_EXPORT void setInvalid(const bool theFlag) override; /// Returns true if text is invalid - MODEL_EXPORT virtual bool isInvalid(); + MODEL_EXPORT bool isInvalid() override; protected: /// Initializes attributes Model_ExpressionInteger(TDF_Label &theLabel); /// Reinitializes the internal state of the attribute (may be needed on /// undo/redo, abort, etc) - virtual void reinit(); + void reinit() override; friend class Model_AttributeInteger; diff --git a/src/Model/Model_FeatureValidator.cpp b/src/Model/Model_FeatureValidator.cpp index 94b4adb8e..af589b337 100644 --- a/src/Model/Model_FeatureValidator.cpp +++ b/src/Model/Model_FeatureValidator.cpp @@ -50,14 +50,13 @@ bool Model_FeatureValidator::isValid( } const std::string kAllTypes = ""; std::list aLtAttributes = aData->attributesIDs(kAllTypes); - std::list::iterator it = aLtAttributes.begin(); + auto it = aLtAttributes.begin(); for (; it != aLtAttributes.end(); it++) { AttributePtr anAttr = aData->attribute(*it); if (!aValidators->isCase(theFeature, anAttr->id())) continue; // this attribute is not participated in the current case if (!anAttr->isInitialized()) { // attribute is not initialized - std::map>::const_iterator - aFeatureFind = myNotObligatory.find(theFeature->getKind()); + auto aFeatureFind = myNotObligatory.find(theFeature->getKind()); if (aFeatureFind == myNotObligatory.end() || // and it is obligatory for filling aFeatureFind->second.find(*it) == aFeatureFind->second.end()) { diff --git a/src/Model/Model_FeatureValidator.h b/src/Model/Model_FeatureValidator.h index 0beb6b868..5fcbec835 100644 --- a/src/Model/Model_FeatureValidator.h +++ b/src/Model/Model_FeatureValidator.h @@ -47,10 +47,9 @@ public: /// \param theArguments the arguments in the configuration file for this /// validator \param theError erros message produced by validator to the user /// if it fails \returns true if feature is valid - MODEL_EXPORT virtual bool - isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + MODEL_EXPORT bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; /// sets not obligatory attributes, not checked for initialization virtual void registerNotObligatory(std::string theFeature, @@ -58,8 +57,8 @@ public: /// Returns true if the attribute in feature is not obligatory for the feature /// execution - virtual bool isNotObligatory(std::string theFeature, - std::string theAttribute); + bool isNotObligatory(std::string theFeature, + std::string theAttribute) override; }; #endif diff --git a/src/Model/Model_FiltersFactory.cpp b/src/Model/Model_FiltersFactory.cpp index 67adc4e9c..e198776e7 100644 --- a/src/Model/Model_FiltersFactory.cpp +++ b/src/Model/Model_FiltersFactory.cpp @@ -123,21 +123,19 @@ bool Model_FiltersFactory::isValid(FeaturePtr theFiltersFeature, std::list aGroups; theFiltersFeature->data()->allGroups(aGroups); - for (std::list::iterator aGIter = aGroups.begin(); - aGIter != aGroups.end(); aGIter++) { - std::string aPureID = pureFilterID(*aGIter); + for (auto &aGroup : aGroups) { + std::string aPureID = pureFilterID(aGroup); if (myFilters.find(aPureID) == myFilters.end()) continue; std::list> anAttrs; - theFiltersFeature->data()->attributesOfGroup(*aGIter, anAttrs); - std::list>::iterator anAttrIter = - anAttrs.begin(); + theFiltersFeature->data()->attributesOfGroup(aGroup, anAttrs); + auto anAttrIter = anAttrs.begin(); for (; anAttrIter != anAttrs.end(); anAttrIter++) { - std::string anArgID = (*anAttrIter)->id().substr((*aGIter).length() + 2); + std::string anArgID = (*anAttrIter)->id().substr(aGroup.length() + 2); if (anArgID.empty()) { // reverse flag std::shared_ptr aReverse = std::dynamic_pointer_cast(*anAttrIter); - FilterArgs aFArgs = {myFilters[aPureID], aReverse->value(), *aGIter}; + FilterArgs aFArgs = {myFilters[aPureID], aReverse->value(), aGroup}; aFilters.push_back(aFArgs); } else { @@ -147,7 +145,7 @@ bool Model_FiltersFactory::isValid(FeaturePtr theFiltersFeature, } // iterate filters and check shape for validity for all of them - std::list::iterator aFilter = aFilters.begin(); + auto aFilter = aFilters.begin(); for (; aFilter != aFilters.end(); aFilter++) { anArgs.setFilter(aFilter->myFilterID); bool aResult = aFilter->myFilter->isOk(theShape, theResult, anArgs); @@ -216,12 +214,12 @@ Model_FiltersFactory::filters(GeomAPI_Shape::ShapeType theType) { FilterPtr Model_FiltersFactory::filter(std::string theID) { std::string aPureID = pureFilterID(theID); - std::map::iterator aFound = myFilters.find(aPureID); + auto aFound = myFilters.find(aPureID); return aFound == myFilters.end() ? FilterPtr() : aFound->second; } std::string Model_FiltersFactory::id(FilterPtr theFilter) { - std::map::iterator anIter = myFilters.begin(); + auto anIter = myFilters.begin(); for (; anIter != myFilters.end(); anIter++) { if (anIter->second == theFilter) return anIter->first; diff --git a/src/Model/Model_FiltersFactory.h b/src/Model/Model_FiltersFactory.h index ee18e6e3a..1f28dde93 100644 --- a/src/Model/Model_FiltersFactory.h +++ b/src/Model/Model_FiltersFactory.h @@ -36,35 +36,35 @@ public: /// Register an instance of a filter /// \param theID unique identifier of the filter, not necessary equal to the /// name of filter \param theFilter the filter's instance - virtual void registerFilter(const std::string &theID, - ModelAPI_Filter *theFilter); + void registerFilter(const std::string &theID, + ModelAPI_Filter *theFilter) override; /// Returns true if all filters of the Filters feature are ok for the Shape /// (taking into account the Reversed states). \param theResult parent result /// of the shape to check \param theShape the checked shape - virtual bool isValid(FeaturePtr theFiltersFeature, ResultPtr theResult, - GeomShapePtr theShape); + bool isValid(FeaturePtr theFiltersFeature, ResultPtr theResult, + GeomShapePtr theShape) override; /// Returns list of all shapes and subshapes in the study, satisfying /// criteria of all filters of \a theFilterFeature. /// \param theFiltersFeature feature that contains all information about the /// filters \param theShapeType the type of sub-shapes to find - virtual std::list> + std::list> select(const FiltersFeaturePtr &theFilterFeature, - const GeomAPI_Shape::ShapeType theShapeType); + const GeomAPI_Shape::ShapeType theShapeType) override; /// Returns the filters that support the given shape type - virtual std::list filters(GeomAPI_Shape::ShapeType theType); + std::list filters(GeomAPI_Shape::ShapeType theType) override; /// Returns a filter by ID - virtual FilterPtr filter(std::string theID); + FilterPtr filter(std::string theID) override; /// Returns a filter ID by the filter pointer - virtual std::string id(FilterPtr theFilter); + std::string id(FilterPtr theFilter) override; protected: /// Get instance from Session - Model_FiltersFactory() {} + Model_FiltersFactory() = default; private: std::map diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 2bfecc411..17bc4b702 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -74,12 +74,11 @@ static const std::string &groupNameFoldering(const std::string &theGroupID, static FolderPtr inFolder(const FeaturePtr &theFeature, const std::string &theFolderAttr) { const std::set &aRefs = theFeature->data()->refsToMe(); - for (std::set::iterator anIt = aRefs.begin(); - anIt != aRefs.end(); ++anIt) { - if ((*anIt)->id() != theFolderAttr) + for (const auto &aRef : aRefs) { + if (aRef->id() != theFolderAttr) continue; - ObjectPtr anOwner = (*anIt)->owner(); + ObjectPtr anOwner = aRef->owner(); FolderPtr aFolder = std::dynamic_pointer_cast(anOwner); if (aFolder.get()) return aFolder; @@ -279,19 +278,18 @@ void Model_Objects::refsToFeature( // the dependencies can be in the feature results std::list aResults; ModelAPI_Tools::allResults(theFeature, aResults); - std::list::const_iterator aResIter = aResults.cbegin(); + auto aResIter = aResults.cbegin(); for (; aResIter != aResults.cend(); aResIter++) { ResultPtr aResult = (*aResIter); std::shared_ptr aData = std::dynamic_pointer_cast(aResult->data()); - if (aData.get() != NULL) { + if (aData.get() != nullptr) { const std::set &aRefs = aData->refsToMe(); - std::set::const_iterator aRefIt = aRefs.begin(), - aRefLast = aRefs.end(); + auto aRefIt = aRefs.begin(), aRefLast = aRefs.end(); for (; aRefIt != aRefLast; aRefIt++) { FeaturePtr aFeature = std::dynamic_pointer_cast((*aRefIt)->owner()); - if (aFeature.get() != NULL) + if (aFeature.get() != nullptr) theRefs.insert(aFeature); } } @@ -301,12 +299,11 @@ void Model_Objects::refsToFeature( std::dynamic_pointer_cast(theFeature->data()); if (aData.get() && !aData->refsToMe().empty()) { const std::set &aRefs = aData->refsToMe(); - std::set::const_iterator aRefIt = aRefs.begin(), - aRefLast = aRefs.end(); + auto aRefIt = aRefs.begin(), aRefLast = aRefs.end(); for (; aRefIt != aRefLast; aRefIt++) { FeaturePtr aFeature = std::dynamic_pointer_cast((*aRefIt)->owner()); - if (aFeature.get() != NULL) + if (aFeature.get() != nullptr) theRefs.insert(aFeature); } } @@ -327,8 +324,7 @@ void Model_Objects::removeFeature(FeaturePtr theFeature) { // inform the owner std::set> aRefs; refsToFeature(theFeature, aRefs, false); - std::set>::iterator aRefIter = - aRefs.begin(); + auto aRefIter = aRefs.begin(); for (; aRefIter != aRefs.end(); aRefIter++) { std::shared_ptr aComposite = std::dynamic_pointer_cast(*aRefIter); @@ -375,7 +371,7 @@ void Model_Objects::eraseAllFeatures() { FeaturePtr aFeature = aFIter.Value(); std::list aResList; ModelAPI_Tools::allResults(aFeature, aResList); - std::list::iterator aRIter = aResList.begin(); + auto aRIter = aResList.begin(); for (; aRIter != aResList.end(); aRIter++) { ResultPtr aRes = *aRIter; if (aRes && aRes->data()->isValid()) { @@ -465,8 +461,7 @@ void Model_Objects::clearHistory(ObjectPtr theObj) { FeaturePtr aFeature = std::dynamic_pointer_cast(theObj); std::string aResultGroup = featureResultGroup(aFeature); if (!aResultGroup.empty()) { - std::map>::iterator aHIter = - myHistory.find(aResultGroup); + auto aHIter = myHistory.find(aResultGroup); if (aHIter != myHistory.end()) myHistory.erase(aHIter); // erase from map => this means that it is // not synchronized @@ -476,8 +471,7 @@ void Model_Objects::clearHistory(ObjectPtr theObj) { } void Model_Objects::createHistory(const std::string &theGroupID) { - std::map>::iterator aHIter = - myHistory.find(theGroupID); + auto aHIter = myHistory.find(theGroupID); if (aHIter == myHistory.end()) { std::vector aResult; std::vector aResultOutOfFolder; @@ -493,12 +487,13 @@ void Model_Objects::createHistory(const std::string &theGroupID) { if (aFeature.get()) { // if feature is in sub-component, remove it from history: // it is in sub-tree of sub-component - bool isSub = ModelAPI_Tools::compositeOwner(aFeature).get() != NULL; + bool isSub = + ModelAPI_Tools::compositeOwner(aFeature).get() != nullptr; if (isFeature) { // here may be also disabled features if (!isSub && aFeature->isInHistory()) { aResult.push_back(aFeature); // the feature is out of the folders - if (aLastFeatureInFolder.get() == NULL) + if (aLastFeatureInFolder.get() == nullptr) aResultOutOfFolder.push_back(aFeature); } } else if (!aFeature->isDisabled()) { // iterate all results of @@ -509,8 +504,7 @@ void Model_Objects::createHistory(const std::string &theGroupID) { // changed by "isConcealed" const std::list> aResults = aFeature->results(); - std::list>::const_iterator - aRIter = aResults.begin(); + auto aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { ResultPtr aRes = *aRIter; if (aRes->groupName() != theGroupID) @@ -569,8 +563,7 @@ void Model_Objects::updateHistory( } void Model_Objects::updateHistory(const std::string theGroup) { - std::map>::iterator aHIter = - myHistory.find(theGroup); + auto aHIter = myHistory.find(theGroup); if (aHIter != myHistory.end()) { myHistory.erase( aHIter); // erase from map => this means that it is not synchronized @@ -637,8 +630,7 @@ ObjectPtr Model_Objects::object(TDF_Label theLabel) { return ObjectPtr(); } else { // iterate results of feature const std::list &aResults = aFeature->results(); - std::list>::const_iterator aRIter = - aResults.cbegin(); + auto aRIter = aResults.cbegin(); for (; aRIter != aResults.cend(); aRIter++) { std::shared_ptr aResData = std::dynamic_pointer_cast((*aRIter)->data()); @@ -675,8 +667,7 @@ Model_Objects::objectByName(const std::string &theGroupID, // history or not) std::list> allObjs = allFeatures(); // from the end to find the latest result with such name - std::list>::reverse_iterator anObjIter = - allObjs.rbegin(); + auto anObjIter = allObjs.rbegin(); for (; anObjIter != allObjs.rend(); anObjIter++) { if ((*anObjIter)->data()->name() == theName) return *anObjIter; @@ -684,16 +675,14 @@ Model_Objects::objectByName(const std::string &theGroupID, } else { // searching among results (concealed or not) std::list> allObjs = allFeatures(); // from the end to find the latest result with such name - std::list>::reverse_iterator anObjIter = - allObjs.rbegin(); + auto anObjIter = allObjs.rbegin(); for (; anObjIter != allObjs.rend(); anObjIter++) { std::list allRes; ModelAPI_Tools::allResults(*anObjIter, allRes); - for (std::list::iterator aRes = allRes.begin(); - aRes != allRes.end(); aRes++) { - if (aRes->get() && (*aRes)->groupName() == theGroupID) { - if ((*aRes)->data()->name() == theName) - return *aRes; + for (auto &allRe : allRes) { + if (allRe.get() && allRe->groupName() == theGroupID) { + if (allRe->data()->name() == theName) + return allRe; } } } @@ -702,8 +691,8 @@ Model_Objects::objectByName(const std::string &theGroupID, return ObjectPtr(); } -const int Model_Objects::index(std::shared_ptr theObject, - const bool theAllowFolder) { +int Model_Objects::index(std::shared_ptr theObject, + const bool theAllowFolder) { std::string aGroup = theObject->groupName(); // treat folder as feature if (aGroup == ModelAPI_Folder::group()) @@ -715,8 +704,7 @@ const int Model_Objects::index(std::shared_ptr theObject, aGroup = groupNameFoldering(aGroup, theAllowFolder); std::vector &allObjs = myHistory[aGroup]; - std::vector::iterator anObjIter = - allObjs.begin(); // iterate to search object + auto anObjIter = allObjs.begin(); // iterate to search object for (int anIndex = 0; anObjIter != allObjs.end(); anObjIter++, anIndex++) { if ((*anObjIter) == theObject) return anIndex; @@ -757,8 +745,7 @@ void Model_Objects::allResults(const std::string &theGroupID, if (aFeature.get()) { const std::list> &aResults = aFeature->results(); - std::list>::const_iterator aRIter = - aResults.begin(); + auto aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { ResultPtr aRes = *aRIter; if (aRes->groupName() != theGroupID) @@ -946,15 +933,14 @@ void Model_Objects::synchronizeFeatures(const TDF_LabelList &theUpdated, } else { std::list> anAttrs = anObject->data()->attributes(""); - std::list>::iterator anAttr = - anAttrs.begin(); + auto anAttr = anAttrs.begin(); for (; anAttr != anAttrs.end(); anAttr++) (*anAttr)->reinit(); // if feature contains results, re-init them too if (aFeature.get()) { std::list aResults; ModelAPI_Tools::allResults(aFeature, aResults); - std::list::iterator aResIter = aResults.begin(); + auto aResIter = aResults.begin(); for (; aResIter != aResults.end(); aResIter++) { anAttrs = (*aResIter)->data()->attributes(""); for (anAttr = anAttrs.begin(); anAttr != anAttrs.end(); @@ -969,8 +955,7 @@ void Model_Objects::synchronizeFeatures(const TDF_LabelList &theUpdated, // if parameters are changed, update the results (issue 937) const std::list> &aResults = aFeature->results(); - std::list>::const_iterator aRIter = - aResults.begin(); + auto aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { std::shared_ptr aRes = *aRIter; if (aRes->data()->isValid() && !aRes->isDisabled()) { @@ -1086,7 +1071,7 @@ void Model_Objects::synchronizeBackRefsForObject( std::shared_ptr aData = std::dynamic_pointer_cast(theObject->data()); // iterate new list to compare with current - std::set::iterator aNewIter = theNewRefs.begin(); + auto aNewIter = theNewRefs.begin(); for (; aNewIter != theNewRefs.end(); aNewIter++) { // for the Model_AttributeRefList erase cash (issue #2819) std::shared_ptr aRefList = @@ -1105,7 +1090,7 @@ void Model_Objects::synchronizeBackRefsForObject( } if (theNewRefs.size() != aData->refsToMe().size()) { // some back ref must be removed - std::set::iterator aCurrentIter = aData->refsToMe().begin(); + auto aCurrentIter = aData->refsToMe().begin(); while (aCurrentIter != aData->refsToMe().end()) { if (theNewRefs.find(*aCurrentIter) == theNewRefs.end()) { // for external references from other documents this system @@ -1121,9 +1106,7 @@ void Model_Objects::synchronizeBackRefsForObject( std::list>>> aRefs; (*aCurrentIter)->owner()->data()->referencesToObjects(aRefs); - std::list>>>:: - iterator aRefIter = aRefs.begin(); + auto aRefIter = aRefs.begin(); for (; aRefIter != aRefs.end(); aRefIter++) { if ((*aCurrentIter)->id() == aRefIter->first) { std::list>::iterator anOIt; @@ -1149,7 +1132,7 @@ void Model_Objects::synchronizeBackRefsForObject( // for the last feature in the folder, check if it is a sub-feature, // then refer the folder to a top-level parent composite feature const std::set &aRefs = aData->refsToMe(); - std::set::iterator anIt = aRefs.begin(); + auto anIt = aRefs.begin(); for (; anIt != aRefs.end(); ++anIt) if ((*anIt)->id() == ModelAPI_Folder::LAST_FEATURE_ID()) break; @@ -1188,14 +1171,12 @@ collectReferences(std::shared_ptr theData, if (theData.get()) { std::list>> aRefs; theData->referencesToObjects(aRefs); - std::list>>::iterator aRefsIt = - aRefs.begin(); + auto aRefsIt = aRefs.begin(); for (; aRefsIt != aRefs.end(); aRefsIt++) { - std::list::iterator aRefTo = aRefsIt->second.begin(); + auto aRefTo = aRefsIt->second.begin(); for (; aRefTo != aRefsIt->second.end(); aRefTo++) { if (*aRefTo) { - std::map>::iterator aFound = - theRefs.find(*aRefTo); + auto aFound = theRefs.find(*aRefTo); if (aFound == theRefs.end()) { theRefs[*aRefTo] = std::set(); aFound = theRefs.find(*aRefTo); @@ -1229,8 +1210,7 @@ void Model_Objects::synchronizeBackRefs() { for (aFeatures.Initialize(myFeatures); aFeatures.More(); aFeatures.Next()) { FeaturePtr aFeature = aFeatures.Value(); static std::set anEmpty; - std::map>::iterator aFound = - allRefs.find(aFeature); + auto aFound = allRefs.find(aFeature); if (aFound == allRefs.end()) { // not found => erase all back references synchronizeBackRefsForObject(anEmpty, aFeature); } else { @@ -1240,7 +1220,7 @@ void Model_Objects::synchronizeBackRefs() { // also for results std::list aResults; ModelAPI_Tools::allResults(aFeature, aResults); - std::list::iterator aRIter = aResults.begin(); + auto aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { aFound = allRefs.find(*aRIter); if (aFound == allRefs.end()) { // not found => erase all back references @@ -1256,15 +1236,14 @@ void Model_Objects::synchronizeBackRefs() { std::list aResults; ModelAPI_Tools::allResults(aFeature, aResults); // update the concealment status for display in isConcealed of ResultBody - std::list::iterator aRIter = aResults.begin(); + auto aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { (*aRIter)->isConcealed(); } } // the rest all refs means that feature references to the external document // feature: process also them - std::map>::iterator anExtIter = - allRefs.begin(); + auto anExtIter = allRefs.begin(); for (; anExtIter != allRefs.end(); anExtIter++) { synchronizeBackRefsForObject(anExtIter->second, anExtIter->first); } @@ -1303,7 +1282,7 @@ bool Model_Objects::hasCustomName(DataPtr theFeatureData, ResultPtr theResult, // CompSolid's result) int aBodyResultIndex = 0; const std::list &aResults = anOwner->results(); - std::list::const_iterator anIt = aResults.begin(); + auto anIt = aResults.begin(); for (; anIt != aResults.end(); ++anIt, ++aBodyResultIndex) if (aBodyRes == *anIt) break; @@ -1566,7 +1545,7 @@ static FeaturePtr limitingFeature(std::list &theFeatures, // Verify the feature is sub-element in composite feature or it is not used in // the history static bool isSkippedFeature(FeaturePtr theFeature) { - bool isSub = ModelAPI_Tools::compositeOwner(theFeature).get() != NULL; + bool isSub = ModelAPI_Tools::compositeOwner(theFeature).get() != nullptr; return isSub || (theFeature && !theFeature->isInHistory()); } @@ -1994,8 +1973,7 @@ void Model_Objects::updateResults(FeaturePtr theFeature, return; // check the existing results and remove them if there is nothing on the label - std::list::const_iterator aResIter = - theFeature->results().cbegin(); + auto aResIter = theFeature->results().cbegin(); while (aResIter != theFeature->results().cend()) { ResultPtr aBody = std::dynamic_pointer_cast(*aResIter); if (aBody.get()) { @@ -2073,7 +2051,7 @@ void Model_Objects::updateResults(FeaturePtr theFeature, } } if (aResSize > 0) { // check there exist a body that must be updated - std::list::const_iterator aRes = theFeature->results().cbegin(); + auto aRes = theFeature->results().cbegin(); for (; aResSize && aRes != theFeature->results().cend(); aRes++, aResSize++) { if ((*aRes)->data()->isValid()) { @@ -2103,7 +2081,7 @@ ResultPtr Model_Objects::findByName(const std::wstring theName) { continue; std::list allResults; ModelAPI_Tools::allResults(aFeature, allResults); - std::list::iterator aRIter = allResults.begin(); + auto aRIter = allResults.begin(); for (; aRIter != allResults.cend(); aRIter++) { ResultPtr aRes = *aRIter; if (aRes.get() && aRes->data() && aRes->data()->isValid() && diff --git a/src/Model/Model_Objects.h b/src/Model/Model_Objects.h index c38a3013c..d3219f033 100644 --- a/src/Model/Model_Objects.h +++ b/src/Model/Model_Objects.h @@ -87,8 +87,8 @@ public: //! returns -1. \param theObject object of this document \param theAllowFolder //! take into account grouping feature by folders \returns index started from //! zero, or -1 if object is invisible or belongs to another document - const int index(std::shared_ptr theObject, - const bool theAllowFolder = false); + int index(std::shared_ptr theObject, + const bool theAllowFolder = false); //! Returns the feature in the group by the index (started from zero) //! \param theGroupID group that contains a feature diff --git a/src/Model/Model_ResultBody.cpp b/src/Model/Model_ResultBody.cpp index 56d6f2692..4672efaa2 100644 --- a/src/Model/Model_ResultBody.cpp +++ b/src/Model/Model_ResultBody.cpp @@ -69,9 +69,7 @@ bool Model_ResultBody::generated(const GeomShapePtr &theNewShape, const bool theCheckIsInResult) { bool aResult = false; if (mySubs.size()) { // consists of subs - for (std::vector::const_iterator aSubIter = mySubs.cbegin(); - aSubIter != mySubs.cend(); ++aSubIter) { - const ResultBodyPtr &aSub = *aSubIter; + for (const auto &aSub : mySubs) { if (aSub->generated(theNewShape, theName, theCheckIsInResult)) aResult = true; } @@ -88,9 +86,7 @@ void Model_ResultBody::loadGeneratedShapes( const GeomAPI_Shape::ShapeType theShapeTypeToExplore, const std::string &theName, const bool theSaveOldIfNotInTree) { if (mySubs.size()) { // consists of subs - for (std::vector::const_iterator aSubIter = mySubs.cbegin(); - aSubIter != mySubs.cend(); ++aSubIter) { - const ResultBodyPtr &aSub = *aSubIter; + for (const auto &aSub : mySubs) { aSub->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName, theSaveOldIfNotInTree); } @@ -109,7 +105,7 @@ void Model_ResultBody::loadModifiedShapes( // optimization of getting of new shapes for specific sub-result if (!theAlgo->isNewShapesCollected(theOldShape, theShapeTypeToExplore)) theAlgo->collectNewShapes(theOldShape, theShapeTypeToExplore); - std::vector::const_iterator aSubIter = mySubs.cbegin(); + auto aSubIter = mySubs.cbegin(); for (; aSubIter != mySubs.cend(); aSubIter++) { (*aSubIter)->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName); @@ -123,9 +119,7 @@ void Model_ResultBody::loadModifiedShapes( void Model_ResultBody::loadFirstLevel(GeomShapePtr theShape, const std::string &theName) { if (mySubs.size()) { // consists of subs - for (std::vector::const_iterator aSubIter = mySubs.cbegin(); - aSubIter != mySubs.cend(); ++aSubIter) { - const ResultBodyPtr &aSub = *aSubIter; + for (const auto &aSub : mySubs) { aSub->loadFirstLevel(theShape, theName); } } else { // do for this directly @@ -145,7 +139,7 @@ ResultBodyPtr Model_ResultBody::subResult(const int theIndex, } bool Model_ResultBody::isSub(ObjectPtr theResult, int &theIndex) const { - std::map::const_iterator aFound = mySubsMap.find(theResult); + auto aFound = mySubsMap.find(theResult); if (aFound != mySubsMap.end()) { theIndex = aFound->second; return true; @@ -215,7 +209,7 @@ void Model_ResultBody::updateConcealment() { bool aNewFlag = !myLastConcealed; if (checkAllSubs(anOwner, aNewFlag, anUpdated)) { // state of everyone must be updated - std::list::iterator aRes = anUpdated.begin(); + auto aRes = anUpdated.begin(); for (; aRes != anUpdated.end(); aRes++) { bool aLastConcealed = (*aRes)->isConcealed(); if (aNewFlag != aLastConcealed) { @@ -265,12 +259,10 @@ std::wstring Model_ResultBody::findShapeName(std::shared_ptr theShape) { TopoDS_Shape aShape = theShape->impl(); - for (std::map>::iterator it = - myNamesShape.begin(); - it != myNamesShape.end(); ++it) { - TopoDS_Shape curSelectedShape = (*it).second->impl(); + for (auto &it : myNamesShape) { + TopoDS_Shape curSelectedShape = it.second->impl(); if ((aShape.IsSame(curSelectedShape))) { - return (*it).first; + return it.first; } } return L"material not found"; @@ -278,8 +270,7 @@ Model_ResultBody::findShapeName(std::shared_ptr theShape) { const std::vector & Model_ResultBody::findShapeColor(const std::wstring &theShapeName) { - std::map>::iterator aColor = - myColorsShape.find(theShapeName); + auto aColor = myColorsShape.find(theShapeName); if (aColor != myColorsShape.end()) return aColor->second; static std::vector anEmptyVector; @@ -333,19 +324,16 @@ void Model_ResultBody::updateSubs( aSubIndex) { // it is needed to create a new sub-result std::wstring thenameshape = L""; // find shape name read - for (std::map>::iterator - it = myNamesShape.begin(); - it != myNamesShape.end(); ++it) { - TopoDS_Shape curSelectedShape = (*it).second->impl(); + for (auto &it : myNamesShape) { + TopoDS_Shape curSelectedShape = it.second->impl(); if (!(aShapesIter.Value().IsSame(curSelectedShape))) continue; - thenameshape = (*it).first; + thenameshape = it.first; break; } aSub = anObjects->createBody(this->data(), aSubIndex, thenameshape); // finf color read - std::map>::iterator itColor = - myColorsShape.find(thenameshape); + auto itColor = myColorsShape.find(thenameshape); if (itColor != myColorsShape.end()) { ModelAPI_Tools::setColor(aSub, (*itColor).second); } @@ -449,9 +437,7 @@ bool Model_ResultBody::isConnectedTopology() { void Model_ResultBody::cleanCash() { myBuilder->cleanCash(); - for (std::vector::const_iterator aSubIter = mySubs.cbegin(); - aSubIter != mySubs.cend(); ++aSubIter) { - const ResultBodyPtr &aSub = *aSubIter; + for (const auto &aSub : mySubs) { aSub->cleanCash(); } } @@ -478,8 +464,7 @@ static void collectSubs(const GeomShapePtr theSub, for (GeomAPI_ShapeIterator anIter(theSub); anIter.more(); anIter.next()) collectSubs(anIter.current(), theSubSubs, theOneLevelMore); } else if (theOneLevelMore) { - GeomAPI_Shape::ShapeType aSubType = - GeomAPI_Shape::ShapeType(int(theSub->shapeType()) + 1); + auto aSubType = GeomAPI_Shape::ShapeType(int(theSub->shapeType()) + 1); if (aSubType == GeomAPI_Shape::SHAPE) return; if (aSubType == GeomAPI_Shape::SHELL) @@ -503,7 +488,7 @@ void Model_ResultBody::computeOldForSub( TopTools_MapOfShape aSubSubs; collectSubs(theSub, aSubSubs, false); - std::list::const_iterator aRootOlds = theAllOlds.cbegin(); + auto aRootOlds = theAllOlds.cbegin(); for (; aRootOlds != theAllOlds.cend(); aRootOlds++) { // use sub-shapes of olds too if they are compounds or compsolids TopTools_MapOfShape anOldSubs; @@ -539,18 +524,16 @@ void Model_ResultBody::computeOldForSub( aNews.clear(); // store result in the history TopTools_ListOfShape aList; - for (ListOfShape::iterator aNewIter = aNews.begin(); - aNewIter != aNews.end(); aNewIter++) { - aList.Append((*aNewIter)->impl()); + for (auto &aNew : aNews) { + aList.Append(aNew->impl()); } myHistoryCash.Bind(anOldShape, aList); } - for (ListOfShape::iterator aNewIter = aNews.begin(); - aNewIter != aNews.end(); aNewIter++) { - if (aSubSubs.Contains((*aNewIter)->impl())) { + for (auto &aNew : aNews) { + if (aSubSubs.Contains(aNew->impl())) { // check list already contains this sub - std::list::iterator aResIter = theOldForSub.begin(); + auto aResIter = theOldForSub.begin(); for (; aResIter != theOldForSub.end(); aResIter++) if ((*aResIter)->isSame(anOldSub)) break; diff --git a/src/Model/Model_ResultBody.h b/src/Model/Model_ResultBody.h index 9dca0ced9..31e16a654 100644 --- a/src/Model/Model_ResultBody.h +++ b/src/Model/Model_ResultBody.h @@ -59,22 +59,22 @@ class Model_ResultBody : public ModelAPI_ResultBody { public: /// Removes the stored builders - MODEL_EXPORT virtual ~Model_ResultBody(); + MODEL_EXPORT ~Model_ResultBody() override; /// Request for initialization of data model of the result body: adding all /// attributes - virtual void initAttributes(); + void initAttributes() override; /// Records the subshape newShape which was generated during a topological /// construction. As an example, consider the case of a face generated in /// construction of a box. - MODEL_EXPORT virtual bool - generated(const GeomShapePtr &theNewShape, const std::string &theName, - const bool theCheckIsInResult = true) override; + MODEL_EXPORT bool generated(const GeomShapePtr &theNewShape, + const std::string &theName, + const bool theCheckIsInResult = true) override; /// load generated shapes MODEL_EXPORT - virtual void + void loadGeneratedShapes(const std::shared_ptr &theAlgo, const GeomShapePtr &theOldShape, const GeomAPI_Shape::ShapeType theShapeTypeToExplore, @@ -83,59 +83,58 @@ public: /// load modified shapes for sub-objects MODEL_EXPORT - virtual void - loadModifiedShapes(const std::shared_ptr &theAlgo, - const GeomShapePtr &theOldShape, - const GeomAPI_Shape::ShapeType theShapeTypeToExplore, - const std::string &theName = "") override; + void loadModifiedShapes(const std::shared_ptr &theAlgo, + const GeomShapePtr &theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string &theName = "") override; /// load shapes of the first level (to be used during shape import) - MODEL_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape, - const std::string &theName); + MODEL_EXPORT void loadFirstLevel(GeomShapePtr theShape, + const std::string &theName) override; /// Returns the number of sub-elements - MODEL_EXPORT virtual int numberOfSubs(bool forTree = false) const; + MODEL_EXPORT int numberOfSubs(bool forTree = false) const override; /// Returns the sub-result by zero-base index - MODEL_EXPORT virtual ResultBodyPtr subResult(const int theIndex, - bool forTree = false) const; + MODEL_EXPORT ResultBodyPtr subResult(const int theIndex, + bool forTree = false) const override; /// Returns true if feature or result belong to this composite feature as subs /// Returns theIndex - zero based index of sub if found - MODEL_EXPORT virtual bool isSub(ObjectPtr theObject, int &theIndex) const; + MODEL_EXPORT bool isSub(ObjectPtr theObject, int &theIndex) const override; /// Returns the parameters of color definition in the resources configuration /// manager - MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection, - std::string &theName, - std::string &theDefault); + MODEL_EXPORT void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) override; /// Disables the result body: keeps the resulting shape as selection, but /// erases the underlaying naming data structure if theFlag if false. Or /// restores every thing on theFlag is true. - MODEL_EXPORT virtual bool - setDisabled(std::shared_ptr theThis, const bool theFlag); + MODEL_EXPORT bool setDisabled(std::shared_ptr theThis, + const bool theFlag) override; /// The compsolid is concealed if at least one of the sub is concealed - MODEL_EXPORT virtual bool isConcealed(); + MODEL_EXPORT bool isConcealed() override; /// Sets all subs as concealed in the data tree (referenced by other objects) - MODEL_EXPORT virtual void setIsConcealed(const bool theValue, - const bool theForced = false); + MODEL_EXPORT void setIsConcealed(const bool theValue, + const bool theForced = false) override; /// Returns true is the topology is connected. - MODEL_EXPORT virtual bool isConnectedTopology(); + MODEL_EXPORT bool isConnectedTopology() override; /// Cleans cash related to the already stored elements - MODEL_EXPORT virtual void cleanCash() override; + MODEL_EXPORT void cleanCash() override; /// sets the texture file - MODEL_EXPORT virtual bool hasTexture() override; + MODEL_EXPORT bool hasTexture() override; /// Find the imported color by the construction name of a shape. /// Returns empty vector if not found. - MODEL_EXPORT virtual const std::vector & - findShapeColor(const std::wstring &theShapeName); + MODEL_EXPORT const std::vector & + findShapeColor(const std::wstring &theShapeName) override; protected: /// Makes a body on the given feature @@ -143,13 +142,13 @@ protected: /// Updates the sub-bodies if shape of this object is composite-solid void updateSubs(const std::shared_ptr &theThisShape, - const bool theShapeChanged = true); + const bool theShapeChanged = true) override; /// Updates the sub-bodies in accordance to the algorithm history information void updateSubs(const GeomShapePtr &theThisShape, const std::list &theOlds, const std::shared_ptr theMakeShape, - const bool isGenerated); + const bool isGenerated) override; /// Checks the state of children and parents to send events of creation/erase /// when needed diff --git a/src/Model/Model_ResultConstruction.cpp b/src/Model/Model_ResultConstruction.cpp index 029179a32..8327220fd 100644 --- a/src/Model/Model_ResultConstruction.cpp +++ b/src/Model/Model_ResultConstruction.cpp @@ -183,7 +183,7 @@ bool Model_ResultConstruction::updateShape() { return false; } -Model_ResultConstruction::Model_ResultConstruction() {} +Model_ResultConstruction::Model_ResultConstruction() = default; bool Model_ResultConstruction::isInHistory() { std::shared_ptr aData = @@ -286,7 +286,7 @@ void Model_ResultConstruction::storeShape( } std::shared_ptr aMyDoc = std::dynamic_pointer_cast(document()); - const TopoDS_Shape &aShape = theShape->impl(); + const auto &aShape = theShape->impl(); if (isInfinite() || aShape.ShapeType() == TopAbs_VERTEX) { aShapeLab.ForgetAllAttributes(); // clear all previously stored TNaming_Builder aBuilder(aShapeLab); @@ -406,7 +406,7 @@ void Model_ResultConstruction::setFacesOrder( } std::shared_ptr aMyDoc = std::dynamic_pointer_cast(document()); - const TopoDS_Shape &aShape = aResShape->impl(); + const auto &aShape = aResShape->impl(); if (aShape.ShapeType() != TopAbs_VERTEX && aShape.ShapeType() != TopAbs_EDGE) { ResultPtr aThisPtr = @@ -430,10 +430,9 @@ void Model_ResultConstruction::setFacesOrder( NCollection_List anUnorderedFaces; // unordered faces are empty in this case int aTagId = 0; - for (std::list::const_iterator aFIt = theFaces.begin(); - aFIt != theFaces.end(); ++aFIt) { - aFaces.push_back(*aFIt); - aFacesOrder.Bind(++aTagId, (*aFIt)->impl()); + for (const auto &theFace : theFaces) { + aFaces.push_back(theFace); + aFacesOrder.Bind(++aTagId, theFace->impl()); } MapFaceToEdgeIndices aNewIndices; // edges indices @@ -493,7 +492,7 @@ void storeFacesOnLabel( std::wstringstream aName; aName << "Face"; TopExp_Explorer aPutEdges(aFaceToPut, TopAbs_EDGE); - TNaming_Builder *anEdgesBuilder = 0, *aVerticesBuilder = 0; + TNaming_Builder *anEdgesBuilder = nullptr, *aVerticesBuilder = nullptr; for (TColStd_ListOfInteger::Iterator anIter(aNewInd); anIter.More(); anIter.Next()) { int anIndex = anIter.Value(); @@ -579,8 +578,7 @@ void indexingSketchEdges( FeaturePtr aSub = theComposite->subFeature(a); const std::list> &aResults = aSub->results(); - std::list>::const_iterator aRes = - aResults.cbegin(); + auto aRes = aResults.cbegin(); for (; aRes != aResults.cend(); aRes++) { ResultConstructionPtr aConstr = std::dynamic_pointer_cast(*aRes); @@ -601,8 +599,7 @@ void faceToEdgeIndices( const ListOfShape &theFaces, const NCollection_DataMap &theCurvesIndices, MapFaceToEdgeIndices &theFaceEdges) { - std::list>::const_iterator aFIter = - theFaces.begin(); + auto aFIter = theFaces.begin(); for (; aFIter != theFaces.end(); aFIter++) { std::shared_ptr aFace(new GeomAPI_Face(*aFIter)); // put them to a label, trying to keep the same faces on the same labels diff --git a/src/Model/Model_ResultConstruction.h b/src/Model/Model_ResultConstruction.h index 018935347..65898ca4f 100644 --- a/src/Model/Model_ResultConstruction.h +++ b/src/Model/Model_ResultConstruction.h @@ -41,43 +41,43 @@ class Model_ResultConstruction : public ModelAPI_ResultConstruction { myShape; ///< shape of this result created "on the fly" public: /// Retuns the parameters of color definition in the resources config manager - MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection, - std::string &theName, - std::string &theDefault); + MODEL_EXPORT void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) override; /// By default object is displayed in the object browser. - MODEL_EXPORT virtual bool isInHistory(); + MODEL_EXPORT bool isInHistory() override; /// Sets the result - MODEL_EXPORT virtual void setShape(std::shared_ptr theShape); + MODEL_EXPORT void setShape(std::shared_ptr theShape) override; /// Returns the shape-result produced by this feature - MODEL_EXPORT virtual std::shared_ptr shape(); + MODEL_EXPORT std::shared_ptr shape() override; /// Sets the flag that it must be displayed in history (default is true) - MODEL_EXPORT virtual void setIsInHistory(const bool myIsInHistory); + MODEL_EXPORT void setIsInHistory(const bool myIsInHistory) override; /// if the construction result may be used as faces, this method returns not /// zero number of faces \param theUpdateNaming is false of keeping the naming /// structure untouched (on load) - MODEL_EXPORT virtual int facesNum(const bool theUpdateNaming = true); + MODEL_EXPORT int facesNum(const bool theUpdateNaming = true) override; /// if the construction result may be used as faces, this method returns face /// by zero based index - MODEL_EXPORT virtual std::shared_ptr face(const int theIndex); + MODEL_EXPORT std::shared_ptr face(const int theIndex) override; /// Change the order of faces MODEL_EXPORT - virtual void - setFacesOrder(const std::list> &theFaces); + void setFacesOrder( + const std::list> &theFaces) override; /// By default object is not infinite. - MODEL_EXPORT virtual bool isInfinite(); + MODEL_EXPORT bool isInfinite() override; /// Sets the flag that it is infinite - MODEL_EXPORT virtual void setInfinite(const bool theInfinite); + MODEL_EXPORT void setInfinite(const bool theInfinite) override; /// The construction element may be concealed only by "delete" feature - MODEL_EXPORT virtual void setIsConcealed(const bool theValue, - const bool theForced = false); + MODEL_EXPORT void setIsConcealed(const bool theValue, + const bool theForced = false) override; /// Updates the shape taking the current value from the data structure, /// returns true if update has been correctly done - MODEL_EXPORT virtual bool updateShape(); + MODEL_EXPORT bool updateShape() override; protected: /// Makes a body on the given feature diff --git a/src/Model/Model_ResultField.cpp b/src/Model/Model_ResultField.cpp index ea5c5c4e7..4166eb254 100644 --- a/src/Model/Model_ResultField.cpp +++ b/src/Model/Model_ResultField.cpp @@ -149,7 +149,7 @@ Model_ResultField::step(int theId) const { if (theId < (int)mySteps.size()) { return mySteps[theId]; } - return NULL; + return nullptr; } std::wstring Model_ResultField::Model_FieldStep::name() { diff --git a/src/Model/Model_ResultField.h b/src/Model/Model_ResultField.h index 74fdde6a5..1c9357219 100644 --- a/src/Model/Model_ResultField.h +++ b/src/Model/Model_ResultField.h @@ -44,16 +44,16 @@ public: // "valid" for GUI checks }; - virtual ModelAPI_ResultField *field() const { return myParent; } + ModelAPI_ResultField *field() const override { return myParent; } - virtual int id() const { return myId; } + int id() const override { return myId; } - virtual std::shared_ptr document() const { + std::shared_ptr document() const override { return myParent->document(); } /// Returns a GUI name of this step - virtual std::wstring name(); + std::wstring name() override; private: ModelAPI_ResultField *myParent; @@ -62,30 +62,30 @@ public: /// Returns the parameters of color definition in the resources configuration /// manager - MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection, - std::string &theName, - std::string &theDefault); + MODEL_EXPORT void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) override; /// Returns the compound of selected entities - MODEL_EXPORT virtual std::shared_ptr shape(); + MODEL_EXPORT std::shared_ptr shape() override; /// Returns number of steps - MODEL_EXPORT virtual int stepsSize() const; + MODEL_EXPORT int stepsSize() const override; /// Returns a text line by its number /// \param theLine a number of line - MODEL_EXPORT virtual std::string textLine(int theLine) const; + MODEL_EXPORT std::string textLine(int theLine) const override; /// Returns step object /// \param theId an id of the object - MODEL_EXPORT virtual std::shared_ptr - step(int theId) const; + MODEL_EXPORT std::shared_ptr + step(int theId) const override; /// Removes the stored builders - MODEL_EXPORT virtual ~Model_ResultField(); + MODEL_EXPORT ~Model_ResultField() override; /// To refresh the steps of a field - MODEL_EXPORT virtual void updateSteps(); + MODEL_EXPORT void updateSteps() override; protected: /// Makes a body on the given feature data diff --git a/src/Model/Model_ResultGroup.h b/src/Model/Model_ResultGroup.h index 13af70272..da7140d8b 100644 --- a/src/Model/Model_ResultGroup.h +++ b/src/Model/Model_ResultGroup.h @@ -34,20 +34,20 @@ class Model_ResultGroup : public ModelAPI_ResultGroup { std::shared_ptr myOwnerData; ///< data of owner of this result public: /// Retuns the parameters of color definition in the resources config manager - MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection, - std::string &theName, - std::string &theDefault); + MODEL_EXPORT void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) override; /// Returns the compound of selected entities - MODEL_EXPORT virtual std::shared_ptr shape(); + MODEL_EXPORT std::shared_ptr shape() override; /// \brief Stores the result of operation made on groups. /// Cleans the storage if empty shape is given. /// param[in] theShape shape to store. - MODEL_EXPORT virtual void store(const GeomShapePtr &theShape); + MODEL_EXPORT void store(const GeomShapePtr &theShape) override; /// Removes the stored builders - MODEL_EXPORT virtual ~Model_ResultGroup() {} + MODEL_EXPORT ~Model_ResultGroup() override = default; protected: /// Makes a body on the given feature data diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index 84bcea884..988033553 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -84,7 +84,7 @@ std::shared_ptr Model_ResultPart::partDoc() { return aRes; } -Model_ResultPart::Model_ResultPart() {} +Model_ResultPart::Model_ResultPart() = default; void Model_ResultPart::activate() { if (myTrsf.get()) { @@ -163,7 +163,7 @@ bool Model_ResultPart::isActivated() { std::shared_ptr aDocRef = data()->document(DOC_REF()); - return aDocRef->value().get() != NULL; + return aDocRef->value().get() != nullptr; } bool Model_ResultPart::setDisabled(std::shared_ptr theThis, diff --git a/src/Model/Model_ResultPart.h b/src/Model/Model_ResultPart.h index 8158a0fdf..4a9c6c482 100644 --- a/src/Model/Model_ResultPart.h +++ b/src/Model/Model_ResultPart.h @@ -48,60 +48,61 @@ public: } /// Request for initialization of data model of the result: adding all /// attributes - virtual void initAttributes(); + void initAttributes() override; /// Returns the part-document of this result - MODEL_EXPORT virtual std::shared_ptr partDoc(); + MODEL_EXPORT std::shared_ptr partDoc() override; /// Returns the original part result: for transformation features results this /// is the original Part feature result - MODEL_EXPORT virtual std::shared_ptr original(); + MODEL_EXPORT std::shared_ptr original() override; /// Sets this document as current and if it is not loaded yet, loads it - MODEL_EXPORT virtual void activate(); + MODEL_EXPORT void activate() override; /// disable all feature of the part on disable of the part result - MODEL_EXPORT virtual bool - setDisabled(std::shared_ptr theThis, const bool theFlag); + MODEL_EXPORT bool setDisabled(std::shared_ptr theThis, + const bool theFlag) override; /// Result shape of part document is compound of bodies inside of this part - MODEL_EXPORT virtual std::shared_ptr shape(); + MODEL_EXPORT std::shared_ptr shape() override; /// Returns the name of the shape inside of the part /// \param theShape selected shape in this document /// \param theIndex is returned as one-based index if selection was required, /// "0" otherwise \returns empty name is selection is not correct - MODEL_EXPORT virtual std::wstring - nameInPart(const std::shared_ptr &theShape, int &theIndex); + MODEL_EXPORT std::wstring + nameInPart(const std::shared_ptr &theShape, + int &theIndex) override; /// Updates the selection inside of the part by the selection index - MODEL_EXPORT virtual bool updateInPart(const int theIndex); + MODEL_EXPORT bool updateInPart(const int theIndex) override; /// Returns the shape by the name in the part - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT std::shared_ptr shapeInPart(const std::wstring &theName, const std::string &theType, - int &theIndex); + int &theIndex) override; /// Updates the selection inside of the part as a geometrical selection - MODEL_EXPORT virtual bool combineGeometrical(const int theIndex, - std::wstring &theNewName); + MODEL_EXPORT bool combineGeometrical(const int theIndex, + std::wstring &theNewName) override; /// Updates the shape-result of the part (called on Part feature execution) - MODEL_EXPORT virtual void updateShape(); + MODEL_EXPORT void updateShape() override; /// Applies the additional transformation of the part - MODEL_EXPORT virtual void + MODEL_EXPORT void setTrsf(std::shared_ptr theThis, - const std::shared_ptr &theTransformation); + const std::shared_ptr &theTransformation) override; /// Returns the summary transformations of all references to the origin - MODEL_EXPORT virtual std::shared_ptr summaryTrsf(); + MODEL_EXPORT std::shared_ptr summaryTrsf() override; /// Returns the parameters of color definition in the resources config manager - MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection, - std::string &theName, - std::string &theDefault); + MODEL_EXPORT void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) override; /// Returns the shape selected in the selection index - MODEL_EXPORT virtual std::shared_ptr - selectionValue(const int theIndex); + MODEL_EXPORT std::shared_ptr + selectionValue(const int theIndex) override; /// Loading the part from file - MODEL_EXPORT virtual void loadPart(); + MODEL_EXPORT void loadPart() override; protected: /// makes a result on a temporary feature (an action) @@ -112,7 +113,7 @@ protected: gp_Trsf sumTrsf(); /// Returns true if document is activated (loaded into the memory) - virtual bool isActivated(); + bool isActivated() override; friend class Model_Objects; }; diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index f03ea6c3e..7a5f69e33 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -74,7 +74,7 @@ void Model_Session::closeAll() { Model_Application::getApplication()->deleteAllDocuments(); static const Events_ID aDocsCloseEvent = Events_Loop::eventByName(EVENT_DOCUMENTS_CLOSED); - myCurrentDoc = NULL; + myCurrentDoc = nullptr; static std::shared_ptr aMsg( new Events_Message(aDocsCloseEvent)); Events_Loop::loop()->send(aMsg); @@ -190,7 +190,7 @@ ModelAPI_Plugin *Model_Session::getPlugin(const std::string &thePluginName) { Events_InfoMessage("Model_Session", "Can not load plugin '%1'") .arg(thePluginName) .send(); - return NULL; + return nullptr; } return myPluginObjs[thePluginName]; } @@ -368,15 +368,14 @@ Model_Session::allOpenedDocuments() { std::list> aResult; aResult.push_back(moduleDocument()); // add subs recursively - std::list>::iterator aDocIt = - aResult.begin(); + auto aDocIt = aResult.begin(); for (; aDocIt != aResult.end(); aDocIt++) { DocumentPtr anAPIDoc = *aDocIt; std::shared_ptr aDoc = std::dynamic_pointer_cast(anAPIDoc); if (aDoc) { const std::set aSubs = aDoc->subDocuments(); - std::set::const_iterator aSubIter = aSubs.cbegin(); + auto aSubIter = aSubs.cbegin(); for (; aSubIter != aSubs.cend(); aSubIter++) { aResult.push_back( Model_Application::getApplication()->document(*aSubIter)); @@ -438,19 +437,17 @@ Model_Session::copy(std::shared_ptr theSource, // Add in reverse order. TDF_Label aLabel = aNamedShape->Label(); TNaming_Builder aBuilder(aLabel); - for (std::list>::iterator aPairsIter = - aShapePairs.begin(); - aPairsIter != aShapePairs.end(); aPairsIter++) { + for (auto &aShapePair : aShapePairs) { if (anEvol == TNaming_GENERATED) { - aBuilder.Generated(aPairsIter->first, aPairsIter->second); + aBuilder.Generated(aShapePair.first, aShapePair.second); } else if (anEvol == TNaming_MODIFY) { - aBuilder.Modify(aPairsIter->first, aPairsIter->second); + aBuilder.Modify(aShapePair.first, aShapePair.second); } else if (anEvol == TNaming_DELETE) { - aBuilder.Delete(aPairsIter->first); + aBuilder.Delete(aShapePair.first); } else if (anEvol == TNaming_PRIMITIVE) { - aBuilder.Generated(aPairsIter->second); + aBuilder.Generated(aShapePair.second); } else if (anEvol == TNaming_SELECTED) { - aBuilder.Select(aPairsIter->second, aPairsIter->first); + aBuilder.Select(aShapePair.second, aShapePair.first); } } } @@ -471,11 +468,11 @@ Model_Session::Model_Session() { Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT()); aLoop->registerListener(this, kFeatureEvent); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED), - 0, true); + nullptr, true); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED), - 0, true); + nullptr, true); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED), - 0, true); + nullptr, true); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_VALIDATOR_LOADED)); aLoop->registerListener( @@ -566,11 +563,9 @@ void Model_Session::processEvent( theMessage); std::list> allOpened = Model_Session::allOpenedDocuments(); - std::list, std::string>>:: - const_iterator aGIter = aDeleted->groups().cbegin(); + auto aGIter = aDeleted->groups().cbegin(); for (; !aIsActual && aGIter != aDeleted->groups().cend(); aGIter++) { - std::list>::iterator anOpened = - allOpened.begin(); + auto anOpened = allOpened.begin(); for (; anOpened != allOpened.end(); anOpened++) { if (aGIter->first == *anOpened) { aIsActual = true; @@ -594,8 +589,7 @@ void Model_Session::processEvent( std::shared_ptr aDeleted = std::dynamic_pointer_cast(theMessage); - std::list, std::string>>:: - const_iterator aGIter = aDeleted->groups().cbegin(); + auto aGIter = aDeleted->groups().cbegin(); for (; aGIter != aDeleted->groups().cend(); aGIter++) { if (aGIter->second == ModelAPI_ResultPart::group()) break; @@ -608,8 +602,7 @@ void Model_Session::processEvent( if (aCurrentPart.get()) { const std::list> &aResList = aCurrentPart->results(); - std::list>::const_iterator aRes = - aResList.begin(); + auto aRes = aResList.begin(); for (; !aFound && aRes != aResList.end(); aRes++) { ResultPartPtr aPRes = std::dynamic_pointer_cast(*aRes); @@ -636,7 +629,7 @@ void Model_Session::LoadPluginsInfo() { Config_ModuleReader aModuleReader(Config_FeatureMessage::MODEL_EVENT()); aModuleReader.readAll(); std::set aFiles = aModuleReader.modulePluginFiles(); - std::set::iterator it = aFiles.begin(); + auto it = aFiles.begin(); for (; it != aFiles.end(); it++) { Config_ValidatorReader aValidatorReader(*it); aValidatorReader.readAll(); @@ -649,7 +642,7 @@ void Model_Session::registerPlugin(ModelAPI_Plugin *thePlugin) { Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED); ModelAPI_EventCreator::get()->sendUpdated(ObjectPtr(), EVENT_LOAD, false); // If the plugin has an ability to process GUI events, register it - Events_Listener *aListener = dynamic_cast(thePlugin); + auto *aListener = dynamic_cast(thePlugin); if (aListener) { Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aStateRequestEventId = @@ -659,12 +652,12 @@ void Model_Session::registerPlugin(ModelAPI_Plugin *thePlugin) { } ModelAPI_ValidatorsFactory *Model_Session::validators() { - static Model_ValidatorsFactory *aFactory = new Model_ValidatorsFactory; + static auto *aFactory = new Model_ValidatorsFactory; return aFactory; } ModelAPI_FiltersFactory *Model_Session::filters() { - static Model_FiltersFactory *aFactory = new Model_FiltersFactory; + static auto *aFactory = new Model_FiltersFactory; return aFactory; } diff --git a/src/Model/Model_Session.h b/src/Model/Model_Session.h index 91b78956b..0c9422c4a 100644 --- a/src/Model/Model_Session.h +++ b/src/Model/Model_Session.h @@ -64,17 +64,17 @@ public: //! Loads the OCAF document from the file. //! \param theFileName full name of the file to load //! \returns true if file was loaded successfully - MODEL_EXPORT virtual bool load(const char *theFileName); + MODEL_EXPORT bool load(const char *theFileName) override; //! Saves the OCAF document to the file. //! \param theFileName full name of the file to store //! \param theResults the result full file names that were stored by "save" //! \returns true if file was stored successfully - MODEL_EXPORT virtual bool save(const char *theFileName, - std::list &theResults); + MODEL_EXPORT bool save(const char *theFileName, + std::list &theResults) override; //! Closes all documents - MODEL_EXPORT virtual void closeAll(); + MODEL_EXPORT void closeAll() override; //! Starts a new operation (opens a transaction) //! \param theId string-identifier of the started transaction @@ -83,83 +83,83 @@ public: //! the nested //! where it is located and will be committed on the next commit with //! the nested - MODEL_EXPORT virtual void + MODEL_EXPORT void startOperation(const std::string &theId = "", - const bool theAttachedToNested = false); + const bool theAttachedToNested = false) override; //! Finishes the previously started operation (closes the transaction) - MODEL_EXPORT virtual void finishOperation(); + MODEL_EXPORT void finishOperation() override; //! Aborts the operation - MODEL_EXPORT virtual void abortOperation(); + MODEL_EXPORT void abortOperation() override; //! Returns true if operation has been started, but not yet finished or //! aborted - MODEL_EXPORT virtual bool isOperation(); + MODEL_EXPORT bool isOperation() override; //! Returns true if document was modified (since creation/opening) - MODEL_EXPORT virtual bool isModified(); + MODEL_EXPORT bool isModified() override; //! Returns True if there are available Undos - MODEL_EXPORT virtual bool canUndo(); + MODEL_EXPORT bool canUndo() override; //! Undoes last operation - MODEL_EXPORT virtual void undo(); + MODEL_EXPORT void undo() override; //! Returns True if there are available Redos - MODEL_EXPORT virtual bool canRedo(); + MODEL_EXPORT bool canRedo() override; //! Redoes last operation - MODEL_EXPORT virtual void redo(); + MODEL_EXPORT void redo() override; //! Returns stack of performed operations - MODEL_EXPORT virtual std::list undoList(); + MODEL_EXPORT std::list undoList() override; //! Returns stack of rolled back operations - MODEL_EXPORT virtual std::list redoList(); + MODEL_EXPORT std::list redoList() override; //! Clears undo and redo lists of all documents in the session - MODEL_EXPORT virtual void clearUndoRedo(); + MODEL_EXPORT void clearUndoRedo() override; /// Returns the root document of the application (that may contains /// sub-documents) - MODEL_EXPORT virtual std::shared_ptr moduleDocument(); + MODEL_EXPORT std::shared_ptr moduleDocument() override; /// Returns the document by ID, loads if not loaded yet. Returns null if no /// such document. - MODEL_EXPORT virtual std::shared_ptr - document(int theDocID); + MODEL_EXPORT std::shared_ptr + document(int theDocID) override; /// Return true if root document has been already created - MODEL_EXPORT virtual bool hasModuleDocument(); + MODEL_EXPORT bool hasModuleDocument() override; /// Returns the current document that used for current work in the application - MODEL_EXPORT virtual std::shared_ptr activeDocument(); + MODEL_EXPORT std::shared_ptr activeDocument() override; /// Defines the current document that used for current work in the application - MODEL_EXPORT virtual void - setActiveDocument(std::shared_ptr theDoc, - bool theSendSignal = true); + MODEL_EXPORT void setActiveDocument(std::shared_ptr theDoc, + bool theSendSignal = true) override; /// Returns all the opened documents of the session (without postponed) - MODEL_EXPORT virtual std::list> - allOpenedDocuments(); + MODEL_EXPORT std::list> + allOpenedDocuments() override; /// Returns true if document is not loaded yet - MODEL_EXPORT virtual bool isLoadByDemand(const std::wstring theDocID, - const int theDocIndex); + MODEL_EXPORT bool isLoadByDemand(const std::wstring theDocID, + const int theDocIndex) override; /// Registers the plugin that creates features. /// It is obligatory for each plugin to call this function on loading to be /// found by the plugin manager on call of the feature) - MODEL_EXPORT virtual void registerPlugin(ModelAPI_Plugin *thePlugin); + MODEL_EXPORT void registerPlugin(ModelAPI_Plugin *thePlugin) override; /// Verifies the license for the plugin is valid - MODEL_EXPORT virtual bool checkLicense(const std::string &thePluginName); + MODEL_EXPORT bool checkLicense(const std::string &thePluginName) override; /// Processes the configuration file reading - MODEL_EXPORT virtual void - processEvent(const std::shared_ptr &theMessage); + MODEL_EXPORT void + processEvent(const std::shared_ptr &theMessage) override; /// Copies the document to the new one - MODEL_EXPORT virtual std::shared_ptr - copy(std::shared_ptr theSource, const int theDestID); + MODEL_EXPORT std::shared_ptr + copy(std::shared_ptr theSource, + const int theDestID) override; /// Returns the validators factory: the only one instance per application - MODEL_EXPORT virtual ModelAPI_ValidatorsFactory *validators(); + MODEL_EXPORT ModelAPI_ValidatorsFactory *validators() override; /// Returns the filters factory: the only one instance per application - MODEL_EXPORT virtual ModelAPI_FiltersFactory *filters(); + MODEL_EXPORT ModelAPI_FiltersFactory *filters() override; /// Sets the flag to check modifications outside the transaction or not void setCheckTransactions(const bool theCheck) { @@ -171,13 +171,13 @@ public: /// Returns the global identifier of the current transaction (needed for the /// update algo) - MODEL_EXPORT virtual int transactionID(); + MODEL_EXPORT int transactionID() override; /// Returns true if auto-update in the application is blocked - MODEL_EXPORT virtual bool isAutoUpdateBlocked(); + MODEL_EXPORT bool isAutoUpdateBlocked() override; /// Set state of the auto-update of features result in the application - MODEL_EXPORT virtual void blockAutoUpdate(const bool theBlock); + MODEL_EXPORT void blockAutoUpdate(const bool theBlock) override; #ifdef TINSPECTOR MODEL_EXPORT virtual Handle(TDocStd_Application) application(); diff --git a/src/Model/Model_Tools.cpp b/src/Model/Model_Tools.cpp index cd8415328..4267dd6d7 100644 --- a/src/Model/Model_Tools.cpp +++ b/src/Model/Model_Tools.cpp @@ -143,7 +143,7 @@ void Model_Tools::copyAttrsAndKeepRefsToCoordinates( Handle(TDF_Reference) aSourceRef = Handle(TDF_Reference)::DownCast(anAttrIter.Value()); if (!aSourceRef.IsNull() && !aSourceRef->Get().IsNull()) { - std::set::const_iterator aFound = + auto aFound = theCoordinateLabels.find(labelToString(aSourceRef->Get())); if (aFound != theCoordinateLabels.end()) makeExternalReference(theDestination, aSourceRef->Get()); @@ -169,9 +169,7 @@ void Model_Tools::labelsOfCoordinates( Handle(TDF_RelocationTable) theRelocTable) { DocumentPtr aPartSet = ModelAPI_Session::get()->moduleDocument(); std::list aFeatures = aPartSet->allFeatures(); - for (std::list::iterator aFIt = aFeatures.begin(); - aFIt != aFeatures.end(); ++aFIt) { - FeaturePtr aCurFeat = *aFIt; + for (auto aCurFeat : aFeatures) { if (!aCurFeat->isInHistory() && (aCurFeat->getKind() == ConstructionPlugin_Point::ID() || aCurFeat->getKind() == ConstructionPlugin_Axis::ID() || diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index 8d18adb0d..6b9c680e9 100644 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -215,8 +215,7 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { std::set aRefSet; const std::set> &aRefs = theFeature->data()->refsToMe(); - std::set>::const_iterator aRefIter = - aRefs.cbegin(); + auto aRefIter = aRefs.cbegin(); for (; aRefIter != aRefs.cend(); aRefIter++) { if ((*aRefIter)->isArgument()) { FeaturePtr aReferenced = @@ -229,12 +228,11 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { // process also results std::list allResults; // list of this feature and results ModelAPI_Tools::allResults(theFeature, allResults); - std::list::iterator aRes = allResults.begin(); + auto aRes = allResults.begin(); for (; aRes != allResults.end(); aRes++) { const std::set> &aResRefs = (*aRes)->data()->refsToMe(); - std::set>::const_iterator aRIter = - aResRefs.cbegin(); + auto aRIter = aResRefs.cbegin(); for (; aRIter != aResRefs.cend(); aRIter++) { if ((*aRIter)->isArgument()) { FeaturePtr aReferenced = @@ -252,9 +250,8 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { if (aPart.get()) aRefSet.insert(aPart); } - for (std::set::iterator aRef = aRefSet.begin(); - aRef != aRefSet.end(); aRef++) - addModified(*aRef, theFeature); + for (const auto &aRef : aRefSet) + addModified(aRef, theFeature); return true; } @@ -301,13 +298,11 @@ void Model_Update::processEvent( // modified std::list> allDocs = ModelAPI_Session::get()->allOpenedDocuments(); - std::list>::iterator aDoc = - allDocs.begin(); + auto aDoc = allDocs.begin(); for (; aDoc != allDocs.end(); aDoc++) { std::list> allFeats = (*aDoc)->allFeatures(); - std::list>::iterator aFeat = - allFeats.begin(); + auto aFeat = allFeats.begin(); for (; aFeat != allFeats.end(); aFeat++) { if ((*aFeat)->data()->isValid() && (*aFeat)->data()->execState() == ModelAPI_StateMustBeUpdated) { @@ -350,7 +345,7 @@ void Model_Update::processEvent( std::shared_ptr aMsg = std::dynamic_pointer_cast(theMessage); const std::set &anObjs = aMsg->objects(); - std::set::const_iterator anObjIter = anObjs.cbegin(); + auto anObjIter = anObjs.cbegin(); std::list aFeatures, aResults; for (; anObjIter != anObjs.cend(); anObjIter++) { if (std::dynamic_pointer_cast((*anObjIter)->document()) @@ -376,7 +371,7 @@ void Model_Update::processEvent( std::shared_ptr aMsg = std::dynamic_pointer_cast(theMessage); const std::set &anObjs = aMsg->objects(); - std::set::const_iterator anObjIter = anObjs.cbegin(); + auto anObjIter = anObjs.cbegin(); bool aSomeModified = false; // check that features not changed: only redisplay is needed for (; anObjIter != anObjs.cend(); anObjIter++) { @@ -401,8 +396,7 @@ void Model_Update::processEvent( // result const std::set> &aRefs = (*anObjIter)->data()->refsToMe(); - std::set>::const_iterator aRefIter = - aRefs.cbegin(); + auto aRefIter = aRefs.cbegin(); FeaturePtr aReason; ResultPtr aReasonResult = std::dynamic_pointer_cast(*anObjIter); @@ -432,9 +426,7 @@ void Model_Update::processEvent( if (theMessage->eventID() == kOpFinishEvent) { // if update is blocked, skip myIsFinish = true; // add features that wait for finish as modified - std::map, - std::set>>::iterator aFeature = - myProcessOnFinish.begin(); + auto aFeature = myProcessOnFinish.begin(); for (; aFeature != myProcessOnFinish.end(); aFeature++) { if (aFeature->first->data() ->isValid()) { // there may be already removed while wait @@ -474,7 +466,7 @@ void Model_Update::processEvent( } // remove all macros before clearing all created - std::set::iterator anUpdatedIter = myWaitForFinish.begin(); + auto anUpdatedIter = myWaitForFinish.begin(); while (anUpdatedIter != myWaitForFinish.end()) { FeaturePtr aFeature = std::dynamic_pointer_cast(*anUpdatedIter); @@ -556,13 +548,10 @@ static void allReasons(FeaturePtr theFeature, std::list>>> aDeps; theFeature->data()->referencesToObjects(aDeps); - std::list>>>::iterator - anAttrsIter = aDeps.begin(); + auto anAttrsIter = aDeps.begin(); for (; anAttrsIter != aDeps.end(); anAttrsIter++) { if (theFeature->attribute(anAttrsIter->first)->isArgument()) { - std::list>::iterator aDepIter = - anAttrsIter->second.begin(); + auto aDepIter = anAttrsIter->second.begin(); for (; aDepIter != anAttrsIter->second.end(); aDepIter++) { FeaturePtr aDepFeat = std::dynamic_pointer_cast(*aDepIter); @@ -687,7 +676,7 @@ bool Model_Update::processFeature(FeaturePtr theFeature) { aNorm->z() != aNZ) { std::set aWholeR; allReasons(theFeature, aWholeR); - std::set::iterator aRIter = aWholeR.begin(); + auto aRIter = aWholeR.begin(); for (; aRIter != aWholeR.end(); aRIter++) { if ((*aRIter)->data()->selection("External").get()) (*aRIter)->attributeChanged("External"); @@ -772,7 +761,7 @@ bool Model_Update::processFeature(FeaturePtr theFeature) { // re-processed std::set aWholeR; allReasons(theFeature, aWholeR); - std::set::iterator aRIter = aWholeR.begin(); + auto aRIter = aWholeR.begin(); for (; aRIter != aWholeR.end(); aRIter++) { if (myModified.find(*aRIter) != myModified.end()) { processFeature(theFeature); @@ -864,7 +853,7 @@ void Model_Update::redisplayWithResults(FeaturePtr theFeature, std::list allResults; ModelAPI_Tools::allResults(theFeature, allResults); - std::list::iterator aRIter = allResults.begin(); + auto aRIter = allResults.begin(); for (; aRIter != allResults.cend(); aRIter++) { std::shared_ptr aRes = *aRIter; if (!aRes->isDisabled()) { @@ -918,7 +907,7 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { { std::list anAttrinbutes = theFeature->data()->attributes(ModelAPI_AttributeInteger::typeId()); - std::list::iterator anIter = anAttrinbutes.begin(); + auto anIter = anAttrinbutes.begin(); for (; anIter != anAttrinbutes.end(); anIter++) { AttributeIntegerPtr anAttribute = std::dynamic_pointer_cast(*anIter); @@ -936,7 +925,7 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { { std::list aDoubles = theFeature->data()->attributes(ModelAPI_AttributeDouble::typeId()); - std::list::iterator aDoubleIter = aDoubles.begin(); + auto aDoubleIter = aDoubles.begin(); for (; aDoubleIter != aDoubles.end(); aDoubleIter++) { AttributeDoublePtr aDouble = std::dynamic_pointer_cast(*aDoubleIter); @@ -954,7 +943,7 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { { std::list anAttributes = theFeature->data()->attributes(GeomDataAPI_Point::typeId()); - std::list::iterator anIter = anAttributes.begin(); + auto anIter = anAttributes.begin(); for (; anIter != anAttributes.end(); anIter++) { AttributePointPtr aPointAttribute = std::dynamic_pointer_cast(*anIter); @@ -978,7 +967,7 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { { std::list anAttributes = theFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); - std::list::iterator anIter = anAttributes.begin(); + auto anIter = anAttributes.begin(); for (; anIter != anAttributes.end(); anIter++) { AttributePoint2DPtr aPoint2DAttribute = std::dynamic_pointer_cast(*anIter); @@ -998,7 +987,7 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { // update the selection attributes if any std::list aRefs = theFeature->data()->attributes(ModelAPI_AttributeSelection::typeId()); - std::list::iterator aRefsIter = aRefs.begin(); + auto aRefsIter = aRefs.begin(); for (; aRefsIter != aRefs.end(); aRefsIter++) { std::shared_ptr aSel = std::dynamic_pointer_cast(*aRefsIter); @@ -1085,9 +1074,7 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { bool Model_Update::isReason(std::shared_ptr &theFeature, std::shared_ptr theReason) { - std::map, - std::set>>::iterator aReasonsIt = - myModified.find(theFeature); + auto aReasonsIt = myModified.find(theFeature); if (aReasonsIt != myModified.end()) { if (aReasonsIt->second.find(theFeature) != aReasonsIt->second.end()) return true; // any is reason if it contains itself @@ -1103,9 +1090,7 @@ bool Model_Update::isReason(std::shared_ptr &theFeature, return true; } // another try: postponed modification by not-persistences - std::map, - std::set>>::iterator aNotPersist = - myNotPersistentRefs.find(theFeature); + auto aNotPersist = myNotPersistentRefs.find(theFeature); if (aNotPersist != myNotPersistentRefs.end()) { FeaturePtr aReasFeat = std::dynamic_pointer_cast(theReason); @@ -1162,7 +1147,7 @@ void Model_Update::updateStability(void *theSender) { ModelAPI_Session::get()->validators(); if (theSender) { bool added = false; // object may be was crated - ModelAPI_Object *aSender = static_cast(theSender); + auto *aSender = static_cast(theSender); if (aSender && aSender->document()) { FeaturePtr aFeatureSender = std::dynamic_pointer_cast(aSender->data()->owner()); @@ -1175,8 +1160,7 @@ void Model_Update::updateStability(void *theSender) { // remove or add all concealment refs from this feature std::list>> aRefs; aSender->data()->referencesToObjects(aRefs); - std::list>>::iterator - aRefIt = aRefs.begin(); + auto aRefIt = aRefs.begin(); for (; aRefIt != aRefs.end(); aRefIt++) { if (!aFactory->isConcealed(aFeatureSender->getKind(), aRefIt->first)) @@ -1185,8 +1169,7 @@ void Model_Update::updateStability(void *theSender) { // edit) continue; std::list &aRefFeaturesList = aRefIt->second; - std::list::iterator aReferenced = - aRefFeaturesList.begin(); + auto aReferenced = aRefFeaturesList.begin(); for (; aReferenced != aRefFeaturesList.end(); aReferenced++) { // stability is only on results: feature to feature reference mean // nested @@ -1220,12 +1203,11 @@ void Model_Update::updateStability(void *theSender) { void Model_Update::updateSelection( const std::set> &theObjects) { - std::set>::iterator anObj = - theObjects.begin(); + auto anObj = theObjects.begin(); for (; anObj != theObjects.end(); anObj++) { std::list aRefs = (*anObj)->data()->attributes(ModelAPI_AttributeSelection::typeId()); - std::list::iterator aRefsIter = aRefs.begin(); + auto aRefsIter = aRefs.begin(); for (; aRefsIter != aRefs.end(); aRefsIter++) { AttributeSelectionPtr aSel = std::dynamic_pointer_cast(*aRefsIter); diff --git a/src/Model/Model_Update.h b/src/Model/Model_Update.h index 0944946fc..7edaa86b5 100644 --- a/src/Model/Model_Update.h +++ b/src/Model/Model_Update.h @@ -80,8 +80,8 @@ public: Model_Update(); /// Processes the feature argument update: executes the results - MODEL_EXPORT virtual void - processEvent(const std::shared_ptr &theMessage); + MODEL_EXPORT void + processEvent(const std::shared_ptr &theMessage) override; protected: /// Appends the new modified feature to the myModified, clears myProcessed if diff --git a/src/Model/Model_Validator.cpp b/src/Model/Model_Validator.cpp index 4936128c1..4795a71f6 100644 --- a/src/Model/Model_Validator.cpp +++ b/src/Model/Model_Validator.cpp @@ -77,15 +77,13 @@ void Model_ValidatorsFactory::assignValidator( const std::string &theID, const std::string &theFeatureID, const std::string &theAttrID, const std::list &theArguments) { // create feature-structures if not exist - std::map>::iterator - aFeature = myAttrs.find(theFeatureID); + auto aFeature = myAttrs.find(theFeatureID); if (aFeature == myAttrs.end()) { myAttrs[theFeatureID] = std::map(); aFeature = myAttrs.find(theFeatureID); } // add attr-structure if not exist, or generate error if already exist - std::map::iterator anAttr = - aFeature->second.find(theAttrID); + auto anAttr = aFeature->second.find(theAttrID); if (anAttr == aFeature->second.end()) { aFeature->second[theAttrID] = AttrValidators(); } @@ -94,10 +92,9 @@ void Model_ValidatorsFactory::assignValidator( void Model_ValidatorsFactory::validators(const std::string &theFeatureID, Validators &theValidators) const { - std::map::const_iterator aFeatureIt = - myFeatures.find(theFeatureID); + auto aFeatureIt = myFeatures.find(theFeatureID); if (aFeatureIt != myFeatures.cend()) { - AttrValidators::const_iterator aValidatorsIt = aFeatureIt->second.cbegin(); + auto aValidatorsIt = aFeatureIt->second.cbegin(); for (; aValidatorsIt != aFeatureIt->second.cend(); aValidatorsIt++) { if (!validator(aValidatorsIt->first)) { Events_InfoMessage("Model_Validator", "Validator %1 was not registered") @@ -115,13 +112,11 @@ void Model_ValidatorsFactory::validators(const std::string &theFeatureID, void Model_ValidatorsFactory::validators(const std::string &theFeatureID, const std::string &theAttrID, Validators &theValidators) const { - std::map>::const_iterator - aFeatureIt = myAttrs.find(theFeatureID); + auto aFeatureIt = myAttrs.find(theFeatureID); if (aFeatureIt != myAttrs.cend()) { - std::map::const_iterator anAttrIt = - aFeatureIt->second.find(theAttrID); + auto anAttrIt = aFeatureIt->second.find(theAttrID); if (anAttrIt != aFeatureIt->second.end()) { - AttrValidators::const_iterator aValidatorsIt = anAttrIt->second.cbegin(); + auto aValidatorsIt = anAttrIt->second.cbegin(); for (; aValidatorsIt != anAttrIt->second.cend(); aValidatorsIt++) { if (!validator(aValidatorsIt->first)) { Events_InfoMessage("Model_Validator", @@ -146,12 +141,11 @@ Model_ValidatorsFactory::Model_ValidatorsFactory() const ModelAPI_Validator * Model_ValidatorsFactory::validator(const std::string &theID) const { - std::map::const_iterator aIt = - myIDs.find(theID); + auto aIt = myIDs.find(theID); if (aIt != myIDs.end()) { return aIt->second; } - return NULL; + return nullptr; } void Model_ValidatorsFactory::addDefaultValidators( @@ -187,13 +181,12 @@ bool Model_ValidatorsFactory::validate( validators(theFeature->getKind(), aValidators); if (!aValidators.empty()) { - Validators::const_iterator aValidatorIt = aValidators.cbegin(); + auto aValidatorIt = aValidators.cbegin(); for (; aValidatorIt != aValidators.cend(); aValidatorIt++) { const std::string &aValidatorID = aValidatorIt->first; const std::list &anArguments = aValidatorIt->second; - const ModelAPI_FeatureValidator *aFValidator = - dynamic_cast( - validator(aValidatorID)); + const auto *aFValidator = dynamic_cast( + validator(aValidatorID)); if (aFValidator) { Events_InfoMessage anError; if (!aFValidator->isValid(theFeature, anArguments, anError)) { @@ -214,7 +207,7 @@ bool Model_ValidatorsFactory::validate( // check all attributes for validity static const std::string kAllTypes = ""; std::list aLtAttributes = aData->attributesIDs(kAllTypes); - std::list::const_iterator anAttrIt = aLtAttributes.cbegin(); + auto anAttrIt = aLtAttributes.cbegin(); for (; anAttrIt != aLtAttributes.cend(); anAttrIt++) { const std::string &anAttributeID = *anAttrIt; AttributePtr anAttribute = theFeature->data()->attribute(anAttributeID); @@ -255,11 +248,11 @@ bool Model_ValidatorsFactory::validate( Validators aValidators; validators(aFeature->getKind(), theAttribute->id(), aValidators); - Validators::iterator aValidatorIt = aValidators.begin(); + auto aValidatorIt = aValidators.begin(); for (; aValidatorIt != aValidators.end(); ++aValidatorIt) { const std::string &aValidatorID = aValidatorIt->first; const std::list &anArguments = aValidatorIt->second; - const ModelAPI_AttributeValidator *anAttrValidator = + const auto *anAttrValidator = dynamic_cast( validator(aValidatorID)); if (!anAttrValidator) @@ -279,8 +272,7 @@ void Model_ValidatorsFactory::registerNotObligatory(std::string theFeature, std::map::const_iterator it = myIDs.find(kDefaultId); if (it != myIDs.end()) { - Model_FeatureValidator *aValidator = - dynamic_cast(it->second); + auto *aValidator = dynamic_cast(it->second); if (aValidator) { aValidator->registerNotObligatory(theFeature, theAttribute); } @@ -293,8 +285,7 @@ bool Model_ValidatorsFactory::isNotObligatory(std::string theFeature, std::map::const_iterator it = myIDs.find(kDefaultId); if (it != myIDs.end()) { - Model_FeatureValidator *aValidator = - dynamic_cast(it->second); + auto *aValidator = dynamic_cast(it->second); if (aValidator) { return aValidator->isNotObligatory(theFeature, theAttribute); } @@ -304,8 +295,7 @@ bool Model_ValidatorsFactory::isNotObligatory(std::string theFeature, void Model_ValidatorsFactory::registerConcealment(std::string theFeature, std::string theAttribute) { - std::map>::iterator aFind = - myConcealed.find(theFeature); + auto aFind = myConcealed.find(theFeature); if (aFind == myConcealed.end()) { std::set aNewSet; aNewSet.insert(theAttribute); @@ -317,8 +307,7 @@ void Model_ValidatorsFactory::registerConcealment(std::string theFeature, bool Model_ValidatorsFactory::isConcealed(std::string theFeature, std::string theAttribute) { - std::map>::iterator aFind = - myConcealed.find(theFeature); + auto aFind = myConcealed.find(theFeature); return aFind != myConcealed.end() && aFind->second.find(theAttribute) != aFind->second.end(); } @@ -326,26 +315,20 @@ bool Model_ValidatorsFactory::isConcealed(std::string theFeature, void Model_ValidatorsFactory::registerCase( std::string theFeature, std::string theAttribute, const std::list> &theCases) { - std::map>>>::iterator - aFindFeature = myCases.find(theFeature); + auto aFindFeature = myCases.find(theFeature); if (aFindFeature == myCases.end()) { myCases[theFeature] = std::map>>(); aFindFeature = myCases.find(theFeature); } - std::map>>::iterator - aFindAttrID = aFindFeature->second.find(theAttribute); + auto aFindAttrID = aFindFeature->second.find(theAttribute); if (aFindAttrID == aFindFeature->second.end()) { aFindFeature->second[theAttribute] = std::map>(); aFindAttrID = aFindFeature->second.find(theAttribute); } - std::list>::const_iterator - aCasesIt = theCases.begin(), - aCasesLast = theCases.end(); + auto aCasesIt = theCases.begin(), aCasesLast = theCases.end(); std::map> aFindCases = aFindAttrID->second; for (; aCasesIt != aCasesLast; aCasesIt++) { std::pair aCasePair = *aCasesIt; @@ -360,18 +343,12 @@ void Model_ValidatorsFactory::registerCase( bool Model_ValidatorsFactory::isCase(FeaturePtr theFeature, std::string theAttribute) { bool anInCase = true; - std::map>>>::iterator - aFindFeature = myCases.find(theFeature->getKind()); + auto aFindFeature = myCases.find(theFeature->getKind()); if (aFindFeature != myCases.end()) { - std::map>>::iterator - aFindAttrID = aFindFeature->second.find(theAttribute); + auto aFindAttrID = aFindFeature->second.find(theAttribute); if (aFindAttrID != aFindFeature->second.end()) { - std::map>::iterator - aCasesIt = aFindAttrID->second.begin(), - aCasesLast = aFindAttrID->second.end(); + auto aCasesIt = aFindAttrID->second.begin(), + aCasesLast = aFindAttrID->second.end(); for (; aCasesIt != aCasesLast && anInCase; aCasesIt++) { // the the switch-attribute that contains the case value AttributeStringPtr aSwitch = theFeature->string(aCasesIt->first); @@ -389,23 +366,20 @@ bool Model_ValidatorsFactory::isCase(FeaturePtr theFeature, void Model_ValidatorsFactory::registerMainArgument(std::string theFeature, std::string theAttribute) { - std::map::iterator aFound = - myMainArgument.find(theFeature); + auto aFound = myMainArgument.find(theFeature); if (aFound == myMainArgument.end()) myMainArgument[theFeature] = theAttribute; } bool Model_ValidatorsFactory::isMainArgument(std::string theFeature, std::string theAttribute) { - std::map::iterator aFound = - myMainArgument.find(theFeature); + auto aFound = myMainArgument.find(theFeature); return aFound != myMainArgument.end() && aFound->second == theAttribute; } void Model_ValidatorsFactory::registerGeometricalSelection( std::string theFeature, std::string theAttribute) { - std::map>::iterator aFind = - myGeometricalSelection.find(theFeature); + auto aFind = myGeometricalSelection.find(theFeature); if (aFind == myGeometricalSelection.end()) { std::set aNewSet; aNewSet.insert(theAttribute); @@ -417,8 +391,7 @@ void Model_ValidatorsFactory::registerGeometricalSelection( bool Model_ValidatorsFactory::isGeometricalSelection(std::string theFeature, std::string theAttribute) { - std::map>::iterator aFind = - myGeometricalSelection.find(theFeature); + auto aFind = myGeometricalSelection.find(theFeature); return aFind != myGeometricalSelection.end() && aFind->second.find(theAttribute) != aFind->second.end(); } diff --git a/src/Model/Model_Validator.h b/src/Model/Model_Validator.h index a9d1978fc..f318d5c37 100644 --- a/src/Model/Model_Validator.h +++ b/src/Model/Model_Validator.h @@ -43,7 +43,7 @@ private: std::map myIDs; ///< map from ID to registered validator /// validators IDs to list of arguments - typedef std::map> AttrValidators; + using AttrValidators = std::map>; /// validators IDs by feature ID std::map myFeatures; /// validators IDs and arguments by feature and attribute IDs @@ -65,86 +65,89 @@ private: public: /// Registers the instance of the validator by the ID - MODEL_EXPORT virtual void registerValidator(const std::string &theID, - ModelAPI_Validator *theValidator); + MODEL_EXPORT void + registerValidator(const std::string &theID, + ModelAPI_Validator *theValidator) override; /// Assigns validator to the feature - MODEL_EXPORT virtual void assignValidator(const std::string &theID, - const std::string &theFeatureID); + MODEL_EXPORT void assignValidator(const std::string &theID, + const std::string &theFeatureID) override; /// Assigns validator to the feature with arguments of the validator - MODEL_EXPORT virtual void + MODEL_EXPORT void assignValidator(const std::string &theID, const std::string &theFeatureID, - const std::list &theArguments); + const std::list &theArguments) override; /// Assigns validator to the attribute of the feature - MODEL_EXPORT virtual void + MODEL_EXPORT void assignValidator(const std::string &theID, const std::string &theFeatureID, const std::string &theAttrID, - const std::list &theArguments); + const std::list &theArguments) override; /// Provides a validator for the feature, returns NULL if no validator - MODEL_EXPORT virtual void validators(const std::string &theFeatureID, - Validators &theResult) const; + MODEL_EXPORT void validators(const std::string &theFeatureID, + Validators &theResult) const override; /// Provides a validator for the attribute, returns NULL if no validator - MODEL_EXPORT virtual void validators(const std::string &theFeatureID, - const std::string &theAttrID, - Validators &theResult) const; + MODEL_EXPORT void validators(const std::string &theFeatureID, + const std::string &theAttrID, + Validators &theResult) const override; /// Returns registered validator by its Id - MODEL_EXPORT virtual const ModelAPI_Validator * - validator(const std::string &theID) const; + MODEL_EXPORT const ModelAPI_Validator * + validator(const std::string &theID) const override; /// Returns true if feature and all its attributes are valid. - MODEL_EXPORT virtual bool - validate(const std::shared_ptr &theFeature) const; + MODEL_EXPORT bool + validate(const std::shared_ptr &theFeature) const override; /// Returns true if the attribute is valid. - MODEL_EXPORT virtual bool + MODEL_EXPORT bool validate(const std::shared_ptr &theAttribute, - std::string &theValidator, Events_InfoMessage &theError) const; + std::string &theValidator, + Events_InfoMessage &theError) const override; /// register that this attribute in feature is not obligatory for the feature /// execution so, it is not needed for the standard validation mechanism - virtual void registerNotObligatory(std::string theFeature, - std::string theAttribute); + void registerNotObligatory(std::string theFeature, + std::string theAttribute) override; /// Returns true if the attribute in feature is not obligatory for the feature /// execution - virtual bool isNotObligatory(std::string theFeature, - std::string theAttribute); + bool isNotObligatory(std::string theFeature, + std::string theAttribute) override; /// register that this attribute conceals in the object browser /// all referenced features after execution - virtual void registerConcealment(std::string theFeature, - std::string theAttribute); + void registerConcealment(std::string theFeature, + std::string theAttribute) override; /// Returns true that it was registered that attribute conceals the referenced /// result - virtual bool isConcealed(std::string theFeature, std::string theAttribute); + bool isConcealed(std::string theFeature, std::string theAttribute) override; /// register the case-attribute (\a myCases set definition) - virtual void - registerCase(std::string theFeature, std::string theAttribute, - const std::list> &theCases); + void registerCase( + std::string theFeature, std::string theAttribute, + const std::list> &theCases) override; /// Returns true if the attribute must be checked (the case is selected) - virtual bool isCase(FeaturePtr theFeature, std::string theAttribute); + bool isCase(FeaturePtr theFeature, std::string theAttribute) override; /// Register the attribute as a main argument of the feature - virtual void registerMainArgument(std::string theFeature, - std::string theAttribute); + void registerMainArgument(std::string theFeature, + std::string theAttribute) override; /// Returns true is the attribute is a main argument of the feature - virtual bool isMainArgument(std::string theFeature, std::string theAttribute); + bool isMainArgument(std::string theFeature, + std::string theAttribute) override; /// Register the selection attribute as geometrical selection - virtual void registerGeometricalSelection(std::string theFeature, - std::string theAttribute); + void registerGeometricalSelection(std::string theFeature, + std::string theAttribute) override; /// Returns true if the attribute is a geometrical selection - virtual bool isGeometricalSelection(std::string theFeature, - std::string theAttribute); + bool isGeometricalSelection(std::string theFeature, + std::string theAttribute) override; protected: /// Adds the defualt validators that are usefull for all features. diff --git a/src/ModelAPI/ModelAPI_Attribute.cpp b/src/ModelAPI/ModelAPI_Attribute.cpp index 21c65674b..70e8fd962 100644 --- a/src/ModelAPI/ModelAPI_Attribute.cpp +++ b/src/ModelAPI/ModelAPI_Attribute.cpp @@ -20,7 +20,7 @@ #include -ModelAPI_Attribute::~ModelAPI_Attribute() {} +ModelAPI_Attribute::~ModelAPI_Attribute() = default; /// Sets the owner of this attribute void ModelAPI_Attribute::setObject( diff --git a/src/ModelAPI/ModelAPI_AttributeBoolean.cpp b/src/ModelAPI/ModelAPI_AttributeBoolean.cpp index 14bf5d7ff..ebfca45de 100644 --- a/src/ModelAPI/ModelAPI_AttributeBoolean.cpp +++ b/src/ModelAPI/ModelAPI_AttributeBoolean.cpp @@ -23,6 +23,6 @@ std::string ModelAPI_AttributeBoolean::attributeType() { return typeId(); } /// To virtually destroy the fields of successors -ModelAPI_AttributeBoolean::~ModelAPI_AttributeBoolean() {} +ModelAPI_AttributeBoolean::~ModelAPI_AttributeBoolean() = default; -ModelAPI_AttributeBoolean::ModelAPI_AttributeBoolean() {} +ModelAPI_AttributeBoolean::ModelAPI_AttributeBoolean() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeDocRef.cpp b/src/ModelAPI/ModelAPI_AttributeDocRef.cpp index fc5ada929..6ff206f9c 100644 --- a/src/ModelAPI/ModelAPI_AttributeDocRef.cpp +++ b/src/ModelAPI/ModelAPI_AttributeDocRef.cpp @@ -22,6 +22,6 @@ std::string ModelAPI_AttributeDocRef::attributeType() { return typeId(); } -ModelAPI_AttributeDocRef::~ModelAPI_AttributeDocRef() {} +ModelAPI_AttributeDocRef::~ModelAPI_AttributeDocRef() = default; -ModelAPI_AttributeDocRef::ModelAPI_AttributeDocRef() {} +ModelAPI_AttributeDocRef::ModelAPI_AttributeDocRef() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeDouble.cpp b/src/ModelAPI/ModelAPI_AttributeDouble.cpp index 424185b77..533437cb9 100644 --- a/src/ModelAPI/ModelAPI_AttributeDouble.cpp +++ b/src/ModelAPI/ModelAPI_AttributeDouble.cpp @@ -22,6 +22,6 @@ std::string ModelAPI_AttributeDouble::attributeType() { return typeId(); } -ModelAPI_AttributeDouble::~ModelAPI_AttributeDouble() {} +ModelAPI_AttributeDouble::~ModelAPI_AttributeDouble() = default; -ModelAPI_AttributeDouble::ModelAPI_AttributeDouble() {} +ModelAPI_AttributeDouble::ModelAPI_AttributeDouble() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeDoubleArray.cpp b/src/ModelAPI/ModelAPI_AttributeDoubleArray.cpp index 8759d75a7..cd3494bc9 100644 --- a/src/ModelAPI/ModelAPI_AttributeDoubleArray.cpp +++ b/src/ModelAPI/ModelAPI_AttributeDoubleArray.cpp @@ -24,7 +24,7 @@ std::string ModelAPI_AttributeDoubleArray::attributeType() { return typeId(); } //================================================================================================== -ModelAPI_AttributeDoubleArray::~ModelAPI_AttributeDoubleArray() {} +ModelAPI_AttributeDoubleArray::~ModelAPI_AttributeDoubleArray() = default; //================================================================================================== -ModelAPI_AttributeDoubleArray::ModelAPI_AttributeDoubleArray() {} +ModelAPI_AttributeDoubleArray::ModelAPI_AttributeDoubleArray() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeIntArray.cpp b/src/ModelAPI/ModelAPI_AttributeIntArray.cpp index d81e16f7a..bcd440829 100644 --- a/src/ModelAPI/ModelAPI_AttributeIntArray.cpp +++ b/src/ModelAPI/ModelAPI_AttributeIntArray.cpp @@ -23,6 +23,6 @@ std::string ModelAPI_AttributeIntArray::attributeType() { return typeId(); } /// To virtually destroy the fields of successors -ModelAPI_AttributeIntArray::~ModelAPI_AttributeIntArray() {} +ModelAPI_AttributeIntArray::~ModelAPI_AttributeIntArray() = default; -ModelAPI_AttributeIntArray::ModelAPI_AttributeIntArray() {} +ModelAPI_AttributeIntArray::ModelAPI_AttributeIntArray() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeInteger.cpp b/src/ModelAPI/ModelAPI_AttributeInteger.cpp index 2ca07542c..1cf1a6886 100644 --- a/src/ModelAPI/ModelAPI_AttributeInteger.cpp +++ b/src/ModelAPI/ModelAPI_AttributeInteger.cpp @@ -23,6 +23,6 @@ std::string ModelAPI_AttributeInteger::attributeType() { return typeId(); } /// To virtually destroy the fields of successors -ModelAPI_AttributeInteger::~ModelAPI_AttributeInteger() {} +ModelAPI_AttributeInteger::~ModelAPI_AttributeInteger() = default; -ModelAPI_AttributeInteger::ModelAPI_AttributeInteger() {} +ModelAPI_AttributeInteger::ModelAPI_AttributeInteger() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeRefAttr.cpp b/src/ModelAPI/ModelAPI_AttributeRefAttr.cpp index 471aa09cd..a84edc0ab 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefAttr.cpp +++ b/src/ModelAPI/ModelAPI_AttributeRefAttr.cpp @@ -22,6 +22,6 @@ std::string ModelAPI_AttributeRefAttr::attributeType() { return typeId(); } -ModelAPI_AttributeRefAttr::~ModelAPI_AttributeRefAttr() {} +ModelAPI_AttributeRefAttr::~ModelAPI_AttributeRefAttr() = default; -ModelAPI_AttributeRefAttr::ModelAPI_AttributeRefAttr() {} +ModelAPI_AttributeRefAttr::ModelAPI_AttributeRefAttr() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeRefList.cpp b/src/ModelAPI/ModelAPI_AttributeRefList.cpp index 1b68a29f8..d0754bc7c 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefList.cpp +++ b/src/ModelAPI/ModelAPI_AttributeRefList.cpp @@ -22,6 +22,6 @@ std::string ModelAPI_AttributeRefList::attributeType() { return typeId(); } -ModelAPI_AttributeRefList::~ModelAPI_AttributeRefList() {} +ModelAPI_AttributeRefList::~ModelAPI_AttributeRefList() = default; -ModelAPI_AttributeRefList::ModelAPI_AttributeRefList() {} +ModelAPI_AttributeRefList::ModelAPI_AttributeRefList() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeReference.cpp b/src/ModelAPI/ModelAPI_AttributeReference.cpp index 409b53347..41654a5be 100644 --- a/src/ModelAPI/ModelAPI_AttributeReference.cpp +++ b/src/ModelAPI/ModelAPI_AttributeReference.cpp @@ -22,6 +22,6 @@ std::string ModelAPI_AttributeReference::attributeType() { return typeId(); } -ModelAPI_AttributeReference::~ModelAPI_AttributeReference() {} +ModelAPI_AttributeReference::~ModelAPI_AttributeReference() = default; -ModelAPI_AttributeReference::ModelAPI_AttributeReference() {} +ModelAPI_AttributeReference::ModelAPI_AttributeReference() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeSelection.cpp b/src/ModelAPI/ModelAPI_AttributeSelection.cpp index a2ad8d951..72225416e 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelection.cpp +++ b/src/ModelAPI/ModelAPI_AttributeSelection.cpp @@ -22,6 +22,6 @@ std::string ModelAPI_AttributeSelection::attributeType() { return typeId(); } -ModelAPI_AttributeSelection::~ModelAPI_AttributeSelection() {} +ModelAPI_AttributeSelection::~ModelAPI_AttributeSelection() = default; -ModelAPI_AttributeSelection::ModelAPI_AttributeSelection() {} +ModelAPI_AttributeSelection::ModelAPI_AttributeSelection() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeSelectionList.cpp b/src/ModelAPI/ModelAPI_AttributeSelectionList.cpp index c52dfc3c4..376a0eeda 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelectionList.cpp +++ b/src/ModelAPI/ModelAPI_AttributeSelectionList.cpp @@ -24,4 +24,4 @@ std::string ModelAPI_AttributeSelectionList::attributeType() { return typeId(); } -ModelAPI_AttributeSelectionList::~ModelAPI_AttributeSelectionList() {} +ModelAPI_AttributeSelectionList::~ModelAPI_AttributeSelectionList() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeString.cpp b/src/ModelAPI/ModelAPI_AttributeString.cpp index 163c464c8..22d1eb896 100644 --- a/src/ModelAPI/ModelAPI_AttributeString.cpp +++ b/src/ModelAPI/ModelAPI_AttributeString.cpp @@ -22,6 +22,6 @@ std::string ModelAPI_AttributeString::attributeType() { return typeId(); } -ModelAPI_AttributeString::~ModelAPI_AttributeString() {} +ModelAPI_AttributeString::~ModelAPI_AttributeString() = default; -ModelAPI_AttributeString::ModelAPI_AttributeString() {} +ModelAPI_AttributeString::ModelAPI_AttributeString() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeStringArray.cpp b/src/ModelAPI/ModelAPI_AttributeStringArray.cpp index cb5bbb62d..3ff6b7868 100644 --- a/src/ModelAPI/ModelAPI_AttributeStringArray.cpp +++ b/src/ModelAPI/ModelAPI_AttributeStringArray.cpp @@ -24,7 +24,7 @@ std::string ModelAPI_AttributeStringArray::attributeType() { return typeId(); } //================================================================================================== -ModelAPI_AttributeStringArray::~ModelAPI_AttributeStringArray() {} +ModelAPI_AttributeStringArray::~ModelAPI_AttributeStringArray() = default; //================================================================================================== -ModelAPI_AttributeStringArray::ModelAPI_AttributeStringArray() {} +ModelAPI_AttributeStringArray::ModelAPI_AttributeStringArray() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeStringArray.h b/src/ModelAPI/ModelAPI_AttributeStringArray.h index 8e580c28a..8afb1e5b9 100644 --- a/src/ModelAPI/ModelAPI_AttributeStringArray.h +++ b/src/ModelAPI/ModelAPI_AttributeStringArray.h @@ -49,10 +49,10 @@ public: MODELAPI_EXPORT static std::string typeId() { return "StringArray"; } /// Returns the type of this class of attributes, not static method - MODELAPI_EXPORT virtual std::string attributeType(); + MODELAPI_EXPORT std::string attributeType() override; /// To virtually destroy the fields of successors - MODELAPI_EXPORT virtual ~ModelAPI_AttributeStringArray(); + MODELAPI_EXPORT ~ModelAPI_AttributeStringArray() override; protected: /// Objects are created for features automatically @@ -60,6 +60,6 @@ protected: }; /// Pointer on string attribute -typedef std::shared_ptr AttributeStringArrayPtr; +using AttributeStringArrayPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeTables.cpp b/src/ModelAPI/ModelAPI_AttributeTables.cpp index 39ea4c6ab..e14b3fa57 100644 --- a/src/ModelAPI/ModelAPI_AttributeTables.cpp +++ b/src/ModelAPI/ModelAPI_AttributeTables.cpp @@ -24,7 +24,7 @@ std::string ModelAPI_AttributeTables::attributeType() { return typeId(); } //================================================================================================== -ModelAPI_AttributeTables::~ModelAPI_AttributeTables() {} +ModelAPI_AttributeTables::~ModelAPI_AttributeTables() = default; //================================================================================================== -ModelAPI_AttributeTables::ModelAPI_AttributeTables() {} +ModelAPI_AttributeTables::ModelAPI_AttributeTables() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeValidator.cpp b/src/ModelAPI/ModelAPI_AttributeValidator.cpp index 2517dc826..55735b69d 100644 --- a/src/ModelAPI/ModelAPI_AttributeValidator.cpp +++ b/src/ModelAPI/ModelAPI_AttributeValidator.cpp @@ -20,4 +20,4 @@ #include -ModelAPI_AttributeValidator::~ModelAPI_AttributeValidator() {} +ModelAPI_AttributeValidator::~ModelAPI_AttributeValidator() = default; diff --git a/src/ModelAPI/ModelAPI_BodyBuilder.h b/src/ModelAPI/ModelAPI_BodyBuilder.h index afa7463e6..73ddcd193 100644 --- a/src/ModelAPI/ModelAPI_BodyBuilder.h +++ b/src/ModelAPI/ModelAPI_BodyBuilder.h @@ -38,7 +38,8 @@ class ModelAPI_Object; */ class ModelAPI_BodyBuilder { public: - MODELAPI_EXPORT virtual ~ModelAPI_BodyBuilder(){}; + MODELAPI_EXPORT virtual ~ModelAPI_BodyBuilder() = default; + ; /// Stores the shape (called by the execution method). virtual void store(const GeomShapePtr &theShape, @@ -135,6 +136,6 @@ protected: }; //! Pointer on feature object -typedef std::shared_ptr BodyBuilderPtr; +using BodyBuilderPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_CompositeFeature.cpp b/src/ModelAPI/ModelAPI_CompositeFeature.cpp index 9b8e8aa37..795b6b326 100644 --- a/src/ModelAPI/ModelAPI_CompositeFeature.cpp +++ b/src/ModelAPI/ModelAPI_CompositeFeature.cpp @@ -20,7 +20,7 @@ #include -ModelAPI_CompositeFeature::~ModelAPI_CompositeFeature() {} +ModelAPI_CompositeFeature::~ModelAPI_CompositeFeature() = default; void ModelAPI_CompositeFeature::erase() { // erase all sub-features diff --git a/src/ModelAPI/ModelAPI_Data.cpp b/src/ModelAPI/ModelAPI_Data.cpp index b766fa491..e1294cf5b 100644 --- a/src/ModelAPI/ModelAPI_Data.cpp +++ b/src/ModelAPI/ModelAPI_Data.cpp @@ -20,6 +20,6 @@ #include -ModelAPI_Data::~ModelAPI_Data() {} +ModelAPI_Data::~ModelAPI_Data() = default; -ModelAPI_Data::ModelAPI_Data() {} +ModelAPI_Data::ModelAPI_Data() = default; diff --git a/src/ModelAPI/ModelAPI_Events.cpp b/src/ModelAPI/ModelAPI_Events.cpp index a5134f87d..0fff1ad78 100644 --- a/src/ModelAPI/ModelAPI_Events.cpp +++ b/src/ModelAPI/ModelAPI_Events.cpp @@ -33,19 +33,19 @@ ModelAPI_ObjectUpdatedMessage::ModelAPI_ObjectUpdatedMessage( const Events_ID theID, const void *theSender) : Events_MessageGroup(theID, theSender) {} -ModelAPI_ObjectUpdatedMessage::~ModelAPI_ObjectUpdatedMessage() {} +ModelAPI_ObjectUpdatedMessage::~ModelAPI_ObjectUpdatedMessage() = default; ModelAPI_ObjectDeletedMessage::ModelAPI_ObjectDeletedMessage( const Events_ID theID, const void *theSender) : Events_MessageGroup(theID, theSender) {} -ModelAPI_ObjectDeletedMessage::~ModelAPI_ObjectDeletedMessage() {} +ModelAPI_ObjectDeletedMessage::~ModelAPI_ObjectDeletedMessage() = default; ModelAPI_OrderUpdatedMessage::ModelAPI_OrderUpdatedMessage( const Events_ID theID, const void *theSender) : Events_Message(theID, theSender) {} -ModelAPI_OrderUpdatedMessage::~ModelAPI_OrderUpdatedMessage() {} +ModelAPI_OrderUpdatedMessage::~ModelAPI_OrderUpdatedMessage() = default; // used by GUI only // LCOV_EXCL_START @@ -55,7 +55,7 @@ ModelAPI_FeatureStateMessage::ModelAPI_FeatureStateMessage( myCurrentFeature = std::shared_ptr(); } -ModelAPI_FeatureStateMessage::~ModelAPI_FeatureStateMessage() {} +ModelAPI_FeatureStateMessage::~ModelAPI_FeatureStateMessage() = default; std::shared_ptr ModelAPI_FeatureStateMessage::feature() const { @@ -86,7 +86,7 @@ void ModelAPI_FeatureStateMessage::setState(const std::string &theFeatureId, std::list ModelAPI_FeatureStateMessage::features() const { std::list result; - std::map::const_iterator it = myFeatureState.begin(); + auto it = myFeatureState.begin(); for (; it != myFeatureState.end(); ++it) { result.push_back(it->first); } @@ -98,7 +98,7 @@ ModelAPI_DocumentCreatedMessage::ModelAPI_DocumentCreatedMessage( const Events_ID theID, const void *theSender) : Events_Message(theID, theSender) {} -ModelAPI_DocumentCreatedMessage::~ModelAPI_DocumentCreatedMessage() {} +ModelAPI_DocumentCreatedMessage::~ModelAPI_DocumentCreatedMessage() = default; DocumentPtr ModelAPI_DocumentCreatedMessage::document() const { return myDocument; @@ -112,7 +112,7 @@ ModelAPI_AttributeEvalMessage::ModelAPI_AttributeEvalMessage( const Events_ID theID, const void *theSender) : Events_Message(theID, theSender) {} -ModelAPI_AttributeEvalMessage::~ModelAPI_AttributeEvalMessage() {} +ModelAPI_AttributeEvalMessage::~ModelAPI_AttributeEvalMessage() = default; AttributePtr ModelAPI_AttributeEvalMessage::attribute() const { return myAttribute; @@ -126,7 +126,7 @@ ModelAPI_ParameterEvalMessage::ModelAPI_ParameterEvalMessage( const Events_ID theID, const void *theSender) : Events_Message(theID, theSender), myIsProcessed(false) {} -ModelAPI_ParameterEvalMessage::~ModelAPI_ParameterEvalMessage() {} +ModelAPI_ParameterEvalMessage::~ModelAPI_ParameterEvalMessage() = default; FeaturePtr ModelAPI_ParameterEvalMessage::parameter() const { return myParam; } @@ -161,7 +161,7 @@ ModelAPI_ImportParametersMessage::ModelAPI_ImportParametersMessage( const Events_ID theID, const void *theSender) : Events_Message(theID, theSender) {} -ModelAPI_ImportParametersMessage::~ModelAPI_ImportParametersMessage() {} +ModelAPI_ImportParametersMessage::~ModelAPI_ImportParametersMessage() = default; std::string ModelAPI_ImportParametersMessage::filename() const { return myFilename; @@ -175,7 +175,7 @@ ModelAPI_BuildEvalMessage::ModelAPI_BuildEvalMessage(const Events_ID theID, const void *theSender) : Events_Message(theID, theSender), myIsProcessed(false) {} -ModelAPI_BuildEvalMessage::~ModelAPI_BuildEvalMessage() {} +ModelAPI_BuildEvalMessage::~ModelAPI_BuildEvalMessage() = default; FeaturePtr ModelAPI_BuildEvalMessage::parameter() const { return myParam; } @@ -204,7 +204,7 @@ ModelAPI_ComputePositionsMessage::ModelAPI_ComputePositionsMessage( const Events_ID theID, const void *theSender) : Events_Message(theID, theSender) {} -ModelAPI_ComputePositionsMessage::~ModelAPI_ComputePositionsMessage() {} +ModelAPI_ComputePositionsMessage::~ModelAPI_ComputePositionsMessage() = default; const std::wstring &ModelAPI_ComputePositionsMessage::expression() const { return myExpression; @@ -234,7 +234,7 @@ ModelAPI_ObjectRenamedMessage::ModelAPI_ObjectRenamedMessage( const Events_ID theID, const void *theSender) : Events_Message(theID, theSender) {} -ModelAPI_ObjectRenamedMessage::~ModelAPI_ObjectRenamedMessage() {} +ModelAPI_ObjectRenamedMessage::~ModelAPI_ObjectRenamedMessage() = default; void ModelAPI_ObjectRenamedMessage::send(ObjectPtr theObject, const std::wstring &theOldName, @@ -274,7 +274,7 @@ ModelAPI_ReplaceParameterMessage::ModelAPI_ReplaceParameterMessage( const Events_ID theID, const void *theSender) : Events_Message(theID, theSender) {} -ModelAPI_ReplaceParameterMessage::~ModelAPI_ReplaceParameterMessage() {} +ModelAPI_ReplaceParameterMessage::~ModelAPI_ReplaceParameterMessage() = default; void ModelAPI_ReplaceParameterMessage::send(ObjectPtr theObject, const void *theSender) { @@ -295,7 +295,7 @@ ModelAPI_SolverFailedMessage::ModelAPI_SolverFailedMessage( const Events_ID theID, const void *theSender) : Events_Message(theID, theSender), myDOF(-1) {} -ModelAPI_SolverFailedMessage::~ModelAPI_SolverFailedMessage() {} +ModelAPI_SolverFailedMessage::~ModelAPI_SolverFailedMessage() = default; void ModelAPI_SolverFailedMessage::setObjects( const std::set &theObjects) { @@ -371,7 +371,7 @@ ModelAPI_ShapesFailedMessage::ModelAPI_ShapesFailedMessage( const Events_ID theID, const void *theSender) : Events_Message(theID, theSender) {} -ModelAPI_ShapesFailedMessage::~ModelAPI_ShapesFailedMessage() {} +ModelAPI_ShapesFailedMessage::~ModelAPI_ShapesFailedMessage() = default; void ModelAPI_ShapesFailedMessage::setShapes(const ListOfShape &theShapes) { myShapes = theShapes; @@ -386,7 +386,7 @@ ModelAPI_CheckConstraintsMessage::ModelAPI_CheckConstraintsMessage( const Events_ID theID, const void *theSender) : Events_Message(theID, theSender) {} -ModelAPI_CheckConstraintsMessage::~ModelAPI_CheckConstraintsMessage() {} +ModelAPI_CheckConstraintsMessage::~ModelAPI_CheckConstraintsMessage() = default; const std::set & ModelAPI_CheckConstraintsMessage::constraints() const { @@ -403,7 +403,8 @@ ModelAPI_FeaturesLicenseValidMessage::ModelAPI_FeaturesLicenseValidMessage( const Events_ID theID, const void *theSender) : Events_Message(theID, theSender) {} -ModelAPI_FeaturesLicenseValidMessage::~ModelAPI_FeaturesLicenseValidMessage() {} +ModelAPI_FeaturesLicenseValidMessage::~ModelAPI_FeaturesLicenseValidMessage() = + default; void ModelAPI_FeaturesLicenseValidMessage::setFeatures( const std::set &theFeatures) { diff --git a/src/ModelAPI/ModelAPI_Expression.cpp b/src/ModelAPI/ModelAPI_Expression.cpp index 220618c0d..2e2479d31 100644 --- a/src/ModelAPI/ModelAPI_Expression.cpp +++ b/src/ModelAPI/ModelAPI_Expression.cpp @@ -24,17 +24,17 @@ #include -ModelAPI_Expression::ModelAPI_Expression() {} +ModelAPI_Expression::ModelAPI_Expression() = default; -ModelAPI_Expression::~ModelAPI_Expression() {} +ModelAPI_Expression::~ModelAPI_Expression() = default; bool ModelAPI_Expression::isInitialized() { return myIsInitialized; } void ModelAPI_Expression::setInitialized() { myIsInitialized = true; } -ModelAPI_ExpressionDouble::ModelAPI_ExpressionDouble() {} +ModelAPI_ExpressionDouble::ModelAPI_ExpressionDouble() = default; -ModelAPI_ExpressionInteger::ModelAPI_ExpressionInteger() {} +ModelAPI_ExpressionInteger::ModelAPI_ExpressionInteger() = default; bool ModelAPI_Expression::isVariable(const std::string &theString) { return isVariable(Locale::Convert::toWString(theString)); diff --git a/src/ModelAPI/ModelAPI_Expression.h b/src/ModelAPI/ModelAPI_Expression.h index 65d4c228f..fe026ac31 100644 --- a/src/ModelAPI/ModelAPI_Expression.h +++ b/src/ModelAPI/ModelAPI_Expression.h @@ -132,8 +132,8 @@ protected: }; //! Smart pointers for objects -typedef std::shared_ptr ExpressionPtr; -typedef std::shared_ptr ExpressionDoublePtr; -typedef std::shared_ptr ExpressionIntegerPtr; +using ExpressionPtr = std::shared_ptr; +using ExpressionDoublePtr = std::shared_ptr; +using ExpressionIntegerPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_Feature.cpp b/src/ModelAPI/ModelAPI_Feature.cpp index ec401c8b7..a017e7ad6 100644 --- a/src/ModelAPI/ModelAPI_Feature.cpp +++ b/src/ModelAPI/ModelAPI_Feature.cpp @@ -60,8 +60,7 @@ void ModelAPI_Feature::setResult( if (firstResult() == theResult) { // nothing to change } else if (!myResults.empty()) { // all except first become disabled - std::list>::iterator aResIter = - myResults.begin(); + auto aResIter = myResults.begin(); *aResIter = theResult; aECreator->sendUpdated(theResult, EVENT_UPD); for (aResIter++; aResIter != myResults.end(); aResIter++) { @@ -85,8 +84,7 @@ void ModelAPI_Feature::setResult( void ModelAPI_Feature::setResult( const std::shared_ptr &theResult, const int theIndex) { - std::list>::iterator aResIter = - myResults.begin(); + auto aResIter = myResults.begin(); for (int anIndex = 0; anIndex < theIndex; anIndex++) { aResIter++; } @@ -100,8 +98,7 @@ void ModelAPI_Feature::setResult( void ModelAPI_Feature::eraseResultFromList( const std::shared_ptr &theResult) { - std::list>::iterator aResIter = - myResults.begin(); + auto aResIter = myResults.begin(); for (; aResIter != myResults.end(); aResIter++) { ResultPtr aRes = *aResIter; if (aRes == theResult) { @@ -125,14 +122,13 @@ void ModelAPI_Feature::eraseResultFromList( void ModelAPI_Feature::removeResults(const int theSinceIndex, const bool theForever, const bool theFlush) { - std::list>::iterator aResIter = - myResults.begin(); + auto aResIter = myResults.begin(); for (int anIndex = 0; anIndex < theSinceIndex && aResIter != myResults.end(); anIndex++) aResIter++; std::string aGroup; - std::list>::iterator aNextIter = aResIter; + auto aNextIter = aResIter; while (aNextIter != myResults.end()) { aGroup = (*aNextIter)->groupName(); // remove previously erased results: to enable later if needed only actual @@ -210,8 +206,7 @@ bool ModelAPI_Feature::setDisabled(const bool theFlag) { removeResults(0, false, false); // flush will be in setCurrentFeature } else { // enable all disabled previously results - std::list>::iterator aResIter = - myResults.begin(); + auto aResIter = myResults.begin(); for (; aResIter != myResults.end(); aResIter++) { (*aResIter)->setDisabled(*aResIter, false); } diff --git a/src/ModelAPI/ModelAPI_FeatureValidator.cpp b/src/ModelAPI/ModelAPI_FeatureValidator.cpp index b2fd16d26..8ff320228 100644 --- a/src/ModelAPI/ModelAPI_FeatureValidator.cpp +++ b/src/ModelAPI/ModelAPI_FeatureValidator.cpp @@ -20,11 +20,11 @@ #include "ModelAPI_FeatureValidator.h" -ModelAPI_FeatureValidator::ModelAPI_FeatureValidator() {} +ModelAPI_FeatureValidator::ModelAPI_FeatureValidator() = default; -ModelAPI_FeatureValidator::~ModelAPI_FeatureValidator() {} +ModelAPI_FeatureValidator::~ModelAPI_FeatureValidator() = default; -bool ModelAPI_FeatureValidator::isNotObligatory(std::string theFeature, - std::string theAttribute) { +bool ModelAPI_FeatureValidator::isNotObligatory(std::string /*theFeature*/, + std::string /*theAttribute*/) { return false; } diff --git a/src/ModelAPI/ModelAPI_FeatureValidator.h b/src/ModelAPI/ModelAPI_FeatureValidator.h index 7f4589379..427d187ff 100644 --- a/src/ModelAPI/ModelAPI_FeatureValidator.h +++ b/src/ModelAPI/ModelAPI_FeatureValidator.h @@ -37,7 +37,7 @@ public: /// Default constructor ModelAPI_FeatureValidator(); /// Virtual destructor - virtual ~ModelAPI_FeatureValidator(); + ~ModelAPI_FeatureValidator() override; /// Returns true if feature and/or attributes are valid /// \param theFeature the validated feature diff --git a/src/ModelAPI/ModelAPI_FiltersFactory.h b/src/ModelAPI/ModelAPI_FiltersFactory.h index 6c863848d..43a9435f7 100644 --- a/src/ModelAPI/ModelAPI_FiltersFactory.h +++ b/src/ModelAPI/ModelAPI_FiltersFactory.h @@ -33,7 +33,7 @@ */ class ModelAPI_FiltersFactory { public: - virtual ~ModelAPI_FiltersFactory() {} + virtual ~ModelAPI_FiltersFactory() = default; /// Register an instance of a filter /// \param theID unique identifier of the filter, not necessary equal to the @@ -67,7 +67,7 @@ public: protected: /// Get instance from Session - ModelAPI_FiltersFactory() {} + ModelAPI_FiltersFactory() = default; }; #endif diff --git a/src/ModelAPI/ModelAPI_Folder.cpp b/src/ModelAPI/ModelAPI_Folder.cpp index 16e5eb0db..cc3a547e3 100644 --- a/src/ModelAPI/ModelAPI_Folder.cpp +++ b/src/ModelAPI/ModelAPI_Folder.cpp @@ -22,9 +22,9 @@ #include -ModelAPI_Folder::ModelAPI_Folder() {} +ModelAPI_Folder::ModelAPI_Folder() = default; -ModelAPI_Folder::~ModelAPI_Folder() {} +ModelAPI_Folder::~ModelAPI_Folder() = default; void ModelAPI_Folder::init() {} diff --git a/src/ModelAPI/ModelAPI_IReentrant.cpp b/src/ModelAPI/ModelAPI_IReentrant.cpp index a61aa7b5e..7c01176dc 100644 --- a/src/ModelAPI/ModelAPI_IReentrant.cpp +++ b/src/ModelAPI/ModelAPI_IReentrant.cpp @@ -20,4 +20,4 @@ #include -ModelAPI_IReentrant::~ModelAPI_IReentrant() {} +ModelAPI_IReentrant::~ModelAPI_IReentrant() = default; diff --git a/src/ModelAPI/ModelAPI_Object.cpp b/src/ModelAPI/ModelAPI_Object.cpp index 2fd020206..05fa59a13 100644 --- a/src/ModelAPI/ModelAPI_Object.cpp +++ b/src/ModelAPI/ModelAPI_Object.cpp @@ -54,9 +54,9 @@ std::shared_ptr ModelAPI_Object::document() const { void ModelAPI_Object::attributeChanged(const std::string & /*theID*/) {} -ModelAPI_Object::ModelAPI_Object() {} +ModelAPI_Object::ModelAPI_Object() = default; -ModelAPI_Object::~ModelAPI_Object() {} +ModelAPI_Object::~ModelAPI_Object() = default; void ModelAPI_Object::setData(std::shared_ptr theData) { myData = theData; diff --git a/src/ModelAPI/ModelAPI_Plugin.cpp b/src/ModelAPI/ModelAPI_Plugin.cpp index fc74d5358..9702614d8 100644 --- a/src/ModelAPI/ModelAPI_Plugin.cpp +++ b/src/ModelAPI/ModelAPI_Plugin.cpp @@ -20,4 +20,4 @@ #include "ModelAPI_Plugin.h" -ModelAPI_Plugin::~ModelAPI_Plugin() {} +ModelAPI_Plugin::~ModelAPI_Plugin() = default; diff --git a/src/ModelAPI/ModelAPI_Result.cpp b/src/ModelAPI/ModelAPI_Result.cpp index 134374fa5..f531bc165 100644 --- a/src/ModelAPI/ModelAPI_Result.cpp +++ b/src/ModelAPI/ModelAPI_Result.cpp @@ -28,7 +28,7 @@ #include -ModelAPI_Result::~ModelAPI_Result() {} +ModelAPI_Result::~ModelAPI_Result() = default; void ModelAPI_Result::initAttributes() { // append the color attribute. It is empty, the attribute will be filled by a diff --git a/src/ModelAPI/ModelAPI_ResultBody.cpp b/src/ModelAPI/ModelAPI_ResultBody.cpp index 9a83bcc52..eed1c659d 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.cpp +++ b/src/ModelAPI/ModelAPI_ResultBody.cpp @@ -24,11 +24,11 @@ #include #include -ModelAPI_ResultBody::ModelAPI_ResultBody() : myBuilder(0) { +ModelAPI_ResultBody::ModelAPI_ResultBody() { myConnect = ConnectionNotComputed; } -ModelAPI_ResultBody::~ModelAPI_ResultBody() {} +ModelAPI_ResultBody::~ModelAPI_ResultBody() = default; std::string ModelAPI_ResultBody::groupName() { return group(); } diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index 562f5ac2f..8c42c9702 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -55,8 +55,8 @@ protected: /// Keeps (not persistently) the connected topology flag ConnectedTopologyFlag myConnect; - ModelAPI_BodyBuilder - *myBuilder; ///< provides the body processing in naming shape + ModelAPI_BodyBuilder *myBuilder{ + 0}; ///< provides the body processing in naming shape public: MODELAPI_EXPORT ~ModelAPI_ResultBody() override; diff --git a/src/ModelAPI/ModelAPI_ResultField.cpp b/src/ModelAPI/ModelAPI_ResultField.cpp index f391e416e..747f3c4c7 100644 --- a/src/ModelAPI/ModelAPI_ResultField.cpp +++ b/src/ModelAPI/ModelAPI_ResultField.cpp @@ -22,7 +22,7 @@ #include "ModelAPI_Events.h" #include -ModelAPI_ResultField::~ModelAPI_ResultField() {} +ModelAPI_ResultField::~ModelAPI_ResultField() = default; std::string ModelAPI_ResultField::groupName() { return group(); } diff --git a/src/ModelAPI/ModelAPI_ResultGroup.cpp b/src/ModelAPI/ModelAPI_ResultGroup.cpp index a8299236b..043f48997 100644 --- a/src/ModelAPI/ModelAPI_ResultGroup.cpp +++ b/src/ModelAPI/ModelAPI_ResultGroup.cpp @@ -20,6 +20,6 @@ #include "ModelAPI_ResultGroup.h" -ModelAPI_ResultGroup::~ModelAPI_ResultGroup() {} +ModelAPI_ResultGroup::~ModelAPI_ResultGroup() = default; std::string ModelAPI_ResultGroup::groupName() { return group(); } diff --git a/src/ModelAPI/ModelAPI_ResultParameter.cpp b/src/ModelAPI/ModelAPI_ResultParameter.cpp index 82f40ccab..84de2070f 100644 --- a/src/ModelAPI/ModelAPI_ResultParameter.cpp +++ b/src/ModelAPI/ModelAPI_ResultParameter.cpp @@ -20,4 +20,4 @@ #include "ModelAPI_ResultParameter.h" -ModelAPI_ResultParameter::~ModelAPI_ResultParameter() {} +ModelAPI_ResultParameter::~ModelAPI_ResultParameter() = default; diff --git a/src/ModelAPI/ModelAPI_Session.cpp b/src/ModelAPI/ModelAPI_Session.cpp index b5da3a738..8966e83fc 100644 --- a/src/ModelAPI/ModelAPI_Session.cpp +++ b/src/ModelAPI/ModelAPI_Session.cpp @@ -87,7 +87,7 @@ std::shared_ptr ModelAPI_Session::get() { } /// instance of the events creator, one pre application -const ModelAPI_EventCreator *MY_API_CREATOR = 0; +const ModelAPI_EventCreator *MY_API_CREATOR = nullptr; const ModelAPI_EventCreator *ModelAPI_EventCreator::get() { if (!MY_API_CREATOR) { // import Model library that implements this interface diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index c6a9c3324..76196f5c2 100644 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -221,7 +221,7 @@ void loadModifiedShapes(ResultBodyPtr theResultBody, theResultBody->storeModified(theBaseShapes, theResultShape, theMakeShape); ListOfShape aShapes = theBaseShapes; - ListOfShape::const_iterator aToolIter = theTools.cbegin(); + auto aToolIter = theTools.cbegin(); for (; aToolIter != theTools.cend(); aToolIter++) aShapes.push_back(*aToolIter); @@ -299,10 +299,7 @@ void loadDeletedShapes(ResultBodyPtr theResultBody, void loadDeletedShapes(std::vector &theResultBaseAlgoList, const ListOfShape &theTools, const GeomShapePtr theResultShapesCompound) { - for (std::vector::iterator anIt = - theResultBaseAlgoList.begin(); - anIt != theResultBaseAlgoList.end(); ++anIt) { - ResultBaseAlgo &aRCA = *anIt; + for (auto &aRCA : theResultBaseAlgoList) { loadDeletedShapes(aRCA.resultBody, aRCA.baseShape, theTools, aRCA.makeShape, theResultShapesCompound); } @@ -353,9 +350,8 @@ static void cacheSubresults(const ResultBodyPtr &theTopLevelResult, std::set &theCashedResults) { std::list aResults; ModelAPI_Tools::allSubs(theTopLevelResult, aResults, false); - for (std::list::iterator aR = aResults.begin(); - aR != aResults.end(); ++aR) { - theCashedResults.insert(*aR); + for (auto &aResult : aResults) { + theCashedResults.insert(aResult); } } @@ -364,7 +360,7 @@ bool isInResults(AttributeSelectionListPtr theSelection, std::set &theCashedResults) { // collect all results into a cashed set if (theCashedResults.empty()) { - std::list::const_iterator aRes = theResults.cbegin(); + auto aRes = theResults.cbegin(); for (; aRes != theResults.cend(); aRes++) { if (theCashedResults.count(*aRes)) continue; @@ -413,7 +409,7 @@ bool isInResults(AttributeSelectionListPtr theSelection, continue; GeomShapePtr aGroupResShape = aSelFeature->firstResult()->shape(); - std::set::iterator allResultsIter = theCashedResults.begin(); + auto allResultsIter = theCashedResults.begin(); for (; allResultsIter != theCashedResults.end(); allResultsIter++) { GeomShapePtr aResultShape = (*allResultsIter)->shape(); @@ -433,7 +429,7 @@ bool isInResults(AttributeSelectionListPtr theSelection, FeaturePtr aContextFeature = anAttr->contextFeature(); if (aContextFeature.get() && !aContextFeature->results().empty()) { const std::list &allResluts = aContextFeature->results(); - std::list::const_iterator aResIter = allResluts.cbegin(); + auto aResIter = allResluts.cbegin(); for (; aResIter != allResluts.cend(); aResIter++) { if (aResIter->get() && theCashedResults.count(*aResIter)) return true; @@ -477,8 +473,7 @@ FeaturePtr findPartFeature(const DocumentPtr &theMain, if (aPartFeat.get()) { const std::list> &aResList = aPartFeat->results(); - std::list>::const_iterator aRes = - aResList.begin(); + auto aRes = aResList.begin(); for (; aRes != aResList.end(); aRes++) { ResultPartPtr aPart = std::dynamic_pointer_cast(*aRes); @@ -498,8 +493,7 @@ CompositeFeaturePtr compositeOwner(const FeaturePtr &theFeature) { if (theFeature.get() && theFeature->data() && theFeature->data()->isValid()) { const std::set> &aRefs = theFeature->data()->refsToMe(); - std::set>::const_iterator aRefIter = - aRefs.begin(); + auto aRefIter = aRefs.begin(); for (; aRefIter != aRefs.end(); aRefIter++) { CompositeFeaturePtr aComp = std::dynamic_pointer_cast( @@ -568,7 +562,7 @@ void allResults(const FeaturePtr &theFeature, return; const std::list> &aResults = theFeature->results(); - std::list::const_iterator aRIter = aResults.begin(); + auto aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { theResults.push_back(*aRIter); ResultBodyPtr aResult = @@ -633,8 +627,7 @@ bool removeFeaturesAndReferences(const std::set &theFeatures, bool removeFeatures(const std::set &theFeatures, const bool theFlushRedisplay) { bool isDone = false; - std::set::const_iterator anIt = theFeatures.begin(), - aLast = theFeatures.end(); + auto anIt = theFeatures.begin(), aLast = theFeatures.end(); for (; anIt != aLast; anIt++) { FeaturePtr aFeature = *anIt; if (aFeature.get()) { @@ -673,8 +666,7 @@ void addRefsToFeature( // references to it std::set aMainReferences = theReferencesMap.at(theFeature); - std::set::const_iterator anIt = aMainReferences.begin(), - aLast = aMainReferences.end(); + auto anIt = aMainReferences.begin(), aLast = aMainReferences.end(); for (; anIt != aLast; anIt++) { FeaturePtr aRefFeature = *anIt; if (theReferences.find(aRefFeature) == theReferences.end()) { @@ -696,8 +688,7 @@ void findReferences(const std::set &theFeatures, if (theRecLevel > RECURSE_TOP_LEVEL) return; theRecLevel++; - std::set::const_iterator anIt = theFeatures.begin(), - aLast = theFeatures.end(); + auto anIt = theFeatures.begin(), aLast = theFeatures.end(); for (; anIt != aLast; anIt++) { FeaturePtr aFeature = *anIt; if (aFeature.get() && theReferences.find(aFeature) == theReferences.end()) { @@ -710,8 +701,7 @@ void findReferences(const std::set &theFeatures, } else { // filter references to skip composition features of the current // feature std::set aFilteredFeatures; - std::set::const_iterator aRefIt = aSelRefFeatures.begin(), - aRefLast = aSelRefFeatures.end(); + auto aRefIt = aSelRefFeatures.begin(), aRefLast = aSelRefFeatures.end(); for (; aRefIt != aRefLast; aRefIt++) { FeaturePtr aCFeature = *aRefIt; CompositeFeaturePtr aComposite = @@ -780,8 +770,7 @@ void findAllReferences( << getFeatureInfo(aMainListFeature) << ", references size = " << aSize << std::endl; #endif - std::set::const_iterator anIt = aMainRefList.begin(), - aLast = aMainRefList.end(); + auto anIt = aMainRefList.begin(), aLast = aMainRefList.end(); std::set aResultRefList; aResultRefList.insert(aMainRefList.begin(), aMainRefList.end()); for (; anIt != aLast; anIt++) { @@ -809,15 +798,13 @@ void findRefsToFeatures( const std::set &theFeatures, const std::map> &theReferences, std::set &theFeaturesRefsTo) { - std::set::const_iterator anIt = theFeatures.begin(), - aLast = theFeatures.end(); + auto anIt = theFeatures.begin(), aLast = theFeatures.end(); for (; anIt != aLast; anIt++) { FeaturePtr aFeature = *anIt; if (theReferences.find(aFeature) == theReferences.end()) continue; std::set aRefList = theReferences.at(aFeature); - std::set::const_iterator aRefIt = aRefList.begin(), - aRefLast = aRefList.end(); + auto aRefIt = aRefList.begin(), aRefLast = aRefList.end(); for (; aRefIt != aRefLast; aRefIt++) { FeaturePtr aRefFeature = *aRefIt; CompositeFeaturePtr aComposite = @@ -924,7 +911,7 @@ getDefaultName(const std::shared_ptr &theResult, // get the result number in the feature int anIndexInOwner = 0; const std::list &anOwnerResults = anOwner->results(); - std::list::const_iterator aResIt = anOwnerResults.cbegin(); + auto aResIt = anOwnerResults.cbegin(); for (; aResIt != anOwnerResults.cend(); aResIt++) { if (*aResIt == theResult) break; @@ -936,7 +923,7 @@ getDefaultName(const std::shared_ptr &theResult, // store number of references for each object std::map aNbRefToObject; // search the object by result index - std::list::const_iterator anObjIt = aFoundRef->second.begin(); + auto anObjIt = aFoundRef->second.begin(); int aResultIndex = anIndexInOwner; while (--aResultIndex >= 0) { ResultPtr aCurRes = std::dynamic_pointer_cast(*anObjIt); @@ -970,8 +957,7 @@ getDefaultName(const std::shared_ptr &theResult, anObjRes->data()->name() != getDefaultName(anObjRes).first)) { std::wstringstream aName; aName << anObjRes->data()->name(); - std::map::iterator aFound = - aNbRefToObject.find(anObjRes); + auto aFound = aNbRefToObject.find(anObjRes); if (aFound != aNbRefToObject.end()) { // to generate unique name, add suffix if there are several results // referring to the same shape @@ -998,9 +984,8 @@ std::set getParents(const FeaturePtr &theFeature) { for (FeaturePtr aCurFeat = theFeature; aCurFeat;) { CompositeFeaturePtr aFoundComposite; const std::set &aRefs = aCurFeat->data()->refsToMe(); - for (std::set::const_iterator anIt = aRefs.begin(); - anIt != aRefs.end(); ++anIt) { - FeaturePtr aF = ModelAPI_Feature::feature((*anIt)->owner()); + for (const auto &aRef : aRefs) { + FeaturePtr aF = ModelAPI_Feature::feature(aRef->owner()); aFoundComposite = std::dynamic_pointer_cast(aF); if (aFoundComposite && aFoundComposite->isSub(aCurFeat)) @@ -1051,7 +1036,7 @@ void removeResults(const std::list &theResults) { // collect all documents where the results must be removed std::map> aDocs; - std::list::const_iterator aResIter = theResults.cbegin(); + auto aResIter = theResults.cbegin(); for (; aResIter != theResults.cend(); aResIter++) { DocumentPtr aDoc = (*aResIter)->document(); if (!aDocs.count(aDoc)) @@ -1059,7 +1044,7 @@ void removeResults(const std::list &theResults) { aDocs[aDoc].push_back(*aResIter); } // create a "remove" feature in each doc - std::map>::iterator aDoc = aDocs.begin(); + auto aDoc = aDocs.begin(); for (; aDoc != aDocs.end(); aDoc++) { FeaturePtr aRemove = aDoc->first->addFeature("RemoveResults"); if (aRemove) { @@ -1080,7 +1065,7 @@ void setDeflection(ResultPtr theResult, const double theDeflection) { AttributeDoublePtr aDeflectionAttr = theResult->data()->real(ModelAPI_Result::DEFLECTION_ID()); - if (aDeflectionAttr.get() != NULL) { + if (aDeflectionAttr.get() != nullptr) { aDeflectionAttr->setValue(theDeflection); } } @@ -1088,9 +1073,9 @@ void setDeflection(ResultPtr theResult, const double theDeflection) { double getDeflection(const std::shared_ptr &theResult) { double aDeflection = -1; // get deflection from the attribute of the result - if (theResult.get() != NULL && + if (theResult.get() != nullptr && theResult->data()->attribute(ModelAPI_Result::DEFLECTION_ID()).get() != - NULL) { + nullptr) { AttributeDoublePtr aDoubleAttr = theResult->data()->real(ModelAPI_Result::DEFLECTION_ID()); if (aDoubleAttr.get() && aDoubleAttr->isInitialized()) { @@ -1110,7 +1095,7 @@ void setColor(ResultPtr theResult, const std::vector &theColor) { AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); - if (aColorAttr.get() != NULL) { + if (aColorAttr.get() != nullptr) { if (!aColorAttr->size()) { aColorAttr->setSize(3); } @@ -1124,8 +1109,9 @@ void getColor(const std::shared_ptr &theResult, std::vector &theColor) { theColor.clear(); // get color from the attribute of the result - if (theResult.get() != NULL && - theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) { + if (theResult.get() != nullptr && + theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != + nullptr) { AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); if (aColorAttr.get() && aColorAttr->size()) { @@ -1171,7 +1157,7 @@ void setIsoLines(ResultPtr theResult, const std::vector &theIso) { AttributeIntArrayPtr aAttr = theResult->data()->intArray(ModelAPI_Result::ISO_LINES_ID()); - if (aAttr.get() != NULL) { + if (aAttr.get() != nullptr) { if (!aAttr->size()) { aAttr->setSize(2); } @@ -1187,7 +1173,7 @@ void showIsoLines(std::shared_ptr theResult, bool theShow) { AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID()); - if (aAttr.get() != NULL) { + if (aAttr.get() != nullptr) { aAttr->setValue(theShow); } } @@ -1199,7 +1185,7 @@ bool isShownIsoLines(std::shared_ptr theResult) { AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID()); - if (aAttr.get() != NULL) { + if (aAttr.get() != nullptr) { return aAttr->value(); } return false; @@ -1213,7 +1199,7 @@ void showEdgesDirection(std::shared_ptr theResult, AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::SHOW_EDGES_DIRECTION_ID()); - if (aAttr.get() != NULL) { + if (aAttr.get() != nullptr) { aAttr->setValue(theShow); } } @@ -1225,7 +1211,7 @@ bool isShowEdgesDirection(std::shared_ptr theResult) { AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::SHOW_EDGES_DIRECTION_ID()); - if (aAttr.get() != NULL) { + if (aAttr.get() != nullptr) { return aAttr->value(); } return false; @@ -1238,7 +1224,7 @@ void bringToFront(std::shared_ptr theResult, bool theFlag) { AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::BRING_TO_FRONT_ID()); - if (aAttr.get() != NULL) { + if (aAttr.get() != nullptr) { aAttr->setValue(theFlag); } } @@ -1250,7 +1236,7 @@ bool isBringToFront(std::shared_ptr theResult) { AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::BRING_TO_FRONT_ID()); - if (aAttr.get() != NULL) { + if (aAttr.get() != nullptr) { return aAttr->value(); } return false; @@ -1263,7 +1249,7 @@ void setTransparency(ResultPtr theResult, double theTransparency) { AttributeDoublePtr anAttribute = theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); - if (anAttribute.get() != NULL) { + if (anAttribute.get() != nullptr) { anAttribute->setValue(theTransparency); } } @@ -1271,9 +1257,9 @@ void setTransparency(ResultPtr theResult, double theTransparency) { double getTransparency(const std::shared_ptr &theResult) { double aTransparency = -1; // get transparency from the attribute of the result - if (theResult.get() != NULL && + if (theResult.get() != nullptr && theResult->data()->attribute(ModelAPI_Result::TRANSPARENCY_ID()).get() != - NULL) { + nullptr) { AttributeDoublePtr aDoubleAttr = theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID()); if (aDoubleAttr.get() && aDoubleAttr->isInitialized()) { @@ -1368,10 +1354,10 @@ referencedFeatures(std::shared_ptr theTarget, std::dynamic_pointer_cast(theTarget); if (aBody.get()) allSubs(aBody, allSubRes); - std::list::iterator aSub = allSubRes.begin(); + auto aSub = allSubRes.begin(); for (; aSub != allSubRes.end(); aSub++) { const std::set &aRefs = (*aSub)->data()->refsToMe(); - std::set::const_iterator aRef = aRefs.cbegin(); + auto aRef = aRefs.cbegin(); for (; aRef != aRefs.cend(); aRef++) { FeaturePtr aFeat = std::dynamic_pointer_cast((*aRef)->owner()); @@ -1383,7 +1369,7 @@ referencedFeatures(std::shared_ptr theTarget, // add also feature of the target that may be referenced as a whole FeaturePtr aTargetFeature = theTarget->document()->feature(theTarget); const std::set &aRefs = aTargetFeature->data()->refsToMe(); - std::set::const_iterator aRef = aRefs.cbegin(); + auto aRef = aRefs.cbegin(); for (; aRef != aRefs.cend(); aRef++) { FeaturePtr aFeat = std::dynamic_pointer_cast((*aRef)->owner()); @@ -1396,14 +1382,13 @@ referencedFeatures(std::shared_ptr theTarget, if (theFeatureKind == "Group") { std::set aGroupOperations; for (bool aNeedIterate = true; aNeedIterate;) { - std::set::iterator aResIter = aResSet.begin(); + auto aResIter = aResSet.begin(); for (; aResIter != aResSet.end(); aResIter++) { - std::list::const_iterator aGroupRes = - (*aResIter)->results().cbegin(); + auto aGroupRes = (*aResIter)->results().cbegin(); for (; aGroupRes != (*aResIter)->results().cend(); aGroupRes++) { const std::set &aGroupRefs = (*aGroupRes)->data()->refsToMe(); - std::set::const_iterator aRefIt = aGroupRefs.cbegin(); + auto aRefIt = aGroupRefs.cbegin(); for (; aRefIt != aGroupRefs.cend(); aRefIt++) { FeaturePtr aFeat = std::dynamic_pointer_cast((*aRefIt)->owner()); @@ -1415,8 +1400,7 @@ referencedFeatures(std::shared_ptr theTarget, // without theTarget shape GeomShapePtr aTargetShape = theTarget->shape(); bool anIsIn = false; - std::list::const_iterator anOpRes = - aFeat->results().cbegin(); + auto anOpRes = aFeat->results().cbegin(); for (; anOpRes != aFeat->results().cend() && !anIsIn; anOpRes++) { GeomShapePtr anOpShape = (*anOpRes)->shape(); if (!anOpShape.get() || anOpShape->isNull()) @@ -1438,7 +1422,7 @@ referencedFeatures(std::shared_ptr theTarget, // insert all new group operations into result and if they are, check for // next dependencies aNeedIterate = false; - std::set::iterator aGroupOpIter = aGroupOperations.begin(); + auto aGroupOpIter = aGroupOperations.begin(); for (; aGroupOpIter != aGroupOperations.end(); aGroupOpIter++) { if (aResSet.find(*aGroupOpIter) == aResSet.end()) { aResSet.insert(*aGroupOpIter); @@ -1449,10 +1433,10 @@ referencedFeatures(std::shared_ptr theTarget, } std::list aResList; - std::set::iterator aResIter = aResSet.begin(); + auto aResIter = aResSet.begin(); for (; aResIter != aResSet.end(); aResIter++) { if (theSortResults) { // sort results by creation-order - std::list::iterator aListIter = aResList.begin(); + auto aListIter = aResList.begin(); for (; aListIter != aResList.end(); aListIter++) { if ((*aResIter)->document()->isLater(*aListIter, *aResIter)) break; @@ -1589,30 +1573,28 @@ std::wstring validateMovement(const FeaturePtr &theAfter, aPassedMoved; // all features and all moved before the current one std::set aPassedAfter; // all passed features after theAfter bool anAfterIsPassed = - theAfter.get() == 0; // flag that iterator already passed theAfter + theAfter.get() == nullptr; // flag that iterator already passed theAfter std::list allFeat = aDoc->allFeatures(); - for (std::list::iterator aFeat = allFeat.begin(); - aFeat != allFeat.end(); aFeat++) { + for (auto &aFeat : allFeat) { if (!anAfterIsPassed) { - if (aMoved.count(*aFeat)) - aPassedMoved.insert(*aFeat); + if (aMoved.count(aFeat)) + aPassedMoved.insert(aFeat); else // check aPassedMoved are not referenced by the current feature - aPassed.insert(*aFeat); + aPassed.insert(aFeat); - anAfterIsPassed = *aFeat == theAfter; + anAfterIsPassed = aFeat == theAfter; if (anAfterIsPassed && !aPassedMoved.empty()) { // check dependencies of moved relatively to // the passed std::map> aReferences; findAllReferences(aPassedMoved, aReferences); - std::map>::iterator aRefIter = - aReferences.begin(); + auto aRefIter = aReferences.begin(); for (; aRefIter != aReferences.end(); aRefIter++) { if (aPassed.count(aRefIter->first)) { aResult += topOwner(aRefIter->first)->name() + L" -> "; // iterate all passed moved to check is it referenced by described // feature or not - std::set::iterator aMovedIter = aPassedMoved.begin(); + auto aMovedIter = aPassedMoved.begin(); for (; aMovedIter != aPassedMoved.end(); aMovedIter++) { std::map> aPassedRefs; std::set aMovedOne; @@ -1627,33 +1609,32 @@ std::wstring validateMovement(const FeaturePtr &theAfter, } } else // iteration after theAfter { - if (aMoved.count(*aFeat)) { // check dependencies of moved relatively to - // ones after theAfter + if (aMoved.count(aFeat)) { // check dependencies of moved relatively to + // ones after theAfter std::map> aReferences; findAllReferences(aPassedAfter, aReferences); - bool aFoundRef = aReferences.find(*aFeat) != aReferences.end(); - if (!aFoundRef && !(*aFeat)->results().empty()) // reference may be a - // feature in moved part + bool aFoundRef = aReferences.find(aFeat) != aReferences.end(); + if (!aFoundRef && !aFeat->results().empty()) // reference may be a + // feature in moved part { ResultPartPtr aFeatPart = std::dynamic_pointer_cast( - (*aFeat)->firstResult()); + aFeat->firstResult()); if (aFeatPart.get() && aFeatPart->partDoc().get()) { - std::map>::iterator aRef = - aReferences.begin(); + auto aRef = aReferences.begin(); for (; aRef != aReferences.end() && !aFoundRef; aRef++) aFoundRef = aRef->first->document() == aFeatPart->partDoc(); } } if (aFoundRef) { - aResult += topOwner(*aFeat)->name() + L" -> "; + aResult += topOwner(aFeat)->name() + L" -> "; std::set aReferencedCount; // to avoid duplicates in the // displayed references // iterate all passed after theAfter to check refers it described // feature or not - FeaturePtr aFeatTop = topOwner(*aFeat); - std::set::iterator aPassedIter = aPassedAfter.begin(); + FeaturePtr aFeatTop = topOwner(aFeat); + auto aPassedIter = aPassedAfter.begin(); for (; aPassedIter != aPassedAfter.end(); aPassedIter++) { FeaturePtr aPassedTop = topOwner(*aPassedIter); if (aReferencedCount.count(aPassedTop)) @@ -1662,12 +1643,11 @@ std::wstring validateMovement(const FeaturePtr &theAfter, std::set aPassedOne; aPassedOne.insert(*aPassedIter); findAllReferences(aPassedOne, aPassedRefs); - std::map>::iterator aPRIter = - aPassedRefs.begin(); + auto aPRIter = aPassedRefs.begin(); for (; aPRIter != aPassedRefs.end(); aPRIter++) { FeaturePtr aPRTop = topOwner(aPRIter->first); - if (aPRIter->first == *aFeat || aPRIter->first == aFeatTop || - aPRTop == *aFeat || aPRTop == aFeatTop) { + if (aPRIter->first == aFeat || aPRIter->first == aFeatTop || + aPRTop == aFeat || aPRTop == aFeatTop) { aResult += aPassedTop->name() + L" "; aReferencedCount.insert(aPassedTop); break; @@ -1677,7 +1657,7 @@ std::wstring validateMovement(const FeaturePtr &theAfter, aResult += L"\n"; } } else { - aPassedAfter.insert(*aFeat); + aPassedAfter.insert(aFeat); } } } diff --git a/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp b/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp index 6d4f96f9f..f8c8ed37f 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp +++ b/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp @@ -102,8 +102,7 @@ void ModelGeomAlgo_Point2D::getPointsOfReference( if (aRefFeature->getKind() == theReferenceFeatureKind) { std::list anAttributes = aRefFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); - std::list::iterator anIter = anAttributes.begin(), - aLast = anAttributes.end(); + auto anIter = anAttributes.begin(), aLast = anAttributes.end(); bool isSkippedAttribute = false; if (isSkipFeatureAttributes) { for (anIter = anAttributes.begin(); @@ -145,8 +144,7 @@ void ModelGeomAlgo_Point2D::getPointsOfReference( if (aFeature.get()) { const std::list> aResults = aFeature->results(); - std::list>::const_iterator aRIter = - aResults.begin(); + auto aRIter = aResults.begin(); for (; aRIter != aResults.cend(); aRIter++) { ResultPtr aResult = *aRIter; getPointsOfReference(aResult, theReferenceFeatureKind, theAttributes, @@ -244,9 +242,7 @@ void ModelGeomAlgo_Point2D::getPointsIntersectedShape( aFeatureShape = (*anEdgeShapes.begin())->shape(); } - std::list>::const_iterator - anIt = theFeatures.begin(), - aLast = theFeatures.end(); + auto anIt = theFeatures.begin(), aLast = theFeatures.end(); for (; anIt != aLast; anIt++) { FeaturePtr aFeature = *anIt; if (aFeature.get() == theBaseFeature.get()) @@ -306,9 +302,7 @@ void ModelGeomAlgo_Point2D::getPointsInsideShape( #ifdef DEBUG_POINT_INSIDE_SHAPE std::cout << "ModelGeomAlgo_Point2D::getPointsInsideShape:" << std::endl; #endif - std::set>::const_iterator - anIt = theAttributes.begin(), - aLast = theAttributes.end(); + auto anIt = theAttributes.begin(), aLast = theAttributes.end(); for (; anIt != aLast; anIt++) { std::shared_ptr anAttribute = *anIt; std::shared_ptr aPnt2d = anAttribute->pnt(); @@ -350,9 +344,7 @@ void ModelGeomAlgo_Point2D::getPointsInsideShape_p( std::list> &thePoints, std::map, std::shared_ptr> &theAttributeToPoint) { - std::set>::const_iterator - anIt = theAttributes.begin(), - aLast = theAttributes.end(); + auto anIt = theAttributes.begin(), aLast = theAttributes.end(); for (; anIt != aLast; anIt++) { std::shared_ptr anAttribute = *anIt; std::shared_ptr aPnt2d = anAttribute->pnt(); diff --git a/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.h b/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.h index 12da07c15..6d4b120e9 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.h +++ b/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.h @@ -78,10 +78,10 @@ public: /// to intersect with the base feature \param thePoints a container of 3D /// points belong to the shape \param theObjectToPoint a container of object /// to point - typedef std::map, - std::pair>, - std::list>>> - PointToRefsMap; + using PointToRefsMap = + std::map, + std::pair>, + std::list>>>; static MODELGEOMALGO_EXPORT void getPointsIntersectedShape( const std::shared_ptr &theBaseFeature, diff --git a/src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp b/src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp index e3a8e11a8..5dc731e5b 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp +++ b/src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp @@ -46,7 +46,7 @@ void shapesOfType(const FeaturePtr &theFeature, std::set &theShapeResults) { theShapeResults.clear(); std::list aResults = theFeature->results(); - std::list::const_iterator aRIter = aResults.cbegin(); + auto aRIter = aResults.cbegin(); for (; aRIter != aResults.cend(); aRIter++) { ResultPtr aResult = *aRIter; GeomShapePtr aShape = aResult->shape(); @@ -174,9 +174,8 @@ static void appendSubshapeOfResult( static void appendSubshapeOfResult(std::list &theList, const ResultPtr &theResult, const std::list &theSubshape) { - for (std::list::const_iterator anIt = theSubshape.begin(); - anIt != theSubshape.end(); ++anIt) - appendSubshapeOfResult(theList, theResult, *anIt); + for (const auto &anIt : theSubshape) + appendSubshapeOfResult(theList, theResult, anIt); } static bool @@ -221,10 +220,9 @@ bool findSubshapeByPoint(const std::shared_ptr &theFeature, theSelected.clear(); const std::list &aResults = theFeature->results(); - for (std::list::const_iterator aResIt = aResults.begin(); - aResIt != aResults.end(); ++aResIt) { + for (const auto &aResult : aResults) { bool isSubshapeFound = false; - GeomShapePtr aCurShape = (*aResIt)->shape(); + GeomShapePtr aCurShape = aResult->shape(); // first of all, check the point is within bounding box of the result if (!aCurShape || !isPointWithinBB(thePoint, aCurShape, TOLERANCE)) continue; @@ -235,7 +233,7 @@ bool findSubshapeByPoint(const std::shared_ptr &theFeature, std::dynamic_pointer_cast(aCurShape); if (theShapeType != GeomAPI_Shape::COMPOUND || !aSketchEdges) { ResultBodyPtr aCompSolid = - std::dynamic_pointer_cast(*aResIt); + std::dynamic_pointer_cast(aResult); if (aCompSolid) { isSubshapeFound = findSubshapeInCompsolid( aCompSolid, thePoint, theShapeType, TOLERANCE, theSelected); @@ -245,7 +243,7 @@ bool findSubshapeByPoint(const std::shared_ptr &theFeature, std::list aSubshapes = findSubShape(aCurShape, theShapeType, thePoint, TOLERANCE); if (!aSubshapes.empty()) { - appendSubshapeOfResult(theSelected, *aResIt, aSubshapes); + appendSubshapeOfResult(theSelected, aResult, aSubshapes); isSubshapeFound = true; } } @@ -255,7 +253,7 @@ bool findSubshapeByPoint(const std::shared_ptr &theFeature, // special case for ResultConstruction if the FACE is selected ResultConstructionPtr aResConstr = - std::dynamic_pointer_cast(*aResIt); + std::dynamic_pointer_cast(aResult); if (aResConstr && theShapeType >= GeomAPI_Shape::FACE) { int aNbFaces = aResConstr->facesNum(); for (int aFaceInd = 0; aFaceInd < aNbFaces; ++aFaceInd) { @@ -266,7 +264,7 @@ bool findSubshapeByPoint(const std::shared_ptr &theFeature, std::list aSubshapes = findSubShape(aCurFace, theShapeType, thePoint, TOLERANCE); if (!aSubshapes.empty()) { - appendSubshapeOfResult(theSelected, *aResIt, aSubshapes); + appendSubshapeOfResult(theSelected, aResult, aSubshapes); isSubshapeFound = true; } } @@ -279,7 +277,7 @@ bool findSubshapeByPoint(const std::shared_ptr &theFeature, if (aSketchEdges && theShapeType == GeomAPI_Shape::COMPOUND && aSketchEdges->middlePoint()->distance(thePoint) < TOLERANCE) { // select whole result - appendSubshapeOfResult(theSelected, *aResIt, GeomShapePtr()); + appendSubshapeOfResult(theSelected, aResult, GeomShapePtr()); continue; } @@ -290,7 +288,7 @@ bool findSubshapeByPoint(const std::shared_ptr &theFeature, GeomShapePtr aSubshape = findEdgeByCenter(aCurShape, thePoint, TOLERANCE, aCenterType); if (aSubshape) { - appendSubshapeOfResult(theSelected, *aResIt, aSubshape, aCenterType); + appendSubshapeOfResult(theSelected, aResult, aSubshape, aCenterType); continue; } } @@ -318,9 +316,8 @@ bool findSubshapeByPoint(const std::shared_ptr &theFeature, for (int aSubInd = 0; aSubInd < aNbSubs; ++aSubInd) { FeaturePtr aSub = aCF->subFeature(aSubInd); const std::list &aSubResults = aSub->results(); - for (std::list::const_iterator aSRIt = aSubResults.begin(); - aSRIt != aSubResults.end(); ++aSRIt) { - GeomShapePtr aCurShape = (*aSRIt)->shape(); + for (const auto &aSubResult : aSubResults) { + GeomShapePtr aCurShape = aSubResult->shape(); std::list aSubshapes = findSubShape(aCurShape, theShapeType, thePoint, TOLERANCE); if (!aSubshapes.empty()) { diff --git a/src/ModelHighAPI/ModelHighAPI_Double.cpp b/src/ModelHighAPI/ModelHighAPI_Double.cpp index f7aa0a45b..8ed0e80b7 100644 --- a/src/ModelHighAPI/ModelHighAPI_Double.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Double.cpp @@ -28,7 +28,7 @@ //-------------------------------------------------------------------------------------- ModelHighAPI_Double::ModelHighAPI_Double(double theValue) - : myVariantType(VT_DOUBLE), myDouble(theValue) {} + : myDouble(theValue) {} ModelHighAPI_Double::ModelHighAPI_Double(const std::wstring &theValue) : myVariantType(VT_STRING), myString(theValue) {} @@ -36,7 +36,7 @@ ModelHighAPI_Double::ModelHighAPI_Double(const std::wstring &theValue) ModelHighAPI_Double::ModelHighAPI_Double(const wchar_t *theValue) : myVariantType(VT_STRING), myString(theValue) {} -ModelHighAPI_Double::~ModelHighAPI_Double() {} +ModelHighAPI_Double::~ModelHighAPI_Double() = default; double ModelHighAPI_Double::value() const { // needed for array of double, which supports no text diff --git a/src/ModelHighAPI/ModelHighAPI_Double.h b/src/ModelHighAPI/ModelHighAPI_Double.h index bcd78e78d..0fb9f337f 100644 --- a/src/ModelHighAPI/ModelHighAPI_Double.h +++ b/src/ModelHighAPI/ModelHighAPI_Double.h @@ -68,7 +68,7 @@ public: MODELHIGHAPI_EXPORT virtual std::wstring string() const; private: - enum VariantType { VT_DOUBLE, VT_STRING } myVariantType; + enum VariantType { VT_DOUBLE, VT_STRING } myVariantType{VT_DOUBLE}; double myDouble; std::wstring myString; }; diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index 4aa82da04..a0933f459 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -94,8 +94,7 @@ public: } void mergeBuffer() { - std::list::iterator anIt = - myStorageArray.begin(); + auto anIt = myStorageArray.begin(); for (; anIt != myStorageArray.end(); ++anIt) { // avoid multiple empty lines std::string aBuf = (*anIt)->buffer().str(); @@ -112,8 +111,7 @@ public: if (myStorageArray.empty()) addStorage(DumpStoragePtr(new DumpStorage)); - std::list::iterator anIt = - myStorageArray.begin(); + auto anIt = myStorageArray.begin(); for (; anIt != myStorageArray.end(); ++anIt) (*anIt)->buffer() << theValue; } @@ -177,33 +175,30 @@ public: write(anOutput.str()); } - virtual void - write(const std::shared_ptr &theAttrSelect) { + void write(const std::shared_ptr &theAttrSelect) + override { if (myStorageArray.empty()) addStorage(DumpStoragePtr(new DumpStorage)); - std::list::iterator anIt = - myStorageArray.begin(); + auto anIt = myStorageArray.begin(); for (; anIt != myStorageArray.end(); ++anIt) (*anIt)->write(theAttrSelect); } - virtual void reserveBuffer() { - std::list::iterator anIt = - myStorageArray.begin(); + void reserveBuffer() override { + auto anIt = myStorageArray.begin(); for (; anIt != myStorageArray.end(); ++anIt) (*anIt)->reserveBuffer(); } - virtual void restoreReservedBuffer() { - std::list::iterator anIt = - myStorageArray.begin(); + void restoreReservedBuffer() override { + auto anIt = myStorageArray.begin(); for (; anIt != myStorageArray.end(); ++anIt) (*anIt)->restoreReservedBuffer(); } - virtual bool exportTo(const std::string &theFilename, - const ModulesSet &theUsedModules) { + bool exportTo(const std::string &theFilename, + const ModulesSet &theUsedModules) override { static const std::string THE_EXT = ".py"; std::string aFilenameBase = theFilename; if (aFilenameBase.rfind(THE_EXT) == aFilenameBase.size() - THE_EXT.size()) @@ -211,8 +206,7 @@ public: aFilenameBase.substr(0, aFilenameBase.size() - THE_EXT.size()); bool isOk = true; - std::list::iterator anIt = - myStorageArray.begin(); + auto anIt = myStorageArray.begin(); for (; anIt != myStorageArray.end(); ++anIt) { std::string aFilename = aFilenameBase + (*anIt)->myFilenameSuffix + THE_EXT; @@ -259,9 +253,8 @@ bool ModelHighAPI_Dumper::DumpStorage::exportTo( return false; // standard header imported modules - for (ModulesSet::const_iterator aModIt = theUsedModules.begin(); - aModIt != theUsedModules.end(); ++aModIt) { - aFile << "from " << *aModIt << " import *" << std::endl; + for (const auto &theUsedModule : theUsedModules) { + aFile << "from " << theUsedModule << " import *" << std::endl; } if (!theUsedModules.empty()) aFile << std::endl; @@ -329,7 +322,7 @@ static int possibleSelectionsByPoint(const GeomPointPtr &thePoint, // Find the position of the part, where its features should be inserted. // It will avoid checking of appropriate elements in partSet after the // current part. - std::list::iterator aFIt = aFeatures.begin(); + auto aFIt = aFeatures.begin(); for (; aFIt != aFeatures.end(); ++aFIt) { ResultPartPtr aPartRes = std::dynamic_pointer_cast((*aFIt)->lastResult()); @@ -385,8 +378,7 @@ static int possibleSelectionsByPoint(const GeomPointPtr &thePoint, *aFIt, thePoint, theShape->shapeType(), anApproproate)) { bool isContinue = true; std::list> aCenters; - std::list::iterator anApIt = - anApproproate.begin(); + auto anApIt = anApproproate.begin(); for (; anApIt != anApproproate.end() && isContinue; ++anApIt) { ++aNbPossibleSelections; @@ -509,15 +501,15 @@ void ModelHighAPI_Dumper::DumpStorageWeak::write( static int gCompositeStackDepth = 0; -ModelHighAPI_Dumper *ModelHighAPI_Dumper::mySelf = 0; +ModelHighAPI_Dumper *ModelHighAPI_Dumper::mySelf = nullptr; ModelHighAPI_Dumper::ModelHighAPI_Dumper() - : myDumpStorage(new DumpStorageBuffer), myDumpPostponedInProgress(false) {} + : myDumpStorage(new DumpStorageBuffer) {} ModelHighAPI_Dumper::~ModelHighAPI_Dumper() { delete myDumpStorage; } void ModelHighAPI_Dumper::setInstance(ModelHighAPI_Dumper *theDumper) { - if (mySelf == 0) + if (mySelf == nullptr) mySelf = theDumper; } @@ -557,7 +549,7 @@ const std::string &ModelHighAPI_Dumper::name(const EntityPtr &theEntity, bool theSaveNotDumped, bool theUseEntityName, bool theSetIsDumped) { - EntityNameMap::iterator aFound = myNames.find(theEntity); + auto aFound = myNames.find(theEntity); if (aFound != myNames.end()) { // Set dumped flag for postponed constraints which are without names if (!aFound->second.myIsDumped) @@ -626,8 +618,7 @@ const std::string &ModelHighAPI_Dumper::name(const EntityPtr &theEntity, int aFullIndex = 0; NbFeaturesMap::const_iterator aFIt = myFeatureCount.begin(); for (; aFIt != myFeatureCount.end(); ++aFIt) { - std::map>::const_iterator aFoundKind = - aFIt->second.find(aKind); + auto aFoundKind = aFIt->second.find(aKind); if (aFoundKind != aFIt->second.end()) aFullIndex += aFoundKind->second.first; } @@ -651,7 +642,7 @@ const std::string &ModelHighAPI_Dumper::name(const EntityPtr &theEntity, const std::string & ModelHighAPI_Dumper::parentName(const FeaturePtr &theEntity) { const std::set &aRefs = theEntity->data()->refsToMe(); - std::set::const_iterator aRefIt = aRefs.begin(); + auto aRefIt = aRefs.begin(); for (; aRefIt != aRefs.end(); ++aRefIt) { CompositeFeaturePtr anOwner = std::dynamic_pointer_cast( @@ -671,14 +662,13 @@ void ModelHighAPI_Dumper::saveResultNames(const FeaturePtr &theFeature) { // Save only names of results which is not correspond to default feature name std::list allRes; ModelAPI_Tools::allResults(theFeature, allRes); - for (std::list::iterator aRes = allRes.begin(); - aRes != allRes.end(); aRes++) { + for (auto &allRe : allRes) { std::pair aName = - ModelAPI_Tools::getDefaultName(*aRes, true, true); + ModelAPI_Tools::getDefaultName(allRe, true, true); std::string aDefaultName = Locale::Convert::toString(aName.first); - std::string aResName = Locale::Convert::toString((*aRes)->data()->name()); + std::string aResName = Locale::Convert::toString(allRe->data()->name()); bool isUserDefined = !(isFeatureDefaultName && aDefaultName == aResName); - myNames[*aRes] = EntityName( + myNames[allRe] = EntityName( aResName, (isUserDefined ? aResName : std::string()), !isUserDefined); } } @@ -716,7 +706,7 @@ bool ModelHighAPI_Dumper::process( // iteratively process composite features, // if the composite feature is the last in the document, no need to dump // "model.do()" action - std::list::const_iterator aNext = anObjIt; + auto aNext = anObjIt; isOk = process(aCompFeat, false, ++aNext != anObjects.end()) && isOk; } else if (!isDumped(EntityPtr(*anObjIt))) { // dump folder @@ -868,7 +858,7 @@ void ModelHighAPI_Dumper::dumpSubFeatureNameAndColor( // store results if they have user-defined names or colors std::list aResultsWithNameOrColor; const std::list &aResults = theSubFeature->results(); - std::list::const_iterator aResIt = aResults.begin(); + auto aResIt = aResults.begin(); for (; aResIt != aResults.end(); ++aResIt) { std::string aResName = Locale::Convert::toString((*aResIt)->data()->name()); myNames[*aResIt] = EntityName(aResName, aResName, false); @@ -901,8 +891,8 @@ void ModelHighAPI_Dumper::dumpEntitySetName() { anEntityNames.myIsDefault = true; } // dump "setName" for results - std::list::const_iterator aResIt = aLastDumped.myResults.begin(); - std::list::const_iterator aResEnd = aLastDumped.myResults.end(); + auto aResIt = aLastDumped.myResults.begin(); + auto aResEnd = aLastDumped.myResults.end(); for (; aResIt != aResEnd; ++aResIt) { // set result name EntityName &anEntityNames = myNames[*aResIt]; @@ -954,7 +944,7 @@ void ModelHighAPI_Dumper::dumpEntitySetName() { } bool ModelHighAPI_Dumper::isDumped(const EntityPtr &theEntity) const { - EntityNameMap::const_iterator aFound = myNames.find(theEntity); + auto aFound = myNames.find(theEntity); FeaturePtr aFeature = std::dynamic_pointer_cast(theEntity); return (aFound != myNames.end() && aFound->second.myIsDumped) || myFeaturesToSkip.find(aFeature) != myFeaturesToSkip.end(); @@ -973,7 +963,7 @@ bool ModelHighAPI_Dumper::isDumped( bool ModelHighAPI_Dumper::isDumped( const AttributeRefListPtr &theRefList) const { std::list aRefs = theRefList->list(); - std::list::iterator anIt = aRefs.begin(); + auto anIt = aRefs.begin(); for (; anIt != aRefs.end(); ++anIt) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); if (aFeature && !isDumped(EntityPtr(aFeature))) @@ -1296,11 +1286,10 @@ ModelHighAPI_Dumper::operator<<(const FeaturePtr &theEntity) { std::list aResultsWithNameOrColor; std::list allRes; ModelAPI_Tools::allResults(theEntity, allRes); - for (std::list::iterator aRes = allRes.begin(); - aRes != allRes.end(); aRes++) { - if (!myNames[*aRes].myIsDefault || !isDefaultColor(*aRes) || - !isDefaultDeflection(*aRes) || !isDefaultTransparency(*aRes)) - aResultsWithNameOrColor.push_back(*aRes); + for (auto &allRe : allRes) { + if (!myNames[allRe].myIsDefault || !isDefaultColor(allRe) || + !isDefaultDeflection(allRe) || !isDefaultTransparency(allRe)) + aResultsWithNameOrColor.push_back(allRe); } // store just dumped entity to stack if (myEntitiesStack.empty() || myEntitiesStack.top().myEntity != theEntity) @@ -1325,7 +1314,7 @@ ModelHighAPI_Dumper::operator<<(const ResultPtr &theResult) { if (aParent) { anIndices.push_front(ModelAPI_Tools::bodyIndex(aCurRes)); } else { // index of the result in the feature - std::list::const_iterator aRes = aFeature->results().cbegin(); + auto aRes = aFeature->results().cbegin(); for (int anIndex = 0; aRes != aFeature->results().cend(); aRes++, anIndex++) { if (*aRes == aCurRes) { @@ -1338,8 +1327,7 @@ ModelHighAPI_Dumper::operator<<(const ResultPtr &theResult) { } *myDumpStorage << name(aFeature); - for (std::list::iterator anI = anIndices.begin(); anI != anIndices.end(); - anI++) { + for (auto anI = anIndices.begin(); anI != anIndices.end(); anI++) { if (anI == anIndices.begin()) { if (*anI == 0) { *myDumpStorage << ".result()"; @@ -1357,8 +1345,7 @@ ModelHighAPI_Dumper::operator<<(const ResultPtr &theResult) { ModelHighAPI_Dumper & ModelHighAPI_Dumper::operator<<(const std::list &theResults) { *this << "["; - for (std::list::const_iterator anIt = theResults.begin(); - anIt != theResults.end(); ++anIt) { + for (auto anIt = theResults.begin(); anIt != theResults.end(); ++anIt) { if (anIt != theResults.begin()) *this << ", "; *this << *anIt; @@ -1546,8 +1533,8 @@ ModelHighAPI_Dumper &ModelHighAPI_Dumper::operator<<( anOwner->data()->attributes(ModelAPI_AttributeSelectionList::typeId()); if (aSelLists.size() > 1) { int anIndex = 1; - for (std::list::iterator aSIt = aSelLists.begin(); - aSIt != aSelLists.end(); ++aSIt, ++anIndex) + for (auto aSIt = aSelLists.begin(); aSIt != aSelLists.end(); + ++aSIt, ++anIndex) if ((*aSIt).get() == theAttrSelList.get()) break; std::ostringstream aSStream; @@ -1618,7 +1605,7 @@ operator<<(ModelHighAPI_Dumper &theDumper, std::set aNotDumped = theDumper.myNotDumpedEntities; theDumper.clearNotDumped(); theDumper.myDumpStorage->reserveBuffer(); - std::set::const_iterator anIt = aNotDumped.begin(); + auto anIt = aNotDumped.begin(); for (; anIt != aNotDumped.end(); ++anIt) { // if the feature is composite, dump it with all subs CompositeFeaturePtr aCompFeat = @@ -1632,7 +1619,7 @@ operator<<(ModelHighAPI_Dumper &theDumper, AttributeBooleanPtr aCopyAttr = aFeature->boolean("Copy"); if (aCopyAttr.get() && aCopyAttr->value()) { const std::set &aRefs = aFeature->data()->refsToMe(); - std::set::iterator aRefIt = aRefs.begin(); + auto aRefIt = aRefs.begin(); for (; aRefIt != aRefs.end(); ++aRefIt) if ((*aRefIt)->id() == "ProjectedFeature") { // process projection only @@ -1656,7 +1643,7 @@ operator<<(ModelHighAPI_Dumper &theDumper, void ModelHighAPI_Dumper::exportVariables() const { DocumentPtr aRoot = ModelAPI_Session::get()->moduleDocument(); - EntityNameMap::const_iterator aNameIter = myNames.cbegin(); + auto aNameIter = myNames.cbegin(); for (; aNameIter != myNames.end(); aNameIter++) { FeaturePtr aFeature = std::dynamic_pointer_cast(aNameIter->first); diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.h b/src/ModelHighAPI/ModelHighAPI_Dumper.h index c7403407e..67a71f7c1 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.h +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.h @@ -412,8 +412,8 @@ protected: MODELHIGHAPI_EXPORT void dumpEntitySetName(); private: - ModelHighAPI_Dumper(const ModelHighAPI_Dumper &); - const ModelHighAPI_Dumper &operator=(const ModelHighAPI_Dumper &); + ModelHighAPI_Dumper(const ModelHighAPI_Dumper &) = delete; + const ModelHighAPI_Dumper &operator=(const ModelHighAPI_Dumper &) = delete; /// Iterate all features in document and dump them into intermediate buffer bool process(const std::shared_ptr &theDoc); @@ -492,7 +492,8 @@ private: std::list myPostponed; ///< list of postponed entities (sketch ///< constraints or folders) - bool myDumpPostponedInProgress; ///< processing postponed is in progress + bool myDumpPostponedInProgress{ + false}; ///< processing postponed is in progress std::string myDumpDir; diff --git a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp index 2fe2acecf..6857b3520 100644 --- a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp +++ b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp @@ -66,7 +66,7 @@ ModelHighAPI_FeatureStore::ModelHighAPI_FeatureStore(ObjectPtr theObject) { // iterate results to store std::list allResults; ModelAPI_Tools::allResults(aFeature, allResults); - std::list::iterator aRes = allResults.begin(); + auto aRes = allResults.begin(); for (; aRes != allResults.end(); aRes++) { std::map aResDump; storeData((*aRes)->data(), aResDump); @@ -86,9 +86,8 @@ std::string ModelHighAPI_FeatureStore::compare(ObjectPtr theObject) { if (aFeature) { std::list allResults; ModelAPI_Tools::allResults(aFeature, allResults); - std::list::iterator aRes = allResults.begin(); - std::list>::iterator aResIter = - myRes.begin(); + auto aRes = allResults.begin(); + auto aResIter = myRes.begin(); for (; aRes != allResults.end() && aResIter != myRes.end(); aRes++, aResIter++) { anError = compareData((*aRes)->data(), *aResIter); @@ -117,8 +116,7 @@ void ModelHighAPI_FeatureStore::storeData( theAttrs["__name__"] = Locale::Convert::toString(theData->name()); std::list> allAttrs = theData->attributes(""); - std::list>::iterator anAttr = - allAttrs.begin(); + auto anAttr = allAttrs.begin(); for (; anAttr != allAttrs.end(); anAttr++) { theAttrs[(*anAttr)->id()] = dumpAttr(*anAttr); } @@ -135,7 +133,7 @@ std::string ModelHighAPI_FeatureStore::compareData( std::map &theAttrs) { std::map aThis; storeData(theData, aThis); - std::map::iterator aThisIter = aThis.begin(); + auto aThisIter = aThis.begin(); for (; aThisIter != aThis.end(); aThisIter++) { if (theAttrs.find(aThisIter->first) == theAttrs.end()) { return "original model had no attribute '" + aThisIter->first + "'"; @@ -147,7 +145,7 @@ std::string ModelHighAPI_FeatureStore::compareData( } } // iterate back to find lack attribute in the current model - std::map::iterator anOrigIter = theAttrs.begin(); + auto anOrigIter = theAttrs.begin(); for (; anOrigIter != theAttrs.end(); anOrigIter++) { if (aThis.find(anOrigIter->first) == aThis.end()) { return "current model had no attribute '" + anOrigIter->first + "'"; @@ -315,34 +313,32 @@ std::string ModelHighAPI_FeatureStore::dumpAttr(const AttributePtr &theAttr) { ->getKind() == "Sketch"; std::list aList = anAttr->list(); std::list aResList; // list of resulting strings - for (std::list::iterator aL = aList.begin(); aL != aList.end(); - aL++) { - if (aL->get()) { + for (auto &aL : aList) { + if (aL.get()) { if (isSketchFeatures) { // do not control construction features of an ellipse and other - FeaturePtr aFeature = ModelAPI_Feature::feature(*aL); + FeaturePtr aFeature = ModelAPI_Feature::feature(aL); // if (aFeature->getKind() == "SketchConstraintCoincidenceInternal") // continue; // skip internal constraints std::string aStr = aFeature->getKind().substr(0, 16); if (aStr == "SketchConstraint") continue; // no need to dump and check constraints } - aResList.push_back(Locale::Convert::toString((*aL)->data()->name())); + aResList.push_back(Locale::Convert::toString(aL->data()->name())); } else if (!isSketchFeatures) { aResList.push_back("__empty__"); } } if (isSketchFeatures) aResList.sort(); - for (std::list::iterator aR = aResList.begin(); - aR != aResList.end(); aR++) { - aResult << *aR << " "; + for (auto &aR : aResList) { + aResult << aR << " "; } } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { AttributeRefAttrListPtr anAttr = std::dynamic_pointer_cast(theAttr); std::list> aList = anAttr->list(); - std::list>::iterator aL = aList.begin(); + auto aL = aList.begin(); for (; aL != aList.end(); aL++) { if (aL != aList.begin()) aResult << " "; diff --git a/src/ModelHighAPI/ModelHighAPI_FeatureStore.h b/src/ModelHighAPI/ModelHighAPI_FeatureStore.h index fb7e6d58d..701a055e6 100644 --- a/src/ModelHighAPI/ModelHighAPI_FeatureStore.h +++ b/src/ModelHighAPI/ModelHighAPI_FeatureStore.h @@ -34,7 +34,7 @@ class GeomAPI_Shape; class ModelAPI_Attribute; typedef std::shared_ptr ObjectPtr; -typedef std::shared_ptr AttributePtr; +using AttributePtr = std::shared_ptr; /**\class ModelHighAPI_FeatureStore * \ingroup CPPHighAPI @@ -48,7 +48,7 @@ class ModelHighAPI_FeatureStore { public: // unused constructor for the map container needs - ModelHighAPI_FeatureStore() {} + ModelHighAPI_FeatureStore() = default; // constructor that initializes this object by feature to store ModelHighAPI_FeatureStore(ObjectPtr theObject); // compares the stored feature information with the given feature diff --git a/src/ModelHighAPI/ModelHighAPI_Folder.cpp b/src/ModelHighAPI/ModelHighAPI_Folder.cpp index 3dbb194dc..ea93caab3 100644 --- a/src/ModelHighAPI/ModelHighAPI_Folder.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Folder.cpp @@ -35,7 +35,7 @@ ModelHighAPI_Folder::ModelHighAPI_Folder( initialize(); } -ModelHighAPI_Folder::~ModelHighAPI_Folder() {} +ModelHighAPI_Folder::~ModelHighAPI_Folder() = default; bool ModelHighAPI_Folder::initialize() { if (!myFolder) { diff --git a/src/ModelHighAPI/ModelHighAPI_Folder.h b/src/ModelHighAPI/ModelHighAPI_Folder.h index 5b8a828cb..484f083f7 100644 --- a/src/ModelHighAPI/ModelHighAPI_Folder.h +++ b/src/ModelHighAPI/ModelHighAPI_Folder.h @@ -43,7 +43,7 @@ public: explicit ModelHighAPI_Folder( const std::shared_ptr &theFolder); /// Destructor - MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_Folder(); + MODELHIGHAPI_EXPORT ~ModelHighAPI_Folder() override; static std::string ID() { return ModelAPI_Folder::ID(); } virtual std::string getID() { return ID(); } @@ -72,7 +72,7 @@ public: // MODELHIGHAPI_EXPORT void execute(); /// Dump wrapped feature - MODELHIGHAPI_EXPORT virtual void dump(ModelHighAPI_Dumper &theDumper) const; + MODELHIGHAPI_EXPORT void dump(ModelHighAPI_Dumper &theDumper) const override; protected: bool initialize(); diff --git a/src/ModelHighAPI/ModelHighAPI_Integer.cpp b/src/ModelHighAPI/ModelHighAPI_Integer.cpp index e545e4429..bf174cff5 100644 --- a/src/ModelHighAPI/ModelHighAPI_Integer.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Integer.cpp @@ -26,8 +26,7 @@ //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- -ModelHighAPI_Integer::ModelHighAPI_Integer(int theValue) - : myVariantType(VT_INT), myInt(theValue) {} +ModelHighAPI_Integer::ModelHighAPI_Integer(int theValue) : myInt(theValue) {} ModelHighAPI_Integer::ModelHighAPI_Integer(const std::wstring &theValue) : myVariantType(VT_STRING), myString(theValue) {} @@ -35,7 +34,7 @@ ModelHighAPI_Integer::ModelHighAPI_Integer(const std::wstring &theValue) ModelHighAPI_Integer::ModelHighAPI_Integer(const wchar_t *theValue) : myVariantType(VT_STRING), myString(theValue) {} -ModelHighAPI_Integer::~ModelHighAPI_Integer() {} +ModelHighAPI_Integer::~ModelHighAPI_Integer() = default; //-------------------------------------------------------------------------------------- void ModelHighAPI_Integer::fillAttribute( diff --git a/src/ModelHighAPI/ModelHighAPI_Integer.h b/src/ModelHighAPI/ModelHighAPI_Integer.h index f443d6ea2..e109a0d2c 100644 --- a/src/ModelHighAPI/ModelHighAPI_Integer.h +++ b/src/ModelHighAPI/ModelHighAPI_Integer.h @@ -60,7 +60,7 @@ public: MODELHIGHAPI_EXPORT virtual std::wstring string() const; private: - enum VariantType { VT_INT, VT_STRING } myVariantType; + enum VariantType { VT_INT, VT_STRING } myVariantType{VT_INT}; int myInt; std::wstring myString; }; diff --git a/src/ModelHighAPI/ModelHighAPI_RefAttr.cpp b/src/ModelHighAPI/ModelHighAPI_RefAttr.cpp index 74c31c523..6e5817773 100644 --- a/src/ModelHighAPI/ModelHighAPI_RefAttr.cpp +++ b/src/ModelHighAPI/ModelHighAPI_RefAttr.cpp @@ -27,7 +27,7 @@ #include #include //-------------------------------------------------------------------------------------- -ModelHighAPI_RefAttr::ModelHighAPI_RefAttr() : myVariantType(VT_OBJECT) {} +ModelHighAPI_RefAttr::ModelHighAPI_RefAttr() {} ModelHighAPI_RefAttr::ModelHighAPI_RefAttr( const std::shared_ptr &theValue) @@ -42,7 +42,7 @@ ModelHighAPI_RefAttr::ModelHighAPI_RefAttr( : myVariantType(VT_OBJECT), myObject(std::shared_ptr(theValue->defaultResult())) {} -ModelHighAPI_RefAttr::~ModelHighAPI_RefAttr() {} +ModelHighAPI_RefAttr::~ModelHighAPI_RefAttr() = default; //-------------------------------------------------------------------------------------- void ModelHighAPI_RefAttr::fillAttribute( diff --git a/src/ModelHighAPI/ModelHighAPI_RefAttr.h b/src/ModelHighAPI/ModelHighAPI_RefAttr.h index 0577258bd..570da0ad8 100644 --- a/src/ModelHighAPI/ModelHighAPI_RefAttr.h +++ b/src/ModelHighAPI/ModelHighAPI_RefAttr.h @@ -77,7 +77,7 @@ public: std::shared_ptr object() const { return myObject; } private: - enum VariantType { VT_ATTRIBUTE, VT_OBJECT } myVariantType; + enum VariantType { VT_ATTRIBUTE, VT_OBJECT } myVariantType{VT_OBJECT}; std::shared_ptr myAttribute; std::shared_ptr myObject; }; diff --git a/src/ModelHighAPI/ModelHighAPI_Selection.cpp b/src/ModelHighAPI/ModelHighAPI_Selection.cpp index f271e739f..bb6ee66d4 100644 --- a/src/ModelHighAPI/ModelHighAPI_Selection.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Selection.cpp @@ -32,7 +32,7 @@ //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- -ModelHighAPI_Selection::ModelHighAPI_Selection() : myVariantType(VT_Empty) {} +ModelHighAPI_Selection::ModelHighAPI_Selection() {} ModelHighAPI_Selection::ModelHighAPI_Selection( const std::shared_ptr &theContext, @@ -55,7 +55,7 @@ ModelHighAPI_Selection::ModelHighAPI_Selection( : myVariantType(VT_TypeInnerPointPair) { double aCoordinates[3] = {0.0, 0.0, 0.0}; double *aCIt = aCoordinates; - std::list::const_iterator aPIt = theSubShapeInnerPoint.begin(); + auto aPIt = theSubShapeInnerPoint.begin(); for (; aPIt != theSubShapeInnerPoint.end(); ++aPIt, ++aCIt) *aCIt = *aPIt; @@ -73,7 +73,7 @@ ModelHighAPI_Selection::ModelHighAPI_Selection( std::pair(theContextName, theIndex)) { } -ModelHighAPI_Selection::~ModelHighAPI_Selection() {} +ModelHighAPI_Selection::~ModelHighAPI_Selection() = default; //-------------------------------------------------------------------------------------- void ModelHighAPI_Selection::fillAttribute( diff --git a/src/ModelHighAPI/ModelHighAPI_Selection.h b/src/ModelHighAPI/ModelHighAPI_Selection.h index 1b86084eb..491675372 100644 --- a/src/ModelHighAPI/ModelHighAPI_Selection.h +++ b/src/ModelHighAPI/ModelHighAPI_Selection.h @@ -157,7 +157,7 @@ public: ModelHighAPI_Selection subResult(int theIndex) const; protected: - VariantType myVariantType; + VariantType myVariantType{VT_Empty}; ResultSubShapePair myResultSubShapePair; TypeSubShapeNamePair myTypeSubShapeNamePair; TypeInnerPointPair myTypeInnerPointPair; diff --git a/src/ModelHighAPI/ModelHighAPI_Tools.cpp b/src/ModelHighAPI/ModelHighAPI_Tools.cpp index 2f896a5e4..c84680d1c 100644 --- a/src/ModelHighAPI/ModelHighAPI_Tools.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Tools.cpp @@ -135,8 +135,8 @@ void fillAttribute( const std::list &theValue, const std::shared_ptr &theAttribute) { theAttribute->clear(); - for (auto it = theValue.begin(); it != theValue.end(); ++it) - it->appendToList(theAttribute); + for (const auto &it : theValue) + it.appendToList(theAttribute); } //-------------------------------------------------------------------------------------- @@ -151,8 +151,8 @@ void fillAttribute( const std::list &theValue, const std::shared_ptr &theAttribute) { theAttribute->clear(); - for (auto it = theValue.begin(); it != theValue.end(); ++it) - it->appendToList(theAttribute); + for (const auto &it : theValue) + it.appendToList(theAttribute); } //-------------------------------------------------------------------------------------- @@ -187,9 +187,9 @@ void fillAttribute( const std::list &theValue, const std::shared_ptr &theAttribute) { theAttribute->clear(); - for (auto it = theValue.begin(); it != theValue.end(); ++it) { - if (it->resultSubShapePair().first) - theAttribute->append(it->resultSubShapePair().first); // use only context + for (const auto &it : theValue) { + if (it.resultSubShapePair().first) + theAttribute->append(it.resultSubShapePair().first); // use only context } } @@ -212,8 +212,8 @@ void fillAttribute( theAttribute->setSelectionType(strByShapeType(aSelectionType)); } - for (auto it = theValue.begin(); it != theValue.end(); ++it) - it->appendToList(theAttribute); + for (const auto &it : theValue) + it.appendToList(theAttribute); } //-------------------------------------------------------------------------------------- @@ -455,7 +455,7 @@ std::string storeFeatures( // process all objects (features and folders) std::list allObjects = theDoc->allObjects(); - std::list::iterator allIter = allObjects.begin(); + auto allIter = allObjects.begin(); for (; allIter != allObjects.end(); allIter++) { ObjectPtr anObject = *allIter; FeaturePtr aFeature = std::dynamic_pointer_cast(anObject); @@ -468,8 +468,7 @@ std::string storeFeatures( continue; // no need to dump and check constraints } if (theCompare) { - std::map::iterator anObjFind = - aDocFind->second.find(anObject->data()->name()); + auto anObjFind = aDocFind->second.find(anObject->data()->name()); if (anObjFind == aDocFind->second.end()) { return "Document '" + Locale::Convert::toString(theDocName) + "' feature '" + @@ -493,7 +492,7 @@ std::string storeFeatures( // iterate all results of this feature std::list allResults; ModelAPI_Tools::allResults(aFeature, allResults); - std::list::iterator aRes = allResults.begin(); + auto aRes = allResults.begin(); for (; aRes != allResults.end(); aRes++) { // recursively store features of sub-documents if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) { diff --git a/src/ModuleBase/ModuleBase_ActionInfo.cpp b/src/ModuleBase/ModuleBase_ActionInfo.cpp index 08e56f708..1c3554547 100644 --- a/src/ModuleBase/ModuleBase_ActionInfo.cpp +++ b/src/ModuleBase/ModuleBase_ActionInfo.cpp @@ -36,7 +36,7 @@ ModuleBase_ActionInfo::ModuleBase_ActionInfo(const QIcon &theIcon, text = theText; } -ModuleBase_ActionInfo::~ModuleBase_ActionInfo() {} +ModuleBase_ActionInfo::~ModuleBase_ActionInfo() = default; void ModuleBase_ActionInfo::initFrom(QAction *theAction) { // By convenience, QAction for a feature keeps feature's id as data diff --git a/src/ModuleBase/ModuleBase_ActionIntParameter.h b/src/ModuleBase/ModuleBase_ActionIntParameter.h index 5af983fc9..9162dae47 100644 --- a/src/ModuleBase/ModuleBase_ActionIntParameter.h +++ b/src/ModuleBase/ModuleBase_ActionIntParameter.h @@ -34,6 +34,6 @@ private: int myVal; }; -typedef std::shared_ptr ActionIntParamPtr; +using ActionIntParamPtr = std::shared_ptr; #endif diff --git a/src/ModuleBase/ModuleBase_BRepOwner.h b/src/ModuleBase/ModuleBase_BRepOwner.h index a21244fe0..109bd2335 100644 --- a/src/ModuleBase/ModuleBase_BRepOwner.h +++ b/src/ModuleBase/ModuleBase_BRepOwner.h @@ -51,10 +51,9 @@ public: /// \param aPM a presentations manager /// \param theStyle a style of presentation /// \param theMode a drawing mode - virtual void HilightWithColor(const Handle(PrsMgr_PresentationManager3d) & - aPM, - const Handle(Prs3d_Drawer) & theStyle, - const Standard_Integer /*theMode*/ = 0) { + void HilightWithColor(const Handle(PrsMgr_PresentationManager3d) & aPM, + const Handle(Prs3d_Drawer) & theStyle, + const Standard_Integer /*theMode*/ = 0) override { Selectable()->HilightOwnerWithColor(aPM, theStyle, this); } diff --git a/src/ModuleBase/ModuleBase_ChoiceCtrl.cpp b/src/ModuleBase/ModuleBase_ChoiceCtrl.cpp index fab50e4e9..56efebe08 100644 --- a/src/ModuleBase/ModuleBase_ChoiceCtrl.cpp +++ b/src/ModuleBase/ModuleBase_ChoiceCtrl.cpp @@ -39,7 +39,7 @@ ModuleBase_ChoiceCtrl::ModuleBase_ChoiceCtrl(QWidget *theParent, ControlType theType, Qt::Orientation theButtonsDir) : QWidget(theParent), myType(theType) { - QHBoxLayout *aLayout = new QHBoxLayout(this); + auto *aLayout = new QHBoxLayout(this); aLayout->setContentsMargins(0, 0, 0, 0); switch (myType) { @@ -48,7 +48,7 @@ ModuleBase_ChoiceCtrl::ModuleBase_ChoiceCtrl(QWidget *theParent, myGroupBox = new QGroupBox("", this); aLayout->addWidget(myGroupBox); - QLayout *aBtnLayout = 0; + QLayout *aBtnLayout = nullptr; switch (theButtonsDir) { case Qt::Horizontal: aBtnLayout = new QHBoxLayout(myGroupBox); @@ -62,7 +62,7 @@ ModuleBase_ChoiceCtrl::ModuleBase_ChoiceCtrl(QWidget *theParent, if (theIconsList.length() == theChoiceList.length()) { int aId = 0; foreach (QString aBtnTxt, theChoiceList) { - QToolButton *aBtn = new QToolButton(myGroupBox); + auto *aBtn = new QToolButton(myGroupBox); aBtn->setFocusPolicy(Qt::StrongFocus); aBtn->setCheckable(true); aBtn->setToolTip(aBtnTxt); @@ -79,7 +79,7 @@ ModuleBase_ChoiceCtrl::ModuleBase_ChoiceCtrl(QWidget *theParent, } else { int aId = 0; foreach (QString aBtnTxt, theChoiceList) { - QRadioButton *aBtn = new QRadioButton(aBtnTxt, myGroupBox); + auto *aBtn = new QRadioButton(aBtnTxt, myGroupBox); aBtnLayout->addWidget(aBtn); myButtons->addButton(aBtn, aId++); } diff --git a/src/ModuleBase/ModuleBase_Dialog.cpp b/src/ModuleBase/ModuleBase_Dialog.cpp index 8f053173c..1dbc8e653 100644 --- a/src/ModuleBase/ModuleBase_Dialog.cpp +++ b/src/ModuleBase/ModuleBase_Dialog.cpp @@ -43,7 +43,8 @@ ModuleBase_Dialog::ModuleBase_Dialog(ModuleBase_IWorkshop *theParent, : QDialog(theParent->desktop(), Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), - myDescription(theDescription), myWorkshop(theParent), myActiveWidget(0) { + myDescription(theDescription), myWorkshop(theParent), + myActiveWidget(nullptr) { Config_WidgetAPI aApi(myDescription, ""); myId = aApi.getProperty("id"); @@ -66,21 +67,21 @@ ModuleBase_Dialog::ModuleBase_Dialog(ModuleBase_IWorkshop *theParent, Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); - QVBoxLayout *aLayout = new QVBoxLayout(this); + auto *aLayout = new QVBoxLayout(this); aLayout->setContentsMargins(0, 0, 0, 0); aLayout->setSpacing(1); - ModuleBase_PageWidget *aPage = new ModuleBase_PageWidget(this); + auto *aPage = new ModuleBase_PageWidget(this); aLayout->addWidget(aPage); aFactory.createWidget(aPage, false); myWidgets = aFactory.getModelWidgets(); - QFrame *aFrame = new QFrame(this); + auto *aFrame = new QFrame(this); aFrame->setFrameStyle(QFrame::WinPanel | QFrame::Raised); aLayout->addWidget(aFrame); - QHBoxLayout *aBtnLayout = new QHBoxLayout(aFrame); + auto *aBtnLayout = new QHBoxLayout(aFrame); ModuleBase_Tools::adjustMargins(aBtnLayout); myButtonsBox = new QDialogButtonBox( @@ -105,8 +106,7 @@ ModuleBase_Dialog::ModuleBase_Dialog(ModuleBase_IWorkshop *theParent, } void ModuleBase_Dialog::initializeWidget(ModuleBase_ModelWidget *theWidget) { - ModuleBase_ModelDialogWidget *aDlgWgt = - dynamic_cast(theWidget); + auto *aDlgWgt = dynamic_cast(theWidget); if (aDlgWgt) aDlgWgt->setDialogButtons(myButtonsBox); diff --git a/src/ModuleBase/ModuleBase_Dialog.h b/src/ModuleBase/ModuleBase_Dialog.h index 082a1a094..0dca2f809 100644 --- a/src/ModuleBase/ModuleBase_Dialog.h +++ b/src/ModuleBase/ModuleBase_Dialog.h @@ -46,11 +46,11 @@ public: const std::string &theDescription); /// Redefinition of virtual method - virtual void accept(); + void accept() override; protected: /// Redefinition of virtual method - virtual void showEvent(QShowEvent *theEvent); + void showEvent(QShowEvent *theEvent) override; private slots: void onHelpRequest(); diff --git a/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp b/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp index 1ab86ada1..5541cac0d 100644 --- a/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_DoubleSpinBox.cpp @@ -74,7 +74,7 @@ const double PSEUDO_ZERO = 1.e-20; */ ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget *theParent, int thePrecision) - : QDoubleSpinBox(theParent), myCleared(false) { + : QDoubleSpinBox(theParent) { setLocale(ModuleBase_Tools::doubleLocale()); // MPV 15/09/2014: this must be set before setDecimals; @@ -95,7 +95,7 @@ ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget *theParent, /*! \brief Destructor. */ -ModuleBase_DoubleSpinBox::~ModuleBase_DoubleSpinBox() {} +ModuleBase_DoubleSpinBox::~ModuleBase_DoubleSpinBox() = default; /*! \brief Check if spin box is in the "cleared" state. @@ -236,7 +236,7 @@ QValidator::State ModuleBase_DoubleSpinBox::validate(QString &str, uint overhead = pref.length() + suff.length(); QValidator::State state = QValidator::Invalid; - QDoubleValidator v(NULL); + QDoubleValidator v(nullptr); // If 'g' format is used (myPrecision < 0), then // myPrecision - 1 digits are allowed after the decimal point. diff --git a/src/ModuleBase/ModuleBase_DoubleSpinBox.h b/src/ModuleBase/ModuleBase_DoubleSpinBox.h index 93853f4ea..d578b82a6 100644 --- a/src/ModuleBase/ModuleBase_DoubleSpinBox.h +++ b/src/ModuleBase/ModuleBase_DoubleSpinBox.h @@ -83,7 +83,7 @@ private: bool myIsEmitKeyPressEvent; /// Is clear flag - bool myCleared; + bool myCleared{false}; /// Precision value int myPrecision; diff --git a/src/ModuleBase/ModuleBase_FilterValidated.cpp b/src/ModuleBase/ModuleBase_FilterValidated.cpp index b80ce6d5f..8cf82d3ba 100644 --- a/src/ModuleBase/ModuleBase_FilterValidated.cpp +++ b/src/ModuleBase/ModuleBase_FilterValidated.cpp @@ -51,7 +51,7 @@ Standard_Boolean ModuleBase_FilterValidated::IsOk( myWorkshop->selection()->fillPresentation(aPrs, theOwner); if (aPrs->isEmpty()) return false; - ModuleBase_WidgetValidated *aWidgetValidated = + auto *aWidgetValidated = dynamic_cast(aCurrentWidget); if (aWidgetValidated) aValid = diff --git a/src/ModuleBase/ModuleBase_IErrorMgr.cpp b/src/ModuleBase/ModuleBase_IErrorMgr.cpp index f29a1203c..932ea809a 100644 --- a/src/ModuleBase/ModuleBase_IErrorMgr.cpp +++ b/src/ModuleBase/ModuleBase_IErrorMgr.cpp @@ -24,9 +24,9 @@ #include "ModuleBase_ModelWidget.h" ModuleBase_IErrorMgr::ModuleBase_IErrorMgr(QObject *theParent /*= 0*/) - : QObject(theParent), myPropertyPanel(NULL) {} + : QObject(theParent), myPropertyPanel(nullptr) {} -ModuleBase_IErrorMgr::~ModuleBase_IErrorMgr() {} +ModuleBase_IErrorMgr::~ModuleBase_IErrorMgr() = default; void ModuleBase_IErrorMgr::setPropertyPanel( ModuleBase_IPropertyPanel *theProp) { diff --git a/src/ModuleBase/ModuleBase_IErrorMgr.h b/src/ModuleBase/ModuleBase_IErrorMgr.h index 56087701d..5f410eb95 100644 --- a/src/ModuleBase/ModuleBase_IErrorMgr.h +++ b/src/ModuleBase/ModuleBase_IErrorMgr.h @@ -40,9 +40,9 @@ class MODULEBASE_EXPORT ModuleBase_IErrorMgr : public QObject { public: /// Default constructor /// \param theParent a parent object - ModuleBase_IErrorMgr(QObject *theParent = 0); + ModuleBase_IErrorMgr(QObject *theParent = nullptr); /// Virtual destructor - virtual ~ModuleBase_IErrorMgr(); + ~ModuleBase_IErrorMgr() override; /// \brief Set property pane to the operation /// \param theProp a property panel instance diff --git a/src/ModuleBase/ModuleBase_IModule.cpp b/src/ModuleBase/ModuleBase_IModule.cpp index 7a426890d..12440a48d 100644 --- a/src/ModuleBase/ModuleBase_IModule.cpp +++ b/src/ModuleBase/ModuleBase_IModule.cpp @@ -113,9 +113,8 @@ void ModuleBase_IModule::launchOperation(const QString &theCmdId, QList aPreSelected = aSelection->getSelected(ModuleBase_ISelection::AllControls); - ModuleBase_OperationFeature *aCurOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aCurOperation = dynamic_cast( + myWorkshop->currentOperation()); QString aCurOperationKind = aCurOperation ? aCurOperation->getDescription()->operationId() : ""; @@ -164,12 +163,12 @@ void ModuleBase_IModule::launchOperation(const QString &theCmdId, } AISObjectPtr -ModuleBase_IModule::createPresentation(const ObjectPtr &theResult) { +ModuleBase_IModule::createPresentation(const ObjectPtr & /*theResult*/) { return AISObjectPtr(); } bool ModuleBase_IModule::canBeShaded(Handle(AIS_InteractiveObject) - theAIS) const { + /*theAIS*/) const { return true; } @@ -189,14 +188,12 @@ ModuleBase_IModule::getNewOperation(const std::string &theFeatureId) { ModuleBase_Operation * ModuleBase_IModule::createOperation(const std::string &theFeatureId) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - getNewOperation(theFeatureId)); + auto *aFOperation = dynamic_cast( + getNewOperation(theFeatureId)); // If the operation is launched as sub-operation of another then we have to // initialize parent feature - ModuleBase_OperationFeature *aCurOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aCurOperation = dynamic_cast( + myWorkshop->currentOperation()); if (aCurOperation) { FeaturePtr aFeature = aCurOperation->feature(); CompositeFeaturePtr aCompFeature = @@ -228,28 +225,26 @@ void ModuleBase_IModule::createFeatures() { } void ModuleBase_IModule::processProprietaryFeatures() { - std::set::iterator it = myFeaturesValidLicense.begin(); + auto it = myFeaturesValidLicense.begin(); while (it != myFeaturesValidLicense.end()) { - std::map::iterator aFound = - myProprietaryFeatures.find(*it); + auto aFound = myProprietaryFeatures.find(*it); if (aFound == myProprietaryFeatures.end()) ++it; else { myFeaturesInFiles[aFound->first] = aFound->second; myProprietaryFeatures.erase(aFound); - std::set::iterator aRemoveIt = it++; + auto aRemoveIt = it++; myFeaturesValidLicense.erase(aRemoveIt); } } } void ModuleBase_IModule::loadProprietaryPlugins() { - for (std::set::const_iterator itP = myProprietaryPlugins.begin(); - itP != myProprietaryPlugins.end(); ++itP) { - if (!ModelAPI_Session::get()->checkLicense(*itP)) - Events_InfoMessage(*itP, + for (const auto &myProprietaryPlugin : myProprietaryPlugins) { + if (!ModelAPI_Session::get()->checkLicense(myProprietaryPlugin)) + Events_InfoMessage(myProprietaryPlugin, "License of %1 plugin is not valid or not exist!") - .arg(*itP) + .arg(myProprietaryPlugin) .send(); } } @@ -259,11 +254,12 @@ void ModuleBase_IModule::actionCreated(QAction *theFeature) { SLOT(onFeatureTriggered())); } -bool ModuleBase_IModule::canEraseObject(const ObjectPtr &theObject) const { +bool ModuleBase_IModule::canEraseObject(const ObjectPtr & /*theObject*/) const { return true; } -bool ModuleBase_IModule::canDisplayObject(const ObjectPtr &theObject) const { +bool ModuleBase_IModule::canDisplayObject( + const ObjectPtr & /*theObject*/) const { return true; } @@ -296,7 +292,7 @@ bool ModuleBase_IModule::canRedo() const { } void ModuleBase_IModule::onFeatureTriggered() { - QAction *aCmd = dynamic_cast(sender()); + auto *aCmd = dynamic_cast(sender()); // Do nothing on uncheck if (aCmd->isCheckable() && !aCmd->isChecked()) { ModuleBase_Operation *anOperation = @@ -325,7 +321,7 @@ void ModuleBase_IModule::editFeature(FeaturePtr theFeature) { if (!myWorkshop->canStartOperation(aFeatureId.c_str(), isCommitted)) return; - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(createOperation(aFeatureId)); if (aFOperation) { aFOperation->setFeature(theFeature); @@ -335,9 +331,8 @@ void ModuleBase_IModule::editFeature(FeaturePtr theFeature) { bool ModuleBase_IModule::canActivateSelection( const ObjectPtr &theObject) const { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aFOperation = dynamic_cast( + myWorkshop->currentOperation()); return !aFOperation || !aFOperation->hasObject(theObject); } @@ -379,8 +374,7 @@ void ModuleBase_IModule::registerSelectionFilter( //****************************************************** Handle(SelectMgr_Filter) ModuleBase_IModule::selectionFilter(const int theType) { - ModuleBase_SelectionFilterType aType = - (ModuleBase_SelectionFilterType)theType; + auto aType = (ModuleBase_SelectionFilterType)theType; if (mySelectionFilters.find(aType) != mySelectionFilters.end()) return mySelectionFilters[aType]; diff --git a/src/ModuleBase/ModuleBase_IPrefMgr.cpp b/src/ModuleBase/ModuleBase_IPrefMgr.cpp index fc5f4fa1b..03140f939 100644 --- a/src/ModuleBase/ModuleBase_IPrefMgr.cpp +++ b/src/ModuleBase/ModuleBase_IPrefMgr.cpp @@ -20,6 +20,6 @@ #include "ModuleBase_IPrefMgr.h" -ModuleBase_IPrefMgr::ModuleBase_IPrefMgr() {} +ModuleBase_IPrefMgr::ModuleBase_IPrefMgr() = default; -ModuleBase_IPrefMgr::~ModuleBase_IPrefMgr() {} +ModuleBase_IPrefMgr::~ModuleBase_IPrefMgr() = default; diff --git a/src/ModuleBase/ModuleBase_IPropertyPanel.cpp b/src/ModuleBase/ModuleBase_IPropertyPanel.cpp index 03322cd91..c2be77084 100644 --- a/src/ModuleBase/ModuleBase_IPropertyPanel.cpp +++ b/src/ModuleBase/ModuleBase_IPropertyPanel.cpp @@ -30,7 +30,7 @@ ModuleBase_IPropertyPanel::ModuleBase_IPropertyPanel(QWidget *theParent) ModuleBase_ModelWidget *ModuleBase_IPropertyPanel::modelWidget( const std::string &theAttributeId) const { - ModuleBase_ModelWidget *aWidget = 0; + ModuleBase_ModelWidget *aWidget = nullptr; QList aWidgets = modelWidgets(); ModelAPI_ValidatorsFactory *aValidators = ModelAPI_Session::get()->validators(); @@ -56,7 +56,7 @@ ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget() { ModuleBase_ModelWidget * ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget( const QList &theWidgets) { - ModuleBase_ModelWidget *aFirstWidget = 0; + ModuleBase_ModelWidget *aFirstWidget = nullptr; ModelAPI_ValidatorsFactory *aValidators = ModelAPI_Session::get()->validators(); diff --git a/src/ModuleBase/ModuleBase_ISelection.cpp b/src/ModuleBase/ModuleBase_ISelection.cpp index 003f2c672..7f54cf291 100644 --- a/src/ModuleBase/ModuleBase_ISelection.cpp +++ b/src/ModuleBase/ModuleBase_ISelection.cpp @@ -43,9 +43,9 @@ void ModuleBase_ISelection::appendSelected( ObjectPtr anObject; foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) { anObject = aPrs->object(); - if (anObject.get() != NULL && !anExistedObjects.contains(anObject)) { + if (anObject.get() != nullptr && !anExistedObjects.contains(anObject)) { theValuesTo.append(std::shared_ptr( - new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), nullptr))); } } } @@ -93,9 +93,9 @@ ModuleBase_ISelection::getViewerPrs(const QObjectPtrList &theObjects) { aLast = theObjects.end(); for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; - if (anObject.get() != NULL) { + if (anObject.get() != nullptr) { aSelectedPrs.append(std::shared_ptr( - new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), nullptr))); } } return aSelectedPrs; @@ -115,14 +115,12 @@ void ModuleBase_ISelection::filterSelectionOnEqualPoints( std::shared_ptr aGeomPrsVertex = getPresentationVertex(aPrs); if (aGeomPrsVertex.get()) { - const TopoDS_Vertex &aPrsVertex = aGeomPrsVertex->impl(); - std::set>::const_iterator - aVIt = aVerticesMap.begin(), - aVLast = aVerticesMap.end(); + const auto &aPrsVertex = aGeomPrsVertex->impl(); + auto aVIt = aVerticesMap.begin(), aVLast = aVerticesMap.end(); bool aFound = false; for (; aVIt != aVLast && !aFound; aVIt++) { std::shared_ptr aGeomVertex = *aVIt; - const TopoDS_Vertex &aVertex = aGeomVertex->impl(); + const auto &aVertex = aGeomVertex->impl(); gp_Pnt aPoint1 = BRep_Tool::Pnt(aVertex); gp_Pnt aPoint2 = BRep_Tool::Pnt(aPrsVertex); diff --git a/src/ModuleBase/ModuleBase_IStepPrs.cpp b/src/ModuleBase/ModuleBase_IStepPrs.cpp index a6429a7e4..74ad27941 100644 --- a/src/ModuleBase/ModuleBase_IStepPrs.cpp +++ b/src/ModuleBase/ModuleBase_IStepPrs.cpp @@ -20,4 +20,4 @@ #include "ModuleBase_IStepPrs.h" -ModuleBase_IStepPrs::ModuleBase_IStepPrs() {} +ModuleBase_IStepPrs::ModuleBase_IStepPrs() = default; diff --git a/src/ModuleBase/ModuleBase_ITreeNode.h b/src/ModuleBase/ModuleBase_ITreeNode.h index 774a7e1c1..3e059f20c 100644 --- a/src/ModuleBase/ModuleBase_ITreeNode.h +++ b/src/ModuleBase/ModuleBase_ITreeNode.h @@ -39,14 +39,14 @@ class ModuleBase_ITreeNode; class ModuleBase_IWorkshop; -typedef QList QTreeNodesList; +using QTreeNodesList = QList; class ModuleBase_ITreeNode { public: enum VisibilityState { NoneState, Visible, SemiVisible, Hidden }; /// Default constructor - ModuleBase_ITreeNode(ModuleBase_ITreeNode *theParent = 0) + ModuleBase_ITreeNode(ModuleBase_ITreeNode *theParent = nullptr) : myParent(theParent) {} virtual ~ModuleBase_ITreeNode() { deleteChildren(); } @@ -54,10 +54,12 @@ public: virtual std::string type() const = 0; /// Returns the node representation according to theRole. - virtual QVariant data(int theColumn, int theRole) const { return QVariant(); } + virtual QVariant data(int /*theColumn*/, int /*theRole*/) const { + return QVariant(); + } /// Returns properties flag of the item - virtual Qt::ItemFlags flags(int theColumn) const { + virtual Qt::ItemFlags flags(int /*theColumn*/) const { return Qt::ItemIsSelectable | Qt::ItemIsEnabled; } @@ -71,7 +73,7 @@ public: ModuleBase_ITreeNode *subNode(int theRow) const { if ((theRow > -1) && (theRow < myChildren.length())) return myChildren.at(theRow); - return 0; + return nullptr; } /// Finds a node which contains the referenced object @@ -88,7 +90,7 @@ public: return aSubNode; } } - return 0; + return nullptr; } /// Returns true if the given node is found within children @@ -122,7 +124,7 @@ public: /// Process creation of objects. /// \param theObjects a list of created objects /// \return a list of nodes which corresponds to the created objects - virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects) { + virtual QTreeNodesList objectCreated(const QObjectPtrList & /*theObjects*/) { return QTreeNodesList(); } @@ -130,8 +132,8 @@ public: /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted /// \return a list of parents where nodes were deleted - virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, - const QString &theGroup) { + virtual QTreeNodesList objectsDeleted(const DocumentPtr & /*theDoc*/, + const QString & /*theGroup*/) { return QTreeNodesList(); } @@ -147,9 +149,9 @@ public: /// Returns a node which belongs to the given document and contains objects of /// the given group \param theDoc a document \param theGroup a name of objects /// group \return a parent node if it is found - virtual ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc, - QString theGroup) { - return 0; + virtual ModuleBase_ITreeNode *findParent(const DocumentPtr & /*theDoc*/, + QString /*theGroup*/) { + return nullptr; } /// Returns root node of a data tree of the given document @@ -164,7 +166,7 @@ public: if (aRoot) return aRoot; } - return 0; + return nullptr; } /// Returns visibilitystate of the node in viewer 3d @@ -182,7 +184,7 @@ protected: void sortChildren() { if (myChildren.size() > 1) { int i = 0; - ModuleBase_ITreeNode *aNode = 0; + ModuleBase_ITreeNode *aNode = nullptr; ObjectPtr aObject; int aIdx; int aCount = 0; diff --git a/src/ModuleBase/ModuleBase_IWidgetCreator.cpp b/src/ModuleBase/ModuleBase_IWidgetCreator.cpp index fac447ce6..85d43c813 100644 --- a/src/ModuleBase/ModuleBase_IWidgetCreator.cpp +++ b/src/ModuleBase/ModuleBase_IWidgetCreator.cpp @@ -20,25 +20,25 @@ #include "ModuleBase_IWidgetCreator.h" -ModuleBase_IWidgetCreator::ModuleBase_IWidgetCreator() {} +ModuleBase_IWidgetCreator::ModuleBase_IWidgetCreator() = default; -ModuleBase_IWidgetCreator::~ModuleBase_IWidgetCreator() {} +ModuleBase_IWidgetCreator::~ModuleBase_IWidgetCreator() = default; QWidget *ModuleBase_IWidgetCreator::createPanelByType( - const std::string &theType, QWidget *theParent, - const FeaturePtr &theFeature, Config_WidgetAPI *theWidgetApi) { - return 0; + const std::string & /*theType*/, QWidget * /*theParent*/, + const FeaturePtr & /*theFeature*/, Config_WidgetAPI * /*theWidgetApi*/) { + return nullptr; } -ModuleBase_PageBase * -ModuleBase_IWidgetCreator::createPageByType(const std::string &theType, - QWidget *theParent, - Config_WidgetAPI *theWidgetApi) { - return 0; +ModuleBase_PageBase *ModuleBase_IWidgetCreator::createPageByType( + const std::string & /*theType*/, QWidget * /*theParent*/, + Config_WidgetAPI * /*theWidgetApi*/) { + return nullptr; } ModuleBase_ModelWidget *ModuleBase_IWidgetCreator::createWidgetByType( - const std::string &theType, QWidget *theParent, - Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop *theWorkshop) { - return 0; + const std::string & /*theType*/, QWidget * /*theParent*/, + Config_WidgetAPI * /*theWidgetApi*/, + ModuleBase_IWorkshop * /*theWorkshop*/) { + return nullptr; } diff --git a/src/ModuleBase/ModuleBase_IWidgetCreator.h b/src/ModuleBase/ModuleBase_IWidgetCreator.h index a2d0c5ceb..22bf9e4c8 100644 --- a/src/ModuleBase/ModuleBase_IWidgetCreator.h +++ b/src/ModuleBase/ModuleBase_IWidgetCreator.h @@ -77,7 +77,7 @@ public: virtual QWidget *createPanelByType(const std::string &theType, QWidget *theParent, const FeaturePtr &theFeature, - Config_WidgetAPI *theWidgetApi = 0); + Config_WidgetAPI *theWidgetApi = nullptr); /// Create page by its type /// The default implementation is empty @@ -100,6 +100,6 @@ public: ModuleBase_IWorkshop *theWorkshop); }; -typedef std::shared_ptr WidgetCreatorPtr; +using WidgetCreatorPtr = std::shared_ptr; #endif diff --git a/src/ModuleBase/ModuleBase_IconFactory.cpp b/src/ModuleBase/ModuleBase_IconFactory.cpp index 11188d4a0..26deceed1 100644 --- a/src/ModuleBase/ModuleBase_IconFactory.cpp +++ b/src/ModuleBase/ModuleBase_IconFactory.cpp @@ -24,7 +24,7 @@ #include -ModuleBase_IconFactory *MYIconFactory = 0; +ModuleBase_IconFactory *MYIconFactory = nullptr; ModuleBase_IconFactory::ModuleBase_IconFactory() { setFactory(this); } @@ -41,7 +41,7 @@ ModuleBase_IconFactory *ModuleBase_IconFactory::get() { return MYIconFactory; } -QIcon ModuleBase_IconFactory::getIcon(ObjectPtr theIcon) { return QIcon(); } +QIcon ModuleBase_IconFactory::getIcon(ObjectPtr /*theIcon*/) { return QIcon(); } QIcon ModuleBase_IconFactory::loadIcon(const QString &theValue) { return QIcon(loadPixmap(theValue)); diff --git a/src/ModuleBase/ModuleBase_LabelValue.cpp b/src/ModuleBase/ModuleBase_LabelValue.cpp index 53596adc1..97df80341 100644 --- a/src/ModuleBase/ModuleBase_LabelValue.cpp +++ b/src/ModuleBase/ModuleBase_LabelValue.cpp @@ -32,7 +32,7 @@ ModuleBase_LabelValue::ModuleBase_LabelValue(QWidget *theParent, const QString &theIcon, int thePrecision) : QWidget(theParent), myValue(0), myPrecision(thePrecision) { - QHBoxLayout *aLayout = new QHBoxLayout(this); + auto *aLayout = new QHBoxLayout(this); aLayout->setContentsMargins(2, 0, 0, 0); aLayout->setSpacing(0); @@ -51,7 +51,7 @@ ModuleBase_LabelValue::ModuleBase_LabelValue(QWidget *theParent, aLayout->addStretch(1); } -ModuleBase_LabelValue::~ModuleBase_LabelValue() {} +ModuleBase_LabelValue::~ModuleBase_LabelValue() = default; void ModuleBase_LabelValue::setValue(const double theValue) { myValue = theValue; diff --git a/src/ModuleBase/ModuleBase_ListView.cpp b/src/ModuleBase/ModuleBase_ListView.cpp index 3019ae31f..151f37911 100644 --- a/src/ModuleBase/ModuleBase_ListView.cpp +++ b/src/ModuleBase/ModuleBase_ListView.cpp @@ -65,7 +65,7 @@ ModuleBase_ListView::ModuleBase_ListView(QWidget *theParent, //******************************************************************** void ModuleBase_ListView::addItem(const QString &theTextValue, const int theIndex) { - QListWidgetItem *anItem = new QListWidgetItem(theTextValue, myListControl); + auto *anItem = new QListWidgetItem(theTextValue, myListControl); anItem->setData(ATTRIBUTE_SELECTION_INDEX_ROLE, theIndex); myListControl->addItem(anItem); } diff --git a/src/ModuleBase/ModuleBase_ListView.h b/src/ModuleBase/ModuleBase_ListView.h index 768a94f29..e4e966443 100644 --- a/src/ModuleBase/ModuleBase_ListView.h +++ b/src/ModuleBase/ModuleBase_ListView.h @@ -46,14 +46,14 @@ public: CustomListWidget(QWidget *theParent) : QListWidget(theParent) {} /// Redefinition of virtual method - virtual QSize sizeHint() const { + QSize sizeHint() const override { int aHeight = 2 * QFontMetrics(font()).height(); QSize aSize = QListWidget::sizeHint(); return QSize(aSize.width(), aHeight); } /// Redefinition of virtual method - virtual QSize minimumSizeHint() const { + QSize minimumSizeHint() const override { int aHeight = 4 /*2*/ * QFontMetrics(font()).height(); QSize aSize = QListWidget::minimumSizeHint(); return QSize(aSize.width(), aHeight); @@ -63,7 +63,7 @@ signals: void activated(); protected: - virtual void mouseReleaseEvent(QMouseEvent *e) { + void mouseReleaseEvent(QMouseEvent *e) override { QListWidget::mouseReleaseEvent(e); emit activated(); } @@ -72,7 +72,7 @@ protected: // The code is necessary only for Linux because // it can not update viewport on widget resize protected: - void resizeEvent(QResizeEvent *theEvent) { + void resizeEvent(QResizeEvent *theEvent) override { QListWidget::resizeEvent(theEvent); QTimer::singleShot(5, viewport(), SLOT(repaint())); } @@ -88,11 +88,11 @@ class MODULEBASE_EXPORT ModuleBase_ListView : public QObject { public: /// Constructor - ModuleBase_ListView(QWidget *theParent = 0, + ModuleBase_ListView(QWidget *theParent = nullptr, const QString &theObjectName = QString(), const QString &theToolTip = QString()); /// Destructor - virtual ~ModuleBase_ListView() {} + ~ModuleBase_ListView() override = default; /// Returns current control /// \return list view instance diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index e6a26625a..69022d168 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -52,7 +52,7 @@ //************************************************************** ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget *theParent, const Config_WidgetAPI *theData) - : QWidget(theParent), myWidgetValidator(0), myState(Stored), + : QWidget(theParent), myWidgetValidator(nullptr), myState(Stored), myIsEditing(false), myIsValueStateBlocked(false), myFlushUpdateBlocked(false) { #ifdef DEBUG_WIDGET_INSTANCE @@ -231,7 +231,7 @@ void ModuleBase_ModelWidget::enableFocusProcessing() { void ModuleBase_ModelWidget::setHighlighted(bool isHighlighted) { QList aWidgetList = getControls(); foreach (QWidget *aWidget, aWidgetList) { - QLabel *aLabel = qobject_cast(aWidget); + auto *aLabel = qobject_cast(aWidget); // We won't set the effect to QLabels - it looks ugly if (aLabel) continue; @@ -290,7 +290,7 @@ void ModuleBase_ModelWidget::activate() { // fields are filled in the edition mode if (!isEditingMode()) { AttributePtr anAttribute = myFeature->data()->attribute(myAttributeID); - if (anAttribute.get() != NULL && !anAttribute->isInitialized()) + if (anAttribute.get() != nullptr && !anAttribute->isInitialized()) initializeValueByActivate(); } activateCustom(); @@ -320,7 +320,7 @@ void ModuleBase_ModelWidget::initializeValueByActivate() { //************************************************************** QWidget *ModuleBase_ModelWidget::getControlAcceptingFocus(const bool isFirst) { - QWidget *aControl = 0; + QWidget *aControl = nullptr; QList aControls = getControls(); int aSize = aControls.size(); @@ -474,8 +474,8 @@ bool ModuleBase_ModelWidget::canProcessAction( } //************************************************************** -bool ModuleBase_ModelWidget::processAction(ModuleBase_ActionType theActionType, - const ActionParamPtr &theParam) { +bool ModuleBase_ModelWidget::processAction( + ModuleBase_ActionType theActionType, const ActionParamPtr & /*theParam*/) { switch (theActionType) { case ActionEnter: return processEnter(); @@ -512,7 +512,7 @@ bool ModuleBase_ModelWidget::processSelection() { return false; } bool ModuleBase_ModelWidget::eventFilter(QObject *theObject, QEvent *theEvent) { QWidget *aWidget = qobject_cast(theObject); if (theEvent->type() == QEvent::FocusIn) { - QFocusEvent *aFocusEvent = dynamic_cast(theEvent); + auto *aFocusEvent = dynamic_cast(theEvent); Qt::FocusReason aReason = aFocusEvent->reason(); bool aMouseOrKey = aReason == Qt::MouseFocusReason || @@ -524,7 +524,7 @@ bool ModuleBase_ModelWidget::eventFilter(QObject *theObject, QEvent *theEvent) { emitFocusInWidget(); } } else if (theEvent->type() == QEvent::FocusOut) { - QFocusEvent *aFocusEvent = dynamic_cast(theEvent); + auto *aFocusEvent = dynamic_cast(theEvent); Qt::FocusReason aReason = aFocusEvent->reason(); bool aMouseOrKey = @@ -557,9 +557,9 @@ QString ModuleBase_ModelWidget::translate(const std::string &theStr) const { //************************************************************** ModuleBase_ModelWidget * -ModuleBase_ModelWidget::findModelWidget(ModuleBase_IPropertyPanel *theProp, +ModuleBase_ModelWidget::findModelWidget(ModuleBase_IPropertyPanel * /*theProp*/, QWidget *theWidget) { - ModuleBase_ModelWidget *aModelWidget = 0; + ModuleBase_ModelWidget *aModelWidget = nullptr; if (!theWidget) return aModelWidget; diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index a4de781c8..5e6cb9874 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -51,8 +51,7 @@ ModuleBase_Operation::ModuleBase_Operation(const QString &theId, QObject *theParent) - : QObject(theParent), myIsModified(false), myPropertyPanel(NULL), - myHideFacesVisibilityState(false) { + : QObject(theParent), myPropertyPanel(nullptr) { myDescription = new ModuleBase_OperationDescription(theId); } diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index fd4bf82e5..90f63547e 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -212,7 +212,7 @@ private: ModuleBase_OperationDescription *myDescription; /// Modified feature flag - bool myIsModified; + bool myIsModified{false}; /// List of operations IDs which are granted of the current operation QStringList myGrantedIds; @@ -223,7 +223,7 @@ private: QString myHelpFileName; /// Visibility state of HideFaces panel before the operation launch - bool myHideFacesVisibilityState; + bool myHideFacesVisibilityState{false}; }; #endif diff --git a/src/ModuleBase/ModuleBase_OperationDescription.cpp b/src/ModuleBase/ModuleBase_OperationDescription.cpp index 3497a24b2..4dc684d39 100644 --- a/src/ModuleBase/ModuleBase_OperationDescription.cpp +++ b/src/ModuleBase/ModuleBase_OperationDescription.cpp @@ -25,7 +25,7 @@ ModuleBase_OperationDescription::ModuleBase_OperationDescription( const QString &theId) : myOperationId(theId) {} -ModuleBase_OperationDescription::~ModuleBase_OperationDescription() {} +ModuleBase_OperationDescription::~ModuleBase_OperationDescription() = default; const QString &ModuleBase_OperationDescription::operationId() const { return myOperationId; diff --git a/src/ModuleBase/ModuleBase_OperationFeature.cpp b/src/ModuleBase/ModuleBase_OperationFeature.cpp index 74d7f092d..c450df1bc 100644 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@ -61,8 +61,7 @@ ModuleBase_OperationFeature::ModuleBase_OperationFeature(const QString &theId, QObject *theParent) - : ModuleBase_Operation(theId, theParent), myIsEditing(false), - myNeedToBeAborted(false), myRestartTransactionOnResume(false) {} + : ModuleBase_Operation(theId, theParent) {} ModuleBase_OperationFeature::~ModuleBase_OperationFeature() { clearPreselection(); @@ -164,7 +163,7 @@ void ModuleBase_OperationFeature::stopOperation() { } FeaturePtr -ModuleBase_OperationFeature::createFeature(const bool theFlushMessage) { +ModuleBase_OperationFeature::createFeature(const bool /*theFlushMessage*/) { if (myParentFeature.get()) { myFeature = myParentFeature->addFeature( getDescription()->operationId().toStdString()); @@ -241,7 +240,7 @@ bool ModuleBase_OperationFeature::start() { if (!myIsEditing) { FeaturePtr aFeature = createFeature(); // if the feature is not created, there is no sense to start the operation - if (aFeature.get() == NULL) { + if (aFeature.get() == nullptr) { // it is necessary to abor the operation in the session and emit the // aborted signal in order to update commands status in the workshop, to // be exact the feature action to be unchecked @@ -363,17 +362,17 @@ bool ModuleBase_OperationFeature::commit() { ModuleBase_ModelWidget *ModuleBase_OperationFeature::activateByPreselection( const std::string &theGreedAttributeId) { - ModuleBase_ModelWidget *aWidget = 0; + ModuleBase_ModelWidget *aWidget = nullptr; if (myPreSelection.empty()) return aWidget; ModuleBase_IPropertyPanel *aPropertyPanel = propertyPanel(); - ModuleBase_ModelWidget *aFilledWgt = 0; + ModuleBase_ModelWidget *aFilledWgt = nullptr; if (aPropertyPanel) { const QList &aWidgets = aPropertyPanel->modelWidgets(); QList::const_iterator aWIt; - ModuleBase_ModelWidget *aWgt = 0; + ModuleBase_ModelWidget *aWgt = nullptr; if (!aWidgets.empty()) { // equal vertices should not be used here ModuleBase_ISelection::filterSelectionOnEqualPoints(myPreSelection); @@ -386,7 +385,7 @@ ModuleBase_ModelWidget *ModuleBase_OperationFeature::activateByPreselection( if (aWgt->attributeID() == theGreedAttributeId) { aPropertyPanel->setPreselectionWidget(aWgt); if (aWgt->setSelection(myPreSelection, true)) { - aPropertyPanel->setPreselectionWidget(NULL); + aPropertyPanel->setPreselectionWidget(nullptr); aFilledWgt = aWgt; break; } else { // do not process invalid for greed widget selection @@ -409,7 +408,7 @@ ModuleBase_ModelWidget *ModuleBase_OperationFeature::activateByPreselection( aFilledWgt = aWgt; } } - aPropertyPanel->setPreselectionWidget(NULL); + aPropertyPanel->setPreselectionWidget(nullptr); // in order to redisplay object in the viewer, the update/redisplay // signals should be flushed it is better to perform it not in // setSelection of each widget, but do it here, after the preselection is @@ -499,7 +498,7 @@ void ModuleBase_OperationFeature::setPropertyPanel( // operation Because we don't know which widget is going to be edited. if (!isEditOperation()) { // 4. activate the first obligatory widget - theProp->activateNextWidget(NULL); + theProp->activateNextWidget(nullptr); } else { // set focus on Ok button in order to operation manager could process Enter // press diff --git a/src/ModuleBase/ModuleBase_OperationFeature.h b/src/ModuleBase/ModuleBase_OperationFeature.h index 8bae28d8b..ed0735877 100644 --- a/src/ModuleBase/ModuleBase_OperationFeature.h +++ b/src/ModuleBase/ModuleBase_OperationFeature.h @@ -212,10 +212,10 @@ protected: std::set myVisualizedObjects; /// Editing feature flag - bool myIsEditing; + bool myIsEditing{false}; /// State used only if the operation should not be commited - bool myNeedToBeAborted; + bool myNeedToBeAborted{false}; /// List of pre-selected object QList> myPreSelection; @@ -230,7 +230,7 @@ protected: /// commit/abort this operation. FeaturePtr myPreviousCurrentFeature; - bool myRestartTransactionOnResume; + bool myRestartTransactionOnResume{false}; }; #endif diff --git a/src/ModuleBase/ModuleBase_PageBase.cpp b/src/ModuleBase/ModuleBase_PageBase.cpp index f8f893e35..7beb07d05 100644 --- a/src/ModuleBase/ModuleBase_PageBase.cpp +++ b/src/ModuleBase/ModuleBase_PageBase.cpp @@ -25,9 +25,9 @@ class QWidget; -ModuleBase_PageBase::ModuleBase_PageBase() {} +ModuleBase_PageBase::ModuleBase_PageBase() = default; -ModuleBase_PageBase::~ModuleBase_PageBase() {} +ModuleBase_PageBase::~ModuleBase_PageBase() = default; QWidget *ModuleBase_PageBase::pageWidget() { return dynamic_cast(this); @@ -50,7 +50,7 @@ void ModuleBase_PageBase::clearPage() { myWidgetList.clear(); QLayoutItem *aChild; - while ((aChild = pageLayout()->takeAt(0)) != 0) { + while ((aChild = pageLayout()->takeAt(0)) != nullptr) { if (aChild->widget()) { delete aChild->widget(); } else { @@ -65,7 +65,7 @@ void ModuleBase_PageBase::clearPage() { // without necessity. // In this patch we clear the stretch information specifying the default // value: 0. - QGridLayout *aLayout = dynamic_cast(pageLayout()); + auto *aLayout = dynamic_cast(pageLayout()); if (aLayout) { int r = aLayout->rowCount(); for (int i = 0; i < r; i++) @@ -104,6 +104,6 @@ void ModuleBase_PageBase::alignToTop() { } void ModuleBase_PageBase::placePageWidget(ModuleBase_PageBase *theWidget) { - QWidget *aWidget = dynamic_cast(theWidget); + auto *aWidget = dynamic_cast(theWidget); placeWidget(aWidget); } diff --git a/src/ModuleBase/ModuleBase_PageGroupBox.cpp b/src/ModuleBase/ModuleBase_PageGroupBox.cpp index 55f1d62a4..003e0b01a 100644 --- a/src/ModuleBase/ModuleBase_PageGroupBox.cpp +++ b/src/ModuleBase/ModuleBase_PageGroupBox.cpp @@ -31,7 +31,7 @@ ModuleBase_PageGroupBox::ModuleBase_PageGroupBox(QWidget *theParent) setLayout(myMainLayout); } -ModuleBase_PageGroupBox::~ModuleBase_PageGroupBox() {} +ModuleBase_PageGroupBox::~ModuleBase_PageGroupBox() = default; void ModuleBase_PageGroupBox::addPageStretch() {} diff --git a/src/ModuleBase/ModuleBase_PageGroupBox.h b/src/ModuleBase/ModuleBase_PageGroupBox.h index a1de075db..8ea279592 100644 --- a/src/ModuleBase/ModuleBase_PageGroupBox.h +++ b/src/ModuleBase/ModuleBase_PageGroupBox.h @@ -39,19 +39,19 @@ class MODULEBASE_EXPORT ModuleBase_PageGroupBox : public QGroupBox, Q_OBJECT public: /// Constructs a page that looks like a QGroupBox - explicit ModuleBase_PageGroupBox(QWidget *theParent = 0); + explicit ModuleBase_PageGroupBox(QWidget *theParent = nullptr); /// Destructs the page - virtual ~ModuleBase_PageGroupBox(); + ~ModuleBase_PageGroupBox() override; protected: /// Adds the given widget to page's layout - virtual void placeModelWidget(ModuleBase_ModelWidget *theWidget); + void placeModelWidget(ModuleBase_ModelWidget *theWidget) override; /// Adds the given page to page's layout - virtual void placeWidget(QWidget *theWidget); + void placeWidget(QWidget *theWidget) override; /// Returns page's layout (QGridLayout) - virtual QLayout *pageLayout(); + QLayout *pageLayout() override; /// Adds a stretch to page's layout - virtual void addPageStretch(); + void addPageStretch() override; private: QGridLayout *myMainLayout; ///< page's layout diff --git a/src/ModuleBase/ModuleBase_PageWidget.cpp b/src/ModuleBase/ModuleBase_PageWidget.cpp index 6b1b821ff..22b390619 100644 --- a/src/ModuleBase/ModuleBase_PageWidget.cpp +++ b/src/ModuleBase/ModuleBase_PageWidget.cpp @@ -33,7 +33,7 @@ ModuleBase_PageWidget::ModuleBase_PageWidget(QWidget *theParent) setLayout(myMainLayout); } -ModuleBase_PageWidget::~ModuleBase_PageWidget() {} +ModuleBase_PageWidget::~ModuleBase_PageWidget() = default; void ModuleBase_PageWidget::addPageStretch() { myMainLayout->addStretch(1); } diff --git a/src/ModuleBase/ModuleBase_PageWidget.h b/src/ModuleBase/ModuleBase_PageWidget.h index 7804e95e0..72a84b889 100644 --- a/src/ModuleBase/ModuleBase_PageWidget.h +++ b/src/ModuleBase/ModuleBase_PageWidget.h @@ -39,19 +39,19 @@ class MODULEBASE_EXPORT ModuleBase_PageWidget : public QFrame, Q_OBJECT public: /// Constructs a page that looks like a QFrame - explicit ModuleBase_PageWidget(QWidget *theParent = 0); + explicit ModuleBase_PageWidget(QWidget *theParent = nullptr); /// Destructs the page - virtual ~ModuleBase_PageWidget(); + ~ModuleBase_PageWidget() override; protected: /// Adds the given widget to page's layout - virtual void placeModelWidget(ModuleBase_ModelWidget *theWidget); + void placeModelWidget(ModuleBase_ModelWidget *theWidget) override; /// Adds the given page to page's layout - virtual void placeWidget(QWidget *theWidget); + void placeWidget(QWidget *theWidget) override; /// Returns page's layout (QGridLayout) - virtual QLayout *pageLayout(); + QLayout *pageLayout() override; /// Adds a stretch to page's layout - virtual void addPageStretch(); + void addPageStretch() override; private: QVBoxLayout *myMainLayout; ///< page's layout diff --git a/src/ModuleBase/ModuleBase_PagedContainer.cpp b/src/ModuleBase/ModuleBase_PagedContainer.cpp index 8d6e8d035..fb797e1b7 100644 --- a/src/ModuleBase/ModuleBase_PagedContainer.cpp +++ b/src/ModuleBase/ModuleBase_PagedContainer.cpp @@ -42,7 +42,7 @@ ModuleBase_PagedContainer::ModuleBase_PagedContainer( myDefValue = defaultValues[myFeatureId + attributeID()]; } -ModuleBase_PagedContainer::~ModuleBase_PagedContainer() {} +ModuleBase_PagedContainer::~ModuleBase_PagedContainer() = default; int ModuleBase_PagedContainer::addPage(ModuleBase_PageBase *thePage, const QString & /*theName*/, diff --git a/src/ModuleBase/ModuleBase_PagedContainer.h b/src/ModuleBase/ModuleBase_PagedContainer.h index 1539fc9f0..bd3ff1068 100644 --- a/src/ModuleBase/ModuleBase_PagedContainer.h +++ b/src/ModuleBase/ModuleBase_PagedContainer.h @@ -40,7 +40,7 @@ public: /// \param theData a data of the widget ModuleBase_PagedContainer(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_PagedContainer(); + ~ModuleBase_PagedContainer() override; /// Add a new page /// \param theWidget a page object @@ -52,20 +52,20 @@ public: const QString &theTooltip); /// Redefinition of virtual function - virtual QList getControls() const; + QList getControls() const override; /// Redefinition of virtual function - virtual bool focusTo(); + bool focusTo() override; /// Redefinition of virtual function - virtual void setHighlighted(bool isHighlighted); + void setHighlighted(bool isHighlighted) override; /// Redefinition of virtual function - virtual void enableFocusProcessing(); + void enableFocusProcessing() override; /// The slot is called when user press Ok or OkPlus buttons in the parent /// property panel - virtual void onFeatureAccepted(); + void onFeatureAccepted() override; protected: /// Returns index of current page @@ -75,13 +75,13 @@ protected: virtual void setCurrentPageIndex(int) = 0; /// Redefinition of virtual function - virtual void activateCustom(); + void activateCustom() override; /// Redefinition of virtual function - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Redefinition of virtual function - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; // A flag which let to remeber last user choice and restore it on next launch bool myRemeberChoice; diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp index a475885e9..7d1a839fb 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp @@ -45,8 +45,7 @@ bool isVariableSymbol(const QChar &theChar) { ModuleBase_ParamSpinBox::ModuleBase_ParamSpinBox(QWidget *theParent, int thePrecision) - : QAbstractSpinBox(theParent), myIsEquation(false), myAcceptVariables(true), - myMinimum(-DBL_MAX), myMaximum(DBL_MAX), mySingleStep(1) { + : QAbstractSpinBox(theParent) { myCompleter = new QCompleter(this); myCompleter->setWidget(lineEdit()); myCompleter->setCompletionMode(QCompleter::PopupCompletion); @@ -92,7 +91,7 @@ void ModuleBase_ParamSpinBox::setCompletionList(QStringList &theList) { /*! \brief Destructor. */ -ModuleBase_ParamSpinBox::~ModuleBase_ParamSpinBox() {} +ModuleBase_ParamSpinBox::~ModuleBase_ParamSpinBox() = default; /*! \brief Perform \a steps increment/decrement steps. diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.h b/src/ModuleBase/ModuleBase_ParamSpinBox.h index 16026341f..8e277c366 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.h +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.h @@ -26,6 +26,7 @@ #include #include #include +#include class QStringListModel; class QCompleter; @@ -155,18 +156,18 @@ private: QString getPrefix(int &theStart, int &theEnd) const; void showCompletion(bool checkPrefix); - bool myIsEquation; - bool myAcceptVariables; + bool myIsEquation{false}; + bool myAcceptVariables{true}; QStringListModel *myCompleterModel; QCompleter *myCompleter; - double myMinimum; - double myMaximum; + double myMinimum{-DBL_MAX}; + double myMaximum{DBL_MAX}; int myCompletePos; - double mySingleStep; + double mySingleStep{1}; /// Cashed color of active base palette QColor myEnabledBaseColor; diff --git a/src/ModuleBase/ModuleBase_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp index c61d85984..e1adad09b 100644 --- a/src/ModuleBase/ModuleBase_Preferences.cpp +++ b/src/ModuleBase/ModuleBase_Preferences.cpp @@ -42,7 +42,7 @@ const QString ModuleBase_Preferences::VIEWER_SECTION = "Viewer"; const QString ModuleBase_Preferences::MENU_SECTION = "Menu"; const QString ModuleBase_Preferences::GENERAL_SECTION = "General"; -SUIT_ResourceMgr *ModuleBase_Preferences::myResourceMgr = 0; +SUIT_ResourceMgr *ModuleBase_Preferences::myResourceMgr = nullptr; SUIT_ResourceMgr *ModuleBase_Preferences::resourceMgr() { if (!myResourceMgr) { @@ -326,18 +326,19 @@ public: /// \param theMgr a preferences manager ModuleBase_PrefMgr(ModuleBase_PreferencesMgr *theMgr) : myMgr(theMgr) {} - virtual int addPreference(const QString &theLbl, int pId, - SUIT_PreferenceMgr::PrefItemType theType, - const QString &theSection, const QString &theName) { + int addPreference(const QString &theLbl, int pId, + SUIT_PreferenceMgr::PrefItemType theType, + const QString &theSection, + const QString &theName) override { return myMgr->addItem(theLbl, pId, theType, theSection, theName); } - virtual void setItemProperty(const QString &thePropName, - const QVariant &theValue, const int theId = -1) { + void setItemProperty(const QString &thePropName, const QVariant &theValue, + const int theId = -1) override { myMgr->setItemProperty(thePropName, theValue, theId); } - virtual SUIT_PreferenceMgr *prefMgr() const { return myMgr; } + SUIT_PreferenceMgr *prefMgr() const override { return myMgr; } private: ModuleBase_PreferencesMgr *myMgr; @@ -353,7 +354,7 @@ ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg( myIsChanged(false) { setWindowTitle(tr("Edit preferences")); - QVBoxLayout *main = new QVBoxLayout(this); + auto *main = new QVBoxLayout(this); main->setMargin(5); main->setSpacing(5); @@ -363,7 +364,7 @@ ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg( setFocusProxy(myPreferences); myPreferences->setFrameStyle(QFrame::Box | QFrame::Sunken); - QDialogButtonBox *aBtnBox = new QDialogButtonBox( + auto *aBtnBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Reset, Qt::Horizontal, this); QPushButton *aDefaultButton = aBtnBox->button(QDialogButtonBox::Reset); @@ -378,7 +379,7 @@ ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg( myPreferences->retrieve(); } -ModuleBase_PreferencesDlg::~ModuleBase_PreferencesDlg() {} +ModuleBase_PreferencesDlg::~ModuleBase_PreferencesDlg() = default; void ModuleBase_PreferencesDlg::createEditors() { int aPage = myPreferences->addItem(tr("Desktop")); diff --git a/src/ModuleBase/ModuleBase_Preferences.h b/src/ModuleBase/ModuleBase_Preferences.h index ff638ae48..84dba7e72 100644 --- a/src/ModuleBase/ModuleBase_Preferences.h +++ b/src/ModuleBase/ModuleBase_Preferences.h @@ -31,10 +31,10 @@ class SUIT_ResourceMgr; class QWidget; /// Pair of values: section name, value name -typedef QPair ModuleBase_Pref; +using ModuleBase_Pref = QPair; /// List of preferences -typedef QList ModuleBase_Prefs; +using ModuleBase_Prefs = QList; //*********************************************************************** /// \ingroup GUI @@ -113,14 +113,14 @@ public: ModuleBase_PreferencesMgr(QtxResourceMgr *theResource, QWidget *theParent) : SUIT_PreferenceMgr(theResource, theParent) {} - virtual ~ModuleBase_PreferencesMgr() {} + ~ModuleBase_PreferencesMgr() override = default; /// Returns True if preferences were modified ModuleBase_Prefs modified() const { return myModified; } protected: /// Store changed resource - virtual void changedResources(const ResourceMap &theMap); + void changedResources(const ResourceMap &theMap) override; private: ModuleBase_Prefs myModified; @@ -136,8 +136,8 @@ public: /// \param theResurces resources manager /// \param theParent a parent widget ModuleBase_PreferencesDlg(SUIT_ResourceMgr *theResurces, - QWidget *theParent = 0); - virtual ~ModuleBase_PreferencesDlg(); + QWidget *theParent = nullptr); + ~ModuleBase_PreferencesDlg() override; /// Returns True if preferences were changed bool isChanged() const { return myIsChanged; } @@ -148,10 +148,10 @@ public: public slots: /// A slot called on Ok button press - virtual void accept(); + void accept() override; protected: - virtual void showEvent(QShowEvent *theEvent); + void showEvent(QShowEvent *theEvent) override; protected slots: /// A slot called on Default button press diff --git a/src/ModuleBase/ModuleBase_ToolBox.cpp b/src/ModuleBase/ModuleBase_ToolBox.cpp index 399121874..3c9eb1837 100644 --- a/src/ModuleBase/ModuleBase_ToolBox.cpp +++ b/src/ModuleBase/ModuleBase_ToolBox.cpp @@ -35,7 +35,7 @@ const QString AStyle = ModuleBase_ToolBox::ModuleBase_ToolBox(QWidget *theParent, const bool theUseFrameStyleBox) : QFrame(theParent) { - QVBoxLayout *aMainLayout = new QVBoxLayout(this); + auto *aMainLayout = new QVBoxLayout(this); aMainLayout->setMargin(0); aMainLayout->setSpacing(2); @@ -64,7 +64,7 @@ ModuleBase_ToolBox::ModuleBase_ToolBox(QWidget *theParent, SLOT(onButton(int))); } -ModuleBase_ToolBox::~ModuleBase_ToolBox() {} +ModuleBase_ToolBox::~ModuleBase_ToolBox() = default; void ModuleBase_ToolBox::addItem(QWidget *thePage, const QString &theName, const QPixmap &theIcon) { @@ -72,7 +72,7 @@ void ModuleBase_ToolBox::addItem(QWidget *thePage, const QString &theName, myStack->addWidget(thePage); - QToolButton *aButton = new QToolButton(myButtonsFrame); + auto *aButton = new QToolButton(myButtonsFrame); aButton->setFocusPolicy(Qt::StrongFocus); aButton->setCheckable(true); aButton->setStyleSheet(AStyle); @@ -109,9 +109,9 @@ bool ModuleBase_ToolBox::isOffToolBoxParent(ModuleBase_ModelWidget *theWidget) { QWidget *aFirstControl = aControls.first(); QWidget *aWidget = aFirstControl; - QWidget *aParent = (QWidget *)aFirstControl->parent(); + auto *aParent = (QWidget *)aFirstControl->parent(); while (aParent) { - QStackedWidget *aStackedWidget = dynamic_cast(aParent); + auto *aStackedWidget = dynamic_cast(aParent); if (aStackedWidget) { isOffToolBox = aStackedWidget->currentWidget() != aWidget; break; diff --git a/src/ModuleBase/ModuleBase_ToolBox.h b/src/ModuleBase/ModuleBase_ToolBox.h index 7abac5d44..d37831c80 100644 --- a/src/ModuleBase/ModuleBase_ToolBox.h +++ b/src/ModuleBase/ModuleBase_ToolBox.h @@ -45,7 +45,7 @@ public: /// buttons and current page ModuleBase_ToolBox(QWidget *theParent, const bool theUseFrameStyleBox = false); - virtual ~ModuleBase_ToolBox(); + ~ModuleBase_ToolBox() override; /// Add a new item to the tool box /// \param thePage a widget of the new item diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index df139c3de..ed13fdf63 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -130,7 +130,8 @@ public: return anInstance; } - void processEvent(const std::shared_ptr &theMessage) { + void + processEvent(const std::shared_ptr &theMessage) override { if (theMessage->eventID() == Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)) { #if HAVE_SALOME @@ -196,7 +197,7 @@ void zeroMargins(QLayout *theLayout) { theLayout->setSpacing(5); } -void activateWindow(QWidget *theWidget, const QString &theInfo) { +void activateWindow(QWidget *theWidget, const QString & /*theInfo*/) { if (theWidget) { theWidget->activateWindow(); theWidget->raise(); @@ -207,7 +208,7 @@ void activateWindow(QWidget *theWidget, const QString &theInfo) { #endif } -void setFocus(QWidget *theWidget, const QString &theInfo) { +void setFocus(QWidget *theWidget, const QString & /*theInfo*/) { activateWindow(theWidget); theWidget->setFocus(); // rectangle of focus is not visible on tool button widgets @@ -219,7 +220,7 @@ void setFocus(QWidget *theWidget, const QString &theInfo) { void setShadowEffect(QWidget *theWidget, const bool isSetEffect) { if (isSetEffect) { - QGraphicsDropShadowEffect *aGlowEffect = new QGraphicsDropShadowEffect(); + auto *aGlowEffect = new QGraphicsDropShadowEffect(); aGlowEffect->setOffset(.0); aGlowEffect->setBlurRadius(10.0); aGlowEffect->setColor(QColor(0, 170, 255)); // Light-blue color, #00AAFF @@ -228,7 +229,7 @@ void setShadowEffect(QWidget *theWidget, const bool isSetEffect) { QGraphicsEffect *anEffect = theWidget->graphicsEffect(); if (anEffect) anEffect->deleteLater(); - theWidget->setGraphicsEffect(NULL); + theWidget->setGraphicsEffect(nullptr); } } @@ -331,7 +332,7 @@ QAction *createAction(const QIcon &theIcon, const QString &theText, QObject *theParent, const QObject *theReceiver, const char *theMember, const QString &theToolTip, const QString &theStatusTip) { - QAction *anAction = new QAction(theIcon, theText, theParent); + auto *anAction = new QAction(theIcon, theText, theParent); anAction->setToolTip(theToolTip.isEmpty() ? theText : theToolTip); anAction->setStatusTip(!theStatusTip.isEmpty() ? theStatusTip @@ -457,15 +458,16 @@ void checkObjects(const QObjectPtrList &theObjects, bool &hasResult, std::dynamic_pointer_cast( aObj); - hasResult |= ((aResult.get() != NULL) || (aStep.get() != NULL)); - hasFeature |= (aFeature.get() != NULL); - hasFolder |= (aFolder.get() != NULL); - hasParameter |= (aConstruction.get() != NULL); - hasNonGroup |= (aGroup.get() == NULL); + hasResult |= ((aResult.get() != nullptr) || (aStep.get() != nullptr)); + hasFeature |= (aFeature.get() != nullptr); + hasFolder |= (aFolder.get() != nullptr); + hasParameter |= (aConstruction.get() != nullptr); + hasNonGroup |= (aGroup.get() == nullptr); if (hasFeature) - hasCompositeOwner |= (ModelAPI_Tools::compositeOwner(aFeature) != NULL); + hasCompositeOwner |= + (ModelAPI_Tools::compositeOwner(aFeature) != nullptr); else if (aResult.get()) - hasCompositeOwner |= (ModelAPI_Tools::bodyOwner(aResult) != NULL); + hasCompositeOwner |= (ModelAPI_Tools::bodyOwner(aResult) != nullptr); if (!hasResultInHistory && aResult.get()) { aFeature = ModelAPI_Feature::feature(aResult); @@ -518,19 +520,19 @@ ObjectPtr getObject(const AttributePtr &theAttribute) { if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) { AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast(theAttribute); - if (anAttr != NULL && anAttr->isObject()) + if (anAttr != nullptr && anAttr->isObject()) anObject = anAttr->object(); } if (anAttrType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr anAttr = std::dynamic_pointer_cast(theAttribute); - if (anAttr != NULL) + if (anAttr != nullptr) anObject = anAttr->context(); } if (anAttrType == ModelAPI_AttributeReference::typeId()) { AttributeReferencePtr anAttr = std::dynamic_pointer_cast(theAttribute); - if (anAttr.get() != NULL) + if (anAttr.get() != nullptr) anObject = anAttr->value(); } return anObject; @@ -719,7 +721,7 @@ bool setObject(const AttributePtr &theAttribute, const ObjectPtr &theObject, } else if (aType == ModelAPI_AttributeSelection::typeId()) { AttributeSelectionPtr aSelectAttr = std::dynamic_pointer_cast(theAttribute); - if (aSelectAttr.get() != NULL) { + if (aSelectAttr.get() != nullptr) { aSelectAttr->setValue(theObject, theShape, theTemporarily); } } @@ -786,7 +788,7 @@ GeomShapePtr getShape(const AttributePtr &theAttribute, return aShape; } -void flushUpdated(ObjectPtr theObject) { +void flushUpdated(ObjectPtr /*theObject*/) { blockUpdateViewer(true); // Fix the problem of not previewed results of constraints applied. Flush @@ -945,8 +947,7 @@ bool hasModuleDocumentFeature(const std::set &theFeatures) { bool aFoundModuleDocumentObject = false; DocumentPtr aModuleDoc = ModelAPI_Session::get()->moduleDocument(); - std::set::const_iterator anIt = theFeatures.begin(), - aLast = theFeatures.end(); + auto anIt = theFeatures.begin(), aLast = theFeatures.end(); for (; anIt != aLast && !aFoundModuleDocumentObject; anIt++) { FeaturePtr aFeature = *anIt; ResultPtr aResult = ModuleBase_Tools::firstResult(aFeature); @@ -978,8 +979,7 @@ bool askToDelete( std::set aFeaturesRefsToParameter; std::set aParameterFeatures; QStringList aPartFeatureNames; - std::set::const_iterator anIt = theFeatures.begin(), - aLast = theFeatures.end(); + auto anIt = theFeatures.begin(), aLast = theFeatures.end(); // separate features to references to parameter features and references to // others for (; anIt != aLast; anIt++) { @@ -992,8 +992,7 @@ bool askToDelete( std::set aRefFeatures; std::set aRefList = theReferences.at(aFeature); - std::set::const_iterator aRefIt = aRefList.begin(), - aRefLast = aRefList.end(); + auto aRefIt = aRefList.begin(), aRefLast = aRefList.end(); for (; aRefIt != aRefLast; aRefIt++) { FeaturePtr aRefFeature = *aRefIt; if (theFeatures.find(aRefFeature) == @@ -1093,7 +1092,7 @@ bool askToDelete( if (aButtonRole == QMessageBox::ActionRole) { foreach (FeaturePtr aObj, aParameterFeatures) - ModelAPI_ReplaceParameterMessage::send(aObj, 0); + ModelAPI_ReplaceParameterMessage::send(aObj, nullptr); } else theReferencesToDelete.insert(aFeaturesRefsToParameterOnly.begin(), aFeaturesRefsToParameterOnly.end()); @@ -1111,7 +1110,7 @@ bool warningAboutConflict(QWidget *theParent, (theWarningText + "\nConstraints will be removed or substituted") .c_str()); - QCheckBox *aCheckBox = new QCheckBox; + auto *aCheckBox = new QCheckBox; aCheckBox->setTristate(false); aCheckBox->setText("switch off the notifications."); @@ -1357,7 +1356,7 @@ FeaturePtr findParameter(const QString &theName) { std::wstring generateName(const AttributePtr &theAttribute, ModuleBase_IWorkshop *theWorkshop) { std::wstring aName; - if (theAttribute.get() != NULL) { + if (theAttribute.get() != nullptr) { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); if (aFeature.get()) { std::string aXmlCfg, aDescription; @@ -1406,8 +1405,7 @@ qreal currentPixelRatio() { // Set displaying status to every element on group static void setDisplayingByLoop(DocumentPtr theDoc, int theSize, - std::string theGroup, bool theDisplayFromScript, - int theDisplayingId) { + std::string theGroup, int theDisplayingId) { for (int anIndex = theSize - 1; anIndex >= 0; --anIndex) { ObjectPtr anObject = theDoc->object(theGroup, anIndex); anObject->setDisplayed((theDisplayingId == 1 && anIndex == theSize - 1) || @@ -1450,14 +1448,13 @@ void setDisplaying(ResultPartPtr thePart, bool theDisplayFromScript) { } setDisplayingByLoop(aDoc, aConstructionSize, - ModelAPI_ResultConstruction::group(), - theDisplayFromScript, aDisplayingId); + ModelAPI_ResultConstruction::group(), aDisplayingId); setDisplayingByLoop(aDoc, aGroupSize, ModelAPI_ResultGroup::group(), - theDisplayFromScript, aDisplayingId); + aDisplayingId); setDisplayingByLoop(aDoc, aFieldSize, ModelAPI_ResultField::group(), - theDisplayFromScript, aDisplayingId); + aDisplayingId); setDisplayingByLoop(aDoc, aResultSize, ModelAPI_ResultBody::group(), - theDisplayFromScript, aDisplayingId); + aDisplayingId); isDoingDisplay = false; } diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.h b/src/ModuleBase/ModuleBase_ViewerFilters.h index 714f2e7ee..b85c079ab 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.h +++ b/src/ModuleBase/ModuleBase_ViewerFilters.h @@ -48,8 +48,8 @@ public: /// Returns True if the given owner is acceptable for selection /// \param theOwner the selected owner - Standard_EXPORT virtual Standard_Boolean - IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; + Standard_EXPORT Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner) & + theOwner) const override; /// Add an object type name to list of non selectable objects /// \param theType - a name of an object type @@ -103,8 +103,8 @@ public: /// Returns True if the given owner is acceptable for selection /// \param theOwner the selected owner - Standard_EXPORT virtual Standard_Boolean - IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; + Standard_EXPORT Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner) & + theOwner) const override; DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter) private: diff --git a/src/ModuleBase/ModuleBase_ViewerPrs.cpp b/src/ModuleBase/ModuleBase_ViewerPrs.cpp index 36704c114..659a9d2ec 100644 --- a/src/ModuleBase/ModuleBase_ViewerPrs.cpp +++ b/src/ModuleBase/ModuleBase_ViewerPrs.cpp @@ -29,7 +29,7 @@ ModuleBase_ViewerPrs::ModuleBase_ViewerPrs(ObjectPtr theResult, theOwner) : myResult(theResult), myOwner(theOwner), myShape(theShape) {} -ModuleBase_ViewerPrs::~ModuleBase_ViewerPrs() {} +ModuleBase_ViewerPrs::~ModuleBase_ViewerPrs() = default; bool ModuleBase_ViewerPrs::isEqual(ModuleBase_ViewerPrs *thePrs) const { if (!thePrs || thePrs->isEmpty()) diff --git a/src/ModuleBase/ModuleBase_WidgetAction.cpp b/src/ModuleBase/ModuleBase_WidgetAction.cpp index 87354aeb1..f9a4839e1 100644 --- a/src/ModuleBase/ModuleBase_WidgetAction.cpp +++ b/src/ModuleBase/ModuleBase_WidgetAction.cpp @@ -35,7 +35,7 @@ ModuleBase_WidgetAction::ModuleBase_WidgetAction( : ModuleBase_ModelWidget(theParent, theData), myActionID(attributeID()) { setAttributeID( ""); // To prevent errors. Action not stored as attribtue in feature. - QHBoxLayout *aControlLay = new QHBoxLayout(this); + auto *aControlLay = new QHBoxLayout(this); ModuleBase_Tools::adjustMargins(aControlLay); myButton = new QToolButton(this); @@ -56,7 +56,7 @@ ModuleBase_WidgetAction::ModuleBase_WidgetAction( connect(myButton, SIGNAL(clicked(bool)), this, SLOT(onActionClicked())); } -ModuleBase_WidgetAction::~ModuleBase_WidgetAction() {} +ModuleBase_WidgetAction::~ModuleBase_WidgetAction() = default; bool ModuleBase_WidgetAction::focusTo() { return false; } diff --git a/src/ModuleBase/ModuleBase_WidgetAction.h b/src/ModuleBase/ModuleBase_WidgetAction.h index 298407739..2a3dc1f31 100644 --- a/src/ModuleBase/ModuleBase_WidgetAction.h +++ b/src/ModuleBase/ModuleBase_WidgetAction.h @@ -42,17 +42,17 @@ public: /// is obtained from ModuleBase_WidgetAction(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetAction(); + ~ModuleBase_WidgetAction() override; /// Do not accept focus, returns false - virtual bool focusTo(); + bool focusTo() override; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// \return Context for translation - virtual std::string context() const { + std::string context() const override { std::string aContext = myFeatureId; if (!aContext.empty() && !myActionID.empty()) { aContext += ":"; @@ -65,10 +65,10 @@ public: protected: /// Do nothing /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Do nothing - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; protected slots: /// Listens the button click and call the customAction function of the current diff --git a/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp b/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp index 4be6b9038..1e33300ef 100644 --- a/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetBoolValue.cpp @@ -45,7 +45,7 @@ ModuleBase_WidgetBoolValue::ModuleBase_WidgetBoolValue( myCheckBox->setToolTip(aToolTip); myCheckBox->setChecked(myDefVal); - QVBoxLayout *aMainLayout = new QVBoxLayout(this); + auto *aMainLayout = new QVBoxLayout(this); ModuleBase_Tools::adjustMargins(aMainLayout); aMainLayout->addWidget(myCheckBox); setLayout(aMainLayout); @@ -53,7 +53,7 @@ ModuleBase_WidgetBoolValue::ModuleBase_WidgetBoolValue( connect(myCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(valuesChanged())); } -ModuleBase_WidgetBoolValue::~ModuleBase_WidgetBoolValue() {} +ModuleBase_WidgetBoolValue::~ModuleBase_WidgetBoolValue() = default; bool ModuleBase_WidgetBoolValue::storeValueCustom() { DataPtr aData = myFeature->data(); diff --git a/src/ModuleBase/ModuleBase_WidgetBoolValue.h b/src/ModuleBase/ModuleBase_WidgetBoolValue.h index fc6b2568f..e089aceb0 100644 --- a/src/ModuleBase/ModuleBase_WidgetBoolValue.h +++ b/src/ModuleBase/ModuleBase_WidgetBoolValue.h @@ -43,20 +43,20 @@ public: ModuleBase_WidgetBoolValue(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetBoolValue(); + ~ModuleBase_WidgetBoolValue() override; - virtual bool canAcceptFocus() const { return false; }; + bool canAcceptFocus() const override { return false; }; - virtual QList getControls() const; + QList getControls() const override; - virtual void setHighlighted(bool isHighlighted); + void setHighlighted(bool isHighlighted) override; protected: /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; private: /// The check box diff --git a/src/ModuleBase/ModuleBase_WidgetChoice.cpp b/src/ModuleBase/ModuleBase_WidgetChoice.cpp index 02db727b2..060066717 100644 --- a/src/ModuleBase/ModuleBase_WidgetChoice.cpp +++ b/src/ModuleBase/ModuleBase_WidgetChoice.cpp @@ -75,7 +75,7 @@ ModuleBase_WidgetChoice::ModuleBase_WidgetChoice( std::string aWgtDir = theData->getProperty("buttons_dir"); - QHBoxLayout *aLayout = new QHBoxLayout(this); + auto *aLayout = new QHBoxLayout(this); myChoiceCtrl = new ModuleBase_ChoiceCtrl( this, aList, aIconList, (aWgtType == "radiobuttons") ? ModuleBase_ChoiceCtrl::RadioButtons @@ -94,7 +94,7 @@ ModuleBase_WidgetChoice::ModuleBase_WidgetChoice( aLayout->addWidget(myChoiceCtrl); } -ModuleBase_WidgetChoice::~ModuleBase_WidgetChoice() {} +ModuleBase_WidgetChoice::~ModuleBase_WidgetChoice() = default; bool ModuleBase_WidgetChoice::storeValueCustom() { DataPtr aData = myFeature->data(); diff --git a/src/ModuleBase/ModuleBase_WidgetChoice.h b/src/ModuleBase/ModuleBase_WidgetChoice.h index 76e5c0655..230f8ac6a 100644 --- a/src/ModuleBase/ModuleBase_WidgetChoice.h +++ b/src/ModuleBase/ModuleBase_WidgetChoice.h @@ -55,17 +55,17 @@ public: /// is obtained from ModuleBase_WidgetChoice(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetChoice(); + ~ModuleBase_WidgetChoice() override; /// Defines if it is supported to set the value in this widget /// It returns false because this is an info widget - virtual bool canAcceptFocus() const { return false; }; + bool canAcceptFocus() const override { return false; }; - virtual bool focusTo(); + bool focusTo() override; /// Returns list of widget controls /// \return a controls list - virtual QList getControls() const; + QList getControls() const override; /// Returns text value for the property panel title /// \param theIndex a button index @@ -74,7 +74,7 @@ public: /// The slot is called when user press Ok or OkPlus buttons in the parent /// property panel - virtual void onFeatureAccepted(); + void onFeatureAccepted() override; signals: /// Segnal about selected item @@ -85,9 +85,9 @@ signals: protected: /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; private slots: /// Slot called on combo box index change diff --git a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp index eea8bf073..ee5c6f8fc 100644 --- a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.cpp @@ -41,9 +41,9 @@ ModuleBase_WidgetCreatorFactory::get() { return MY_WIDGET_CREATOR_FACTORY; } -ModuleBase_WidgetCreatorFactory::ModuleBase_WidgetCreatorFactory() {} +ModuleBase_WidgetCreatorFactory::ModuleBase_WidgetCreatorFactory() = default; -ModuleBase_WidgetCreatorFactory::~ModuleBase_WidgetCreatorFactory() {} +ModuleBase_WidgetCreatorFactory::~ModuleBase_WidgetCreatorFactory() = default; void ModuleBase_WidgetCreatorFactory::registerCreator( const WidgetCreatorPtr &theCreator) { @@ -106,7 +106,7 @@ bool ModuleBase_WidgetCreatorFactory::hasPanelWidget( QWidget *ModuleBase_WidgetCreatorFactory::createPanelByType( const std::string &theType, QWidget *theParent, const FeaturePtr &theFeature, Config_WidgetAPI *myWidgetApi) { - QWidget *aPanel = 0; + QWidget *aPanel = nullptr; if (myPanelToCreator.contains(theType)) { WidgetCreatorPtr aCreator = myPanelToCreator[theType]; aPanel = aCreator->createPanelByType(theType, theParent, theFeature, @@ -123,7 +123,7 @@ bool ModuleBase_WidgetCreatorFactory::hasPageWidget( ModuleBase_PageBase *ModuleBase_WidgetCreatorFactory::createPageByType( const std::string &theType, QWidget *theParent, Config_WidgetAPI *theWidgetApi) { - ModuleBase_PageBase *aPage = 0; + ModuleBase_PageBase *aPage = nullptr; if (myPageToCreator.contains(theType)) { WidgetCreatorPtr aCreator = myPageToCreator[theType]; @@ -136,7 +136,7 @@ ModuleBase_PageBase *ModuleBase_WidgetCreatorFactory::createPageByType( ModuleBase_ModelWidget *ModuleBase_WidgetCreatorFactory::createWidgetByType( const std::string &theType, QWidget *theParent, Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop *theWorkshop) { - ModuleBase_ModelWidget *aWidget = 0; + ModuleBase_ModelWidget *aWidget = nullptr; if (myCreators.contains(theType)) { WidgetCreatorPtr aCreator = myCreators[theType]; diff --git a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.h b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.h index 761cddabd..46603c1b9 100644 --- a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.h +++ b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.h @@ -70,7 +70,7 @@ public: /// \return a created panel or null QWidget *createPanelByType(const std::string &theType, QWidget *theParent, const FeaturePtr &theFeature, - Config_WidgetAPI *theWidgetApi = 0); + Config_WidgetAPI *theWidgetApi = nullptr); /// Returns true if there is a creator, which can make a page by the type /// \param theType a type diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index 01cbdd44a..574c1a54f 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -56,7 +56,7 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue( QWidget *theParent, const Config_WidgetAPI *theData) : ModuleBase_ModelWidget(theParent, theData), myHasDefault(false) { - QFormLayout *aControlLay = new QFormLayout(this); + auto *aControlLay = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aControlLay); QString aLabelText = translate(theData->widgetLabel()); @@ -117,7 +117,7 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue( mySpinBox->setValueEnabled(isValueEnabled()); } -ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue() {} +ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue() = default; void ModuleBase_WidgetDoubleValue::activateCustom() { ModuleBase_ModelWidget::activateCustom(); diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.h b/src/ModuleBase/ModuleBase_WidgetDoubleValue.h index 0255e7ac4..f779b712b 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.h +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.h @@ -49,21 +49,21 @@ public: ModuleBase_WidgetDoubleValue(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetDoubleValue(); + ~ModuleBase_WidgetDoubleValue() override; /// The methiod called when widget is activated - virtual void activateCustom(); + void activateCustom() override; /// Select the internal content if it can be selected. It is empty in the /// default realization - virtual void selectContent(); + void selectContent() override; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// Returns True if data of its feature was modified during operation - virtual bool isModified() const; + bool isModified() const override; public slots: // Delayed value chnged: when user starts typing something, @@ -73,19 +73,19 @@ public slots: protected: /// Returns true if the event is processed. - virtual bool processEnter(); + bool processEnter() override; /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; //! Read value of corresponded attribute from data model to the input control // \return True in success - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// Fills the widget with default values /// \return true if the widget current value is reset - virtual bool resetCustom(); + bool resetCustom() override; protected: /// Label of the widget diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.cpp b/src/ModuleBase/ModuleBase_WidgetEditor.cpp index 046fecb11..4bcf200c5 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.cpp +++ b/src/ModuleBase/ModuleBase_WidgetEditor.cpp @@ -55,12 +55,12 @@ public: setObjectName("ModuleBase_EditorDialog"); setMinimumWidth(100); } - ~ModuleBase_EditorDialog() {} + ~ModuleBase_EditorDialog() override = default; protected: // Do nothing if key pressed because it is processing on operation manager // level - virtual void keyPressEvent(QKeyEvent *theEvent) { + void keyPressEvent(QKeyEvent *theEvent) override { if (theEvent->key() == Qt::Key_Escape) return; QDialog::keyPressEvent(theEvent); @@ -70,9 +70,9 @@ protected: ModuleBase_WidgetEditor::ModuleBase_WidgetEditor( QWidget *theParent, const Config_WidgetAPI *theData) : ModuleBase_WidgetDoubleValue(theParent, theData), myXPosition(-1), - myYPosition(-1), myEditorDialog(0) {} + myYPosition(-1), myEditorDialog(nullptr) {} -ModuleBase_WidgetEditor::~ModuleBase_WidgetEditor() {} +ModuleBase_WidgetEditor::~ModuleBase_WidgetEditor() = default; bool ModuleBase_WidgetEditor::editedValue(double theSpinMinValue, double theSpinMaxValue, @@ -82,11 +82,10 @@ bool ModuleBase_WidgetEditor::editedValue(double theSpinMinValue, myEditorDialog = new ModuleBase_EditorDialog(QApplication::desktop(), Qt::FramelessWindowHint); - QHBoxLayout *aLay = new QHBoxLayout(myEditorDialog); + auto *aLay = new QHBoxLayout(myEditorDialog); aLay->setContentsMargins(2, 2, 2, 2); - ModuleBase_ParamSpinBox *anEditor = - new ModuleBase_ParamSpinBox(myEditorDialog); + auto *anEditor = new ModuleBase_ParamSpinBox(myEditorDialog); anEditor->setMinimum(theSpinMinValue); anEditor->setMaximum(theSpinMaxValue); @@ -120,7 +119,7 @@ bool ModuleBase_WidgetEditor::editedValue(double theSpinMinValue, } } delete myEditorDialog; - myEditorDialog = 0; + myEditorDialog = nullptr; return isValueAccepted; } diff --git a/src/ModuleBase/ModuleBase_WidgetEditor.h b/src/ModuleBase/ModuleBase_WidgetEditor.h index 18951023f..f3142985e 100644 --- a/src/ModuleBase/ModuleBase_WidgetEditor.h +++ b/src/ModuleBase/ModuleBase_WidgetEditor.h @@ -51,13 +51,13 @@ public: ModuleBase_WidgetEditor(QWidget *theParent, const std::string &theAttribute); /// Destructor - virtual ~ModuleBase_WidgetEditor(); + ~ModuleBase_WidgetEditor() override; /// Set focus to the first control of the current widget. /// The focus policy of the control is checked. /// If the widget has the NonFocus focus policy, it is skipped. /// \return the state whether the widget can accept the focus - virtual bool focusTo(); + bool focusTo() override; /// Shous popup window under cursor for data editing /// \param theSendSignals a flag whether the signals should be sent or the @@ -72,10 +72,10 @@ public: protected: /// Returns true if the event is processed. - virtual bool processEnter(); + bool processEnter() override; /// Reject the current editor dialog if it is shown and returns true. - virtual bool processEscape(); + bool processEscape() override; private: /// Show editor diff --git a/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp b/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp index 314cd6fce..5e4c4ce86 100644 --- a/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp +++ b/src/ModuleBase/ModuleBase_WidgetExprEditor.cpp @@ -51,7 +51,7 @@ #include ExpressionEditor::ExpressionEditor(QWidget *theParent) - : QPlainTextEdit(theParent), myCompletedAndSelected(false) { + : QPlainTextEdit(theParent) { myCompleter = new QCompleter(this); myCompleter->setWidget(this); myCompleter->setCompletionMode(QCompleter::PopupCompletion); @@ -73,7 +73,7 @@ ExpressionEditor::ExpressionEditor(QWidget *theParent) setTabChangesFocus(true); } -ExpressionEditor::~ExpressionEditor() {} +ExpressionEditor::~ExpressionEditor() = default; void ExpressionEditor::setCompletionList(QStringList &theList) { theList.sort(); @@ -213,7 +213,7 @@ ModuleBase_WidgetExprEditor::ModuleBase_WidgetExprEditor( QWidget *theParent, const Config_WidgetAPI *theData, const std::string &thePlaceHolder) : ModuleBase_ModelWidget(theParent, theData) { - QVBoxLayout *aMainLay = new QVBoxLayout(this); + auto *aMainLay = new QVBoxLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); myResultLabel = new QLabel(this); @@ -234,7 +234,7 @@ ModuleBase_WidgetExprEditor::ModuleBase_WidgetExprEditor( SIGNAL(keyReleased(QObject *, QKeyEvent *))); } -ModuleBase_WidgetExprEditor::~ModuleBase_WidgetExprEditor() {} +ModuleBase_WidgetExprEditor::~ModuleBase_WidgetExprEditor() = default; void ModuleBase_WidgetExprEditor::activateCustom() { ModuleBase_ModelWidget::activateCustom(); diff --git a/src/ModuleBase/ModuleBase_WidgetExprEditor.h b/src/ModuleBase/ModuleBase_WidgetExprEditor.h index e770acaf2..73ff27bae 100644 --- a/src/ModuleBase/ModuleBase_WidgetExprEditor.h +++ b/src/ModuleBase/ModuleBase_WidgetExprEditor.h @@ -44,8 +44,8 @@ class ExpressionEditor : public QPlainTextEdit { public: /// Constructor /// \param theParent a parent widget - explicit ExpressionEditor(QWidget *theParent = 0); - virtual ~ExpressionEditor(); + explicit ExpressionEditor(QWidget *theParent = nullptr); + ~ExpressionEditor() override; /// Set list of completion strings void setCompletionList(QStringList &); @@ -86,19 +86,19 @@ protected: /// Redefinition of virtual method /// \param theEvent a key press event - virtual void keyPressEvent(QKeyEvent *theEvent); + void keyPressEvent(QKeyEvent *theEvent) override; /// Key events processing /// theEvent a key event bool handledCompletedAndSelected(QKeyEvent *theEvent); /// Redefinition of virtual method - virtual void paintEvent(QPaintEvent *); + void paintEvent(QPaintEvent *) override; private: QStringListModel *myCompleterModel; QCompleter *myCompleter; - bool myCompletedAndSelected; + bool myCompletedAndSelected{false}; QString myPlaceHolderText; }; @@ -117,13 +117,13 @@ public: ModuleBase_WidgetExprEditor(QWidget *theParent, const Config_WidgetAPI *theData, const std::string &thePlaceHolder); - virtual ~ModuleBase_WidgetExprEditor(); + ~ModuleBase_WidgetExprEditor() override; /// The methiod called when widget is activated - virtual void activateCustom(); + void activateCustom() override; /// Redefinition of virtual method - virtual QList getControls() const; + QList getControls() const override; protected slots: /// A slot for processing text changed event @@ -131,17 +131,17 @@ protected slots: protected: /// Returns true if the event is processed. - virtual bool processEnter(); + bool processEnter() override; /// Do not initialize value on the widget activation - virtual void initializeValueByActivate(); + void initializeValueByActivate() override; /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Redefinition of virtual method - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; private: /// A line edit control diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.cpp b/src/ModuleBase/ModuleBase_WidgetFactory.cpp index 84be50a58..9013cbb37 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFactory.cpp @@ -145,7 +145,7 @@ void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase *thePage, createWidget(aPage); if (aWdgType == WDG_SWITCH || aWdgType == WDG_TOOLBOX || aWdgType == WDG_RADIOBOX) { - ModuleBase_PagedContainer *aContainer = + auto *aContainer = qobject_cast(aWidget); QString anIconPath = @@ -170,8 +170,7 @@ void ModuleBase_WidgetFactory::createPanel(ModuleBase_PageBase *thePage, ModuleBase_WidgetCreatorFactory::get()->hasPanelWidget(aPanelName)) { QWidget *aPanel = ModuleBase_WidgetCreatorFactory::get()->createPanelByType( aPanelName, thePage->pageWidget(), theFeature, myWidgetApi); - ModuleBase_ModelWidget *aModelWdg = - dynamic_cast(aPanel); + auto *aModelWdg = dynamic_cast(aPanel); if (aModelWdg) thePage->addModelWidget(aModelWdg); else @@ -283,25 +282,23 @@ void ModuleBase_WidgetFactory::moveToWidgetId(const std::string &theWidgetId, ModuleBase_PageBase * ModuleBase_WidgetFactory::createPageByType(const std::string &theType, QWidget *theParent) { - ModuleBase_PageBase *aResult = NULL; + ModuleBase_PageBase *aResult = nullptr; if (theType == WDG_GROUP) { QString aGroupName = qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)); - ModuleBase_PageGroupBox *aPage = new ModuleBase_PageGroupBox(theParent); + auto *aPage = new ModuleBase_PageGroupBox(theParent); aPage->setTitle(ModuleBase_Tools::translate(myWidgetApi->myFeatureId, aGroupName.toStdString())); aResult = aPage; } else if (theType == WDG_OPTIONALBOX) { - ModuleBase_WidgetOptionalBox *aPage = - new ModuleBase_WidgetOptionalBox(theParent, myWidgetApi); + auto *aPage = new ModuleBase_WidgetOptionalBox(theParent, myWidgetApi); aResult = aPage; } if (!aResult) aResult = ModuleBase_WidgetCreatorFactory::get()->createPageByType( theType, theParent, myWidgetApi); - ModuleBase_ModelWidget *aWidget = - dynamic_cast(aResult); + auto *aWidget = dynamic_cast(aResult); if (aWidget) myModelWidgets.append(aWidget); @@ -311,7 +308,7 @@ ModuleBase_WidgetFactory::createPageByType(const std::string &theType, ModuleBase_ModelWidget * ModuleBase_WidgetFactory::createWidgetByType(const std::string &theType, QWidget *theParent) { - ModuleBase_ModelWidget *result = NULL; + ModuleBase_ModelWidget *result = nullptr; if (theType == WDG_INFO) { result = new ModuleBase_WidgetLabel(theParent, myWidgetApi); @@ -363,7 +360,7 @@ ModuleBase_WidgetFactory::createWidgetByType(const std::string &theType, } else if (theType == WDG_TOOLBOX_BOX || theType == WDG_SWITCH_CASE || theType == NODE_VALIDATOR) { // Do nothing for "box" and "case" - result = NULL; + result = nullptr; } else if (theType == WDG_ACTION) { result = new ModuleBase_WidgetAction(theParent, myWidgetApi); } else if (theType == WDG_POINT_INPUT) { diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.h b/src/ModuleBase/ModuleBase_WidgetFactory.h index febdf2ac5..6ba9f1bff 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.h +++ b/src/ModuleBase/ModuleBase_WidgetFactory.h @@ -98,7 +98,7 @@ protected: /// \param theType a type /// \param theParent a parent widget ModuleBase_ModelWidget *createWidgetByType(const std::string &theType, - QWidget *theParent = NULL); + QWidget *theParent = nullptr); /// Convert STD string to QT string /// \param theStdString is STD string diff --git a/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp b/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp index 11ad36ce3..e4ddbd1bb 100644 --- a/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFileSelector.cpp @@ -47,7 +47,7 @@ static QString myDefaultPath; ModuleBase_WidgetFileSelector::ModuleBase_WidgetFileSelector( QWidget *theParent, const Config_WidgetAPI *theData) - : ModuleBase_ModelWidget(theParent, theData), myFileDialog(0) { + : ModuleBase_ModelWidget(theParent, theData), myFileDialog(nullptr) { myTitle = translate(theData->getProperty("title")); myType = (theData->getProperty("type") == "save") ? WFS_SAVE : WFS_OPEN; if (myDefaultPath.isNull() || myDefaultPath.isEmpty()) @@ -57,15 +57,15 @@ ModuleBase_WidgetFileSelector::ModuleBase_WidgetFileSelector( myDefaultPath = Config_PropManager::string("Plugins", "import_initial_path").c_str(); - QGridLayout *aMainLay = new QGridLayout(this); + auto *aMainLay = new QGridLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); - QLabel *aTitleLabel = new QLabel(myTitle, this); + auto *aTitleLabel = new QLabel(myTitle, this); aTitleLabel->setIndent(1); aMainLay->addWidget(aTitleLabel, 0, 0); myPathField = new QLineEdit(this); aMainLay->addWidget(myPathField, 1, 0); - QPushButton *aSelectPathBtn = new QPushButton("...", this); + auto *aSelectPathBtn = new QPushButton("...", this); aSelectPathBtn->setToolTip(tr("Select file...")); aSelectPathBtn->setMaximumWidth(20); aSelectPathBtn->setMaximumHeight(20); @@ -80,7 +80,7 @@ ModuleBase_WidgetFileSelector::ModuleBase_WidgetFileSelector( connect(aSelectPathBtn, SIGNAL(clicked()), this, SLOT(onPathSelectionBtn())); } -ModuleBase_WidgetFileSelector::~ModuleBase_WidgetFileSelector() {} +ModuleBase_WidgetFileSelector::~ModuleBase_WidgetFileSelector() = default; bool ModuleBase_WidgetFileSelector::storeValueCustom() { // A rare case when plugin was not loaded. @@ -159,7 +159,7 @@ void ModuleBase_WidgetFileSelector::onPathSelectionBtn() { } } } - myFileDialog = 0; + myFileDialog = nullptr; } void ModuleBase_WidgetFileSelector::onPathChanged() { diff --git a/src/ModuleBase/ModuleBase_WidgetFileSelector.h b/src/ModuleBase/ModuleBase_WidgetFileSelector.h index 4fec7d84c..6c539cb6d 100644 --- a/src/ModuleBase/ModuleBase_WidgetFileSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetFileSelector.h @@ -60,9 +60,9 @@ public: /// is obtained from ModuleBase_WidgetFileSelector(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetFileSelector(); + ~ModuleBase_WidgetFileSelector() override; - virtual QList getControls() const; + QList getControls() const override; /// Returns true if a file on the current path in the line edit /// exists and has supported format @@ -77,13 +77,13 @@ public slots: protected: /// Reject the current editor dialog if it is shown and returns true. - virtual bool processEscape(); + bool processEscape() override; /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; protected: /// Converts format to filter string diff --git a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp index 334a1c6a7..238851d8f 100644 --- a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp @@ -52,7 +52,7 @@ ModuleBase_WidgetIntValue::ModuleBase_WidgetIntValue( QWidget *theParent, const Config_WidgetAPI *theData) : ModuleBase_ModelWidget(theParent, theData), myHasDefault(false) { - QFormLayout *aControlLay = new QFormLayout(this); + auto *aControlLay = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aControlLay); QString aLabelText = translate(theData->widgetLabel()); @@ -102,7 +102,7 @@ ModuleBase_WidgetIntValue::ModuleBase_WidgetIntValue( SIGNAL(valuesModified())); } -ModuleBase_WidgetIntValue::~ModuleBase_WidgetIntValue() {} +ModuleBase_WidgetIntValue::~ModuleBase_WidgetIntValue() = default; void ModuleBase_WidgetIntValue::activateCustom() { ModuleBase_ModelWidget::activateCustom(); diff --git a/src/ModuleBase/ModuleBase_WidgetIntValue.h b/src/ModuleBase/ModuleBase_WidgetIntValue.h index 0724e887e..c5790ad35 100644 --- a/src/ModuleBase/ModuleBase_WidgetIntValue.h +++ b/src/ModuleBase/ModuleBase_WidgetIntValue.h @@ -49,37 +49,37 @@ public: ModuleBase_WidgetIntValue(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetIntValue(); + ~ModuleBase_WidgetIntValue() override; /// The methiod called when widget is activated - virtual void activateCustom(); + void activateCustom() override; /// Select the internal content if it can be selected. It is empty in the /// default realization - virtual void selectContent(); + void selectContent() override; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// Returns True if data of its feature was modified during operation - virtual bool isModified() const; + bool isModified() const override; protected: /// Returns true if the event is processed. - virtual bool processEnter(); + bool processEnter() override; /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; //! Read value of corresponded attribute from data model to the input control // \return True in success - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// Fills the widget with default values /// \return true if the widget current value is reset - virtual bool resetCustom(); + bool resetCustom() override; protected: /// Label of the widget diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.cpp b/src/ModuleBase/ModuleBase_WidgetLabel.cpp index 2e0d1c3ec..89a51124b 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabel.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLabel.cpp @@ -55,7 +55,7 @@ ModuleBase_WidgetLabel::ModuleBase_WidgetLabel(QWidget *theParent, if (aIsHtml) myLabel->setTextFormat(Qt::RichText); - QVBoxLayout *aLayout = new QVBoxLayout(this); + auto *aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); aLayout->addWidget(myLabel); setLayout(aLayout); @@ -69,7 +69,7 @@ ModuleBase_WidgetLabel::ModuleBase_WidgetLabel(QWidget *theParent, myLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); } -ModuleBase_WidgetLabel::~ModuleBase_WidgetLabel() {} +ModuleBase_WidgetLabel::~ModuleBase_WidgetLabel() = default; QList ModuleBase_WidgetLabel::getControls() const { return QList(); diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.h b/src/ModuleBase/ModuleBase_WidgetLabel.h index 3fdd2672d..a1205b96b 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabel.h +++ b/src/ModuleBase/ModuleBase_WidgetLabel.h @@ -39,23 +39,23 @@ public: /// is obtained from ModuleBase_WidgetLabel(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetLabel(); + ~ModuleBase_WidgetLabel() override; /// Defines if it is supported to set the value in this widget /// It returns false because this is an info widget - virtual bool canAcceptFocus() const { return false; }; + bool canAcceptFocus() const override { return false; }; - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; - virtual QList getControls() const; + QList getControls() const override; /// This control doesn't accept focus - virtual bool focusTo(); + bool focusTo() override; protected: /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom() { return true; } + bool storeValueCustom() override { return true; } /// A label control QLabel *myLabel; diff --git a/src/ModuleBase/ModuleBase_WidgetLabelValue.cpp b/src/ModuleBase/ModuleBase_WidgetLabelValue.cpp index e21e55cc0..6b39150c3 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabelValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLabelValue.cpp @@ -32,7 +32,7 @@ ModuleBase_WidgetLabelValue::ModuleBase_WidgetLabelValue( QWidget *theParent, const Config_WidgetAPI *theData) : ModuleBase_ModelWidget(theParent, theData) { - QVBoxLayout *aLayout = new QVBoxLayout(this); + auto *aLayout = new QVBoxLayout(this); aLayout->setContentsMargins(0, 0, 0, 0); aLayout->setSpacing(0); @@ -50,7 +50,7 @@ ModuleBase_WidgetLabelValue::ModuleBase_WidgetLabelValue( aLayout->addWidget(myLabel); } -ModuleBase_WidgetLabelValue::~ModuleBase_WidgetLabelValue() {} +ModuleBase_WidgetLabelValue::~ModuleBase_WidgetLabelValue() = default; QList ModuleBase_WidgetLabelValue::getControls() const { QList aControls; diff --git a/src/ModuleBase/ModuleBase_WidgetLabelValue.h b/src/ModuleBase/ModuleBase_WidgetLabelValue.h index 77e2c30f5..739fb9d7a 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabelValue.h +++ b/src/ModuleBase/ModuleBase_WidgetLabelValue.h @@ -41,19 +41,19 @@ public: ModuleBase_WidgetLabelValue(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetLabelValue(); + ~ModuleBase_WidgetLabelValue() override; - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; - virtual QList getControls() const; + QList getControls() const override; protected: /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; //! Switch On/Off highlighting of the widget - virtual void setHighlighted(bool isHighlighted) {} + void setHighlighted(bool isHighlighted) override {} protected: ModuleBase_LabelValue *myLabel; ///< A label control diff --git a/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp b/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp index b59f7ea3f..9bee60009 100644 --- a/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLineEdit.cpp @@ -53,11 +53,11 @@ public: CustomLineEdit(QWidget *theParent, const QString &thePlaceHolder) : QLineEdit(theParent), myPlaceHolder(thePlaceHolder) {} - virtual ~CustomLineEdit() {} + ~CustomLineEdit() override = default; /// Redefiniotion of virtual method /// \param theEvent a paint event - virtual void paintEvent(QPaintEvent *theEvent) { + void paintEvent(QPaintEvent *theEvent) override { QLineEdit::paintEvent(theEvent); if (text().isEmpty() && !myPlaceHolder.isEmpty()) { QPainter aPainter(this); @@ -85,11 +85,11 @@ ModuleBase_WidgetLineEdit::ModuleBase_WidgetLineEdit( QWidget *theParent, const Config_WidgetAPI *theData, const std::string &thePlaceHolder) : ModuleBase_ModelWidget(theParent, theData) { - QFormLayout *aMainLay = new QFormLayout(this); + auto *aMainLay = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); QString aLabelText = translate(theData->widgetLabel()); QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); - QLabel *aLabel = new QLabel(aLabelText, this); + auto *aLabel = new QLabel(aLabelText, this); if (!aLabelIcon.isEmpty()) aLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); @@ -109,7 +109,7 @@ ModuleBase_WidgetLineEdit::ModuleBase_WidgetLineEdit( SIGNAL(valuesModified())); } -ModuleBase_WidgetLineEdit::~ModuleBase_WidgetLineEdit() {} +ModuleBase_WidgetLineEdit::~ModuleBase_WidgetLineEdit() = default; bool ModuleBase_WidgetLineEdit::storeValueCustom() { // A rare case when plugin was not loaded. diff --git a/src/ModuleBase/ModuleBase_WidgetLineEdit.h b/src/ModuleBase/ModuleBase_WidgetLineEdit.h index 8e1526a89..9fb8263de 100644 --- a/src/ModuleBase/ModuleBase_WidgetLineEdit.h +++ b/src/ModuleBase/ModuleBase_WidgetLineEdit.h @@ -46,24 +46,24 @@ public: /// \param thePlaceHolder a string of placeholder ModuleBase_WidgetLineEdit(QWidget *theParent, const Config_WidgetAPI *theData, const std::string &thePlaceHolder); - virtual ~ModuleBase_WidgetLineEdit(); + ~ModuleBase_WidgetLineEdit() override; /// Redefinition of virtual method - virtual QList getControls() const; + QList getControls() const override; /// Returns True if data of its feature was modified during operation - virtual bool isModified() const; + bool isModified() const override; protected: /// Returns true if the event is processed. - virtual bool processEnter(); + bool processEnter() override; /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Redefinition of virtual method - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// A line edit control QLineEdit *myLineEdit; diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 6b700dfc8..8db7ade36 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -111,7 +111,7 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector( const Config_WidgetAPI *theData) : ModuleBase_WidgetSelector(theParent, theWorkshop, theData), myIsSetSelectionBlocked(false), myCurrentHistoryIndex(-1), - myIsFirst(true), myFiltersWgt(0), myShowOnlyBtn(0) { + myIsFirst(true), myFiltersWgt(nullptr), myShowOnlyBtn(nullptr) { std::string aPropertyTypes = theData->getProperty("shape_types"); QString aTypesStr = aPropertyTypes.c_str(); myShapeTypes = aTypesStr.split(' ', QString::SkipEmptyParts); @@ -160,19 +160,19 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector( QString aLabelText = translate(theData->getProperty("label")); if (aLabelText.size() > 0) { - QWidget *aLabelWgt = new QWidget(this); - QHBoxLayout *aLabelLayout = new QHBoxLayout(aLabelWgt); + auto *aLabelWgt = new QWidget(this); + auto *aLabelLayout = new QHBoxLayout(aLabelWgt); aLabelLayout->setContentsMargins(0, 0, 0, 0); myMainLayout->addWidget(aLabelWgt); - QLabel *aListLabel = new QLabel(aLabelText, this); + auto *aListLabel = new QLabel(aLabelText, this); aLabelLayout->addWidget(aListLabel); // if the xml definition contains one type, an information label // should be shown near to the latest if (myShapeTypes.size() <= 1) { QString aLabelIcon = QString::fromStdString(theData->widgetIcon()); if (!aLabelIcon.isEmpty()) { - QLabel *aSelectedLabel = new QLabel("", this); + auto *aSelectedLabel = new QLabel("", this); aSelectedLabel->setPixmap( ModuleBase_IconFactory::loadPixmap(aLabelIcon)); aLabelLayout->addWidget(aSelectedLabel); @@ -195,8 +195,8 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector( myUseFilters = theData->getProperty("use_filters"); if (myUseFilters.length() > 0) { - QWidget *aFltrWgt = new QWidget(this); - QHBoxLayout *aFltrLayout = new QHBoxLayout(aFltrWgt); + auto *aFltrWgt = new QWidget(this); + auto *aFltrLayout = new QHBoxLayout(aFltrWgt); myFiltersWgt = new ModuleBase_FilterStarter(myUseFilters, aFltrWgt, theWorkshop); @@ -220,7 +220,7 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector( myMainLayout->addWidget(myGeomCheck); connect(myGeomCheck, SIGNAL(toggled(bool)), SLOT(onSameTopology(bool))); } else - myGeomCheck = 0; + myGeomCheck = nullptr; myIsNeutralPointClear = theData->getBooleanAttribute("clear_in_neutral_point", true); @@ -232,7 +232,7 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector( } } -ModuleBase_WidgetMultiSelector::~ModuleBase_WidgetMultiSelector() {} +ModuleBase_WidgetMultiSelector::~ModuleBase_WidgetMultiSelector() = default; //******************************************************************** void ModuleBase_WidgetMultiSelector::activateCustom() { @@ -521,7 +521,7 @@ bool ModuleBase_WidgetMultiSelector::isValidSelectionCustom( if (aFeature.get()) aResult = aFeature->firstResult(); } - aValid = aResult.get() != NULL; + aValid = aResult.get() != nullptr; if (aValid) { if (myFeature) { // We can not select a result of our feature @@ -907,7 +907,7 @@ void ModuleBase_WidgetMultiSelector::getSelectedAttributeIndices( void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection( std::set theAttributeIds, QList &theValues) const { - if (myFeature.get() == NULL) + if (myFeature.get() == nullptr) return; DataPtr aData = myFeature->data(); @@ -926,7 +926,7 @@ void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection( ObjectPtr anObject = anAttr->contextObject(); if (anObject.get()) theValues.append(std::shared_ptr( - new ModuleBase_ViewerPrs(anObject, anAttr->value(), NULL))); + new ModuleBase_ViewerPrs(anObject, anAttr->value(), nullptr))); } } else if (aType == ModelAPI_AttributeRefList::typeId()) { AttributeRefListPtr aRefListAttr = aData->reflist(attributeID()); @@ -939,7 +939,7 @@ void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection( ObjectPtr anObject = aRefListAttr->object(i); if (anObject.get()) { theValues.append(std::shared_ptr( - new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), nullptr))); } } } else if (aType == ModelAPI_AttributeRefAttrList::typeId()) { @@ -960,7 +960,7 @@ void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection( GeomShapePtr aGeomShape = ModuleBase_Tools::getShape(anAttr, myWorkshop); theValues.append(std::shared_ptr( - new ModuleBase_ViewerPrs(anObject, aGeomShape, NULL))); + new ModuleBase_ViewerPrs(anObject, aGeomShape, nullptr))); } } } @@ -1095,8 +1095,7 @@ bool ModuleBase_WidgetMultiSelector::findInSelection( } if (theGeomSelection.find(theObject) != theGeomSelection.end()) { // found const std::set &aShapes = theGeomSelection.at(theObject); - std::set::const_iterator anIt = aShapes.begin(), - aLast = aShapes.end(); + auto anIt = aShapes.begin(), aLast = aShapes.end(); for (; anIt != aLast && !aFound; anIt++) { GeomShapePtr aCShape = *anIt; if (aCShape.get()) { @@ -1120,7 +1119,7 @@ bool ModuleBase_WidgetMultiSelector::findInSelection( if (!aFound && theShape.get() && theWorkshop->hasSHIFTPressed() && theObject->isDisplayed()) { AISObjectPtr anAIS = theWorkshop->findPresentation(theObject); - if (anAIS.get() != NULL) { + if (anAIS.get() != nullptr) { Handle(AIS_InteractiveObject) anAISIO = anAIS->impl(); @@ -1264,9 +1263,8 @@ void ModuleBase_WidgetMultiSelector::setReadOnly(bool isReadOnly) { myWorkshop->module()->getXMLRepresentation(myUseFilters, aXmlCfg, aDescription); - ModuleBase_WidgetSelectionFilter *aWgt = - new ModuleBase_WidgetSelectionFilter( - this, myWorkshop, new Config_WidgetAPI(aDescription), true); + auto *aWgt = new ModuleBase_WidgetSelectionFilter( + this, myWorkshop, new Config_WidgetAPI(aDescription), true); aWgt->setFeature(aFilters); aWgt->restoreValue(); myMainLayout->addWidget(aWgt); diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index a0b4dd09c..79010b6fb 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -70,65 +70,65 @@ public: ModuleBase_WidgetMultiSelector(QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetMultiSelector(); + ~ModuleBase_WidgetMultiSelector() override; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// The methiod called when widget is deactivated - virtual void deactivate(); + void deactivate() override; /// Update Undo/Redo actions state - virtual void updateAfterDeactivation(); + void updateAfterDeactivation() override; /// Update Undo/Redo actions state - virtual void updateAfterActivation(); + void updateAfterActivation() override; /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs /// \param theValues the wrapped selection values /// \param theToValidate a validation of the values flag - virtual bool - setSelection(QList> &theValues, - const bool theToValidate); + bool setSelection(QList> &theValues, + const bool theToValidate) override; /// Returns values which should be highlighted when the whidget is active /// \param theValues a list of presentations - virtual void - getHighlighted(QList> &theValues); + void getHighlighted( + QList> &theValues) override; /// Returns true if the action can be processed. By default it is empty and /// returns false. \param theActionType an action type \param isActionEnabled /// if true, the enable state of the action - virtual bool canProcessAction(ModuleBase_ActionType theActionType, - bool &isActionEnabled); + bool canProcessAction(ModuleBase_ActionType theActionType, + bool &isActionEnabled) override; /// Returns true if the event is processed. The default implementation is /// empty, returns false. - virtual bool processAction(ModuleBase_ActionType theActionType, - const ActionParamPtr &theParam = ActionParamPtr()); + bool + processAction(ModuleBase_ActionType theActionType, + const ActionParamPtr &theParam = ActionParamPtr()) override; /// Checks the widget validity. By default, it returns true. /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool - isValidSelectionCustom(const std::shared_ptr &thePrs); + bool isValidSelectionCustom( + const std::shared_ptr &thePrs) override; /// Returns list of accessible actions for Undo/Redo commands. By default it /// returns empty list. \param theActionType type of action. It can be /// ActionUndo or ActionRedo. - virtual QList - actionsList(ModuleBase_ActionType theActionType) const; + QList + actionsList(ModuleBase_ActionType theActionType) const override; /// The slot is called when user press Ok or OkPlus buttons in the parent /// property panel - virtual void onFeatureAccepted(); + void onFeatureAccepted() override; /// Returns True if data of its feature was modified during operation - virtual bool isModified() const; + bool isModified() const override; - virtual void setReadOnly(bool isReadOnly); + void setReadOnly(bool isReadOnly) override; public slots: /// Slot is called on selection type changed @@ -137,7 +137,7 @@ public slots: protected: /// Returns true if envent is processed. /// Redefined to process XML state about clear selection in neutral point - virtual bool processSelection(); + bool processSelection() override; protected slots: /// Slot for delete command in a list pop-up menu @@ -155,17 +155,17 @@ protected slots: protected: /// Returns true if the event is processed. The default implementation is /// empty, returns false. - virtual bool processDelete(); + bool processDelete() override; /// The methiod called when widget is activated - virtual void activateCustom(); + void activateCustom() override; /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// restire type of selection by feature attribute - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// Creates an element of the attribute current selection if history is empty virtual void appendFirstSelectionInHistory(); @@ -178,18 +178,18 @@ protected: void clearSelectedHistory(); /// Set the focus on the last item in the list - virtual void updateFocus(); + void updateFocus() override; /// Computes and updates name of selected object in the widget - virtual void updateSelectionName(); + void updateSelectionName() override; /// Emits model changed info, updates the current control by selection change /// \param theDone a state whether the selection is set - virtual void updateOnSelectionChanged(const bool theDone); + void updateOnSelectionChanged(const bool theDone) override; /// Retunrs a list of possible shape types /// \return a list of shapes - virtual QIntList shapeTypes() const; + QIntList shapeTypes() const override; /// Set current shape type for selection void setCurrentShapeType(const QString &theShapeType); @@ -197,8 +197,8 @@ protected: /// Return the attribute values wrapped in a list of viewer presentations /// \return a list of viewer presentations, which contains an attribute result /// and a shape. If the attribute do not uses the shape, it is empty - virtual QList> - getAttributeSelection() const; + QList> + getAttributeSelection() const override; /// Fills the list control by the attribute values void updateSelectionList(); diff --git a/src/ModuleBase/ModuleBase_WidgetNameEdit.h b/src/ModuleBase/ModuleBase_WidgetNameEdit.h index 604de3054..2850dacc0 100644 --- a/src/ModuleBase/ModuleBase_WidgetNameEdit.h +++ b/src/ModuleBase/ModuleBase_WidgetNameEdit.h @@ -33,17 +33,17 @@ public: /// Returns True if the widget uses feature attribute. /// If not then it means that the widget do not need attribute at all. - virtual bool usesAttribute() const { return false; } + bool usesAttribute() const override { return false; } - virtual bool focusTo() { return false; } + bool focusTo() override { return false; } protected: /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Redefinition of virtual method - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; }; #endif diff --git a/src/ModuleBase/ModuleBase_WidgetOptionalBox.cpp b/src/ModuleBase/ModuleBase_WidgetOptionalBox.cpp index 0ef3e1f8b..da04a5b78 100644 --- a/src/ModuleBase/ModuleBase_WidgetOptionalBox.cpp +++ b/src/ModuleBase/ModuleBase_WidgetOptionalBox.cpp @@ -36,10 +36,11 @@ ModuleBase_WidgetOptionalBox::ModuleBase_WidgetOptionalBox( QWidget *theParent, const Config_WidgetAPI *theData) : ModuleBase_ModelWidget(theParent, theData), ModuleBase_PageBase(), - myOptionType(CheckBox), myCheckBoxFrame(0), myCheckBox(0), - myCheckBoxLayout(0), myCheckBoxWidget(0), myGroupBox(0), - myGroupBoxLayout(0), myCheckGroup(0), myCheckGroupBtn(0), - myCheckContent(0), myCheckGroupLayout(0), myEnableOnCheck(true) { + myOptionType(CheckBox), myCheckBoxFrame(nullptr), myCheckBox(nullptr), + myCheckBoxLayout(nullptr), myCheckBoxWidget(nullptr), myGroupBox(nullptr), + myGroupBoxLayout(nullptr), myCheckGroup(nullptr), + myCheckGroupBtn(nullptr), myCheckContent(nullptr), + myCheckGroupLayout(nullptr), myEnableOnCheck(true) { myToolTip = theData->widgetTooltip(); myGroupTitle = theData->getProperty(CONTAINER_PAGE_NAME); @@ -54,7 +55,7 @@ ModuleBase_WidgetOptionalBox::ModuleBase_WidgetOptionalBox( ModuleBase_Tools::adjustMargins(myMainLayout); } -ModuleBase_WidgetOptionalBox::~ModuleBase_WidgetOptionalBox() {} +ModuleBase_WidgetOptionalBox::~ModuleBase_WidgetOptionalBox() = default; QWidget *ModuleBase_WidgetOptionalBox::pageWidget() { return myOptionType == GroupBox ? (myGroupBox ? myGroupBox : myCheckGroup) @@ -98,7 +99,7 @@ void ModuleBase_WidgetOptionalBox::placeModelWidget( setOptionType(GroupBox); ModuleBase_ModelWidget *aCheckBoxWidget = myCheckBoxWidget; - myCheckBoxWidget = 0; + myCheckBoxWidget = nullptr; if (aCheckBoxWidget) // move the model widget from check box frame to group // box frame placeModelWidget(aCheckBoxWidget); @@ -162,7 +163,7 @@ void ModuleBase_WidgetOptionalBox::createControl(const OptionType &theType) { connect(myGroupBox, SIGNAL(clicked(bool)), this, SLOT(onPageClicked())); } else { myCheckGroup = new QWidget(this); - QVBoxLayout *aLayout = new QVBoxLayout(myCheckGroup); + auto *aLayout = new QVBoxLayout(myCheckGroup); ModuleBase_Tools::zeroMargins(aLayout); myCheckGroupBtn = new QCheckBox(translate(myGroupTitle), myCheckGroup); @@ -235,7 +236,7 @@ void ModuleBase_WidgetOptionalBox::setOptionType( } bool ModuleBase_WidgetOptionalBox::isCheckBoxFilled() const { - return myCheckBoxWidget != 0; + return myCheckBoxWidget != nullptr; } bool ModuleBase_WidgetOptionalBox::getCurrentValue() const { diff --git a/src/ModuleBase/ModuleBase_WidgetOptionalBox.h b/src/ModuleBase/ModuleBase_WidgetOptionalBox.h index de27a3a29..e2d362fe1 100644 --- a/src/ModuleBase/ModuleBase_WidgetOptionalBox.h +++ b/src/ModuleBase/ModuleBase_WidgetOptionalBox.h @@ -51,11 +51,11 @@ public: /// is obtained from ModuleBase_WidgetOptionalBox(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetOptionalBox(); + ~ModuleBase_WidgetOptionalBox() override; /// Defines if it is supported to set the value in this widget /// \return false because this is an info widget - virtual bool canAcceptFocus() const { return false; }; + bool canAcceptFocus() const override { return false; }; /// Methods to be redefined from ModuleBase_PageBase: start /// Cast the page to regular QWidget @@ -65,7 +65,7 @@ public: /// Methods to be redefined from ModuleBase_ModelWidget: start /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// Methods to be redefined from ModuleBase_ModelWidget: end protected slots: @@ -75,21 +75,21 @@ protected slots: protected: /// Methods to be redefined from ModuleBase_PageBase: start /// Adds the given widget to page's layout - virtual void placeModelWidget(ModuleBase_ModelWidget *theWidget); + void placeModelWidget(ModuleBase_ModelWidget *theWidget) override; /// Adds the given page to page's layout - virtual void placeWidget(QWidget *theWidget); + void placeWidget(QWidget *theWidget) override; /// Returns page's layout (QGridLayout) - virtual QLayout *pageLayout(); + QLayout *pageLayout() override; /// Adds a stretch to page's layout - virtual void addPageStretch(); + void addPageStretch() override; /// Methods to be redefined from ModuleBase_PageBase: end /// Methods to be redefined from ModuleBase_ModelWidget: start /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Restore value from attribute data to the widget's control - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// Methods to be redefined from ModuleBase_ModelWidget: end private: diff --git a/src/ModuleBase/ModuleBase_WidgetPointInput.cpp b/src/ModuleBase/ModuleBase_WidgetPointInput.cpp index 848b0ef6f..7ec82f7e4 100644 --- a/src/ModuleBase/ModuleBase_WidgetPointInput.cpp +++ b/src/ModuleBase/ModuleBase_WidgetPointInput.cpp @@ -55,14 +55,14 @@ ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput( myDefaultValue[i] = aStrArray.at(i).toDouble(); } } - QFormLayout *aMainlayout = new QFormLayout(this); + auto *aMainlayout = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aMainlayout); myXSpin = new ModuleBase_ParamSpinBox(this); myXSpin->setAcceptVariables(aAcceptVariables); myXSpin->setToolTip(tr("X coordinate")); myXSpin->setValue(myDefaultValue[0]); - QLabel *aXLbl = new QLabel(this); + auto *aXLbl = new QLabel(this); aXLbl->setPixmap(QPixmap(":pictures/x_size.png")); aMainlayout->addRow(aXLbl, myXSpin); @@ -70,7 +70,7 @@ ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput( myYSpin->setAcceptVariables(aAcceptVariables); myYSpin->setToolTip(tr("Y coordinate")); myYSpin->setValue(myDefaultValue[1]); - QLabel *aYLbl = new QLabel(this); + auto *aYLbl = new QLabel(this); aYLbl->setPixmap(QPixmap(":pictures/y_size.png")); aMainlayout->addRow(aYLbl, myYSpin); @@ -78,7 +78,7 @@ ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput( myZSpin->setAcceptVariables(aAcceptVariables); myZSpin->setToolTip(tr("Z coordinate")); myZSpin->setValue(myDefaultValue[2]); - QLabel *aZLbl = new QLabel(this); + auto *aZLbl = new QLabel(this); aZLbl->setPixmap(QPixmap(":pictures/z_size.png")); aMainlayout->addRow(aZLbl, myZSpin); @@ -90,7 +90,7 @@ ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput( SIGNAL(valuesModified())); } -ModuleBase_WidgetPointInput::~ModuleBase_WidgetPointInput() {} +ModuleBase_WidgetPointInput::~ModuleBase_WidgetPointInput() = default; //******************************************************************** QList ModuleBase_WidgetPointInput::getControls() const { @@ -214,7 +214,7 @@ QIntList ModuleBase_WidgetPointInput::shapeTypes() const { //******************************************************************** bool ModuleBase_WidgetPointInput ::setSelection( QList> &theValues, - const bool theToValidate) { + const bool /*theToValidate*/) { if (theValues.size() == 1) { GeomShapePtr aShape = theValues.first()->shape(); if (aShape.get() && aShape->isVertex()) { diff --git a/src/ModuleBase/ModuleBase_WidgetPointInput.h b/src/ModuleBase/ModuleBase_WidgetPointInput.h index dfc04a58c..6f9de44f8 100644 --- a/src/ModuleBase/ModuleBase_WidgetPointInput.h +++ b/src/ModuleBase/ModuleBase_WidgetPointInput.h @@ -40,40 +40,40 @@ public: const Config_WidgetAPI *theData); /// Destructor - virtual ~ModuleBase_WidgetPointInput(); + ~ModuleBase_WidgetPointInput() override; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Restore value from attribute data to the widget's control - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// Defines if it is supposed that the widget should interact with the viewer. - virtual bool isViewerSelector() { return true; } + bool isViewerSelector() override { return true; } /// Fills given container with selection modes if the widget has it /// \param [out] theModuleSelectionModes module additional modes, -1 means all /// default modes \param [out] theModes a container of modes - virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes); + void selectionModes(int &theModuleSelectionModes, + QIntList &theModes) override; /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - virtual bool - setSelection(QList> &theValues, - const bool theToValidate); + bool setSelection(QList> &theValues, + const bool theToValidate) override; protected: /// Retunrs a list of possible shape types /// \return a list of shapes - virtual QIntList shapeTypes() const; + QIntList shapeTypes() const override; /// Returns true if the event is processed. - virtual bool processEnter(); + bool processEnter() override; protected: ModuleBase_ParamSpinBox *myXSpin; diff --git a/src/ModuleBase/ModuleBase_WidgetRadiobox.cpp b/src/ModuleBase/ModuleBase_WidgetRadiobox.cpp index 7fc7ba439..3c7952bba 100644 --- a/src/ModuleBase/ModuleBase_WidgetRadiobox.cpp +++ b/src/ModuleBase/ModuleBase_WidgetRadiobox.cpp @@ -41,7 +41,7 @@ ModuleBase_WidgetRadiobox::ModuleBase_WidgetRadiobox( connect(myGroup, SIGNAL(buttonToggled(int, bool)), SLOT(onPageChanged())); } -ModuleBase_WidgetRadiobox::~ModuleBase_WidgetRadiobox() {} +ModuleBase_WidgetRadiobox::~ModuleBase_WidgetRadiobox() = default; int ModuleBase_WidgetRadiobox::addPage(ModuleBase_PageBase *thePage, const QString &theName, @@ -50,8 +50,8 @@ int ModuleBase_WidgetRadiobox::addPage(ModuleBase_PageBase *thePage, const QString &theTooltip) { ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, theTooltip); - QWidget *aWgt = new QWidget(this); - QVBoxLayout *aLay = new QVBoxLayout(aWgt); + auto *aWgt = new QWidget(this); + auto *aLay = new QVBoxLayout(aWgt); aLay->setContentsMargins(0, 0, 0, 0); QRadioButton *aButton; diff --git a/src/ModuleBase/ModuleBase_WidgetRadiobox.h b/src/ModuleBase/ModuleBase_WidgetRadiobox.h index 78de46a32..7829ef29c 100644 --- a/src/ModuleBase/ModuleBase_WidgetRadiobox.h +++ b/src/ModuleBase/ModuleBase_WidgetRadiobox.h @@ -38,23 +38,23 @@ public: /// is obtained from ModuleBase_WidgetRadiobox(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetRadiobox(); + ~ModuleBase_WidgetRadiobox() override; /// Add a page to the widget /// \param theWidget a page widget /// \param theName a name of page /// \param theCaseId an Id of the page /// \param theIcon an icon of the page - virtual int addPage(ModuleBase_PageBase *theWidget, const QString &theName, - const QString &theCaseId, const QPixmap &theIcon, - const QString &theTooltip); + int addPage(ModuleBase_PageBase *theWidget, const QString &theName, + const QString &theCaseId, const QPixmap &theIcon, + const QString &theTooltip) override; protected: /// Implements ModuleBase_PagedContainer - virtual int currentPageIndex() const; + int currentPageIndex() const override; /// Implements ModuleBase_PagedContainer - virtual void setCurrentPageIndex(int); + void setCurrentPageIndex(int) override; private: QFormLayout *myLayout; diff --git a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp index ccdd97e9e..1580b66cb 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp @@ -91,11 +91,11 @@ ModuleBase_FilterStarter::ModuleBase_FilterStarter( const std::string &theFeature, QWidget *theParent, ModuleBase_IWorkshop *theWorkshop) : QWidget(theParent), myFeatureName(theFeature), myWorkshop(theWorkshop) { - QHBoxLayout *aMainLayout = new QHBoxLayout(this); + auto *aMainLayout = new QHBoxLayout(this); ModuleBase_Tools::adjustMargins(aMainLayout); aMainLayout->addStretch(1); - QPushButton *aLaunchBtn = new QPushButton( + auto *aLaunchBtn = new QPushButton( ModuleBase_Tools::translate("FiltersSelection", "Selection by filters"), this); connect(aLaunchBtn, SIGNAL(clicked()), SLOT(onFiltersLaunch())); @@ -107,15 +107,13 @@ void ModuleBase_FilterStarter::onFiltersLaunch() { QString("FiltersPlugin.html"); ModuleBase_Operation *aParentOp = myWorkshop->currentOperation(); - ModuleBase_OperationFeature *aFeatureOp = - dynamic_cast(aParentOp); + auto *aFeatureOp = dynamic_cast(aParentOp); if (aFeatureOp) // Open transaction on filters operation finish aFeatureOp->openTransactionOnResume(); QWidget *aParent = parentWidget(); - ModuleBase_WidgetMultiSelector *aSelector = - dynamic_cast(aParent); + auto *aSelector = dynamic_cast(aParent); while (!aSelector) { aParent = aParent->parentWidget(); aSelector = dynamic_cast(aParent); @@ -126,9 +124,8 @@ void ModuleBase_FilterStarter::onFiltersLaunch() { ModuleBase_WidgetSelectionFilter::AttributeId = aSelector->attributeID(); // Launch Filters operation - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->module()->createOperation(myFeatureName)); + auto *aFOperation = dynamic_cast( + myWorkshop->module()->createOperation(myFeatureName)); AttributeSelectionListPtr aAttrList = ModuleBase_WidgetSelectionFilter::SelectorFeature->selectionList( @@ -165,14 +162,14 @@ ModuleBase_FilterItem::ModuleBase_FilterItem( aValidatorReader.setFeatureId(mySelection->getKind()); aValidatorReader.readAll(); - QVBoxLayout *aLayout = new QVBoxLayout(this); + auto *aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); - QWidget *aItemRow = new QWidget(this); + auto *aItemRow = new QWidget(this); addItemRow(aItemRow); aLayout->addWidget(aItemRow); - ModuleBase_PageWidget *aParamsWgt = new ModuleBase_PageWidget(this); + auto *aParamsWgt = new ModuleBase_PageWidget(this); aParamsWgt->setFrameStyle(QFrame::Box | QFrame::Raised); aFactory.createWidget(aParamsWgt); ModuleBase_Tools::zeroMargins(aParamsWgt->layout()); @@ -193,7 +190,7 @@ ModuleBase_FilterItem::ModuleBase_FilterItem( void ModuleBase_FilterItem::addItemRow(QWidget *theParent) { std::string aContext = mySelection->getKind(); - QHBoxLayout *aLayout = new QHBoxLayout(theParent); + auto *aLayout = new QHBoxLayout(theParent); ModuleBase_Tools::zeroMargins(aLayout); // Reverse filter button @@ -217,7 +214,7 @@ void ModuleBase_FilterItem::addItemRow(QWidget *theParent) { new QLabel(ModuleBase_Tools::translate(aContext, aFilterName), theParent), 1); - QToolButton *aDelBtn = new QToolButton(theParent); + auto *aDelBtn = new QToolButton(theParent); aDelBtn->setIcon(QIcon(":pictures/delete.png")); aDelBtn->setAutoRaise(true); aDelBtn->setToolTip( @@ -255,11 +252,11 @@ ModuleBase_WidgetSelectionFilter::ModuleBase_WidgetSelectionFilter( } // Define widgets - QVBoxLayout *aMainLayout = new QVBoxLayout(this); + auto *aMainLayout = new QVBoxLayout(this); ModuleBase_Tools::adjustMargins(aMainLayout); - QGroupBox *aFiltersGroup = new QGroupBox(translate("Filters"), this); - QVBoxLayout *aGroupLayout = new QVBoxLayout(aFiltersGroup); + auto *aFiltersGroup = new QGroupBox(translate("Filters"), this); + auto *aGroupLayout = new QVBoxLayout(aFiltersGroup); aGroupLayout->setContentsMargins(0, 0, 0, 0); aGroupLayout->setSpacing(0); @@ -287,8 +284,8 @@ ModuleBase_WidgetSelectionFilter::ModuleBase_WidgetSelectionFilter( aMainLayout->addWidget(aFiltersGroup); // Select Button - QWidget *aBtnWgt = new QWidget(this); - QHBoxLayout *aBtnLayout = new QHBoxLayout(aBtnWgt); + auto *aBtnWgt = new QWidget(this); + auto *aBtnLayout = new QHBoxLayout(aBtnWgt); ModuleBase_Tools::adjustMargins(aBtnLayout); aBtnLayout->addStretch(1); @@ -300,8 +297,8 @@ ModuleBase_WidgetSelectionFilter::ModuleBase_WidgetSelectionFilter( aMainLayout->addWidget(aBtnWgt); // Label widgets - QWidget *aLblWgt = new QWidget(this); - QHBoxLayout *aLblLayout = new QHBoxLayout(aLblWgt); + auto *aLblWgt = new QWidget(this); + auto *aLblLayout = new QHBoxLayout(aLblWgt); ModuleBase_Tools::zeroMargins(aLblLayout); aLblLayout->addWidget( @@ -393,8 +390,8 @@ void ModuleBase_WidgetSelectionFilter::onAddFilter(int theIndex) { ModuleBase_FilterItem * ModuleBase_WidgetSelectionFilter::onAddFilter(const std::string &theFilter) { if (theFilter.length() == 0) - return 0; - ModuleBase_FilterItem *aItem = new ModuleBase_FilterItem(theFilter, this); + return nullptr; + auto *aItem = new ModuleBase_FilterItem(theFilter, this); connect(aItem, SIGNAL(deleteItem(ModuleBase_FilterItem *)), SLOT(onDeleteItem(ModuleBase_FilterItem *))); connect(aItem, SIGNAL(reversedItem(ModuleBase_FilterItem *)), @@ -447,7 +444,7 @@ void ModuleBase_WidgetSelectionFilter::redisplayFeature() { } void ModuleBase_WidgetSelectionFilter::onReverseItem( - ModuleBase_FilterItem *theItem) { + ModuleBase_FilterItem * /*theItem*/) { updateSelectBtn(); clearCurrentSelection(true); updateNumberSelected(); @@ -471,8 +468,7 @@ void ModuleBase_WidgetSelectionFilter::onSelect() { TopoDS_Compound aComp; aBuilder.MakeCompound(aComp); - std::list>::const_iterator itSelected = - aResList.cbegin(); + auto itSelected = aResList.cbegin(); for (; itSelected != aResList.cend(); itSelected++) { ResultPtr aCurRes = (*itSelected).first; GeomShapePtr aSubShape = (*itSelected).second; @@ -615,7 +611,7 @@ void replaceSubShapesByResult(QList &theResults, TopTools_MapOfShape aShapesMap; if (aRes.get()) { GeomShapePtr aSubShape = aRes->shape(); - const TopoDS_Shape &aShape = aSubShape->impl(); + const auto &aShape = aSubShape->impl(); for (TopExp_Explorer anExp(aShape, (TopAbs_ShapeEnum)theShapeType); anExp.More(); anExp.Next()) { aShapesMap.Add(anExp.Current()); @@ -682,11 +678,11 @@ bool ModuleBase_WidgetSelectionFilter::restoreValueCustom() { std::list::const_iterator aIt; int i = 0; int aNbItems = aItemsList.size(); - ModuleBase_FilterItem *aItem = 0; + ModuleBase_FilterItem *aItem = nullptr; bool isBlocked = myFiltersCombo->blockSignals(true); for (aIt = aFilters.cbegin(); aIt != aFilters.cend(); aIt++, i++) { std::string aStr = (*aIt); - aItem = 0; + aItem = nullptr; if (i >= aNbItems) { aItem = onAddFilter(aStr); FilterPtr aFilterObj = aFactory->filter(aStr); @@ -742,10 +738,9 @@ void ModuleBase_WidgetSelectionFilter::onObjectUpdated() { void ModuleBase_WidgetSelectionFilter::storeFilters( const std::list &theFilters) { - for (std::list::const_iterator anIt = theFilters.begin(); - anIt != theFilters.end(); ++anIt) { - std::string aName = translate((*anIt)->name()).toStdString(); - myFilters[aName] = *anIt; + for (const auto &theFilter : theFilters) { + std::string aName = translate(theFilter->name()).toStdString(); + myFilters[aName] = theFilter; } } diff --git a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h index d619fe868..fc3a9170b 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h +++ b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.h @@ -62,7 +62,7 @@ public: ModuleBase_IWorkshop *theWorkshop); /// Destructor - ~ModuleBase_FilterStarter() {} + ~ModuleBase_FilterStarter() override = default; private slots: /// A slot to launch filtering operation @@ -149,15 +149,15 @@ public: bool theReadOnly = false); /// Destructor - ~ModuleBase_WidgetSelectionFilter(); + ~ModuleBase_WidgetSelectionFilter() override; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// It is called when user press Ok or OkPlus buttons in the parent property /// panel By default this slot does nothing - virtual void onFeatureAccepted(); + void onFeatureAccepted() override; /// Returns current workshop ModuleBase_IWorkshop *workshop() const { return myWorkshop; } @@ -166,16 +166,16 @@ public: QWidget *filtersWidget() const { return myFiltersWgt; } /// Returns error string - virtual QString getError(const bool theValueStateChecked = true) const; + QString getError(const bool theValueStateChecked = true) const override; protected: /// Saves the internal parameters to the given feature (not ussed for this /// widget) \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Restore value from attribute data to the widget's control (not ussed for /// this widget) - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; private slots: /// Add a filter by Id in combo box @@ -220,7 +220,7 @@ private: QList itemsList() const; /// Translate a string - QString translate(const std::string &theString) const; + QString translate(const std::string &theString) const override; /// Store translated names of filters and their instances void diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.cpp b/src/ModuleBase/ModuleBase_WidgetSelector.cpp index f2bcfe132..cebd48bf9 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelector.cpp @@ -58,7 +58,7 @@ ModuleBase_WidgetSelector::ModuleBase_WidgetSelector( } //******************************************************************** -ModuleBase_WidgetSelector::~ModuleBase_WidgetSelector() {} +ModuleBase_WidgetSelector::~ModuleBase_WidgetSelector() = default; //******************************************************************** void ModuleBase_WidgetSelector::getGeomSelection( @@ -177,7 +177,7 @@ bool ModuleBase_WidgetSelector::acceptSubShape( QIntList::const_iterator anIt = aShapeTypes.begin(), aLast = aShapeTypes.end(); for (; anIt != aLast && !aValid; anIt++) { - TopAbs_ShapeEnum aCurrentShapeType = (TopAbs_ShapeEnum)*anIt; + auto aCurrentShapeType = (TopAbs_ShapeEnum)*anIt; if (aShapeType == aCurrentShapeType) aValid = true; else if (aCurrentShapeType == TopAbs_FACE) { diff --git a/src/ModuleBase/ModuleBase_WidgetSelectorStore.cpp b/src/ModuleBase/ModuleBase_WidgetSelectorStore.cpp index ad5dd9384..02e14224f 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectorStore.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelectorStore.cpp @@ -28,7 +28,7 @@ #include ModuleBase_WidgetSelectorStore::ModuleBase_WidgetSelectorStore() - : myIsObject(false), mySelectionType(""), mySelectionCount(0) {} + : mySelectionType("") {} void ModuleBase_WidgetSelectorStore::storeAttributeValue( const AttributePtr &theAttribute, ModuleBase_IWorkshop *theWorkshop) { diff --git a/src/ModuleBase/ModuleBase_WidgetSelectorStore.h b/src/ModuleBase/ModuleBase_WidgetSelectorStore.h index 979c63172..76f1b5c5d 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectorStore.h +++ b/src/ModuleBase/ModuleBase_WidgetSelectorStore.h @@ -39,7 +39,7 @@ public: /// Constructor MODULEBASE_EXPORT ModuleBase_WidgetSelectorStore(); /// Destructor - MODULEBASE_EXPORT virtual ~ModuleBase_WidgetSelectorStore() {} + MODULEBASE_EXPORT virtual ~ModuleBase_WidgetSelectorStore() = default; /// Creates a backup of the current values of the attribute /// \param theAttribute a model attribute which parameters are to be stored @@ -65,13 +65,13 @@ private: /// A reference of the attribute AttributePtr myRefAttribute; /// A boolean value whether refAttr uses reference of object - bool myIsObject; + bool myIsObject{false}; /// Variable of selection type std::string mySelectionType; /// Variable of GeomSelection - int mySelectionCount; // number of elements in the attribute selection list - // when store + int mySelectionCount{0}; // number of elements in the attribute selection list + // when store }; #endif diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index 4ebc3cd4c..168b2b5cd 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -82,7 +82,7 @@ ModuleBase_WidgetShapeSelector::ModuleBase_WidgetShapeSelector( QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData) : ModuleBase_WidgetSelector(theParent, theWorkshop, theData) { - QFormLayout *aLayout = new QFormLayout(this); + auto *aLayout = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aLayout); QString aLabelText = translate(theData->widgetLabel()); @@ -107,7 +107,7 @@ ModuleBase_WidgetShapeSelector::ModuleBase_WidgetShapeSelector( } //******************************************************************** -ModuleBase_WidgetShapeSelector::~ModuleBase_WidgetShapeSelector() {} +ModuleBase_WidgetShapeSelector::~ModuleBase_WidgetShapeSelector() = default; //******************************************************************** bool ModuleBase_WidgetShapeSelector::storeValueCustom() { @@ -122,7 +122,7 @@ bool ModuleBase_WidgetShapeSelector::setSelection( // In order to make reselection possible, set empty object and shape should // be done setSelectionCustom(std::shared_ptr( - new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), nullptr))); return false; } // it removes the processed value from the parameters list @@ -151,7 +151,7 @@ ModuleBase_WidgetShapeSelector::getAttributeSelection() const { ObjectPtr anObject = ModuleBase_Tools::getObject(anAttribute); std::shared_ptr aShapePtr = getShape(); ModuleBase_ViewerPrsPtr aPrs( - new ModuleBase_ViewerPrs(anObject, aShapePtr, NULL)); + new ModuleBase_ViewerPrs(anObject, aShapePtr, nullptr)); aSelected.append(aPrs); } return aSelected; @@ -213,12 +213,12 @@ void ModuleBase_WidgetShapeSelector::updateSelectionName() { if (!isNameUpdated) { ObjectPtr anObject = ModuleBase_Tools::getObject(myFeature->attribute(attributeID())); - if (anObject.get() != NULL) { + if (anObject.get() != nullptr) { std::wstring aName = anObject->data()->name(); myTextLine->setText(QString::fromStdWString(aName)); } else { AttributeRefAttrPtr aRefAttr = aData->refattr(attributeID()); - if (aRefAttr && aRefAttr->attr().get() != NULL) { + if (aRefAttr && aRefAttr->attr().get() != nullptr) { // myIsObject = aRefAttr->isObject(); std::wstring anAttrName = ModuleBase_Tools::generateName(aRefAttr->attr(), myWorkshop); diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h index 9032157c2..4b14367e2 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.h @@ -81,7 +81,7 @@ public: ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetShapeSelector(); + ~ModuleBase_WidgetShapeSelector() override; /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs @@ -89,33 +89,32 @@ public: /// preselection. It is redefined to check the value validity and if it is, /// fill the attribute with by value \param theValues the wrapped selection /// values \param theToValidate a flag on validation of the values - virtual bool - setSelection(QList> &theValues, - const bool theToValidate); + bool setSelection(QList> &theValues, + const bool theToValidate) override; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// Returns True if data of its feature was modified during operation - virtual bool isModified() const; + bool isModified() const override; protected: /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// Computes and updates name of selected object in the widget - virtual void updateSelectionName(); + void updateSelectionName() override; // Update focus after the attribute value change - virtual void updateFocus(); + void updateFocus() override; /// Retunrs a list of possible shape types /// \return a list of shapes - virtual QIntList shapeTypes() const; + QIntList shapeTypes() const override; /// Get the shape from the attribute if the attribute contains a shape, e.g. /// selection attribute \return a shape @@ -124,8 +123,8 @@ protected: /// Return the attribute values wrapped in a list of viewer presentations /// \return a list of viewer presentations, which contains an attribute result /// and a shape. If the attribute do not uses the shape, it is empty - virtual QList> - getAttributeSelection() const; + QList> + getAttributeSelection() const override; //----------- Class members ------------- protected: diff --git a/src/ModuleBase/ModuleBase_WidgetSwitch.cpp b/src/ModuleBase/ModuleBase_WidgetSwitch.cpp index 7da2ad00c..e7c095053 100644 --- a/src/ModuleBase/ModuleBase_WidgetSwitch.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSwitch.cpp @@ -33,7 +33,7 @@ ModuleBase_WidgetSwitch::ModuleBase_WidgetSwitch( QWidget *theParent, const Config_WidgetAPI *theData) : ModuleBase_PagedContainer(theParent, theData) { myRemeberChoice = false; - QVBoxLayout *aMainLay = new QVBoxLayout(this); + auto *aMainLay = new QVBoxLayout(this); // aMainLay->setContentsMargins(2, 4, 2, 2); ModuleBase_Tools::adjustMargins(aMainLay); myCombo = new QComboBox(this); @@ -49,7 +49,7 @@ ModuleBase_WidgetSwitch::ModuleBase_WidgetSwitch( SLOT(setCurrentIndex(int))); } -ModuleBase_WidgetSwitch::~ModuleBase_WidgetSwitch() {} +ModuleBase_WidgetSwitch::~ModuleBase_WidgetSwitch() = default; int ModuleBase_WidgetSwitch::addPage(ModuleBase_PageBase *thePage, const QString &theName, @@ -62,7 +62,7 @@ int ModuleBase_WidgetSwitch::addPage(ModuleBase_PageBase *thePage, int aResultCount = myCombo->count(); if (aResultCount == 2) myCombo->show(); - QFrame *aFrame = dynamic_cast(thePage); + auto *aFrame = dynamic_cast(thePage); aFrame->setFrameShape(QFrame::Box); aFrame->setFrameStyle(QFrame::Sunken); myPagesLayout->addWidget(aFrame); diff --git a/src/ModuleBase/ModuleBase_WidgetSwitch.h b/src/ModuleBase/ModuleBase_WidgetSwitch.h index 15f5b2ba3..6f2c8154e 100644 --- a/src/ModuleBase/ModuleBase_WidgetSwitch.h +++ b/src/ModuleBase/ModuleBase_WidgetSwitch.h @@ -41,28 +41,28 @@ public: /// \param theData the widget configuration. The attribute of the model widget /// is obtained from ModuleBase_WidgetSwitch(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetSwitch(); + ~ModuleBase_WidgetSwitch() override; /// Defines if it is supported to set the value in this widget /// It returns false because this is an info widget - virtual bool canAcceptFocus() const { return false; }; + bool canAcceptFocus() const override { return false; }; /// Add a page to the widget /// \param theWidget a page widget /// \param theName a name of page /// \param theCaseId an Id of the page /// \param theIcon an icon of the page - virtual int addPage(ModuleBase_PageBase *theWidget, const QString &theName, - const QString &theCaseId, const QPixmap &theIcon, - const QString &theTooltip); + int addPage(ModuleBase_PageBase *theWidget, const QString &theName, + const QString &theCaseId, const QPixmap &theIcon, + const QString &theTooltip) override; protected: /// Returns index of the current page - virtual int currentPageIndex() const; + int currentPageIndex() const override; /// Set current page by index /// \param index index of the page - virtual void setCurrentPageIndex(int index); + void setCurrentPageIndex(int index) override; private: /// Combo box diff --git a/src/ModuleBase/ModuleBase_WidgetToolbox.cpp b/src/ModuleBase/ModuleBase_WidgetToolbox.cpp index 69d4063ba..6f3dee888 100644 --- a/src/ModuleBase/ModuleBase_WidgetToolbox.cpp +++ b/src/ModuleBase/ModuleBase_WidgetToolbox.cpp @@ -34,14 +34,13 @@ ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox( QWidget *theParent, const Config_WidgetAPI *theData) : ModuleBase_PagedContainer(theParent, theData) { - QVBoxLayout *aMainLayout = new QVBoxLayout(this); + auto *aMainLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aMainLayout); bool aHasContainerParent = false; - QWidget *aParent = dynamic_cast(parent()); + auto *aParent = dynamic_cast(parent()); while (aParent && !aHasContainerParent) { - ModuleBase_PagedContainer *aPagedContainer = - dynamic_cast(aParent); + auto *aPagedContainer = dynamic_cast(aParent); aHasContainerParent = aPagedContainer; aParent = dynamic_cast(aParent->parent()); } @@ -60,7 +59,7 @@ ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox( connect(myToolBox, SIGNAL(currentChanged(int)), this, SLOT(onPageChanged())); } -ModuleBase_WidgetToolbox::~ModuleBase_WidgetToolbox() {} +ModuleBase_WidgetToolbox::~ModuleBase_WidgetToolbox() = default; int ModuleBase_WidgetToolbox::addPage(ModuleBase_PageBase *thePage, const QString &theName, @@ -69,7 +68,7 @@ int ModuleBase_WidgetToolbox::addPage(ModuleBase_PageBase *thePage, const QString &theTooltip) { ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, theTooltip); - QFrame *aFrame = dynamic_cast(thePage); + auto *aFrame = dynamic_cast(thePage); myToolBox->addItem(aFrame, translate(theName.toStdString()), theIcon); return myToolBox->count(); } diff --git a/src/ModuleBase/ModuleBase_WidgetToolbox.h b/src/ModuleBase/ModuleBase_WidgetToolbox.h index 8511f0d08..f57ad3fe4 100644 --- a/src/ModuleBase/ModuleBase_WidgetToolbox.h +++ b/src/ModuleBase/ModuleBase_WidgetToolbox.h @@ -41,27 +41,27 @@ public: /// \param theData the widget configuration. The attribute of the model widget /// is obtained from ModuleBase_WidgetToolbox(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetToolbox(); + ~ModuleBase_WidgetToolbox() override; /// Defines if it is supported to set the value in this widget /// \return false because this is an info widget - virtual bool canAcceptFocus() const { return false; }; + bool canAcceptFocus() const override { return false; }; /// Add a page to the widget /// \param theWidget a page widget /// \param theName a name of page /// \param theCaseId an Id of the page /// \param theIcon an icon of the page - virtual int addPage(ModuleBase_PageBase *theWidget, const QString &theName, - const QString &theCaseId, const QPixmap &theIcon, - const QString &theTooltip); + int addPage(ModuleBase_PageBase *theWidget, const QString &theName, + const QString &theCaseId, const QPixmap &theIcon, + const QString &theTooltip) override; protected: /// Implements ModuleBase_PagedContainer - virtual int currentPageIndex() const; + int currentPageIndex() const override; /// Implements ModuleBase_PagedContainer - virtual void setCurrentPageIndex(int); + void setCurrentPageIndex(int) override; private: ModuleBase_ToolBox *myToolBox; diff --git a/src/ModuleBase/ModuleBase_WidgetUndoLabel.h b/src/ModuleBase/ModuleBase_WidgetUndoLabel.h index 5f2e8bbae..d5a6d0784 100644 --- a/src/ModuleBase/ModuleBase_WidgetUndoLabel.h +++ b/src/ModuleBase/ModuleBase_WidgetUndoLabel.h @@ -43,9 +43,9 @@ public: ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetUndoLabel() {} + ~ModuleBase_WidgetUndoLabel() override = default; - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; private slots: void onUndo(); diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index 8426253a7..4a92715e0 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -60,7 +60,7 @@ ModuleBase_WidgetValidated::~ModuleBase_WidgetValidated() { //******************************************************************** ObjectPtr ModuleBase_WidgetValidated::findPresentedObject( - const AISObjectPtr &theAIS) const { + const AISObjectPtr & /*theAIS*/) const { return myPresentedObject; } @@ -85,7 +85,7 @@ void ModuleBase_WidgetValidated::storeAttributeValue( //******************************************************************** void ModuleBase_WidgetValidated::restoreAttributeValue( - const AttributePtr &theAttribute, const bool theValid) { + const AttributePtr &theAttribute, const bool /*theValid*/) { myIsInValidate = false; myAttributeStore->restoreAttributeValue(theAttribute, myWorkshop); } @@ -315,7 +315,7 @@ bool ModuleBase_WidgetValidated::isValidSelectionForAttribute( //******************************************************************** bool ModuleBase_WidgetValidated::isValidSelectionCustom( - const ModuleBase_ViewerPrsPtr &thePrs) { + const ModuleBase_ViewerPrsPtr & /*thePrs*/) { return true; } @@ -339,7 +339,7 @@ bool ModuleBase_WidgetValidated::isFilterActivated() const { //******************************************************************** void ModuleBase_WidgetValidated::selectionFilters( - QIntList &theModuleSelectionFilters, + QIntList & /*theModuleSelectionFilters*/, SelectMgr_ListOfFilter &theSelectionFilters) { theSelectionFilters.Append(myWorkshop->validatorFilter()); } @@ -383,7 +383,7 @@ void ModuleBase_WidgetValidated::storeValidState( GeomShapePtr aShape = theValue.get() ? theValue->shape() : GeomShapePtr(); if (aShape.get()) { if (theValid) { - const TopoDS_Shape &aTDShape = aShape->impl(); + const auto &aTDShape = aShape->impl(); bool aValidPrsContains = myValidPrs.IsBound(aTDShape) && theValue.get()->isEqual(myValidPrs.Find(aTDShape).get()); @@ -401,7 +401,7 @@ void ModuleBase_WidgetValidated::storeValidState( } } else { // !theValid if (aShape.get()) { - const TopoDS_Shape &aTDShape = aShape->impl(); + const auto &aTDShape = aShape->impl(); bool anIValidPrsContains = myInvalidPrs.IsBound(aTDShape) && theValue.get()->isEqual(myInvalidPrs.Find(aTDShape).get()); @@ -442,7 +442,7 @@ bool ModuleBase_WidgetValidated::getValidState( if (!aShape.get()) return false; - const TopoDS_Shape &aTDShape = aShape->impl(); + const auto &aTDShape = aShape->impl(); bool aValidPrsContains = myValidPrs.IsBound(aTDShape) && theValue.get()->isEqual(myValidPrs.Find(aTDShape).get()); @@ -527,8 +527,7 @@ void ModuleBase_WidgetValidated::filterCompSolids( FeaturePtr aFeature = std::dynamic_pointer_cast(anObject); if (aFeature.get()) { - std::list::const_iterator aRes = - aFeature->results().cbegin(); + auto aRes = aFeature->results().cbegin(); for (; aRes != aFeature->results().cend(); aRes++) aFilterOut.insert(*aRes); } diff --git a/src/ModuleBase/ModuleBase_WidgetValidator.cpp b/src/ModuleBase/ModuleBase_WidgetValidator.cpp index d8db0faf1..16917b126 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidator.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidator.cpp @@ -40,7 +40,7 @@ ModuleBase_WidgetValidator::~ModuleBase_WidgetValidator() { //******************************************************************** void ModuleBase_WidgetValidator::selectionFilters( - QIntList &theModuleSelectionFilters, + QIntList & /*theModuleSelectionFilters*/, SelectMgr_ListOfFilter &theSelectionFilters) { theSelectionFilters.Append(myWorkshop->validatorFilter()); } @@ -65,7 +65,7 @@ void ModuleBase_WidgetValidator::storeAttributeValue( } void ModuleBase_WidgetValidator::restoreAttributeValue( - const AttributePtr &theAttribute, const bool theValid) { + const AttributePtr &theAttribute, const bool /*theValid*/) { myIsInValidate = false; myAttributeStore->restoreAttributeValue(theAttribute, myWorkshop); } diff --git a/src/ParametersAPI/ParametersAPI_Parameter.cpp b/src/ParametersAPI/ParametersAPI_Parameter.cpp index ca2ecb39a..0a27a1ab3 100644 --- a/src/ParametersAPI/ParametersAPI_Parameter.cpp +++ b/src/ParametersAPI/ParametersAPI_Parameter.cpp @@ -61,7 +61,7 @@ double ParametersAPI_Parameter::value() { return aRes->data()->real(ModelAPI_ResultParameter::VALUE())->value(); } -ParametersAPI_Parameter::~ParametersAPI_Parameter() {} +ParametersAPI_Parameter::~ParametersAPI_Parameter() = default; void ParametersAPI_Parameter::dump(ModelHighAPI_Dumper &theDumper) const { FeaturePtr aBase = feature(); @@ -103,7 +103,7 @@ void removeParameter(const std::shared_ptr &thePart, const ParameterPtr &theParameter) { FeaturePtr aParam = theParameter->feature(); if (aParam) { - ModelAPI_ReplaceParameterMessage::send(aParam, 0); + ModelAPI_ReplaceParameterMessage::send(aParam, nullptr); thePart->removeFeature(aParam); } } diff --git a/src/ParametersAPI/ParametersAPI_Parameter.h b/src/ParametersAPI/ParametersAPI_Parameter.h index 6c2dd85ac..eb2c8196f 100644 --- a/src/ParametersAPI/ParametersAPI_Parameter.h +++ b/src/ParametersAPI/ParametersAPI_Parameter.h @@ -49,7 +49,7 @@ public: const std::wstring &theComment = std::wstring()); /// Destructor PARAMETERSAPI_EXPORT - virtual ~ParametersAPI_Parameter(); + ~ParametersAPI_Parameter() override; INTERFACE_3(ParametersPlugin_Parameter::ID(), name, ParametersPlugin_Parameter::VARIABLE_ID(), @@ -68,7 +68,7 @@ public: /// Dump wrapped feature PARAMETERSAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; //! Pointer on Parameter object diff --git a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp index bb8f572ec..9d7deac8a 100644 --- a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp +++ b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp @@ -70,12 +70,11 @@ ParametersPlugin_EvalListener::ParametersPlugin_EvalListener() { Events_ID anEvents_IDs[] = {ModelAPI_ObjectRenamedMessage::eventId(), ModelAPI_ReplaceParameterMessage::eventId()}; - for (unsigned long long i = 0; - i < sizeof(anEvents_IDs) / sizeof(anEvents_IDs[0]); ++i) - aLoop->registerListener(this, anEvents_IDs[i], NULL, true); + for (auto anEvents_ID : anEvents_IDs) + aLoop->registerListener(this, anEvents_ID, nullptr, true); } -ParametersPlugin_EvalListener::~ParametersPlugin_EvalListener() {} +ParametersPlugin_EvalListener::~ParametersPlugin_EvalListener() = default; void ParametersPlugin_EvalListener::processEvent( const std::shared_ptr &theMessage) { @@ -108,7 +107,7 @@ std::wstring ParametersPlugin_EvalListener::renameInPythonExpression( return anExpressionString; std::map> aLines; - std::list>::const_iterator it = aPositions.begin(); + auto it = aPositions.begin(); for (; it != aPositions.end(); ++it) aLines[it->first].push_back(it->second); @@ -124,7 +123,7 @@ std::wstring ParametersPlugin_EvalListener::renameInPythonExpression( aLineStart = anExpressionString.find(L"\n", aLineStart) + 1; const std::list &aColOffsets = ritLine->second; - std::list::const_reverse_iterator ritOffset = aColOffsets.rbegin(); + auto ritOffset = aColOffsets.rbegin(); for (; ritOffset != aColOffsets.rend(); ++ritOffset) { int anOffset = *ritOffset; anExpressionString.replace(aLineStart + anOffset, theOldName.size(), @@ -179,9 +178,8 @@ void ParametersPlugin_EvalListener::renameInAttribute( std::dynamic_pointer_cast(theAttribute); std::wstring anExpressionString[3] = { anAttribute->textX(), anAttribute->textY(), anAttribute->textZ()}; - for (int i = 0; i < 3; ++i) - anExpressionString[i] = renameInPythonExpression(anExpressionString[i], - theOldName, theNewName); + for (auto &i : anExpressionString) + i = renameInPythonExpression(i, theOldName, theNewName); anAttribute->setText(anExpressionString[0], anExpressionString[1], anExpressionString[2]); } else if (theAttribute->attributeType() == GeomDataAPI_Point2D::typeId()) { @@ -189,9 +187,8 @@ void ParametersPlugin_EvalListener::renameInAttribute( std::dynamic_pointer_cast(theAttribute); std::wstring anExpressionString[2] = {anAttribute->textX(), anAttribute->textY()}; - for (int i = 0; i < 2; ++i) - anExpressionString[i] = renameInPythonExpression(anExpressionString[i], - theOldName, theNewName); + for (auto &i : anExpressionString) + i = renameInPythonExpression(i, theOldName, theNewName); anAttribute->setText(anExpressionString[0], anExpressionString[1]); } } @@ -201,8 +198,7 @@ void ParametersPlugin_EvalListener::renameInDependents( const std::wstring &theOldName, const std::wstring &theNewName) { std::set> anAttributes = theResultParameter->data()->refsToMe(); - std::set>::const_iterator anAttributeIt = - anAttributes.cbegin(); + auto anAttributeIt = anAttributes.cbegin(); for (; anAttributeIt != anAttributes.cend(); ++anAttributeIt) { const AttributePtr &anAttribute = *anAttributeIt; if (anAttribute->attributeType() == ModelAPI_AttributeRefList::typeId()) { @@ -277,7 +273,7 @@ void ParametersPlugin_EvalListener::processObjectRenamedEvent( Events_InfoMessage aMsg(aMsgContext, aMsgText); aMsg.arg(aNotActivatedNames.c_str()); QMessageBox::StandardButton aRes = QMessageBox::warning( - 0, ModuleBase_Tools::translate(aMsgContext, "Warning"), + nullptr, ModuleBase_Tools::translate(aMsgContext, "Warning"), ModuleBase_Tools::translate(aMsg), QMessageBox::No | QMessageBox::Yes, QMessageBox::No); if (aRes != QMessageBox::Yes) { diff --git a/src/ParametersPlugin/ParametersPlugin_EvalListener.h b/src/ParametersPlugin/ParametersPlugin_EvalListener.h index 9d9a574d2..3cbb74379 100644 --- a/src/ParametersPlugin/ParametersPlugin_EvalListener.h +++ b/src/ParametersPlugin/ParametersPlugin_EvalListener.h @@ -43,11 +43,11 @@ class ParametersPlugin_EvalListener : public Events_Listener { public: PARAMETERSPLUGIN_EXPORT ParametersPlugin_EvalListener(); - PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_EvalListener(); + PARAMETERSPLUGIN_EXPORT ~ParametersPlugin_EvalListener() override; /// Reimplemented from Events_Listener::processEvent(). PARAMETERSPLUGIN_EXPORT - virtual void processEvent(const std::shared_ptr &theMessage); + void processEvent(const std::shared_ptr &theMessage) override; protected: /// Processes ObjectRenamed event. diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp index 9e81b1138..56f30176b 100644 --- a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp @@ -36,9 +36,9 @@ #include #include -ParametersPlugin_Parameter::ParametersPlugin_Parameter() {} +ParametersPlugin_Parameter::ParametersPlugin_Parameter() = default; -ParametersPlugin_Parameter::~ParametersPlugin_Parameter() {} +ParametersPlugin_Parameter::~ParametersPlugin_Parameter() = default; void ParametersPlugin_Parameter::initAttributes() { data()->addAttribute(VARIABLE_ID(), ModelAPI_AttributeString::typeId()); @@ -91,7 +91,7 @@ void ParametersPlugin_Parameter::updateName() { if (anOldName != aName) { aNames.push_back(anOldName); } - std::list::iterator aNIter = aNames.begin(); + auto aNIter = aNames.begin(); for (; aNIter != aNames.end(); aNIter++) { double aValue; ResultParameterPtr aRootParam; @@ -101,11 +101,10 @@ void ParametersPlugin_Parameter::updateName() { aRootDoc)) { std::set> anAttributes = aRootParam->data()->refsToMe(); - std::set>::const_iterator - anAttributeIt = anAttributes.cbegin(); + auto anAttributeIt = anAttributes.cbegin(); for (; anAttributeIt != anAttributes.cend(); ++anAttributeIt) { const AttributePtr &anAttribute = *anAttributeIt; - ModelAPI_AttributeEvalMessage::send(anAttribute, NULL); + ModelAPI_AttributeEvalMessage::send(anAttribute, nullptr); } } } @@ -158,8 +157,7 @@ ParametersPlugin_Parameter::evaluate(const std::wstring & /*theExpression*/, AttributeRefListPtr aParams = reflist(ARGUMENTS_ID()); bool aDifferent = aParams->size() != (int)aParamsList.size(); if (!aDifferent) { - std::list::const_iterator aNewIter = - aParamsList.begin(); + auto aNewIter = aParamsList.begin(); std::list anOldList = aParams->list(); std::list::const_iterator anOldIter = anOldList.begin(); for (; !aDifferent && aNewIter != aParamsList.end(); @@ -170,8 +168,7 @@ ParametersPlugin_Parameter::evaluate(const std::wstring & /*theExpression*/, } if (aDifferent) { aParams->clear(); - std::list::const_iterator aNewIter = - aParamsList.begin(); + auto aNewIter = aParamsList.begin(); for (; aNewIter != aParamsList.end(); aNewIter++) { aParams->append(*aNewIter); } diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.h b/src/ParametersPlugin/ParametersPlugin_Parameter.h index 03ca3b052..abc5a9216 100644 --- a/src/ParametersPlugin/ParametersPlugin_Parameter.h +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.h @@ -33,7 +33,7 @@ */ class ParametersPlugin_Parameter : public ModelAPI_Feature { public: - virtual ~ParametersPlugin_Parameter(); + ~ParametersPlugin_Parameter() override; /// Feature kind inline static const std::string &ID() { @@ -68,27 +68,27 @@ public: } /// Returns the kind of a feature - PARAMETERSPLUGIN_EXPORT virtual const std::string &getKind() { + PARAMETERSPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = ParametersPlugin_Parameter::ID(); return MY_KIND; } /// Pre-execution is not needed for parameter - PARAMETERSPLUGIN_EXPORT virtual bool isPreviewNeeded() const; + PARAMETERSPLUGIN_EXPORT bool isPreviewNeeded() const override; /// Creates a parameter in document - PARAMETERSPLUGIN_EXPORT virtual void execute(); + PARAMETERSPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - PARAMETERSPLUGIN_EXPORT virtual void initAttributes(); + PARAMETERSPLUGIN_EXPORT void initAttributes() override; /// Reimplemented from ModelAPI_Feature::isInHistory(). Returns false. - PARAMETERSPLUGIN_EXPORT virtual bool isInHistory(); + PARAMETERSPLUGIN_EXPORT bool isInHistory() override; /// Reimplemented from ModelAPI_Feature::isInHistory(). - PARAMETERSPLUGIN_EXPORT virtual void - attributeChanged(const std::string &theID); + PARAMETERSPLUGIN_EXPORT void + attributeChanged(const std::string &theID) override; /// Use plugin manager for features creation ParametersPlugin_Parameter(); diff --git a/src/ParametersPlugin/ParametersPlugin_ParametersMgr.cpp b/src/ParametersPlugin/ParametersPlugin_ParametersMgr.cpp index c909b014e..d0d182878 100644 --- a/src/ParametersPlugin/ParametersPlugin_ParametersMgr.cpp +++ b/src/ParametersPlugin/ParametersPlugin_ParametersMgr.cpp @@ -25,7 +25,7 @@ ParametersPlugin_ParametersMgr::ParametersPlugin_ParametersMgr() : ModelAPI_Feature() {} -ParametersPlugin_ParametersMgr::~ParametersPlugin_ParametersMgr() {} +ParametersPlugin_ParametersMgr::~ParametersPlugin_ParametersMgr() = default; void ParametersPlugin_ParametersMgr::initAttributes() {} diff --git a/src/ParametersPlugin/ParametersPlugin_ParametersMgr.h b/src/ParametersPlugin/ParametersPlugin_ParametersMgr.h index dcb170c29..a14d385a2 100644 --- a/src/ParametersPlugin/ParametersPlugin_ParametersMgr.h +++ b/src/ParametersPlugin/ParametersPlugin_ParametersMgr.h @@ -43,35 +43,37 @@ public: ParametersPlugin_ParametersMgr(); /// Destructor - virtual ~ParametersPlugin_ParametersMgr(); + ~ParametersPlugin_ParametersMgr() override; /// Request for initialization of data model of the feature: adding all /// attributes - PARAMETERSPLUGIN_EXPORT virtual void initAttributes(); + PARAMETERSPLUGIN_EXPORT void initAttributes() override; /// Returns the unique kind of a feature - PARAMETERSPLUGIN_EXPORT virtual const std::string &getKind() { + PARAMETERSPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = ParametersPlugin_ParametersMgr::ID(); return MY_KIND; }; /// Computes or recomputes the results - PARAMETERSPLUGIN_EXPORT virtual void execute(); + PARAMETERSPLUGIN_EXPORT void execute() override; /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true. - PARAMETERSPLUGIN_EXPORT virtual bool isMacro() const { return true; } + PARAMETERSPLUGIN_EXPORT bool isMacro() const override { return true; } /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. - PARAMETERSPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + PARAMETERSPLUGIN_EXPORT bool isPreviewNeeded() const override { + return false; + } /// Returns true if result is persistent (stored in document) and on /// undo-redo, save-open it is not needed to recompute it. - PARAMETERSPLUGIN_EXPORT virtual bool isPersistentResult() { return false; } + PARAMETERSPLUGIN_EXPORT bool isPersistentResult() override { return false; } /// Returns true if this feature must not be created: this is just an action /// that is not stored in the features history and data model (like "delete /// part"). - virtual bool isInHistory() { return false; } + bool isInHistory() override { return false; } }; #endif diff --git a/src/ParametersPlugin/ParametersPlugin_Plugin.h b/src/ParametersPlugin/ParametersPlugin_Plugin.h index d62521f31..c6f776091 100644 --- a/src/ParametersPlugin/ParametersPlugin_Plugin.h +++ b/src/ParametersPlugin/ParametersPlugin_Plugin.h @@ -36,8 +36,8 @@ class ParametersPlugin_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - PARAMETERSPLUGIN_EXPORT virtual FeaturePtr - createFeature(std::string theFeatureID); + PARAMETERSPLUGIN_EXPORT FeaturePtr + createFeature(std::string theFeatureID) override; public: ParametersPlugin_Plugin(); diff --git a/src/ParametersPlugin/ParametersPlugin_Validators.cpp b/src/ParametersPlugin/ParametersPlugin_Validators.cpp index 40c3277b7..0ecb605cd 100644 --- a/src/ParametersPlugin/ParametersPlugin_Validators.cpp +++ b/src/ParametersPlugin/ParametersPlugin_Validators.cpp @@ -32,9 +32,11 @@ #include #include -ParametersPlugin_VariableValidator::ParametersPlugin_VariableValidator() {} +ParametersPlugin_VariableValidator::ParametersPlugin_VariableValidator() = + default; -ParametersPlugin_VariableValidator::~ParametersPlugin_VariableValidator() {} +ParametersPlugin_VariableValidator::~ParametersPlugin_VariableValidator() = + default; bool ParametersPlugin_VariableValidator::isValid( const AttributePtr &theAttribute, @@ -86,9 +88,11 @@ bool ParametersPlugin_VariableValidator::isUnique( return true; } -ParametersPlugin_ExpressionValidator::ParametersPlugin_ExpressionValidator() {} +ParametersPlugin_ExpressionValidator::ParametersPlugin_ExpressionValidator() = + default; -ParametersPlugin_ExpressionValidator::~ParametersPlugin_ExpressionValidator() {} +ParametersPlugin_ExpressionValidator::~ParametersPlugin_ExpressionValidator() = + default; bool ParametersPlugin_ExpressionValidator::isValid( const AttributePtr &theAttribute, diff --git a/src/ParametersPlugin/ParametersPlugin_Validators.h b/src/ParametersPlugin/ParametersPlugin_Validators.h index 233b06a3d..8df2c9848 100644 --- a/src/ParametersPlugin/ParametersPlugin_Validators.h +++ b/src/ParametersPlugin/ParametersPlugin_Validators.h @@ -36,7 +36,7 @@ class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator { public: PARAMETERSPLUGIN_EXPORT ParametersPlugin_VariableValidator(); - PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_VariableValidator(); + PARAMETERSPLUGIN_EXPORT ~ParametersPlugin_VariableValidator() override; /** * \brief Returns true if attribute has a valid parameter name. @@ -44,10 +44,10 @@ public: * \param theArguments arguments of the attribute * \param theError the error string message if validation fails */ - PARAMETERSPLUGIN_EXPORT virtual bool + PARAMETERSPLUGIN_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; protected: /// Returns true if theString is unique parameter name in the document of @@ -65,7 +65,7 @@ class ParametersPlugin_ExpressionValidator : public ModelAPI_AttributeValidator { public: PARAMETERSPLUGIN_EXPORT ParametersPlugin_ExpressionValidator(); - PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_ExpressionValidator(); + PARAMETERSPLUGIN_EXPORT ~ParametersPlugin_ExpressionValidator() override; /** * \brief Returns true if attribute has a valid parameter expression. @@ -73,10 +73,10 @@ public: * \param theArguments arguments of the attribute * \param theError the error string message if validation fails */ - PARAMETERSPLUGIN_EXPORT virtual bool + PARAMETERSPLUGIN_EXPORT bool isValid(const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const; + Events_InfoMessage &theError) const override; }; #endif /* PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_ */ diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetCreator.cpp b/src/ParametersPlugin/ParametersPlugin_WidgetCreator.cpp index 390766038..569dac76f 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetCreator.cpp +++ b/src/ParametersPlugin/ParametersPlugin_WidgetCreator.cpp @@ -33,7 +33,7 @@ void ParametersPlugin_WidgetCreator::widgetTypes( ModuleBase_ModelWidget *ParametersPlugin_WidgetCreator::createWidgetByType( const std::string &theType, QWidget *theParent, Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop *theWorkshop) { - ModuleBase_ModelWidget *aModelWidget = 0; + ModuleBase_ModelWidget *aModelWidget = nullptr; if (theType == "parameters-manager") { aModelWidget = new ParametersPlugin_WidgetParamsMgr(theParent, theWidgetApi, theWorkshop); diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetCreator.h b/src/ParametersPlugin/ParametersPlugin_WidgetCreator.h index 252ac89d2..acb4a2428 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetCreator.h +++ b/src/ParametersPlugin/ParametersPlugin_WidgetCreator.h @@ -39,7 +39,7 @@ public: /// Returns a container of possible widget types, which this creator can /// process \param theTypes a list of type names - virtual void widgetTypes(std::set &theTypes); + void widgetTypes(std::set &theTypes) override; /// Create widget by its type /// The default implementation is empty @@ -48,10 +48,10 @@ public: /// \param theWidgetApi a low-level API for reading xml definitions of widgets /// \param theWorkshop a current workshop /// \return a created model widget or null - virtual ModuleBase_ModelWidget * + ModuleBase_ModelWidget * createWidgetByType(const std::string &theType, QWidget *theParent, Config_WidgetAPI *theWidgetApi, - ModuleBase_IWorkshop *theWorkshop); + ModuleBase_IWorkshop *theWorkshop) override; }; #endif diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp index 478f54a5d..ce9738454 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp +++ b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp @@ -81,16 +81,15 @@ public: /// \param painter a painter object /// \param option the item options /// \param index the current index - virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const; + void paint(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index) const override; /// Redefinition of virtual method /// \param parent a parent widget /// \param option the item options /// \param index the current index - virtual QWidget *createEditor(QWidget *parent, - const QStyleOptionViewItem &option, - const QModelIndex &index) const; + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, + const QModelIndex &index) const override; /// Returns True if the given index is editable item /// \param theIndex an item index @@ -181,7 +180,7 @@ ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr( ModuleBase_IWorkshop *theWorkshop) : ModuleBase_ModelDialogWidget(theParent, theData), myWorkshop(theWorkshop), isUpplyBlocked(false) { - QVBoxLayout *aLayout = new QVBoxLayout(this); + auto *aLayout = new QVBoxLayout(this); myTable = new ParametersPlugin_TreeWidget(this); myTable->setColumnCount(4); @@ -222,7 +221,7 @@ ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr( myFeatures->setFlags(Qt::ItemIsEnabled); myTable->addTopLevelItem(myFeatures); - QHBoxLayout *aBtnLayout = new QHBoxLayout(this); + auto *aBtnLayout = new QHBoxLayout(this); myUpBtn = new QToolButton(this); myUpBtn->setArrowType(Qt::UpArrow); @@ -246,7 +245,7 @@ ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr( if (aAddStr.isEmpty()) aAddStr = "Ctrl+A"; - QShortcut *aAddShc = new QShortcut(QKeySequence(aAddStr), myAddBtn); + auto *aAddShc = new QShortcut(QKeySequence(aAddStr), myAddBtn); connect(aAddShc, SIGNAL(activated()), SLOT(onAdd())); myInsertBtn = new QPushButton(translate("Insert"), this); @@ -271,11 +270,9 @@ void ParametersPlugin_WidgetParamsMgr::setDialogButtons( ModuleBase_ModelDialogWidget::setDialogButtons(theButtons); QWidget *aBtnParentWgt = myOkCancelBtn->parentWidget(); - QHBoxLayout *aBtnParentLayout = - dynamic_cast(aBtnParentWgt->layout()); + auto *aBtnParentLayout = dynamic_cast(aBtnParentWgt->layout()); - QPushButton *aPreviewBtn = - new QPushButton(translate("See preview"), aBtnParentWgt); + auto *aPreviewBtn = new QPushButton(translate("See preview"), aBtnParentWgt); aBtnParentLayout->insertWidget(0, aPreviewBtn); aBtnParentLayout->insertStretch(1, 1); connect(aPreviewBtn, SIGNAL(clicked(bool)), SLOT(onShowPreview())); @@ -485,7 +482,7 @@ void ParametersPlugin_WidgetParamsMgr::onDoubleClick( } void ParametersPlugin_WidgetParamsMgr::onCloseEditor( - QWidget *theEditor, QAbstractItemDelegate::EndEditHint theHint) { + QWidget * /*theEditor*/, QAbstractItemDelegate::EndEditHint /*theHint*/) { FeaturePtr aFeature = myParametersList.at(myDelegate->editIndex().row()); QTreeWidgetItem *aItem = myParameters->child(myDelegate->editIndex().row()); int aColumn = myDelegate->editIndex().column(); @@ -586,7 +583,7 @@ QTreeWidgetItem *ParametersPlugin_WidgetParamsMgr::createNewItem( aValues << translate(NoName); aValues << translate(NoValue); - QTreeWidgetItem *aItem = new QTreeWidgetItem(aValues); + auto *aItem = new QTreeWidgetItem(aValues); if (theParent == myParameters) { aItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled); @@ -616,11 +613,11 @@ void ParametersPlugin_WidgetParamsMgr::onAdd() { QTreeWidgetItem *ParametersPlugin_WidgetParamsMgr::selectedItem() const { QList aItemsList = myTable->selectedItems(); if (aItemsList.count() == 0) - return 0; + return nullptr; QTreeWidgetItem *aCurrentItem = aItemsList.first(); if (aCurrentItem->parent() != myParameters) - return 0; + return nullptr; return aCurrentItem; } diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h index 9bcf1c621..62b0470c8 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h +++ b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h @@ -41,15 +41,15 @@ class ParametersPlugin_TreeWidget : public QTreeWidget { public: /// Constructor /// \param theParent a parent widget - ParametersPlugin_TreeWidget(QWidget *theParent = 0) + ParametersPlugin_TreeWidget(QWidget *theParent = nullptr) : QTreeWidget(theParent) {} protected slots: /// Redefinition of virtual method /// \param theEditor a editor widget /// \param theHint end of editing hint - virtual void closeEditor(QWidget *theEditor, - QAbstractItemDelegate::EndEditHint theHint); + void closeEditor(QWidget *theEditor, + QAbstractItemDelegate::EndEditHint theHint) override; }; /*! @@ -66,30 +66,30 @@ public: ModuleBase_IWorkshop *theWorkshop); /// Destructs the model widget - virtual ~ParametersPlugin_WidgetParamsMgr() {} + ~ParametersPlugin_WidgetParamsMgr() override = default; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// Set general buttons from dialog /// \param theButtons the dialog buttons - virtual void setDialogButtons(QDialogButtonBox *theButtons); + void setDialogButtons(QDialogButtonBox *theButtons) override; protected: /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Restore value from attribute data to the widget's control - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// The method called when widget is activated - virtual void activateCustom(); + void activateCustom() override; - virtual void showEvent(QShowEvent *theEvent); + void showEvent(QShowEvent *theEvent) override; - virtual void hideEvent(QHideEvent *theEvent); + void hideEvent(QHideEvent *theEvent) override; private slots: /// Slot for reaction on double click in the table (start editing) diff --git a/src/PartSet/PartSet_CenterPrs.h b/src/PartSet/PartSet_CenterPrs.h index a52387436..f0ebd1667 100644 --- a/src/PartSet/PartSet_CenterPrs.h +++ b/src/PartSet/PartSet_CenterPrs.h @@ -64,12 +64,11 @@ public: return myCenterType; } - virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d) & PM, - const SelectMgr_SequenceOfOwner &Seq); - virtual void - HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d) &, - const Handle(Prs3d_Drawer) &, - const Handle(SelectMgr_EntityOwner) &); + void HilightSelected(const Handle(PrsMgr_PresentationManager3d) & PM, + const SelectMgr_SequenceOfOwner &Seq) override; + void HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d) &, + const Handle(Prs3d_Drawer) &, + const Handle(SelectMgr_EntityOwner) &) override; DEFINE_STANDARD_RTTIEXT(PartSet_CenterPrs, AIS_Point) diff --git a/src/PartSet/PartSet_ExternalObjectsMgr.cpp b/src/PartSet/PartSet_ExternalObjectsMgr.cpp index 85ba3764b..a2dac4ae4 100644 --- a/src/PartSet/PartSet_ExternalObjectsMgr.cpp +++ b/src/PartSet/PartSet_ExternalObjectsMgr.cpp @@ -58,7 +58,8 @@ bool PartSet_ExternalObjectsMgr::isValidObject(const ObjectPtr &theObject) { std::dynamic_pointer_cast(aFeature); // Do check that we can use external feature - if (aSPFeature.get() != NULL && aSPFeature->isExternal() && !useExternal()) { + if (aSPFeature.get() != nullptr && aSPFeature->isExternal() && + !useExternal()) { aValid = false; } @@ -120,7 +121,7 @@ void PartSet_ExternalObjectsMgr::getGeomSelection( // there is no a sketch feature is selected, but the shape exists, // try to create an exernal object // TODO: unite with the same functionality in PartSet_WidgetShapeSelector - if (aSPFeature.get() == NULL) { + if (aSPFeature.get() == nullptr) { ObjectPtr anExternalObject = ObjectPtr(); GeomShapePtr anExternalShape = GeomShapePtr(); if (useExternal()) { @@ -131,7 +132,7 @@ void PartSet_ExternalObjectsMgr::getGeomSelection( if (aResult.get()) aShape = aResult->shape(); } - if (aShape.get() != NULL && !aShape->isNull()) + if (aShape.get() != nullptr && !aShape->isNull()) anExternalObject = externalObject(theObject, aShape, theSketch, isInValidate); if (!anExternalObject.get()) { @@ -166,7 +167,7 @@ void PartSet_ExternalObjectsMgr::removeExternalObject( if (theObject.get()) { DocumentPtr aDoc = theObject->document(); FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); - if (aFeature.get() != NULL) { + if (aFeature.get() != nullptr) { QObjectPtrList anObjects; anObjects.append(aFeature); // the external feature should be removed with all references, @@ -178,7 +179,6 @@ void PartSet_ExternalObjectsMgr::removeExternalObject( XGUI_Workshop * PartSet_ExternalObjectsMgr::workshop(ModuleBase_IWorkshop *theWorkshop) { - XGUI_ModuleConnector *aConnector = - dynamic_cast(theWorkshop); + auto *aConnector = dynamic_cast(theWorkshop); return aConnector->workshop(); } diff --git a/src/PartSet/PartSet_ExternalObjectsMgr.h b/src/PartSet/PartSet_ExternalObjectsMgr.h index 6ac0158ba..a1a36d19b 100644 --- a/src/PartSet/PartSet_ExternalObjectsMgr.h +++ b/src/PartSet/PartSet_ExternalObjectsMgr.h @@ -51,7 +51,7 @@ public: const std::string &theCanCreateExternal, const bool theDefaultValue); - virtual ~PartSet_ExternalObjectsMgr() {} + virtual ~PartSet_ExternalObjectsMgr() = default; /// Returns the state whether the external object is used bool useExternal() const { return myUseExternal; } diff --git a/src/PartSet/PartSet_ExternalPointsMgr.cpp b/src/PartSet/PartSet_ExternalPointsMgr.cpp index 95fa73ba1..2d2e81f3e 100644 --- a/src/PartSet/PartSet_ExternalPointsMgr.cpp +++ b/src/PartSet/PartSet_ExternalPointsMgr.cpp @@ -199,13 +199,13 @@ std::shared_ptr PartSet_ExternalPointsMgr::plane() const { return PartSet_Tools::sketchPlane(mySketch); } -void PartSet_ExternalPointsMgr::onDisplayObject(ObjectPtr theObj, - AISObjectPtr theAIS) { +void PartSet_ExternalPointsMgr::onDisplayObject(ObjectPtr /*theObj*/, + AISObjectPtr /*theAIS*/) { updateCenterPresentations(); } void PartSet_ExternalPointsMgr::onEraseObject(ObjectPtr theObj, - AISObjectPtr theAIS) { + AISObjectPtr /*theAIS*/) { if (myPresentations.contains(theObj)) { XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); XGUI_Displayer *aDisplayer = aWorkshop->displayer(); diff --git a/src/PartSet/PartSet_ExternalPointsMgr.h b/src/PartSet/PartSet_ExternalPointsMgr.h index 0ec80e172..744166999 100644 --- a/src/PartSet/PartSet_ExternalPointsMgr.h +++ b/src/PartSet/PartSet_ExternalPointsMgr.h @@ -47,7 +47,7 @@ public: PartSet_ExternalPointsMgr(ModuleBase_IWorkshop *theWorkshop, const CompositeFeaturePtr &theSketch); - virtual ~PartSet_ExternalPointsMgr(); + ~PartSet_ExternalPointsMgr() override; public slots: /** @@ -96,7 +96,7 @@ private: CompositeFeaturePtr mySketch; /// Type for list of created AIS objects - typedef QList ListOfAIS; + using ListOfAIS = QList; /// Map of created AIS objects QMap myPresentations; diff --git a/src/PartSet/PartSet_FieldStepPrs.h b/src/PartSet/PartSet_FieldStepPrs.h index 85e854cc1..9157286c3 100644 --- a/src/PartSet/PartSet_FieldStepPrs.h +++ b/src/PartSet/PartSet_FieldStepPrs.h @@ -47,17 +47,17 @@ public: /// \param theResult a result object Standard_EXPORT PartSet_FieldStepPrs(FieldStepPtr theStep); - ModelAPI_AttributeTables::ValueType dataType() const; + ModelAPI_AttributeTables::ValueType dataType() const override; - bool dataRange(double &theMin, double &theMax) const; + bool dataRange(double &theMin, double &theMax) const override; DEFINE_STANDARD_RTTIEXT(PartSet_FieldStepPrs, ViewerData_AISShape) protected: //! Compute presentation considering sub-shape color map. - virtual void Compute(const Handle(PrsMgr_PresentationManager3d) & thePrsMgr, - const Handle(Prs3d_Presentation) & thePrs, - const Standard_Integer theMode); + void Compute(const Handle(PrsMgr_PresentationManager3d) & thePrsMgr, + const Handle(Prs3d_Presentation) & thePrs, + const Standard_Integer theMode) override; private: QList range(double &theMin, double &theMax) const; diff --git a/src/PartSet/PartSet_FilterInfinite.h b/src/PartSet/PartSet_FilterInfinite.h index 4918cb2c4..179d94425 100644 --- a/src/PartSet/PartSet_FilterInfinite.h +++ b/src/PartSet/PartSet_FilterInfinite.h @@ -41,8 +41,8 @@ public: /// Returns True if selected presentation can be selected /// \param theOwner an owner of the persentation - Standard_EXPORT virtual Standard_Boolean - IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; + Standard_EXPORT Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner) & + theOwner) const override; DEFINE_STANDARD_RTTIEXT(PartSet_FilterInfinite, SelectMgr_Filter) diff --git a/src/PartSet/PartSet_Filters.h b/src/PartSet/PartSet_Filters.h index cffc22beb..77dc3b74e 100644 --- a/src/PartSet/PartSet_Filters.h +++ b/src/PartSet/PartSet_Filters.h @@ -40,8 +40,8 @@ public: /// Returns True if selected presentation can be selected /// \param theOwner an owner of the persentation - Standard_EXPORT virtual Standard_Boolean - IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; + Standard_EXPORT Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner) & + theOwner) const override; DEFINE_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter) }; @@ -61,8 +61,8 @@ public: /// Returns True if selected presentation can be selected /// \param theOwner an owner of the persentation - Standard_EXPORT virtual Standard_Boolean - IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; + Standard_EXPORT Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner) & + theOwner) const override; DEFINE_STANDARD_RTTIEXT(PartSet_ResultGroupNameFilter, SelectMgr_Filter) @@ -85,8 +85,8 @@ public: /// Returns True if the given owner is acceptable for selection /// \param theOwner the selected owner - Standard_EXPORT virtual Standard_Boolean - IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const; + Standard_EXPORT Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner) & + theOwner) const override; DEFINE_STANDARD_RTTIEXT(PartSet_CirclePointFilter, SelectMgr_Filter) diff --git a/src/PartSet/PartSet_IconFactory.h b/src/PartSet/PartSet_IconFactory.h index a0d622aec..8c9bea749 100644 --- a/src/PartSet/PartSet_IconFactory.h +++ b/src/PartSet/PartSet_IconFactory.h @@ -42,11 +42,11 @@ public: /// Returns Icon for the given object /// \param theObj an object - virtual QIcon getIcon(ObjectPtr theObj); + QIcon getIcon(ObjectPtr theObj) override; /// Event Listener method /// \param theMessage an event message - virtual void processEvent(const std::shared_ptr &theMessage); + void processEvent(const std::shared_ptr &theMessage) override; private: static QMap myIcons; diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 87ed314f7..bfa6ae8ca 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -166,7 +166,7 @@ createModule(ModuleBase_IWorkshop *theWshop) { //****************************************************** PartSet_Module::PartSet_Module(ModuleBase_IWorkshop *theWshop) : ModuleBase_IModule(theWshop), myIsOperationIsLaunched(false), - myVisualLayerId(0), myRoot(0) { + myVisualLayerId(0), myRoot(nullptr) { new PartSet_IconFactory(this); mySketchMgr = new PartSet_SketcherMgr(this); @@ -423,13 +423,12 @@ void PartSet_Module::operationAborted(ModuleBase_Operation *theOperation) { //****************************************************** void PartSet_Module::operationStarted(ModuleBase_Operation *theOperation) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast(theOperation); + auto *aFOperation = dynamic_cast(theOperation); if (aFOperation) { XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(workshop()); XGUI_PropertyPanel *aPropertyPanel = aWorkshop->propertyPanel(); - ModuleBase_ModelWidget *aFilledWidget = 0; + ModuleBase_ModelWidget *aFilledWidget = nullptr; bool aPostonedWidgetActivation = false; FeaturePtr aFeature = aFOperation->feature(); @@ -531,8 +530,7 @@ void PartSet_Module::updateSketcherOnStart(ModuleBase_Operation *theOperation) { //****************************************************** void PartSet_Module::updatePresentationsOnStart( ModuleBase_Operation *theOperation) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast(theOperation); + auto *aFOperation = dynamic_cast(theOperation); if (aFOperation) { myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, false); @@ -545,8 +543,7 @@ void PartSet_Module::updatePresentationsOnStart( void PartSet_Module::operationResumed(ModuleBase_Operation *theOperation) { ModuleBase_IModule::operationResumed(theOperation); - ModuleBase_OperationFeature *aFOperation = - dynamic_cast(theOperation); + auto *aFOperation = dynamic_cast(theOperation); if (aFOperation) { myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, false); @@ -570,8 +567,7 @@ void PartSet_Module::operationStopped(ModuleBase_Operation *theOperation) { // VSV: Viewer is updated on feature update and redisplay if (isModified) { - XGUI_ModuleConnector *aConnector = - dynamic_cast(myWorkshop); + auto *aConnector = dynamic_cast(myWorkshop); XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); aDisplayer->updateViewer(); } @@ -586,8 +582,7 @@ void PartSet_Module::operationStopped(ModuleBase_Operation *theOperation) { //****************************************************** ModuleBase_Operation *PartSet_Module::currentOperation() const { - XGUI_ModuleConnector *aConnector = - dynamic_cast(workshop()); + auto *aConnector = dynamic_cast(workshop()); XGUI_OperationMgr *anOpMgr = aConnector->workshop()->operationMgr(); return anOpMgr->currentOperation(); } @@ -672,7 +667,7 @@ bool PartSet_Module::canActivateSelection(const ObjectPtr &theObject) const { // in active sketch operation it is possible to activate operation object in // selection in the edit operation, e.g. points of the line can be moved // when the line is edited - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(anOperation); aCanActivate = aCanActivate || (aFOperation && aFOperation->isEditOperation()); @@ -732,7 +727,7 @@ void PartSet_Module::activeSelectionModes(QIntList &theModes) { } //****************************************************** -void PartSet_Module::moduleSelectionModes(int theModesType, +void PartSet_Module::moduleSelectionModes(int /*theModesType*/, QIntList &theModes) { customSubShapesSelectionModes(theModes); // theModes.append(XGUI_Tools::workshop(myWorkshop)->viewerSelectionModes()); @@ -824,8 +819,7 @@ void PartSet_Module::clearViewer() { //****************************************************** void PartSet_Module::propertyPanelDefined(ModuleBase_Operation *theOperation) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast(theOperation); + auto *aFOperation = dynamic_cast(theOperation); if (!aFOperation) return; @@ -866,7 +860,7 @@ bool PartSet_Module::createWidgets( if (aResult.get() && aResult->shape()->isEqual(aShape)) return aProcessed; } - const TopoDS_Shape &aTDShape = aShape->impl(); + const auto &aTDShape = aShape->impl(); std::pair anAttribute = PartSet_Tools::findAttributeBy2dPoint(anObject, aTDShape, mySketchMgr->activeSketch()); @@ -926,8 +920,7 @@ void PartSet_Module::onSelectionChanged() { //****************************************************** void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow *theWnd, QKeyEvent *theEvent) { - XGUI_ModuleConnector *aConnector = - dynamic_cast(workshop()); + auto *aConnector = dynamic_cast(workshop()); XGUI_OperationMgr *anOpMgr = aConnector->workshop()->operationMgr(); anOpMgr->onKeyReleased(theWnd->viewPort(), theEvent); } @@ -938,9 +931,9 @@ PartSet_Module::createWidgetByType(const std::string &theType, QWidget *theParent, Config_WidgetAPI *theWidgetApi) { ModuleBase_IWorkshop *aWorkshop = workshop(); - ModuleBase_ModelWidget *aWgt = NULL; + ModuleBase_ModelWidget *aWgt = nullptr; if (theType == "sketch-start-label") { - PartSet_WidgetSketchLabel *aLabelWgt = new PartSet_WidgetSketchLabel( + auto *aLabelWgt = new PartSet_WidgetSketchLabel( theParent, aWorkshop, theWidgetApi, myHasConstraintShown); connect(aLabelWgt, SIGNAL(planeSelected(const std::shared_ptr &)), @@ -955,37 +948,36 @@ PartSet_Module::createWidgetByType(const std::string &theType, aLabelWgt->setShowPointsState(mySketchMgr->isShowFreePointsShown()); aWgt = aLabelWgt; } else if (theType == "sketch-2dpoint_selector") { - PartSet_WidgetPoint2D *aPointWgt = + auto *aPointWgt = new PartSet_WidgetPoint2D(theParent, aWorkshop, theWidgetApi); aPointWgt->setSketch(mySketchMgr->activeSketch()); connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected())); aWgt = aPointWgt; } else if (theType == "sketch-2dpoint_flyout_selector") { - PartSet_WidgetPoint2DFlyout *aPointWgt = + auto *aPointWgt = new PartSet_WidgetPoint2DFlyout(theParent, aWorkshop, theWidgetApi); aPointWgt->setSketch(mySketchMgr->activeSketch()); connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected())); aWgt = aPointWgt; } else if (theType == "sketch_shape_selector") { - PartSet_WidgetShapeSelector *aShapeSelectorWgt = + auto *aShapeSelectorWgt = new PartSet_WidgetShapeSelector(theParent, aWorkshop, theWidgetApi); aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch()); aWgt = aShapeSelectorWgt; } else if (theType == "sketch_multi_selector") { - PartSet_WidgetMultiSelector *aShapeSelectorWgt = + auto *aShapeSelectorWgt = new PartSet_WidgetMultiSelector(theParent, aWorkshop, theWidgetApi); aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch()); aWgt = aShapeSelectorWgt; } else if (theType == "sketch_feature_point_selector") { - PartSet_WidgetFeaturePointSelector *aPointSelectorWgt = - new PartSet_WidgetFeaturePointSelector(theParent, aWorkshop, - theWidgetApi); + auto *aPointSelectorWgt = new PartSet_WidgetFeaturePointSelector( + theParent, aWorkshop, theWidgetApi); aPointSelectorWgt->setSketcher(mySketchMgr->activeSketch()); aWgt = aPointSelectorWgt; } else if (theType == "sketch-bspline_selector") { - PartSet_WidgetBSplinePoints *aBSplineWgt = + auto *aBSplineWgt = new PartSet_WidgetBSplinePoints(theParent, aWorkshop, theWidgetApi); aBSplineWgt->setSketch(mySketchMgr->activeSketch()); aWgt = aBSplineWgt; @@ -1000,8 +992,7 @@ PartSet_Module::createWidgetByType(const std::string &theType, connect(aWgt, SIGNAL(itemSelected(ModuleBase_ModelWidget *, int)), this, SLOT(onChoiceChanged(ModuleBase_ModelWidget *, int))); } else if (theType == "bspline-panel") { - PartSet_BSplineWidget *aPanel = - new PartSet_BSplineWidget(theParent, theWidgetApi); + auto *aPanel = new PartSet_BSplineWidget(theParent, theWidgetApi); // aPanel->setFeature(theFeature); aWgt = aPanel; } @@ -1010,7 +1001,7 @@ PartSet_Module::createWidgetByType(const std::string &theType, //****************************************************** ModuleBase_ModelWidget *PartSet_Module::activeWidget() const { - ModuleBase_ModelWidget *anActiveWidget = 0; + ModuleBase_ModelWidget *anActiveWidget = nullptr; ModuleBase_Operation *aOperation = myWorkshop->currentOperation(); if (!aOperation) @@ -1072,8 +1063,7 @@ bool PartSet_Module::deleteObjects() { // 3. start operation QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text(); - ModuleBase_Operation *anOpAction = - new ModuleBase_Operation(aDescription, this); + auto *anOpAction = new ModuleBase_Operation(aDescription, this); // the active nested sketch operation should be aborted unconditionally // the Delete action should be additionally granted for the Sketch operation @@ -1123,7 +1113,8 @@ void PartSet_Module::launchOperation(const QString &theCmdId, } //****************************************************** -void PartSet_Module::storeConstraintsState(const std::string &theFeatureKind) { +void PartSet_Module::storeConstraintsState( + const std::string & /*theFeatureKind*/) { if (myWorkshop->currentOperation() && myWorkshop->currentOperation()->id().toStdString() == SketchPlugin_Sketch::ID()) { @@ -1372,8 +1363,7 @@ bool PartSet_Module::customizeFeature(ObjectPtr theObject, //****************************************************** void PartSet_Module::customizeObjectBrowser(QWidget *theObjectBrowser) { - XGUI_ObjectsBrowser *aOB = - dynamic_cast(theObjectBrowser); + auto *aOB = dynamic_cast(theObjectBrowser); if (aOB) { QLabel *aLabel = aOB->activeDocLabel(); aLabel->installEventFilter(myMenuMgr); @@ -1436,7 +1426,7 @@ AISObjectPtr PartSet_Module::createPresentation(const ObjectPtr &theObject) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (aResult.get()) { std::shared_ptr aShapePtr = ModelAPI_Tools::shape(aResult); - if (aShapePtr.get() != NULL) + if (aShapePtr.get() != nullptr) anAISPrs = new ModuleBase_ResultPrs(aResult); } else { FieldStepPtr aStep = @@ -1537,11 +1527,11 @@ void PartSet_Module::setTexture(const AISObjectPtr &thePrs, #else aPixmap->InitTrash(Image_Format_BGRA, aWidth, aHeight); #endif - std::list::iterator aByteIter = aByteList.begin(); + auto aByteIter = aByteList.begin(); for (int aLine = 0; aLine < aHeight; ++aLine) { // convert pixels from ARGB to renderer-compatible RGBA for (int aByte = 0; aByte < aWidth; ++aByte) { - Image_ColorBGRA &aPixmapBytes = + auto &aPixmapBytes = aPixmap->ChangeValue(aLine, aByte); aPixmapBytes.b() = (Standard_Byte)*aByteIter++; @@ -1625,7 +1615,7 @@ PartSet_Module::findPresentedObject(const AISObjectPtr &theAIS) const { if (!anActiveWidget) anActiveWidget = aPanel->preselectionWidget(); - ModuleBase_WidgetValidated *aWidgetValidated = + auto *aWidgetValidated = dynamic_cast(anActiveWidget); if (aWidgetValidated) anObject = aWidgetValidated->findPresentedObject(theAIS); @@ -1719,12 +1709,12 @@ void PartSet_Module::addObjectBrowserMenu(QMenu *theMenu) const { } } else { if (hasFeature) { - myMenuMgr->action("EDIT_CMD")->setEnabled(aCurrentOp == 0); + myMenuMgr->action("EDIT_CMD")->setEnabled(aCurrentOp == nullptr); theMenu->addAction(myMenuMgr->action("EDIT_CMD")); theMenu->addSeparator(); } } - bool aNotDeactivate = (aCurrentOp == 0); + bool aNotDeactivate = (aCurrentOp == nullptr); if (!aNotDeactivate) { aActivatePartAction->setEnabled(false); } @@ -1763,7 +1753,7 @@ void PartSet_Module::processEvent( return; XGUI_Workshop *aWorkshop = getWorkshop(); bool needUpdate = false; - XGUI_DataTree *aTreeView = 0; + XGUI_DataTree *aTreeView = nullptr; if (aWorkshop->objectBrowser()) { aTreeView = aWorkshop->objectBrowser()->treeView(); QLabel *aLabel = aWorkshop->objectBrowser()->activeDocLabel(); @@ -2022,8 +2012,7 @@ void PartSet_Module::setReentrantPreSelection( //****************************************************** void PartSet_Module::onChoiceChanged(ModuleBase_ModelWidget *theWidget, int theIndex) { - ModuleBase_WidgetChoice *aChoiceWidget = - dynamic_cast(theWidget); + auto *aChoiceWidget = dynamic_cast(theWidget); if (!aChoiceWidget) return; @@ -2040,8 +2029,7 @@ void PartSet_Module::onChoiceChanged(ModuleBase_ModelWidget *theWidget, //****************************************************** XGUI_Workshop *PartSet_Module::getWorkshop() const { - XGUI_ModuleConnector *aConnector = - dynamic_cast(workshop()); + auto *aConnector = dynamic_cast(workshop()); return aConnector->workshop(); } @@ -2087,8 +2075,7 @@ void PartSet_Module::onRemoveConflictingConstraints() { aText += aName + "\n"; } - XGUI_ModuleConnector *aConnector = - dynamic_cast(myWorkshop); + auto *aConnector = dynamic_cast(myWorkshop); ModuleBase_Tools::warningAboutConflict(aConnector->desktop(), aText); } @@ -2106,7 +2093,7 @@ void PartSet_Module::onRemoveConflictingConstraints() { QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text(); - ModuleBase_Operation *anOpAction = new ModuleBase_Operation(aDescription); + auto *anOpAction = new ModuleBase_Operation(aDescription); anOpMgr->startOperation(anOpAction); aWorkshop->deleteFeatures(anObjectsList); diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index 64e60560d..7b28ce972 100644 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -86,7 +86,7 @@ PartSet_OperationPrs::PartSet_OperationPrs(ModuleBase_IWorkshop *theWorkshop) gp_Pnt aPnt(0.0, 0.0, 0.0); BRepBuilderAPI_MakeVertex aMaker(aPnt); TopoDS_Vertex aVertex = aMaker.Vertex(); - myShapeToPrsMap.Bind(aVertex, NULL); + myShapeToPrsMap.Bind(aVertex, nullptr); Handle(Prs3d_Drawer) aDrawer = Attributes(); Handle(Prs3d_IsoAspect) aUIsoAspect = @@ -108,10 +108,10 @@ void PartSet_OperationPrs::setShapeColor(const Quantity_Color &theColor) { void PartSet_OperationPrs::useAISWidth() { myUseAISWidth = true; } void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d) & - thePresentationManager, + /*thePresentationManager*/, const Handle(Prs3d_Presentation) & thePresentation, - const Standard_Integer theMode) { + const Standard_Integer /*theMode*/) { #ifdef DEBUG_OPERATION_PRS qDebug("PartSet_OperationPrs::Compute -- begin"); #endif @@ -242,7 +242,7 @@ void PartSet_OperationPrs::addValue( } void PartSet_OperationPrs::appendShapeIfVisible( - ModuleBase_IWorkshop *theWorkshop, const ObjectPtr &theObject, + ModuleBase_IWorkshop * /*theWorkshop*/, const ObjectPtr &theObject, GeomShapePtr theGeomShape, QMap> &theObjectShapes) { if (theGeomShape.get()) { diff --git a/src/PartSet/PartSet_OverconstraintListener.cpp b/src/PartSet/PartSet_OverconstraintListener.cpp index 1f4579368..8b63be4a4 100644 --- a/src/PartSet/PartSet_OverconstraintListener.cpp +++ b/src/PartSet/PartSet_OverconstraintListener.cpp @@ -187,8 +187,7 @@ void PartSet_OverconstraintListener::processEvent( if (aPrevFullyConstrained != myIsFullyConstrained) { std::set aModifiedObjects; - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); CompositeFeaturePtr aSketch = aModule->sketchMgr()->activeSketch(); // check the sketch in the message and the active sketch are the same @@ -231,7 +230,7 @@ void PartSet_OverconstraintListener::processEvent( ModuleBase_Operation *anOperation = XGUI_Tools::workshop(myWorkshop)->operationMgr()->currentOperation(); if (anOperation) { - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(anOperation); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); @@ -242,15 +241,13 @@ void PartSet_OverconstraintListener::processEvent( } } if (theMessage->sender()) { - ModelAPI_Object *aSender = - static_cast(theMessage->sender()); + auto *aSender = static_cast(theMessage->sender()); if (aSender) { FeaturePtr aFeatureSender = std::dynamic_pointer_cast( aSender->data()->owner()); if (aFeatureSender.get() && aFeatureSender->data()->name() == aCurrentFeatureName) { - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); PartSet_SketcherReentrantMgr *aReentrantMgr = aModule->sketchReentranceMgr(); aReentrantMgr->setReentrantMessage(theMessage); @@ -263,10 +260,9 @@ void PartSet_OverconstraintListener::processEvent( if (aConstraintsMsg.get()) { myObjectsToRemove = aConstraintsMsg->constraints(); - std::set::const_iterator anIt = myObjectsToRemove.begin(); + auto anIt = myObjectsToRemove.begin(); - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); for (; anIt != myObjectsToRemove.end();) { ObjectPtr anObject = *anIt; @@ -306,8 +302,8 @@ bool PartSet_OverconstraintListener::appendConflictingObjects( // set error state for new objects and append them in the internal map of // objects - std::set::const_iterator anIt = theConflictingObjects.begin(), - aLast = theConflictingObjects.end(); + auto anIt = theConflictingObjects.begin(), + aLast = theConflictingObjects.end(); int aCountOfSimilarConstraints = 0; for (; anIt != aLast; anIt++) { @@ -368,8 +364,7 @@ void PartSet_OverconstraintListener::redisplayObjects( static Events_ID EVENT_REDISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); static const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get(); - std::set::const_iterator anIt = theObjects.begin(), - aLast = theObjects.end(); + auto anIt = theObjects.begin(), aLast = theObjects.end(); for (; anIt != aLast; anIt++) { ObjectPtr aObj = *anIt; aECreator->sendUpdated(aObj, EVENT_DISP); diff --git a/src/PartSet/PartSet_PreviewPlanes.cpp b/src/PartSet/PartSet_PreviewPlanes.cpp index c9e4955eb..85c814ddc 100644 --- a/src/PartSet/PartSet_PreviewPlanes.cpp +++ b/src/PartSet/PartSet_PreviewPlanes.cpp @@ -35,7 +35,7 @@ #include -PartSet_PreviewPlanes::PartSet_PreviewPlanes() : myPreviewDisplayed(false) {} +PartSet_PreviewPlanes::PartSet_PreviewPlanes() {} bool PartSet_PreviewPlanes::hasVisualizedBodies( ModuleBase_IWorkshop *theWorkshop) { @@ -47,7 +47,7 @@ bool PartSet_PreviewPlanes::hasVisualizedBodies( foreach (ObjectPtr anObj, aDisplayed) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); // result constructions should not be taken as a body - if (aResult.get() != NULL && + if (aResult.get() != nullptr && ((aResult->groupName() == ModelAPI_ResultBody::group()) || ((aResult->groupName() == ModelAPI_ResultPart::group())))) { GeomShapePtr aShape = aResult->shape(); @@ -71,7 +71,7 @@ bool PartSet_PreviewPlanes::hasVisualizedSketch( QObjectPtrList aDisplayed = aDisp->displayedObjects(); foreach (ObjectPtr anObj, aDisplayed) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); - if (aResult.get() != NULL) { + if (aResult.get() != nullptr) { FeaturePtr aFeature = ModelAPI_Feature::feature(aResult); if (aFeature.get() && aFeature->getKind() == SketchPlugin_Sketch::ID()) { ResultConstructionPtr aCResult = diff --git a/src/PartSet/PartSet_PreviewPlanes.h b/src/PartSet/PartSet_PreviewPlanes.h index afff952f4..542ed23b1 100644 --- a/src/PartSet/PartSet_PreviewPlanes.h +++ b/src/PartSet/PartSet_PreviewPlanes.h @@ -39,7 +39,8 @@ public: /// Constructor PartSet_PreviewPlanes(); - ~PartSet_PreviewPlanes(){}; + ~PartSet_PreviewPlanes() = default; + ; /// Returns true if there is body visualized in the viewer /// \param theWorkshop the application workshop @@ -78,7 +79,7 @@ private: const int theRGB[3]); private: - bool myPreviewDisplayed; + bool myPreviewDisplayed{false}; AISObjectPtr myYZPlane; AISObjectPtr myXZPlane; diff --git a/src/PartSet/PartSet_PreviewSketchPlane.cpp b/src/PartSet/PartSet_PreviewSketchPlane.cpp index 13f8e3d88..e34488b02 100644 --- a/src/PartSet/PartSet_PreviewSketchPlane.cpp +++ b/src/PartSet/PartSet_PreviewSketchPlane.cpp @@ -43,8 +43,7 @@ #include -PartSet_PreviewSketchPlane::PartSet_PreviewSketchPlane() - : myPreviewIsDisplayed(false), mySizeOfView(0), myIsUseSizeOfView(false) {} +PartSet_PreviewSketchPlane::PartSet_PreviewSketchPlane() {} void PartSet_PreviewSketchPlane::eraseSketchPlane( ModuleBase_IWorkshop *theWorkshop, const bool isClearPlane) { @@ -201,7 +200,7 @@ bool PartSet_PreviewSketchPlane::getDefaultSizeOfView( } } if (aBox.IsVoid()) - return 0; + return false; double aXmin, aXmax, anYmin, anYmax, aZmin, aZmax; aBox.Get(aXmin, anYmin, aZmin, aXmax, anYmax, aZmax); diff --git a/src/PartSet/PartSet_PreviewSketchPlane.h b/src/PartSet/PartSet_PreviewSketchPlane.h index 9a184b93d..d4f0edc89 100644 --- a/src/PartSet/PartSet_PreviewSketchPlane.h +++ b/src/PartSet/PartSet_PreviewSketchPlane.h @@ -98,14 +98,16 @@ private: std::shared_ptr createPreviewPlane(); private: - bool myPreviewIsDisplayed; + bool myPreviewIsDisplayed{false}; std::shared_ptr myPlane; //! visualized presentation std::shared_ptr myShape; //! current shape to be displayed std::shared_ptr myViewCentralPoint; //! central point of the default view - double mySizeOfView; //! size that should be used by creating a default face - bool myIsUseSizeOfView; //! state if the size is custom or from preferences + double mySizeOfView{ + 0}; //! size that should be used by creating a default face + bool myIsUseSizeOfView{ + false}; //! state if the size is custom or from preferences std::shared_ptr myViewOrigin; //! origin point of sketch if default view is used }; diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index b3b2abd8e..ff45e0724 100644 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -82,7 +82,7 @@ PartSet_ResultSketchPrs::PartSet_ResultSketchPrs(ResultPtr theResult) // Activate individual repaintng if this is a part of compsolid ResultBodyPtr anOwner = ModelAPI_Tools::bodyOwner(myResult); - SetAutoHilight(anOwner.get() == NULL); + SetAutoHilight(anOwner.get() == nullptr); ModuleBase_Tools::setPointBallHighlighting(this); @@ -249,7 +249,7 @@ void PartSet_ResultSketchPrs::setAuxiliaryPresentationStyle( // set line style Handle(Prs3d_LineAspect) aLineAspect; - Aspect_TypeOfLine aType = (Aspect_TypeOfLine)aLineStyle; + auto aType = (Aspect_TypeOfLine)aLineStyle; if (aDrawer->HasOwnLineAspect()) { aLineAspect = aDrawer->LineAspect(); } @@ -316,15 +316,14 @@ void PartSet_ResultSketchPrs::fillShapes( // result. const std::list> &aRes = aFeature->results(); - std::list>::const_iterator aResIter = - aRes.cbegin(); + auto aResIter = aRes.cbegin(); for (; aResIter != aRes.cend(); aResIter++) { std::shared_ptr aConstr = std::dynamic_pointer_cast(*aResIter); if (aConstr) { std::shared_ptr aGeomShape = aConstr->shape(); if (aGeomShape.get()) { - const TopoDS_Shape &aShape = aGeomShape->impl(); + const auto &aShape = aGeomShape->impl(); if (aShape.ShapeType() != TopAbs_EDGE) anAuxiliaryResults.push_back(aConstr); } @@ -344,7 +343,7 @@ void PartSet_ResultSketchPrs::fillShapes( if (aResult.get()) { GeomShapePtr aGeomShape = aResult->shape(); if (aGeomShape.get()) { - const TopoDS_Shape &aShape = aGeomShape->impl(); + const auto &aShape = aGeomShape->impl(); if (!aShape.IsNull()) aBuilder.Add(theAuxiliaryCompound, aShape); } diff --git a/src/PartSet/PartSet_ResultSketchPrs.h b/src/PartSet/PartSet_ResultSketchPrs.h index 072a3f581..290a2a0ed 100644 --- a/src/PartSet/PartSet_ResultSketchPrs.h +++ b/src/PartSet/PartSet_ResultSketchPrs.h @@ -45,15 +45,15 @@ public: DEFINE_STANDARD_RTTIEXT(PartSet_ResultSketchPrs, ViewerData_AISShape) protected: /// Redefinition of virtual function - Standard_EXPORT virtual void + Standard_EXPORT void Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, const Handle(Prs3d_Presentation) & thePresentation, - const Standard_Integer theMode = 0); + const Standard_Integer theMode = 0) override; /// Redefinition of virtual function - Standard_EXPORT virtual void + Standard_EXPORT void ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, - const Standard_Integer theMode); + const Standard_Integer theMode) override; private: /// Appens sensitive and owners for wires of the given shape into selection diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index f3d981d4e..9cfd6ee5f 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -156,7 +156,7 @@ void getAttributesOrResults(const Handle(SelectMgr_EntityOwner) & theOwner, if (aShapeType == TopAbs_VERTEX) { std::pair aPntAttrIndex = PartSet_Tools::findAttributeBy2dPoint(theFeature, aShape, theSketch); - if (aPntAttrIndex.first.get() != NULL) + if (aPntAttrIndex.first.get() != nullptr) theSelectedAttributes[aPntAttrIndex.first] = aPntAttrIndex.second; } else if (aShapeType == TopAbs_EDGE && theSelectedResults.find(theResult) == theSelectedResults.end()) { @@ -169,7 +169,7 @@ PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module *theModule) : QObject(theModule), myModule(theModule), myIsEditLaunching(false), myIsDragging(false), myDragDone(false), myIsMouseOverWindow(false), myIsMouseOverViewProcessed(true), myIsPopupMenuActive(false), - myPreviousUpdateViewerEnabled(true), myExternalPointsMgr(0), + myPreviousUpdateViewerEnabled(true), myExternalPointsMgr(nullptr), myNoDragMoving(false) { ModuleBase_IWorkshop *anIWorkshop = myModule->workshop(); ModuleBase_IViewer *aViewer = anIWorkshop->viewer(); @@ -191,8 +191,7 @@ PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module *theModule) this, SLOT(onMouseDoubleClick(ModuleBase_IViewWindow *, QMouseEvent *))); - XGUI_ModuleConnector *aConnector = - dynamic_cast(anIWorkshop); + auto *aConnector = dynamic_cast(anIWorkshop); XGUI_Workshop *aWorkshop = aConnector->workshop(); connect(aWorkshop, SIGNAL(applicationStarted()), this, SLOT(onApplicationStarted())); @@ -250,7 +249,7 @@ void PartSet_SketcherMgr::onEnterViewPort() { // flag is true, the presentable feature is displayed as soon as the // presentation becomes valid and redisplay happens // ModuleBase_Operation* aOperation = getCurrentOperation(); - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(getCurrentOperation()); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); @@ -292,8 +291,7 @@ void PartSet_SketcherMgr::onLeaveViewPort() { // 2. if the mouse IS NOT over window, reset the active widget value and hide // the presentation ModuleBase_IWorkshop *aWorkshop = myModule->workshop(); - XGUI_ModuleConnector *aConnector = - dynamic_cast(aWorkshop); + auto *aConnector = dynamic_cast(aWorkshop); XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); // disable the viewer update in order to avoid visualization of redisplayed // feature in viewer obtained after reset value @@ -306,7 +304,7 @@ void PartSet_SketcherMgr::onLeaveViewPort() { // the feature is to be erased here, but it is correct to call // canDisplayObject because there can be additional check (e.g. editor widget // in distance constraint) - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(getCurrentOperation()); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); @@ -406,7 +404,7 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow *theWnd, // if (!aViewer->canDragByMouse()) // return; - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(getCurrentOperation()); if (!aFOperation) return; @@ -444,7 +442,7 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow *theWnd, if ((!isSketcher) && (!isEditing)) { if (MyModeByDrag) { ModuleBase_ModelWidget *anActiveWidget = getActiveWidget(); - PartSet_MouseProcessor *aProcessor = + auto *aProcessor = dynamic_cast(anActiveWidget); if (aProcessor) { MyMultiselectionState = aViewer->isMultiSelectionEnabled(); @@ -525,7 +523,7 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow *theWnd, aFOperation->propertyPanel()->cleanContent(); } myIsEditLaunching = aPrevLaunchingState; - if (aFeature.get() != NULL) { + if (aFeature.get() != nullptr) { std::shared_ptr aSketchFeature = std::dynamic_pointer_cast(aFeature); if (aSketchFeature.get() && @@ -562,7 +560,7 @@ void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow *theWnd, return; } - ModuleBase_OperationFeature *aOp = + auto *aOp = dynamic_cast(getCurrentOperation()); bool isEditing = false; if (aOp) { @@ -598,8 +596,7 @@ void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow *theWnd, } ModuleBase_ModelWidget *anActiveWidget = getActiveWidget(); - PartSet_MouseProcessor *aProcessor = - dynamic_cast(anActiveWidget); + auto *aProcessor = dynamic_cast(anActiveWidget); if (aProcessor) { ModuleBase_ISelection *aSelection = aWorkshop->selection(); QList aPreSelected = aSelection->getHighlighted(); @@ -649,8 +646,7 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow *theWnd, return; ModuleBase_IWorkshop *aWorkshop = myModule->workshop(); - XGUI_ModuleConnector *aConnector = - dynamic_cast(aWorkshop); + auto *aConnector = dynamic_cast(aWorkshop); XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); if (isNestedCreateOperation(getCurrentOperation(), activeSketch())) { @@ -663,8 +659,7 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow *theWnd, // in order to visualize correct presentation. These widgets correct the // feature attribute according to the mouse position ModuleBase_ModelWidget *anActiveWidget = myModule->activeWidget(); - PartSet_MouseProcessor *aProcessor = - dynamic_cast(anActiveWidget); + auto *aProcessor = dynamic_cast(anActiveWidget); if (aProcessor) aProcessor->mouseMoved(theWnd, theEvent); if (!myIsMouseOverViewProcessed) { @@ -673,7 +668,7 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow *theWnd, // the feature is to be erased here, but it is correct to call // canDisplayObject because there can be additional check (e.g. editor // widget in distance constraint) - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(getCurrentOperation()); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); @@ -743,7 +738,7 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow *theWnd, anAttributes.end(); for (; anAttIt != anAttLast; anAttIt++) { AttributePtr anAttr = anAttIt->first; - if (anAttr.get() == NULL) + if (anAttr.get() == nullptr) continue; std::string aAttrId = anAttr->id(); DataPtr aData = aFeature->data(); @@ -808,9 +803,9 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow *theWnd, } } -void PartSet_SketcherMgr::onMouseDoubleClick(ModuleBase_IViewWindow *theWnd, - QMouseEvent *theEvent) { - ModuleBase_OperationFeature *aFOperation = +void PartSet_SketcherMgr::onMouseDoubleClick( + ModuleBase_IViewWindow * /*theWnd*/, QMouseEvent * /*theEvent*/) { + auto *aFOperation = dynamic_cast(getCurrentOperation()); if (aFOperation && aFOperation->isEditOperation()) { std::string aId = aFOperation->id().toStdString(); @@ -825,8 +820,7 @@ void PartSet_SketcherMgr::onMouseDoubleClick(ModuleBase_IViewWindow *theWnd, anId == SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID() || anId == SketchPlugin_ConstraintDistanceAlongDir::DISTANCE_VALUE_ID()) { - PartSet_WidgetEditor *anEditor = - dynamic_cast(aWgt); + auto *anEditor = dynamic_cast(aWgt); if (anEditor) anEditor->showPopupEditor(); return; @@ -838,8 +832,7 @@ void PartSet_SketcherMgr::onMouseDoubleClick(ModuleBase_IViewWindow *theWnd, void PartSet_SketcherMgr::onApplicationStarted() { ModuleBase_IWorkshop *anIWorkshop = myModule->workshop(); - XGUI_ModuleConnector *aConnector = - dynamic_cast(anIWorkshop); + auto *aConnector = dynamic_cast(anIWorkshop); XGUI_Workshop *aWorkshop = aConnector->workshop(); PartSet_SketcherReentrantMgr *aReentranceMgr = myModule->sketchReentranceMgr(); @@ -1028,7 +1021,7 @@ bool PartSet_SketcherMgr::isNestedSketchOperation( if (anActiveSketch.get() && theOperation) { ModuleBase_Operation *aSketchOperation = operationMgr()->findOperation(anActiveSketch->getKind().c_str()); - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(theOperation); if (aSketchOperation && aFOperation) { FeaturePtr aFeature = aFOperation->feature(); @@ -1059,18 +1052,16 @@ bool PartSet_SketcherMgr::isNestedSketchFeature( bool PartSet_SketcherMgr::isNestedCreateOperation( ModuleBase_Operation *theOperation, - const CompositeFeaturePtr &theSketch) const { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast(theOperation); + const CompositeFeaturePtr & /*theSketch*/) const { + auto *aFOperation = dynamic_cast(theOperation); return aFOperation && !aFOperation->isEditOperation() && isNestedSketchOperation(aFOperation); } bool PartSet_SketcherMgr::isNestedEditOperation( ModuleBase_Operation *theOperation, - const CompositeFeaturePtr &theSketch) const { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast(theOperation); + const CompositeFeaturePtr & /*theSketch*/) const { + auto *aFOperation = dynamic_cast(theOperation); return aFOperation && aFOperation->isEditOperation() && isNestedSketchOperation(aFOperation); } @@ -1109,13 +1100,13 @@ bool PartSet_SketcherMgr::isDistanceKind(std::string &theKind) { (theKind == SketchPlugin_ConstraintDistanceAlongDir::ID()); } -void PartSet_SketcherMgr::startSketch(ModuleBase_Operation *theOperation) { +void PartSet_SketcherMgr::startSketch(ModuleBase_Operation * /*theOperation*/) { static Events_ID EVENT_ATTR = Events_Loop::loop()->eventByName(EVENT_VISUAL_ATTRIBUTES); static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(getCurrentOperation()); if (!aFOperation) return; @@ -1138,8 +1129,7 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation *theOperation) { } mySketchPlane->createSketchPlane(myCurrentSketch, myModule->workshop()); - XGUI_ModuleConnector *aConnector = - dynamic_cast(myModule->workshop()); + auto *aConnector = dynamic_cast(myModule->workshop()); // Hide sketcher result std::list aResults = myCurrentSketch->results(); @@ -1164,8 +1154,7 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation *theOperation) { std::map> aReferences; ModelAPI_Tools::findAllReferences(anInvalidFeatures, aReferences, false); - std::set::const_iterator anIt = anInvalidFeatures.begin(), - aLast = anInvalidFeatures.end(); + auto anIt = anInvalidFeatures.begin(), aLast = anInvalidFeatures.end(); // separate features to references to parameter features and references to // others QStringList anInvalidFeatureNames; @@ -1249,16 +1238,14 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation *theOperation) { workshop()->viewer()->set2dMode(true); - PartSet_Fitter *aFitter = new PartSet_Fitter(this); + auto *aFitter = new PartSet_Fitter(this); myModule->workshop()->viewer()->setFitter(aFitter); } void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation *theOperation) { - XGUI_ModuleConnector *aConnector = - dynamic_cast(myModule->workshop()); - PartSet_Fitter *aFitter = - (PartSet_Fitter *)myModule->workshop()->viewer()->fitter(); - myModule->workshop()->viewer()->setFitter(0); + auto *aConnector = dynamic_cast(myModule->workshop()); + auto *aFitter = (PartSet_Fitter *)myModule->workshop()->viewer()->fitter(); + myModule->workshop()->viewer()->setFitter(nullptr); delete aFitter; myIsMouseOverWindow = false; @@ -1268,7 +1255,7 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation *theOperation) { if (myExternalPointsMgr) { delete myExternalPointsMgr; - myExternalPointsMgr = 0; + myExternalPointsMgr = nullptr; } onShowPoints(false); @@ -1304,7 +1291,7 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation *theOperation) { Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aDispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(theOperation); for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { if (!aFOperation->isDisplayedOnStart(*aIt)) { @@ -1356,7 +1343,7 @@ void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation *theOperation) { // returning to the neutral point of the Sketcher bool isClearSelectionPossible = true; if (myIsEditLaunching) { - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(theOperation); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); @@ -1375,7 +1362,7 @@ void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation *theOperation) { void PartSet_SketcherMgr::commitNestedSketch( ModuleBase_Operation *theOperation) { if (isNestedCreateOperation(theOperation, activeSketch())) { - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(theOperation); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); @@ -1413,7 +1400,7 @@ bool PartSet_SketcherMgr::operationActivatedByPreselection() { /// value after entering the value, the operation should be /// committed/aborted(by Esc key) bool aCanCommitOperation = true; - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(anOperation); if (aFOperation && PartSet_SketcherMgr::isDistanceOperation(aFOperation)) { bool aValueAccepted = setDistanceValueByPreselection( @@ -1453,13 +1440,13 @@ bool PartSet_SketcherMgr::canEraseObject(const ObjectPtr &theObject) const { bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr &theObject) const { bool aCanDisplay = true; - bool aHasActiveSketch = activeSketch().get() != NULL; + bool aHasActiveSketch = activeSketch().get() != nullptr; if (aHasActiveSketch) { // 1. the sketch feature should not be displayed during the sketch active // operation it is hidden by a sketch operation start and shown by a sketch // stop, just the sketch nested features can be visualized FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); - if (aFeature.get() != NULL && aFeature == activeSketch()) { + if (aFeature.get() != nullptr && aFeature == activeSketch()) { aCanDisplay = false; } std::shared_ptr aSketchFeature = @@ -1471,7 +1458,7 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr &theObject) const { // 2. sketch sub-features should not be visualized if the sketch operation // is not active FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); - if (aFeature.get() != NULL) { + if (aFeature.get() != nullptr) { std::shared_ptr aSketchFeature = std::dynamic_pointer_cast(aFeature); if (aSketchFeature.get()) { @@ -1485,7 +1472,7 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr &theObject) const { // feature or this feature result if (aCanDisplay) { bool isObjectFound = false; - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(getCurrentOperation()); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); @@ -1515,7 +1502,7 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr &theObject) const { ModuleBase_WidgetEditor *anEditorWdg = anActiveWidget ? dynamic_cast(anActiveWidget) - : 0; + : nullptr; // the active widget editor should not influence here. The presentation // should be visible always when this widget is active. if (!anEditorWdg && !myIsPopupMenuActive) { @@ -1716,8 +1703,7 @@ bool PartSet_SketcherMgr::setDistanceValueByPreselection( bool isValueAccepted = false; theCanCommitOperation = false; - ModuleBase_OperationFeature *aFOperation = - dynamic_cast(theOperation); + auto *aFOperation = dynamic_cast(theOperation); FeaturePtr aFeature = aFOperation->feature(); // editor is shown only if all attribute references are filled by preseletion bool anAllRefAttrInitialized = true; @@ -1748,8 +1734,7 @@ bool PartSet_SketcherMgr::setDistanceValueByPreselection( Events_Loop::loop()->flush( Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - PartSet_WidgetEditor *anEditor = - dynamic_cast(aWgt); + auto *anEditor = dynamic_cast(aWgt); if (anEditor) { int aX = 0, anY = 0; @@ -1757,10 +1742,10 @@ bool PartSet_SketcherMgr::setDistanceValueByPreselection( XGUI_Displayer *aDisplayer = aWorkshop->displayer(); AISObjectPtr anAIS = aDisplayer->getAISObject(aFeature); Handle(AIS_InteractiveObject) anAISIO; - if (anAIS.get() != NULL) { + if (anAIS.get() != nullptr) { anAISIO = anAIS->impl(); } - if (anAIS.get() != NULL) { + if (anAIS.get() != nullptr) { anAISIO = anAIS->impl(); if (!anAISIO.IsNull()) { @@ -1797,7 +1782,7 @@ void PartSet_SketcherMgr::getSelectionOwners( ModuleBase_IWorkshop *theWorkshop, const FeatureToSelectionMap &theSelection, SelectMgr_IndexedMapOfOwner &theOwnersToSelect) { - if (theFeature.get() == NULL) + if (theFeature.get() == nullptr) return; FeatureToSelectionMap::const_iterator anIt = theSelection.find(theFeature); @@ -1805,13 +1790,12 @@ void PartSet_SketcherMgr::getSelectionOwners( std::map aSelectedAttributes = anInfo.myAttributes; std::set aSelectedResults = anInfo.myResults; - XGUI_ModuleConnector *aConnector = - dynamic_cast(theWorkshop); + auto *aConnector = dynamic_cast(theWorkshop); XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); // 1. found the feature's owners. Check the AIS objects of the constructions AISObjectPtr aAISObj = aDisplayer->getAISObject(theFeature); - if (aAISObj.get() != NULL && aSelectedAttributes.empty() && + if (aAISObj.get() != nullptr && aSelectedAttributes.empty() && aSelectedResults.empty()) { Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl(); @@ -1841,7 +1825,7 @@ void PartSet_SketcherMgr::getSelectionOwners( for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) { ResultPtr aResult = *aIt; AISObjectPtr aResAISObj = aDisplayer->getAISObject(aResult); - if (aResAISObj.get() == NULL) + if (aResAISObj.get() == nullptr) continue; Handle(AIS_InteractiveObject) anAISIO = aResAISObj->impl(); @@ -1862,7 +1846,7 @@ void PartSet_SketcherMgr::getSelectionOwners( std::pair aPntAttrIndex = PartSet_Tools::findAttributeBy2dPoint(theFeature, aShape, theSketch); - if (aPntAttrIndex.first.get() != NULL && + if (aPntAttrIndex.first.get() != nullptr && aSelectedAttributes.find(aPntAttrIndex.first) != aSelectedAttributes.end()) theOwnersToSelect.Add(anOwner); @@ -1921,7 +1905,7 @@ void PartSet_SketcherMgr::connectToPropertyPanel( } void PartSet_SketcherMgr::widgetStateChanged(int thePreviousState) { - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(getCurrentOperation()); if (aFOperation) { if ((PartSet_SketcherMgr::isSketchOperation(aFOperation) || @@ -1962,7 +1946,7 @@ ModuleBase_Operation *PartSet_SketcherMgr::getCurrentOperation() const { //************************************************************** ModuleBase_ModelWidget *PartSet_SketcherMgr::getActiveWidget() const { - ModuleBase_ModelWidget *aWidget = 0; + ModuleBase_ModelWidget *aWidget = nullptr; ModuleBase_Operation *anOperation = getCurrentOperation(); if (anOperation) { ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel(); @@ -2090,8 +2074,7 @@ void PartSet_SketcherMgr::restoreSelection( // qDebug(QString("restoreSelection: // %1").arg(theCurrentSelection.size()).toStdString().c_str()); ModuleBase_IWorkshop *aWorkshop = myModule->workshop(); - XGUI_ModuleConnector *aConnector = - dynamic_cast(aWorkshop); + auto *aConnector = dynamic_cast(aWorkshop); FeatureToSelectionMap::const_iterator aSIt = theCurrentSelection.begin(), aSLast = theCurrentSelection.end(); SelectMgr_IndexedMapOfOwner anOwnersToSelect; @@ -2105,8 +2088,7 @@ void PartSet_SketcherMgr::restoreSelection( } void PartSet_SketcherMgr::onShowConstraintsToggle(int theType, bool theState) { - PartSet_Tools::ConstraintVisibleState aType = - (PartSet_Tools::ConstraintVisibleState)theType; + auto aType = (PartSet_Tools::ConstraintVisibleState)theType; updateBySketchParameters(aType, theState); myModule->workshop()->viewer()->update(); @@ -2114,7 +2096,7 @@ void PartSet_SketcherMgr::onShowConstraintsToggle(int theType, bool theState) { void PartSet_SketcherMgr::updateBySketchParameters( const PartSet_Tools::ConstraintVisibleState &theType, bool theState) { - if (myCurrentSketch.get() == NULL) + if (myCurrentSketch.get() == nullptr) return; bool aPrevState = myIsConstraintsShown[theType]; @@ -2163,7 +2145,7 @@ void PartSet_SketcherMgr::updateSelectionPriority(ObjectPtr theObject, AISObjectPtr anAIS = workshop()->displayer()->getAISObject(theObject); Handle(AIS_InteractiveObject) anAISIO; - if (anAIS.get() != NULL) { + if (anAIS.get() != nullptr) { anAISIO = anAIS->impl(); } @@ -2172,7 +2154,7 @@ void PartSet_SketcherMgr::updateSelectionPriority(ObjectPtr theObject, // current feature std::shared_ptr aSPFeature = std::dynamic_pointer_cast(theFeature); - if (aSPFeature.get() != NULL) { + if (aSPFeature.get() != nullptr) { // 1. Vertices // 2. Simple segments // 3. External objects (violet color) @@ -2207,8 +2189,7 @@ void PartSet_SketcherMgr::updateSelectionPriority(ObjectPtr theObject, XGUI_Workshop *PartSet_SketcherMgr::workshop() const { ModuleBase_IWorkshop *anIWorkshop = myModule->workshop(); - XGUI_ModuleConnector *aConnector = - dynamic_cast(anIWorkshop); + auto *aConnector = dynamic_cast(anIWorkshop); return aConnector->workshop(); } @@ -2307,7 +2288,7 @@ bool isExternal(const ObjectPtr &theObject) { AttributeSelectionPtr aAttr = theObject->data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); if (aAttr) - return aAttr->context().get() != NULL && !aAttr->isInvalid(); + return aAttr->context().get() != nullptr && !aAttr->isInvalid(); return false; } @@ -2379,7 +2360,7 @@ void PartSet_SketcherMgr::customizeSketchPresentation( std::shared_ptr anAuxiliaryAttr = aFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()); bool isConstruction = - anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value(); + anAuxiliaryAttr.get() != nullptr && anAuxiliaryAttr->value(); std::vector aColor = colorOfObject(theObject, aFeature, isConstruction); if (!aColor.empty()) { @@ -2448,8 +2429,7 @@ void PartSet_Fitter::fitAll(Handle(V3d_View) theView) { CompositeFeaturePtr aSketch = mySketchMgr->activeSketch(); ModuleBase_IWorkshop *aWorkshop = mySketchMgr->module()->workshop(); - XGUI_ModuleConnector *aConnector = - dynamic_cast(aWorkshop); + auto *aConnector = dynamic_cast(aWorkshop); XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); Bnd_Box aBndBox; diff --git a/src/PartSet/PartSet_SketcherReentrantMgr.cpp b/src/PartSet/PartSet_SketcherReentrantMgr.cpp index 6f5c84d0c..972c2735c 100644 --- a/src/PartSet/PartSet_SketcherReentrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReentrantMgr.cpp @@ -74,9 +74,9 @@ PartSet_SketcherReentrantMgr::PartSet_SketcherReentrantMgr( : QObject(theWorkshop), myWorkshop(theWorkshop), myRestartingMode(RM_None), myIsFlagsBlocked(false), myIsInternalEditOperation(false), myNoMoreWidgetsAttribute(""), myIsAutoConstraints(true), - myLastAutoConstraint(0) {} + myLastAutoConstraint(nullptr) {} -PartSet_SketcherReentrantMgr::~PartSet_SketcherReentrantMgr() {} +PartSet_SketcherReentrantMgr::~PartSet_SketcherReentrantMgr() = default; bool PartSet_SketcherReentrantMgr::isInternalEditActive() const { return myIsInternalEditOperation; @@ -84,9 +84,8 @@ bool PartSet_SketcherReentrantMgr::isInternalEditActive() const { void PartSet_SketcherReentrantMgr::updateInternalEditActiveState() { if (myIsInternalEditOperation) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aFOperation = dynamic_cast( + myWorkshop->currentOperation()); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); QString anError = myWorkshop->module()->getFeatureError(aFeature); @@ -103,7 +102,7 @@ void PartSet_SketcherReentrantMgr::updateInternalEditActiveState() { } bool PartSet_SketcherReentrantMgr::operationCommitted( - ModuleBase_Operation *theOperation) { + ModuleBase_Operation * /*theOperation*/) { bool aProcessed = false; if (!isActiveMgr()) return aProcessed; @@ -115,7 +114,7 @@ bool PartSet_SketcherReentrantMgr::operationCommitted( } void PartSet_SketcherReentrantMgr::operationStarted( - ModuleBase_Operation *theOperation) { + ModuleBase_Operation * /*theOperation*/) { if (!isActiveMgr()) return; @@ -132,7 +131,7 @@ void PartSet_SketcherReentrantMgr::operationStarted( } void PartSet_SketcherReentrantMgr::operationAborted( - ModuleBase_Operation *theOperation) { + ModuleBase_Operation * /*theOperation*/) { if (!isActiveMgr()) return; @@ -146,9 +145,8 @@ bool PartSet_SketcherReentrantMgr::processMouseMoved( return aProcessed; if (myIsInternalEditOperation) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aFOperation = dynamic_cast( + myWorkshop->currentOperation()); FeaturePtr aLastFeature = myRestartingMode == RM_LastFeatureUsed ? aFOperation->feature() : FeaturePtr(); @@ -189,8 +187,7 @@ bool PartSet_SketcherReentrantMgr::processMouseMoved( } else { // processing mouse move in active widget of restarted operation ModuleBase_ModelWidget *anActiveWdg = module()->activeWidget(); - PartSet_MouseProcessor *aProcessor = - dynamic_cast(anActiveWdg); + auto *aProcessor = dynamic_cast(anActiveWdg); if (aProcessor) aProcessor->mouseMoved(theWnd, theEvent); } @@ -225,9 +222,8 @@ bool PartSet_SketcherReentrantMgr::processMouseReleased( // position ModuleBase_Tools::blockUpdateViewer(true); - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aFOperation = dynamic_cast( + myWorkshop->currentOperation()); myPreviousFeature = aFOperation->feature(); /// selection should be obtained from workshop before ask if the operation @@ -247,7 +243,7 @@ bool PartSet_SketcherReentrantMgr::processMouseReleased( module()->getGeomSelection(aValue, mySelectedObject, mySelectedAttribute); - PartSet_WidgetPoint2D *aPointWidget = + auto *aPointWidget = dynamic_cast(anActiveWidget); if (aPointWidget) { GeomShapePtr aShape; @@ -281,13 +277,12 @@ bool PartSet_SketcherReentrantMgr::processMouseReleased( // fill the first widget by the mouse event point // if the active widget is not the first, it means that the restarted // operation is filled by the current preselection. - PartSet_MouseProcessor *aMouseProcessor = + auto *aMouseProcessor = dynamic_cast(module()->activeWidget()); // PartSet_WidgetPoint2D* aPoint2DWdg = // dynamic_cast(module()->activeWidget()); - PartSet_MouseProcessor *aFirstWidget = - dynamic_cast( - aPanel->findFirstAcceptingValueWidget()); + auto *aFirstWidget = dynamic_cast( + aPanel->findFirstAcceptingValueWidget()); // if (aPoint2DWdg && aPoint2DWdg == aFirstWidget) { if (aMouseProcessor && aMouseProcessor == aFirstWidget) { std::shared_ptr aSelectedPrs; @@ -368,9 +363,8 @@ void PartSet_SketcherReentrantMgr::onNoMoreWidgets( return; } - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aFOperation = dynamic_cast( + myWorkshop->currentOperation()); if (module()->sketchMgr()->isDragModeCreation()) { if (aFOperation && myIsAutoConstraints) addConstraints(aFOperation->feature()); @@ -412,9 +406,8 @@ bool PartSet_SketcherReentrantMgr::processEnter( if (thePreviousAttributeID.empty()) return isDone; - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aFOperation = dynamic_cast( + myWorkshop->currentOperation()); if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) return isDone; @@ -460,7 +453,7 @@ void PartSet_SketcherReentrantMgr::onVertexSelected() { void PartSet_SketcherReentrantMgr::onAfterValuesChangedInPropertyPanel() { if (isInternalEditActive()) { - ModuleBase_ModelWidget *aWidget = (ModuleBase_ModelWidget *)sender(); + auto *aWidget = (ModuleBase_ModelWidget *)sender(); if (!aWidget->isModifiedInEdit().empty()) restartOperation(); } @@ -486,9 +479,8 @@ bool PartSet_SketcherReentrantMgr::isActiveMgr() const { module()->sketchMgr()->isNestedSketchOperation(aCurrentOperation); if (anActive) { // the manager is not active when the current operation is a // usual Edit - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aFOperation = dynamic_cast( + myWorkshop->currentOperation()); if (aFOperation->isEditOperation()) anActive = myIsInternalEditOperation; } @@ -510,9 +502,8 @@ bool PartSet_SketcherReentrantMgr::startInternalEdit( if (myIsInternalEditOperation) return true; - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aFOperation = dynamic_cast( + myWorkshop->currentOperation()); if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { @@ -544,7 +535,7 @@ bool PartSet_SketcherReentrantMgr::startInternalEdit( ModuleBase_Operation *anEditOperation = module()->currentOperation(); if (anEditOperation) { ModuleBase_IPropertyPanel *aPanel = aFOperation->propertyPanel(); - ModuleBase_ModelWidget *aPreviousAttributeWidget = 0; + ModuleBase_ModelWidget *aPreviousAttributeWidget = nullptr; QList aWidgets = aPanel->modelWidgets(); for (int i = 0, aNb = aWidgets.size(); i < aNb && !aPreviousAttributeWidget; i++) { @@ -570,7 +561,7 @@ bool PartSet_SketcherReentrantMgr::startInternalEdit( // is moved to Apply button and there should not be active control // visualized in property panel if (aPreviousAttributeWidget == aPanel->activeWidget()) { - aPanel->activateWidget(NULL, false); + aPanel->activateWidget(nullptr, false); } // if there is no the next widget to be automatically activated, // the Ok button in property @@ -594,9 +585,8 @@ bool PartSet_SketcherReentrantMgr::startInternalEdit( } void PartSet_SketcherReentrantMgr::beforeStopInternalEdit() { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aFOperation = dynamic_cast( + myWorkshop->currentOperation()); if (aFOperation) { disconnect(aFOperation, SIGNAL(beforeCommitted()), this, SLOT(onBeforeStopped())); @@ -613,9 +603,8 @@ void PartSet_SketcherReentrantMgr::restartOperation() { #endif if (myIsInternalEditOperation) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aFOperation = dynamic_cast( + myWorkshop->currentOperation()); if (aFOperation) { ModuleBase_ISelection *aSelection = myWorkshop->selection(); QList aPreSelected = @@ -648,9 +637,8 @@ void PartSet_SketcherReentrantMgr::restartOperation() { } void PartSet_SketcherReentrantMgr::createInternalFeature() { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aFOperation = dynamic_cast( + myWorkshop->currentOperation()); if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { @@ -666,15 +654,14 @@ void PartSet_SketcherReentrantMgr::createInternalFeature() { bool isFeatureChanged = copyReetntrantAttributes( anOperationFeature, myInternalFeature, aSketch, false); - XGUI_PropertyPanel *aPropertyPanel = + auto *aPropertyPanel = dynamic_cast(aFOperation->propertyPanel()); myInternalWidget = new QWidget(aPropertyPanel->contentWidget()->pageWidget()); myInternalWidget->setVisible(false); - ModuleBase_PageWidget *anInternalPage = - new ModuleBase_PageWidget(myInternalWidget); + auto *anInternalPage = new ModuleBase_PageWidget(myInternalWidget); QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation(); ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), myWorkshop); @@ -703,9 +690,9 @@ void PartSet_SketcherReentrantMgr::deleteInternalFeature() { std::cout << "PartSet_SketcherReentrantMgr::deleteInternalFeature: " << myInternalFeature->data()->name() << std::endl; #endif - setInternalActiveWidget(0); + setInternalActiveWidget(nullptr); delete myInternalWidget; - myInternalWidget = 0; + myInternalWidget = nullptr; QObjectPtrList anObjects; anObjects.append(myInternalFeature); @@ -724,7 +711,7 @@ void PartSet_SketcherReentrantMgr::resetFlags() { bool PartSet_SketcherReentrantMgr::copyReetntrantAttributes( const FeaturePtr &theSourceFeature, const FeaturePtr &theNewFeature, - const CompositeFeaturePtr &theSketch, const bool /*isTemporary*/) { + const CompositeFeaturePtr & /*theSketch*/, const bool /*isTemporary*/) { bool aChanged = false; if (!theSourceFeature.get() || !theSourceFeature->data().get() || !theSourceFeature->data()->isValid()) @@ -827,8 +814,7 @@ bool PartSet_SketcherReentrantMgr::isTangentArc( ModuleBase_Operation *theOperation, const CompositeFeaturePtr & /*theSketch*/) const { bool aTangentArc = false; - ModuleBase_OperationFeature *aFOperation = - dynamic_cast(theOperation); + auto *aFOperation = dynamic_cast(theOperation); if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) { FeaturePtr aFeature = aFOperation->feature(); @@ -850,8 +836,7 @@ void PartSet_SketcherReentrantMgr::updateAcceptAllAction() { } XGUI_Workshop *PartSet_SketcherReentrantMgr::workshop() const { - XGUI_ModuleConnector *aConnector = - dynamic_cast(myWorkshop); + auto *aConnector = dynamic_cast(myWorkshop); return aConnector->workshop(); } @@ -861,11 +846,10 @@ PartSet_Module *PartSet_SketcherReentrantMgr::module() const { void PartSet_SketcherReentrantMgr::setInternalActiveWidget( ModuleBase_ModelWidget *theWidget) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myWorkshop->currentOperation()); + auto *aFOperation = dynamic_cast( + myWorkshop->currentOperation()); if (aFOperation) { - XGUI_PropertyPanel *aPropertyPanel = + auto *aPropertyPanel = dynamic_cast(aFOperation->propertyPanel()); if (aPropertyPanel) aPropertyPanel->setInternalActiveWidget(theWidget); diff --git a/src/PartSet/PartSet_SketcherReentrantMgr.h b/src/PartSet/PartSet_SketcherReentrantMgr.h index 8d2a4dd65..ab5954298 100644 --- a/src/PartSet/PartSet_SketcherReentrantMgr.h +++ b/src/PartSet/PartSet_SketcherReentrantMgr.h @@ -73,7 +73,7 @@ public: /// Constructor /// \param theWorkshop a workshop instance PartSet_SketcherReentrantMgr(ModuleBase_IWorkshop *theWorkshop); - virtual ~PartSet_SketcherReentrantMgr(); + ~PartSet_SketcherReentrantMgr() override; public: /// Return true if the current edit operation is an internal diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index 79096d67c..e5e873adb 100644 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -366,7 +366,7 @@ PartSet_Tools::point3D(std::shared_ptr thePoint2D, } ResultPtr -PartSet_Tools::findFixedObjectByExternal(const TopoDS_Shape &theShape, +PartSet_Tools::findFixedObjectByExternal(const TopoDS_Shape & /*theShape*/, const ObjectPtr &theObject, CompositeFeaturePtr theSketch) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); @@ -385,7 +385,7 @@ PartSet_Tools::findFixedObjectByExternal(const TopoDS_Shape &theShape, ResultPtr PartSet_Tools::createFixedObjectByExternal( const std::shared_ptr &theShape, const ObjectPtr &theObject, - CompositeFeaturePtr theSketch, const bool theTemporary, + CompositeFeaturePtr theSketch, const bool /*theTemporary*/, FeaturePtr &theCreatedFeature) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (!aResult.get()) @@ -443,8 +443,7 @@ GeomShapePtr PartSet_Tools::findShapeBy2DPoint(const AttributePtr &theAttribute, ModuleBase_IWorkshop *theWorkshop) { GeomShapePtr aShape; - XGUI_ModuleConnector *aConnector = - dynamic_cast(theWorkshop); + auto *aConnector = dynamic_cast(theWorkshop); XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer(); // 2. find visualized vertices of the attribute and if the attribute of the @@ -453,11 +452,10 @@ PartSet_Tools::findShapeBy2DPoint(const AttributePtr &theAttribute, ModelAPI_Feature::feature(theAttribute->owner()); // 2.1 get visualized results of the feature const std::list &aResList = anAttributeFeature->results(); - std::list::const_iterator anIt = aResList.begin(), - aLast = aResList.end(); + auto anIt = aResList.begin(), aLast = aResList.end(); for (; anIt != aLast; anIt++) { AISObjectPtr aAISObj = aDisplayer->getAISObject(*anIt); - if (aAISObj.get() != NULL) { + if (aAISObj.get() != nullptr) { Handle(AIS_InteractiveObject) anAISIO = aAISObj->impl(); // 2.2 find selected owners of a visualizedd object @@ -474,14 +472,14 @@ PartSet_Tools::findShapeBy2DPoint(const AttributePtr &theAttribute, if (aBRepShape.ShapeType() == TopAbs_VERTEX) { // 2.3 if the owner is vertex and an attribute of the vertex is // equal to the initial attribute, returns the shape - PartSet_Module *aModule = + auto *aModule = dynamic_cast(theWorkshop->module()); PartSet_SketcherMgr *aSketchMgr = aModule->sketchMgr(); std::pair aPntAttrIndex = PartSet_Tools::findAttributeBy2dPoint( anAttributeFeature, aBRepShape, aSketchMgr->activeSketch()); - if (aPntAttrIndex.first.get() != NULL && + if (aPntAttrIndex.first.get() != nullptr && aPntAttrIndex.first == theAttribute) { aShape = std::shared_ptr(new GeomAPI_Shape); aShape->setImpl(new TopoDS_Shape(aBRepShape)); @@ -503,7 +501,7 @@ PartSet_Tools::getPoint(std::shared_ptr &theFeature, ModelGeomAlgo_Point2D::getPointOfRefAttr(theFeature.get(), theAttribute, SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID()); - if (aPointAttr.get() != NULL) + if (aPointAttr.get() != nullptr) return aPointAttr->pnt(); return std::shared_ptr(); } @@ -572,7 +570,7 @@ FeaturePtr PartSet_Tools::findFirstCoincidence(const FeaturePtr &theFeature, std::shared_ptr thePoint) { FeaturePtr aCoincident; - if (theFeature.get() == NULL) + if (theFeature.get() == nullptr) return aCoincident; const std::set &aRefsList = theFeature->data()->refsToMe(); @@ -618,7 +616,7 @@ void PartSet_Tools::findCoincidences(FeaturePtr theStartCoin, std::string theAttr, QList &theIsAttributes) { std::shared_ptr aOrig = getCoincedencePoint(theStartCoin); - if (aOrig.get() == NULL) + if (aOrig.get() == nullptr) return; AttributeRefAttrPtr aPnt = theStartCoin->refattr(theAttr); @@ -695,7 +693,7 @@ std::shared_ptr PartSet_Tools::getCoincedencePoint(FeaturePtr theStartCoin) { std::shared_ptr aPnt = SketcherPrs_Tools::getPoint( theStartCoin.get(), SketchPlugin_Constraint::ENTITY_A()); - if (aPnt.get() == NULL) + if (aPnt.get() == nullptr) aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), SketchPlugin_Constraint::ENTITY_B()); return aPnt; @@ -821,9 +819,7 @@ bool PartSet_Tools::isIncludeIntoSketchResult(const ObjectPtr &theObject) { // go through the references to the feature to check // if it was created by Projection or Intersection const std::set &aRefs = theObject->data()->refsToMe(); - for (std::set::const_iterator aRefIt = aRefs.begin(); - aRefIt != aRefs.end(); ++aRefIt) { - AttributePtr anAttr = *aRefIt; + for (auto anAttr : aRefs) { std::string anIncludeToResultAttrName; if (anAttr->id() == SketchPlugin_Projection::PROJECTED_FEATURE_ID()) anIncludeToResultAttrName = diff --git a/src/PartSet/PartSet_TreeNodes.cpp b/src/PartSet/PartSet_TreeNodes.cpp index a92be79ae..5b7790b4d 100644 --- a/src/PartSet/PartSet_TreeNodes.cpp +++ b/src/PartSet/PartSet_TreeNodes.cpp @@ -304,8 +304,7 @@ void PartSet_ObjectNode::update() { FieldStepPtr aStep = aFieldRes->step(i); if (aStep.get()) { if (i < myChildren.size()) { - PartSet_StepNode *aStepNode = - static_cast(myChildren.at(i)); + auto *aStepNode = static_cast(myChildren.at(i)); if (aStepNode->object() != aStep) { aStepNode->setObject(aStep); } @@ -363,8 +362,7 @@ PartSet_ObjectNode::objectCreated(const QObjectPtrList &theObjects) { FieldStepPtr aStep = aFieldRes->step(i); if (aStep.get()) { if (i < myChildren.size()) { - PartSet_StepNode *aStepNode = - static_cast(myChildren.at(i)); + auto *aStepNode = static_cast(myChildren.at(i)); if (aStepNode->object() != aStep) { aStepNode->setObject(aStep); } @@ -476,7 +474,7 @@ QVariant PartSet_FolderNode::data(int theColumn, int theRole) const { FeaturePtr aFeature = document()->currentFeature(true); if (!aFeature.get()) { // There is no current feature - ModuleBase_ITreeNode *aLastFolder = 0; + ModuleBase_ITreeNode *aLastFolder = nullptr; foreach (ModuleBase_ITreeNode *aNode, parent()->children()) { if (aNode->type() == PartSet_FolderNode::typeId()) aLastFolder = aNode; @@ -746,7 +744,7 @@ PartSet_FeatureFolderNode::objectsDeleted(const DocumentPtr &theDoc, ModuleBase_ITreeNode * PartSet_FeatureFolderNode::findParent(const DocumentPtr &theDoc, QString theGroup) { - ModuleBase_ITreeNode *aResult = 0; + ModuleBase_ITreeNode *aResult = nullptr; foreach (ModuleBase_ITreeNode *aNode, myChildren) { aResult = aNode->findParent(theDoc, theGroup); if (aResult) { @@ -757,12 +755,11 @@ PartSet_FeatureFolderNode::findParent(const DocumentPtr &theDoc, (theGroup.toStdString() == ModelAPI_Folder::group())); if ((theDoc == document()) && isGroup) return this; - return 0; + return nullptr; } ////////////////////////////////////////////////////////////////////////////////// -PartSet_RootNode::PartSet_RootNode() - : PartSet_FeatureFolderNode(0), myWorkshop(0) { +PartSet_RootNode::PartSet_RootNode() : PartSet_FeatureFolderNode(nullptr) { SessionPtr aSession = ModelAPI_Session::get(); DocumentPtr aDoc = aSession->moduleDocument(); @@ -841,7 +838,7 @@ ModuleBase_ITreeNode *PartSet_RootNode::createNode(const ObjectPtr &theObj) { if (aFeature->getKind() == PartSetPlugin_Part::ID()) return new PartSet_PartRootNode(theObj, this); - PartSet_ObjectNode *aNode = new PartSet_ObjectNode(theObj, this); + auto *aNode = new PartSet_ObjectNode(theObj, this); aNode->update(); return aNode; } @@ -972,7 +969,7 @@ QVariant PartSet_PartRootNode::data(int theColumn, int theRole) const { case Qt::DisplayRole: { ResultPartPtr aPartRes = getPartResult(myObject); if (aPartRes.get()) { - if (aPartRes->partDoc().get() == NULL) + if (aPartRes->partDoc().get() == nullptr) return QString::fromStdWString(myObject->data()->name()) + " (Not loaded)"; } @@ -1007,7 +1004,7 @@ ModuleBase_ITreeNode * PartSet_PartRootNode::createNode(const ObjectPtr &theObj) { if (theObj->groupName() == ModelAPI_Folder::group()) return new PartSet_ObjectFolderNode(theObj, this); - PartSet_ObjectNode *aNode = new PartSet_ObjectNode(theObj, this); + auto *aNode = new PartSet_ObjectNode(theObj, this); aNode->update(); return aNode; } diff --git a/src/PartSet/PartSet_TreeNodes.h b/src/PartSet/PartSet_TreeNodes.h index f4ca9b9e0..623384021 100644 --- a/src/PartSet/PartSet_TreeNodes.h +++ b/src/PartSet/PartSet_TreeNodes.h @@ -32,11 +32,11 @@ */ class PartSet_TreeNode : public ModuleBase_ITreeNode { public: - PartSet_TreeNode(ModuleBase_ITreeNode *theParent = 0) + PartSet_TreeNode(ModuleBase_ITreeNode *theParent = nullptr) : ModuleBase_ITreeNode(theParent) {} /// Returns the node representation according to theRole. - virtual QVariant data(int theColumn, int theRole) const; + QVariant data(int theColumn, int theRole) const override; // Returns color of the Item when it is active virtual QColor activeItemColor() const; @@ -49,7 +49,7 @@ public: class PartSet_ObjectNode : public PartSet_TreeNode { public: PartSet_ObjectNode(const ObjectPtr &theObj, - ModuleBase_ITreeNode *theParent = 0) + ModuleBase_ITreeNode *theParent = nullptr) : PartSet_TreeNode(theParent), myObject(theObj) {} static std::string typeId() { @@ -57,36 +57,36 @@ public: return myType; } - virtual std::string type() const { return typeId(); } + std::string type() const override { return typeId(); } /// Returns the node representation according to theRole. - virtual QVariant data(int theColumn, int theRole) const; + QVariant data(int theColumn, int theRole) const override; /// Returns properties flag of the item - virtual Qt::ItemFlags flags(int theColumn) const; + Qt::ItemFlags flags(int theColumn) const override; /// Returns object referenced by the node (can be null) - virtual ObjectPtr object() const { return myObject; } + ObjectPtr object() const override { return myObject; } /// Sets an object to the node /// theObj a new object void setObject(ObjectPtr theObj) { myObject = theObj; } - virtual VisibilityState visibilityState() const; + VisibilityState visibilityState() const override; /// Updates sub-nodes of the node - virtual void update(); + void update() override; /// Process creation of objects. /// \param theObjects a list of created objects /// \return a list of nodes which corresponds to the created objects - virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects); + QTreeNodesList objectCreated(const QObjectPtrList &theObjects) override; /// Process deletion of objects. /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted - virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, - const QString &theGroup); + QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup) override; /// Returns number of sub-objects of the current object virtual int numberOfSubs() const; @@ -94,7 +94,7 @@ public: virtual ObjectPtr subObject(int theId) const; // Returns color of the Item when it is active - virtual QColor activeItemColor() const; + QColor activeItemColor() const override; protected: ObjectPtr myObject; @@ -122,38 +122,38 @@ public: return myType; } - virtual std::string type() const { return typeId(); } + std::string type() const override { return typeId(); } /// Returns the node representation according to theRole. - virtual QVariant data(int theColumn, int theRole) const; + QVariant data(int theColumn, int theRole) const override; /// Returns properties flag of the item - virtual Qt::ItemFlags flags(int theColumn) const; + Qt::ItemFlags flags(int theColumn) const override; /// Updates sub-nodes of the node - virtual void update(); + void update() override; /// Process creation of objects. /// \param theObjects a list of created objects /// \return a list of nodes which corresponds to the created objects - virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects); + QTreeNodesList objectCreated(const QObjectPtrList &theObjects) override; /// Process deletion of objects. /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted - virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, - const QString &theGroup); + QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup) override; QString name() const; /// Returns a node which belongs to the given document and contains objects of /// the given group \param theDoc a document \param theGroup a name of objects /// group \return a parent node if it is found - virtual ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc, - QString theGroup) { + ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc, + QString theGroup) override { if ((theDoc == document()) && (theGroup.toStdString() == groupName())) return this; - return 0; + return nullptr; } private: @@ -171,25 +171,25 @@ private: */ class PartSet_FeatureFolderNode : public PartSet_TreeNode { public: - PartSet_FeatureFolderNode(ModuleBase_ITreeNode *theParent = 0) + PartSet_FeatureFolderNode(ModuleBase_ITreeNode *theParent = nullptr) : PartSet_TreeNode(theParent) {} /// Process creation of objects. /// \param theObjects a list of created objects /// \return a list of nodes which corresponds to the created objects - virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects); + QTreeNodesList objectCreated(const QObjectPtrList &theObjects) override; /// Process deletion of objects. /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted - virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, - const QString &theGroup); + QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup) override; /// Returns a node which belongs to the given document and contains objects of /// the given group \param theDoc a document \param theGroup a name of objects /// group \return a parent node if it is found - virtual ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc, - QString theGroup); + ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc, + QString theGroup) override; protected: virtual ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj) = 0; @@ -211,29 +211,29 @@ public: return myType; } - virtual std::string type() const { return typeId(); } + std::string type() const override { return typeId(); } /// Updates sub-nodes of the node - virtual void update(); + void update() override; - virtual ModuleBase_IWorkshop *workshop() const { return myWorkshop; } + ModuleBase_IWorkshop *workshop() const override { return myWorkshop; } /// Returns document object of the sub-tree. - virtual DocumentPtr document() const; + DocumentPtr document() const override; void setWorkshop(ModuleBase_IWorkshop *theWork) { myWorkshop = theWork; } protected: - virtual ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj); + ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj) override; - virtual int numberOfFolders() const { return 3; } + int numberOfFolders() const override { return 3; } private: PartSet_FolderNode *myParamsFolder; PartSet_FolderNode *myConstrFolder; PartSet_FolderNode *myPartsFolder; - ModuleBase_IWorkshop *myWorkshop; + ModuleBase_IWorkshop *myWorkshop{0}; }; ///////////////////////////////////////////////////////////////////// @@ -251,40 +251,40 @@ public: return myType; } - virtual std::string type() const { return typeId(); } + std::string type() const override { return typeId(); } /// Returns object referenced by the node (can be null) - virtual ObjectPtr object() const { return myObject; } + ObjectPtr object() const override { return myObject; } /// Returns document object of the sub-tree. - virtual DocumentPtr document() const; + DocumentPtr document() const override; /// Updates sub-nodes of the node - virtual void update(); + void update() override; /// Returns the node representation according to theRole. - virtual QVariant data(int theColumn, int theRole) const; + QVariant data(int theColumn, int theRole) const override; /// Returns properties flag of the item - virtual Qt::ItemFlags flags(int theColumn) const; + Qt::ItemFlags flags(int theColumn) const override; /// Process creation of objects. /// \param theObjects a list of created objects /// \return a list of nodes which corresponds to the created objects - virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects); + QTreeNodesList objectCreated(const QObjectPtrList &theObjects) override; /// Process deletion of objects. /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted - virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, - const QString &theGroup); + QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup) override; protected: - virtual ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj); + ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj) override; - virtual int numberOfFolders() const; + int numberOfFolders() const override; - virtual void deleteChildren(); + void deleteChildren() override; private: PartSet_FolderNode *myParamsFolder; @@ -312,24 +312,24 @@ public: return myType; } - virtual std::string type() const { return typeId(); } + std::string type() const override { return typeId(); } /// Updates sub-nodes of the node - virtual void update(); + void update() override; /// Process creation of objects. /// \param theObjects a list of created objects /// \return a list of nodes which corresponds to the created objects - virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects); + QTreeNodesList objectCreated(const QObjectPtrList &theObjects) override; /// Process deletion of objects. /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted - virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, - const QString &theGroup); + QTreeNodesList objectsDeleted(const DocumentPtr &theDoc, + const QString &theGroup) override; /// Returns the node representation according to theRole. - virtual QVariant data(int theColumn, int theRole) const; + QVariant data(int theColumn, int theRole) const override; }; ///////////////////////////////////////////////////////////////////// @@ -347,12 +347,12 @@ public: return myType; } - virtual std::string type() const { return typeId(); } + std::string type() const override { return typeId(); } /// Returns the node representation according to theRole. - virtual QVariant data(int theColumn, int theRole) const; + QVariant data(int theColumn, int theRole) const override; - virtual VisibilityState visibilityState() const; + VisibilityState visibilityState() const override; }; #endif diff --git a/src/PartSet/PartSet_Validators.cpp b/src/PartSet/PartSet_Validators.cpp index 3a03222a6..29446b97d 100644 --- a/src/PartSet/PartSet_Validators.cpp +++ b/src/PartSet/PartSet_Validators.cpp @@ -89,7 +89,7 @@ int shapesNbEdges(const ModuleBase_ISelection *theSelection, const GeomShapePtr &aShape = aPrs->shape(); if (aShape.get() && !aShape->isNull()) { if (aShape->shapeType() == GeomAPI_Shape::EDGE) { - const TopoDS_Shape &aTDShape = aShape->impl(); + const auto &aTDShape = aShape->impl(); TopoDS_Edge aEdge = TopoDS::Edge(aTDShape); Standard_Real aStart, aEnd; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aEdge, aStart, aEnd); @@ -105,7 +105,7 @@ int shapesNbEdges(const ModuleBase_ISelection *theSelection, std::shared_ptr sketcherPlane(ModuleBase_Operation *theOperation) { std::shared_ptr aEmptyPln; if (theOperation) { - ModuleBase_OperationFeature *aFeatureOp = + auto *aFeatureOp = dynamic_cast(theOperation); if (aFeatureOp) { CompositeFeaturePtr aFeature = @@ -119,8 +119,7 @@ std::shared_ptr sketcherPlane(ModuleBase_Operation *theOperation) { } bool isEmptySelectionValid(ModuleBase_Operation *theOperation) { - ModuleBase_OperationFeature *aFeatureOp = - dynamic_cast(theOperation); + auto *aFeatureOp = dynamic_cast(theOperation); // during the create operation empty selection is always valid if (!aFeatureOp->isEditOperation()) { return true; @@ -409,7 +408,7 @@ std::string PartSet_DifferentObjectsValidator::errorMessage( bool PartSet_DifferentObjectsValidator::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); @@ -428,8 +427,7 @@ bool PartSet_DifferentObjectsValidator::isValid( anAttrs = aFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); if (anAttrs.size() > 0) { - std::list>::iterator anAttrIter = - anAttrs.begin(); + auto anAttrIter = anAttrs.begin(); for (; anAttrIter != anAttrs.end(); anAttrIter++) { if ((*anAttrIter).get() && (*anAttrIter)->id() != theAttribute->id()) { std::shared_ptr aRef = @@ -470,15 +468,14 @@ bool PartSet_DifferentObjectsValidator::isValid( anAttrs = aFeature->data()->attributes(ModelAPI_AttributeSelection::typeId()); if (anAttrs.size() > 0) { - std::list>::iterator anAttr = - anAttrs.begin(); + auto anAttr = anAttrs.begin(); for (; anAttr != anAttrs.end(); anAttr++) { if ((*anAttr).get() && (*anAttr)->id() != theAttribute->id()) { std::shared_ptr aRef = std::dynamic_pointer_cast(*anAttr); // check the object is already presented if (aRef->context() == aContext) { - bool aHasShape = aShape.get() != NULL; + bool aHasShape = aShape.get() != nullptr; if (!aHasShape || aRef->value()->isEqual(aShape)) { theError = errorMessage(EqualShapes, "", theAttribute->id(), aRef->id()); @@ -519,8 +516,7 @@ bool PartSet_DifferentObjectsValidator::isValid( anAttrs = aFeature->data()->attributes(ModelAPI_AttributeReference::typeId()); if (anAttrs.size() > 0) { - std::list>::iterator anAttr = - anAttrs.begin(); + auto anAttr = anAttrs.begin(); for (; anAttr != anAttrs.end(); anAttr++) { if ((*anAttr).get() && (*anAttr)->id() != theAttribute->id()) { std::shared_ptr aRef = @@ -546,8 +542,7 @@ bool PartSet_DifferentObjectsValidator::isValid( anAttrs = aFeature->data()->attributes(ModelAPI_AttributeSelectionList::typeId()); if (anAttrs.size() > 0) { - std::list>::iterator anAttrItr = - anAttrs.begin(); + auto anAttrItr = anAttrs.begin(); for (; anAttrItr != anAttrs.end(); anAttrItr++) { if ((*anAttrItr).get() && (*anAttrItr)->id() != theAttribute->id()) { std::shared_ptr aRefSelList = @@ -584,8 +579,8 @@ bool PartSet_DifferentObjectsValidator::isValid( return false; } if (aCurSelContext == aRefSelContext) { - if (aCurSel->value().get() == NULL || - aRefSel->value().get() == NULL) { + if (aCurSel->value().get() == nullptr || + aRefSel->value().get() == nullptr) { theError = errorMessage(EmptyShapes, "", theAttribute->id(), aRefSel->id()); return false; @@ -630,8 +625,7 @@ bool PartSet_DifferentObjectsValidator::isValid( std::dynamic_pointer_cast(theAttribute); anAttrs = aFeature->data()->attributes(ModelAPI_AttributeRefList::typeId()); if (anAttrs.size() > 0) { - std::list>::iterator anAttrItr = - anAttrs.begin(); + auto anAttrItr = anAttrs.begin(); for (; anAttrItr != anAttrs.end(); anAttrItr++) { if ((*anAttrItr).get() && (*anAttrItr)->id() != theAttribute->id()) { std::shared_ptr aRefSelList = @@ -660,7 +654,7 @@ bool PartSet_DifferentObjectsValidator::isValid( bool PartSet_DifferentPointsValidator::isValid( const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const { + Events_InfoMessage & /*theError*/) const { FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); diff --git a/src/PartSet/PartSet_Validators.h b/src/PartSet/PartSet_Validators.h index 994145c9b..0365ca52e 100644 --- a/src/PartSet/PartSet_Validators.h +++ b/src/PartSet/PartSet_Validators.h @@ -37,56 +37,63 @@ class GeomDataAPI_Point2D; //! A class to validate a selection for Distance constraint operation class PartSet_DistanceSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Length constraint operation class PartSet_LengthSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Perpendicular constraint operation class PartSet_PerpendicularSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Parallel constraint operation class PartSet_ParallelSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Radius constraint operation class PartSet_RadiusSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Rigid constraint operation class PartSet_RigidSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for coincedence constraint operation class PartSet_CoincidentSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators @@ -94,88 +101,99 @@ public: //! operation class PartSet_HVDirSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Tangential constraints operation class PartSet_TangentSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Fillet constraints operation class PartSet_FilletSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Angle constraints operation class PartSet_AngleSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Equal constraints operation class PartSet_EqualSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Collinear constraints operation class PartSet_CollinearSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Middle point constraints operation class PartSet_MiddlePointSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Middle point constraints operation class PartSet_MultyTranslationSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Middle point constraints operation class PartSet_SplitSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for Middle point constraints operation class PartSet_ProjectionSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; //! \ingroup Validators //! A class to validate a selection for intersection operation class PartSet_IntersectionSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection, - ModuleBase_Operation *theOperation) const; + PARTSET_EXPORT bool + isValid(const ModuleBase_ISelection *theSelection, + ModuleBase_Operation *theOperation) const override; }; ////////////// Attribute validators //////////////// @@ -194,9 +212,9 @@ public: //! \param theAttribute an attribute //! \param theArguments a list of arguments (names of attributes to check) //! \param theError an output error string - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; private: //! Returns error message for the error type @@ -223,9 +241,9 @@ public: //! \param theAttribute an attribute //! \param theArguments a list of arguments (names of attributes to check) //! \param theError an output error string - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; private: //! Finds Point2D attribute by reference attribute. It might be: @@ -248,9 +266,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError an output error string - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/PartSet/PartSet_WidgetBSplinePoints.cpp b/src/PartSet/PartSet_WidgetBSplinePoints.cpp index 54de97a63..3fa0d7668 100644 --- a/src/PartSet/PartSet_WidgetBSplinePoints.cpp +++ b/src/PartSet/PartSet_WidgetBSplinePoints.cpp @@ -74,7 +74,7 @@ PartSet_WidgetBSplinePoints::PartSet_WidgetBSplinePoints( myValueIsCashed(false), myIsFeatureVisibleInCash(true), myXValueInCash(0), myYValueInCash(0), myPointIndex(0), myFinished(false) { myRefAttribute = theData->getProperty("reference_attribute"); - QVBoxLayout *aMainLayout = new QVBoxLayout(this); + auto *aMainLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aMainLayout); // the control should accept the focus, so the boolean flag is corrected to be @@ -94,7 +94,7 @@ PartSet_WidgetBSplinePoints::PartSet_WidgetBSplinePoints( // B-spline weights attribute myWeightsAttr = theData->getProperty("weights"); - QVBoxLayout *aLayout = new QVBoxLayout(myBox); + auto *aLayout = new QVBoxLayout(myBox); ModuleBase_Tools::adjustMargins(aLayout); myScrollArea = new QScrollArea(myBox); @@ -103,12 +103,12 @@ PartSet_WidgetBSplinePoints::PartSet_WidgetBSplinePoints( myScrollArea->setFrameStyle(QFrame::NoFrame); aLayout->addWidget(myScrollArea); - QWidget *aContainer = new QWidget(myScrollArea); - QVBoxLayout *aBoxLay = new QVBoxLayout(aContainer); + auto *aContainer = new QWidget(myScrollArea); + auto *aBoxLay = new QVBoxLayout(aContainer); aBoxLay->setContentsMargins(0, 0, 0, 0); myGroupBox = new QWidget(aContainer); - QGridLayout *aGroupLay = new QGridLayout(myGroupBox); + auto *aGroupLay = new QGridLayout(myGroupBox); ModuleBase_Tools::adjustMargins(aGroupLay); aGroupLay->setSpacing(4); aGroupLay->setColumnStretch(1, 1); @@ -127,14 +127,14 @@ PartSet_WidgetBSplinePoints::PartSet_WidgetBSplinePoints( void PartSet_WidgetBSplinePoints::createNextPoint() { storeCurentValue(); - QGridLayout *aGroupLay = dynamic_cast(myGroupBox->layout()); + auto *aGroupLay = dynamic_cast(myGroupBox->layout()); int row = (int)myXSpin.size(); QString aPoleStr = translate("Pole %1"); aPoleStr = aPoleStr.arg(myXSpin.size() + 1); - QGroupBox *aPoleGroupBox = new QGroupBox(aPoleStr, myGroupBox); - QGridLayout *aPoleLay = new QGridLayout(aPoleGroupBox); + auto *aPoleGroupBox = new QGroupBox(aPoleStr, myGroupBox); + auto *aPoleLay = new QGridLayout(aPoleGroupBox); ModuleBase_Tools::adjustMargins(aPoleLay); aPoleLay->setSpacing(2); aPoleLay->setColumnStretch(1, 1); @@ -149,7 +149,7 @@ void PartSet_WidgetBSplinePoints::createNextPoint() { } void PartSet_WidgetBSplinePoints::removeLastPoint() { - QGridLayout *aGroupLay = dynamic_cast(myGroupBox->layout()); + auto *aGroupLay = dynamic_cast(myGroupBox->layout()); QWidget *aXSpin = myXSpin.back(); QWidget *aYSpin = myYSpin.back(); QWidget *aBox = myXSpin.back()->parentWidget(); @@ -168,8 +168,7 @@ void PartSet_WidgetBSplinePoints::removeLastPoint() { bool PartSet_WidgetBSplinePoints::isValidSelectionCustom( const ModuleBase_ViewerPrsPtr &theValue) { - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); if (aModule->sketchReentranceMgr()->isInternalEditActive()) return true; // when internal edit is started a new feature is created. I // has not results, AIS @@ -235,7 +234,7 @@ bool PartSet_WidgetBSplinePoints::setSelectionCustom( GeomShapePtr aShape = theValue->shape(); if (aShape.get() && !aShape->isNull()) { Handle(V3d_View) aView = myWorkshop->viewer()->activeView(); - const TopoDS_Shape &aTDShape = aShape->impl(); + const auto &aTDShape = aShape->impl(); GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aTDShape, mySketch); if (aPnt) { fillRefAttribute(aPnt, theValue); @@ -250,9 +249,8 @@ bool PartSet_WidgetBSplinePoints::setSelectionCustom( static void fillLabels(std::vector &theLabels, const double theValue) { - for (std::vector::iterator anIt = theLabels.begin(); - anIt != theLabels.end(); ++anIt) - (*anIt)->setValue(theValue); + for (auto &theLabel : theLabels) + theLabel->setValue(theValue); } bool PartSet_WidgetBSplinePoints::resetCustom() { @@ -304,8 +302,8 @@ void PartSet_WidgetBSplinePoints::storePolesAndWeights() const { aPointArray->setSize(aSize); aWeightsArray->setSize(aSize); - std::vector::const_iterator aXIt = myXSpin.begin(); - std::vector::const_iterator aYIt = myYSpin.begin(); + auto aXIt = myXSpin.begin(); + auto aYIt = myYSpin.begin(); for (int anIndex = 0; aXIt != myXSpin.end() && aYIt != myYSpin.end(); ++anIndex, ++aXIt, ++aYIt) aPointArray->setPnt(anIndex, (*aXIt)->value(), (*aYIt)->value()); @@ -324,7 +322,7 @@ bool PartSet_WidgetBSplinePoints::storeValueCustom() { aData->attribute(attributeID())); AttributeDoubleArrayPtr aWeightsArray = aData->realArray(myWeightsAttr); - PartSet_WidgetBSplinePoints *that = (PartSet_WidgetBSplinePoints *)this; + auto *that = (PartSet_WidgetBSplinePoints *)this; bool isBlocked = that->blockSignals(true); bool isImmutable = aPointArray->setImmutable(true); @@ -365,8 +363,8 @@ bool PartSet_WidgetBSplinePoints::restoreValueCustom() { while ((int)myXSpin.size() < aPointArray->size()) createNextPoint(); - std::vector::iterator aXIt = myXSpin.begin(); - std::vector::iterator aYIt = myYSpin.begin(); + auto aXIt = myXSpin.begin(); + auto aYIt = myYSpin.begin(); for (int anIndex = 0; aXIt != myXSpin.end() && aYIt != myYSpin.end(); ++anIndex, ++aXIt, ++aYIt) { GeomPnt2dPtr aPoint = aPointArray->pnt(anIndex); @@ -388,10 +386,8 @@ static void storeArray(const std::vector &theLabels, std::vector &theValues) { theValues.clear(); theValues.reserve(theLabels.size()); - for (std::vector::const_iterator anIt = - theLabels.begin(); - anIt != theLabels.end(); ++anIt) - theValues.push_back((*anIt)->value()); + for (auto theLabel : theLabels) + theValues.push_back(theLabel->value()); } void PartSet_WidgetBSplinePoints::storeCurentValue() { @@ -405,8 +401,8 @@ void PartSet_WidgetBSplinePoints::storeCurentValue() { static void restoreArray(std::vector &theCacheValues, std::vector &theLabels) { - std::vector::iterator aCIt = theCacheValues.begin(); - std::vector::iterator anIt = theLabels.begin(); + auto aCIt = theCacheValues.begin(); + auto anIt = theLabels.begin(); for (; anIt != theLabels.end(); ++anIt) { if (aCIt != theCacheValues.end()) (*anIt)->setValue(*aCIt++); @@ -550,8 +546,7 @@ void PartSet_WidgetBSplinePoints::mouseReleased( void PartSet_WidgetBSplinePoints::mouseMoved(ModuleBase_IViewWindow *theWindow, QMouseEvent *theEvent) { - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); if (myFinished || isEditingMode() || aModule->sketchReentranceMgr()->isInternalEditActive()) diff --git a/src/PartSet/PartSet_WidgetBSplinePoints.h b/src/PartSet/PartSet_WidgetBSplinePoints.h index feff4861e..52ce43a79 100644 --- a/src/PartSet/PartSet_WidgetBSplinePoints.h +++ b/src/PartSet/PartSet_WidgetBSplinePoints.h @@ -56,18 +56,19 @@ public: ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); /// Destructor - virtual ~PartSet_WidgetBSplinePoints(); + ~PartSet_WidgetBSplinePoints() override; /// Fills given container with selection modes if the widget has it /// \param [out] theModuleSelectionModes module additional modes, -1 means all /// default modes \param theModes [out] a container of modes - virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes); + void selectionModes(int &theModuleSelectionModes, + QIntList &theModes) override; /// Checks if the selection presentation is valid in widget /// \param theValue a selected presentation in the view /// \return a boolean value - virtual bool - isValidSelectionCustom(const std::shared_ptr &theValue); + bool isValidSelectionCustom( + const std::shared_ptr &theValue) override; /// Checks all attribute validators returns valid. It tries on the given /// selection to current attribute by setting the value inside and calling @@ -85,10 +86,10 @@ public: /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// The methiod called when widget is deactivated - virtual void deactivate(); + void deactivate() override; /// \returns the sketch instance std::shared_ptr sketch() const { return mySketch; } @@ -105,7 +106,7 @@ public: bool setPoint(double theX, double theY); /// Returns true if the event is processed. - virtual bool processEscape(); + bool processEscape() override; /// Returns true if the attribute can be changed using the selected shapes in /// the viewer and creating a coincidence constraint to them. This control use @@ -115,22 +116,22 @@ public: /// Processing the mouse move event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - virtual void mouseMoved(ModuleBase_IViewWindow *theWindow, - QMouseEvent *theEvent); + void mouseMoved(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent) override; /// Processing the mouse release event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - virtual void mouseReleased(ModuleBase_IViewWindow *theWindow, - QMouseEvent *theEvent); + void mouseReleased(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent) override; protected: /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Restore value from attribute data to the widget's control - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// Store current value in cashed value void storeCurentValue(); @@ -141,7 +142,7 @@ protected: /// Fills the widget with default values /// \return true if the widget current value is reset - virtual bool resetCustom(); + bool resetCustom() override; private: /// Create labels for the next B-spline point diff --git a/src/PartSet/PartSet_WidgetEditor.cpp b/src/PartSet/PartSet_WidgetEditor.cpp index 66c6a5985..49a6dcf84 100644 --- a/src/PartSet/PartSet_WidgetEditor.cpp +++ b/src/PartSet/PartSet_WidgetEditor.cpp @@ -33,8 +33,7 @@ PartSet_WidgetEditor::PartSet_WidgetEditor(QWidget *theParent, : ModuleBase_WidgetEditor(theParent, theData), myWorkshop(theWorkshop) {} bool PartSet_WidgetEditor::focusTo() { - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); if (aModule->isMouseOverWindow() && !isEditingMode()) return ModuleBase_WidgetEditor::focusTo(); else { diff --git a/src/PartSet/PartSet_WidgetEditor.h b/src/PartSet/PartSet_WidgetEditor.h index 9fb0c7d86..18ee1bdae 100644 --- a/src/PartSet/PartSet_WidgetEditor.h +++ b/src/PartSet/PartSet_WidgetEditor.h @@ -43,12 +43,12 @@ public: PartSet_WidgetEditor(QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); - virtual ~PartSet_WidgetEditor() {} + ~PartSet_WidgetEditor() override = default; /// Activates the editor control only in case if the mouse over the OCC /// window, otherwise set focus to the usual double value control \return the /// state whether the widget can accept the focus - virtual bool focusTo(); + bool focusTo() override; private: ModuleBase_IWorkshop *myWorkshop; // the current workshop diff --git a/src/PartSet/PartSet_WidgetFeaturePointSelector.h b/src/PartSet/PartSet_WidgetFeaturePointSelector.h index 504fd4d18..4ee24c42a 100644 --- a/src/PartSet/PartSet_WidgetFeaturePointSelector.h +++ b/src/PartSet/PartSet_WidgetFeaturePointSelector.h @@ -68,7 +68,7 @@ public: ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); - virtual ~PartSet_WidgetFeaturePointSelector(); + ~PartSet_WidgetFeaturePointSelector() override; /// Checks all widget validator if the owner is valid. Firstly it checks /// custom widget validating, next, the attribute's validating. It trying on @@ -76,8 +76,8 @@ public: /// calling validators. After this, the previous attribute value is /// restored.The valid/invalid value is cashed. \param theValue a selected /// presentation in the view \return a boolean value - virtual bool - isValidSelection(const std::shared_ptr &theValue); + bool isValidSelection( + const std::shared_ptr &theValue) override; /// Set sketcher /// \param theSketch a sketcher object @@ -87,46 +87,45 @@ public: CompositeFeaturePtr sketch() const { return mySketch; } /// The methiod called when widget is deactivated - virtual void deactivate(); + void deactivate() override; /// Processing the mouse move event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - virtual void mouseMoved(ModuleBase_IViewWindow *theWindow, - QMouseEvent *theEvent); + void mouseMoved(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent) override; /// Processing the mouse release event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - virtual void mouseReleased(ModuleBase_IViewWindow *theWindow, - QMouseEvent *theEvent); + void mouseReleased(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent) override; /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - virtual bool setSelectionCustom(const ModuleBase_ViewerPrsPtr &thePrs); + bool setSelectionCustom(const ModuleBase_ViewerPrsPtr &thePrs) override; /// Fill preselection used in mouseReleased - virtual void setPreSelection(const ModuleBase_ViewerPrsPtr &thePreSelected, - ModuleBase_IViewWindow *theWnd, - QMouseEvent *theEvent); + void setPreSelection(const ModuleBase_ViewerPrsPtr &thePreSelected, + ModuleBase_IViewWindow *theWnd, + QMouseEvent *theEvent) override; protected: /// Return the attribute values wrapped in a list of viewer presentations /// \return a list of viewer presentations, which contains an attribute result /// and a shape. If the attribute do not uses the shape, it is empty - virtual QList> - getAttributeSelection() const; + QList> + getAttributeSelection() const override; /// The methiod called when widget is activated - virtual void activateCustom(); + void activateCustom() override; /// Return an object and geom shape by the viewer presentation /// \param thePrs a selection /// \param theObject an output object /// \param theShape a shape of the selection - virtual void - getGeomSelection(const std::shared_ptr &thePrs, - ObjectPtr &theObject, GeomShapePtr &theShape); + void getGeomSelection(const std::shared_ptr &thePrs, + ObjectPtr &theObject, GeomShapePtr &theShape) override; /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different @@ -134,7 +133,7 @@ protected: /// \param theAttribute an attribute /// \param theValid a boolean flag, if restore happens for valid parameters void restoreAttributeValue(const AttributePtr &theAttribute, - const bool theValid); + const bool theValid) override; protected: bool fillFeature(); diff --git a/src/PartSet/PartSet_WidgetFileSelector.h b/src/PartSet/PartSet_WidgetFileSelector.h index cad7690c5..3729ed9b5 100644 --- a/src/PartSet/PartSet_WidgetFileSelector.h +++ b/src/PartSet/PartSet_WidgetFileSelector.h @@ -45,14 +45,14 @@ public: ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); - virtual ~PartSet_WidgetFileSelector() {} + ~PartSet_WidgetFileSelector() override = default; protected: /// Reimplemented from ModuleBase_WidgetFileSelector::storeValueCustom() - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Reimplemented from ModuleBase_WidgetFileSelector::restoreValue() - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// Returns a full format string for the short format QString shortFormatToFullFormat(const QString &theShortFormat) const; diff --git a/src/PartSet/PartSet_WidgetMultiSelector.cpp b/src/PartSet/PartSet_WidgetMultiSelector.cpp index 496e108b5..0821392ef 100644 --- a/src/PartSet/PartSet_WidgetMultiSelector.cpp +++ b/src/PartSet/PartSet_WidgetMultiSelector.cpp @@ -94,7 +94,7 @@ void PartSet_WidgetMultiSelector::getGeomSelection( // there is no a sketch feature is selected, but the shape exists, try to // create an exernal object // TODO: unite with the same functionality in PartSet_WidgetShapeSelector - if (aSPFeature.get() == NULL) { + if (aSPFeature.get() == nullptr) { ObjectPtr anExternalObject = ObjectPtr(); GeomShapePtr anExternalShape = GeomShapePtr(); if (myExternalObjectMgr->useExternal()) { @@ -105,7 +105,7 @@ void PartSet_WidgetMultiSelector::getGeomSelection( if (aResult.get()) aShape = aResult->shape(); } - if (aShape.get() != NULL && !aShape->isNull()) + if (aShape.get() != nullptr && !aShape->isNull()) anExternalObject = myExternalObjectMgr->externalObject( theObject, aShape, sketch(), myIsInValidate); } else { diff --git a/src/PartSet/PartSet_WidgetMultiSelector.h b/src/PartSet/PartSet_WidgetMultiSelector.h index 1f7adf5fb..f502cb795 100644 --- a/src/PartSet/PartSet_WidgetMultiSelector.h +++ b/src/PartSet/PartSet_WidgetMultiSelector.h @@ -48,10 +48,10 @@ public: ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); - virtual ~PartSet_WidgetMultiSelector(); + ~PartSet_WidgetMultiSelector() override; /// Defines if it is supposed that the widget should interact with the viewer. - virtual bool isViewerSelector() { return true; } + bool isViewerSelector() override { return true; } /// Set sketcher /// \param theSketch a sketcher object @@ -64,24 +64,23 @@ protected: /// Checks the widget validity. By default, it returns true. /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool - isValidSelectionCustom(const std::shared_ptr &thePrs); + bool isValidSelectionCustom( + const std::shared_ptr &thePrs) override; /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theAttribute an attribute /// \param theValid a boolean flag, if restore happens for valid parameters - virtual void restoreAttributeValue(const AttributePtr &theAttribute, - const bool theValid); + void restoreAttributeValue(const AttributePtr &theAttribute, + const bool theValid) override; /// Return an object and geom shape by the viewer presentation /// \param thePrs a selection /// \param theObject an output object /// \param theShape a shape of the selection - virtual void - getGeomSelection(const std::shared_ptr &thePrs, - ObjectPtr &theObject, GeomShapePtr &theShape); + void getGeomSelection(const std::shared_ptr &thePrs, + ObjectPtr &theObject, GeomShapePtr &theShape) override; protected: /// Manager of external objects diff --git a/src/PartSet/PartSet_WidgetPoint2DFlyout.cpp b/src/PartSet/PartSet_WidgetPoint2DFlyout.cpp index 71e26bc3f..b49f3b7ce 100644 --- a/src/PartSet/PartSet_WidgetPoint2DFlyout.cpp +++ b/src/PartSet/PartSet_WidgetPoint2DFlyout.cpp @@ -48,7 +48,7 @@ bool PartSet_WidgetPoint2DFlyout::setSelection( } bool PartSet_WidgetPoint2DFlyout::isValidSelectionCustom( - const std::shared_ptr &theValue) { + const std::shared_ptr & /*theValue*/) { return false; } @@ -66,7 +66,6 @@ bool PartSet_WidgetPoint2DFlyout::focusTo() { } XGUI_Workshop *PartSet_WidgetPoint2DFlyout::workshop() const { - XGUI_ModuleConnector *aConnector = - dynamic_cast(myWorkshop); + auto *aConnector = dynamic_cast(myWorkshop); return aConnector->workshop(); } diff --git a/src/PartSet/PartSet_WidgetPoint2DFlyout.h b/src/PartSet/PartSet_WidgetPoint2DFlyout.h index 7467d2050..9422690a6 100644 --- a/src/PartSet/PartSet_WidgetPoint2DFlyout.h +++ b/src/PartSet/PartSet_WidgetPoint2DFlyout.h @@ -45,31 +45,31 @@ public: ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); /// Destructor - virtual ~PartSet_WidgetPoint2DFlyout(){}; + ~PartSet_WidgetPoint2DFlyout() override = default; + ; /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs /// \param theValues the wrapped widget values /// \param theToValidate a validation flag - virtual bool - setSelection(QList> &theValues, - const bool theToValidate); + bool setSelection(QList> &theValues, + const bool theToValidate) override; /// Checks if the selection presentation is valid in widget /// \param theValue a selected presentation in the view /// \return a boolean value - virtual bool - isValidSelectionCustom(const std::shared_ptr &theValue); + bool isValidSelectionCustom( + const std::shared_ptr &theValue) override; /// Activates the editor control only in case if the mouse over the OCC /// window, otherwise set focus to the usual double value control \return the /// state whether the widget can accept the focus - virtual bool focusTo(); + bool focusTo() override; /// Returns true if the attribute can be changed using the selected shapes in /// the viewer and creating a coincidence constraint to them. This control /// does not use them. - virtual bool useSelectedShapes() const; + bool useSelectedShapes() const override; private: //! Returns workshop diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index a13095ba1..eae8338fa 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -112,7 +112,7 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget *theParent, #endif theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); - QGridLayout *aGroupLay = new QGridLayout(myGroupBox); + auto *aGroupLay = new QGridLayout(myGroupBox); ModuleBase_Tools::adjustMargins(aGroupLay); aGroupLay->setSpacing(2); aGroupLay->setColumnStretch(1, 1); @@ -122,7 +122,7 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget *theParent, myYSpin = new ModuleBase_LabelValue(myGroupBox, tr("Y")); aGroupLay->addWidget(myYSpin, 1, 1); - QVBoxLayout *aLayout = new QVBoxLayout(this); + auto *aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); aLayout->addWidget(myGroupBox); setLayout(aLayout); @@ -135,8 +135,7 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget *theParent, bool PartSet_WidgetPoint2D::isValidSelectionCustom( const ModuleBase_ViewerPrsPtr &theValue) { - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); if (aModule->sketchReentranceMgr()->isInternalEditActive()) return true; /// when internal edit is started a new feature is created. I /// has not results, AIS @@ -177,8 +176,7 @@ bool PartSet_WidgetPoint2D::isValidSelectionCustom( aFoundPoint = shapeExploreHasVertex(anAISShape, aPoint, mySketch); /// analysis of results - std::list>::const_iterator aRIter = - aResults.cbegin(); + auto aRIter = aResults.cbegin(); for (; aRIter != aResults.cend() && !aFoundPoint; aRIter++) { ResultPtr aResult = *aRIter; if (aResult.get() && aResult->shape().get()) { @@ -228,7 +226,7 @@ bool PartSet_WidgetPoint2D::setSelectionCustom( GeomShapePtr aShape = theValue->shape(); if (aShape.get() && !aShape->isNull()) { Handle(V3d_View) aView = myWorkshop->viewer()->activeView(); - const TopoDS_Shape &aTDShape = aShape->impl(); + const auto &aTDShape = aShape->impl(); GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aTDShape, mySketch); if (aPnt) { fillRefAttribute(aPnt->x(), aPnt->y(), theValue); @@ -284,7 +282,7 @@ bool PartSet_WidgetPoint2D::setSelection( GeomShapePtr aShape = aValue->shape(); if (aShape.get() && !aShape->isNull()) { Handle(V3d_View) aView = myWorkshop->viewer()->activeView(); - const TopoDS_Shape &aTDShape = aShape->impl(); + const auto &aTDShape = aShape->impl(); GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aTDShape, mySketch); if (aPnt) { @@ -326,7 +324,7 @@ bool PartSet_WidgetPoint2D::storeValueCustom() { AttributePoint2DPtr aPoint = std::dynamic_pointer_cast( aData->attribute(attributeID())); - PartSet_WidgetPoint2D *that = (PartSet_WidgetPoint2D *)this; + auto *that = (PartSet_WidgetPoint2D *)this; bool isBlocked = that->blockSignals(true); bool isImmutable = aPoint->setImmutable(true); @@ -562,7 +560,7 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow *theWindow, if (aFirstValue.get()) { GeomShapePtr aShape = aFirstValue->shape(); if (aShape.get() && aShape->shapeType() == GeomAPI_Shape::VERTEX) { - const TopoDS_Shape &aTDShape = aShape->impl(); + const auto &aTDShape = aShape->impl(); GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aTDShape, mySketch); aX = aPnt->x(); aY = aPnt->y(); @@ -591,7 +589,7 @@ void PartSet_WidgetPoint2D::processSelection( FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(aObject); bool anExternal = false; std::shared_ptr aSPFeature; - if (aSelectedFeature.get() != NULL) + if (aSelectedFeature.get() != nullptr) aSPFeature = std::dynamic_pointer_cast(aSelectedFeature); @@ -740,8 +738,7 @@ void PartSet_WidgetPoint2D::getGeomSelection_( void PartSet_WidgetPoint2D::mouseMoved(ModuleBase_IViewWindow *theWindow, QMouseEvent *theEvent) { - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); if (isEditingMode() || aModule->sketchReentranceMgr()->isInternalEditActive()) return; @@ -764,8 +761,8 @@ double PartSet_WidgetPoint2D::x() const { return myXSpin->value(); } double PartSet_WidgetPoint2D::y() const { return myYSpin->value(); } -bool PartSet_WidgetPoint2D::isFeatureContainsPoint(const FeaturePtr &theFeature, - double theX, double theY) { +bool PartSet_WidgetPoint2D::isFeatureContainsPoint( + const FeaturePtr & /*theFeature*/, double theX, double theY) { bool aPointIsFound = false; if (feature()->getKind() != SketchPlugin_Line::ID()) @@ -777,7 +774,7 @@ bool PartSet_WidgetPoint2D::isFeatureContainsPoint(const FeaturePtr &theFeature, std::shared_ptr(new GeomAPI_Pnt2d(theX, theY)); std::list anAttributes = myFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); - std::list::iterator anIter = anAttributes.begin(); + auto anIter = anAttributes.begin(); for (; anIter != anAttributes.end() && !aPointIsFound; anIter++) { AttributePoint2DPtr aPoint2DAttribute = std::dynamic_pointer_cast(*anIter); @@ -813,9 +810,9 @@ bool PartSet_WidgetPoint2D::processEnter() { bool PartSet_WidgetPoint2D::useSelectedShapes() const { return true; } -bool PartSet_WidgetPoint2D::isOrphanPoint(const FeaturePtr &theFeature, - const CompositeFeaturePtr &theSketch, - double theX, double theY) { +bool PartSet_WidgetPoint2D::isOrphanPoint( + const FeaturePtr &theFeature, const CompositeFeaturePtr & /*theSketch*/, + double theX, double theY) { bool anOrphanPoint = false; if (theFeature.get()) { AttributePoint2DPtr aPointAttr; diff --git a/src/PartSet/PartSet_WidgetPoint2d.h b/src/PartSet/PartSet_WidgetPoint2d.h index 0176eb4d5..5c9f5f2af 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.h +++ b/src/PartSet/PartSet_WidgetPoint2d.h @@ -67,18 +67,19 @@ public: PartSet_WidgetPoint2D(QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); /// Destructor - virtual ~PartSet_WidgetPoint2D(); + ~PartSet_WidgetPoint2D() override; /// Fills given container with selection modes if the widget has it /// \param [out] theModuleSelectionModes module additional modes, -1 means all /// default modes \param theModes [out] a container of modes - virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes); + void selectionModes(int &theModuleSelectionModes, + QIntList &theModes) override; /// Checks if the selection presentation is valid in widget /// \param theValue a selected presentation in the view /// \return a boolean value - virtual bool - isValidSelectionCustom(const std::shared_ptr &theValue); + bool isValidSelectionCustom( + const std::shared_ptr &theValue) override; /// Checks all attribute validators returns valid. It tries on the given /// selection to current attribute by setting the value inside and calling @@ -98,9 +99,8 @@ public: /// This value should be processed in the widget according to the needs /// \param theValues the wrapped widget values /// \param theToValidate a validation flag - virtual bool - setSelection(QList> &theValues, - const bool theToValidate); + bool setSelection(QList> &theValues, + const bool theToValidate) override; /// Select the internal content if it can be selected. It is empty in the /// default realization @@ -108,12 +108,12 @@ public: /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; // bool initFromPrevious(ObjectPtr theObject); /// The methiod called when widget is deactivated - virtual void deactivate(); + void deactivate() override; /// \returns the sketch instance CompositeFeaturePtr sketch() const { return mySketch; } @@ -134,7 +134,7 @@ public: double y() const; /// Returns true if the event is processed. - virtual bool processEnter(); + bool processEnter() override; /// Returns true if the attribute can be changed using the selected shapes in /// the viewer and creating a coincidence constraint to them. This control use @@ -144,21 +144,22 @@ public: /// Processing the mouse move event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - virtual void mouseMoved(ModuleBase_IViewWindow *theWindow, - QMouseEvent *theEvent); + void mouseMoved(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent) override; /// Processing the mouse release event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - virtual void mouseReleased(ModuleBase_IViewWindow *theWindow, - QMouseEvent *theEvent); + void mouseReleased(ModuleBase_IViewWindow *theWindow, + QMouseEvent *theEvent) override; /// Fill preselection used in mouseReleased // virtual void setPreSelection(const std::shared_ptr& // thePreSelected); - virtual void + void setPreSelection(const std::shared_ptr &thePreSelected, - ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent); + ModuleBase_IViewWindow *theWnd, + QMouseEvent *theEvent) override; /// Return an object and geom shape by the viewer presentation /// \param thePrs a selection @@ -181,10 +182,10 @@ signals: protected: /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Restore value from attribute data to the widget's control - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// Store current value in cashed value void storeCurentValue(); @@ -195,13 +196,13 @@ protected: /// Fills the widget with default values /// \return true if the widget current value is reset - virtual bool resetCustom(); + bool resetCustom() override; /// The methiod called when widget is activated - virtual void activateCustom(); + void activateCustom() override; //! Switch On/Off highlighting of the widget - virtual void setHighlighted(bool isHighlighted); + void setHighlighted(bool isHighlighted) override; /// Returns true if the feature contains Point2D attribute with the same /// coordinates The attribute of the widget is not processed. \param @@ -220,7 +221,7 @@ protected: /// incorrect visualization in Sketch. E.g. by a line creation, the line /// should not be visualized immediatelly when the end point widget is /// activated. - virtual void initializeValueByActivate(); + void initializeValueByActivate() override; private: /// Creates constrains of the clicked point diff --git a/src/PartSet/PartSet_WidgetShapeSelector.h b/src/PartSet/PartSet_WidgetShapeSelector.h index db1cf597d..21e16a4e2 100644 --- a/src/PartSet/PartSet_WidgetShapeSelector.h +++ b/src/PartSet/PartSet_WidgetShapeSelector.h @@ -47,7 +47,7 @@ public: ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); - virtual ~PartSet_WidgetShapeSelector(); + ~PartSet_WidgetShapeSelector() override; /// Set sketcher /// \param theSketch a sketcher object @@ -59,23 +59,22 @@ public: /// Appends into container of workshop selection filters /// \param [out] theModuleSelectionFilters module additional modes, -1 means /// all default modes \param [out] theSelectionFilters selection filters - virtual void selectionFilters(QIntList &theModuleSelectionFilters, - SelectMgr_ListOfFilter &theSelectionFilters); + void selectionFilters(QIntList &theModuleSelectionFilters, + SelectMgr_ListOfFilter &theSelectionFilters) override; protected: /// Checks the widget validity. By default, it returns true. /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool - isValidSelectionCustom(const std::shared_ptr &thePrs); + bool isValidSelectionCustom( + const std::shared_ptr &thePrs) override; /// Return an object and geom shape by the viewer presentation /// \param thePrs a selection /// \param theObject an output object /// \param theShape a shape of the selection - virtual void - getGeomSelection(const std::shared_ptr &thePrs, - ObjectPtr &theObject, GeomShapePtr &theShape); + void getGeomSelection(const std::shared_ptr &thePrs, + ObjectPtr &theObject, GeomShapePtr &theShape) override; /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different @@ -83,7 +82,7 @@ protected: /// \param theAttribute an attribute /// \param theValid a boolean flag, if restore happens for valid parameters void restoreAttributeValue(const AttributePtr &theAttribute, - const bool theValid); + const bool theValid) override; protected: /// A reference to external objects manager diff --git a/src/PartSet/PartSet_WidgetSketchCreator.cpp b/src/PartSet/PartSet_WidgetSketchCreator.cpp index 3bda0345a..2ce623077 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.cpp +++ b/src/PartSet/PartSet_WidgetSketchCreator.cpp @@ -98,7 +98,7 @@ PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator( myAttributeListID = theData->getProperty("attribute_list_id"); // QFormLayout* aLayout = new QFormLayout(this); - QVBoxLayout *aLayout = new QVBoxLayout(this); + auto *aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); ModuleBase_Tools::adjustMargins(aLayout); @@ -108,13 +108,12 @@ PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator( // Size of the View control mySizeOfViewWidget = new QWidget(this); - QHBoxLayout *aSizeLayout = new QHBoxLayout(mySizeOfViewWidget); + auto *aSizeLayout = new QHBoxLayout(mySizeOfViewWidget); aSizeLayout->addWidget( new QLabel(tr("Size of the view"), mySizeOfViewWidget)); mySizeOfView = new QLineEdit(mySizeOfViewWidget); - QDoubleValidator *aValidator = - new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView); + auto *aValidator = new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView); aValidator->setLocale(ModuleBase_Tools::doubleLocale()); aValidator->setNotation(QDoubleValidator::StandardNotation); mySizeOfView->setValidator(aValidator); @@ -317,7 +316,7 @@ void PartSet_WidgetSketchCreator::setEditingMode(bool isEditing) { if (isEditing) { setVisibleSelectionControl(false); - ModuleBase_ModelWidget *anAttributeListWidget = 0; + ModuleBase_ModelWidget *anAttributeListWidget = nullptr; XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myModule->workshop()); XGUI_PropertyPanel *aPanel = aWorkshop->propertyPanel(); const QList &aWidgets = aPanel->modelWidgets(); @@ -471,7 +470,7 @@ void PartSet_WidgetSketchCreator::deactivate() { XGUI_Tools::workshop(myWorkshop)->viewer()->update(); } -void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation *theOp) { +void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation * /*theOp*/) { SessionPtr aMgr = ModelAPI_Session::get(); bool aIsOp = aMgr->isOperation(); if (aIsOp) { @@ -537,7 +536,7 @@ void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation *theOp) { XGUI_PropertyPanel *aPropertyPanel = aWorkshop->propertyPanel(); const QList &aWidgets = aPropertyPanel->modelWidgets(); - ModuleBase_ModelWidget *aListWidget = 0; + ModuleBase_ModelWidget *aListWidget = nullptr; foreach (ModuleBase_ModelWidget *aWidget, aWidgets) { if (aWidget->attributeID() == myAttributeListID) { aListWidget = aWidget; diff --git a/src/PartSet/PartSet_WidgetSketchCreator.h b/src/PartSet/PartSet_WidgetSketchCreator.h index bc614d550..42ebf5c2c 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.h +++ b/src/PartSet/PartSet_WidgetSketchCreator.h @@ -53,32 +53,31 @@ public: PartSet_WidgetSketchCreator(QWidget *theParent, PartSet_Module *theModule, const Config_WidgetAPI *theData); - virtual ~PartSet_WidgetSketchCreator(); + ~PartSet_WidgetSketchCreator() override; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// Set focus to the first control of the current widget. /// The focus policy of the control is checked. /// If the widget has the NonFocus focus policy, it is skipped. /// \return the state whether the widget can accept the focus - virtual bool focusTo(); + bool focusTo() override; /// The methiod called when widget is deactivated - virtual void deactivate(); + void deactivate() override; /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs /// \param theValues the wrapped selection values /// \param theToValidate a validation of the values flag - virtual bool - setSelection(QList> &theValues, - const bool theToValidate); + bool setSelection(QList> &theValues, + const bool theToValidate) override; /// Editing mode depends on mode of current operation. This value is defined /// by it. - virtual void setEditingMode(bool isEditing); + void setEditingMode(bool isEditing) override; /// Checks all widget validator if the owner is valid. Firstly it checks /// custom widget validating, next, the attribute's validating. It trying on @@ -87,12 +86,12 @@ public: /// restored.The valid/invalid value is cashed. /// \param theValue a selected presentation in the view /// \return a boolean value - virtual bool - isValidSelection(const std::shared_ptr &theValue); + bool isValidSelection( + const std::shared_ptr &theValue) override; /// Returns True in case if the widget contains useful information for /// inspection tool - virtual bool isInformative() const { return false; } + bool isInformative() const override { return false; } protected: /// If there is no operation in current session, start operation for modify @@ -102,19 +101,19 @@ protected: /// Checks whether the selection presentation contains preview planes /// \param theValue a selection information /// \return a boolean value - virtual bool - isValidSelectionCustom(const std::shared_ptr &theValue); + bool isValidSelectionCustom( + const std::shared_ptr &theValue) override; /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// Retunrs attribute, which should be validated. In default implementation, /// this is an attribute of ID /// \return an attribute - virtual AttributePtr attribute() const; + AttributePtr attribute() const override; /// Sets the selection control visible and set the current widget as active in /// property panel It leads to connect to onSelectionChanged slot @@ -127,15 +126,15 @@ protected: /// Retunrs a list of possible shape types /// \return a list of shapes - virtual QIntList shapeTypes() const; + QIntList shapeTypes() const override; /// Emits model changed info, updates the current control by selection change /// \param theDone a state whether the selection is set - void updateOnSelectionChanged(const bool theDone); + void updateOnSelectionChanged(const bool theDone) override; protected: /// Returns true if envent is processed. - virtual bool processSelection(); + bool processSelection() override; private: /// Returns true if the selection mode is active. This is when composition diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 671f9dbf8..bd7e9cd6f 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -95,7 +95,7 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel( const QMap &toShowConstraints) : ModuleBase_WidgetValidated(theParent, theWorkshop, theData), myOpenTransaction(false), myIsSelection(false) { - QVBoxLayout *aLayout = new QVBoxLayout(this); + auto *aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); myStackWidget = new QStackedWidget(this); @@ -103,17 +103,16 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel( aLayout->addWidget(myStackWidget); // Define label for plane selection - QWidget *aFirstWgt = new QWidget(this); + auto *aFirstWgt = new QWidget(this); // Size of the View control mySizeOfViewWidget = new QWidget(aFirstWgt); - QHBoxLayout *aSizeLayout = new QHBoxLayout(mySizeOfViewWidget); + auto *aSizeLayout = new QHBoxLayout(mySizeOfViewWidget); aSizeLayout->addWidget( new QLabel(tr("Size of the view"), mySizeOfViewWidget)); mySizeOfView = new QLineEdit(mySizeOfViewWidget); - QDoubleValidator *aValidator = - new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView); + auto *aValidator = new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView); aValidator->setLocale(ModuleBase_Tools::doubleLocale()); aValidator->setNotation(QDoubleValidator::StandardNotation); mySizeOfView->setValidator(aValidator); @@ -122,7 +121,7 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel( myPartSetMessage = new QDialog(this, Qt::ToolTip); myPartSetMessage->setModal(false); myPartSetMessage->setStyleSheet("background-color:lightyellow;"); - QVBoxLayout *aMsgLay = new QVBoxLayout(myPartSetMessage); + auto *aMsgLay = new QVBoxLayout(myPartSetMessage); QString aMsg = tr("The Sketch is created in PartSet.\n" "It will be necessary to create a Part in order to use " "this sketch for body creation"); @@ -138,7 +137,7 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel( mySizeMessage->hide(); QString aText = translate(theData->getProperty("title")); - QLabel *aLabel = new QLabel(aText, aFirstWgt); + auto *aLabel = new QLabel(aText, aFirstWgt); aLabel->setWordWrap(true); QString aTooltip = translate(theData->getProperty("tooltip")); aLabel->setToolTip(aTooltip); @@ -160,20 +159,19 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel( myStackWidget->addWidget(aFirstWgt); // Define widget for sketch manmagement - QWidget *aSecondWgt = new QWidget(this); + auto *aSecondWgt = new QWidget(this); aLayout = new QVBoxLayout(aSecondWgt); ModuleBase_Tools::zeroMargins(aLayout); - QGroupBox *aViewBox = new QGroupBox(tr("Sketcher plane"), this); - QGridLayout *aViewLayout = new QGridLayout(aViewBox); + auto *aViewBox = new QGroupBox(tr("Sketcher plane"), this); + auto *aViewLayout = new QGridLayout(aViewBox); myViewInverted = new QCheckBox(tr("Reversed"), aViewBox); aViewLayout->addWidget(myViewInverted, 0, 0); // Sketch plane visibility myViewVisible = new QCheckBox(tr("Visible"), aViewBox); - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); PartSet_PreviewSketchPlane *aPreviewPlane = aModule->sketchMgr()->previewSketchPlane(); if (aPreviewPlane->isPlaneCreated()) @@ -187,8 +185,8 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel( connect(myViewVisible, SIGNAL(toggled(bool)), this, SLOT(onShowViewPlane(bool))); - QPushButton *aSetViewBtn = new QPushButton(QIcon(":icons/plane_view.png"), - tr("Set plane view"), aViewBox); + auto *aSetViewBtn = new QPushButton(QIcon(":icons/plane_view.png"), + tr("Set plane view"), aViewBox); connect(aSetViewBtn, SIGNAL(clicked(bool)), this, SLOT(onSetPlaneView())); aViewLayout->addWidget(aSetViewBtn, 1, 0, 1, 2); @@ -203,7 +201,7 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel( anIt = aStates.begin(), aLast = aStates.end(); for (; anIt != aLast; anIt++) { - QCheckBox *aShowConstraints = new QCheckBox(anIt.value(), this); + auto *aShowConstraints = new QCheckBox(anIt.value(), this); connect(aShowConstraints, SIGNAL(toggled(bool)), this, SLOT(onShowConstraint(bool))); aLayout->addWidget(aShowConstraints); @@ -226,8 +224,7 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel( SIGNAL(autoConstraints(bool))); aLayout->addWidget(myAutoConstraints); - QPushButton *aPlaneBtn = - new QPushButton(tr("Change sketch plane"), aSecondWgt); + auto *aPlaneBtn = new QPushButton(tr("Change sketch plane"), aSecondWgt); connect(aPlaneBtn, SIGNAL(clicked(bool)), SLOT(onChangePlane())); aLayout->addWidget(aPlaneBtn); @@ -247,7 +244,7 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel( myPreviewPlanes = new PartSet_PreviewPlanes(); } -PartSet_WidgetSketchLabel::~PartSet_WidgetSketchLabel() {} +PartSet_WidgetSketchLabel::~PartSet_WidgetSketchLabel() = default; bool PartSet_WidgetSketchLabel::setSelection( QList &theValues, const bool theToValidate) { @@ -290,7 +287,7 @@ bool PartSet_WidgetSketchLabel::processSelection() { } void PartSet_WidgetSketchLabel::onShowConstraint(bool theOn) { - QCheckBox *aSenderCheckBox = qobject_cast(sender()); + auto *aSenderCheckBox = qobject_cast(sender()); QMap::const_iterator anIt = myShowConstraints.begin(), @@ -338,7 +335,7 @@ bool PartSet_WidgetSketchLabel::setSelectionInternal( // In order to make reselection possible, set empty object and shape should // be done setSelectionCustom(ModuleBase_ViewerPrsPtr( - new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), nullptr))); aDone = false; } else { // it removes the processed value from the parameters list @@ -354,7 +351,7 @@ bool PartSet_WidgetSketchLabel::setSelectionInternal( } void PartSet_WidgetSketchLabel::updateByPlaneSelected( - const ModuleBase_ViewerPrsPtr &thePrs) { + const ModuleBase_ViewerPrsPtr & /*thePrs*/) { // Nullify a temporary remembered plane if (myTmpPlane.get()) myTmpPlane.reset(); @@ -379,8 +376,7 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected( isSetSizeOfView = false; } } - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); if (aModule) { CompositeFeaturePtr aSketch = std::dynamic_pointer_cast(myFeature); @@ -541,7 +537,7 @@ bool PartSet_WidgetSketchLabel::fillSketchPlaneBySelection( std::shared_ptr aDir; if (aShape.get() && !aShape->isNull()) { - const TopoDS_Shape &aTDShape = aShape->impl(); + const auto &aTDShape = aShape->impl(); aDir = setSketchPlane(aTDShape); isOwnerSet = aDir.get(); } @@ -563,7 +559,7 @@ bool PartSet_WidgetSketchLabel::fillSketchPlaneBySelection( aShapePtr = aShape; } if (aShapePtr.get() && aShapePtr->isFace()) { - const TopoDS_Shape &aTDShape = aShapePtr->impl(); + const auto &aTDShape = aShapePtr->impl(); setSketchPlane(aTDShape); aSelAttr->setValue(aRes, aShapePtr); isOwnerSet = true; @@ -576,7 +572,7 @@ bool PartSet_WidgetSketchLabel::fillSketchPlaneBySelection( aSelShape = aSelAttr->contextFeature()->firstResult()->shape(); } if (aSelShape.get() && aSelShape->isPlanar()) { - const TopoDS_Shape &aTDShape = aSelShape->impl(); + const auto &aTDShape = aSelShape->impl(); setSketchPlane(aTDShape); isOwnerSet = true; } @@ -591,8 +587,7 @@ void PartSet_WidgetSketchLabel::activateCustom() { if (aTopWidget) aTopWidget->installEventFilter(this); - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); if (aModule) { bool isBlocked = myAutoConstraints->blockSignals(true); myAutoConstraints->setChecked( @@ -760,8 +755,7 @@ void PartSet_WidgetSketchLabel::onSetPlaneView() { if (myViewInverted->isChecked()) aDir.Reverse(); myWorkshop->viewer()->setViewProjection(aDir.X(), aDir.Y(), aDir.Z(), 0.); - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); if (aModule) aModule->onViewTransformed(); } @@ -813,8 +807,7 @@ PartSet_WidgetSketchLabel::findCircularEdgesInPlane() { //****************************************************** void PartSet_WidgetSketchLabel::onChangePlane() { - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); if (aModule) { mySizeOfViewWidget->setVisible(false); myRemoveExternal->setVisible(true); @@ -917,8 +910,7 @@ bool PartSet_WidgetSketchLabel::eventFilter(QObject *theObj, QEvent *theEvent) { } void PartSet_WidgetSketchLabel::onShowViewPlane(bool toShow) { - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); PartSet_PreviewSketchPlane *aPreviewPlane = aModule->sketchMgr()->previewSketchPlane(); if (toShow) { diff --git a/src/PartSet/PartSet_WidgetSketchLabel.h b/src/PartSet/PartSet_WidgetSketchLabel.h index e5291ea90..f0a5da392 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.h +++ b/src/PartSet/PartSet_WidgetSketchLabel.h @@ -68,7 +68,7 @@ public: const QMap &toShowConstraints); - virtual ~PartSet_WidgetSketchLabel(); + ~PartSet_WidgetSketchLabel() override; /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs @@ -76,38 +76,38 @@ public: /// preselection. It is redefined to do nothing if the plane of the sketch has /// been already set. \param theValues the wrapped selection values \param /// theToValidate a validation flag - virtual bool - setSelection(QList> &theValues, - const bool theToValidate); + bool setSelection(QList> &theValues, + const bool theToValidate) override; /// Fills given container with selection modes if the widget has it /// \param [out] theModuleSelectionModes module additional modes, -1 means all /// default modes \param theModes [out] a container of modes - virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes); + void selectionModes(int &theModuleSelectionModes, + QIntList &theModes) override; /// Using widget selection filter only if plane is not defined. /// \param [out] theModuleSelectionFilters module additional modes, -1 means /// all default modes \param [out] selection filters - virtual void selectionFilters(QIntList &theModuleSelectionFilters, - SelectMgr_ListOfFilter &theSelectionFilters); + void selectionFilters(QIntList &theModuleSelectionFilters, + SelectMgr_ListOfFilter &theSelectionFilters) override; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// The methiod called when widget is deactivated - virtual void deactivate(); + void deactivate() override; /// The method called if widget should be activated always - virtual bool needToBeActivated() { return true; } + bool needToBeActivated() override { return true; } /// Returns sketcher plane std::shared_ptr plane() const; /// This control accepts focus - virtual bool focusTo(); - virtual void setHighlighted(bool){/*do nothing*/}; - virtual void enableFocusProcessing(); + bool focusTo() override; + void setHighlighted(bool) override{/*do nothing*/}; + void enableFocusProcessing() override; /// Set current state of show free points /// \param theState a state of the corresponded check box @@ -119,7 +119,7 @@ public: /// If widgets has several panels then this method has to show a page which /// contains information for current feature. By default does nothing - virtual void showInformativePage() { + void showInformativePage() override { if (myStackWidget) myStackWidget->setCurrentIndex(1); } @@ -146,28 +146,28 @@ protected: /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theAttribute an attribute to be stored - virtual void storeAttributeValue(const AttributePtr &theAttribute); + void storeAttributeValue(const AttributePtr &theAttribute) override; /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different /// parameters of the current attribute /// \param theAttribute an attribute to be restored /// \param theValid a boolean flag, if restore happens for valid parameters - virtual void restoreAttributeValue(const AttributePtr &theAttribute, - const bool theValid); + void restoreAttributeValue(const AttributePtr &theAttribute, + const bool theValid) override; /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - virtual bool setSelectionCustom(const ModuleBase_ViewerPrsPtr &thePrs); + bool setSelectionCustom(const ModuleBase_ViewerPrsPtr &thePrs) override; /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom() { return true; } + bool storeValueCustom() override { return true; } - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// The methiod called when widget is activated - virtual void activateCustom(); + void activateCustom() override; /// Block the model flush of update and intialization of attribute /// In additional to curstom realization it blocks initialization for all @@ -179,13 +179,13 @@ protected: /// isAttributeSetInitializedBlocked out value if model is blocked in value if /// model is unblocked to be used to restore previous state when unblocked /// \param isAttributeSendUpdatedBlocked out value if model signal is blocked - virtual void blockAttribute(const AttributePtr &theAttribute, - const bool &theToBlock, bool &isFlushesActived, - bool &isAttributeSetInitializedBlocked, - bool &isAttributeSendUpdatedBlocked); + void blockAttribute(const AttributePtr &theAttribute, const bool &theToBlock, + bool &isFlushesActived, + bool &isAttributeSetInitializedBlocked, + bool &isAttributeSendUpdatedBlocked) override; /// Returns true if envent is processed. - virtual bool processSelection(); + bool processSelection() override; /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs @@ -206,13 +206,13 @@ protected: bool fillSketchPlaneBySelection(const ModuleBase_ViewerPrsPtr &thePrs); /// Redefinition of a virtual function - virtual void showEvent(QShowEvent *theEvent); + void showEvent(QShowEvent *theEvent) override; /// Redefinition of a virtual function - virtual void hideEvent(QHideEvent *theEvent); + void hideEvent(QHideEvent *theEvent) override; /// Redefinition of a virtual function - virtual bool eventFilter(QObject *theObj, QEvent *theEvent); + bool eventFilter(QObject *theObj, QEvent *theEvent) override; private slots: /// A slot called on set sketch plane view diff --git a/src/PartSetAPI/PartSetAPI_Part.cpp b/src/PartSetAPI/PartSetAPI_Part.cpp index f2cae3395..f702acaf0 100644 --- a/src/PartSetAPI/PartSetAPI_Part.cpp +++ b/src/PartSetAPI/PartSetAPI_Part.cpp @@ -34,7 +34,7 @@ PartSetAPI_Part::PartSetAPI_Part( initialize(); } -PartSetAPI_Part::~PartSetAPI_Part() {} +PartSetAPI_Part::~PartSetAPI_Part() = default; //-------------------------------------------------------------------------------------- std::shared_ptr PartSetAPI_Part::document() const { diff --git a/src/PartSetAPI/PartSetAPI_Part.h b/src/PartSetAPI/PartSetAPI_Part.h index 9bfdf8e2c..75e71a03c 100644 --- a/src/PartSetAPI/PartSetAPI_Part.h +++ b/src/PartSetAPI/PartSetAPI_Part.h @@ -42,7 +42,7 @@ public: explicit PartSetAPI_Part(const std::shared_ptr &theFeature); /// Destructor PARTSETAPI_EXPORT - virtual ~PartSetAPI_Part(); + ~PartSetAPI_Part() override; INTERFACE_0(PartSetPlugin_Part::ID()) @@ -52,7 +52,7 @@ public: /// Dump wrapped feature PARTSETAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; //! Pointer on Part object diff --git a/src/PartSetPlugin/PartSetPlugin_Duplicate.h b/src/PartSetPlugin/PartSetPlugin_Duplicate.h index 411c4dcc8..797963586 100644 --- a/src/PartSetPlugin/PartSetPlugin_Duplicate.h +++ b/src/PartSetPlugin/PartSetPlugin_Duplicate.h @@ -37,7 +37,7 @@ public: } // LCOV_EXCL_START /// Returns the kind of a feature - PARTSETPLUGIN_EXPORT virtual const std::string &getKind() { + PARTSETPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = PartSetPlugin_Duplicate::ID(); return MY_KIND; } @@ -51,16 +51,16 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes - PARTSETPLUGIN_EXPORT virtual void initAttributes() {} + PARTSETPLUGIN_EXPORT void initAttributes() override {} /// Not normal feature that stored in the tree - PARTSETPLUGIN_EXPORT virtual bool isAction() { return true; } + PARTSETPLUGIN_EXPORT bool isAction() override { return true; } /// Performs the "duplicate" - PARTSETPLUGIN_EXPORT virtual void execute(); + PARTSETPLUGIN_EXPORT void execute() override; /// Use plugin manager for features creation - PartSetPlugin_Duplicate() {} + PartSetPlugin_Duplicate() = default; }; #endif diff --git a/src/PartSetPlugin/PartSetPlugin_Part.cpp b/src/PartSetPlugin/PartSetPlugin_Part.cpp index e362482f6..684500ea7 100644 --- a/src/PartSetPlugin/PartSetPlugin_Part.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Part.cpp @@ -26,7 +26,7 @@ #include #include -PartSetPlugin_Part::PartSetPlugin_Part() {} +PartSetPlugin_Part::PartSetPlugin_Part() = default; void PartSetPlugin_Part::initAttributes() { // all is in part result } diff --git a/src/PartSetPlugin/PartSetPlugin_Plugin.h b/src/PartSetPlugin/PartSetPlugin_Plugin.h index 76b6e3a94..04a55340d 100644 --- a/src/PartSetPlugin/PartSetPlugin_Plugin.h +++ b/src/PartSetPlugin/PartSetPlugin_Plugin.h @@ -37,15 +37,15 @@ class PartSetPlugin_Plugin : public ModelAPI_Plugin, public Events_Listener { public: /// Creates the feature object of this plugin by the feature string ID - PARTSETPLUGIN_EXPORT virtual FeaturePtr - createFeature(std::string theFeatureID); + PARTSETPLUGIN_EXPORT FeaturePtr + createFeature(std::string theFeatureID) override; /// Is needed for python wrapping by swig PARTSETPLUGIN_EXPORT PartSetPlugin_Plugin(); //! Redefinition of Events_Listener method - PARTSETPLUGIN_EXPORT virtual void - processEvent(const std::shared_ptr &theMessage); + PARTSETPLUGIN_EXPORT void + processEvent(const std::shared_ptr &theMessage) override; //! Performs the chenges of enabled/disabled state in the toolbar //! due to the current state of the application. PARTSETPLUGIN_EXPORT std::shared_ptr diff --git a/src/PartSetPlugin/PartSetPlugin_Remove.h b/src/PartSetPlugin/PartSetPlugin_Remove.h index a39d43e6e..4b725b852 100644 --- a/src/PartSetPlugin/PartSetPlugin_Remove.h +++ b/src/PartSetPlugin/PartSetPlugin_Remove.h @@ -37,7 +37,7 @@ public: } // LCOV_EXCL_START /// Returns the kind of a feature - PARTSETPLUGIN_EXPORT virtual const std::string &getKind() { + PARTSETPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = PartSetPlugin_Remove::ID(); return MY_KIND; } @@ -50,17 +50,17 @@ public: /// Request for initialization of data model of the feature: adding all /// attributes - PARTSETPLUGIN_EXPORT virtual void initAttributes() {} + PARTSETPLUGIN_EXPORT void initAttributes() override {} // LCOV_EXCL_STOP /// Not normal feature that stored in the tree - PARTSETPLUGIN_EXPORT virtual bool isAction() { return true; } + PARTSETPLUGIN_EXPORT bool isAction() override { return true; } /// Performs the "remove" - PARTSETPLUGIN_EXPORT virtual void execute(); + PARTSETPLUGIN_EXPORT void execute() override; /// Use plugin manager for features creation - PartSetPlugin_Remove() {} + PartSetPlugin_Remove() = default; }; #endif diff --git a/src/PrimitivesAPI/PrimitivesAPI_Box.cpp b/src/PrimitivesAPI/PrimitivesAPI_Box.cpp index 8a5c7319f..ca8ade4d6 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Box.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Box.cpp @@ -71,7 +71,7 @@ PrimitivesAPI_Box::PrimitivesAPI_Box( } //================================================================================================== -PrimitivesAPI_Box::~PrimitivesAPI_Box() {} +PrimitivesAPI_Box::~PrimitivesAPI_Box() = default; //================================================================================================== void PrimitivesAPI_Box::setDimensions(const ModelHighAPI_Double &theDx, diff --git a/src/PrimitivesAPI/PrimitivesAPI_Box.h b/src/PrimitivesAPI/PrimitivesAPI_Box.h index f9751908f..0b9492525 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Box.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Box.h @@ -65,7 +65,7 @@ public: /// Destructor. PRIMITIVESAPI_EXPORT - virtual ~PrimitivesAPI_Box(); + ~PrimitivesAPI_Box() override; INTERFACE_12(PrimitivesPlugin_Box::ID(), creationMethod, PrimitivesPlugin_Box::CREATION_METHOD(), @@ -116,7 +116,7 @@ public: /// Dump wrapped feature PRIMITIVESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on primitive Box object diff --git a/src/PrimitivesAPI/PrimitivesAPI_Cone.cpp b/src/PrimitivesAPI/PrimitivesAPI_Cone.cpp index 56376e715..fa4a61166 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Cone.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Cone.cpp @@ -54,7 +54,7 @@ PrimitivesAPI_Cone::PrimitivesAPI_Cone( } //================================================================================================== -PrimitivesAPI_Cone::~PrimitivesAPI_Cone() {} +PrimitivesAPI_Cone::~PrimitivesAPI_Cone() = default; //================================================================================================== void PrimitivesAPI_Cone::setRadius(const ModelHighAPI_Double &theBaseRadius, diff --git a/src/PrimitivesAPI/PrimitivesAPI_Cone.h b/src/PrimitivesAPI/PrimitivesAPI_Cone.h index d8bc447a7..f8ad7c5f3 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Cone.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Cone.h @@ -57,7 +57,7 @@ public: /// Destructor. PRIMITIVESAPI_EXPORT - virtual ~PrimitivesAPI_Cone(); + ~PrimitivesAPI_Cone() override; INTERFACE_5(PrimitivesPlugin_Cone::ID(), basePoint, PrimitivesPlugin_Cone::BASE_POINT_ID(), @@ -81,7 +81,7 @@ public: /// Dump wrapped feature PRIMITIVESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on primitive Cone object diff --git a/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp b/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp index 796ccfb5d..091330c43 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp @@ -65,7 +65,7 @@ PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder( } //================================================================================================== -PrimitivesAPI_Cylinder::~PrimitivesAPI_Cylinder() {} +PrimitivesAPI_Cylinder::~PrimitivesAPI_Cylinder() = default; //================================================================================================== void PrimitivesAPI_Cylinder::setSizes(const ModelHighAPI_Double &theRadius, diff --git a/src/PrimitivesAPI/PrimitivesAPI_Cylinder.h b/src/PrimitivesAPI/PrimitivesAPI_Cylinder.h index 1e434ffb2..edf336965 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Cylinder.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Cylinder.h @@ -62,7 +62,7 @@ public: /// Destructor. PRIMITIVESAPI_EXPORT - virtual ~PrimitivesAPI_Cylinder(); + ~PrimitivesAPI_Cylinder() override; INTERFACE_6(PrimitivesPlugin_Cylinder::ID(), creationMethod, PrimitivesPlugin_Cylinder::CREATION_METHOD(), @@ -84,7 +84,7 @@ public: /// Dump wrapped feature PRIMITIVESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on primitive Cylinder object diff --git a/src/PrimitivesAPI/PrimitivesAPI_Sphere.cpp b/src/PrimitivesAPI/PrimitivesAPI_Sphere.cpp index e8f968bf6..c3f7c21be 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Sphere.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Sphere.cpp @@ -71,7 +71,7 @@ PrimitivesAPI_Sphere::PrimitivesAPI_Sphere( } //================================================================================================== -PrimitivesAPI_Sphere::~PrimitivesAPI_Sphere() {} +PrimitivesAPI_Sphere::~PrimitivesAPI_Sphere() = default; //================================================================================================== void PrimitivesAPI_Sphere::setCenterPoint( diff --git a/src/PrimitivesAPI/PrimitivesAPI_Sphere.h b/src/PrimitivesAPI/PrimitivesAPI_Sphere.h index 5c4d2b137..2b154d4df 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Sphere.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Sphere.h @@ -64,7 +64,7 @@ public: /// Destructor. PRIMITIVESAPI_EXPORT - virtual ~PrimitivesAPI_Sphere(); + ~PrimitivesAPI_Sphere() override; INTERFACE_9(PrimitivesPlugin_Sphere::ID(), creationMethod, PrimitivesPlugin_Sphere::CREATION_METHOD(), @@ -110,7 +110,7 @@ public: /// Dump wrapped feature PRIMITIVESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on primitive Sphere object diff --git a/src/PrimitivesAPI/PrimitivesAPI_Torus.cpp b/src/PrimitivesAPI/PrimitivesAPI_Torus.cpp index e0041a6bd..b4d49a1b4 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Torus.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Torus.cpp @@ -50,7 +50,7 @@ PrimitivesAPI_Torus::PrimitivesAPI_Torus( } //================================================================================================== -PrimitivesAPI_Torus::~PrimitivesAPI_Torus() {} +PrimitivesAPI_Torus::~PrimitivesAPI_Torus() = default; //================================================================================================== void PrimitivesAPI_Torus::setRadius(const ModelHighAPI_Double &theRadius, diff --git a/src/PrimitivesAPI/PrimitivesAPI_Torus.h b/src/PrimitivesAPI/PrimitivesAPI_Torus.h index a7c93667c..b195b5428 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Torus.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Torus.h @@ -56,7 +56,7 @@ public: /// Destructor. PRIMITIVESAPI_EXPORT - virtual ~PrimitivesAPI_Torus(); + ~PrimitivesAPI_Torus() override; INTERFACE_4(PrimitivesPlugin_Torus::ID(), basePoint, PrimitivesPlugin_Torus::BASE_POINT_ID(), @@ -75,7 +75,7 @@ public: /// Dump wrapped feature PRIMITIVESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on primitive Torus object diff --git a/src/PrimitivesAPI/PrimitivesAPI_Tube.cpp b/src/PrimitivesAPI/PrimitivesAPI_Tube.cpp index 4404b89ee..652fa35dd 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Tube.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Tube.cpp @@ -44,7 +44,7 @@ PrimitivesAPI_Tube::PrimitivesAPI_Tube( } //================================================================================================== -PrimitivesAPI_Tube::~PrimitivesAPI_Tube() {} +PrimitivesAPI_Tube::~PrimitivesAPI_Tube() = default; //================================================================================================== void PrimitivesAPI_Tube::setRadius(const ModelHighAPI_Double &theRMin, diff --git a/src/PrimitivesAPI/PrimitivesAPI_Tube.h b/src/PrimitivesAPI/PrimitivesAPI_Tube.h index eb161f93f..8a237da3c 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Tube.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Tube.h @@ -48,7 +48,7 @@ public: /// Destructor. PRIMITIVESAPI_EXPORT - virtual ~PrimitivesAPI_Tube(); + ~PrimitivesAPI_Tube() override; INTERFACE_3(PrimitivesPlugin_Tube::ID(), rmin, PrimitivesPlugin_Tube::RMIN_ID(), ModelAPI_AttributeDouble, @@ -68,7 +68,7 @@ public: /// Dump wrapped feature PRIMITIVESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on primitive Tube object diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp index deca244a7..1a14a41aa 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp @@ -34,7 +34,7 @@ //================================================================================================= PrimitivesPlugin_Box::PrimitivesPlugin_Box() // Nothing to do during // instantiation -{} + = default; //================================================================================================= void PrimitivesPlugin_Box::initAttributes() { @@ -129,7 +129,7 @@ void PrimitivesPlugin_Box::createBoxByTwoPoints() { std::shared_ptr aBoxAlgo; - if ((aRef1.get() != NULL) && (aRef2.get() != NULL)) { + if ((aRef1.get() != nullptr) && (aRef2.get() != nullptr)) { GeomShapePtr aShape1 = aRef1->value(); if (!aShape1.get()) // If we can't get the points directly, try getting them // from the context @@ -236,9 +236,7 @@ void PrimitivesPlugin_Box::loadNamingDS( // Insert to faces std::map> listOfFaces = theBoxAlgo->getCreatedFaces(); - for (std::map>::iterator it = - listOfFaces.begin(); - it != listOfFaces.end(); ++it) { - theResultBox->generated((*it).second, (*it).first); + for (auto &listOfFace : listOfFaces) { + theResultBox->generated(listOfFace.second, listOfFace.first); } } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Box.h b/src/PrimitivesPlugin/PrimitivesPlugin_Box.h index a6cc1ffde..0c7ac3111 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Box.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Box.h @@ -136,17 +136,17 @@ public: } /// Returns the kind of a feature - PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() { + PRIMITIVESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = PrimitivesPlugin_Box::ID(); return MY_KIND; } /// Creates a new part document if needed - PRIMITIVESPLUGIN_EXPORT virtual void execute(); + PRIMITIVESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - PRIMITIVESPLUGIN_EXPORT virtual void initAttributes(); + PRIMITIVESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation PrimitivesPlugin_Box(); diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp index 5353a2fdc..d8b7761ad 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp @@ -40,7 +40,7 @@ #include //================================================================================================= -PrimitivesPlugin_Cone::PrimitivesPlugin_Cone() {} +PrimitivesPlugin_Cone::PrimitivesPlugin_Cone() = default; //================================================================================================= void PrimitivesPlugin_Cone::initAttributes() { @@ -92,7 +92,7 @@ void PrimitivesPlugin_Cone::execute() { std::shared_ptr aBasePoint; std::shared_ptr aPointRef = selection(PrimitivesPlugin_Cone::BASE_POINT_ID()); - if (aPointRef.get() != NULL) { + if (aPointRef.get() != nullptr) { GeomShapePtr aShape1 = aPointRef->value(); if (!aShape1.get()) { aShape1 = aPointRef->context()->shape(); @@ -184,10 +184,8 @@ void PrimitivesPlugin_Cone::loadNamingDS( std::map> listOfFaces = theConeAlgo->getCreatedFaces(); int nbFaces = 0; - for (std::map>::iterator it = - listOfFaces.begin(); - it != listOfFaces.end(); ++it) { - theResultCone->generated((*it).second, (*it).first); + for (auto &listOfFace : listOfFaces) { + theResultCone->generated(listOfFace.second, listOfFace.first); nbFaces++; } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Cone.h b/src/PrimitivesPlugin/PrimitivesPlugin_Cone.h index 7d58ced26..279c35c70 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Cone.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Cone.h @@ -74,17 +74,17 @@ public: } /// Returns the kind of a feature - PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() { + PRIMITIVESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = PrimitivesPlugin_Cone::ID(); return MY_KIND; } /// Creates a new part document if needed - PRIMITIVESPLUGIN_EXPORT virtual void execute(); + PRIMITIVESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - PRIMITIVESPLUGIN_EXPORT virtual void initAttributes(); + PRIMITIVESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation PrimitivesPlugin_Cone(); diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp index 0bf607698..44f56bbd6 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp @@ -35,7 +35,7 @@ #include //================================================================================================= -PrimitivesPlugin_Cylinder::PrimitivesPlugin_Cylinder() {} +PrimitivesPlugin_Cylinder::PrimitivesPlugin_Cylinder() = default; //================================================================================================= void PrimitivesPlugin_Cylinder::initAttributes() { @@ -103,7 +103,7 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle) { std::shared_ptr aBasePoint; std::shared_ptr aPointRef = selection(PrimitivesPlugin_Cylinder::BASE_POINT_ID()); - if (aPointRef.get() != NULL) { + if (aPointRef.get() != nullptr) { GeomShapePtr aShape1 = aPointRef->value(); if (!aShape1.get()) { aShape1 = aPointRef->context()->shape(); @@ -204,9 +204,7 @@ void PrimitivesPlugin_Cylinder::loadNamingDS( // Insert to faces std::map> listOfFaces = theCylinderAlgo->getCreatedFaces(); - for (std::map>::iterator it = - listOfFaces.begin(); - it != listOfFaces.end(); ++it) { - theResultCylinder->generated((*it).second, (*it).first); + for (auto &listOfFace : listOfFaces) { + theResultCylinder->generated(listOfFace.second, listOfFace.first); } } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.h b/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.h index 12af199ab..9468194b5 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.h @@ -92,17 +92,17 @@ public: } /// Returns the kind of a feature - PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() { + PRIMITIVESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = PrimitivesPlugin_Cylinder::ID(); return MY_KIND; } /// Creates a new part document if needed - PRIMITIVESPLUGIN_EXPORT virtual void execute(); + PRIMITIVESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - PRIMITIVESPLUGIN_EXPORT virtual void initAttributes(); + PRIMITIVESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation PrimitivesPlugin_Cylinder(); diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.h b/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.h index b8099bfa1..0a37b8555 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.h @@ -32,7 +32,7 @@ class PRIMITIVESPLUGIN_EXPORT PrimitivesPlugin_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - virtual FeaturePtr createFeature(std::string theFeatureID); + FeaturePtr createFeature(std::string theFeatureID) override; public: /// Default constructor diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp index 9e2ff415a..2c4638bd4 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp @@ -40,7 +40,7 @@ #include //================================================================================================= -PrimitivesPlugin_Torus::PrimitivesPlugin_Torus() {} +PrimitivesPlugin_Torus::PrimitivesPlugin_Torus() = default; //================================================================================================= void PrimitivesPlugin_Torus::initAttributes() { @@ -90,7 +90,7 @@ void PrimitivesPlugin_Torus::execute() { std::shared_ptr aBasePoint; std::shared_ptr aPointRef = selection(PrimitivesPlugin_Torus::BASE_POINT_ID()); - if (aPointRef.get() != NULL) { + if (aPointRef.get() != nullptr) { GeomShapePtr aShape1 = aPointRef->value(); if (!aShape1.get()) { aShape1 = aPointRef->context()->shape(); @@ -181,10 +181,8 @@ void PrimitivesPlugin_Torus::loadNamingDS( // Naming for faces std::map> listOfFaces = theTorusAlgo->getCreatedFaces(); - for (std::map>::iterator it = - listOfFaces.begin(); - it != listOfFaces.end(); ++it) { - theResultTorus->generated((*it).second, (*it).first); + for (auto &listOfFace : listOfFaces) { + theResultTorus->generated(listOfFace.second, listOfFace.first); } // Naming of edges diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.h b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.h index ba4455717..b5688df67 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.h @@ -68,17 +68,17 @@ public: } /// Returns the kind of a feature - PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() { + PRIMITIVESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = PrimitivesPlugin_Torus::ID(); return MY_KIND; } /// Creates a new part document if needed - PRIMITIVESPLUGIN_EXPORT virtual void execute(); + PRIMITIVESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - PRIMITIVESPLUGIN_EXPORT virtual void initAttributes(); + PRIMITIVESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation PrimitivesPlugin_Torus(); diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Tube.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Tube.cpp index 566a413e6..4f31cd8a5 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Tube.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Tube.cpp @@ -26,7 +26,7 @@ //================================================================================================= PrimitivesPlugin_Tube::PrimitivesPlugin_Tube() // Nothing to do during // instantiation -{} + = default; //================================================================================================= void PrimitivesPlugin_Tube::initAttributes() { @@ -76,9 +76,7 @@ void PrimitivesPlugin_Tube::loadNamingDS( // Insert to faces std::map> listOfFaces = theTubeAlgo->getCreatedFaces(); - for (std::map>::iterator it = - listOfFaces.begin(); - it != listOfFaces.end(); ++it) { - theResultTube->generated((*it).second, (*it).first); + for (auto &listOfFace : listOfFaces) { + theResultTube->generated(listOfFace.second, listOfFace.first); } } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Tube.h b/src/PrimitivesPlugin/PrimitivesPlugin_Tube.h index b9500f559..67a62a8c6 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Tube.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Tube.h @@ -60,17 +60,17 @@ public: } /// Returns the kind of a feature - PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() { + PRIMITIVESPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = PrimitivesPlugin_Tube::ID(); return MY_KIND; } /// Performs the algorithm and stores results it in the data structure - PRIMITIVESPLUGIN_EXPORT virtual void execute(); + PRIMITIVESPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - PRIMITIVESPLUGIN_EXPORT virtual void initAttributes(); + PRIMITIVESPLUGIN_EXPORT void initAttributes() override; /// Use plugin manager for features creation. PrimitivesPlugin_Tube(); diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index edc7c6843..bdc7e0723 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -105,19 +105,20 @@ public: SHAPERGUI_PrefMgr(LightApp_Preferences *theMgr, const QString &theModName) : myMgr(theMgr), myModName(theModName) {} - virtual int addPreference(const QString &theLbl, int pId, - SUIT_PreferenceMgr::PrefItemType theType, - const QString &theSection, const QString &theName) { + int addPreference(const QString &theLbl, int pId, + SUIT_PreferenceMgr::PrefItemType theType, + const QString &theSection, + const QString &theName) override { return myMgr->addPreference(myModName, theLbl, pId, theType, theSection, theName); } - virtual void setItemProperty(const QString &thePropName, - const QVariant &theValue, const int theId = -1) { + void setItemProperty(const QString &thePropName, const QVariant &theValue, + const int theId = -1) override { myMgr->setItemProperty(thePropName, theValue, theId); } - virtual SUIT_PreferenceMgr *prefMgr() const { return myMgr; } + SUIT_PreferenceMgr *prefMgr() const override { return myMgr; } private: LightApp_Preferences *myMgr; @@ -125,11 +126,7 @@ private: }; //****************************************************** -SHAPERGUI::SHAPERGUI() - : LightApp_Module("SHAPER"), mySelector(0), myIsOpened(0), myPopupMgr(0), - myIsInspectionVisible(false), myInspectionPanel(0), - myIsFacesPanelVisible(false), myIsToolbarsModified(false), - myAxisArrowRate(-1) { +SHAPERGUI::SHAPERGUI() : LightApp_Module("SHAPER") { myWorkshop = new XGUI_Workshop(this); connect(myWorkshop, SIGNAL(commandStatusUpdated()), this, SLOT(onUpdateCommandStatus())); @@ -153,7 +150,7 @@ void SHAPERGUI::initialize(CAM_Application *theApp) { LightApp_Module::initialize(theApp); myWorkshop->startApplication(); - LightApp_Application *anApp = dynamic_cast(theApp); + auto *anApp = dynamic_cast(theApp); if (anApp) { connect(anApp, SIGNAL(preferenceResetToDefaults()), this, SLOT(onDefaultPreferences())); @@ -210,7 +207,7 @@ void SHAPERGUI::initialize(CAM_Application *theApp) { SUIT_ViewManager *aMgr = aOCCViewManagers.first(); SUIT_ViewWindow *aWnd = aMgr->getActiveView(); if (aWnd) { - OCCViewer_ViewWindow *aOccWnd = static_cast(aWnd); + auto *aOccWnd = static_cast(aWnd); OCCViewer_ViewPort3d *aViewPort = aOccWnd->getViewPort(); if (aViewPort) { XGUI_ViewerProxy *aViewer = myWorkshop->viewer(); @@ -223,8 +220,7 @@ void SHAPERGUI::initialize(CAM_Application *theApp) { } } } - SHAPERGUI_DataModel *aDataModel = - dynamic_cast(dataModel()); + auto *aDataModel = dynamic_cast(dataModel()); aDataModel->initRootObject(); } @@ -274,8 +270,7 @@ bool SHAPERGUI::activateModule(SUIT_Study *theStudy) { // this must be done in the initialization and in activation (on the second // activation initialization in not called, so SComponent must be added anyway - SHAPERGUI_DataModel *aDataModel = - dynamic_cast(dataModel()); + auto *aDataModel = dynamic_cast(dataModel()); aDataModel->initRootObject(); bool isDone = LightApp_Module::activateModule(theStudy); @@ -286,7 +281,7 @@ bool SHAPERGUI::activateModule(SUIT_Study *theStudy) { setToolShown(true); QObject *aObj = myWorkshop->objectBrowser()->parent(); - QDockWidget *aObjDoc = dynamic_cast(aObj); + auto *aObjDoc = dynamic_cast(aObj); if (aObjDoc) { myWorkshop->objectBrowser()->setVisible(true); aObjDoc->setVisible(true); @@ -400,7 +395,7 @@ void SHAPERGUI::hideInternalWindows() { setToolShown(false); QObject *aObj = myWorkshop->objectBrowser()->parent(); - QDockWidget *aObjDoc = dynamic_cast(aObj); + auto *aObjDoc = dynamic_cast(aObj); if (aObjDoc) { aObjDoc->setVisible(false); myWorkshop->objectBrowser()->setVisible(false); @@ -453,7 +448,7 @@ bool SHAPERGUI::deactivateModule(SUIT_Study *theStudy) { aContext->Redisplay(aTrihedron, false); } myWorkshop->displayer()->setSelectionColor(myOldSelectionColor); - myProxyViewer->setSelector(0); + myProxyViewer->setSelector(nullptr); LightApp_SelectionMgr *aMgr = getApp()->selectionMgr(); QList aList; @@ -463,7 +458,7 @@ bool SHAPERGUI::deactivateModule(SUIT_Study *theStudy) { } delete mySelector; - mySelector = 0; + mySelector = nullptr; } // myWorkshop->contextMenuMgr()->disconnectViewer(); @@ -494,7 +489,7 @@ bool SHAPERGUI::deactivateModule(SUIT_Study *theStudy) { //****************************************************** void SHAPERGUI::logShaperGUIEvent() { - QAction *anAction = static_cast(sender()); + auto *anAction = static_cast(sender()); if (!anAction) return; const QString anId = anAction->data().toString(); @@ -539,7 +534,7 @@ void SHAPERGUI::onViewManagerAdded(SUIT_ViewManager *theMgr) { if (theMgr->getType() == OCCViewer_Viewer::Type()) { // Set the auto rotate flag in the new viewer based on the current // preference - OCCViewer_ViewManager *aVM = (OCCViewer_ViewManager *)theMgr; + auto *aVM = (OCCViewer_ViewManager *)theMgr; bool aAutoRotation = Config_PropManager::boolean("Visualization", "use_auto_rotation"); aVM->setAutoRotation(aAutoRotation); @@ -553,8 +548,7 @@ void SHAPERGUI::onViewManagerAdded(SUIT_ViewManager *theMgr) { void SHAPERGUI::onViewManagerRemoved(SUIT_ViewManager *theMgr) { if (mySelector) { if (theMgr->getType() == OCCViewer_Viewer::Type()) { - OCCViewer_Viewer *aViewer = - static_cast(theMgr->getViewModel()); + auto *aViewer = static_cast(theMgr->getViewModel()); if (mySelector->viewer() == aViewer) { XGUI_Displayer *aDisp = myWorkshop->displayer(); QObjectPtrList aObjects = aDisp->displayedObjects(); @@ -563,16 +557,16 @@ void SHAPERGUI::onViewManagerRemoved(SUIT_ViewManager *theMgr) { aObj->setDisplayed(false); aRes = std::dynamic_pointer_cast(aObj); if (aRes.get()) { - while (aRes = ModelAPI_Tools::bodyOwner(aRes)) { + while ((aRes = ModelAPI_Tools::bodyOwner(aRes))) { aRes->setDisplayed(false); } } } Events_Loop::loop()->flush( Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - myProxyViewer->setSelector(0); + myProxyViewer->setSelector(nullptr); delete mySelector; - mySelector = 0; + mySelector = nullptr; myWorkshop->module()->clearViewer(); } @@ -583,7 +577,7 @@ void SHAPERGUI::onViewManagerRemoved(SUIT_ViewManager *theMgr) { //****************************************************** QtxPopupMgr *SHAPERGUI::popupMgr() { if (!myPopupMgr) - myPopupMgr = new QtxPopupMgr(0, this); + myPopupMgr = new QtxPopupMgr(nullptr, this); return myPopupMgr; } @@ -634,8 +628,7 @@ void SHAPERGUI::onSaveAsDocByShaper() { void SHAPERGUI::onUpdateCommandStatus() { getApp()->updateActions(); - LightApp_Application *aApp = - dynamic_cast(application()); + auto *aApp = dynamic_cast(application()); QtxInfoPanel *aInfoPanel = aApp->infoPanel(); if (aInfoPanel->isVisible()) updateInfoPanel(); @@ -644,8 +637,7 @@ void SHAPERGUI::onUpdateCommandStatus() { //****************************************************** SHAPERGUI_OCCSelector *SHAPERGUI::createSelector(SUIT_ViewManager *theMgr) { if (theMgr->getType() == OCCViewer_Viewer::Type()) { - OCCViewer_Viewer *aViewer = - static_cast(theMgr->getViewModel()); + auto *aViewer = static_cast(theMgr->getViewModel()); // Remember current length of arrow of axis Handle(AIS_Trihedron) aTrihedron = aViewer->getTrihedron(); @@ -654,7 +646,7 @@ SHAPERGUI_OCCSelector *SHAPERGUI::createSelector(SUIT_ViewManager *theMgr) { myAxisArrowRate = aDatumAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent); - SHAPERGUI_OCCSelector *aSelector = + auto *aSelector = new SHAPERGUI_OCCSelector(aViewer, getApp()->selectionMgr()); #ifdef SALOME_PATCH_FOR_CTRL_WHEEL aViewer->setUseLocalSelection(true); @@ -679,7 +671,7 @@ SHAPERGUI_OCCSelector *SHAPERGUI::createSelector(SUIT_ViewManager *theMgr) { return aSelector; } - return 0; + return nullptr; } //****************************************************** @@ -766,8 +758,7 @@ SHAPERGUI::addFeatureOfNested(const QString &theWBName, const ActionInfo &theInfo, const QList &theNestedActions) { SUIT_Desktop *aDesk = application()->desktop(); - SHAPERGUI_NestedButton *anAction = - new SHAPERGUI_NestedButton(aDesk, theNestedActions); + auto *anAction = new SHAPERGUI_NestedButton(aDesk, theNestedActions); anAction->setData(theInfo.id); anAction->setCheckable(theInfo.checkable); anAction->setChecked(theInfo.checked); @@ -1065,9 +1056,8 @@ void SHAPERGUI::preferencesChanged(const QString &theSection, // Update the auto rotation flag in all OCC 3D view windows ViewManagerList lst; getApp()->viewManagers(OCCViewer_Viewer::Type(), lst); - for (auto it = lst.begin(); it != lst.end(); ++it) { - OCCViewer_ViewManager *aVMgr = - dynamic_cast(*it); + for (auto &it : lst) { + auto *aVMgr = dynamic_cast(it); if (aVMgr) { aVMgr->setAutoRotation(aAutoRotation); } @@ -1443,8 +1433,7 @@ void SHAPERGUI::addActionsToInfoGroup(QtxInfoPanel *theInfoPanel, } void SHAPERGUI::updateInfoPanel() { - LightApp_Application *aApp = - dynamic_cast(application()); + auto *aApp = dynamic_cast(application()); QtxInfoPanel *aInfoPanel = aApp->infoPanel(); aInfoPanel->clear(); aInfoPanel->setTitle(tr("Welcome to SHAPER")); diff --git a/src/SHAPERGUI/SHAPERGUI.h b/src/SHAPERGUI/SHAPERGUI.h index d7356e626..6d2e8f0e1 100644 --- a/src/SHAPERGUI/SHAPERGUI.h +++ b/src/SHAPERGUI/SHAPERGUI.h @@ -49,115 +49,113 @@ class SHAPERGUI_EXPORT SHAPERGUI : public LightApp_Module, Q_OBJECT public: SHAPERGUI(); - virtual ~SHAPERGUI(); + ~SHAPERGUI() override; //----- LightAPP_Module interface --------------- /// \brief Initializing of the module /// \param theApp application instance - virtual void initialize(CAM_Application *theApp); + void initialize(CAM_Application *theApp) override; /// \brief Definition of module standard windows - virtual void windows(QMap &theWndMap) const; + void windows(QMap &theWndMap) const override; /// \brief Definition of module viewer - virtual void viewManagers(QStringList &theList) const; + void viewManagers(QStringList &theList) const override; /// \brief The method is called on selection changed event - virtual void selectionChanged(); + void selectionChanged() override; //--- XGUI connector interface ----- - virtual QAction *addFeature(const QString &theWBName, - const QString &theTBName, const QString &theId, - const QString &theTitle, const QString &theTip, - const QIcon &theIcon, - const QKeySequence &theKeys /* = QKeySequence()*/, - bool isCheckable /*= false*/, - const bool isAddSeparator /* = false*/, - const QString &theStatusTip); + QAction *addFeature(const QString &theWBName, const QString &theTBName, + const QString &theId, const QString &theTitle, + const QString &theTip, const QIcon &theIcon, + const QKeySequence &theKeys /* = QKeySequence()*/, + bool isCheckable /*= false*/, + const bool isAddSeparator /* = false*/, + const QString &theStatusTip) override; //! Add feature (QAction) in the \a theWBName toolbar with given \a theInfo //! about action - virtual QAction *addFeature(const QString &theWBName, - const ActionInfo &theInfo, - const bool isAddSeparator); + QAction *addFeature(const QString &theWBName, const ActionInfo &theInfo, + const bool isAddSeparator) override; /// Add a nested feature /// \param theWBName a workbench name /// \param theInfo the action parameters /// \param theNestedActions a list of nested actions - virtual QAction *addFeatureOfNested(const QString &theWBName, - const ActionInfo &theInfo, - const QList &theNestedActions); + QAction * + addFeatureOfNested(const QString &theWBName, const ActionInfo &theInfo, + const QList &theNestedActions) override; //! Returns true if the feature action is a nested action, in other words, //! it is created by addNestedFeature(). //! \param theAction - an action of a feature //! returns boolean result - virtual bool isFeatureOfNested(const QAction *theAction); + bool isFeatureOfNested(const QAction *theAction) override; - virtual QAction *addDesktopCommand( + QAction *addDesktopCommand( const QString &theId, const QString &theTitle, const QString &theTip, const QIcon &theIcon, const QKeySequence &theKeys, bool isCheckable, const char *theMenuSourceText, const QString &theSubMenu = QString(), const int theMenuPosition = 10, const int theSuibMenuPosition = -1) Standard_OVERRIDE; - virtual void addDesktopMenuSeparator(const char *theMenuSourceText, - const int theMenuPosition = 10); + void addDesktopMenuSeparator(const char *theMenuSourceText, + const int theMenuPosition = 10) override; /// Add an action to a tool bar /// \param theAction an ation to add /// \param theToolBarTitle a name of tool bar - virtual bool addActionInToolbar(QAction *theAction, - const QString &theToolBarTitle); + bool addActionInToolbar(QAction *theAction, + const QString &theToolBarTitle) override; /// Creates menu/tool bar actions for loaded features stored in the menu /// manager - virtual void createFeatureActions(); + void createFeatureActions() override; - virtual QMainWindow *desktop() const; + QMainWindow *desktop() const override; //! Stores XML information for the feature kind //! \param theFeatureId a feature kind //! \param theMessage a container of the feature XML properties - virtual void - setFeatureInfo(const QString &theFeatureId, - const std::shared_ptr &theMessage); + void setFeatureInfo( + const QString &theFeatureId, + const std::shared_ptr &theMessage) override; //! Returns XML information for the feature kind //! \param theFeatureId a feature kind //! \return theMessage a container of the feature XML properties - virtual std::shared_ptr - featureInfo(const QString &theFeatureId); + std::shared_ptr + featureInfo(const QString &theFeatureId) override; //! Returns interface to Salome viewer - virtual ModuleBase_IViewer *viewer() const { return myProxyViewer; } + ModuleBase_IViewer *viewer() const override { return myProxyViewer; } //! Returns list of defined actions (just by SHAPER module) - virtual QList commandList() const; + QList commandList() const override; /// Redefinition of virtual function. /// \param theClient name of pop-up client /// \param theMenu popup menu instance /// \param theTitle menu title. - virtual void contextMenuPopup(const QString &theClient, QMenu *theMenu, - QString &theTitle); + void contextMenuPopup(const QString &theClient, QMenu *theMenu, + QString &theTitle) override; /// Redefinition of virtual function for preferences creation. - virtual void createPreferences(); + void createPreferences() override; /// Redefinition of virtual function for preferences changed event. - virtual void preferencesChanged(const QString &theSection, - const QString &theParam); + void preferencesChanged(const QString &theSection, + const QString &theParam) override; //! Shows the given text in status bar as a permanent text //! \theInfo a string value //! \theMsecs interval of msec milliseconds when the message will be hidden, //! if -1, it stays. // If 0, default value is used, it is 3000 - virtual void putInfo(const QString &theInfo, const int theMSecs = 0); + void putInfo(const QString &theInfo, const int theMSecs = 0) override; /// \return Workshop class instance XGUI_Workshop *workshop() const { return myWorkshop; } @@ -165,7 +163,7 @@ public: /// \brief Set flag about opened document state void setIsOpened(bool theOpened) { myIsOpened = theOpened; } - virtual void updateModuleVisibilityState(); + void updateModuleVisibilityState() override; /// Returns list of the module commands QIntList shaperActions() const { return myActionsList; } @@ -185,7 +183,7 @@ public: void publishToStudy(); - virtual void updateInfoPanel(); + void updateInfoPanel() override; public slots: /// \brief The method is redefined to connect to the study viewer before the @@ -195,20 +193,20 @@ public slots: /// \brief The method is called on the module activation /// \param theStudy current study - virtual bool activateModule(SUIT_Study *theStudy); + bool activateModule(SUIT_Study *theStudy) override; /// \brief The method is called on the module activation /// \param theStudy current study - virtual bool deactivateModule(SUIT_Study *theStudy); + bool deactivateModule(SUIT_Study *theStudy) override; protected slots: /// Redefinition of virtual function /// \param theMgr view manager - virtual void onViewManagerAdded(SUIT_ViewManager *theMgr); + void onViewManagerAdded(SUIT_ViewManager *theMgr) override; /// Redefinition of virtual function /// \param theMgr view manager - virtual void onViewManagerRemoved(SUIT_ViewManager *theMgr); + void onViewManagerRemoved(SUIT_ViewManager *theMgr) override; /// Set preferences to default void onDefaultPreferences(); @@ -232,13 +230,13 @@ protected slots: protected: /// Create data model - CAM_DataModel *createDataModel(); + CAM_DataModel *createDataModel() override; /// Create popup menu manager - virtual QtxPopupMgr *popupMgr(); + QtxPopupMgr *popupMgr() override; /// Abort all operations - virtual bool abortAllOperations(); + bool abortAllOperations() override; private slots: void onWhatIs(bool isToggled); @@ -286,7 +284,7 @@ private: XGUI_Workshop *myWorkshop; /// OCC viewer selector instance - SHAPERGUI_OCCSelector *mySelector; + SHAPERGUI_OCCSelector *mySelector{0}; /// Proxy viewer for connection to OCC Viewer in SALOME SHAPERGUI_SalomeViewer *myProxyViewer; @@ -295,31 +293,31 @@ private: QMap> myFeaturesInfo; /// Flag of opened document state - bool myIsOpened; + bool myIsOpened{0}; // the next parameter should be restored after this module deactivation /// The application value bool myIsEditEnabled; /// Popup manager - QtxPopupMgr *myPopupMgr; + QtxPopupMgr *myPopupMgr{0}; QAction *myWhatIsAction; - bool myIsInspectionVisible; - QDockWidget *myInspectionPanel; - bool myIsFacesPanelVisible; + bool myIsInspectionVisible{false}; + QDockWidget *myInspectionPanel{0}; + bool myIsFacesPanelVisible{false}; /// List of registered actions QIntList myActionsList; QMap myToolbars; QMap myDefaultToolbars; - bool myIsToolbarsModified; + bool myIsToolbarsModified{false}; std::vector myOldSelectionColor; Handle(Graphic3d_AspectMarker3d) myHighlightPointAspect; - double myAxisArrowRate; + double myAxisArrowRate{-1}; }; #endif diff --git a/src/SHAPERGUI/SHAPERGUI_DataModel.cpp b/src/SHAPERGUI/SHAPERGUI_DataModel.cpp index e2325989d..4c5b0867d 100644 --- a/src/SHAPERGUI/SHAPERGUI_DataModel.cpp +++ b/src/SHAPERGUI/SHAPERGUI_DataModel.cpp @@ -43,7 +43,7 @@ SHAPERGUI_DataModel::SHAPERGUI_DataModel(SHAPERGUI *theModule) : LightApp_DataModel(theModule), myStudyPath(""), myModule(theModule) {} -SHAPERGUI_DataModel::~SHAPERGUI_DataModel() {} +SHAPERGUI_DataModel::~SHAPERGUI_DataModel() = default; bool SHAPERGUI_DataModel::open(const QString &thePath, CAM_Study *theStudy, QStringList theFiles) { @@ -61,7 +61,7 @@ bool SHAPERGUI_DataModel::open(const QString &thePath, CAM_Study *theStudy, // creates a new tmp directory with a copy of files. QString aTmpDir = theFiles.first(); - LightApp_Study *aStudy = + auto *aStudy = dynamic_cast(myModule->application()->activeStudy()); QString aNewTmpDir = aStudy->GetTmpDir("", false).c_str(); @@ -89,7 +89,7 @@ bool SHAPERGUI_DataModel::save(QStringList &theFiles) { std::list aFileNames; CAM_Application *anApp = myModule->application(); - LightApp_Study *aStudy = dynamic_cast(anApp->activeStudy()); + auto *aStudy = dynamic_cast(anApp->activeStudy()); SUIT_ResourceMgr *aResMgr = anApp->resourceMgr(); // it is important to check whether the file is saved in the multi-files mode @@ -117,7 +117,8 @@ bool SHAPERGUI_DataModel::save(QStringList &theFiles) { return true; } -bool SHAPERGUI_DataModel::saveAs(const QString &thePath, CAM_Study *theStudy, +bool SHAPERGUI_DataModel::saveAs(const QString &thePath, + CAM_Study * /*theStudy*/, QStringList &theFiles) { myStudyPath = thePath; return save(theFiles); @@ -128,7 +129,7 @@ bool SHAPERGUI_DataModel::close() { return LightApp_DataModel::close(); } -bool SHAPERGUI_DataModel::create(CAM_Study *theStudy) { return true; } +bool SHAPERGUI_DataModel::create(CAM_Study * /*theStudy*/) { return true; } bool SHAPERGUI_DataModel::isModified() const { SessionPtr aMgr = ModelAPI_Session::get(); @@ -137,8 +138,8 @@ bool SHAPERGUI_DataModel::isModified() const { bool SHAPERGUI_DataModel::isSaved() const { return !isModified(); } -void SHAPERGUI_DataModel::update(LightApp_DataObject *theObj, - LightApp_Study *theStudy) { +void SHAPERGUI_DataModel::update(LightApp_DataObject * /*theObj*/, + LightApp_Study * /*theStudy*/) { // Nothing to do here: we always keep the data tree in the up-to-date state // The only goal of this method is to hide default behavior from // LightApp_DataModel @@ -146,10 +147,10 @@ void SHAPERGUI_DataModel::update(LightApp_DataObject *theObj, } void SHAPERGUI_DataModel::initRootObject() { - LightApp_Study *study = + auto *study = dynamic_cast(module()->application()->activeStudy()); - CAM_ModuleObject *aModelRoot = dynamic_cast(root()); - if (study && aModelRoot == NULL) { + auto *aModelRoot = dynamic_cast(root()); + if (study && aModelRoot == nullptr) { aModelRoot = createModuleObject(study->root()); aModelRoot->setDataModel(this); setRoot(aModelRoot); @@ -163,7 +164,7 @@ void SHAPERGUI_DataModel::removeDirectory(const QString &theDirectoryName) { bool SHAPERGUI_DataModel::dumpPython(const QString &thePath, CAM_Study *theStudy, bool isMultiFile, QStringList &theListOfFiles) { - LightApp_Study *aStudy = dynamic_cast(theStudy); + auto *aStudy = dynamic_cast(theStudy); if (!aStudy) return false; diff --git a/src/SHAPERGUI/SHAPERGUI_DataModel.h b/src/SHAPERGUI/SHAPERGUI_DataModel.h index 5d7a96d3f..df61187b2 100644 --- a/src/SHAPERGUI/SHAPERGUI_DataModel.h +++ b/src/SHAPERGUI/SHAPERGUI_DataModel.h @@ -37,53 +37,53 @@ public: /// Constructor /// \param theModule a module instance SHAPERGUI_DataModel(SHAPERGUI *theModule); - virtual ~SHAPERGUI_DataModel(); + ~SHAPERGUI_DataModel() override; /// Open a data file /// \param thePath a path to the directory /// \param theStudy a current study /// \param theFiles a list of files to open - virtual bool open(const QString &thePath, CAM_Study *theStudy, - QStringList theFiles); + bool open(const QString &thePath, CAM_Study *theStudy, + QStringList theFiles) override; /// Save module data to file /// \param theFiles list of created files - virtual bool save(QStringList &theFiles); + bool save(QStringList &theFiles) override; /// Save module data to a file /// \param thePath a path to the directory /// \param theStudy a current study /// \param theFiles a list of files to open - virtual bool saveAs(const QString &thePath, CAM_Study *theStudy, - QStringList &theFiles); + bool saveAs(const QString &thePath, CAM_Study *theStudy, + QStringList &theFiles) override; /// Close data structure - virtual bool close(); + bool close() override; /// Create data structure /// \param theStudy a current study - virtual bool create(CAM_Study *theStudy); + bool create(CAM_Study *theStudy) override; /// Returns True if the data structure has been modified - virtual bool isModified() const; + bool isModified() const override; /// Returns True if the data structure is already saved - virtual bool isSaved() const; + bool isSaved() const override; /// Creates a module root object if it has not been created yet /// and append it to the active study. It is necessary for correct persistent /// of the model. - virtual void initRootObject() override; + void initRootObject() override; /// Update data object /// \param theObj an data object /// \param theStudy a current study - virtual void update(LightApp_DataObject *theObj = 0, - LightApp_Study *theStudy = 0); + void update(LightApp_DataObject *theObj = nullptr, + LightApp_Study *theStudy = nullptr) override; /// Redefinition of virtual method: include the module dump in the common /// SALOME dump - virtual bool dumpPython(const QString &, CAM_Study *, bool, QStringList &); + bool dumpPython(const QString &, CAM_Study *, bool, QStringList &) override; protected: /** diff --git a/src/SHAPERGUI/SHAPERGUI_NestedButton.h b/src/SHAPERGUI/SHAPERGUI_NestedButton.h index 569ed243e..a63a30b97 100644 --- a/src/SHAPERGUI/SHAPERGUI_NestedButton.h +++ b/src/SHAPERGUI/SHAPERGUI_NestedButton.h @@ -64,11 +64,11 @@ protected: bool event(QEvent *theEvent) override; private: - QList myNestedActions; ///< list of nested actions - QWidget *myAdditionalButtonsWidget{0}; ///< widget to precess additional - ///< buttons visibility - QFrame *myButtonFrame{0}; ///< frame arround button representation - QToolButton *myThisButton{0}; ///< main button + QList myNestedActions; ///< list of nested actions + QWidget *myAdditionalButtonsWidget{nullptr}; ///< widget to precess additional + ///< buttons visibility + QFrame *myButtonFrame{nullptr}; ///< frame arround button representation + QToolButton *myThisButton{nullptr}; ///< main button }; #endif /* SRC_SHAPERGUI_NESTEDBUTTON_H_ */ diff --git a/src/SHAPERGUI/SHAPERGUI_OCCSelector.cpp b/src/SHAPERGUI/SHAPERGUI_OCCSelector.cpp index d3651ef4d..1c8bfb17f 100644 --- a/src/SHAPERGUI/SHAPERGUI_OCCSelector.cpp +++ b/src/SHAPERGUI/SHAPERGUI_OCCSelector.cpp @@ -24,17 +24,17 @@ SHAPERGUI_OCCSelector::SHAPERGUI_OCCSelector(OCCViewer_Viewer *theViewer, SUIT_SelectionMgr *theMgr) : LightApp_OCCSelector(theViewer, theMgr) {} -SHAPERGUI_OCCSelector::~SHAPERGUI_OCCSelector() {} +SHAPERGUI_OCCSelector::~SHAPERGUI_OCCSelector() = default; void SHAPERGUI_OCCSelector::getSelection( - SUIT_DataOwnerPtrList &thePtrList) const { + SUIT_DataOwnerPtrList & /*thePtrList*/) const { OCCViewer_Viewer *vw = viewer(); if (!vw) return; } void SHAPERGUI_OCCSelector::setSelection( - const SUIT_DataOwnerPtrList &thePtrList) { + const SUIT_DataOwnerPtrList & /*thePtrList*/) { OCCViewer_Viewer *vw = viewer(); if (!vw) return; diff --git a/src/SHAPERGUI/SHAPERGUI_OCCSelector.h b/src/SHAPERGUI/SHAPERGUI_OCCSelector.h index c2cd32c1a..c9b1bf298 100644 --- a/src/SHAPERGUI/SHAPERGUI_OCCSelector.h +++ b/src/SHAPERGUI/SHAPERGUI_OCCSelector.h @@ -35,14 +35,14 @@ public: /// \param theViewer a viewer /// \param theMgr a selection manager SHAPERGUI_OCCSelector(OCCViewer_Viewer *theViewer, SUIT_SelectionMgr *theMgr); - virtual ~SHAPERGUI_OCCSelector(); + ~SHAPERGUI_OCCSelector() override; protected: /// Redifinition of virtual function - virtual void getSelection(SUIT_DataOwnerPtrList &theList) const; + void getSelection(SUIT_DataOwnerPtrList &theList) const override; /// Redifinition of virtual function - virtual void setSelection(const SUIT_DataOwnerPtrList &theList); + void setSelection(const SUIT_DataOwnerPtrList &theList) override; }; #endif diff --git a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp index d54ec7034..e387b3f5a 100644 --- a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp +++ b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp @@ -44,25 +44,23 @@ #endif SHAPERGUI_SalomeView::SHAPERGUI_SalomeView(OCCViewer_Viewer *theViewer) - : ModuleBase_IViewWindow(), myCurrentView(0) { + : ModuleBase_IViewWindow(), myCurrentView(nullptr) { myViewer = theViewer; } Handle(V3d_View) SHAPERGUI_SalomeView::v3dView() const { Handle(V3d_View) aView; if (myCurrentView) { - OCCViewer_ViewWindow *aWnd = - static_cast(myCurrentView); + auto *aWnd = static_cast(myCurrentView); aView = aWnd->getViewPort()->getView(); } return aView; } QWidget *SHAPERGUI_SalomeView::viewPort() const { - QWidget *aViewPort = 0; + QWidget *aViewPort = nullptr; if (myCurrentView) { - OCCViewer_ViewWindow *aWnd = - static_cast(myCurrentView); + auto *aWnd = static_cast(myCurrentView); aViewPort = aWnd->getViewPort(); } return aViewPort; @@ -73,7 +71,7 @@ QWidget *SHAPERGUI_SalomeView::viewPort() const { //********************************************** SHAPERGUI_SalomeViewer::SHAPERGUI_SalomeViewer(QObject *theParent) - : ModuleBase_IViewer(theParent), mySelector(0), myView(0), + : ModuleBase_IViewer(theParent), mySelector(nullptr), myView(nullptr), myIsSelectionChanged(false) {} SHAPERGUI_SalomeViewer::~SHAPERGUI_SalomeViewer() { @@ -106,8 +104,7 @@ Handle(V3d_View) SHAPERGUI_SalomeViewer::activeView() const { if (mySelector) { OCCViewer_Viewer *aViewer = mySelector->viewer(); SUIT_ViewManager *aMgr = aViewer->getViewManager(); - OCCViewer_ViewWindow *aWnd = - static_cast(aMgr->getActiveView()); + auto *aWnd = static_cast(aMgr->getActiveView()); return aWnd->getViewPort()->getView(); } return Handle(V3d_View)(); @@ -115,12 +112,11 @@ Handle(V3d_View) SHAPERGUI_SalomeViewer::activeView() const { //********************************************** QWidget *SHAPERGUI_SalomeViewer::activeViewPort() const { - QWidget *aViewPort = 0; + QWidget *aViewPort = nullptr; if (mySelector) { OCCViewer_Viewer *aViewer = mySelector->viewer(); SUIT_ViewManager *aMgr = aViewer->getViewManager(); - OCCViewer_ViewWindow *aWnd = - static_cast(aMgr->getActiveView()); + auto *aWnd = static_cast(aMgr->getActiveView()); aViewPort = aWnd->getViewPort(); } return aViewPort; @@ -219,7 +215,7 @@ void SHAPERGUI_SalomeViewer::onMouseMove(SUIT_ViewWindow *theView, bool SHAPERGUI_SalomeViewer::canDragByMouse() const { OCCViewer_Viewer *aViewer = mySelector->viewer(); SUIT_ViewWindow *aWnd = aViewer->getViewManager()->getActiveView(); - OCCViewer_ViewWindow *aViewWnd = dynamic_cast(aWnd); + auto *aViewWnd = dynamic_cast(aWnd); if (aViewWnd) { return (aViewWnd->interactionStyle() == 0); } @@ -254,7 +250,7 @@ void SHAPERGUI_SalomeViewer::onDeleteView(SUIT_ViewWindow *) { void SHAPERGUI_SalomeViewer::onViewCreated(SUIT_ViewWindow *theView) { myView->setCurrentView(theView); - OCCViewer_ViewFrame *aView = dynamic_cast(theView); + auto *aView = dynamic_cast(theView); OCCViewer_ViewWindow *aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW); if (aWnd) { @@ -267,8 +263,7 @@ void SHAPERGUI_SalomeViewer::onViewCreated(SUIT_ViewWindow *theView) { connect(aViewPort, SIGNAL(vpMapped(OCCViewer_ViewPort3d *)), this, SLOT(onViewPortMapped())); - OCCViewer_ViewManager *aMgr = - dynamic_cast(aWnd->getViewManager()); + auto *aMgr = dynamic_cast(aWnd->getViewManager()); if (aMgr) aWnd->enableAutoRotation(aMgr->isAutoRotation()); } @@ -339,8 +334,7 @@ bool SHAPERGUI_SalomeViewer::enableDrawMode(bool isEnabled) { //********************************************** void SHAPERGUI_SalomeViewer::reconnectActions(SUIT_ViewWindow *theWindow, const bool theUseSHAPERSlot) { - OCCViewer_ViewWindow *aWindow = - dynamic_cast(theWindow); + auto *aWindow = dynamic_cast(theWindow); if (!aWindow) return; @@ -366,8 +360,7 @@ void SHAPERGUI_SalomeViewer::reconnectActions(SUIT_ViewWindow *theWindow, void SHAPERGUI_SalomeViewer::fitAll() { if (mySelector) { SUIT_ViewManager *aMgr = mySelector->viewer()->getViewManager(); - OCCViewer_ViewFrame *aVFrame = - dynamic_cast(aMgr->getActiveView()); + auto *aVFrame = dynamic_cast(aMgr->getActiveView()); if (aVFrame) { aVFrame->onFitAll(); } @@ -399,8 +392,7 @@ void SHAPERGUI_SalomeViewer::setViewProjection(double theX, double theY, return; SUIT_ViewManager *aMgr = mySelector->viewer()->getViewManager(); - OCCViewer_ViewFrame *aVFrame = - dynamic_cast(aMgr->getActiveView()); + auto *aVFrame = dynamic_cast(aMgr->getActiveView()); if (aVFrame) { Handle(V3d_View) aView3d = aVFrame->getViewPort()->getView(); if (!aView3d.IsNull()) { @@ -488,8 +480,7 @@ void SHAPERGUI_SalomeViewer::activateViewer(bool toActivate) { QVector aViews = aMgr->getViews(); if (toActivate) { foreach (SUIT_ViewWindow *aView, aViews) { - OCCViewer_ViewFrame *aOCCView = - dynamic_cast(aView); + auto *aOCCView = dynamic_cast(aView); OCCViewer_ViewWindow *aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW); connect( @@ -497,15 +488,13 @@ void SHAPERGUI_SalomeViewer::activateViewer(bool toActivate) { SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)), this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType))); reconnectActions(aWnd, true); - OCCViewer_ViewManager *aOCCMgr = - dynamic_cast(aMgr); + auto *aOCCMgr = dynamic_cast(aMgr); if (aOCCMgr) aWnd->enableAutoRotation(aOCCMgr->isAutoRotation()); } } else { foreach (SUIT_ViewWindow *aView, aViews) { - OCCViewer_ViewFrame *aOCCView = - dynamic_cast(aView); + auto *aOCCView = dynamic_cast(aView); OCCViewer_ViewWindow *aWnd = aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW); disconnect( @@ -592,7 +581,7 @@ void SHAPERGUI_SalomeViewer::setText( double anOffset = -theSize - 1; // initial offset from the toolbar of the viewer - ModuleBase_IViewer::TextColor::const_iterator aLine = theText.cbegin(); + auto aLine = theText.cbegin(); for (; aLine != theText.cend(); aLine++) { Quantity_Color aColor(aLine->second.at(0) / 255., aLine->second.at(1) / 255., @@ -651,5 +640,5 @@ void SHAPERGUI_SalomeViewer::setFitter(OCCViewer_Fitter *theFitter) { OCCViewer_Fitter *SHAPERGUI_SalomeViewer::fitter() const { if (mySelector) return mySelector->viewer()->fitter(); - return 0; + return nullptr; } diff --git a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h index 3e1948687..f11234857 100644 --- a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h +++ b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h @@ -51,10 +51,10 @@ public: /// \param theViewer a reference to a viewer SHAPERGUI_SalomeView(OCCViewer_Viewer *theViewer); - virtual Handle(V3d_View) v3dView() const; + Handle(V3d_View) v3dView() const override; /// Returns the view window view port - virtual QWidget *viewPort() const; + QWidget *viewPort() const override; /// Set the current viewer /// \param theViewer a viewer instance @@ -84,37 +84,37 @@ public: /// \param theParent a parent object SHAPERGUI_SalomeViewer(QObject *theParent); - ~SHAPERGUI_SalomeViewer(); + ~SHAPERGUI_SalomeViewer() override; //! Returns AIS_InteractiveContext from current OCCViewer - virtual Handle(AIS_InteractiveContext) AISContext() const; + Handle(AIS_InteractiveContext) AISContext() const override; //! Retrurns V3d_Vioewer from current viewer - virtual Handle(V3d_Viewer) v3dViewer() const; + Handle(V3d_Viewer) v3dViewer() const override; //! Trihedron 3d object shown in the viewer - virtual Handle(AIS_Trihedron) trihedron() const; + Handle(AIS_Trihedron) trihedron() const override; //! Returns Vsd_View object from currently active view window - virtual Handle(V3d_View) activeView() const; + Handle(V3d_View) activeView() const override; //! Returns viewer view port - virtual QWidget *activeViewPort() const; + QWidget *activeViewPort() const override; //! Enable or disable selection in the viewer - virtual void enableSelection(bool isEnabled); + void enableSelection(bool isEnabled) override; //! Returns true if selection is enabled - virtual bool isSelectionEnabled() const; + bool isSelectionEnabled() const override; //! Enable or disable multiselection in the viewer - virtual void enableMultiselection(bool isEnable); + void enableMultiselection(bool isEnable) override; //! Returns true if multiselection is enabled - virtual bool isMultiSelectionEnabled() const; + bool isMultiSelectionEnabled() const override; //! Enable or disable draw mode in the viewer - virtual bool enableDrawMode(bool isEnabled); + bool enableDrawMode(bool isEnabled) override; //! For some signals it disconnects the window from usual signal and connect //! it to the module ones @@ -122,33 +122,33 @@ public: const bool theUseSHAPERSlot); //! Perfroms the fit all for the active view - virtual void fitAll(); + void fitAll() override; //! Erases all presentations from the viewer - virtual void eraseAll(); + void eraseAll() override; //! Sets the view projection /// \param theX the X projection value /// \param theY the Y projection value /// \param theZ the Z projection value /// \param theTwist the twist angle in radians - virtual void setViewProjection(double theX, double theY, double theZ, - double theTwist); + void setViewProjection(double theX, double theY, double theZ, + double theTwist) override; /// Set selector /// \param theSel a selector instance void setSelector(SHAPERGUI_OCCSelector *theSel); /// Add selection filter to the viewer - virtual void addSelectionFilter(const Handle(SelectMgr_Filter) & theFilter); + void addSelectionFilter(const Handle(SelectMgr_Filter) & theFilter) override; /// Remove selection filter from the viewer - virtual void removeSelectionFilter(const Handle(SelectMgr_Filter) & - theFilter); + void removeSelectionFilter(const Handle(SelectMgr_Filter) & + theFilter) override; /// Returns true if the selection filter is set to the viewer /// \param theFilter a selection filter - virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter) & theFilter); + bool hasSelectionFilter(const Handle(SelectMgr_Filter) & theFilter) override; /// Remove all selection filters from the viewer virtual void clearSelectionFilters(); @@ -157,11 +157,11 @@ public: SHAPERGUI_OCCSelector *selector() const { return mySelector; } /// Update current viewer - virtual void update(); + void update() override; /// Method returns True if the viewer can process editing objects /// by mouse drugging. If this is impossible thet it has to return False. - virtual bool canDragByMouse() const; + bool canDragByMouse() const override; /// Activate or deactivate viewer /// \param toActivate - activation flag @@ -170,51 +170,51 @@ public: // Methods for color scale management //! Returns True if ColorScale is visible - virtual bool isColorScaleVisible() const; + bool isColorScaleVisible() const override; //! Show/Hide ColorScale object - virtual void setColorScaleShown(bool on); + void setColorScaleShown(bool on) override; //! Set position of color scale // \param theX is X position relative to current view width // \param theY is Y position relative to current view heigth - virtual void setColorScalePosition(double theX, double theY); + void setColorScalePosition(double theX, double theY) override; //! Set size of color scale // \param theW is width relative to current view width // \param theh is height relative to current view heigth - virtual void setColorScaleSize(double theW, double theH); + void setColorScaleSize(double theW, double theH) override; //! Set range of color scale // \param theMin is a minimal value // \param theMax is a maximal value - virtual void setColorScaleRange(double theMin, double theMax); + void setColorScaleRange(double theMin, double theMax) override; //! Set number of intervals of color scale // \param theNb is number of intervals - virtual void setColorScaleIntervals(int theNb); + void setColorScaleIntervals(int theNb) override; //! Set text heigth of color scale // \param theH is number of intervals - virtual void setColorScaleTextHeigth(int theH); + void setColorScaleTextHeigth(int theH) override; //! Set color of text of color scale // \param theH is number of intervals - virtual void setColorScaleTextColor(const QColor &theColor); + void setColorScaleTextColor(const QColor &theColor) override; //! Set title of color scale // \param theText is a title - virtual void setColorScaleTitle(const QString &theText); + void setColorScaleTitle(const QString &theText) override; //! Sets the text displayed in right-top corner of the 3D view //! \param theText the text to display, or empty string to erase presentation; //! the first item is the font name and text color //! \param theSize size of the text font - virtual void setText(const ModuleBase_IViewer::TextColor &theText, - const int theSize); + void setText(const ModuleBase_IViewer::TextColor &theText, + const int theSize) override; - virtual void setFitter(OCCViewer_Fitter *theFitter); - virtual OCCViewer_Fitter *fitter() const; + void setFitter(OCCViewer_Fitter *theFitter) override; + OCCViewer_Fitter *fitter() const override; private slots: void onMousePress(SUIT_ViewWindow *, QMouseEvent *); diff --git a/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp b/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp index 53c1b006d..2b4f615e6 100644 --- a/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp +++ b/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp @@ -44,8 +44,8 @@ public: SHAPERGUI *theModule) : QListWidgetItem(theParent), myModule(theModule), myId(theId) {} - virtual QVariant data(int theRole) const { - QAction *aAction = 0; + QVariant data(int theRole) const override { + QAction *aAction = nullptr; if (myId != -1) aAction = myModule->action(myId); @@ -80,17 +80,17 @@ SHAPERGUI_ToolbarsDlg::SHAPERGUI_ToolbarsDlg(SHAPERGUI *theModule) myFreeCommands = theModule->getFreeCommands(); setWindowTitle(tr("Toolbars")); - QVBoxLayout *aMailLayout = new QVBoxLayout(this); + auto *aMailLayout = new QVBoxLayout(this); // Controls part of the dialog - QWidget *aControlsWgt = new QWidget(this); - QHBoxLayout *aContolsLay = new QHBoxLayout(aControlsWgt); + auto *aControlsWgt = new QWidget(this); + auto *aContolsLay = new QHBoxLayout(aControlsWgt); aContolsLay->setContentsMargins(0, 0, 0, 0); aMailLayout->addWidget(aControlsWgt); // Right controls - QWidget *aListWgt = new QWidget(aControlsWgt); - QVBoxLayout *aListLayout = new QVBoxLayout(aListWgt); + auto *aListWgt = new QWidget(aControlsWgt); + auto *aListLayout = new QVBoxLayout(aListWgt); aListLayout->setContentsMargins(0, 0, 0, 0); aContolsLay->addWidget(aListWgt); @@ -101,8 +101,8 @@ SHAPERGUI_ToolbarsDlg::SHAPERGUI_ToolbarsDlg(SHAPERGUI *theModule) SLOT(onDoubleClick(const QModelIndex &))); aListLayout->addWidget(myToolbarsList); - QWidget *aFreeItemsWgt = new QWidget(aListWgt); - QHBoxLayout *aFreeLayout = new QHBoxLayout(aFreeItemsWgt); + auto *aFreeItemsWgt = new QWidget(aListWgt); + auto *aFreeLayout = new QHBoxLayout(aFreeItemsWgt); aFreeLayout->setContentsMargins(0, 0, 0, 0); aListLayout->addWidget(aFreeItemsWgt); @@ -112,35 +112,35 @@ SHAPERGUI_ToolbarsDlg::SHAPERGUI_ToolbarsDlg(SHAPERGUI *theModule) aFreeLayout->addWidget(myFreeNbLbl); // Left controls - QWidget *aButtonsWgt = new QWidget(aControlsWgt); - QVBoxLayout *aBtnLayout = new QVBoxLayout(aButtonsWgt); + auto *aButtonsWgt = new QWidget(aControlsWgt); + auto *aBtnLayout = new QVBoxLayout(aButtonsWgt); aBtnLayout->setContentsMargins(0, 0, 0, 0); aContolsLay->addWidget(aButtonsWgt); - QPushButton *aAddBtn = new QPushButton(tr("Add..."), aButtonsWgt); + auto *aAddBtn = new QPushButton(tr("Add..."), aButtonsWgt); aAddBtn->setToolTip(tr("Add a new empty toolbar to the toolbars list")); connect(aAddBtn, SIGNAL(clicked(bool)), SLOT(onAdd())); aBtnLayout->addWidget(aAddBtn); - QPushButton *aEditBtn = new QPushButton(tr("Edit..."), aButtonsWgt); + auto *aEditBtn = new QPushButton(tr("Edit..."), aButtonsWgt); aEditBtn->setToolTip(tr("Edit currently selected toolbar")); connect(aEditBtn, SIGNAL(clicked(bool)), SLOT(onEdit())); aBtnLayout->addWidget(aEditBtn); - QPushButton *aDeleteBtn = new QPushButton(tr("Delete"), aButtonsWgt); + auto *aDeleteBtn = new QPushButton(tr("Delete"), aButtonsWgt); aDeleteBtn->setToolTip(tr("Delete currently selected toolbar")); connect(aDeleteBtn, SIGNAL(clicked(bool)), SLOT(onDelete())); aBtnLayout->addWidget(aDeleteBtn); aBtnLayout->addStretch(1); - QPushButton *aResetBtn = new QPushButton(tr("Reset"), aButtonsWgt); + auto *aResetBtn = new QPushButton(tr("Reset"), aButtonsWgt); aResetBtn->setToolTip(tr("Restore default toolbars structure")); connect(aResetBtn, SIGNAL(clicked(bool)), SLOT(onReset())); aBtnLayout->addWidget(aResetBtn); aBtnLayout->addSpacing(19); // Buttons part of the dialog - QDialogButtonBox *aButtons = new QDialogButtonBox( + auto *aButtons = new QDialogButtonBox( QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); aMailLayout->addWidget(aButtons); @@ -253,16 +253,16 @@ SHAPERGUI_ToolbarItemsDlg::SHAPERGUI_ToolbarItemsDlg( : QDialog(theParent), myModule(theModule) { setWindowTitle(tr("Edit toolbar")); - QVBoxLayout *aMailLayout = new QVBoxLayout(this); + auto *aMailLayout = new QVBoxLayout(this); // Name of toolbar - QWidget *aNameWgt = new QWidget(this); - QHBoxLayout *aNameLay = new QHBoxLayout(aNameWgt); + auto *aNameWgt = new QWidget(this); + auto *aNameLay = new QHBoxLayout(aNameWgt); aNameLay->setContentsMargins(0, 0, 0, 0); aMailLayout->addWidget(aNameWgt); aNameLay->addWidget(new QLabel(tr("Toolbar name:"), aNameWgt)); - QLabel *aNameLbl = new QLabel(theToolbar, aNameWgt); + auto *aNameLbl = new QLabel(theToolbar, aNameWgt); QFont aFont = aNameLbl->font(); aFont.setBold(true); aNameLbl->setFont(aFont); @@ -270,14 +270,14 @@ SHAPERGUI_ToolbarItemsDlg::SHAPERGUI_ToolbarItemsDlg( aNameLay->addStretch(1); // Lists widget - QWidget *aControlsWgt = new QWidget(this); - QHBoxLayout *aCtrlLayout = new QHBoxLayout(aControlsWgt); + auto *aControlsWgt = new QWidget(this); + auto *aCtrlLayout = new QHBoxLayout(aControlsWgt); aCtrlLayout->setContentsMargins(0, 0, 0, 0); aMailLayout->addWidget(aControlsWgt); // Left list - QWidget *aCommandsWgt = new QWidget(aControlsWgt); - QVBoxLayout *aCommandsLay = new QVBoxLayout(aCommandsWgt); + auto *aCommandsWgt = new QWidget(aControlsWgt); + auto *aCommandsLay = new QVBoxLayout(aCommandsWgt); aCommandsLay->setContentsMargins(0, 0, 0, 0); aCtrlLayout->addWidget(aCommandsWgt); @@ -295,28 +295,28 @@ SHAPERGUI_ToolbarItemsDlg::SHAPERGUI_ToolbarItemsDlg( aCommandsLay->addWidget(myCommandsList); // Middle buttons - QWidget *aButtonsWgt = new QWidget(aControlsWgt); - QVBoxLayout *aBtnLayout = new QVBoxLayout(aButtonsWgt); + auto *aButtonsWgt = new QWidget(aControlsWgt); + auto *aBtnLayout = new QVBoxLayout(aButtonsWgt); aBtnLayout->setContentsMargins(0, 0, 0, 0); aCtrlLayout->addWidget(aButtonsWgt); aBtnLayout->addStretch(1); - QPushButton *aAddButton = + auto *aAddButton = new QPushButton(QIcon(":pictures/arrow-right.png"), "", aButtonsWgt); connect(aAddButton, SIGNAL(clicked(bool)), SLOT(onAddItem())); aBtnLayout->addWidget(aAddButton); aBtnLayout->addSpacing(20); - QPushButton *aDelButton = + auto *aDelButton = new QPushButton(QIcon(":pictures/arrow-left.png"), "", aButtonsWgt); connect(aDelButton, SIGNAL(clicked(bool)), SLOT(onDelItem())); aBtnLayout->addWidget(aDelButton); aBtnLayout->addStretch(1); // Right list - QWidget *aItemsWgt = new QWidget(aControlsWgt); - QVBoxLayout *aItemsLay = new QVBoxLayout(aItemsWgt); + auto *aItemsWgt = new QWidget(aControlsWgt); + auto *aItemsLay = new QVBoxLayout(aItemsWgt); aItemsLay->setContentsMargins(0, 0, 0, 0); aCtrlLayout->addWidget(aItemsWgt); @@ -332,27 +332,27 @@ SHAPERGUI_ToolbarItemsDlg::SHAPERGUI_ToolbarItemsDlg( aItemsLay->addWidget(myItemsList); // Buttons of right list - QWidget *aBtnWgt = new QWidget(aControlsWgt); - QVBoxLayout *aBtnLay = new QVBoxLayout(aBtnWgt); + auto *aBtnWgt = new QWidget(aControlsWgt); + auto *aBtnLay = new QVBoxLayout(aBtnWgt); aBtnLay->setContentsMargins(0, 0, 0, 0); aCtrlLayout->addWidget(aBtnWgt); aBtnLay->addStretch(1); - QPushButton *aUpButton = + auto *aUpButton = new QPushButton(QIcon(":pictures/arrow-up.png"), "", aBtnWgt); connect(aUpButton, SIGNAL(clicked(bool)), SLOT(onUp())); aBtnLay->addWidget(aUpButton); aBtnLay->addSpacing(20); - QPushButton *aDownButton = + auto *aDownButton = new QPushButton(QIcon(":pictures/arrow-down.png"), "", aBtnWgt); connect(aDownButton, SIGNAL(clicked(bool)), SLOT(onDown())); aBtnLay->addWidget(aDownButton); aBtnLay->addStretch(1); // Buttons part of the dialog - QDialogButtonBox *aButtons = new QDialogButtonBox( + auto *aButtons = new QDialogButtonBox( QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); aMailLayout->addWidget(aButtons); @@ -364,15 +364,14 @@ SHAPERGUI_ToolbarItemsDlg::SHAPERGUI_ToolbarItemsDlg( void SHAPERGUI_ToolbarItemsDlg::onAddItem() { QList aCurrentList = myCommandsList->selectedItems(); if (aCurrentList.size() > 0) { - SHAPERGUI_CommandIdItem *aItem = - dynamic_cast(aCurrentList.first()); + auto *aItem = dynamic_cast(aCurrentList.first()); int aId = aItem->id(); if (aId != -1) { myCommandsList->removeItemWidget(aItem); delete aItem; } QModelIndex aIdx = myItemsList->currentIndex(); - aItem = new SHAPERGUI_CommandIdItem(0, aId, myModule); + aItem = new SHAPERGUI_CommandIdItem(nullptr, aId, myModule); if (aIdx.isValid()) { int aRow = aIdx.row(); myItemsList->insertItem(aRow, aItem); @@ -385,8 +384,7 @@ void SHAPERGUI_ToolbarItemsDlg::onAddItem() { void SHAPERGUI_ToolbarItemsDlg::onDelItem() { QList aCurrentList = myItemsList->selectedItems(); if (aCurrentList.size() > 0) { - SHAPERGUI_CommandIdItem *aItem = - dynamic_cast(aCurrentList.first()); + auto *aItem = dynamic_cast(aCurrentList.first()); int aId = aItem->id(); myItemsList->removeItemWidget(aItem); delete aItem; @@ -399,7 +397,7 @@ void SHAPERGUI_ToolbarItemsDlg::onDelItem() { bool SHAPERGUI_ToolbarItemsDlg::eventFilter(QObject *theObj, QEvent *theEvent) { if (theEvent->type() == QEvent::MouseButtonRelease) { - QMouseEvent *aMouseEvent = (QMouseEvent *)theEvent; + auto *aMouseEvent = (QMouseEvent *)theEvent; QModelIndex aIdx = myItemsList->indexAt(aMouseEvent->pos()); if (!aIdx.isValid() || aMouseEvent->button() == Qt::RightButton) { myItemsList->setCurrentIndex(QModelIndex()); @@ -446,7 +444,7 @@ QIntList SHAPERGUI_ToolbarItemsDlg::toolbarItems() const { QIntList SHAPERGUI_ToolbarItemsDlg::getItems(QListWidget *theWidget, int theStart) const { QIntList aList; - SHAPERGUI_CommandIdItem *aItem = 0; + SHAPERGUI_CommandIdItem *aItem = nullptr; int aNb = theWidget->count(); for (int i = theStart; i < aNb; i++) { aItem = (SHAPERGUI_CommandIdItem *)theWidget->item(i); diff --git a/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h b/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h index abf3ce83f..a12becaa5 100644 --- a/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h +++ b/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.h @@ -62,7 +62,7 @@ protected: /// An redifinition of a virtual function /// \param theObj an object /// \param theEvent an event - virtual bool eventFilter(QObject *theObj, QEvent *theEvent); + bool eventFilter(QObject *theObj, QEvent *theEvent) override; private slots: /// A slot for button to add an item to toolbar commands diff --git a/src/SHAPERGUI/shapergui_app.cpp b/src/SHAPERGUI/shapergui_app.cpp index 5c1f53c5f..f07f7da7f 100644 --- a/src/SHAPERGUI/shapergui_app.cpp +++ b/src/SHAPERGUI/shapergui_app.cpp @@ -24,7 +24,7 @@ #include -int main(int argc, char *argv[]) { +int main(int /*argc*/, char * /*argv*/[]) { constexpr char GUI_ROOT_DIR[] = "GUI_ROOT_DIR"; constexpr char SHAPER_ROOT_DIR[] = "SHAPER_ROOT_DIR"; constexpr char LIGHTAPPCONFIG[] = "LightAppConfig"; diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_Feature.h b/src/SamplePanelPlugin/SamplePanelPlugin_Feature.h index edfd8bda6..77cb72230 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_Feature.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_Feature.h @@ -45,21 +45,21 @@ public: /// Request for initialization of data model of the object: adding all /// attributes - virtual void initAttributes(); + void initAttributes() override; /// Returns the unique kind of a feature - virtual const std::string &getKind() { + const std::string &getKind() override { static std::string MY_KIND = SamplePanelPlugin_Feature::ID(); return MY_KIND; }; /// Computes or recomputes the results - virtual void execute() {} + void execute() override {} /// Use plugin manager for features creation SamplePanelPlugin_Feature(); }; -typedef std::shared_ptr SamplePanelFeaturePtr; +using SamplePanelFeaturePtr = std::shared_ptr; #endif diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.cpp b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.cpp index 1a53f5b5a..aee11104d 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.cpp +++ b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.cpp @@ -35,13 +35,13 @@ SamplePanelPlugin_ModelWidget::SamplePanelPlugin_ModelWidget( QWidget *theParent, const Config_WidgetAPI *theData) : ModuleBase_ModelWidget(theParent, theData), myDefaultValue(0) { - QVBoxLayout *aLay = new QVBoxLayout(this); + auto *aLay = new QVBoxLayout(this); aLay->setContentsMargins(0, 0, 0, 0); myMainWidget = new QWidget(this); aLay->addWidget(myMainWidget); - QGridLayout *aLayout = new QGridLayout(myMainWidget); + auto *aLayout = new QGridLayout(myMainWidget); aLayout->addWidget(new QLabel(tr("Values:")), 0, 0); myComboBox = new QComboBox(myMainWidget); diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.h b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.h index b7e6a353b..e62242682 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidget.h @@ -42,19 +42,19 @@ public: SamplePanelPlugin_ModelWidget(QWidget *theParent, const Config_WidgetAPI *theData); /// Destructs the model widget - virtual ~SamplePanelPlugin_ModelWidget() {} + ~SamplePanelPlugin_ModelWidget() override = default; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; protected: /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom(); + bool storeValueCustom() override; /// Restore value from attribute data to the widget's control - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; private: QWidget *myMainWidget; // parent control for all widget controls diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.cpp b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.cpp index 5b5983dac..b00e336a8 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.cpp +++ b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.cpp @@ -37,7 +37,7 @@ ModuleBase_ModelWidget * SamplePanelPlugin_ModelWidgetCreator::createWidgetByType( const std::string &theType, QWidget *theParent, Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop * /*theWorkshop*/) { - ModuleBase_ModelWidget *aModelWidget = 0; + ModuleBase_ModelWidget *aModelWidget = nullptr; if (myModelWidgetTypes.find(theType) == myModelWidgetTypes.end()) return aModelWidget; diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.h b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.h index 7caf98c55..10e2e8b7a 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.h @@ -42,11 +42,11 @@ public: SamplePanelPlugin_ModelWidgetCreator(); /// Virtual destructor - ~SamplePanelPlugin_ModelWidgetCreator() {} + ~SamplePanelPlugin_ModelWidgetCreator() = default; /// Returns a container of possible widget types, which this creator can /// process \param a list of type names - virtual void widgetTypes(std::set &theTypes); + void widgetTypes(std::set &theTypes) override; /// Create widget by its type /// The default implementation is empty @@ -55,10 +55,10 @@ public: /// \param theData a low-level API for reading xml definitions of widgets /// \param theWorkshop a current workshop /// \return a created model widget or null - virtual ModuleBase_ModelWidget * + ModuleBase_ModelWidget * createWidgetByType(const std::string &theType, QWidget *theParent, Config_WidgetAPI *theWidgetApi, - ModuleBase_IWorkshop * /*theWorkshop*/); + ModuleBase_IWorkshop * /*theWorkshop*/) override; private: std::set myModelWidgetTypes; /// types of widgets diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_Panel.cpp b/src/SamplePanelPlugin/SamplePanelPlugin_Panel.cpp index 3b3afb485..a8a4528b3 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_Panel.cpp +++ b/src/SamplePanelPlugin/SamplePanelPlugin_Panel.cpp @@ -32,7 +32,7 @@ SamplePanelPlugin_Panel::SamplePanelPlugin_Panel(QWidget *theParent) : QWidget(theParent), myDefaultValue(0) { - QGridLayout *aLayout = new QGridLayout(this); + auto *aLayout = new QGridLayout(this); aLayout->addWidget(new QLabel(tr("Values:")), 0, 0); myComboBox = new QComboBox(this); diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_Panel.h b/src/SamplePanelPlugin/SamplePanelPlugin_Panel.h index da2a6506c..8d34319b2 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_Panel.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_Panel.h @@ -38,7 +38,7 @@ public: /// Constructs a panel page SamplePanelPlugin_Panel(QWidget *theParent); /// Destructs the page - virtual ~SamplePanelPlugin_Panel() {} + ~SamplePanelPlugin_Panel() override = default; /// Fill the panel by the feature /// \param theFeature a feature to fill the panel controls diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.h b/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.h index a2f7b4a1b..564422d9b 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.h @@ -40,7 +40,7 @@ class QWidget; class SamplePanelPlugin_Plugin : public ModelAPI_Plugin { public: /// Creates the feature object of this plugin by the feature string ID - virtual FeaturePtr createFeature(std::string theFeatureID); + FeaturePtr createFeature(std::string theFeatureID) override; public: SamplePanelPlugin_Plugin(); diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.cpp b/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.cpp index a3c8250c5..39f2bdb50 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.cpp +++ b/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.cpp @@ -35,12 +35,12 @@ void SamplePanelPlugin_WidgetCreator::panelTypes( QWidget *SamplePanelPlugin_WidgetCreator::createPanelByType( const std::string &theType, QWidget *theParent, const FeaturePtr &theFeature) { - QWidget *aWidget = 0; + QWidget *aWidget = nullptr; if (myPanelTypes.find(theType) == myPanelTypes.end()) return aWidget; if (theType == "QtPanel") { - SamplePanelPlugin_Panel *aPanel = new SamplePanelPlugin_Panel(theParent); + auto *aPanel = new SamplePanelPlugin_Panel(theParent); aPanel->setFeature(theFeature); aWidget = aPanel; } diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.h b/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.h index 8fad56ce4..9c7a963e1 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_WidgetCreator.h @@ -40,11 +40,11 @@ public: SamplePanelPlugin_WidgetCreator(); /// Virtual destructor - ~SamplePanelPlugin_WidgetCreator() {} + ~SamplePanelPlugin_WidgetCreator() = default; /// Returns a container of possible page types, which this creator can process /// \param theTypes a list of type names - virtual void panelTypes(std::set &theTypes); + void panelTypes(std::set &theTypes) override; /// Create panel control by its type. /// \param theType a panel type diff --git a/src/Selector/Selector_Algo.cpp b/src/Selector/Selector_Algo.cpp index b21f36bd8..b7dfb4c75 100644 --- a/src/Selector/Selector_Algo.cpp +++ b/src/Selector/Selector_Algo.cpp @@ -119,7 +119,7 @@ Selector_Algo *Selector_Algo::select( const TDF_Label theAccess, const TDF_Label theBaseDocument, const bool theGeometricalNaming, const bool theUseNeighbors, const bool theUseIntersections, const bool theAlwaysGeometricalNaming) { - Selector_Algo *aResult = NULL; + Selector_Algo *aResult = nullptr; if (theValue.IsNull() || theContext.IsNull()) return aResult; @@ -134,15 +134,15 @@ Selector_Algo *Selector_Algo::select( if (aSelectionType == TopAbs_COMPOUND || aSelectionType == TopAbs_COMPSOLID || aSelectionType == TopAbs_SHELL || aSelectionType == TopAbs_WIRE) { - Selector_Container *aContainer = new Selector_Container; + auto *aContainer = new Selector_Container; SET_ALGO_FLAGS(aContainer); if (aContainer->select(theContext, theValue)) return aContainer; delete aContainer; - return NULL; + return nullptr; } - Selector_Intersect *anIntersect = new Selector_Intersect; + auto *anIntersect = new Selector_Intersect; SET_ALGO_FLAGS(anIntersect); bool aGoodIntersector = anIntersect->select(theContext, theValue); // weak intersector is bad for not use neighbors and has lower priority than @@ -152,10 +152,10 @@ Selector_Algo *Selector_Algo::select( } if (!theUseNeighbors) { delete anIntersect; - return NULL; + return nullptr; } // searching by neighbors - Selector_FilterByNeighbors *aNBs = new Selector_FilterByNeighbors; + auto *aNBs = new Selector_FilterByNeighbors; SET_ALGO_FLAGS(aNBs); // searching a context lab to store in NB algorithm TDF_Label aContextLab = findGoodLabelWithShape(theAccess, theContext); @@ -176,15 +176,15 @@ Selector_Algo *Selector_Algo::select( // pure weak naming: there is no sense to use pure weak naming for neighbors // selection if (theUseNeighbors) { - Selector_WeakName *aWeak = new Selector_WeakName; + auto *aWeak = new Selector_WeakName; SET_ALGO_FLAGS(aWeak); if (aWeak->select(theContext, theValue)) { return aWeak; } delete aWeak; } - return NULL; // not found value in the tree, not found context shape in the - // tree also + return nullptr; // not found value in the tree, not found context shape in + // the tree also } // getting label of this operation to avoid usage of ready shapes of this TDF_Label aMyOpLab = theAccess; @@ -232,12 +232,12 @@ Selector_Algo *Selector_Algo::select( } if (!aPrimitiveNS.IsNull()) { - Selector_Primitive *aPrimitive = new Selector_Primitive; + auto *aPrimitive = new Selector_Primitive; SET_ALGO_FLAGS(aPrimitive); aPrimitive->select(aPrimitiveNS->Label()); return aPrimitive; } else { - Selector_Modify *aModify = new Selector_Modify; + auto *aModify = new Selector_Modify; SET_ALGO_FLAGS(aModify); bool aGoodModify = aModify->select(aModifList, theContext, theValue); // weak intersector is bad for not use neighbors and has lower priority than @@ -247,10 +247,10 @@ Selector_Algo *Selector_Algo::select( } if (!theUseNeighbors) { delete aModify; - return NULL; + return nullptr; } // searching by neighbors - Selector_FilterByNeighbors *aNBs = new Selector_FilterByNeighbors; + auto *aNBs = new Selector_FilterByNeighbors; SET_ALGO_FLAGS(aNBs); // searching a context lab to store in NB algorithm TDF_Label aContextLab = findGoodLabelWithShape(theAccess, theContext); @@ -269,7 +269,7 @@ Selector_Algo *Selector_Algo::select( delete aModify; } - return NULL; // invalid case + return nullptr; // invalid case } Selector_Algo * @@ -384,9 +384,9 @@ Selector_Algo *Selector_Algo::restoreByLab(TDF_Label theLab, TDF_Label theBaseDocLab) { Handle(TDataStd_Integer) aTypeAttr; if (!theLab.FindAttribute(kSEL_TYPE, aTypeAttr)) - return NULL; - Selector_Type aType = Selector_Type(aTypeAttr->Get()); - Selector_Algo *aResult = NULL; + return nullptr; + auto aType = Selector_Type(aTypeAttr->Get()); + Selector_Algo *aResult = nullptr; switch (aType) { case SELTYPE_CONTAINER: { aResult = new Selector_Container; @@ -421,7 +421,7 @@ Selector_Algo *Selector_Algo::restoreByLab(TDF_Label theLab, aResult->myGeometricalNaming = theLab.IsAttribute(kGEOMETRICAL_NAMING); if (!aResult->restore()) { delete aResult; - aResult = NULL; + aResult = nullptr; } } return aResult; @@ -431,7 +431,7 @@ Selector_Algo *Selector_Algo::restoreByName( TDF_Label theLab, TDF_Label theBaseDocLab, std::wstring theName, const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming, Selector_NameGenerator *theNameGenerator, TDF_Label &theContextLab) { - Selector_Algo *aResult = NULL; + Selector_Algo *aResult = nullptr; if (theName[0] == L'[') { // intersection or container switch (theShapeType) { case TopAbs_COMPOUND: @@ -465,7 +465,7 @@ Selector_Algo *Selector_Algo::restoreByName( aResult->restoreByName(theName, theShapeType, theNameGenerator); if (theContextLab.IsNull()) { delete aResult; - aResult = NULL; + aResult = nullptr; } } return aResult; diff --git a/src/Selector/Selector_AlgoWithSubs.cpp b/src/Selector/Selector_AlgoWithSubs.cpp index b3b830c3e..c14ede749 100644 --- a/src/Selector/Selector_AlgoWithSubs.cpp +++ b/src/Selector/Selector_AlgoWithSubs.cpp @@ -23,7 +23,7 @@ Selector_AlgoWithSubs::Selector_AlgoWithSubs() : Selector_Algo() {} void Selector_AlgoWithSubs::clearSubAlgos() { - std::list::iterator anAlgo = mySubSelList.begin(); + auto anAlgo = mySubSelList.begin(); for (; anAlgo != mySubSelList.end(); anAlgo++) { delete *anAlgo; } diff --git a/src/Selector/Selector_AlgoWithSubs.h b/src/Selector/Selector_AlgoWithSubs.h index 2a2c6310a..8787dfbb1 100644 --- a/src/Selector/Selector_AlgoWithSubs.h +++ b/src/Selector/Selector_AlgoWithSubs.h @@ -37,7 +37,7 @@ public: /// Initializes selector Selector_AlgoWithSubs(); /// Destructor - virtual ~Selector_AlgoWithSubs(); + ~Selector_AlgoWithSubs() override; /// Erases the sub-algorithms stored void clearSubAlgos(); /// Returns the next label for a new sub-selector created diff --git a/src/Selector/Selector_Container.cpp b/src/Selector/Selector_Container.cpp index e6b6bff29..71de5f6df 100644 --- a/src/Selector/Selector_Container.cpp +++ b/src/Selector/Selector_Container.cpp @@ -56,7 +56,7 @@ void Selector_Container::store() { storeType(Selector_Algo::SELTYPE_CONTAINER); // store all sub-selectors TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType); - std::list::const_iterator aSubSel = list().cbegin(); + auto aSubSel = list().cbegin(); for (; aSubSel != list().cend(); aSubSel++) { (*aSubSel)->store(); } @@ -169,7 +169,7 @@ bool Selector_Container::solve(const TopoDS_Shape &theContext) { break; } TopoDS_ListOfShape aSubSelectorShapes; - std::list::const_iterator aSubSel = list().cbegin(); + auto aSubSel = list().cbegin(); for (; aSubSel != list().cend(); aSubSel++) { if (!(*aSubSel)->solve(theContext)) { return false; @@ -187,7 +187,7 @@ std::wstring Selector_Container::name(Selector_NameGenerator *theNameGenerator) { std::wstring aResult; // add names of sub-components one by one in "[]" - std::list::const_iterator aSubSel = list().cbegin(); + auto aSubSel = list().cbegin(); for (; aSubSel != list().cend(); aSubSel++) { aResult += '['; aResult += (*aSubSel)->name(theNameGenerator); diff --git a/src/Selector/Selector_Container.h b/src/Selector/Selector_Container.h index 94b653601..bcdaba30b 100644 --- a/src/Selector/Selector_Container.h +++ b/src/Selector/Selector_Container.h @@ -38,23 +38,23 @@ public: const TopoDS_Shape theValue); /// Stores the name to the label and sub-labels tree - SELECTOR_EXPORT virtual void store() override; + SELECTOR_EXPORT void store() override; /// Restores the selected shape by the topological naming kept in the data /// structure Returns true if it can restore structure correctly - SELECTOR_EXPORT virtual bool restore() override; + SELECTOR_EXPORT bool restore() override; /// Restores the selected shape by the topological name string. /// Returns not empty label of the context. - SELECTOR_EXPORT virtual TDF_Label + SELECTOR_EXPORT TDF_Label restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator *theNameGenerator) override; /// Updates the current shape by the stored topological name - SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override; + SELECTOR_EXPORT bool solve(const TopoDS_Shape &theContext) override; /// Returns the naming name of the selection - SELECTOR_EXPORT virtual std::wstring + SELECTOR_EXPORT std::wstring name(Selector_NameGenerator *theNameGenerator) override; private: diff --git a/src/Selector/Selector_FilterByNeighbors.cpp b/src/Selector/Selector_FilterByNeighbors.cpp index 1181e9949..09e6fb94d 100644 --- a/src/Selector/Selector_FilterByNeighbors.cpp +++ b/src/Selector/Selector_FilterByNeighbors.cpp @@ -114,8 +114,7 @@ findNeighbor(const TopoDS_Shape theContext, const bool theGeometrical) { // searching for neighbors with minimum level int aMinLevel = 0; - std::list>::const_iterator aNBIter = - theNB.cbegin(); + auto aNBIter = theNB.cbegin(); for (; aNBIter != theNB.cend(); aNBIter++) { if (aMinLevel == 0 || aNBIter->second < aMinLevel) { aMinLevel = aNBIter->second; @@ -247,7 +246,7 @@ bool Selector_FilterByNeighbors::select(const TDF_Label theContextLab, } TopoDS_Shape aResult = findNeighbor(theContext, aNBs, geometricalNaming()); if (!aResult.IsNull() && aResult.IsSame(theValue)) { - std::list>::iterator aNBIter = aNBs.begin(); + auto aNBIter = aNBs.begin(); for (; aNBIter != aNBs.end(); aNBIter++) { Selector_Algo *aSubAlgo = Selector_Algo::select( theContext, aNBIter->first, newSubLabel(), baseDocument(), @@ -270,12 +269,12 @@ void Selector_FilterByNeighbors::store() { // store numbers of levels corresponded to the neighbors in sub-selectors Handle(TDataStd_IntegerArray) anArray = TDataStd_IntegerArray::Set( label(), kLEVELS_ARRAY, 0, int(myNBLevel.size()) - 1); - std::list::iterator aLevel = myNBLevel.begin(); + auto aLevel = myNBLevel.begin(); for (int anIndex = 0; aLevel != myNBLevel.end(); aLevel++, anIndex++) { anArray->SetValue(anIndex, Abs(*aLevel)); } // store all sub-selectors - std::list::const_iterator aSubSel = list().cbegin(); + auto aSubSel = list().cbegin(); for (; aSubSel != list().cend(); aSubSel++) { (*aSubSel)->store(); } @@ -307,11 +306,11 @@ bool Selector_FilterByNeighbors::restore() { // some selector fails, try to use rest selectors, myNBLevel becomes // negative: unused if (myNBLevel.size() > list().size()) { - std::list::iterator aListIter = myNBLevel.begin(); + auto aListIter = myNBLevel.begin(); for (size_t a = 0; a < list().size(); a++) aListIter++; *aListIter = -*aListIter; - list().push_back(NULL); + list().push_back(nullptr); } } } @@ -399,8 +398,8 @@ bool Selector_FilterByNeighbors::solve(const TopoDS_Shape &theContext) { std::list> aNBs; /// neighbor sub-shape -> level of neighborhood - std::list::iterator aLevel = myNBLevel.begin(); - std::list::const_iterator aSubSel = list().cbegin(); + auto aLevel = myNBLevel.begin(); + auto aSubSel = list().cbegin(); for (; aSubSel != list().cend(); aSubSel++, aLevel++) { if (*aLevel < 0) continue; // skip because sub-selector is not good @@ -427,8 +426,8 @@ Selector_FilterByNeighbors::name(Selector_NameGenerator *theNameGenerator) { if (aThisContextNameNeeded) aContextName = theNameGenerator->contextName(myContext); std::wstring aResult; - std::list::iterator aLevel = myNBLevel.begin(); - std::list::const_iterator aSubSel = list().cbegin(); + auto aLevel = myNBLevel.begin(); + auto aSubSel = list().cbegin(); for (; aSubSel != list().cend(); aSubSel++, aLevel++) { if (!*aSubSel) continue; diff --git a/src/Selector/Selector_FilterByNeighbors.h b/src/Selector/Selector_FilterByNeighbors.h index df3d630cc..206dc9794 100644 --- a/src/Selector/Selector_FilterByNeighbors.h +++ b/src/Selector/Selector_FilterByNeighbors.h @@ -44,23 +44,23 @@ public: const TopoDS_Shape theValue); /// Stores the name to the label and sub-labels tree - SELECTOR_EXPORT virtual void store() override; + SELECTOR_EXPORT void store() override; /// Restores the selected shape by the topological naming kept in the data /// structure Returns true if it can restore structure correctly - SELECTOR_EXPORT virtual bool restore() override; + SELECTOR_EXPORT bool restore() override; /// Restores the selected shape by the topological name string. /// Returns not empty label of the context. - SELECTOR_EXPORT virtual TDF_Label + SELECTOR_EXPORT TDF_Label restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator *theNameGenerator) override; /// Updates the current shape by the stored topological name - SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override; + SELECTOR_EXPORT bool solve(const TopoDS_Shape &theContext) override; /// Returns the naming name of the selection - SELECTOR_EXPORT virtual std::wstring + SELECTOR_EXPORT std::wstring name(Selector_NameGenerator *theNameGenerator) override; private: diff --git a/src/Selector/Selector_Intersect.cpp b/src/Selector/Selector_Intersect.cpp index 42bd79235..2b9da881f 100644 --- a/src/Selector/Selector_Intersect.cpp +++ b/src/Selector/Selector_Intersect.cpp @@ -162,7 +162,7 @@ void Selector_Intersect::store() { storeType(Selector_Algo::SELTYPE_INTERSECT); // store all sub-selectors TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType); - std::list::const_iterator aSubSel = list().cbegin(); + auto aSubSel = list().cbegin(); for (; aSubSel != list().cend(); aSubSel++) { (*aSubSel)->store(); } @@ -255,7 +255,7 @@ Selector_Intersect::restoreByName(std::wstring theName, bool Selector_Intersect::solve(const TopoDS_Shape &theContext) { TopoDS_Shape aResult; TopoDS_ListOfShape aSubSelectorShapes; - std::list::const_iterator aSubSel = list().cbegin(); + auto aSubSel = list().cbegin(); for (; aSubSel != list().cend(); aSubSel++) { if (!(*aSubSel)->solve(theContext)) { return false; @@ -306,7 +306,7 @@ std::wstring Selector_Intersect::name(Selector_NameGenerator *theNameGenerator) { std::wstring aResult; // add names of sub-components one by one in "[]" +optionally [weak_name_1] - std::list::const_iterator aSubSel = list().cbegin(); + auto aSubSel = list().cbegin(); for (; aSubSel != list().cend(); aSubSel++) { aResult += '['; aResult += (*aSubSel)->name(theNameGenerator); diff --git a/src/Selector/Selector_Intersect.h b/src/Selector/Selector_Intersect.h index 2f3632862..707eeaa8c 100644 --- a/src/Selector/Selector_Intersect.h +++ b/src/Selector/Selector_Intersect.h @@ -41,23 +41,23 @@ public: const TopoDS_Shape theValue); /// Stores the name to the label and sub-labels tree - SELECTOR_EXPORT virtual void store() override; + SELECTOR_EXPORT void store() override; /// Restores the selected shape by the topological naming kept in the data /// structure Returns true if it can restore structure correctly - SELECTOR_EXPORT virtual bool restore() override; + SELECTOR_EXPORT bool restore() override; /// Restores the selected shape by the topological name string. /// Returns not empty label of the context. - SELECTOR_EXPORT virtual TDF_Label + SELECTOR_EXPORT TDF_Label restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator *theNameGenerator) override; /// Updates the current shape by the stored topological name - SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override; + SELECTOR_EXPORT bool solve(const TopoDS_Shape &theContext) override; /// Returns the naming name of the selection - SELECTOR_EXPORT virtual std::wstring + SELECTOR_EXPORT std::wstring name(Selector_NameGenerator *theNameGenerator) override; private: diff --git a/src/Selector/Selector_Modify.cpp b/src/Selector/Selector_Modify.cpp index d498aedf1..35a611587 100644 --- a/src/Selector/Selector_Modify.cpp +++ b/src/Selector/Selector_Modify.cpp @@ -396,12 +396,11 @@ std::wstring Selector_Modify::name(Selector_NameGenerator *theNameGenerator) { return L""; aResult += theNameGenerator->contextName(myFinal) + L"/"; aResult += Locale::Convert::toWString(aName->Get().ToExtString()); - for (TDF_LabelList::iterator aBase = myBases.begin(); aBase != myBases.end(); - aBase++) { - if (!aBase->FindAttribute(TDataStd_Name::GetID(), aName)) + for (auto &myBase : myBases) { + if (!myBase.FindAttribute(TDataStd_Name::GetID(), aName)) return L""; aResult += L"&"; - aResult += theNameGenerator->contextName(*aBase) + L"/"; + aResult += theNameGenerator->contextName(myBase) + L"/"; aResult += Locale::Convert::toWString(aName->Get().ToExtString()); } if (myWeakIndex != -1) { diff --git a/src/Selector/Selector_Modify.h b/src/Selector/Selector_Modify.h index 5e75e6b9c..5326f0670 100644 --- a/src/Selector/Selector_Modify.h +++ b/src/Selector/Selector_Modify.h @@ -48,23 +48,23 @@ public: const TopoDS_Shape theContext, const TopoDS_Shape theValue); /// Stores the name to the label and sub-labels tree - SELECTOR_EXPORT virtual void store() override; + SELECTOR_EXPORT void store() override; /// Restores the selected shape by the topological naming kept in the data /// structure Returns true if it can restore structure correctly - SELECTOR_EXPORT virtual bool restore() override; + SELECTOR_EXPORT bool restore() override; /// Restores the selected shape by the topological name string. /// Returns not empty label of the context. - SELECTOR_EXPORT virtual TDF_Label + SELECTOR_EXPORT TDF_Label restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator *theNameGenerator) override; /// Updates the current shape by the stored topological name - SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override; + SELECTOR_EXPORT bool solve(const TopoDS_Shape &theContext) override; /// Returns the naming name of the selection - SELECTOR_EXPORT virtual std::wstring + SELECTOR_EXPORT std::wstring name(Selector_NameGenerator *theNameGenerator) override; private: diff --git a/src/Selector/Selector_NExplode.cpp b/src/Selector/Selector_NExplode.cpp index 363e3e211..ba466e4f5 100644 --- a/src/Selector/Selector_NExplode.cpp +++ b/src/Selector/Selector_NExplode.cpp @@ -62,7 +62,7 @@ Selector_NExplode::Selector_NExplode(const TopoDS_Shape &theShape, const bool theOldOrder) : myToBeReordered(theOldOrder) { GeomShapePtr aShape = convertShape(theShape); - GeomAPI_Shape::ShapeType aType = (GeomAPI_Shape::ShapeType)theType; + auto aType = (GeomAPI_Shape::ShapeType)theType; mySorted = std::make_shared(aShape, aType, getOrder(theOldOrder)); } diff --git a/src/Selector/Selector_Selector.cpp b/src/Selector/Selector_Selector.cpp index d61d8e484..2afcf99a3 100644 --- a/src/Selector/Selector_Selector.cpp +++ b/src/Selector/Selector_Selector.cpp @@ -30,7 +30,7 @@ #include Selector_Selector::Selector_Selector(TDF_Label theLab, TDF_Label theBaseDocLab) - : myLab(theLab), myBaseDocumentLab(theBaseDocLab), myAlgo(NULL) {} + : myLab(theLab), myBaseDocumentLab(theBaseDocLab), myAlgo(nullptr) {} Selector_Selector::~Selector_Selector() { if (myAlgo) @@ -46,7 +46,7 @@ bool Selector_Selector::select(const TopoDS_Shape theContext, myAlgo = Selector_Algo::select(theContext, theValue, myLab, myBaseDocumentLab, theGeometricalNaming, true, true); - return myAlgo != NULL; + return myAlgo != nullptr; } bool Selector_Selector::store(const TopoDS_Shape theContext) { diff --git a/src/Selector/Selector_WeakName.cpp b/src/Selector/Selector_WeakName.cpp index 726ee47f7..7507e1dce 100644 --- a/src/Selector/Selector_WeakName.cpp +++ b/src/Selector/Selector_WeakName.cpp @@ -30,8 +30,7 @@ #include #include -Selector_WeakName::Selector_WeakName() - : Selector_Algo(), myRecomputeWeakIndex(false) {} +Selector_WeakName::Selector_WeakName() : Selector_Algo() {} bool Selector_WeakName::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue) { diff --git a/src/Selector/Selector_WeakName.h b/src/Selector/Selector_WeakName.h index de6a2c998..a8d36f0ce 100644 --- a/src/Selector/Selector_WeakName.h +++ b/src/Selector/Selector_WeakName.h @@ -31,32 +31,32 @@ class Selector_WeakName : public Selector_Algo { TopAbs_ShapeEnum myShapeType; ///< type of this shape int myWeakIndex; ///< weak index in case modification produces several shapes - bool myRecomputeWeakIndex; ///< if the index is stored with old (unstable) - ///< order, recompute it - TDF_Label myContext; ///< context shape label + bool myRecomputeWeakIndex{false}; ///< if the index is stored with old + ///< (unstable) order, recompute it + TDF_Label myContext; ///< context shape label public: /// Initializes the selection of this kind SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue); /// Stores the name to the label and sub-labels tree - SELECTOR_EXPORT virtual void store() override; + SELECTOR_EXPORT void store() override; /// Restores the selected shape by the topological naming kept in the data /// structure Returns true if it can restore structure correctly - SELECTOR_EXPORT virtual bool restore() override; + SELECTOR_EXPORT bool restore() override; /// Restores the selected shape by the topological name string. /// Returns not empty label of the context. - SELECTOR_EXPORT virtual TDF_Label + SELECTOR_EXPORT TDF_Label restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator *theNameGenerator) override; /// Updates the current shape by the stored topological name - SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override; + SELECTOR_EXPORT bool solve(const TopoDS_Shape &theContext) override; /// Returns the naming name of the selection - SELECTOR_EXPORT virtual std::wstring + SELECTOR_EXPORT std::wstring name(Selector_NameGenerator *theNameGenerator) override; private: diff --git a/src/SketchAPI/SketchAPI_Arc.cpp b/src/SketchAPI/SketchAPI_Arc.cpp index de420ce8e..3d4ea8c6e 100644 --- a/src/SketchAPI/SketchAPI_Arc.cpp +++ b/src/SketchAPI/SketchAPI_Arc.cpp @@ -82,7 +82,7 @@ SketchAPI_Arc::SketchAPI_Arc( } //================================================================================================ -SketchAPI_Arc::~SketchAPI_Arc() {} +SketchAPI_Arc::~SketchAPI_Arc() = default; //================================================================================================ void SketchAPI_Arc::setByCenterStartEnd(double theCenterX, double theCenterY, diff --git a/src/SketchAPI/SketchAPI_Arc.h b/src/SketchAPI/SketchAPI_Arc.h index edfd24c02..2b801d022 100644 --- a/src/SketchAPI/SketchAPI_Arc.h +++ b/src/SketchAPI/SketchAPI_Arc.h @@ -66,7 +66,7 @@ public: /// Destructor. SKETCHAPI_EXPORT - virtual ~SketchAPI_Arc(); + ~SketchAPI_Arc() override; INTERFACE_7(SketchPlugin_Arc::ID(), center, SketchPlugin_Arc::CENTER_ID(), GeomDataAPI_Point2D, /** Center point */, startPoint, @@ -104,10 +104,10 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Arc object. -typedef std::shared_ptr ArcPtr; +using ArcPtr = std::shared_ptr; #endif // SketchAPI_Arc_H_ diff --git a/src/SketchAPI/SketchAPI_BSpline.cpp b/src/SketchAPI/SketchAPI_BSpline.cpp index 79faedfbf..7e23ffdf8 100644 --- a/src/SketchAPI/SketchAPI_BSpline.cpp +++ b/src/SketchAPI/SketchAPI_BSpline.cpp @@ -54,7 +54,7 @@ SketchAPI_BSpline::SketchAPI_BSpline( initialize(); } -SketchAPI_BSpline::~SketchAPI_BSpline() {} +SketchAPI_BSpline::~SketchAPI_BSpline() = default; void SketchAPI_BSpline::setByDegreePolesAndWeights( const ModelHighAPI_Integer &theDegree, @@ -116,11 +116,10 @@ void SketchAPI_BSpline::setByExternal( static CompositeFeaturePtr sketchForFeature(FeaturePtr theFeature) { const std::set &aRefs = theFeature->data()->refsToMe(); - for (std::set::const_iterator anIt = aRefs.begin(); - anIt != aRefs.end(); ++anIt) - if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID()) + for (const auto &aRef : aRefs) + if (aRef->id() == SketchPlugin_Sketch::FEATURES_ID()) return std::dynamic_pointer_cast( - (*anIt)->owner()); + aRef->owner()); return CompositeFeaturePtr(); } @@ -206,10 +205,10 @@ static void createSegment(const CompositeFeaturePtr &theSketch, static void toMapOfAuxIndices(const std::list &theRegular, const std::list &theAuxiliary, std::map &theIndices) { - for (auto it = theRegular.begin(); it != theRegular.end(); ++it) - theIndices[*it] = false; - for (auto it = theAuxiliary.begin(); it != theAuxiliary.end(); ++it) - theIndices[*it] = true; + for (int it : theRegular) + theIndices[it] = false; + for (int it : theAuxiliary) + theIndices[it] = true; } std::list> @@ -224,8 +223,8 @@ SketchAPI_BSpline::controlPoles(const std::list ®ular, CompositeFeaturePtr aSketch = sketchForFeature(aBSpline); AttributePoint2DArrayPtr aPoles = poles(); - for (auto it = anAux.begin(); it != anAux.end(); ++it) - createPole(aSketch, aBSpline, aPoles, it->first, it->second, anEntities); + for (auto &it : anAux) + createPole(aSketch, aBSpline, aPoles, it.first, it.second, anEntities); return SketchAPI_SketchEntity::wrap(anEntities); } @@ -242,8 +241,8 @@ SketchAPI_BSpline::controlPolygon(const std::list ®ular, CompositeFeaturePtr aSketch = sketchForFeature(aBSpline); AttributePoint2DArrayPtr aPoles = poles(); - for (auto it = anAux.begin(); it != anAux.end(); ++it) - createSegment(aSketch, aBSpline, aPoles, it->first, it->second, anEntities); + for (auto &it : anAux) + createSegment(aSketch, aBSpline, aPoles, it.first, it.second, anEntities); return SketchAPI_SketchEntity::wrap(anEntities); } @@ -256,9 +255,8 @@ void SketchAPI_BSpline::getDefaultParameters( std::shared_ptr aBSplineCurve; try { std::list aWeights; - for (std::list::const_iterator it = theWeights.begin(); - it != theWeights.end(); ++it) - aWeights.push_back(it->value()); + for (const auto &theWeight : theWeights) + aWeights.push_back(theWeight.value()); bool isPeriodic = feature()->getKind() == SketchPlugin_BSplinePeriodic::ID(); @@ -316,14 +314,14 @@ void SketchAPI_BSpline::checkDefaultParameters( isDefaultKnotsMults = aKnotsAttr->size() == (int)aKnots.size() && aMultsAttr->size() == (int)aMults.size(); if (isDefaultKnotsMults) { - std::list::iterator anIt = aKnots.begin(); + auto anIt = aKnots.begin(); for (int anIndex = 0; isDefaultKnotsMults && anIt != aKnots.end(); ++anIt, ++anIndex) isDefaultKnotsMults = fabs(anIt->value() - aKnotsAttr->value(anIndex)) < TOLERANCE; } if (isDefaultKnotsMults) { - std::list::iterator anIt = aMults.begin(); + auto anIt = aMults.begin(); for (int anIndex = 0; isDefaultKnotsMults && anIt != aMults.end(); ++anIt, ++anIndex) isDefaultKnotsMults = anIt->intValue() == aMultsAttr->value(anIndex); @@ -356,9 +354,8 @@ static void collectAuxiliaryFeatures(FeaturePtr theBSpline, std::map &thePoints, std::map &theSegments) { const std::set &aRefs = theBSpline->data()->refsToMe(); - for (std::set::const_iterator aRefIt = aRefs.begin(); - aRefIt != aRefs.end(); ++aRefIt) { - FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); + for (const auto &aRef : aRefs) { + FeaturePtr anOwner = ModelAPI_Feature::feature(aRef->owner()); if (anOwner->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID()) { // process internal constraints only @@ -440,7 +437,7 @@ static void dumpList(ModelHighAPI_Dumper &theDumper, const std::string &theAttrName, const std::set &theIndices) { theDumper << theAttrName << " = ["; - std::set::const_iterator it = theIndices.begin(); + auto it = theIndices.begin(); theDumper << *it; for (++it; it != theIndices.end(); ++it) theDumper << ", " << *it; @@ -455,18 +452,18 @@ void SketchAPI_BSpline::dumpControlPolygon( bool isFirst = true; // dump features and split them to auxiliary and regular std::set aRegular, anAuxiliary; - for (std::map::const_iterator it = theAuxFeatures.begin(); - it != theAuxFeatures.end(); ++it) { + for (const auto &theAuxFeature : theAuxFeatures) { if (!isFirst) theDumper << ", "; - theDumper << theDumper.name(it->second, false); - theDumper.doNotDumpFeature(it->second); + theDumper << theDumper.name(theAuxFeature.second, false); + theDumper.doNotDumpFeature(theAuxFeature.second); isFirst = false; - if (it->second->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) - anAuxiliary.insert(it->first); + if (theAuxFeature.second->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + ->value()) + anAuxiliary.insert(theAuxFeature.first); else - aRegular.insert(it->first); + aRegular.insert(theAuxFeature.first); } theDumper << "] = " << theDumper.name(theBSpline) << "." << theMethod << "("; if (!aRegular.empty()) { @@ -506,7 +503,7 @@ bool SketchAPI_BSpline::insertPole(const int theIndex, // update coordinates of points of control polygon std::map aPoints, aLines; collectAuxiliaryFeatures(feature(), aPoints, aLines); - std::map::iterator aFound = aPoints.find(anIndex); + auto aFound = aPoints.find(anIndex); if (aFound != aPoints.end()) setCoordinates(aFound->second, SketchPlugin_Point::COORD_ID(), theCoordinates); diff --git a/src/SketchAPI/SketchAPI_BSpline.h b/src/SketchAPI/SketchAPI_BSpline.h index a4a5e839e..437c7ee12 100644 --- a/src/SketchAPI/SketchAPI_BSpline.h +++ b/src/SketchAPI/SketchAPI_BSpline.h @@ -48,7 +48,7 @@ public: /// Destructor. SKETCHAPI_EXPORT - virtual ~SketchAPI_BSpline(); + ~SketchAPI_BSpline() override; INTERFACE_8( SketchPlugin_BSpline::ID(), poles, SketchPlugin_BSplineBase::POLES_ID(), @@ -107,7 +107,7 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; protected: SketchAPI_BSpline(const std::shared_ptr &theFeature, @@ -137,7 +137,7 @@ private: }; /// Pointer on B-spline object. -typedef std::shared_ptr BSplinePtr; +using BSplinePtr = std::shared_ptr; /// \class SketchAPI_BSplinePeriodic /// \ingroup CPPHighAPI @@ -151,10 +151,10 @@ public: /// Destructor. SKETCHAPI_EXPORT - virtual ~SketchAPI_BSplinePeriodic() {} + ~SketchAPI_BSplinePeriodic() override = default; static std::string ID() { return SketchPlugin_BSplinePeriodic::ID(); } - virtual std::string getID() { return SketchPlugin_BSplinePeriodic::ID(); } + std::string getID() override { return SketchPlugin_BSplinePeriodic::ID(); } }; #endif // SketchAPI_BSpline_H_ diff --git a/src/SketchAPI/SketchAPI_Circle.cpp b/src/SketchAPI/SketchAPI_Circle.cpp index 2dbafac2c..53f8ad025 100644 --- a/src/SketchAPI/SketchAPI_Circle.cpp +++ b/src/SketchAPI/SketchAPI_Circle.cpp @@ -75,7 +75,7 @@ SketchAPI_Circle::SketchAPI_Circle( } //================================================================================================== -SketchAPI_Circle::~SketchAPI_Circle() {} +SketchAPI_Circle::~SketchAPI_Circle() = default; //================================================================================================== void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, diff --git a/src/SketchAPI/SketchAPI_Circle.h b/src/SketchAPI/SketchAPI_Circle.h index 9992b2117..0b3d2d532 100644 --- a/src/SketchAPI/SketchAPI_Circle.h +++ b/src/SketchAPI/SketchAPI_Circle.h @@ -61,7 +61,7 @@ public: /// Destructor. SKETCHAPI_EXPORT - virtual ~SketchAPI_Circle(); + ~SketchAPI_Circle() override; INTERFACE_3(SketchPlugin_Circle::ID(), center, SketchPlugin_Circle::CENTER_ID(), GeomDataAPI_Point2D, @@ -102,10 +102,10 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Circle object. -typedef std::shared_ptr CirclePtr; +using CirclePtr = std::shared_ptr; #endif // SketchAPI_Circle_H_ diff --git a/src/SketchAPI/SketchAPI_Constraint.cpp b/src/SketchAPI/SketchAPI_Constraint.cpp index fd70ba5a2..e740df3c0 100644 --- a/src/SketchAPI/SketchAPI_Constraint.cpp +++ b/src/SketchAPI/SketchAPI_Constraint.cpp @@ -57,7 +57,7 @@ SketchAPI_Constraint::SketchAPI_Constraint( initialize(); } -SketchAPI_Constraint::~SketchAPI_Constraint() {} +SketchAPI_Constraint::~SketchAPI_Constraint() = default; bool SketchAPI_Constraint::initialize() { if (!feature()) { @@ -194,7 +194,7 @@ void SketchAPI_Constraint::dump(ModelHighAPI_Dumper &theDumper) const { return; AttributeSelectionPtr aAttr = aFeature->data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); - if (aAttr && aAttr->context().get() != NULL && !aAttr->isInvalid()) + if (aAttr && aAttr->context().get() != nullptr && !aAttr->isInvalid()) return; } diff --git a/src/SketchAPI/SketchAPI_Constraint.h b/src/SketchAPI/SketchAPI_Constraint.h index e157f4385..f0d4dba35 100644 --- a/src/SketchAPI/SketchAPI_Constraint.h +++ b/src/SketchAPI/SketchAPI_Constraint.h @@ -45,7 +45,7 @@ public: /// Destructor SKETCHAPI_EXPORT - virtual ~SketchAPI_Constraint(); + ~SketchAPI_Constraint() override; static std::string ID() { static const std::string MY_SKETCH_CONSTRAINT_ID = "SketchConstraint"; @@ -67,7 +67,7 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; protected: // Check all attributes of constraint are already dumped. diff --git a/src/SketchAPI/SketchAPI_ConstraintAngle.h b/src/SketchAPI/SketchAPI_ConstraintAngle.h index 9d8aa7f67..9bb262510 100644 --- a/src/SketchAPI/SketchAPI_ConstraintAngle.h +++ b/src/SketchAPI/SketchAPI_ConstraintAngle.h @@ -40,11 +40,11 @@ public: static const std::string MY_SKETCH_CONSTRAINT_ID = "SketchConstraintAngle"; return MY_SKETCH_CONSTRAINT_ID; } - virtual std::string getID() { return ID(); } + std::string getID() override { return ID(); } /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; #endif diff --git a/src/SketchAPI/SketchAPI_Ellipse.cpp b/src/SketchAPI/SketchAPI_Ellipse.cpp index a822bcaac..7005bc659 100644 --- a/src/SketchAPI/SketchAPI_Ellipse.cpp +++ b/src/SketchAPI/SketchAPI_Ellipse.cpp @@ -83,7 +83,7 @@ SketchAPI_Ellipse::SketchAPI_Ellipse( } } -SketchAPI_Ellipse::~SketchAPI_Ellipse() {} +SketchAPI_Ellipse::~SketchAPI_Ellipse() = default; void SketchAPI_Ellipse::setByCenterFocusAndRadius(double theCenterX, double theCenterY, @@ -168,11 +168,10 @@ static const std::list &ellipseAttrAndDumpNames() { static CompositeFeaturePtr sketchForFeature(FeaturePtr theFeature) { const std::set &aRefs = theFeature->data()->refsToMe(); - for (std::set::const_iterator anIt = aRefs.begin(); - anIt != aRefs.end(); ++anIt) - if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID()) + for (const auto &aRef : aRefs) + if (aRef->id() == SketchPlugin_Sketch::FEATURES_ID()) return std::dynamic_pointer_cast( - (*anIt)->owner()); + aRef->owner()); return CompositeFeaturePtr(); } @@ -306,7 +305,7 @@ SketchAPI_Ellipse::buildConstructionEntities( CompositeFeaturePtr aSketch = sketchForFeature(theEllipse); std::list anEntities; - std::list::const_iterator anAttrIt = theAttributes.begin(); + auto anAttrIt = theAttributes.begin(); createPoint(aSketch, theEllipse, (anAttrIt++)->first, theCenter, anEntities); createPoint(aSketch, theEllipse, (anAttrIt++)->first, theFirstFocus, anEntities); @@ -367,9 +366,8 @@ void SketchAPI_Ellipse::collectAuxiliaryFeatures( const std::pair &theMinorAxis, std::map &theAttrToFeature) { const std::set &aRefs = theEllipse->data()->refsToMe(); - for (std::set::const_iterator aRefIt = aRefs.begin(); - aRefIt != aRefs.end(); ++aRefIt) { - FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); + for (const auto &aRef : aRefs) { + FeaturePtr anOwner = ModelAPI_Feature::feature(aRef->owner()); if (anOwner->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID()) { // process internal constraints only @@ -429,10 +427,8 @@ void SketchAPI_Ellipse::dumpConstructionEntities( theDumper << "["; bool isFirst = true; - for (std::list::iterator anIt = anAttributes.begin(); - anIt != anAttributes.end(); ++anIt) { - std::map::const_iterator aFound = - theAuxFeatures.find(anIt->first); + for (auto &anAttribute : anAttributes) { + auto aFound = theAuxFeatures.find(anAttribute.first); if (aFound == theAuxFeatures.end()) continue; if (!isFirst) @@ -443,16 +439,14 @@ void SketchAPI_Ellipse::dumpConstructionEntities( } theDumper << "] = " << theDumper.name(theEllipse) << ".construction("; isFirst = true; - for (std::list::iterator anIt = anAttributes.begin(); - anIt != anAttributes.end(); ++anIt) { - std::map::const_iterator aFound = - theAuxFeatures.find(anIt->first); + for (auto &anAttribute : anAttributes) { + auto aFound = theAuxFeatures.find(anAttribute.first); if (aFound == theAuxFeatures.end()) continue; if (!isFirst) theDumper << ", "; isFirst = false; - theDumper << anIt->second << " = \""; + theDumper << anAttribute.second << " = \""; if (aFound->second->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) ->value()) theDumper << AUXILIARY_VALUE; diff --git a/src/SketchAPI/SketchAPI_Ellipse.h b/src/SketchAPI/SketchAPI_Ellipse.h index 527340dbe..e5c5fbde8 100644 --- a/src/SketchAPI/SketchAPI_Ellipse.h +++ b/src/SketchAPI/SketchAPI_Ellipse.h @@ -28,7 +28,7 @@ class ModelHighAPI_Selection; -typedef std::pair PairOfStrings; +using PairOfStrings = std::pair; /// \class SketchAPI_Ellipse /// \ingroup CPPHighAPI @@ -65,7 +65,7 @@ public: /// Destructor. SKETCHAPI_EXPORT - virtual ~SketchAPI_Ellipse(); + ~SketchAPI_Ellipse() override; INTERFACE_10(SketchPlugin_Ellipse::ID(), center, SketchPlugin_Ellipse::CENTER_ID(), GeomDataAPI_Point2D, @@ -148,7 +148,7 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; private: /// Find all features connected with theEllipse by the internal coincidence. @@ -192,6 +192,6 @@ private: }; /// Pointer on Ellipse object. -typedef std::shared_ptr EllipsePtr; +using EllipsePtr = std::shared_ptr; #endif // SketchPlugin_Ellipse_H_ diff --git a/src/SketchAPI/SketchAPI_EllipticArc.cpp b/src/SketchAPI/SketchAPI_EllipticArc.cpp index 5f3f7110e..a86f7330f 100644 --- a/src/SketchAPI/SketchAPI_EllipticArc.cpp +++ b/src/SketchAPI/SketchAPI_EllipticArc.cpp @@ -80,7 +80,7 @@ SketchAPI_EllipticArc::SketchAPI_EllipticArc( } } -SketchAPI_EllipticArc::~SketchAPI_EllipticArc() {} +SketchAPI_EllipticArc::~SketchAPI_EllipticArc() = default; void SketchAPI_EllipticArc::setByCenterFocusAndPoints( double theCenterX, double theCenterY, double theFocusX, double theFocusY, diff --git a/src/SketchAPI/SketchAPI_EllipticArc.h b/src/SketchAPI/SketchAPI_EllipticArc.h index ffcf22205..faa648da6 100644 --- a/src/SketchAPI/SketchAPI_EllipticArc.h +++ b/src/SketchAPI/SketchAPI_EllipticArc.h @@ -66,7 +66,7 @@ public: /// Destructor. SKETCHAPI_EXPORT - virtual ~SketchAPI_EllipticArc(); + ~SketchAPI_EllipticArc() override; INTERFACE_13(SketchPlugin_EllipticArc::ID(), center, SketchPlugin_EllipticArc::CENTER_ID(), GeomDataAPI_Point2D, @@ -158,10 +158,10 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Ellipse object. -typedef std::shared_ptr EllipticArcPtr; +using EllipticArcPtr = std::shared_ptr; #endif // SketchAPI_EllipticArc_H_ diff --git a/src/SketchAPI/SketchAPI_IntersectionPoint.cpp b/src/SketchAPI/SketchAPI_IntersectionPoint.cpp index ab58b63ea..a85e8cb79 100644 --- a/src/SketchAPI/SketchAPI_IntersectionPoint.cpp +++ b/src/SketchAPI/SketchAPI_IntersectionPoint.cpp @@ -53,7 +53,7 @@ SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint( } } -SketchAPI_IntersectionPoint::~SketchAPI_IntersectionPoint() {} +SketchAPI_IntersectionPoint::~SketchAPI_IntersectionPoint() = default; //-------------------------------------------------------------------------------------- void SketchAPI_IntersectionPoint::setByExternalEdge( @@ -86,9 +86,8 @@ SketchAPI_IntersectionPoint::intersectionPoints() const { feature() ->reflist(SketchPlugin_IntersectionPoint::INTERSECTION_POINTS_ID()) ->list(); - for (std::list::iterator anIt = anIntersections.begin(); - anIt != anIntersections.end(); ++anIt) { - FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); + for (auto &anIntersection : anIntersections) { + FeaturePtr aFeature = ModelAPI_Feature::feature(anIntersection); if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID()) { std::shared_ptr anEnt( new SketchAPI_Point(aFeature)); diff --git a/src/SketchAPI/SketchAPI_IntersectionPoint.h b/src/SketchAPI/SketchAPI_IntersectionPoint.h index ceb234e55..c6a875fcc 100644 --- a/src/SketchAPI/SketchAPI_IntersectionPoint.h +++ b/src/SketchAPI/SketchAPI_IntersectionPoint.h @@ -52,7 +52,7 @@ public: const std::wstring &theExternalName); /// Destructor SKETCHAPI_EXPORT - virtual ~SketchAPI_IntersectionPoint(); + ~SketchAPI_IntersectionPoint() override; INTERFACE_3(SketchPlugin_IntersectionPoint::ID(), externalFeature, SketchPlugin_IntersectionPoint::EXTERNAL_FEATURE_ID(), @@ -81,11 +81,11 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; //! Pointer on IntersectionPoint object -typedef std::shared_ptr IntersectionPointPtr; +using IntersectionPointPtr = std::shared_ptr; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/SketchAPI/SketchAPI_Line.cpp b/src/SketchAPI/SketchAPI_Line.cpp index e4116dd90..9e1725ae1 100644 --- a/src/SketchAPI/SketchAPI_Line.cpp +++ b/src/SketchAPI/SketchAPI_Line.cpp @@ -69,7 +69,7 @@ SketchAPI_Line::SketchAPI_Line( } } -SketchAPI_Line::~SketchAPI_Line() {} +SketchAPI_Line::~SketchAPI_Line() = default; //-------------------------------------------------------------------------------------- void SketchAPI_Line::setByCoordinates(double theX1, double theY1, double theX2, diff --git a/src/SketchAPI/SketchAPI_Line.h b/src/SketchAPI/SketchAPI_Line.h index a2facccb9..62bce1660 100644 --- a/src/SketchAPI/SketchAPI_Line.h +++ b/src/SketchAPI/SketchAPI_Line.h @@ -60,7 +60,7 @@ public: const std::wstring &theExternalName); /// Destructor SKETCHAPI_EXPORT - virtual ~SketchAPI_Line(); + ~SketchAPI_Line() override; INTERFACE_3(SketchPlugin_Line::ID(), startPoint, SketchPlugin_Line::START_ID(), GeomDataAPI_Point2D, @@ -105,11 +105,11 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; //! Pointer on Line object -typedef std::shared_ptr LinePtr; +using LinePtr = std::shared_ptr; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/SketchAPI/SketchAPI_MacroCircle.cpp b/src/SketchAPI/SketchAPI_MacroCircle.cpp index 685fc465a..c502bcca2 100644 --- a/src/SketchAPI/SketchAPI_MacroCircle.cpp +++ b/src/SketchAPI/SketchAPI_MacroCircle.cpp @@ -78,7 +78,7 @@ SketchAPI_MacroCircle::SketchAPI_MacroCircle( } //================================================================================================== -SketchAPI_MacroCircle::~SketchAPI_MacroCircle() {} +SketchAPI_MacroCircle::~SketchAPI_MacroCircle() = default; //================================================================================================== void SketchAPI_MacroCircle::setByCenterAndPassedPoints(double theCenterX, diff --git a/src/SketchAPI/SketchAPI_MacroCircle.h b/src/SketchAPI/SketchAPI_MacroCircle.h index 130ff19d9..c02fedb25 100644 --- a/src/SketchAPI/SketchAPI_MacroCircle.h +++ b/src/SketchAPI/SketchAPI_MacroCircle.h @@ -65,7 +65,7 @@ public: /// Destructor. SKETCHAPI_EXPORT - virtual ~SketchAPI_MacroCircle(); + ~SketchAPI_MacroCircle() override; INTERFACE_6(SketchPlugin_MacroCircle::ID(), circleType, SketchPlugin_MacroCircle::CIRCLE_TYPE(), ModelAPI_AttributeString, @@ -102,6 +102,6 @@ private: }; /// Pointer on Circle object. -typedef std::shared_ptr MacroCirclePtr; +using MacroCirclePtr = std::shared_ptr; #endif // SketchAPI_MacroCircle_H_ diff --git a/src/SketchAPI/SketchAPI_MacroEllipse.cpp b/src/SketchAPI/SketchAPI_MacroEllipse.cpp index a5aadfc1b..e054b511e 100644 --- a/src/SketchAPI/SketchAPI_MacroEllipse.cpp +++ b/src/SketchAPI/SketchAPI_MacroEllipse.cpp @@ -99,7 +99,7 @@ SketchAPI_MacroEllipse::SketchAPI_MacroEllipse( } } -SketchAPI_MacroEllipse::~SketchAPI_MacroEllipse() {} +SketchAPI_MacroEllipse::~SketchAPI_MacroEllipse() = default; static void fillAttribute(const std::shared_ptr &thePoint, const ModelHighAPI_RefAttr &thePointRef, @@ -185,11 +185,10 @@ void SketchAPI_MacroEllipse::setByMajorAxisAndPassedPoint( void SketchAPI_MacroEllipse::storeSketch(const FeaturePtr &theFeature) { const std::set &aRefs = theFeature->data()->refsToMe(); - for (std::set::const_iterator anIt = aRefs.begin(); - anIt != aRefs.end(); ++anIt) - if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID()) { - mySketch = std::dynamic_pointer_cast( - (*anIt)->owner()); + for (const auto &aRef : aRefs) + if (aRef->id() == SketchPlugin_Sketch::FEATURES_ID()) { + mySketch = + std::dynamic_pointer_cast(aRef->owner()); break; } } diff --git a/src/SketchAPI/SketchAPI_MacroEllipse.h b/src/SketchAPI/SketchAPI_MacroEllipse.h index cdd3bdde6..aa066bd30 100644 --- a/src/SketchAPI/SketchAPI_MacroEllipse.h +++ b/src/SketchAPI/SketchAPI_MacroEllipse.h @@ -68,7 +68,7 @@ public: /// Destructor. SKETCHAPI_EXPORT - virtual ~SketchAPI_MacroEllipse(); + ~SketchAPI_MacroEllipse() override; INTERFACE_1(SketchPlugin_MacroEllipse::ID(), ellipseType, SketchPlugin_MacroEllipse::ELLIPSE_TYPE(), @@ -133,6 +133,6 @@ private: }; /// Pointer on Circle object. -typedef std::shared_ptr MacroEllipsePtr; +using MacroEllipsePtr = std::shared_ptr; #endif // SketchAPI_MacroEllipse_H_ diff --git a/src/SketchAPI/SketchAPI_MacroEllipticArc.cpp b/src/SketchAPI/SketchAPI_MacroEllipticArc.cpp index e974a12ea..e230fc128 100644 --- a/src/SketchAPI/SketchAPI_MacroEllipticArc.cpp +++ b/src/SketchAPI/SketchAPI_MacroEllipticArc.cpp @@ -93,4 +93,4 @@ SketchAPI_MacroEllipticArc::SketchAPI_MacroEllipticArc( } } -SketchAPI_MacroEllipticArc::~SketchAPI_MacroEllipticArc() {} +SketchAPI_MacroEllipticArc::~SketchAPI_MacroEllipticArc() = default; diff --git a/src/SketchAPI/SketchAPI_MacroEllipticArc.h b/src/SketchAPI/SketchAPI_MacroEllipticArc.h index 9616e1b5a..c7733f9a0 100644 --- a/src/SketchAPI/SketchAPI_MacroEllipticArc.h +++ b/src/SketchAPI/SketchAPI_MacroEllipticArc.h @@ -51,7 +51,7 @@ public: /// Destructor. SKETCHAPI_EXPORT - virtual ~SketchAPI_MacroEllipticArc(); + ~SketchAPI_MacroEllipticArc() override; INTERFACE_3(SketchPlugin_MacroEllipticArc::ID(), startPoint, SketchPlugin_MacroEllipticArc::START_POINT_ID(), @@ -64,6 +64,6 @@ public: }; /// Pointer on Elliptic Arc object. -typedef std::shared_ptr MacroEllipticArcPtr; +using MacroEllipticArcPtr = std::shared_ptr; #endif // SketchAPI_MacroEllipticArc_H_ diff --git a/src/SketchAPI/SketchAPI_Mirror.cpp b/src/SketchAPI/SketchAPI_Mirror.cpp index ce4a0714f..835c73f15 100644 --- a/src/SketchAPI/SketchAPI_Mirror.cpp +++ b/src/SketchAPI/SketchAPI_Mirror.cpp @@ -42,7 +42,7 @@ SketchAPI_Mirror::SketchAPI_Mirror( } } -SketchAPI_Mirror::~SketchAPI_Mirror() {} +SketchAPI_Mirror::~SketchAPI_Mirror() = default; void SketchAPI_Mirror::setMirrorList( const std::list> &theObjects) { @@ -82,8 +82,7 @@ void SketchAPI_Mirror::dump(ModelHighAPI_Dumper &theDumper) const { // the number of dumped aMirrorObjects is not changed, no need to dump // anything static std::map aNbDumpedArguments; - std::map::iterator aFound = - aNbDumpedArguments.find(aBase); + auto aFound = aNbDumpedArguments.find(aBase); if (aFound != aNbDumpedArguments.end() && aFound->second == aFirstNotDumped) { theDumper.postpone(aBase); return; diff --git a/src/SketchAPI/SketchAPI_Mirror.h b/src/SketchAPI/SketchAPI_Mirror.h index 71fdb5614..181333043 100644 --- a/src/SketchAPI/SketchAPI_Mirror.h +++ b/src/SketchAPI/SketchAPI_Mirror.h @@ -53,7 +53,7 @@ public: const std::list> &theObjects); /// Destructor SKETCHAPI_EXPORT - virtual ~SketchAPI_Mirror(); + ~SketchAPI_Mirror() override; INTERFACE_4(SketchPlugin_ConstraintMirror::ID(), mirrorLine, SketchPlugin_ConstraintMirror::ENTITY_A(), @@ -76,11 +76,11 @@ public: std::list> mirrored() const; /// Dump wrapped feature - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; //! Pointer on Mirror object -typedef std::shared_ptr MirrorPtr; +using MirrorPtr = std::shared_ptr; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/SketchAPI/SketchAPI_Offset.cpp b/src/SketchAPI/SketchAPI_Offset.cpp index 16cc17c0c..3b42f308d 100644 --- a/src/SketchAPI/SketchAPI_Offset.cpp +++ b/src/SketchAPI/SketchAPI_Offset.cpp @@ -49,7 +49,7 @@ SketchAPI_Offset::SketchAPI_Offset( } } -SketchAPI_Offset::~SketchAPI_Offset() {} +SketchAPI_Offset::~SketchAPI_Offset() = default; std::list> SketchAPI_Offset::offset() const { diff --git a/src/SketchAPI/SketchAPI_Offset.h b/src/SketchAPI/SketchAPI_Offset.h index 7b184e14a..5c3f0e99a 100644 --- a/src/SketchAPI/SketchAPI_Offset.h +++ b/src/SketchAPI/SketchAPI_Offset.h @@ -58,7 +58,7 @@ public: const bool theIsApprox = false); /// Destructor SKETCHAPI_EXPORT - virtual ~SketchAPI_Offset(); + ~SketchAPI_Offset() override; INTERFACE_5(SketchPlugin_Offset::ID(), @@ -83,11 +83,11 @@ public: std::list> offset() const; /// Dump wrapped feature - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; //! Pointer on Offset object -typedef std::shared_ptr OffsetPtr; +using OffsetPtr = std::shared_ptr; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/SketchAPI/SketchAPI_Point.cpp b/src/SketchAPI/SketchAPI_Point.cpp index 0589901b2..e9b4da304 100644 --- a/src/SketchAPI/SketchAPI_Point.cpp +++ b/src/SketchAPI/SketchAPI_Point.cpp @@ -68,7 +68,7 @@ SketchAPI_Point::SketchAPI_Point( } } -SketchAPI_Point::~SketchAPI_Point() {} +SketchAPI_Point::~SketchAPI_Point() = default; //-------------------------------------------------------------------------------------- void SketchAPI_Point::setCoordinates(double theX, double theY) { diff --git a/src/SketchAPI/SketchAPI_Projection.cpp b/src/SketchAPI/SketchAPI_Projection.cpp index 366bc4834..d730fb035 100644 --- a/src/SketchAPI/SketchAPI_Projection.cpp +++ b/src/SketchAPI/SketchAPI_Projection.cpp @@ -55,7 +55,7 @@ SketchAPI_Projection::SketchAPI_Projection( } } -SketchAPI_Projection::~SketchAPI_Projection() {} +SketchAPI_Projection::~SketchAPI_Projection() = default; //-------------------------------------------------------------------------------------- void SketchAPI_Projection::setExternalFeature( diff --git a/src/SketchAPI/SketchAPI_Projection.h b/src/SketchAPI/SketchAPI_Projection.h index cb2edbf63..908bd3f92 100644 --- a/src/SketchAPI/SketchAPI_Projection.h +++ b/src/SketchAPI/SketchAPI_Projection.h @@ -46,7 +46,7 @@ public: const ModelHighAPI_Selection &theExternalFeature); /// Destructor SKETCHAPI_EXPORT - virtual ~SketchAPI_Projection(); + ~SketchAPI_Projection() override; INTERFACE_4(SketchPlugin_Projection::ID(), externalFeature, SketchPlugin_Projection::EXTERNAL_FEATURE_ID(), @@ -77,11 +77,11 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; //! Pointer on Projection object -typedef std::shared_ptr ProjectionPtr; +using ProjectionPtr = std::shared_ptr; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/SketchAPI/SketchAPI_Rectangle.cpp b/src/SketchAPI/SketchAPI_Rectangle.cpp index 28a66b738..00085e94e 100644 --- a/src/SketchAPI/SketchAPI_Rectangle.cpp +++ b/src/SketchAPI/SketchAPI_Rectangle.cpp @@ -52,7 +52,7 @@ SketchAPI_Rectangle::SketchAPI_Rectangle( } } -SketchAPI_Rectangle::~SketchAPI_Rectangle() {} +SketchAPI_Rectangle::~SketchAPI_Rectangle() = default; //-------------------------------------------------------------------------------------- void SketchAPI_Rectangle::setByCoordinates(double theX1, double theY1, diff --git a/src/SketchAPI/SketchAPI_Rectangle.h b/src/SketchAPI/SketchAPI_Rectangle.h index 0fab92813..86619205e 100644 --- a/src/SketchAPI/SketchAPI_Rectangle.h +++ b/src/SketchAPI/SketchAPI_Rectangle.h @@ -50,7 +50,7 @@ public: const std::shared_ptr &theEndPoint); /// Destructor SKETCHAPI_EXPORT - virtual ~SketchAPI_Rectangle(); + ~SketchAPI_Rectangle() override; INTERFACE_7("SketchRectangle", type, "RectangleType", ModelAPI_AttributeString, @@ -83,7 +83,7 @@ public: }; //! Pointer on Rectangle object -typedef std::shared_ptr RectanglePtr; +using RectanglePtr = std::shared_ptr; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/SketchAPI/SketchAPI_Rotation.cpp b/src/SketchAPI/SketchAPI_Rotation.cpp index 1655963e1..803062647 100644 --- a/src/SketchAPI/SketchAPI_Rotation.cpp +++ b/src/SketchAPI/SketchAPI_Rotation.cpp @@ -50,7 +50,7 @@ SketchAPI_Rotation::SketchAPI_Rotation( } } -SketchAPI_Rotation::~SketchAPI_Rotation() {} +SketchAPI_Rotation::~SketchAPI_Rotation() = default; void SketchAPI_Rotation::setRotationList( const std::list> &theObjects) { @@ -118,8 +118,7 @@ void SketchAPI_Rotation::dump(ModelHighAPI_Dumper &theDumper) const { // the number of dumped aRotObjects is not changed, no need to dump anything static std::map aNbDumpedArguments; - std::map::iterator aFound = - aNbDumpedArguments.find(aBase); + auto aFound = aNbDumpedArguments.find(aBase); if (aFound != aNbDumpedArguments.end() && aFound->second == aFirstNotDumped) { theDumper.postpone(aBase); return; diff --git a/src/SketchAPI/SketchAPI_Rotation.h b/src/SketchAPI/SketchAPI_Rotation.h index 4cbd5b71f..ed194657c 100644 --- a/src/SketchAPI/SketchAPI_Rotation.h +++ b/src/SketchAPI/SketchAPI_Rotation.h @@ -58,7 +58,7 @@ public: bool theReversed = false); /// Destructor SKETCHAPI_EXPORT - virtual ~SketchAPI_Rotation(); + ~SketchAPI_Rotation() override; INTERFACE_8(SketchPlugin_MultiRotation::ID(), rotationList, SketchPlugin_MultiRotation::ROTATION_LIST_ID(), @@ -93,11 +93,11 @@ public: std::list> rotatedList() const; /// Dump wrapped feature - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; //! Pointer on Rotation object -typedef std::shared_ptr RotationPtr; +using RotationPtr = std::shared_ptr; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/SketchAPI/SketchAPI_Sketch.cpp b/src/SketchAPI/SketchAPI_Sketch.cpp index c892c11af..e080e8124 100644 --- a/src/SketchAPI/SketchAPI_Sketch.cpp +++ b/src/SketchAPI/SketchAPI_Sketch.cpp @@ -249,7 +249,7 @@ SketchAPI_Sketch::SketchAPI_Sketch( } } -SketchAPI_Sketch::~SketchAPI_Sketch() {} +SketchAPI_Sketch::~SketchAPI_Sketch() = default; //-------------------------------------------------------------------------------------- std::shared_ptr @@ -316,7 +316,7 @@ std::list SketchAPI_Sketch::selectFace() const { ResultConstructionPtr aResultConstruction = std::dynamic_pointer_cast( feature()->firstResult()); - if (aResultConstruction.get() == NULL) + if (aResultConstruction.get() == nullptr) return aSelectionList; for (int anIndex = 0; anIndex < aResultConstruction->facesNum(); ++anIndex) { @@ -379,9 +379,8 @@ std::list> SketchAPI_Sketch::getFreePoints() { std::list> aFreePoints; std::list aPoints = SketcherPrs_Tools::getFreePoints(compositeFeature()); - for (std::list::iterator anIt = aPoints.begin(); - anIt != aPoints.end(); ++anIt) { - FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); + for (auto &anIt : aPoints) { + FeaturePtr aFeature = ModelAPI_Feature::feature(anIt); PointPtr aPoint(new SketchAPI_Point(aFeature)); aFreePoints.push_back(aPoint); } @@ -414,13 +413,12 @@ void SketchAPI_Sketch::changeFacesOrder( aFaces.push_back(aSketchResult->face(i)); // find new faces order according to the given lists of edges std::list aNewFacesOrder; - std::list>::const_iterator anIt = - theFaces.begin(); + auto anIt = theFaces.begin(); for (; anIt != theFaces.end(); ++anIt) { // find the appropriate face - std::list::iterator aFIt = aFaces.begin(); + auto aFIt = aFaces.begin(); for (; aFIt != aFaces.end(); ++aFIt) { - std::list::const_iterator aEdgeIt = anIt->begin(); + auto aEdgeIt = anIt->begin(); GeomAPI_ShapeExplorer aFExp(*aFIt, GeomAPI_Shape::EDGE); for (; aEdgeIt != anIt->end() && aFExp.more(); ++aEdgeIt, aFExp.next()) { ResultPtr aCurRes = aEdgeIt->resultSubShapePair().first; @@ -858,11 +856,10 @@ std::shared_ptr SketchAPI_Sketch::addSpline( bool hasReference = false; std::list aPoints; std::list aReferences; - for (std::list::const_iterator it = poles.begin(); - it != poles.end(); ++it) { - aPoints.push_back(it->first); - aReferences.push_back(it->second); - if (!it->second.isEmpty()) + for (const auto &pole : poles) { + aPoints.push_back(pole.first); + aReferences.push_back(pole.second); + if (!pole.second.isEmpty()) hasReference = true; } @@ -1495,7 +1492,7 @@ static bool isDifferent(GeomFacePtr theFace1, GeomFacePtr theFace2) { anExp.next()) { GeomShapePtr aCurrent = anExp.current(); bool isFound = false; - std::list::iterator anIt1 = anEdges1.begin(); + auto anIt1 = anEdges1.begin(); for (; anIt1 != anEdges1.end(); ++anIt1) if (aCurrent->isSameGeometry(*anIt1)) { isFound = true; @@ -1528,7 +1525,7 @@ static bool isCustomFacesOrder(CompositeFeaturePtr theSketch) { // compare faces stored in sketch with faces generated by SketchBuilder int aNbSketchFaces = aSketchResult->facesNum(); int aFaceIndex = 0; - for (ListOfShape::const_iterator aFIt = aFaces.begin(); + for (auto aFIt = aFaces.begin(); aFIt != aFaces.end() && aFaceIndex < aNbSketchFaces; ++aFIt, ++aFaceIndex) { GeomFacePtr aSketchFace = aSketchResult->face(aFaceIndex); @@ -1553,7 +1550,7 @@ static void edgesOfSketchFaces(CompositeFeaturePtr theSketch, for (int a = 0; a < aSubNum; ++a) { FeaturePtr aSub = theSketch->subFeature(a); const std::list &aResults = aSub->results(); - std::list::const_iterator aRes = aResults.cbegin(); + auto aRes = aResults.cbegin(); for (; aRes != aResults.cend(); aRes++) { GeomShapePtr aCurShape = (*aRes)->shape(); if (aCurShape && aCurShape->isEdge()) @@ -1658,8 +1655,7 @@ void SketchAPI_Sketch::dump(ModelHighAPI_Dumper &theDumper) const { std::string aSpaceShift(aSketchName.size() + aMethodName.size(), ' '); theDumper << aSketchName << aMethodName << "(["; - for (std::list>::iterator aFIt = aFaces.begin(); - aFIt != aFaces.end(); ++aFIt) { + for (auto aFIt = aFaces.begin(); aFIt != aFaces.end(); ++aFIt) { if (aFIt != aFaces.begin()) theDumper << ",\n" << aSpaceShift << " "; theDumper << *aFIt; diff --git a/src/SketchAPI/SketchAPI_Sketch.h b/src/SketchAPI/SketchAPI_Sketch.h index 6ede2827e..8b4fe146f 100644 --- a/src/SketchAPI/SketchAPI_Sketch.h +++ b/src/SketchAPI/SketchAPI_Sketch.h @@ -88,7 +88,7 @@ public: std::shared_ptr thePlaneObject); /// Destructor SKETCHAPI_EXPORT - virtual ~SketchAPI_Sketch(); + ~SketchAPI_Sketch() override; INTERFACE_7(SketchPlugin_Sketch::ID(), origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, @@ -579,14 +579,14 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; protected: std::shared_ptr compositeFeature() const; }; //! Pointer on Sketch object -typedef std::shared_ptr SketchPtr; +using SketchPtr = std::shared_ptr; //-------------------------------------------------------------------------------------- diff --git a/src/SketchAPI/SketchAPI_SketchEntity.cpp b/src/SketchAPI/SketchAPI_SketchEntity.cpp index 510da9a3e..98e06d868 100644 --- a/src/SketchAPI/SketchAPI_SketchEntity.cpp +++ b/src/SketchAPI/SketchAPI_SketchEntity.cpp @@ -45,7 +45,7 @@ SketchAPI_SketchEntity::SketchAPI_SketchEntity( initialize(); } -SketchAPI_SketchEntity::~SketchAPI_SketchEntity() {} +SketchAPI_SketchEntity::~SketchAPI_SketchEntity() = default; //-------------------------------------------------------------------------------------- bool SketchAPI_SketchEntity::initialize() { @@ -90,8 +90,7 @@ bool SketchAPI_SketchEntity::isCopy() const { std::list> SketchAPI_SketchEntity::wrap( const std::list> &theFeatures) { std::list> aResult; - std::list>::const_iterator anIt = - theFeatures.begin(); + auto anIt = theFeatures.begin(); for (; anIt != theFeatures.end(); ++anIt) { if ((*anIt)->getKind() == SketchPlugin_Line::ID()) aResult.push_back( diff --git a/src/SketchAPI/SketchAPI_Translation.cpp b/src/SketchAPI/SketchAPI_Translation.cpp index af7cab449..b4e8f6b74 100644 --- a/src/SketchAPI/SketchAPI_Translation.cpp +++ b/src/SketchAPI/SketchAPI_Translation.cpp @@ -49,7 +49,7 @@ SketchAPI_Translation::SketchAPI_Translation( } } -SketchAPI_Translation::~SketchAPI_Translation() {} +SketchAPI_Translation::~SketchAPI_Translation() = default; void SketchAPI_Translation::setTranslationList( const std::list> &theObjects) { @@ -117,8 +117,7 @@ void SketchAPI_Translation::dump(ModelHighAPI_Dumper &theDumper) const { // the number of dumped aTransObjects is not changed, no need to dump anything static std::map aNbDumpedArguments; - std::map::iterator aFound = - aNbDumpedArguments.find(aBase); + auto aFound = aNbDumpedArguments.find(aBase); if (aFound != aNbDumpedArguments.end() && aFound->second == aFirstNotDumped) { theDumper.postpone(aBase); return; diff --git a/src/SketchAPI/SketchAPI_Translation.h b/src/SketchAPI/SketchAPI_Translation.h index 2154bf4be..bd0caf8a2 100644 --- a/src/SketchAPI/SketchAPI_Translation.h +++ b/src/SketchAPI/SketchAPI_Translation.h @@ -57,7 +57,7 @@ public: bool theFullValue = false); /// Destructor SKETCHAPI_EXPORT - virtual ~SketchAPI_Translation(); + ~SketchAPI_Translation() override; INTERFACE_7(SketchPlugin_MultiTranslation::ID(), translationList, SketchPlugin_MultiTranslation::TRANSLATION_LIST_ID(), @@ -91,11 +91,11 @@ public: std::list> translatedList() const; /// Dump wrapped feature - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; //! Pointer on Translation object -typedef std::shared_ptr TranslationPtr; +using TranslationPtr = std::shared_ptr; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index 1e0845945..3af9d3b81 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -171,7 +171,7 @@ void SketchPlugin_Arc::execute() { } bool SketchPlugin_Arc::isFixed() { - return data()->selection(EXTERNAL_ID())->context().get() != NULL; + return data()->selection(EXTERNAL_ID())->context().get() != nullptr; } void SketchPlugin_Arc::attributeChanged(const std::string &theID) { diff --git a/src/SketchPlugin/SketchPlugin_BSplineBase.cpp b/src/SketchPlugin/SketchPlugin_BSplineBase.cpp index d54bc7d73..4c3eb5cd9 100644 --- a/src/SketchPlugin/SketchPlugin_BSplineBase.cpp +++ b/src/SketchPlugin/SketchPlugin_BSplineBase.cpp @@ -104,7 +104,7 @@ void SketchPlugin_BSplineBase::execute() { } bool SketchPlugin_BSplineBase::isFixed() { - return data()->selection(EXTERNAL_ID())->context().get() != NULL; + return data()->selection(EXTERNAL_ID())->context().get() != nullptr; } void SketchPlugin_BSplineBase::attributeChanged(const std::string & /*theID*/) { @@ -147,20 +147,19 @@ bool SketchPlugin_BSplineBase::addPole(const int theAfter) { std::map aControlPoles, aControlSegments; bool hasAuxSegment = false; const std::set &aRefs = data()->refsToMe(); - for (std::set::iterator anIt = aRefs.begin(); - anIt != aRefs.end(); ++anIt) { - FeaturePtr aFeature = ModelAPI_Feature::feature((*anIt)->owner()); + for (const auto &aRef : aRefs) { + FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->owner()); if (aFeature->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID()) { AttributeIntegerPtr anIndex; AttributeRefAttrPtr aNonSplinePoint; - if ((*anIt)->id() == + if (aRef->id() == SketchPlugin_ConstraintCoincidenceInternal::ENTITY_A()) { anIndex = aFeature->integer( SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A()); aNonSplinePoint = aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()); - } else if ((*anIt)->id() == + } else if (aRef->id() == SketchPlugin_ConstraintCoincidenceInternal::ENTITY_B()) { anIndex = aFeature->integer( SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B()); @@ -219,7 +218,7 @@ bool SketchPlugin_BSplineBase::addPole(const int theAfter) { aWeights.push_back(1.0); // default weight } aWeightsArray->setSize(aWeightsArray->size() + 1); - std::list::iterator aWIt = aWeights.begin(); + auto aWIt = aWeights.begin(); for (int i = 0; i < aWeightsArray->size(); ++i, ++aWIt) aWeightsArray->setValue(i, *aWIt); @@ -234,7 +233,7 @@ bool SketchPlugin_BSplineBase::addPole(const int theAfter) { std::list aKnots = aBSplineCurve->knots(); int aSize = (int)aKnots.size(); aKnotsAttr->setSize(aSize); - std::list::iterator aKIt = aKnots.begin(); + auto aKIt = aKnots.begin(); for (int index = 0; index < aSize; ++index, ++aKIt) aKnotsAttr->setValue(index, *aKIt); @@ -243,17 +242,15 @@ bool SketchPlugin_BSplineBase::addPole(const int theAfter) { std::list aMults = aBSplineCurve->mults(); aSize = (int)aMults.size(); aMultsAttr->setSize(aSize); - std::list::iterator aMIt = aMults.begin(); + auto aMIt = aMults.begin(); for (int index = 0; index < aSize; ++index, ++aMIt) aMultsAttr->setValue(index, *aMIt); data()->blockSendAttributeUpdated(aWasBlocked, true); // update indices of internal coincidences - for (std::list::iterator aCIt = - aCoincidentPoleIndex.begin(); - aCIt != aCoincidentPoleIndex.end(); ++aCIt) - (*aCIt)->setValue((*aCIt)->value() + 1); + for (auto &aCIt : aCoincidentPoleIndex) + aCIt->setValue(aCIt->value() + 1); // create auxiliary segment and pole updating the control polygon SketchPlugin_MacroBSpline::createAuxiliaryPole(aPolesArray, anAfter + 1); @@ -262,16 +259,14 @@ bool SketchPlugin_BSplineBase::addPole(const int theAfter) { anAfter + 1); // update names of features representing control polygon - for (std::map::iterator anIt = aControlPoles.begin(); - anIt != aControlPoles.end(); ++anIt) { + for (auto &aControlPole : aControlPoles) { SketchPlugin_MacroBSpline::assignDefaultNameForAux( - anIt->second, aPolesArray, anIt->first + 1); + aControlPole.second, aPolesArray, aControlPole.first + 1); } - for (std::map::iterator anIt = aControlSegments.begin(); - anIt != aControlSegments.end(); ++anIt) { + for (auto &aControlSegment : aControlSegments) { SketchPlugin_MacroBSpline::assignDefaultNameForAux( - anIt->second, aPolesArray, anIt->first + 1, - (anIt->first + 2) % aPolesArray->size()); + aControlSegment.second, aPolesArray, aControlSegment.first + 1, + (aControlSegment.first + 2) % aPolesArray->size()); } return true; diff --git a/src/SketchPlugin/SketchPlugin_Circle.cpp b/src/SketchPlugin/SketchPlugin_Circle.cpp index cacf30453..917834c35 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.cpp +++ b/src/SketchPlugin/SketchPlugin_Circle.cpp @@ -97,7 +97,7 @@ void SketchPlugin_Circle::execute() { } bool SketchPlugin_Circle::isFixed() { - return data()->selection(EXTERNAL_ID())->context().get() != NULL; + return data()->selection(EXTERNAL_ID())->context().get() != nullptr; } void SketchPlugin_Circle::attributeChanged(const std::string &theID) { diff --git a/src/SketchPlugin/SketchPlugin_Constraint.cpp b/src/SketchPlugin/SketchPlugin_Constraint.cpp index 2a69fedfe..b7328edb4 100644 --- a/src/SketchPlugin/SketchPlugin_Constraint.cpp +++ b/src/SketchPlugin/SketchPlugin_Constraint.cpp @@ -20,4 +20,4 @@ #include "SketchPlugin_Constraint.h" -SketchPlugin_Constraint::SketchPlugin_Constraint() {} +SketchPlugin_Constraint::SketchPlugin_Constraint() = default; diff --git a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp index a2a03ac8e..76ecf6564 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp @@ -484,7 +484,7 @@ bool SketchPlugin_ConstraintAngle::compute(const std::string &theAttributeId) { FeaturePtr aLineA = SketcherPrs_Tools::getFeatureLine(aData, ENTITY_A()); FeaturePtr aLineB = SketcherPrs_Tools::getFeatureLine(aData, ENTITY_B()); - if ((aLineA.get() == NULL) || (aLineB.get() == NULL)) + if ((aLineA.get() == nullptr) || (aLineB.get() == nullptr)) return false; // Intersection of lines diff --git a/src/SketchPlugin/SketchPlugin_ConstraintAngle.h b/src/SketchPlugin/SketchPlugin_ConstraintAngle.h index 3062fb112..18461f994 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintAngle.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintAngle.h @@ -43,7 +43,7 @@ public: return MY_CONSTRAINT_ANGLE_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_ConstraintAngle::ID(); return MY_KIND; } @@ -106,34 +106,34 @@ public: public: /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Computes the attribute value on the base of other attributes if the value /// can be computed \param theAttributeId an attribute index to be computed /// \return a boolean value about it is computed - SKETCHPLUGIN_EXPORT virtual bool compute(const std::string &theAttributeId); + SKETCHPLUGIN_EXPORT bool compute(const std::string &theAttributeId) override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Retuns the parameters of color definition in the resources config manager - SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string &theSection, - std::string &theName, - std::string &theDefault); + SKETCHPLUGIN_EXPORT void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// Apply information of the message to current object. /// It fills selected point and the first object. - virtual std::string - processEvent(const std::shared_ptr &theMessage); + std::string + processEvent(const std::shared_ptr &theMessage) override; /// \brief Use plugin manager for features creation SketchPlugin_ConstraintAngle(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp index 21d6ef15a..4d48d823d 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp @@ -33,7 +33,8 @@ #include -SketchPlugin_ConstraintCoincidence::SketchPlugin_ConstraintCoincidence() {} +SketchPlugin_ConstraintCoincidence::SketchPlugin_ConstraintCoincidence() = + default; void SketchPlugin_ConstraintCoincidence::initAttributes() { data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.cpp b/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.cpp index 57c1293c0..d38bf38f0 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.cpp @@ -25,7 +25,7 @@ #include SketchPlugin_ConstraintCoincidenceInternal:: - SketchPlugin_ConstraintCoincidenceInternal() {} + SketchPlugin_ConstraintCoincidenceInternal() = default; void SketchPlugin_ConstraintCoincidenceInternal::initAttributes() { SketchPlugin_ConstraintCoincidence::initAttributes(); @@ -42,6 +42,6 @@ void SketchPlugin_ConstraintCoincidenceInternal::initAttributes() { void SketchPlugin_ConstraintCoincidenceInternal::execute() {} AISObjectPtr SketchPlugin_ConstraintCoincidenceInternal::getAISObject( - AISObjectPtr thePrevious) { + AISObjectPtr /*thePrevious*/) { return AISObjectPtr(); } diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.h b/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.h index 210611f17..483b6060f 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintCoincidenceInternal.h @@ -38,7 +38,7 @@ public: return MY_CONSTRAINT_COINCIDENCE_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_ConstraintCoincidenceInternal::ID(); return MY_KIND; @@ -56,15 +56,15 @@ public: } /// \brief Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// \brief Use plugin manager for features creation SketchPlugin_ConstraintCoincidenceInternal(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp b/src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp index 0999923e7..d74777299 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp @@ -22,7 +22,7 @@ #include "SketcherPrs_Factory.h" -SketchPlugin_ConstraintCollinear::SketchPlugin_ConstraintCollinear() {} +SketchPlugin_ConstraintCollinear::SketchPlugin_ConstraintCollinear() = default; void SketchPlugin_ConstraintCollinear::initAttributes() { data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCollinear.h b/src/SketchPlugin/SketchPlugin_ConstraintCollinear.h index 6152a6971..b12b47de3 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCollinear.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintCollinear.h @@ -41,21 +41,21 @@ public: return MY_CONSTRAINT_COLLINEAR_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_ConstraintCollinear::ID(); return MY_KIND; } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// \brief Use plugin manager for features creation SketchPlugin_ConstraintCollinear(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h index 1248c7de2..58ce068a1 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h @@ -52,7 +52,7 @@ public: } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_ConstraintDistance::ID(); return MY_KIND; } @@ -77,24 +77,24 @@ public: } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Retuns the parameters of color definition in the resources config manager - SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string &theSection, - std::string &theName, - std::string &theDefault); + SKETCHPLUGIN_EXPORT void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// \brief Use plugin manager for features creation SketchPlugin_ConstraintDistance(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.cpp index 431950927..f39b35657 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.cpp @@ -43,8 +43,7 @@ const double tolerance = 1e-7; SketchPlugin_ConstraintDistanceAlongDir:: SketchPlugin_ConstraintDistanceAlongDir() - : SketchPlugin_ConstraintDistance(), myValue(-1.e100), - myValueUpdate(false) {} + : SketchPlugin_ConstraintDistance() {} //************************************************************************************* void SketchPlugin_ConstraintDistanceAlongDir::initAttributes() { diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.h b/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.h index 216b11271..71db29f2f 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceAlongDir.h @@ -59,33 +59,33 @@ public: } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// \brief Use plugin manager for features creation SketchPlugin_ConstraintDistanceAlongDir(); protected: /// Returns the current distance between the feature attributes - virtual double calculateCurrentDistance() = 0; + double calculateCurrentDistance() override = 0; /// Update flyout point virtual void updateFlyoutPoint() = 0; protected: - double myValue; - bool myValueUpdate; + double myValue{-1.e100}; + bool myValueUpdate{false}; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h index 3168015b3..c76a0a34d 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h @@ -48,7 +48,7 @@ public: } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_ConstraintDistanceHorizontal::ID(); return MY_KIND; @@ -59,10 +59,10 @@ public: protected: /// Returns the current distance between the feature attributes - virtual double calculateCurrentDistance(); + double calculateCurrentDistance() override; /// Update flyout point - virtual void updateFlyoutPoint(); + void updateFlyoutPoint() override; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h index c143ec4d0..15f97c9e4 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h @@ -48,7 +48,7 @@ public: } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_ConstraintDistanceVertical::ID(); return MY_KIND; } @@ -58,10 +58,10 @@ public: protected: /// Returns the current distance between the feature attributes - virtual double calculateCurrentDistance(); + double calculateCurrentDistance() override; /// Update flyout point - virtual void updateFlyoutPoint(); + void updateFlyoutPoint() override; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp b/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp index 163c4769f..49905714f 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp @@ -32,7 +32,8 @@ #include -SketchPlugin_ConstraintHorizontal::SketchPlugin_ConstraintHorizontal() {} +SketchPlugin_ConstraintHorizontal::SketchPlugin_ConstraintHorizontal() = + default; void SketchPlugin_ConstraintHorizontal::initAttributes() { data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), diff --git a/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.h b/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.h index daa479c51..b07607baa 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.h @@ -41,21 +41,21 @@ public: return MY_CONSTRAINT_HORIZONTAL_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_ConstraintHorizontal::ID(); return MY_KIND; } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// \brief Use plugin manager for features creation SketchPlugin_ConstraintHorizontal(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.h b/src/SketchPlugin/SketchPlugin_ConstraintLength.h index 1ba2f9065..e0e4b4e6d 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.h @@ -52,7 +52,7 @@ public: } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_ConstraintLength::ID(); return MY_KIND; } @@ -64,29 +64,29 @@ public: } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Computes the attribute value on the base of other attributes if the value /// can be computed \param theAttributeId an attribute index to be computed /// \return a boolean value about it is computed - SKETCHPLUGIN_EXPORT virtual bool compute(const std::string &theAttributeId); + SKETCHPLUGIN_EXPORT bool compute(const std::string &theAttributeId) override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Retuns the parameters of color definition in the resources config manager - SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string &theSection, - std::string &theName, - std::string &theDefault); + SKETCHPLUGIN_EXPORT void colorConfigInfo(std::string &theSection, + std::string &theName, + std::string &theDefault) override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// \brief Use plugin manager for features creation SketchPlugin_ConstraintLength(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp b/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp index 3d0401239..1933d5097 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp @@ -36,7 +36,7 @@ #include -SketchPlugin_ConstraintMirror::SketchPlugin_ConstraintMirror() {} +SketchPlugin_ConstraintMirror::SketchPlugin_ConstraintMirror() = default; void SketchPlugin_ConstraintMirror::initAttributes() { data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), @@ -84,7 +84,7 @@ void SketchPlugin_ConstraintMirror::execute() { for (int anInd = 0; anInd < aMirrorObjectRefs->size(); anInd++) { ObjectPtr anObject = aMirrorObjectRefs->object(anInd); std::list::const_iterator anIt = anInitialList.begin(); - std::vector::iterator aUsedIt = isUsed.begin(); + auto aUsedIt = isUsed.begin(); for (; anIt != anInitialList.end(); anIt++, aUsedIt++) if (*anIt == anObject) { *aUsedIt = true; @@ -94,9 +94,9 @@ void SketchPlugin_ConstraintMirror::execute() { aRefListOfShapes->append(anObject); } // remove unused items - std::list::iterator anInitIter = anInitialList.begin(); - std::list::iterator aMirrorIter = aMirroredList.begin(); - std::vector::iterator aUsedIter = isUsed.begin(); + auto anInitIter = anInitialList.begin(); + auto aMirrorIter = aMirroredList.begin(); + auto aUsedIter = isUsed.begin(); std::set aFeaturesToBeRemoved; for (; aUsedIter != isUsed.end(); aUsedIter++) { if (!(*aUsedIter)) { @@ -170,7 +170,7 @@ void SketchPlugin_ConstraintMirror::execute() { std::shared_ptr aShapeIn = aRCIn->shape(); const std::list &aResults = aNewFeature->results(); - std::list::const_iterator anIt = aResults.begin(); + auto anIt = aResults.begin(); for (; anIt != aResults.end(); anIt++) { ResultConstructionPtr aRC = std::dynamic_pointer_cast(*anIt); @@ -193,7 +193,7 @@ void SketchPlugin_ConstraintMirror::execute() { aMirrorIter++; } // Remove from the list objects already deleted before - std::set::reverse_iterator anIt = anInvalidInd.rbegin(); + auto anIt = anInvalidInd.rbegin(); for (; anIt != anInvalidInd.rend(); anIt++) { if (*anIt < indFirstWrong) indFirstWrong--; @@ -247,10 +247,9 @@ void SketchPlugin_ConstraintMirror::erase() { aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); std::list aTargetList = aRefListOfMirrored->list(); - for (std::list::const_iterator aTargetIt = aTargetList.cbegin(); - aTargetIt != aTargetList.cend(); aTargetIt++) { - if ((*aTargetIt).get()) { - ResultPtr aRes = std::dynamic_pointer_cast(*aTargetIt); + for (const auto &aTargetIt : aTargetList) { + if (aTargetIt.get()) { + ResultPtr aRes = std::dynamic_pointer_cast(aTargetIt); if (aRes.get()) { FeaturePtr aFeature = aRes->document()->feature(aRes); if (aFeature.get()) { @@ -282,7 +281,7 @@ void SketchPlugin_ConstraintMirror::attributeChanged(const std::string &theID) { std::dynamic_pointer_cast( data()->attribute(SketchPlugin_Constraint::ENTITY_C())); std::list aTargetList = aRefListOfMirrored->list(); - std::list::iterator aTargetIter = aTargetList.begin(); + auto aTargetIter = aTargetList.begin(); for (; aTargetIter != aTargetList.end(); aTargetIter++) { FeaturePtr aFeature = ModelAPI_Feature::feature(*aTargetIter); if (aFeature) diff --git a/src/SketchPlugin/SketchPlugin_ConstraintMirror.h b/src/SketchPlugin/SketchPlugin_ConstraintMirror.h index 5fd8775d9..f7e3839c7 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintMirror.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintMirror.h @@ -45,7 +45,7 @@ public: return MY_CONSTRAINT_MIRROR_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_ConstraintMirror::ID(); return MY_KIND; } @@ -57,22 +57,22 @@ public: } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// removes all fields from this feature: results, data, etc - SKETCHPLUGIN_EXPORT virtual void erase(); + SKETCHPLUGIN_EXPORT void erase() override; /// \brief Use plugin manager for features creation SketchPlugin_ConstraintMirror(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp b/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp index 8da0d5c32..9a67545b7 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp @@ -37,7 +37,7 @@ #include -SketchPlugin_ConstraintParallel::SketchPlugin_ConstraintParallel() {} +SketchPlugin_ConstraintParallel::SketchPlugin_ConstraintParallel() = default; void SketchPlugin_ConstraintParallel::initAttributes() { data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), diff --git a/src/SketchPlugin/SketchPlugin_ConstraintParallel.h b/src/SketchPlugin/SketchPlugin_ConstraintParallel.h index 347571c11..e88c4527e 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintParallel.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintParallel.h @@ -41,21 +41,21 @@ public: return MY_CONSTRAINT_PARALLEL_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_ConstraintParallel::ID(); return MY_KIND; } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// \brief Use plugin manager for features creation SketchPlugin_ConstraintParallel(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp index 0c626c9c1..e13083fb0 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp @@ -36,7 +36,8 @@ #include -SketchPlugin_ConstraintPerpendicular::SketchPlugin_ConstraintPerpendicular() {} +SketchPlugin_ConstraintPerpendicular::SketchPlugin_ConstraintPerpendicular() = + default; void SketchPlugin_ConstraintPerpendicular::initAttributes() { data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), diff --git a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h index d501bba35..36014df91 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h @@ -43,21 +43,21 @@ public: return MY_CONSTRAINT_PERPENDICULAR_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_ConstraintPerpendicular::ID(); return MY_KIND; } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// \brief Use plugin manager for features creation SketchPlugin_ConstraintPerpendicular(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp index e31b4169a..26061c98b 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp @@ -30,7 +30,7 @@ #include #include -SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid() {} +SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid() = default; void SketchPlugin_ConstraintRigid::initAttributes() { data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), diff --git a/src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp b/src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp index ab90edbda..dadd4763a 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp @@ -31,7 +31,7 @@ #include -SketchPlugin_ConstraintTangent::SketchPlugin_ConstraintTangent() {} +SketchPlugin_ConstraintTangent::SketchPlugin_ConstraintTangent() = default; void SketchPlugin_ConstraintTangent::initAttributes() { data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), diff --git a/src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp b/src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp index 38c07af83..972cb043b 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp @@ -31,7 +31,7 @@ #include -SketchPlugin_ConstraintVertical::SketchPlugin_ConstraintVertical() {} +SketchPlugin_ConstraintVertical::SketchPlugin_ConstraintVertical() = default; void SketchPlugin_ConstraintVertical::initAttributes() { data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), diff --git a/src/SketchPlugin/SketchPlugin_ConstraintVertical.h b/src/SketchPlugin/SketchPlugin_ConstraintVertical.h index c9ac97430..4f999398a 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintVertical.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintVertical.h @@ -41,21 +41,21 @@ public: return MY_CONSTRAINT_VERTICAL_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_ConstraintVertical::ID(); return MY_KIND; } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// \brief Use plugin manager for features creation SketchPlugin_ConstraintVertical(); diff --git a/src/SketchPlugin/SketchPlugin_CurveFitting.cpp b/src/SketchPlugin/SketchPlugin_CurveFitting.cpp index 1b44ab7d1..cbdb0ff4d 100644 --- a/src/SketchPlugin/SketchPlugin_CurveFitting.cpp +++ b/src/SketchPlugin/SketchPlugin_CurveFitting.cpp @@ -204,8 +204,7 @@ void SketchPlugin_CurveFitting::createConstraints( AttributeRefAttrListPtr aPointsAttr = refattrlist(POINTS_ID()); std::list> aPointsList = aPointsAttr->list(); - std::list>::iterator aLastIt = - --aPointsList.end(); + auto aLastIt = --aPointsList.end(); for (auto it = aPointsList.begin(); it != aPointsList.end(); ++it) { AttributePtr anAttr = it->second; if (!anAttr) { @@ -268,9 +267,8 @@ void SketchPlugin_CurveFitting::reorderPoints() { std::list> aPointsList = aPointsAttr->list(); - std::list::iterator aCoordIt = aCoordinates.begin(); - std::list>::iterator anAttrIt = - aPointsList.begin(); + auto aCoordIt = aCoordinates.begin(); + auto anAttrIt = aPointsList.begin(); for (; aCoordIt != aCoordinates.end() && anAttrIt != aPointsList.end(); ++aCoordIt, ++anAttrIt) aMap[*aCoordIt] = *anAttrIt; @@ -331,11 +329,11 @@ void convertTo3D(SketchPlugin_Sketch *theSketch, std::list &thePoints) { std::list> aPointsList = theAttribute->list(); - for (auto it = aPointsList.begin(); it != aPointsList.end(); ++it) { - AttributePtr anAttr = it->second; + for (auto &it : aPointsList) { + AttributePtr anAttr = it.second; if (!anAttr) { // maybe the SketchPoint is selected - FeaturePtr aFeature = ModelAPI_Feature::feature(it->first); + FeaturePtr aFeature = ModelAPI_Feature::feature(it.first); if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID()) anAttr = aFeature->attribute(SketchPlugin_Point::COORD_ID()); else { diff --git a/src/SketchPlugin/SketchPlugin_CurveFitting.h b/src/SketchPlugin/SketchPlugin_CurveFitting.h index 057a2f106..6151ac58f 100644 --- a/src/SketchPlugin/SketchPlugin_CurveFitting.h +++ b/src/SketchPlugin/SketchPlugin_CurveFitting.h @@ -97,34 +97,35 @@ public: } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_CurveFitting::ID(); return MY_KIND; } /// Returns the AIS preview - virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + AISObjectPtr getAISObject(AISObjectPtr thePrevious) override; /// Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }; + SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; }; - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }; + SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }; /// Performs some functionality by action id. /// \param[in] theAttributeId action key id. /// \return false in case if action not performed. - SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string &theActionId); + SKETCHPLUGIN_EXPORT bool + customAction(const std::string &theActionId) override; /// Use plugin manager for features creation SketchPlugin_CurveFitting(); protected: /// \brief Initializes attributes of derived class. - virtual void initDerivedClassAttributes(); + void initDerivedClassAttributes() override; private: /// \brief Create a feature, which passes through the selected points diff --git a/src/SketchPlugin/SketchPlugin_Ellipse.cpp b/src/SketchPlugin/SketchPlugin_Ellipse.cpp index 221c6607c..9befb78ce 100644 --- a/src/SketchPlugin/SketchPlugin_Ellipse.cpp +++ b/src/SketchPlugin/SketchPlugin_Ellipse.cpp @@ -84,7 +84,7 @@ void SketchPlugin_Ellipse::execute() { } bool SketchPlugin_Ellipse::isFixed() { - return data()->selection(EXTERNAL_ID())->context().get() != NULL; + return data()->selection(EXTERNAL_ID())->context().get() != nullptr; } void SketchPlugin_Ellipse::attributeChanged(const std::string &theID) { diff --git a/src/SketchPlugin/SketchPlugin_EllipticArc.cpp b/src/SketchPlugin/SketchPlugin_EllipticArc.cpp index b77a83679..f7f7f87d8 100644 --- a/src/SketchPlugin/SketchPlugin_EllipticArc.cpp +++ b/src/SketchPlugin/SketchPlugin_EllipticArc.cpp @@ -44,7 +44,7 @@ static const double paramTolerance = 1.e-4; static const double PI = 3.141592653589793238463; SketchPlugin_EllipticArc::SketchPlugin_EllipticArc() - : SketchPlugin_SketchEntity(), myParamDelta(0.0) {} + : SketchPlugin_SketchEntity() {} void SketchPlugin_EllipticArc::initDerivedClassAttributes() { data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::typeId()); @@ -95,7 +95,7 @@ void SketchPlugin_EllipticArc::execute() { } bool SketchPlugin_EllipticArc::isFixed() { - return data()->selection(EXTERNAL_ID())->context().get() != NULL; + return data()->selection(EXTERNAL_ID())->context().get() != nullptr; } void SketchPlugin_EllipticArc::attributeChanged(const std::string &theID) { diff --git a/src/SketchPlugin/SketchPlugin_EllipticArc.h b/src/SketchPlugin/SketchPlugin_EllipticArc.h index c979d9e4d..2132a75ee 100644 --- a/src/SketchPlugin/SketchPlugin_EllipticArc.h +++ b/src/SketchPlugin/SketchPlugin_EllipticArc.h @@ -132,7 +132,7 @@ private: void createEllipticArc(SketchPlugin_Sketch *theSketch); private: - double myParamDelta; + double myParamDelta{0.0}; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ExternalValidator.cpp b/src/SketchPlugin/SketchPlugin_ExternalValidator.cpp index 11484cd16..06fbd1790 100644 --- a/src/SketchPlugin/SketchPlugin_ExternalValidator.cpp +++ b/src/SketchPlugin/SketchPlugin_ExternalValidator.cpp @@ -62,13 +62,13 @@ bool SketchPlugin_ExternalValidator::isExternalAttribute( AttributeRefAttrPtr anAttribute = std::dynamic_pointer_cast(theAttribute); - if (anAttribute.get() != NULL) { + if (anAttribute.get() != nullptr) { FeaturePtr anArgumentFeature = ModelAPI_Feature::feature(anAttribute->object()); - if (anArgumentFeature.get() != NULL) { + if (anArgumentFeature.get() != nullptr) { std::shared_ptr aSketchFeature = std::dynamic_pointer_cast(anArgumentFeature); - if (aSketchFeature.get() != NULL) { + if (aSketchFeature.get() != nullptr) { isExternal = aSketchFeature->isExternal(); } } diff --git a/src/SketchPlugin/SketchPlugin_ExternalValidator.h b/src/SketchPlugin/SketchPlugin_ExternalValidator.h index 5ad754b17..1ea542f4f 100644 --- a/src/SketchPlugin/SketchPlugin_ExternalValidator.h +++ b/src/SketchPlugin/SketchPlugin_ExternalValidator.h @@ -38,10 +38,9 @@ public: /// \param theAttribute an attribute to check /// \param theArguments a filter parameters /// \param theError error message - SKETCHPLUGIN_EXPORT virtual bool - isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + SKETCHPLUGIN_EXPORT bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; protected: /// returns true if the feature of the attribute is external diff --git a/src/SketchPlugin/SketchPlugin_Feature.cpp b/src/SketchPlugin/SketchPlugin_Feature.cpp index 675a43c75..51a82f72e 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.cpp +++ b/src/SketchPlugin/SketchPlugin_Feature.cpp @@ -36,13 +36,13 @@ /// can be used in outside libraries through casting without a link to the /// current library. -SketchPlugin_Feature::SketchPlugin_Feature() { mySketch = 0; } +SketchPlugin_Feature::SketchPlugin_Feature() { mySketch = nullptr; } SketchPlugin_Sketch *SketchPlugin_Feature::sketch() { if (!mySketch) { // find sketch that references to this feature const std::set &aBackRefs = data()->refsToMe(); - std::set::const_iterator aBackRef = aBackRefs.begin(); + auto aBackRef = aBackRefs.begin(); for (; aBackRef != aBackRefs.end(); aBackRef++) { std::shared_ptr aSketch = std::dynamic_pointer_cast((*aBackRef)->owner()); diff --git a/src/SketchPlugin/SketchPlugin_Fillet.cpp b/src/SketchPlugin/SketchPlugin_Fillet.cpp index 428f2fa8c..87a8d4c11 100644 --- a/src/SketchPlugin/SketchPlugin_Fillet.cpp +++ b/src/SketchPlugin/SketchPlugin_Fillet.cpp @@ -85,8 +85,7 @@ static std::set findFeaturesToRemove(const FeaturePtr theFeature, const AttributePtr theAttribute); -SketchPlugin_Fillet::SketchPlugin_Fillet() - : myIsReversed(false), myFilletCreated(false) { +SketchPlugin_Fillet::SketchPlugin_Fillet() { myIsNotInversed[0] = myIsNotInversed[1] = true; } @@ -156,10 +155,10 @@ void SketchPlugin_Fillet::execute() { ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent); // Create tangent features. - for (int i = 0; i < 2; i++) { + for (auto &myBaseFeature : myBaseFeatures) { aConstraint = SketchPlugin_Tools::createConstraintObjectObject( sketch(), SketchPlugin_ConstraintTangent::ID(), - aFilletArc->lastResult(), myBaseFeatures[i]->lastResult()); + aFilletArc->lastResult(), myBaseFeature->lastResult()); aConstraint->execute(); ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent); } @@ -367,10 +366,10 @@ SketchPlugin_Fillet::createFilletApex(const GeomPnt2dPtr &theCoordinates) { static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); FeaturePtr aConstraint; - for (int i = 0; i < 2; i++) { + for (auto &myBaseFeature : myBaseFeatures) { aConstraint = SketchPlugin_Tools::createConstraintAttrObject( sketch(), SketchPlugin_ConstraintCoincidence::ID(), aCoord, - myBaseFeatures[i]->lastResult()); + myBaseFeature->lastResult()); aConstraint->execute(); ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent); } @@ -392,7 +391,7 @@ void SketchPlugin_Fillet::removeReferencesButKeepDistances( FeaturePtr aFilletApex; std::list aLengthToDistance; - std::set::iterator aFeat = theFeaturesToRemove.begin(); + auto aFeat = theFeaturesToRemove.begin(); while (aFeat != theFeaturesToRemove.end()) { std::shared_ptr aDistance = std::dynamic_pointer_cast(*aFeat); @@ -414,7 +413,7 @@ void SketchPlugin_Fillet::removeReferencesButKeepDistances( } } // avoid distance from removing if it is updated - std::set::iterator aKeepIt = aFeat++; + auto aKeepIt = aFeat++; if (isUpdated) theFeaturesToRemove.erase(aKeepIt); @@ -473,7 +472,7 @@ void SketchPlugin_Fillet::removeReferencesButKeepDistances( // restore Length constraints as point-point distances FeaturePtr aConstraint; - std::list::iterator anIt = aLengthToDistance.begin(); + auto anIt = aLengthToDistance.begin(); for (; anIt != aLengthToDistance.end(); ++anIt) { aConstraint = SketchPlugin_Tools::createConstraintAttrAttr( sketch(), SketchPlugin_ConstraintDistance::ID(), anIt->myPoints[0], @@ -605,15 +604,12 @@ std::set findFeaturesToRemove(const FeaturePtr theFeature, std::set aFeaturesToBeRemoved; std::set aRefs = theFeature->data()->refsToMe(); std::list aResults = theFeature->results(); - for (std::list::const_iterator aResultsIt = aResults.cbegin(); - aResultsIt != aResults.cend(); ++aResultsIt) { - ResultPtr aResult = *aResultsIt; + for (auto aResult : aResults) { std::set aResultRefs = aResult->data()->refsToMe(); aRefs.insert(aResultRefs.begin(), aResultRefs.end()); } - for (std::set::const_iterator anIt = aRefs.cbegin(); - anIt != aRefs.cend(); ++anIt) { - std::shared_ptr anAttr = (*anIt); + for (const auto &aRef : aRefs) { + std::shared_ptr anAttr = aRef; FeaturePtr aFeature = std::dynamic_pointer_cast(anAttr->owner()); if (aFeature->getKind() == SketchPlugin_Fillet::ID()) { @@ -626,11 +622,9 @@ std::set findFeaturesToRemove(const FeaturePtr theFeature, } else { std::list anAttrs = aFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId()); - for (std::list::const_iterator aRefAttrsIt = - anAttrs.cbegin(); - aRefAttrsIt != anAttrs.cend(); ++aRefAttrsIt) { + for (const auto &anAttr : anAttrs) { AttributeRefAttrPtr anAttrRefAttr = - std::dynamic_pointer_cast(*aRefAttrsIt); + std::dynamic_pointer_cast(anAttr); if (anAttrRefAttr.get() && anAttrRefAttr->attr() == theAttribute) { aFeaturesToBeRemoved.insert(aFeature); } diff --git a/src/SketchPlugin/SketchPlugin_Fillet.h b/src/SketchPlugin/SketchPlugin_Fillet.h index 413cccf67..645b1e055 100644 --- a/src/SketchPlugin/SketchPlugin_Fillet.h +++ b/src/SketchPlugin/SketchPlugin_Fillet.h @@ -50,27 +50,27 @@ public: } /// \return the kind of a feature. - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_Fillet::ID(); return MY_KIND; } /// \brief Creates a new part document if needed. - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes. - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; } + SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; } - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } /// Reimplemented from SketchPlugin_Feature::move(). /// Do nothing. @@ -107,9 +107,9 @@ private: private: FeaturePtr myBaseFeatures[2]; std::string myFeatAttributes[4]; // attributes of features - bool myIsReversed; + bool myIsReversed{false}; bool myIsNotInversed[2]; // indicates which point the features share - bool myFilletCreated; + bool myFilletCreated{false}; std::shared_ptr myCenterXY; std::shared_ptr myTangentXY1; std::shared_ptr myTangentXY2; diff --git a/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp b/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp index 958b3a10c..076236860 100644 --- a/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp +++ b/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp @@ -34,7 +34,7 @@ #include SketchPlugin_IntersectionPoint::SketchPlugin_IntersectionPoint() - : SketchPlugin_SketchEntity(), myIsComputing(false) {} + : SketchPlugin_SketchEntity() {} void SketchPlugin_IntersectionPoint::initDerivedClassAttributes() { data()->addAttribute(EXTERNAL_FEATURE_ID(), @@ -99,11 +99,10 @@ void SketchPlugin_IntersectionPoint::computePoint(const std::string &theID) { anExistentIntersections.begin(); const std::list &aResults = results(); - std::list::const_iterator aResIt = aResults.begin(); + auto aResIt = aResults.begin(); int aResultIndex = 0; - for (std::list::iterator aPntIt = - anIntersectionsPoints.begin(); + for (auto aPntIt = anIntersectionsPoints.begin(); aPntIt != anIntersectionsPoints.end(); ++aPntIt, ++aResultIndex) { std::shared_ptr aCurSketchPoint; if (aExistInterIt == anExistentIntersections.end()) { diff --git a/src/SketchPlugin/SketchPlugin_IntersectionPoint.h b/src/SketchPlugin/SketchPlugin_IntersectionPoint.h index 4d9cda63f..71c7517c4 100644 --- a/src/SketchPlugin/SketchPlugin_IntersectionPoint.h +++ b/src/SketchPlugin/SketchPlugin_IntersectionPoint.h @@ -36,7 +36,7 @@ public: return MY_POINT_ID; } /// Returns the kind of a feature - virtual const std::string &getKind() { + const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_IntersectionPoint::ID(); return MY_KIND; } @@ -57,31 +57,31 @@ public: } /// Returns true because intersection point is always external - virtual bool isFixed() { return true; } + bool isFixed() override { return true; } /// Returns true if the feature and the feature results can be displayed. /// \return false - virtual bool canBeDisplayed() const { return false; } + bool canBeDisplayed() const override { return false; } /// Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Called on change of any argument-attribute of this object: for external /// point - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// Use plugin manager for features creation SketchPlugin_IntersectionPoint(); protected: /// \brief Initializes attributes of derived class. - virtual void initDerivedClassAttributes(); + void initDerivedClassAttributes() override; private: /// \brief Find intersection between a line and a sketch plane void computePoint(const std::string &theID); - bool myIsComputing; + bool myIsComputing{false}; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_MacroArc.cpp b/src/SketchPlugin/SketchPlugin_MacroArc.cpp index f2f120990..f6e6d1af0 100644 --- a/src/SketchPlugin/SketchPlugin_MacroArc.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroArc.cpp @@ -137,8 +137,7 @@ static void intersectShapeAndCircle(const GeomShapePtr &theShape, } } -SketchPlugin_MacroArc::SketchPlugin_MacroArc() - : SketchPlugin_SketchEntity(), myParamBefore(0.0) {} +SketchPlugin_MacroArc::SketchPlugin_MacroArc() : SketchPlugin_SketchEntity() {} void SketchPlugin_MacroArc::initAttributes() { data()->addAttribute(ARC_TYPE(), ModelAPI_AttributeString::typeId()); diff --git a/src/SketchPlugin/SketchPlugin_MacroArc.h b/src/SketchPlugin/SketchPlugin_MacroArc.h index ea57f40a5..535415e3a 100644 --- a/src/SketchPlugin/SketchPlugin_MacroArc.h +++ b/src/SketchPlugin/SketchPlugin_MacroArc.h @@ -235,7 +235,7 @@ private: std::shared_ptr myEnd; /// To define in which direction draw arc. - double myParamBefore; + double myParamBefore{0.0}; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_MacroArcReentrantMessage.h b/src/SketchPlugin/SketchPlugin_MacroArcReentrantMessage.h index de634c002..f4d3798a2 100644 --- a/src/SketchPlugin/SketchPlugin_MacroArcReentrantMessage.h +++ b/src/SketchPlugin/SketchPlugin_MacroArcReentrantMessage.h @@ -39,7 +39,8 @@ public: const void *theSender) : ModelAPI_EventReentrantMessage(theID, theSender) {} /// The virtual destructor - SKETCHPLUGIN_EXPORT virtual ~SketchPlugin_MacroArcReentrantMessage() {} + SKETCHPLUGIN_EXPORT ~SketchPlugin_MacroArcReentrantMessage() override = + default; /// Static. Returns EventID of the message. inline static Events_ID eventId() { diff --git a/src/SketchPlugin/SketchPlugin_MacroBSpline.cpp b/src/SketchPlugin/SketchPlugin_MacroBSpline.cpp index e482cc1a5..cf8053721 100644 --- a/src/SketchPlugin/SketchPlugin_MacroBSpline.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroBSpline.cpp @@ -55,7 +55,7 @@ static void createInternalConstraint(SketchPlugin_Sketch *theSketch, const int thePoleIndex); SketchPlugin_MacroBSpline::SketchPlugin_MacroBSpline() - : SketchPlugin_SketchEntity(), myDegree(3), myIsPeriodic(false) {} + : SketchPlugin_SketchEntity() {} SketchPlugin_MacroBSpline::SketchPlugin_MacroBSpline(bool isPeriodic) : SketchPlugin_SketchEntity(), myDegree(3), myIsPeriodic(isPeriodic) {} @@ -114,7 +114,7 @@ FeaturePtr SketchPlugin_MacroBSpline::createBSplineFeature() { aBSpline->data()->realArray(SketchPlugin_BSplineBase::KNOTS_ID()); aSize = (int)myKnots.size(); aKnots->setSize(aSize); - std::list::iterator aKIt = myKnots.begin(); + auto aKIt = myKnots.begin(); for (int index = 0; index < aSize; ++index, ++aKIt) aKnots->setValue(index, *aKIt); @@ -122,7 +122,7 @@ FeaturePtr SketchPlugin_MacroBSpline::createBSplineFeature() { aBSpline->data()->intArray(SketchPlugin_BSplineBase::MULTS_ID()); aSize = (int)myMultiplicities.size(); aMults->setSize(aSize); - std::list::iterator aMIt = myMultiplicities.begin(); + auto aMIt = myMultiplicities.begin(); for (int index = 0; index < aSize; ++index, ++aMIt) aMults->setValue(index, *aMIt); @@ -173,8 +173,8 @@ void SketchPlugin_MacroBSpline::constraintsForPoles( SketchPlugin_Sketch *aSketch = sketch(); - std::list>::iterator aLIt = aList.begin(); - std::list::const_iterator aPIt = thePoles.begin(); + auto aLIt = aList.begin(); + auto aPIt = thePoles.begin(); for (; aLIt != aList.end() && aPIt != thePoles.end(); ++aPIt, ++aLIt) { // firstly, check the attribute (in this case the object will be not empty // too) diff --git a/src/SketchPlugin/SketchPlugin_MacroBSpline.h b/src/SketchPlugin/SketchPlugin_MacroBSpline.h index 29077972a..8bfb6e512 100644 --- a/src/SketchPlugin/SketchPlugin_MacroBSpline.h +++ b/src/SketchPlugin/SketchPlugin_MacroBSpline.h @@ -72,26 +72,26 @@ public: } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_MacroBSpline::ID(); return MY_KIND; } /// \brief Request for initialization of data model of the feature: adding all /// attributes. - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Returns the AIS preview - virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + AISObjectPtr getAISObject(AISObjectPtr thePrevious) override; /// Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }; + SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; }; - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }; + SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }; /// Use plugin manager for features creation SketchPlugin_MacroBSpline(); @@ -129,8 +129,8 @@ private: private: std::list myKnots; std::list myMultiplicities; - int myDegree; - bool myIsPeriodic; + int myDegree{3}; + bool myIsPeriodic{false}; }; /**\class SketchPlugin_MacroBSplinePeriodic @@ -146,7 +146,7 @@ public: } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { return SketchPlugin_MacroBSplinePeriodic::ID(); } diff --git a/src/SketchPlugin/SketchPlugin_MacroCircle.cpp b/src/SketchPlugin/SketchPlugin_MacroCircle.cpp index 32a05bdf4..ca128be6d 100644 --- a/src/SketchPlugin/SketchPlugin_MacroCircle.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroCircle.cpp @@ -63,7 +63,7 @@ static const std::string &POINT_ID(int theIndex) { } // namespace SketchPlugin_MacroCircle::SketchPlugin_MacroCircle() - : SketchPlugin_SketchEntity(), myRadius(0.0) {} + : SketchPlugin_SketchEntity() {} void SketchPlugin_MacroCircle::initAttributes() { data()->addAttribute(CIRCLE_TYPE(), ModelAPI_AttributeString::typeId()); @@ -210,9 +210,9 @@ void SketchPlugin_MacroCircle::constraintsForCircleByThreePoints( // Create constraints. ResultPtr aCircleResult = theCircleFeature->lastResult(); - for (int i = 0; i < 3; ++i) { - SketchPlugin_Tools::createCoincidenceOrTangency( - this, aPointRef[i], AttributePtr(), aCircleResult, true); + for (const auto &i : aPointRef) { + SketchPlugin_Tools::createCoincidenceOrTangency(this, i, AttributePtr(), + aCircleResult, true); } } diff --git a/src/SketchPlugin/SketchPlugin_MacroCircle.h b/src/SketchPlugin/SketchPlugin_MacroCircle.h index 2e90290ca..91285989d 100644 --- a/src/SketchPlugin/SketchPlugin_MacroCircle.h +++ b/src/SketchPlugin/SketchPlugin_MacroCircle.h @@ -135,34 +135,34 @@ public: } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_MacroCircle::ID(); return MY_KIND; } /// \brief Request for initialization of data model of the feature: adding all /// attributes. - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// Returns the AIS preview - virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + AISObjectPtr getAISObject(AISObjectPtr thePrevious) override; /// Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }; + SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; }; - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }; + SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }; /// Apply information of the message to current object. It fills reference /// object, tangent type and tangent point refence in case of tangent arc - virtual std::string - processEvent(const std::shared_ptr &theMessage); + std::string + processEvent(const std::shared_ptr &theMessage) override; /// Use plugin manager for features creation SketchPlugin_MacroCircle(); @@ -180,7 +180,7 @@ private: private: std::shared_ptr myCenter; - double myRadius; + double myRadius{0.0}; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_MacroEllipse.cpp b/src/SketchPlugin/SketchPlugin_MacroEllipse.cpp index 3c94718f4..c48e730d9 100644 --- a/src/SketchPlugin/SketchPlugin_MacroEllipse.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroEllipse.cpp @@ -48,7 +48,7 @@ static const double TOLERANCE = 1.e-7; SketchPlugin_MacroEllipse::SketchPlugin_MacroEllipse() - : SketchPlugin_SketchEntity(), myMajorRadius(0.0), myMinorRadius(0.0) {} + : SketchPlugin_SketchEntity() {} void SketchPlugin_MacroEllipse::initAttributes() { data()->addAttribute(ELLIPSE_TYPE(), ModelAPI_AttributeString::typeId()); @@ -193,7 +193,7 @@ void SketchPlugin_MacroEllipse::attributeChanged(const std::string &theID) { anEllipsePoints[0], anEllipsePoints[1], anEllipsePoints[2])); } - if (!anEllipse || anEllipse->implPtr() == 0) + if (!anEllipse || anEllipse->implPtr() == nullptr) return; myCenter = anEllipse->center(); diff --git a/src/SketchPlugin/SketchPlugin_MacroEllipse.h b/src/SketchPlugin/SketchPlugin_MacroEllipse.h index a37165535..b35992e27 100644 --- a/src/SketchPlugin/SketchPlugin_MacroEllipse.h +++ b/src/SketchPlugin/SketchPlugin_MacroEllipse.h @@ -146,34 +146,34 @@ public: } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_MacroEllipse::ID(); return MY_KIND; } /// \brief Request for initialization of data model of the feature: adding all /// attributes. - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// Returns the AIS preview - virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + AISObjectPtr getAISObject(AISObjectPtr thePrevious) override; /// Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; } + SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; } - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } /// Apply information of the message to current object. It fills reference /// object, tangent type and tangent point refence in case of tangent arc - virtual std::string - processEvent(const std::shared_ptr &theMessage); + std::string + processEvent(const std::shared_ptr &theMessage) override; /// Use plugin manager for features creation SketchPlugin_MacroEllipse(); @@ -187,8 +187,8 @@ private: private: std::shared_ptr myCenter; std::shared_ptr myFocus; - double myMajorRadius; - double myMinorRadius; + double myMajorRadius{0.0}; + double myMinorRadius{0.0}; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_MacroEllipticArc.cpp b/src/SketchPlugin/SketchPlugin_MacroEllipticArc.cpp index f51cd1309..7fe467949 100644 --- a/src/SketchPlugin/SketchPlugin_MacroEllipticArc.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroEllipticArc.cpp @@ -47,8 +47,7 @@ const double paramTolerance = 1.e-4; const double PI = 3.141592653589793238463; SketchPlugin_MacroEllipticArc::SketchPlugin_MacroEllipticArc() - : SketchPlugin_SketchEntity(), myMajorRadius(0.0), myMinorRadius(0.0), - myParamDelta(0.0) {} + : SketchPlugin_SketchEntity() {} void SketchPlugin_MacroEllipticArc::initAttributes() { data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::typeId()); @@ -145,7 +144,7 @@ void SketchPlugin_MacroEllipticArc::attributeChanged( anEllipsePoints[0], anEllipsePoints[1], anEllipsePoints[2])); } - if (!anEllipse || anEllipse->implPtr() == 0) + if (!anEllipse || anEllipse->implPtr() == nullptr) return; myMajorRadius = anEllipse->majorRadius(); diff --git a/src/SketchPlugin/SketchPlugin_MacroEllipticArc.h b/src/SketchPlugin/SketchPlugin_MacroEllipticArc.h index ce03ec4fe..dc7b2feea 100644 --- a/src/SketchPlugin/SketchPlugin_MacroEllipticArc.h +++ b/src/SketchPlugin/SketchPlugin_MacroEllipticArc.h @@ -112,34 +112,34 @@ public: } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_MacroEllipticArc::ID(); return MY_KIND; } /// \brief Request for initialization of data model of the feature: adding all /// attributes. - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// Returns the AIS preview - virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + AISObjectPtr getAISObject(AISObjectPtr thePrevious) override; /// Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; } + SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; } - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } /// Apply information of the message to current object. It fills reference /// object, tangent type and tangent point refence in case of tangent arc - virtual std::string - processEvent(const std::shared_ptr &theMessage); + std::string + processEvent(const std::shared_ptr &theMessage) override; /// Use plugin manager for features creation SketchPlugin_MacroEllipticArc(); @@ -155,9 +155,9 @@ private: std::shared_ptr myMajorAxis; std::shared_ptr myStartPnt; std::shared_ptr myEndPnt; - double myMajorRadius; - double myMinorRadius; - double myParamDelta; + double myMajorRadius{0.0}; + double myMinorRadius{0.0}; + double myParamDelta{0.0}; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_MultiRotation.cpp b/src/SketchPlugin/SketchPlugin_MultiRotation.cpp index 632dbd152..954495230 100644 --- a/src/SketchPlugin/SketchPlugin_MultiRotation.cpp +++ b/src/SketchPlugin/SketchPlugin_MultiRotation.cpp @@ -48,8 +48,7 @@ static const double PI = 3.1415926535897932; static const double PERIOD = 360.0; static const double ANGLETOL = 1.e-7; -SketchPlugin_MultiRotation::SketchPlugin_MultiRotation() - : isUpdatingAngle(false) {} +SketchPlugin_MultiRotation::SketchPlugin_MultiRotation() {} void SketchPlugin_MultiRotation::initAttributes() { data()->addAttribute(CENTER_ID(), ModelAPI_AttributeRefAttr::typeId()); @@ -127,7 +126,7 @@ void SketchPlugin_MultiRotation::execute() { for (int anInd = 0; anInd < aRotationObjectRefs->size(); anInd++) { ObjectPtr anObject = aRotationObjectRefs->object(anInd); std::list::const_iterator anIt = anInitialList.begin(); - std::vector::iterator aUsedIt = isUsed.begin(); + auto aUsedIt = isUsed.begin(); for (; anIt != anInitialList.end(); anIt++, aUsedIt++) if (*anIt == anObject) { *aUsedIt = true; @@ -137,9 +136,9 @@ void SketchPlugin_MultiRotation::execute() { anAddition.push_back(anObject); } // remove unused items - std::list::iterator anInitIter = anInitialList.begin(); - std::list::iterator aTargetIter = aTargetList.begin(); - std::vector::iterator aUsedIter = isUsed.begin(); + auto anInitIter = anInitialList.begin(); + auto aTargetIter = aTargetList.begin(); + auto aUsedIter = isUsed.begin(); std::set aFeaturesToBeRemoved; for (; aUsedIter != isUsed.end(); aUsedIter++) { if (!(*aUsedIter)) { @@ -188,7 +187,7 @@ void SketchPlugin_MultiRotation::execute() { aTargetList.insert(aTargetIter, anObject); } else { // remove object - std::list::iterator aRemoveIt = aTargetIter++; + auto aRemoveIt = aTargetIter++; ObjectPtr anObject = *aRemoveIt; aTargetList.erase(aRemoveIt); aRefListOfRotated->remove(anObject); @@ -216,7 +215,7 @@ void SketchPlugin_MultiRotation::execute() { aRefListOfRotated->append(*aTargetIter); } // add new items - std::list::iterator anAddIter = anAddition.begin(); + auto anAddIter = anAddition.begin(); for (; anAddIter != anAddition.end(); anAddIter++) { aRefListOfShapes->append(*anAddIter); aRefListOfRotated->append(*anAddIter); @@ -302,7 +301,7 @@ ObjectPtr SketchPlugin_MultiRotation::copyFeature(ObjectPtr theObject) { std::shared_ptr aShapeIn = aResult->shape(); const std::list &aResults = aNewFeature->results(); - std::list::const_iterator anIt = aResults.begin(); + auto anIt = aResults.begin(); for (; anIt != aResults.end(); anIt++) { ResultConstructionPtr aRC = std::dynamic_pointer_cast(*anIt); @@ -369,7 +368,7 @@ void SketchPlugin_MultiRotation::attributeChanged(const std::string &theID) { AttributeRefListPtr aRefListOfRotated = reflist(SketchPlugin_Constraint::ENTITY_B()); std::list aTargetList = aRefListOfRotated->list(); - std::list::iterator aTargetIter = aTargetList.begin(); + auto aTargetIter = aTargetList.begin(); std::set aFeaturesToBeRemoved; while (aTargetIter != aTargetList.end()) { aTargetIter++; diff --git a/src/SketchPlugin/SketchPlugin_MultiRotation.h b/src/SketchPlugin/SketchPlugin_MultiRotation.h index 30a7681d0..0713591c4 100644 --- a/src/SketchPlugin/SketchPlugin_MultiRotation.h +++ b/src/SketchPlugin/SketchPlugin_MultiRotation.h @@ -47,7 +47,7 @@ public: return MY_CONSTRAINT_ROTATION_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_MultiRotation::ID(); return MY_KIND; } @@ -88,22 +88,22 @@ public: } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// removes all fields from this feature: results, data, etc - SKETCHPLUGIN_EXPORT virtual void erase(); + SKETCHPLUGIN_EXPORT void erase() override; /// \brief Use plugin manager for features creation SketchPlugin_MultiRotation(); @@ -115,7 +115,7 @@ private: bool updateFullAngleValue(); - bool isUpdatingAngle; + bool isUpdatingAngle{false}; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp b/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp index 0d4d8f414..b898f21aa 100644 --- a/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp +++ b/src/SketchPlugin/SketchPlugin_MultiTranslation.cpp @@ -38,7 +38,7 @@ #include #include -SketchPlugin_MultiTranslation::SketchPlugin_MultiTranslation() {} +SketchPlugin_MultiTranslation::SketchPlugin_MultiTranslation() = default; void SketchPlugin_MultiTranslation::initAttributes() { data()->addAttribute(VALUE_TYPE(), ModelAPI_AttributeString::typeId()); @@ -125,7 +125,7 @@ void SketchPlugin_MultiTranslation::execute() { // aTranslationObjectRefs->value(anInd); ObjectPtr anObject = aTranslationObjectRefs->object(anInd); std::list::const_iterator anIt = anInitialList.begin(); - std::vector::iterator aUsedIt = isUsed.begin(); + auto aUsedIt = isUsed.begin(); for (; anIt != anInitialList.end(); anIt++, aUsedIt++) if (*anIt == anObject) { *aUsedIt = true; @@ -135,9 +135,9 @@ void SketchPlugin_MultiTranslation::execute() { anAddition.push_back(anObject); } // remove unused items - std::list::iterator anInitIter = anInitialList.begin(); - std::list::iterator aTargetIter = aTargetList.begin(); - std::vector::iterator aUsedIter = isUsed.begin(); + auto anInitIter = anInitialList.begin(); + auto aTargetIter = aTargetList.begin(); + auto aUsedIter = isUsed.begin(); std::set aFeaturesToBeRemoved; for (; aUsedIter != isUsed.end(); aUsedIter++) { if (!(*aUsedIter)) { @@ -185,7 +185,7 @@ void SketchPlugin_MultiTranslation::execute() { aTargetList.insert(aTargetIter, anObject); } else { // remove object - std::list::iterator aRemoveIt = aTargetIter++; + auto aRemoveIt = aTargetIter++; ObjectPtr anObject = *aRemoveIt; aTargetList.erase(aRemoveIt); aRefListOfTranslated->remove(anObject); @@ -211,7 +211,7 @@ void SketchPlugin_MultiTranslation::execute() { aRefListOfTranslated->append(*aTargetIter); } // add new items - std::list::iterator anAddIter = anAddition.begin(); + auto anAddIter = anAddition.begin(); for (; anAddIter != anAddition.end(); anAddIter++) { aRefListOfShapes->append(*anAddIter); aRefListOfTranslated->append(*anAddIter); @@ -297,7 +297,7 @@ ObjectPtr SketchPlugin_MultiTranslation::copyFeature(ObjectPtr theObject) { std::shared_ptr aShapeIn = aResult->shape(); const std::list &aResults = aNewFeature->results(); - std::list::const_iterator anIt = aResults.begin(); + auto anIt = aResults.begin(); for (; anIt != aResults.end(); anIt++) { ResultConstructionPtr aRC = std::dynamic_pointer_cast(*anIt); @@ -325,7 +325,7 @@ void SketchPlugin_MultiTranslation::attributeChanged(const std::string &theID) { AttributeRefListPtr aRefListOfTranslated = reflist(SketchPlugin_Constraint::ENTITY_B()); std::list aTargetList = aRefListOfTranslated->list(); - std::list::iterator aTargetIter = aTargetList.begin(); + auto aTargetIter = aTargetList.begin(); while (aTargetIter != aTargetList.end()) { aTargetIter++; for (int i = 0; i < aNbCopies && aTargetIter != aTargetList.end(); diff --git a/src/SketchPlugin/SketchPlugin_MultiTranslation.h b/src/SketchPlugin/SketchPlugin_MultiTranslation.h index d9bfc5923..b7067581c 100644 --- a/src/SketchPlugin/SketchPlugin_MultiTranslation.h +++ b/src/SketchPlugin/SketchPlugin_MultiTranslation.h @@ -48,7 +48,7 @@ public: return MY_CONSTRAINT_TRANSLATION_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_MultiTranslation::ID(); return MY_KIND; } @@ -84,22 +84,22 @@ public: } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Called on change of any argument-attribute of this object /// \param theID identifier of changed attribute - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// removes all fields from this feature: results, data, etc - SKETCHPLUGIN_EXPORT virtual void erase(); + SKETCHPLUGIN_EXPORT void erase() override; /// \brief Use plugin manager for features creation SketchPlugin_MultiTranslation(); diff --git a/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.cpp b/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.cpp index ca65e46dc..a89b77ab0 100644 --- a/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.cpp +++ b/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.cpp @@ -56,8 +56,7 @@ bool SketchPlugin_OverConstraintsResolver::perform() { } bool SketchPlugin_OverConstraintsResolver::checkHorizontalOrVerticalConflict() { - std::set::const_iterator anIt = myConstraints.begin(), - aLast = myConstraints.end(); + auto anIt = myConstraints.begin(), aLast = myConstraints.end(); bool isHVConstraint = false; FeaturePtr aFeature; for (; anIt != aLast; anIt++) { @@ -80,8 +79,7 @@ bool SketchPlugin_OverConstraintsResolver::checkHorizontalOrVerticalConflict() { bool SketchPlugin_OverConstraintsResolver::checkArcsAboutTangentialConflict() { bool isConflictsFound = false; - std::set::const_iterator anIt = myConstraints.begin(), - aLast = myConstraints.end(); + auto anIt = myConstraints.begin(), aLast = myConstraints.end(); for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; ConstraintPtr aConstain = diff --git a/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.h b/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.h index 2b7daea42..ce8046e77 100644 --- a/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.h +++ b/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.h @@ -34,9 +34,9 @@ public: SketchPlugin_OverConstraintsResolver(); /// Redefinition of Events_Listener method - void processEvent(const std::shared_ptr &theMessage); + void processEvent(const std::shared_ptr &theMessage) override; - virtual bool groupMessages() { return true; } + bool groupMessages() override { return true; } protected: /// Perform algorithm diff --git a/src/SketchPlugin/SketchPlugin_Plugin.h b/src/SketchPlugin/SketchPlugin_Plugin.h index 4109ac806..9a4914287 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.h +++ b/src/SketchPlugin/SketchPlugin_Plugin.h @@ -35,15 +35,15 @@ class SketchPlugin_Plugin : public ModelAPI_Plugin, public Events_Listener { public: /// Creates the feature object of this plugin by the feature string ID - SKETCHPLUGIN_EXPORT virtual FeaturePtr - createFeature(std::string theFeatureID); + SKETCHPLUGIN_EXPORT FeaturePtr + createFeature(std::string theFeatureID) override; /// Constructor that registers features and other plugin elements. SKETCHPLUGIN_EXPORT SketchPlugin_Plugin(); //! Redefinition of Events_Listener method - SKETCHPLUGIN_EXPORT virtual void - processEvent(const std::shared_ptr &theMessage); + SKETCHPLUGIN_EXPORT void + processEvent(const std::shared_ptr &theMessage) override; protected: //! Returns the state of the feature in the WorkBench: enabled or disabled for diff --git a/src/SketchPlugin/SketchPlugin_Point.cpp b/src/SketchPlugin/SketchPlugin_Point.cpp index 08bcef246..564cce5f2 100644 --- a/src/SketchPlugin/SketchPlugin_Point.cpp +++ b/src/SketchPlugin/SketchPlugin_Point.cpp @@ -63,7 +63,7 @@ void SketchPlugin_Point::execute() { } bool SketchPlugin_Point::isFixed() { - return data()->selection(EXTERNAL_ID())->context().get() != NULL; + return data()->selection(EXTERNAL_ID())->context().get() != nullptr; } void SketchPlugin_Point::attributeChanged(const std::string &theID) { diff --git a/src/SketchPlugin/SketchPlugin_Sketch.cpp b/src/SketchPlugin/SketchPlugin_Sketch.cpp index e399edd08..605cf5cdb 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@ -59,7 +59,7 @@ #include #include -SketchPlugin_Sketch::SketchPlugin_Sketch() {} +SketchPlugin_Sketch::SketchPlugin_Sketch() = default; void SketchPlugin_Sketch::initAttributes() { data()->addAttribute(SketchPlugin_Sketch::ORIGIN_ID(), @@ -143,8 +143,7 @@ void SketchPlugin_Sketch::execute() { const std::list> &aRes = aFeature->results(); - std::list>::const_iterator aResIter = - aRes.cbegin(); + auto aResIter = aRes.cbegin(); for (; aResIter != aRes.cend(); aResIter++) { std::shared_ptr aConstr = std::dynamic_pointer_cast(*aResIter); @@ -401,7 +400,7 @@ void SketchPlugin_Sketch::attributeChanged(const std::string &theID) { Events_Loop::eventByName(EVENT_OBJECT_UPDATED); std::list aSubs = data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->list(); - std::list::iterator aSub = aSubs.begin(); + auto aSub = aSubs.begin(); for (; aSub != aSubs.end(); aSub++) { if (aSub->get()) { if (areCoordPlanes) @@ -547,9 +546,8 @@ static bool isExternalBased(const FeaturePtr theFeature) { bool SketchPlugin_Sketch::removeLinksToExternal() { std::list aRemove; std::list aSubs = reflist(FEATURES_ID())->list(); - for (std::list::iterator anIt = aSubs.begin(); anIt != aSubs.end(); - ++anIt) { - FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); + for (auto &aSub : aSubs) { + FeaturePtr aFeature = ModelAPI_Feature::feature(aSub); if (!aFeature) continue; if (isExternalBased(aFeature)) { @@ -590,9 +588,8 @@ bool SketchPlugin_Sketch::removeLinksToExternal() { } } } - for (std::list::iterator anIt = aRemove.begin(); - anIt != aRemove.end(); ++anIt) - document()->removeFeature(*anIt); + for (auto &anIt : aRemove) + document()->removeFeature(anIt); return true; } @@ -600,10 +597,10 @@ static ObjectPtr findAxis(GeomShapePtr theAxisToCompare, ObjectPtr theOX, ObjectPtr theOY, ObjectPtr theOZ) { if (theAxisToCompare) { ObjectPtr anAxes[] = {theOX, theOY, theOZ}; - for (int i = 0; i < 3; ++i) { - ResultPtr anAx = std::dynamic_pointer_cast(anAxes[i]); + for (auto &anAxe : anAxes) { + ResultPtr anAx = std::dynamic_pointer_cast(anAxe); if (anAx && theAxisToCompare->isEqual(anAx->shape())) - return anAxes[i]; + return anAxe; } } return ObjectPtr(); diff --git a/src/SketchPlugin/SketchPlugin_SketchCopy.cpp b/src/SketchPlugin/SketchPlugin_SketchCopy.cpp index 36207f464..8706c2a33 100644 --- a/src/SketchPlugin/SketchPlugin_SketchCopy.cpp +++ b/src/SketchPlugin/SketchPlugin_SketchCopy.cpp @@ -51,8 +51,7 @@ public: std::list anOldResults = theOld->results(); std::list aNewResults = theNew->results(); - for (std::list::iterator it1 = anOldResults.begin(), - it2 = aNewResults.begin(); + for (auto it1 = anOldResults.begin(), it2 = aNewResults.begin(); it1 != anOldResults.end() && it2 != aNewResults.end(); ++it1, ++it2) { myObjects[*it1] = *it2; checkPostponed(*it1); @@ -81,8 +80,8 @@ protected: auto aFound = myPostponed.find(theOld); if (aFound == myPostponed.end()) return; - for (auto it = aFound->second.begin(); it != aFound->second.end(); ++it) - copyAttribute(it->first, it->second, *this); + for (auto &it : aFound->second) + copyAttribute(it.first, it.second, *this); myPostponed.erase(aFound); } @@ -119,32 +118,28 @@ static void copyRefAttrList(AttributeRefAttrListPtr theOld, MapEntities &theMapOldNew) { // copy only if all referred objects/attribute are already transfered std::list> aRefs = theOld->list(); - for (std::list>::iterator anIt = - aRefs.begin(); - anIt != aRefs.end(); ++anIt) { + for (auto &aRef : aRefs) { ObjectPtr aNewObj = - anIt->first ? theMapOldNew.find(anIt->first) : ObjectPtr(); + aRef.first ? theMapOldNew.find(aRef.first) : ObjectPtr(); AttributePtr aNewAttr = - anIt->second ? theMapOldNew.find(anIt->second) : AttributePtr(); + aRef.second ? theMapOldNew.find(aRef.second) : AttributePtr(); if (aNewObj || aNewAttr) - *anIt = std::pair(aNewObj, aNewAttr); + aRef = std::pair(aNewObj, aNewAttr); else { - if (anIt->first) - theMapOldNew.postpone(anIt->first, theOld, theNew); + if (aRef.first) + theMapOldNew.postpone(aRef.first, theOld, theNew); else - theMapOldNew.postpone(anIt->second->owner(), theOld, theNew); + theMapOldNew.postpone(aRef.second->owner(), theOld, theNew); return; } } // update the RefAttrList theNew->clear(); - for (std::list>::iterator anIt = - aRefs.begin(); - anIt != aRefs.end(); ++anIt) { - if (anIt->first) - theNew->append(anIt->first); + for (auto &aRef : aRefs) { + if (aRef.first) + theNew->append(aRef.first); else - theNew->append(anIt->second); + theNew->append(aRef.second); } } @@ -162,21 +157,19 @@ static void copyRefList(AttributeRefListPtr theOld, AttributeRefListPtr theNew, MapEntities &theMapOldNew) { // copy only if all referred objects are already transfered std::list aRefs = theOld->list(); - for (std::list::iterator anIt = aRefs.begin(); anIt != aRefs.end(); - ++anIt) { - ObjectPtr aNew = theMapOldNew.find(*anIt); + for (auto &aRef : aRefs) { + ObjectPtr aNew = theMapOldNew.find(aRef); if (aNew) - *anIt = aNew; + aRef = aNew; else { - theMapOldNew.postpone(*anIt, theOld, theNew); + theMapOldNew.postpone(aRef, theOld, theNew); return; } } // update theRefList theNew->clear(); - for (std::list::iterator anIt = aRefs.begin(); anIt != aRefs.end(); - ++anIt) - theNew->append(*anIt); + for (auto &aRef : aRefs) + theNew->append(aRef); } static void copySelection(AttributeSelectionPtr theOld, @@ -230,8 +223,7 @@ static void renameByParent(FeaturePtr theOld, FeaturePtr theNew) { const std::list &anOldResults = theOld->results(); const std::list &aNewResults = theNew->results(); - for (std::list::const_iterator it0 = anOldResults.begin(), - it1 = aNewResults.begin(); + for (auto it0 = anOldResults.begin(), it1 = aNewResults.begin(); it0 != anOldResults.end() && it1 != aNewResults.end(); ++it0, ++it1) { (*it1)->data()->setName((*it0)->data()->name()); SketchPlugin_Tools::replaceInName(*it1, anOldName, aNewName); @@ -248,8 +240,7 @@ static void copyFeature(const FeaturePtr theFeature, FeaturePtr aNewFeature = theSketch->addFeature(theFeature->getKind()); theFeature->data()->copyTo(aNewFeature->data()); int aResultIndex = 0; - for (std::list::const_iterator aRIt = - theFeature->results().begin(); + for (auto aRIt = theFeature->results().begin(); aRIt != theFeature->results().end(); ++aRIt) { ResultConstructionPtr aResult = theSketch->document()->createConstruction( aNewFeature->data(), aResultIndex); @@ -267,10 +258,9 @@ static void copyFeature(const FeaturePtr theFeature, aNewFeature->data()->blockSendAttributeUpdated(true, false); std::list anAttrs = aNewFeature->data()->attributes(std::string()); - for (std::list::iterator anIt = anAttrs.begin(); - anIt != anAttrs.end(); ++anIt) { - AttributePtr anOldAttr = theFeature->attribute((*anIt)->id()); - copyAttribute(anOldAttr, *anIt, theMapOldNew); + for (auto &anAttr : anAttrs) { + AttributePtr anOldAttr = theFeature->attribute(anAttr->id()); + copyAttribute(anOldAttr, anAttr, theMapOldNew); } aNewFeature->data()->blockSendAttributeUpdated(aWasBlocked, false); @@ -325,14 +315,13 @@ void SketchPlugin_SketchCopy::execute() { std::wstring aSketchName = aBaseSketch->name() + SKETCH_NAME_SUFFIX; int aNewSketchIndex = 0; std::list aFeatures = document()->allFeatures(); - for (std::list::iterator aFIt = aFeatures.begin(); - aFIt != aFeatures.end(); ++aFIt) { - if ((*aFIt)->getKind() != SketchPlugin_Sketch::ID()) + for (auto &aFeature : aFeatures) { + if (aFeature->getKind() != SketchPlugin_Sketch::ID()) continue; - int anIndex = index((*aFIt)->name(), aSketchName); + int anIndex = index(aFeature->name(), aSketchName); if (anIndex >= aNewSketchIndex) aNewSketchIndex = anIndex + 1; - anIndex = index((*aFIt)->lastResult()->data()->name(), aSketchName); + anIndex = index(aFeature->lastResult()->data()->name(), aSketchName); if (anIndex >= aNewSketchIndex) aNewSketchIndex = anIndex + 1; } diff --git a/src/SketchPlugin/SketchPlugin_SketchCopy.h b/src/SketchPlugin/SketchPlugin_SketchCopy.h index 8508c25ed..cb2d82f3c 100644 --- a/src/SketchPlugin/SketchPlugin_SketchCopy.h +++ b/src/SketchPlugin/SketchPlugin_SketchCopy.h @@ -46,23 +46,23 @@ public: } /// \return the kind of a feature. - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_SketchCopy::ID(); return MY_KIND; } /// Creates a new sketch. - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes. - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Means that feature is removed on apply. - SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; } + SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; } /// No preview is generated until it is applied. - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } }; #endif diff --git a/src/SketchPlugin/SketchPlugin_SketchDrawer.cpp b/src/SketchPlugin/SketchPlugin_SketchDrawer.cpp index 4fb830551..f776a5d57 100644 --- a/src/SketchPlugin/SketchPlugin_SketchDrawer.cpp +++ b/src/SketchPlugin/SketchPlugin_SketchDrawer.cpp @@ -217,14 +217,12 @@ void SketchPlugin_SketchDrawer::execute() { // and arcs } // check some resulting points are coincident to existing - std::list>::iterator aPIter = - aPoints.begin(); + auto aPIter = aPoints.begin(); for (; aPIter != aPoints.end(); aPIter++) { AttributePoint2DPtr aPointAttr = std::dynamic_pointer_cast( anItem->attribute(aPIter->second)); - std::list::iterator aCoincIter = - aCreatedPoints.begin(); + auto aCoincIter = aCreatedPoints.begin(); for (; aCoincIter != aCreatedPoints.end(); aCoincIter++) { double aDX = (*aCoincIter)->x() - aPIter->first->x(); if (fabs(aDX) >= kTOL) diff --git a/src/SketchPlugin/SketchPlugin_SketchDrawer.h b/src/SketchPlugin/SketchPlugin_SketchDrawer.h index 8d050fbbf..ae65b1694 100644 --- a/src/SketchPlugin/SketchPlugin_SketchDrawer.h +++ b/src/SketchPlugin/SketchPlugin_SketchDrawer.h @@ -58,24 +58,24 @@ public: } /// \return the kind of a feature. - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_SketchDrawer::ID(); return MY_KIND; } /// Creates a new sketch. - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes. - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Reimplemented from ModelAPI_Feature::isMacro(). Means that feature is /// removed on apply. \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; } + SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; } /// No preview is generated until it is applied. - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } }; #endif diff --git a/src/SketchPlugin/SketchPlugin_Split.cpp b/src/SketchPlugin/SketchPlugin_Split.cpp index 4e066a650..a7537113f 100644 --- a/src/SketchPlugin/SketchPlugin_Split.cpp +++ b/src/SketchPlugin/SketchPlugin_Split.cpp @@ -74,7 +74,7 @@ static const double PI = 3.141592653589793238463; -SketchPlugin_Split::SketchPlugin_Split() {} +SketchPlugin_Split::SketchPlugin_Split() = default; void SketchPlugin_Split::initAttributes() { data()->addAttribute(SELECTED_OBJECT(), @@ -644,9 +644,8 @@ void SketchPlugin_Split::updateCoincidenceConstraintsToFeature( theFurtherCoincidences.end()) aNewCoincidencesToSplitFeature.insert(anEndPointAttr); - std::map::const_iterator - aCIt = theCoincidenceToFeature.begin(), - aCLast = theCoincidenceToFeature.end(); + auto aCIt = theCoincidenceToFeature.begin(), + aCLast = theCoincidenceToFeature.end(); #ifdef DEBUG_SPLIT std::cout << std::endl; std::cout << "Coincidences to feature(modified):" << std::endl; @@ -660,9 +659,8 @@ void SketchPlugin_Split::updateCoincidenceConstraintsToFeature( : SketchPlugin_Constraint::ENTITY_A(); AttributePoint2DPtr aCoincPoint = aCIt->second.second; - std::set::const_iterator - aFCIt = theFurtherCoincidences.begin(), - aFCLast = theFurtherCoincidences.end(); + auto aFCIt = theFurtherCoincidences.begin(), + aFCLast = theFurtherCoincidences.end(); std::shared_ptr aCoincPnt = aCoincPoint->pnt(); AttributePoint2DPtr aFeaturePointAttribute; for (; aFCIt != aFCLast && !aFeaturePointAttribute.get(); aFCIt++) { @@ -678,9 +676,8 @@ void SketchPlugin_Split::updateCoincidenceConstraintsToFeature( aCoincFeature->refattr(aSecondAttribute)->attr()); theFeaturesToDelete.insert(aCIt->first); // create new coincidences to split feature points - std::set::const_iterator - aSFIt = aNewCoincidencesToSplitFeature.begin(), - aSFLast = aNewCoincidencesToSplitFeature.end(); + auto aSFIt = aNewCoincidencesToSplitFeature.begin(), + aSFLast = aNewCoincidencesToSplitFeature.end(); for (; aSFIt != aSFLast; aSFIt++) { AttributePoint2DPtr aSFAttribute = *aSFIt; if (aCoincPnt->isEqual(aSFAttribute->pnt())) { @@ -718,8 +715,7 @@ void SketchPlugin_Split::updateCoincidenceConstraintsToFeature( void SketchPlugin_Split::updateRefFeatureConstraints( const ResultPtr &theFeatureBaseResult, const std::list &theRefsToFeature) { - std::list::const_iterator anIt = theRefsToFeature.begin(), - aLast = theRefsToFeature.end(); + auto anIt = theRefsToFeature.begin(), aLast = theRefsToFeature.end(); for (; anIt != aLast; anIt++) { AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(*anIt); @@ -1259,17 +1255,15 @@ FeaturePtr SketchPlugin_Split::splitClosed( // ellipse const std::set &aRefs = aBaseFeature->data()->refsToMe(); std::list aRefsToParent; - for (std::set::const_iterator aRef = aRefs.begin(); - aRef != aRefs.end(); ++aRef) { - if ((*aRef)->id() == SketchPlugin_SketchEntity::PARENT_ID()) - aRefsToParent.push_back(*aRef); + for (const auto &aRef : aRefs) { + if (aRef->id() == SketchPlugin_SketchEntity::PARENT_ID()) + aRefsToParent.push_back(aRef); } - for (std::list::iterator aRef = aRefsToParent.begin(); - aRef != aRefsToParent.end(); ++aRef) { - std::dynamic_pointer_cast(*aRef)->setValue( + for (auto &aRef : aRefsToParent) { + std::dynamic_pointer_cast(aRef)->setValue( theBaseFeatureModified); - FeaturePtr anOwner = ModelAPI_Feature::feature((*aRef)->owner()); + FeaturePtr anOwner = ModelAPI_Feature::feature(aRef->owner()); SketchPlugin_Tools::replaceInName(anOwner, aBaseFeature->name(), theBaseFeatureModified->name()); SketchPlugin_Tools::replaceInName(anOwner->lastResult(), @@ -1472,9 +1466,7 @@ SketchPlugin_Split::getPointAttribute(const bool isFirstAttribute) { // find the points in coincident features const GeomAlgoAPI_ShapeTools::PointToRefsMap &aRefAttributes = myCashedReferences.at(aBaseObject); - GeomAlgoAPI_ShapeTools::PointToRefsMap::const_iterator - aRIt = aRefAttributes.begin(), - aRLast = aRefAttributes.end(); + auto aRIt = aRefAttributes.begin(), aRLast = aRefAttributes.end(); for (; aRIt != aRLast; aRIt++) { const std::list &anAttributes = aRIt->second.first; GeomPointPtr aPoint = aRIt->first; diff --git a/src/SketchPlugin/SketchPlugin_Split.h b/src/SketchPlugin/SketchPlugin_Split.h index c0def317a..9995ed322 100644 --- a/src/SketchPlugin/SketchPlugin_Split.h +++ b/src/SketchPlugin/SketchPlugin_Split.h @@ -33,8 +33,8 @@ class GeomDataAPI_Point2D; class ModelAPI_Feature; class ModelAPI_Result; -typedef std::pair> - IdToPointPair; +using IdToPointPair = + std::pair>; /** \class SketchPlugin_Split * \ingroup Plugins @@ -79,7 +79,7 @@ public: return MY_SPLIT_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_Split::ID(); return MY_KIND; } @@ -108,31 +108,31 @@ public: } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Reimplemented from ModelAPI_Feature::isMacro(). /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; } + SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; } /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. /// This is necessary to perform execute only by apply the feature - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } /// \brief Use plugin manager for features creation SketchPlugin_Split(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// Apply information of the message to current object. It fills selected /// point and object - virtual std::string - processEvent(const std::shared_ptr &theMessage); + std::string + processEvent(const std::shared_ptr &theMessage) override; private: /// Obtains those constraints of the feature that should be modified. output diff --git a/src/SketchPlugin/SketchPlugin_Tools.cpp b/src/SketchPlugin/SketchPlugin_Tools.cpp index 28991e0ff..3c05444ed 100644 --- a/src/SketchPlugin/SketchPlugin_Tools.cpp +++ b/src/SketchPlugin/SketchPlugin_Tools.cpp @@ -100,7 +100,7 @@ void clearExpressions(FeaturePtr theFeature) { std::list anAttributes = theFeature->data()->attributes(std::string()); - std::list::iterator anAttributeIt = anAttributes.begin(); + auto anAttributeIt = anAttributes.begin(); for (; anAttributeIt != anAttributes.end(); ++anAttributeIt) { clearExpressions(*anAttributeIt); } @@ -110,7 +110,7 @@ std::shared_ptr getCoincidencePoint(const FeaturePtr theStartCoin) { std::shared_ptr aPnt = SketcherPrs_Tools::getPoint( theStartCoin.get(), SketchPlugin_Constraint::ENTITY_A()); - if (aPnt.get() == NULL) + if (aPnt.get() == nullptr) aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), SketchPlugin_Constraint::ENTITY_B()); return aPnt; @@ -142,14 +142,14 @@ void findCoincidences(const FeaturePtr theStartCoin, const std::string &theAttr, FeaturePtr aObj = ModelAPI_Feature::feature(aPnt->object()); if (theList.find(aObj) == theList.end()) { std::shared_ptr aOrig = getCoincidencePoint(theStartCoin); - if (aOrig.get() == NULL) { + if (aOrig.get() == nullptr) { return; } if (!theIsAttrOnly || !aPnt->isObject()) { theList.insert(aObj); } std::set aCoincidences = findCoincidentConstraints(aObj); - std::set::const_iterator aCIt = aCoincidences.begin(); + auto aCIt = aCoincidences.begin(); for (; aCIt != aCoincidences.end(); ++aCIt) { FeaturePtr aConstrFeature = *aCIt; std::shared_ptr aPnt2d = @@ -174,7 +174,7 @@ findFeaturesCoincidentToPoint(const AttributePoint2DPtr &thePoint) { aCoincidentFeatures.insert(anOwner); std::set aCoincidences = findCoincidentConstraints(anOwner); - std::set::const_iterator aCIt = aCoincidences.begin(); + auto aCIt = aCoincidences.begin(); for (; aCIt != aCoincidences.end(); ++aCIt) { bool isPointUsedInCoincidence = false; AttributeRefAttrPtr anOtherCoincidentAttr; @@ -225,8 +225,8 @@ public: if (thePoint2) (*aFound1)[thePoint2].insert(theIndex2); } else { - for (auto it = aFound2->begin(); it != aFound2->end(); ++it) - (*aFound1)[it->first].insert(it->second.begin(), it->second.end()); + for (auto &it : *aFound2) + (*aFound1)[it.first].insert(it.second.begin(), it.second.end()); myCoincidentPoints.erase(aFound2); } } @@ -238,26 +238,26 @@ public: std::set aCoincPoints; auto aFound = find(thePoint, THE_DEFAULT_INDEX); if (aFound != myCoincidentPoints.end()) { - for (auto it = aFound->begin(); it != aFound->end(); ++it) { + for (auto &it : *aFound) { AttributePoint2DPtr aPoint = - std::dynamic_pointer_cast(it->first); + std::dynamic_pointer_cast(it.first); if (aPoint) aCoincPoints.insert(aPoint); else { AttributePoint2DArrayPtr aPointArray = - std::dynamic_pointer_cast(it->first); + std::dynamic_pointer_cast(it.first); if (aPointArray) { // this is a B-spline feature, the connection is possible // to the first or the last point FeaturePtr anOwner = ModelAPI_Feature::feature(aPointArray->owner()); - if (it->second.find(0) != it->second.end()) { + if (it.second.find(0) != it.second.end()) { AttributePoint2DPtr aFirstPoint = std::dynamic_pointer_cast( anOwner->attribute(SketchPlugin_BSpline::START_ID())); aCoincPoints.insert(aFirstPoint); } - if (it->second.find(aPointArray->size() - 1) != it->second.end()) { + if (it.second.find(aPointArray->size() - 1) != it.second.end()) { AttributePoint2DPtr aFirstPoint = std::dynamic_pointer_cast( anOwner->attribute(SketchPlugin_BSpline::END_ID())); @@ -282,7 +282,7 @@ private: theFeature->lastResult()); aCoincidences.insert(aCoincToRes.begin(), aCoincToRes.end()); } - std::set::const_iterator aCIt = aCoincidences.begin(); + auto aCIt = aCoincidences.begin(); for (; aCIt != aCoincidences.end(); ++aCIt) { if (theCoincidences.find(*aCIt) != theCoincidences.end()) continue; // already processed @@ -316,7 +316,7 @@ private: std::set aCoincidences; coincidences(anOwner, aCoincidences); - std::set::const_iterator aCIt = aCoincidences.begin(); + auto aCIt = aCoincidences.begin(); for (; aCIt != aCoincidences.end(); ++aCIt) { aPoints[0] = aPoints[1] = AttributePtr(); anIndicesInArray[0] = anIndicesInArray[1] = THE_DEFAULT_INDEX; @@ -803,8 +803,7 @@ GeomShapePtr SketchPlugin_SegmentationTools::getSubShape( std::shared_ptr aStartPoint; std::shared_ptr aSecondPoint; const std::set &aShapes = theCashedShapes[aBaseObject]; - std::set::const_iterator anIt = aShapes.begin(), - aLast = aShapes.end(); + auto anIt = aShapes.begin(), aLast = aShapes.end(); for (; anIt != aLast; anIt++) { GeomShapePtr aCurrentShape = *anIt; std::shared_ptr aProjectedPoint; @@ -913,9 +912,8 @@ void SketchPlugin_SegmentationTools::updateRefAttConstraints( std::cout << "updateRefAttConstraints" << std::endl; #endif - std::set>::const_iterator - anIt = theModifiedAttributes.begin(), - aLast = theModifiedAttributes.end(); + auto anIt = theModifiedAttributes.begin(), + aLast = theModifiedAttributes.end(); for (; anIt != aLast; anIt++) { AttributePtr anAttribute = anIt->first; AttributePtr aNewAttribute = anIt->second; @@ -945,8 +943,7 @@ void SketchPlugin_SegmentationTools::updateRefAttConstraints( void SketchPlugin_SegmentationTools::updateFeaturesAfterOperation( const std::set &theFeaturesToUpdate) { - std::set::const_iterator anIt = theFeaturesToUpdate.begin(), - aLast = theFeaturesToUpdate.end(); + auto anIt = theFeaturesToUpdate.begin(), aLast = theFeaturesToUpdate.end(); for (; anIt != aLast; anIt++) { FeaturePtr aRefFeature = std::dynamic_pointer_cast(*anIt); std::string aRefFeatureKind = aRefFeature->getKind(); @@ -1056,7 +1053,7 @@ struct ArcAttributes { std::string myEnd; std::string myReversed; - ArcAttributes() {} + ArcAttributes() = default; ArcAttributes(const std::string &theKind) : myKind(theKind) { if (myKind == SketchPlugin_Arc::ID()) { diff --git a/src/SketchPlugin/SketchPlugin_Trim.cpp b/src/SketchPlugin/SketchPlugin_Trim.cpp index 1cc79e7c5..eaae8a48c 100644 --- a/src/SketchPlugin/SketchPlugin_Trim.cpp +++ b/src/SketchPlugin/SketchPlugin_Trim.cpp @@ -77,7 +77,7 @@ static const double PI = 3.141592653589793238463; -SketchPlugin_Trim::SketchPlugin_Trim() {} +SketchPlugin_Trim::SketchPlugin_Trim() = default; void SketchPlugin_Trim::initAttributes() { data()->addAttribute(SELECTED_OBJECT(), @@ -120,8 +120,7 @@ void SketchPlugin_Trim::findShapePoints( const std::set &aShapes = myCashedShapes[aBaseObject]; if (!aShapes.empty()) { - std::set::const_iterator anIt = aShapes.begin(), - aLast = aShapes.end(); + auto anIt = aShapes.begin(), aLast = aShapes.end(); for (; anIt != aLast; anIt++) { GeomShapePtr aBaseShape = *anIt; std::shared_ptr aProjectedPoint; @@ -173,9 +172,8 @@ SketchPlugin_Trim::convertPoint(const std::shared_ptr &thePoint) { bool aFound = false; const GeomAlgoAPI_ShapeTools::PointToRefsMap &aRefsMap = myObjectToPoints.at(aBaseObject); - for (GeomAlgoAPI_ShapeTools::PointToRefsMap::const_iterator aPointIt = - aRefsMap.begin(); - aPointIt != aRefsMap.end() && !aFound; aPointIt++) { + for (auto aPointIt = aRefsMap.begin(); aPointIt != aRefsMap.end() && !aFound; + aPointIt++) { if (aPointIt->first->isEqual(thePoint)) { const std::pair, std::list> &anInfo = aPointIt->second; @@ -350,11 +348,8 @@ void SketchPlugin_Trim::execute() { // create coincidence to objects, intersected the base object const GeomAlgoAPI_ShapeTools::PointToRefsMap &aRefsMap = myObjectToPoints.at(aBaseObject); - for (std::set::const_iterator - anIt = aFurtherCoincidences.begin(), - aLast = aFurtherCoincidences.end(); - anIt != aLast; anIt++) { - AttributePoint2DPtr aPointAttribute = (*anIt); + for (const auto &aFurtherCoincidence : aFurtherCoincidences) { + AttributePoint2DPtr aPointAttribute = aFurtherCoincidence; std::shared_ptr aPoint2d = aPointAttribute->pnt(); #ifdef DEBUG_TRIM @@ -379,11 +374,9 @@ void SketchPlugin_Trim::execute() { continue; std::pair, std::list> anInfo; - for (GeomAlgoAPI_ShapeTools::PointToRefsMap::const_iterator aRefIt = - aRefsMap.begin(); - aRefIt != aRefsMap.end(); aRefIt++) { - if (aRefIt->first->isEqual(aExtrPoint)) { - anInfo = aRefIt->second; + for (const auto &aRefIt : aRefsMap) { + if (aRefIt.first->isEqual(aExtrPoint)) { + anInfo = aRefIt.second; // prefer a segment instead of a point, because further coincidence with // a segment decreases only 1 DoF (instead of 2 for point) and prevents // an overconstraint situation. @@ -403,11 +396,10 @@ void SketchPlugin_Trim::execute() { } } const std::list &anObjects = anInfo.second; - for (std::list::const_iterator anObjectIt = anObjects.begin(); - anObjectIt != anObjects.end(); anObjectIt++) { + for (const auto &anObject : anObjects) { SketchPlugin_Tools::createConstraintAttrObject( sketch(), SketchPlugin_ConstraintCoincidence::ID(), aPointAttribute, - *anObjectIt); + anObject); } } @@ -418,11 +410,7 @@ void SketchPlugin_Trim::execute() { aReplacingFeature->execute(); // need it to obtain result aReplacingResult = aReplacingFeature->lastResult(); } - for (std::list::const_iterator anIt = aRefsToFeature.begin(), - aLast = aRefsToFeature.end(); - anIt != aLast; anIt++) { - AttributePtr anAttribute = *anIt; - + for (auto anAttribute : aRefsToFeature) { if (setCoincidenceToAttribute(anAttribute, aFurtherCoincidences, aFeaturesToDelete)) continue; @@ -609,9 +597,8 @@ bool SketchPlugin_Trim::setCoincidenceToAttribute( return false; std::shared_ptr aRefPnt2d = aRefPointAttr->pnt(); - std::set::const_iterator - anIt = theFurtherCoincidences.begin(), - aLast = theFurtherCoincidences.end(); + auto anIt = theFurtherCoincidences.begin(), + aLast = theFurtherCoincidences.end(); bool aFoundPoint = false; for (; anIt != aLast && !aFoundPoint; anIt++) { AttributePoint2DPtr aPointAttribute = (*anIt); @@ -1121,17 +1108,15 @@ FeaturePtr SketchPlugin_Trim::trimClosed( // ellipse const std::set &aRefs = aBaseFeature->data()->refsToMe(); std::list aRefsToParent; - for (std::set::const_iterator aRef = aRefs.begin(); - aRef != aRefs.end(); ++aRef) { - if ((*aRef)->id() == SketchPlugin_SketchEntity::PARENT_ID()) - aRefsToParent.push_back(*aRef); + for (const auto &aRef : aRefs) { + if (aRef->id() == SketchPlugin_SketchEntity::PARENT_ID()) + aRefsToParent.push_back(aRef); } - for (std::list::iterator aRef = aRefsToParent.begin(); - aRef != aRefsToParent.end(); ++aRef) { - std::dynamic_pointer_cast(*aRef)->setValue( + for (auto &aRef : aRefsToParent) { + std::dynamic_pointer_cast(aRef)->setValue( anNewFeature); - FeaturePtr anOwner = ModelAPI_Feature::feature((*aRef)->owner()); + FeaturePtr anOwner = ModelAPI_Feature::feature(aRef->owner()); SketchPlugin_Tools::replaceInName(anOwner, aBaseFeature->name(), anNewFeature->name()); SketchPlugin_Tools::replaceInName( diff --git a/src/SketchPlugin/SketchPlugin_Trim.h b/src/SketchPlugin/SketchPlugin_Trim.h index 7a44f9230..f5cbc86a7 100644 --- a/src/SketchPlugin/SketchPlugin_Trim.h +++ b/src/SketchPlugin/SketchPlugin_Trim.h @@ -33,8 +33,8 @@ class ModelAPI_Feature; class ModelAPI_Result; class ModelAPI_Object; -typedef std::pair> - IdToPointPair; +using IdToPointPair = + std::pair>; /** \class SketchPlugin_Trim * \ingroup Plugins @@ -51,7 +51,7 @@ public: return MY_TRIM_ID; } /// \brief Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind() { + SKETCHPLUGIN_EXPORT const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_Trim::ID(); return MY_KIND; } @@ -81,31 +81,31 @@ public: } /// \brief Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// \brief Request for initialization of data model of the feature: adding all /// attributes - SKETCHPLUGIN_EXPORT virtual void initAttributes(); + SKETCHPLUGIN_EXPORT void initAttributes() override; /// Reimplemented from ModelAPI_Feature::isMacro() /// \returns true - SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; } + SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; } /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false. /// This is necessary to perform execute only by apply the feature - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; } + SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; } /// \brief Use plugin manager for features creation SketchPlugin_Trim(); /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// Apply information of the message to current object. It fills selected /// point and object - virtual std::string - processEvent(const std::shared_ptr &theMessage); + std::string + processEvent(const std::shared_ptr &theMessage) override; private: bool setCoincidenceToAttribute( diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index eaa1830b5..30747b15e 100644 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -252,7 +252,7 @@ bool SketchPlugin_TangentAttrValidator::isValid( // boundary point std::set aCoincidences = SketchPlugin_Tools::findCoincidentConstraints(aRefFea); - for (std::set::iterator anIt = aCoincidences.begin(); + for (auto anIt = aCoincidences.begin(); anIt != aCoincidences.end() && !isValid; ++anIt) { std::set aCoinc; if (isApplicableCoincidence(*anIt, SketchPlugin_Constraint::ENTITY_A())) @@ -263,7 +263,7 @@ bool SketchPlugin_TangentAttrValidator::isValid( SketchPlugin_Tools::findCoincidences( *anIt, SketchPlugin_Constraint::ENTITY_A(), aCoinc, true); - std::set::iterator aFoundCoinc = aCoinc.find(aOtherFea); + auto aFoundCoinc = aCoinc.find(aOtherFea); if (aFoundCoinc != aCoinc.end()) { // do not take into account internal constraints AttributeReferencePtr aParent = @@ -322,7 +322,7 @@ bool SketchPlugin_PerpendicularAttrValidator::isValid( bool SketchPlugin_NotFixedValidator::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { theError = "The attribute with the %1 type is not processed"; @@ -437,7 +437,7 @@ bool SketchPlugin_EqualAttrValidator::isValid( bool SketchPlugin_MirrorAttrValidator::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefList::typeId()) { theError = "The attribute with the %1 type is not processed"; @@ -468,7 +468,7 @@ bool SketchPlugin_MirrorAttrValidator::isValid( } std::wstring aName = aSelObject.get() ? aSelObject->data()->name() : L""; - std::list::iterator aMirIter = aMirroredObjects.begin(); + auto aMirIter = aMirroredObjects.begin(); for (; aMirIter != aMirroredObjects.end(); aMirIter++) if (aSelObject == *aMirIter) { theError = "The object %1 is a result of mirror"; @@ -545,7 +545,7 @@ bool SketchPlugin_CoincidenceAttrValidator::isValid( bool SketchPlugin_CopyValidator::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefList::typeId()) { theError = "The attribute with the %1 type is not processed"; @@ -602,7 +602,7 @@ bool SketchPlugin_CopyValidator::isValid( std::dynamic_pointer_cast(*anObjIter); if (aCurFeature) { const std::list &aResults = aCurFeature->results(); - for (std::list::const_iterator aResIt = aResults.begin(); + for (auto aResIt = aResults.begin(); aResIt != aResults.end() && !isFound; ++aResIt) { isFound = aSelObject == *aResIt; } @@ -624,7 +624,7 @@ bool SketchPlugin_CopyValidator::isValid( bool SketchPlugin_SolverErrorValidator::isValid( const std::shared_ptr &theFeature, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeStringPtr aAttributeString = theFeature->string(SketchPlugin_Sketch::SOLVER_ERROR()); @@ -638,15 +638,14 @@ bool SketchPlugin_SolverErrorValidator::isValid( } bool SketchPlugin_SolverErrorValidator::isNotObligatory( - std::string theFeature, std::string theAttribute) { + std::string /*theFeature*/, std::string /*theAttribute*/) { return true; } static bool hasSameTangentFeature(const std::set &theRefsList, const FeaturePtr theFeature) { - for (std::set::const_iterator anIt = theRefsList.cbegin(); - anIt != theRefsList.cend(); ++anIt) { - std::shared_ptr aAttr = (*anIt); + for (const auto &anIt : theRefsList) { + std::shared_ptr aAttr = anIt; FeaturePtr aFeature = std::dynamic_pointer_cast(aAttr->owner()); if (!aFeature) @@ -701,14 +700,14 @@ static bool isPointPointCoincidence(const FeaturePtr &theCoincidence) { arePoints = aFeature.get() && aFeature->getKind() == SketchPlugin_Point::ID(); } else - arePoints = aRefAttr[i]->attr().get() != NULL; + arePoints = aRefAttr[i]->attr().get() != nullptr; } return arePoints; } bool SketchPlugin_FilletVertexValidator::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { FeaturePtr anEdge1, anEdge2; return isValidVertex(theAttribute, theError, anEdge1, anEdge2); @@ -736,9 +735,8 @@ bool SketchPlugin_FilletVertexValidator::isValidVertex( const std::set &aRefsList = aPointAttribute->owner()->data()->refsToMe(); FeaturePtr aConstraintCoincidence; - for (std::set::const_iterator anIt = aRefsList.cbegin(); - anIt != aRefsList.cend(); ++anIt) { - std::shared_ptr aAttr = (*anIt); + for (const auto &anIt : aRefsList) { + std::shared_ptr aAttr = anIt; FeaturePtr aConstrFeature = std::dynamic_pointer_cast(aAttr->owner()); if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { @@ -784,21 +782,20 @@ bool SketchPlugin_FilletVertexValidator::isValidVertex( // Remove points and external lines from set of coincides. std::set aNewSetOfCoincides; - for (std::set::iterator anIt = aCoinsides.begin(); - anIt != aCoinsides.end(); ++anIt) { + for (const auto &aCoinside : aCoinsides) { std::shared_ptr aSketchEntity = - std::dynamic_pointer_cast(*anIt); + std::dynamic_pointer_cast(aCoinside); if (aSketchEntity.get() && (aSketchEntity->isCopy() || aSketchEntity->isExternal())) { continue; } - if ((*anIt)->getKind() != SketchPlugin_Line::ID() && - (*anIt)->getKind() != SketchPlugin_Arc::ID()) { + if (aCoinside->getKind() != SketchPlugin_Line::ID() && + aCoinside->getKind() != SketchPlugin_Arc::ID()) { continue; } - if ((*anIt)->getKind() == SketchPlugin_Arc::ID()) { + if (aCoinside->getKind() == SketchPlugin_Arc::ID()) { AttributePtr anArcCenter = - (*anIt)->attribute(SketchPlugin_Arc::CENTER_ID()); + aCoinside->attribute(SketchPlugin_Arc::CENTER_ID()); std::shared_ptr anArcCenterPnt = std::dynamic_pointer_cast(anArcCenter)->pnt(); double aDistSelectedArcCenter = aSelectedPnt->distance(anArcCenterPnt); @@ -806,7 +803,7 @@ bool SketchPlugin_FilletVertexValidator::isValidVertex( continue; } } - aNewSetOfCoincides.insert(*anIt); + aNewSetOfCoincides.insert(aCoinside); } aCoinsides = aNewSetOfCoincides; @@ -814,12 +811,10 @@ bool SketchPlugin_FilletVertexValidator::isValidVertex( // of coincides. if (aCoinsides.size() > 2) { aNewSetOfCoincides.clear(); - for (std::set::iterator anIt = aCoinsides.begin(); - anIt != aCoinsides.end(); ++anIt) { - if (!(*anIt) - ->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) + for (const auto &aCoinside : aCoinsides) { + if (!aCoinside->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()) ->value()) { - aNewSetOfCoincides.insert(*anIt); + aNewSetOfCoincides.insert(aCoinside); } } aCoinsides = aNewSetOfCoincides; @@ -832,12 +827,12 @@ bool SketchPlugin_FilletVertexValidator::isValidVertex( } // output edges - std::set::iterator aFIt = aCoinsides.begin(); + auto aFIt = aCoinsides.begin(); theEdge1 = *aFIt; theEdge2 = *(++aFIt); // Check that selected edges don't have tangent constraint. - std::set::iterator anIt = aCoinsides.begin(); + auto anIt = aCoinsides.begin(); FeaturePtr aFirstFeature = *anIt++; FeaturePtr aSecondFeature = *anIt; const std::set &aFirstFeatureRefsList = @@ -848,9 +843,7 @@ bool SketchPlugin_FilletVertexValidator::isValidVertex( } std::list aFirstResults = aFirstFeature->results(); - for (std::list::iterator aResIt = aFirstResults.begin(); - aResIt != aFirstResults.end(); ++aResIt) { - ResultPtr aRes = *aResIt; + for (auto aRes : aFirstResults) { const std::set &aResRefsList = aRes->data()->refsToMe(); if (hasSameTangentFeature(aResRefsList, aSecondFeature)) { theError = "Error: Edges in selected point has tangent constraint."; @@ -935,11 +928,11 @@ bool SketchPlugin_MiddlePointAttrValidator::isValid( AttributeRefAttrPtr aRefAttrs[2] = {aRefAttr, anOtherAttr}; int aNbPoints = 0; int aNbLines = 0; - for (int i = 0; i < 2; ++i) { - if (!aRefAttrs[i]->isObject()) + for (auto &aRefAttr : aRefAttrs) { + if (!aRefAttr->isObject()) ++aNbPoints; else { - FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttrs[i]->object()); + FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object()); if (!aFeature) { if (aNbPoints + aNbLines != 0) return true; @@ -1069,7 +1062,7 @@ bool SketchPlugin_ArcTransversalPointValidator::isValid( bool SketchPlugin_IntersectionValidator::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) { theError = "The attribute with the %1 type is not processed"; @@ -1098,7 +1091,7 @@ bool SketchPlugin_IntersectionValidator::isValid( // find a sketch std::shared_ptr aSketch; std::set aRefs = anExternalAttr->owner()->data()->refsToMe(); - std::set::const_iterator anIt = aRefs.begin(); + auto anIt = aRefs.begin(); for (; anIt != aRefs.end(); ++anIt) { CompositeFeaturePtr aComp = std::dynamic_pointer_cast((*anIt)->owner()); @@ -1126,7 +1119,7 @@ bool SketchPlugin_IntersectionValidator::isValid( bool SketchPlugin_SplitValidator::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { bool aValid = false; @@ -1213,7 +1206,7 @@ bool SketchPlugin_SplitValidator::isValid( bool SketchPlugin_TrimValidator::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { bool aValid = false; @@ -1278,7 +1271,7 @@ bool SketchPlugin_TrimValidator::isValid( bool SketchPlugin_ProjectionValidator::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) { theError = "The attribute with the %1 type is not processed"; @@ -1321,7 +1314,7 @@ bool SketchPlugin_ProjectionValidator::isValid( // find a sketch std::shared_ptr aSketch; std::set aRefs = theAttribute->owner()->data()->refsToMe(); - std::set::const_iterator anIt = aRefs.begin(); + auto anIt = aRefs.begin(); for (; anIt != aRefs.end(); ++anIt) { CompositeFeaturePtr aComp = std::dynamic_pointer_cast((*anIt)->owner()); @@ -1388,8 +1381,7 @@ bool SketchPlugin_ProjectionValidator::isValid( // B-spline's plane is orthogonal to the sketch plane, // thus, need to check whether B-spline is planar. std::list aPoles = aBSpline->poles(); - for (std::list::iterator it = aPoles.begin(); - it != aPoles.end() && !aValid; ++it) { + for (auto it = aPoles.begin(); it != aPoles.end() && !aValid; ++it) { if (aBSplinePlane->distance(*it) > tolerance) aValid = true; // non-planar B-spline curve } @@ -1410,7 +1402,7 @@ static std::set common(const std::set &theSet1, if (theSet1.empty() || theSet2.empty()) return aCommon; - std::set::const_iterator anIt2 = theSet2.begin(); + auto anIt2 = theSet2.begin(); for (; anIt2 != theSet2.end(); ++anIt2) if (theSet1.find(*anIt2) != theSet1.end()) aCommon.insert(*anIt2); @@ -1428,7 +1420,7 @@ bool SketchPlugin_DifferentReferenceValidator::isValid( std::set aCommonReferredFeatures; // find all features referred by attributes listed in theArguments - std::list::const_iterator anArgIt = theArguments.begin(); + auto anArgIt = theArguments.begin(); for (; anArgIt != theArguments.end(); ++anArgIt) { AttributeRefAttrPtr aRefAttr = anOwner->refattr(*anArgIt); if (!aRefAttr) @@ -1486,7 +1478,7 @@ bool SketchPlugin_DifferentPointReferenceValidator::isValid( // find all points referred by attributes listed in theArguments bool hasRefsToPoints = false; - std::list::const_iterator anArgIt = theArguments.begin(); + auto anArgIt = theArguments.begin(); for (; anArgIt != theArguments.end(); ++anArgIt) { AttributeRefAttrPtr aRefAttr = anOwner->refattr(*anArgIt); if (!aRefAttr) @@ -1543,7 +1535,7 @@ bool SketchPlugin_CirclePassedPointValidator::isValid( std::set aCoincidentFeatures = SketchPlugin_Tools::findFeaturesCoincidentToPoint(aCenterPoint); // check one of coincident features is a feature referred by passed point - std::set::const_iterator anIt = aCoincidentFeatures.begin(); + auto anIt = aCoincidentFeatures.begin(); for (; anIt != aCoincidentFeatures.end(); ++anIt) if (*anIt == aPassedFeature) { theError = aErrorMessage; @@ -1740,7 +1732,7 @@ bool SketchPlugin_ThirdPointValidator::arePointsNotSeparated( bool SketchPlugin_ArcEndPointValidator::isValid( const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const { + Events_InfoMessage & /*theError*/) const { FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); AttributeRefAttrPtr anEndPointRef = aFeature->refattr(theArguments.front()); @@ -1809,7 +1801,7 @@ static GeomShapePtr toInfiniteEdge(const GeomShapePtr theShape) { bool SketchPlugin_ArcEndPointIntersectionValidator::isValid( const AttributePtr &theAttribute, const std::list &theArguments, - Events_InfoMessage &theError) const { + Events_InfoMessage & /*theError*/) const { std::shared_ptr anArcFeature = std::dynamic_pointer_cast(theAttribute->owner()); AttributeRefAttrPtr anEndPointRef = @@ -1847,9 +1839,8 @@ bool SketchPlugin_ArcEndPointIntersectionValidator::isValid( FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(anObject); if (aSelectedFeature.get()) { std::list aResults = aSelectedFeature->results(); - for (std::list::const_iterator anIt = aResults.cbegin(); - anIt != aResults.cend(); ++anIt) { - GeomShapePtr aShape = (*anIt)->shape(); + for (const auto &aResult : aResults) { + GeomShapePtr aShape = aResult->shape(); if (!aShape->isEdge()) return true; aShape = toInfiniteEdge(aShape); @@ -1869,9 +1860,8 @@ bool SketchPlugin_HasNoConstraint::isValid( const std::list &theArguments, Events_InfoMessage &theError) const { std::set aFeatureKinds; - for (std::list::const_iterator anArgIt = theArguments.begin(); - anArgIt != theArguments.end(); anArgIt++) { - aFeatureKinds.insert(*anArgIt); + for (const auto &theArgument : theArguments) { + aFeatureKinds.insert(theArgument); } if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { @@ -1897,7 +1887,7 @@ bool SketchPlugin_HasNoConstraint::isValid( FeaturePtr aCurrentFeature = ModelAPI_Feature::feature(aRefAttr->owner()); std::set aRefsList = anObject->data()->refsToMe(); - std::set::const_iterator anIt = aRefsList.begin(); + auto anIt = aRefsList.begin(); for (; anIt != aRefsList.end(); anIt++) { FeaturePtr aRefFeature = ModelAPI_Feature::feature((*anIt)->owner()); if (aRefFeature.get() && aCurrentFeature != aRefFeature && @@ -1962,7 +1952,7 @@ bool SketchPlugin_ReplicationReferenceValidator::isValid( bool SketchPlugin_SketchFeatureValidator::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId() && theAttribute->attributeType() != ModelAPI_AttributeReference::typeId()) { @@ -1979,11 +1969,11 @@ bool SketchPlugin_SketchFeatureValidator::isValid( isSketchFeature = aRefAttr->isObject(); if (isSketchFeature) { FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object()); - isSketchFeature = aFeature.get() != NULL; + isSketchFeature = aFeature.get() != nullptr; if (isSketchFeature) { std::shared_ptr aSketchFeature = std::dynamic_pointer_cast(aFeature); - isSketchFeature = aSketchFeature.get() != NULL; + isSketchFeature = aSketchFeature.get() != nullptr; } } } else { @@ -2003,7 +1993,7 @@ bool SketchPlugin_SketchFeatureValidator::isValid( bool SketchPlugin_MultiRotationAngleValidator::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeDouble::typeId()) { theError = "The attribute with the %1 type is not processed"; @@ -2040,7 +2030,7 @@ bool SketchPlugin_MultiRotationAngleValidator::isValid( bool SketchPlugin_BSplineValidator::isValid( const AttributePtr &theAttribute, - const std::list &theArguments, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributePoint2DArrayPtr aPolesArray = std::dynamic_pointer_cast(theAttribute); @@ -2056,7 +2046,8 @@ bool SketchPlugin_BSplineValidator::isValid( } bool SketchPlugin_CurveFittingValidator::isValid( - const FeaturePtr &theFeature, const std::list &theArguments, + const FeaturePtr &theFeature, + const std::list & /*theArguments*/, Events_InfoMessage &theError) const { AttributeRefAttrListPtr aRefAttrList = theFeature->refattrlist(SketchPlugin_CurveFitting::POINTS_ID()); diff --git a/src/SketchPlugin/SketchPlugin_Validators.h b/src/SketchPlugin/SketchPlugin_Validators.h index c373fe1e8..d3c56ec29 100644 --- a/src/SketchPlugin/SketchPlugin_Validators.h +++ b/src/SketchPlugin/SketchPlugin_Validators.h @@ -37,9 +37,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_TangentAttrValidator @@ -54,9 +54,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_PerpendicularAttrValidator @@ -72,9 +72,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_NotFixedValidator @@ -89,9 +89,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_EqualAttrValidator @@ -106,9 +106,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_MirrorAttrValidator @@ -123,9 +123,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_CoincidenceAttrValidator @@ -141,9 +141,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_CopyValidator @@ -160,9 +160,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_SolverErrorValidator @@ -178,14 +178,14 @@ public: //! \param theFeature the checked feature //! \param theArguments arguments of the feature (not used) //! \param theError error message - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; /// Returns true if the attribute in feature is not obligatory for the feature /// execution - virtual bool isNotObligatory(std::string theFeature, - std::string theAttribute); + bool isNotObligatory(std::string theFeature, + std::string theAttribute) override; }; /**\class SketchPlugin_FilletVertexValidator @@ -200,9 +200,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; //! returns true if attribute is a good point for fillet //! \param theAttribute the checked point attribute @@ -227,9 +227,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute (not used) //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_ArcTangentPointValidator @@ -245,9 +245,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_ArcTransversalPointValidator @@ -263,9 +263,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_SplitValidator @@ -283,9 +283,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_TrimValidator @@ -303,9 +303,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_IntersectionValidator @@ -318,9 +318,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_ProjectionValidator @@ -333,9 +333,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_DifferentReferenceValidator @@ -352,9 +352,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_DifferentPointReferenceValidator @@ -371,9 +371,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_CirclePassedPointValidator @@ -390,9 +390,8 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, const std::list &, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_ThirdPointValidator @@ -409,9 +408,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; private: //! returns true if three points have not been placed on the same line @@ -437,9 +436,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_ArcEndPointIntersectionValidator @@ -455,9 +454,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_HasNoConstraint @@ -474,9 +473,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_ReplicationReferenceValidator @@ -492,9 +491,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_SketchFeatureValidator @@ -508,9 +507,9 @@ public: //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_MultiRotationAngleValidator @@ -524,9 +523,9 @@ class SketchPlugin_MultiRotationAngleValidator //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_BSplineValidator @@ -538,9 +537,9 @@ class SketchPlugin_BSplineValidator : public ModelAPI_AttributeValidator { //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute //! \param theError error message - virtual bool isValid(const AttributePtr &theAttribute, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const AttributePtr &theAttribute, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; /**\class SketchPlugin_CurveFittingValidator @@ -552,9 +551,9 @@ public: //! returns true if number of selected points is greater than the minimal //! value \param theAttribute the checked attribute \param theArguments //! arguments of the attribute \param theError error message - virtual bool isValid(const std::shared_ptr &theFeature, - const std::list &theArguments, - Events_InfoMessage &theError) const; + bool isValid(const std::shared_ptr &theFeature, + const std::list &theArguments, + Events_InfoMessage &theError) const override; }; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AngleWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AngleWrapper.h index ecb1048b8..40006ec5e 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AngleWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AngleWrapper.h @@ -30,12 +30,12 @@ class PlaneGCSSolver_AngleWrapper : public PlaneGCSSolver_ScalarWrapper { public: PlaneGCSSolver_AngleWrapper(double *const theParam); - ~PlaneGCSSolver_AngleWrapper() {} + ~PlaneGCSSolver_AngleWrapper() override = default; /// \brief Change value of parameter - virtual void setValue(double theValue); + void setValue(double theValue) override; /// \brief Return value of parameter - virtual double value() const; + double value() const override; }; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.cpp index b6c530146..3e651efd3 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.cpp @@ -125,7 +125,7 @@ static EntityWrapperPtr createScalarArray(const AttributePtr &theAttribute, if (nonSolverAttribute(anOwner, theAttribute->id()) || nonSolverAttribute(anOwner, theAttribute->id())) - aStorage = 0; + aStorage = nullptr; int aSize = anArray.size(); GCS::VEC_pD aParameters; @@ -216,7 +216,7 @@ bool PlaneGCSSolver_AttributeBuilder::updateAttribute( std::dynamic_pointer_cast(theAttribute); std::vector aPointsArray = aWrapper->array(); - std::vector::iterator aPos = aPointsArray.begin(); + auto aPos = aPointsArray.begin(); if (aWrapper->size() != anAttribute->size()) { while (anAttribute->size() > (int)aPointsArray.size()) { // add points to the middle of array @@ -233,7 +233,7 @@ bool PlaneGCSSolver_AttributeBuilder::updateAttribute( while (anAttribute->size() < (int)aPointsArray.size()) { // remove middle points - std::vector::iterator anIt = --aPointsArray.end(); + auto anIt = --aPointsArray.end(); GCS::SET_pD aParams = PlaneGCSSolver_Tools::parameters(*anIt); aParamsToRemove.insert(aParams.begin(), aParams.end()); aPointsArray.erase(anIt); diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.h index b1e7fa494..e01a15eeb 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_AttributeBuilder.h @@ -30,14 +30,14 @@ */ class PlaneGCSSolver_AttributeBuilder : public PlaneGCSSolver_EntityBuilder { public: - PlaneGCSSolver_AttributeBuilder(PlaneGCSSolver_Storage *theStorage = 0); + PlaneGCSSolver_AttributeBuilder(PlaneGCSSolver_Storage *theStorage = nullptr); PlaneGCSSolver_AttributeBuilder(const StoragePtr &theStorage); /// \brief Converts an attribute to the solver's entity. /// Double attributes and 2D points are supported only. /// \param theAttribute [in] attribute to create /// \return Created wrapper of the attribute applicable for specific solver - virtual EntityWrapperPtr createAttribute(AttributePtr theAttribute); + EntityWrapperPtr createAttribute(AttributePtr theAttribute) override; /// \brief Update entity by the attribute values. /// \return \c true if any value is updated. @@ -45,7 +45,7 @@ public: EntityWrapperPtr theEntity); /// \brief Blank. To be defined in derived class. - virtual EntityWrapperPtr createFeature(FeaturePtr) { + EntityWrapperPtr createFeature(FeaturePtr) override { return EntityWrapperPtr(); } }; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_BooleanWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_BooleanWrapper.h index 07ccb1ebf..70979d7f4 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_BooleanWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_BooleanWrapper.h @@ -37,18 +37,18 @@ public: bool value() const { return myValue; } /// \brief Return type of current entity - virtual SketchSolver_EntityType type() const { return ENTITY_BOOLEAN; } + SketchSolver_EntityType type() const override { return ENTITY_BOOLEAN; } protected: /// \brief Update entity by the values of theAttribute /// \return \c true if any value of attribute is not equal to the stored in /// the entity - virtual bool update(std::shared_ptr theAttribute); + bool update(std::shared_ptr theAttribute) override; protected: bool myValue; }; -typedef std::shared_ptr BooleanWrapperPtr; +using BooleanWrapperPtr = std::shared_ptr; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.h index c515cd0bb..7088173e2 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ConstraintWrapper.h @@ -71,6 +71,6 @@ private: std::list myGCSConstraints; }; -typedef std::shared_ptr ConstraintWrapperPtr; +using ConstraintWrapperPtr = std::shared_ptr; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Defs.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Defs.h index 644490fa5..8b195c25b 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Defs.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Defs.h @@ -26,8 +26,8 @@ #include typedef std::shared_ptr GCSPointPtr; -typedef std::shared_ptr GCSCurvePtr; -typedef std::shared_ptr GCSConstraintPtr; +using GCSCurvePtr = std::shared_ptr; +using GCSConstraintPtr = std::shared_ptr; // Tolerance for value of parameters const double tolerance = 1.e-10; @@ -35,7 +35,7 @@ const double tolerance = 1.e-10; #define PI 3.1415926535897932 // Types for data entities enumeration -typedef int ConstraintID; +using ConstraintID = int; // Predefined values for identifiers const ConstraintID CID_UNKNOWN = 0; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EdgeWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EdgeWrapper.h index 36401f8f8..00168260e 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EdgeWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EdgeWrapper.h @@ -39,7 +39,7 @@ public: GCSCurvePtr &changeEntity() { return myEntity; } /// \brief Return type of current entity - virtual SketchSolver_EntityType type() const { return myType; } + SketchSolver_EntityType type() const override { return myType; } bool isDegenerated() const; @@ -53,6 +53,6 @@ private: BooleanWrapperPtr myReversed; // preferably used to control arc orientation }; -typedef std::shared_ptr EdgeWrapperPtr; +using EdgeWrapperPtr = std::shared_ptr; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityBuilder.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityBuilder.h index f00b39a1b..eeae41362 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityBuilder.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityBuilder.h @@ -34,10 +34,10 @@ public: /// \brief Create entity in the given storage. /// If the storage is empty, the entity should not be changed /// while constraint solving. So, it is created out of the storage. - PlaneGCSSolver_EntityBuilder(PlaneGCSSolver_Storage *theStorage = 0) + PlaneGCSSolver_EntityBuilder(PlaneGCSSolver_Storage *theStorage = nullptr) : myStorage(theStorage) {} - virtual ~PlaneGCSSolver_EntityBuilder() {} + virtual ~PlaneGCSSolver_EntityBuilder() = default; /// \brief Converts an attribute to the solver's entity. /// Double attributes and 2D points are supported only. diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityDestroyer.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityDestroyer.h index 9395a79cf..b29e66d16 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityDestroyer.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityDestroyer.h @@ -30,7 +30,7 @@ */ class PlaneGCSSolver_EntityDestroyer { public: - PlaneGCSSolver_EntityDestroyer() {} + PlaneGCSSolver_EntityDestroyer() = default; /// \brief Add entity to remove. Its parameters are stored for further remove /// from the storage. diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityWrapper.h index 2f0eb5af5..a2e6f74fd 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityWrapper.h @@ -29,15 +29,15 @@ class ModelAPI_Attribute; class PlaneGCSSolver_EntityWrapper; -typedef std::shared_ptr EntityWrapperPtr; +using EntityWrapperPtr = std::shared_ptr; /** * Wrapper providing operations with entities regardless the solver. */ class PlaneGCSSolver_EntityWrapper { public: - PlaneGCSSolver_EntityWrapper() : myExternal(false) {} - virtual ~PlaneGCSSolver_EntityWrapper() {} + PlaneGCSSolver_EntityWrapper() {} + virtual ~PlaneGCSSolver_EntityWrapper() = default; /// \brief Return type of current entity virtual SketchSolver_EntityType type() const = 0; @@ -61,14 +61,14 @@ protected: /// \brief Update entity by the values of theAttribute /// \return \c true if any value of attribute is not equal to the stored in /// the entity - virtual bool update(std::shared_ptr theAttribute) { + virtual bool update(std::shared_ptr /*theAttribute*/) { return false; } friend class PlaneGCSSolver_AttributeBuilder; private: - bool myExternal; + bool myExternal{false}; std::map myAdditionalAttributes; }; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.cpp index b89cc7c4c..ff034b721 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.cpp @@ -132,7 +132,7 @@ PlaneGCSSolver_FeatureBuilder::createFeature(FeaturePtr theFeature) { EntityWrapperPtr createLine(const AttributeEntityMap &theAttributes) { std::shared_ptr aNewLine(new GCS::Line); - AttributeEntityMap::const_iterator anIt = theAttributes.begin(); + auto anIt = theAttributes.begin(); for (; anIt != theAttributes.end(); ++anIt) { std::shared_ptr aPoint = std::dynamic_pointer_cast(anIt->second); @@ -151,7 +151,7 @@ EntityWrapperPtr createLine(const AttributeEntityMap &theAttributes) { EntityWrapperPtr createCircle(const AttributeEntityMap &theAttributes) { std::shared_ptr aNewCircle(new GCS::Circle); - AttributeEntityMap::const_iterator anIt = theAttributes.begin(); + auto anIt = theAttributes.begin(); for (; anIt != theAttributes.end(); ++anIt) { if (anIt->first->id() == SketchPlugin_Circle::CENTER_ID()) { std::shared_ptr aPoint = @@ -177,7 +177,7 @@ EntityWrapperPtr createArc(const AttributeEntityMap &theAttributes, BooleanWrapperPtr isReversed; // Base attributes of arc (center, start and end points) - AttributeEntityMap::const_iterator anIt = theAttributes.begin(); + auto anIt = theAttributes.begin(); for (; anIt != theAttributes.end(); ++anIt) { std::shared_ptr aPoint = std::dynamic_pointer_cast(anIt->second); @@ -213,7 +213,7 @@ EntityWrapperPtr createEllipse(const AttributeEntityMap &theAttributes) { std::map anAdditionalAttributes; - AttributeEntityMap::const_iterator anIt = theAttributes.begin(); + auto anIt = theAttributes.begin(); for (; anIt != theAttributes.end(); ++anIt) { std::shared_ptr aPoint = std::dynamic_pointer_cast(anIt->second); @@ -245,7 +245,7 @@ EntityWrapperPtr createEllipticArc(const AttributeEntityMap &theAttributes, BooleanWrapperPtr isReversed; std::map anAdditionalAttributes; - AttributeEntityMap::const_iterator anIt = theAttributes.begin(); + auto anIt = theAttributes.begin(); for (; anIt != theAttributes.end(); ++anIt) { std::shared_ptr aPoint = std::dynamic_pointer_cast(anIt->second); @@ -294,7 +294,7 @@ EntityWrapperPtr createBSpline(const AttributeEntityMap &theAttributes) { std::map anAdditionalAttributes; - AttributeEntityMap::const_iterator anIt = theAttributes.begin(); + auto anIt = theAttributes.begin(); for (; anIt != theAttributes.end(); ++anIt) { const std::string &anAttrID = anIt->first->id(); if (anAttrID == TYPE::POLES_ID()) { @@ -327,9 +327,8 @@ EntityWrapperPtr createBSpline(const AttributeEntityMap &theAttributes) { else if (anAttrID == TYPE::MULTS_ID()) { const GCS::VEC_pD &aValues = anArray->array(); aNewSpline->mult.reserve(aValues.size()); - for (GCS::VEC_pD::const_iterator anIt = aValues.begin(); - anIt != aValues.end(); ++anIt) - aNewSpline->mult.push_back((int)(**anIt)); + for (auto aValue : aValues) + aNewSpline->mult.push_back((int)(*aValue)); } } } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.h index 411f9c691..02876f707 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_FeatureBuilder.h @@ -23,7 +23,7 @@ #include -typedef std::map AttributeEntityMap; +using AttributeEntityMap = std::map; /** \class PlaneGCSSolver_FeatureBuilder * \ingroup Plugins @@ -32,7 +32,7 @@ typedef std::map AttributeEntityMap; */ class PlaneGCSSolver_FeatureBuilder : public PlaneGCSSolver_AttributeBuilder { public: - PlaneGCSSolver_FeatureBuilder(PlaneGCSSolver_Storage *theStorage = 0); + PlaneGCSSolver_FeatureBuilder(PlaneGCSSolver_Storage *theStorage = nullptr); PlaneGCSSolver_FeatureBuilder(const StoragePtr &theStorage); /// \brief Converts an attribute to the solver's entity and stores it for @@ -40,12 +40,12 @@ public: /// Double attributes and 2D points are supported only. /// \param theAttribute [in] attribute to create /// \return Created wrapper of the attribute applicable for specific solver - virtual EntityWrapperPtr createAttribute(AttributePtr theAttribute); + EntityWrapperPtr createAttribute(AttributePtr theAttribute) override; /// \brief Converts SketchPlugin's feature to the solver's entity. /// Result if based on the list of already converted attributes. /// \param theFeature [in] feature to create - virtual EntityWrapperPtr createFeature(FeaturePtr theFeature); + EntityWrapperPtr createFeature(FeaturePtr theFeature) override; private: /// list of converted attributes (will be cleared when the feature is created) diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.cpp index 3e9a1963c..3019123d2 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.cpp @@ -154,15 +154,12 @@ bool BSplineImpl::parameter(const Point &thePoint, double &theParam) const { std::list aKnots; std::list aMults; - for (GCS::VEC_P::const_iterator anIt = poles.begin(); anIt != poles.end(); - ++anIt) - aPoles.push_back(GeomPnt2dPtr(new GeomAPI_Pnt2d(*anIt->x, *anIt->y))); - for (GCS::VEC_pD::const_iterator anIt = weights.begin(); - anIt != weights.end(); ++anIt) - aWeights.push_back(**anIt); - for (GCS::VEC_pD::const_iterator anIt = knots.begin(); anIt != knots.end(); - ++anIt) - aKnots.push_back(**anIt); + for (const auto &pole : poles) + aPoles.push_back(GeomPnt2dPtr(new GeomAPI_Pnt2d(*pole.x, *pole.y))); + for (auto weight : weights) + aWeights.push_back(*weight); + for (auto knot : knots) + aKnots.push_back(*knot); aMults.assign(mult.begin(), mult.end()); std::shared_ptr aCurve(new GeomAPI_BSpline2d( diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.h index 98d4c2aa4..80b4e6584 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.h @@ -27,10 +27,10 @@ namespace GCS { /// \brife SHAPER's implementation of B-spline curves in PlaneGCS solver class BSplineImpl : public BSpline { public: - virtual DeriVector2 Value(double u, double du, double *derivparam = 0); - virtual DeriVector2 CalculateNormal(Point &p, double *derivparam = 0); + DeriVector2 Value(double u, double du, double *derivparam = nullptr) override; + DeriVector2 CalculateNormal(Point &p, double *derivparam = nullptr) override; - virtual BSplineImpl *Copy(); + BSplineImpl *Copy() override; private: /// Return the index of start knot for the given parameter. diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.cpp index 80ff8da32..b038f021b 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.cpp @@ -34,7 +34,7 @@ bool PlaneGCSSolver_PointArrayWrapper::update(AttributePtr theAttribute) { std::shared_ptr aPointArray = std::dynamic_pointer_cast(theAttribute); if (aPointArray && aPointArray->size() == (int)myPoints.size()) { - std::vector::iterator aPIt = myPoints.begin(); + auto aPIt = myPoints.begin(); for (int anIndex = 0; aPIt != myPoints.end(); ++aPIt, ++anIndex) { GeomPnt2dPtr aPnt = aPointArray->pnt(anIndex); diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.h index 200ad3d52..ffaa326c5 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.h @@ -48,13 +48,13 @@ public: } /// \brief Return type of current entity - virtual SketchSolver_EntityType type() const { return ENTITY_POINT_ARRAY; } + SketchSolver_EntityType type() const override { return ENTITY_POINT_ARRAY; } protected: /// \brief Update entity by the values of theAttribute /// \return \c true if any value of attribute is not equal to the stored in /// the entity - virtual bool update(std::shared_ptr theAttribute); + bool update(std::shared_ptr theAttribute) override; private: std::vector myPoints; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.h index 870f781eb..a21173193 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointWrapper.h @@ -37,18 +37,18 @@ public: GCSPointPtr &changeEntity() { return myPoint; } /// \brief Return type of current entity - virtual SketchSolver_EntityType type() const { return ENTITY_POINT; } + SketchSolver_EntityType type() const override { return ENTITY_POINT; } protected: /// \brief Update entity by the values of theAttribute /// \return \c true if any value of attribute is not equal to the stored in /// the entity - virtual bool update(std::shared_ptr theAttribute); + bool update(std::shared_ptr theAttribute) override; private: GCSPointPtr myPoint; }; -typedef std::shared_ptr PointWrapperPtr; +using PointWrapperPtr = std::shared_ptr; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarArrayWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarArrayWrapper.h index 09c967aa2..9870128e4 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarArrayWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarArrayWrapper.h @@ -40,19 +40,19 @@ public: void setArray(const GCS::VEC_pD &theParams) { myValue = theParams; } /// \brief Return type of current entity - virtual SketchSolver_EntityType type() const { return ENTITY_SCALAR_ARRAY; } + SketchSolver_EntityType type() const override { return ENTITY_SCALAR_ARRAY; } protected: /// \brief Update entity by the values of theAttribute /// \return \c true if any value of attribute is not equal to the stored in /// the entity - virtual bool update(std::shared_ptr theAttribute); + bool update(std::shared_ptr theAttribute) override; protected: GCS::VEC_pD myValue; ///< list of pointers to values provided by the storage }; -typedef std::shared_ptr - ScalarArrayWrapperPtr; +using ScalarArrayWrapperPtr = + std::shared_ptr; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.h index 85c08c371..eca922a9b 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_ScalarWrapper.h @@ -40,18 +40,18 @@ public: virtual double value() const; /// \brief Return type of current entity - virtual SketchSolver_EntityType type() const { return ENTITY_SCALAR; } + SketchSolver_EntityType type() const override { return ENTITY_SCALAR; } protected: /// \brief Update entity by the values of theAttribute /// \return \c true if any value of attribute is not equal to the stored in /// the entity - virtual bool update(std::shared_ptr theAttribute); + bool update(std::shared_ptr theAttribute) override; protected: double *myValue; ///< pointer to value provided by the storage }; -typedef std::shared_ptr ScalarWrapperPtr; +using ScalarWrapperPtr = std::shared_ptr; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp index a13e7ced6..d864f88aa 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp @@ -26,9 +26,7 @@ static const int THE_CONSTRAINT_MULT = 100; PlaneGCSSolver_Solver::PlaneGCSSolver_Solver() - : myEquationSystem(new GCS::System), myDiagnoseBeforeSolve(false), - myInitilized(false), myConfCollected(false), myDOF(0), - myFictiveConstraint(0) {} + : myEquationSystem(new GCS::System) {} PlaneGCSSolver_Solver::~PlaneGCSSolver_Solver() { clear(); } @@ -49,10 +47,7 @@ void PlaneGCSSolver_Solver::addConstraint( ? theMultiConstraintID * THE_CONSTRAINT_MULT : theMultiConstraintID; - for (std::list::const_iterator anIt = - theConstraints.begin(); - anIt != theConstraints.end(); ++anIt) { - GCSConstraintPtr aConstraint = *anIt; + for (auto aConstraint : theConstraints) { aConstraint->setTag(anID); myEquationSystem->addConstraint(aConstraint.get()); @@ -67,11 +62,10 @@ void PlaneGCSSolver_Solver::addConstraint( } void PlaneGCSSolver_Solver::removeConstraint(const ConstraintID &theID) { - ConstraintMap::iterator aFound = myConstraints.find(theID); + auto aFound = myConstraints.find(theID); if (aFound != myConstraints.end()) { - for (std::list::iterator anIt = aFound->second.begin(); - anIt != aFound->second.end(); ++anIt) - myEquationSystem->clearByTag((*anIt)->getTag()); + for (auto &anIt : aFound->second) + myEquationSystem->clearByTag(anIt->getTag()); myConstraints.erase(aFound); } @@ -86,7 +80,7 @@ void PlaneGCSSolver_Solver::removeConstraint(const ConstraintID &theID) { } double *PlaneGCSSolver_Solver::createParameter() { - double *aResult = new double(0); + auto *aResult = new double(0); myParameters.push_back(aResult); if (myConstraints.empty() && myDOF >= 0) ++myDOF; // calculate DoF by hand if and only if there is no constraints yet @@ -98,7 +92,7 @@ double *PlaneGCSSolver_Solver::createParameter() { void PlaneGCSSolver_Solver::addParameters(const GCS::SET_pD &theParams) { GCS::SET_pD aParams(theParams); // leave new parameters only - GCS::VEC_pD::iterator anIt = myParameters.begin(); + auto anIt = myParameters.begin(); for (; anIt != myParameters.end(); ++anIt) if (aParams.find(*anIt) != aParams.end()) aParams.erase(*anIt); @@ -202,16 +196,14 @@ void PlaneGCSSolver_Solver::collectConflicting(bool withRedundant) { GCS::VEC_I aConflict; myEquationSystem->getConflicting(aConflict); // convert PlaneGCS constraint IDs to SketchPlugin's ID - for (GCS::VEC_I::const_iterator anIt = aConflict.begin(); - anIt != aConflict.end(); ++anIt) - myConflictingIDs.insert((*anIt) / THE_CONSTRAINT_MULT); + for (int anIt : aConflict) + myConflictingIDs.insert(anIt / THE_CONSTRAINT_MULT); if (withRedundant) { myEquationSystem->getRedundant(aConflict); // convert PlaneGCS constraint IDs to SketchPlugin's ID - for (GCS::VEC_I::const_iterator anIt = aConflict.begin(); - anIt != aConflict.end(); ++anIt) - myConflictingIDs.insert((*anIt) / THE_CONSTRAINT_MULT); + for (int anIt : aConflict) + myConflictingIDs.insert(anIt / THE_CONSTRAINT_MULT); } myConfCollected = true; @@ -240,9 +232,8 @@ void PlaneGCSSolver_Solver::getFreeParameters(GCS::SET_pD &theFreeParams) { clear(); // reset constraints myParameters = aParametersCopy; - for (ConstraintMap::iterator anIt = aConstraintCopy.begin(); - anIt != aConstraintCopy.end(); ++anIt) - addConstraint(anIt->first, anIt->second); + for (auto &anIt : aConstraintCopy) + addConstraint(anIt.first, anIt.second); // parameters detection works for Dense QR only GCS::QRAlgorithm aQRAlgo = myEquationSystem->qrAlgorithm; @@ -266,14 +257,14 @@ void PlaneGCSSolver_Solver::getFreeParameters(GCS::SET_pD &theFreeParams) { MapParamGroup myGroups; void add(double *theParam1, double *theParam2) { - MapParamGroup::iterator aFound1 = myGroups.find(theParam1); - MapParamGroup::iterator aFound2 = myGroups.find(theParam2); + auto aFound1 = myGroups.find(theParam1); + auto aFound2 = myGroups.find(theParam2); if (aFound1 == myGroups.end()) { if (aFound2 == myGroups.end()) { // create new group myEqualParams.push_back(GCS::SET_pD()); - std::list::iterator aGroup = --myEqualParams.end(); + auto aGroup = --myEqualParams.end(); aGroup->insert(theParam1); aGroup->insert(theParam2); myGroups[theParam1] = aGroup; @@ -292,28 +283,24 @@ void PlaneGCSSolver_Solver::getFreeParameters(GCS::SET_pD &theFreeParams) { // merge two groups GCS::SET_pD aCopy = *(aFound2->second); myEqualParams.erase(aFound2->second); - for (GCS::SET_pD::iterator anIt = aCopy.begin(); anIt != aCopy.end(); - ++anIt) - myGroups[*anIt] = aFound1->second; + for (auto anIt : aCopy) + myGroups[anIt] = aFound1->second; aFound1->second->insert(aCopy.begin(), aCopy.end()); } } } } anEqualParams; - for (ConstraintMap::iterator anIt = myConstraints.begin(); - anIt != myConstraints.end(); ++anIt) - for (std::list::iterator aCIt = anIt->second.begin(); - aCIt != anIt->second.end(); ++aCIt) { + for (auto &myConstraint : myConstraints) + for (auto aCIt = myConstraint.second.begin(); + aCIt != myConstraint.second.end(); ++aCIt) { if ((*aCIt)->getTypeId() == GCS::Equal) anEqualParams.add((*aCIt)->params()[0], (*aCIt)->params()[1]); } GCS::SET_pD aFreeParamsCopy = theFreeParams; - for (GCS::SET_pD::iterator anIt = aFreeParamsCopy.begin(); - anIt != aFreeParamsCopy.end(); ++anIt) { - EqualParameters::MapParamGroup::iterator aFound = - anEqualParams.myGroups.find(*anIt); + for (auto anIt : aFreeParamsCopy) { + auto aFound = anEqualParams.myGroups.find(anIt); if (aFound != anEqualParams.myGroups.end()) theFreeParams.insert(aFound->second->begin(), aFound->second->end()); } @@ -321,7 +308,7 @@ void PlaneGCSSolver_Solver::getFreeParameters(GCS::SET_pD &theFreeParams) { void PlaneGCSSolver_Solver::addFictiveConstraintIfNecessary() { bool hasOnlyMovement = true; - for (ConstraintMap::iterator anIt = myConstraints.begin(); + for (auto anIt = myConstraints.begin(); anIt != myConstraints.end() && hasOnlyMovement; ++anIt) hasOnlyMovement = anIt->first == CID_MOVEMENT; if (!hasOnlyMovement) @@ -332,7 +319,7 @@ void PlaneGCSSolver_Solver::addFictiveConstraintIfNecessary() { int aDOF = myDOF; double *aParam = createParameter(); - double *aFictiveParameter = new double(0.0); + auto *aFictiveParameter = new double(0.0); myFictiveConstraint = new GCS::ConstraintEqual(aFictiveParameter, aParam); myFictiveConstraint->setTag(CID_FICTIVE); @@ -347,12 +334,10 @@ void PlaneGCSSolver_Solver::removeFictiveConstraint() { myParameters.pop_back(); GCS::VEC_pD aParams = myFictiveConstraint->params(); - for (GCS::VEC_pD::iterator anIt = aParams.begin(); anIt != aParams.end(); - ++anIt) { - double *aPar = *anIt; + for (auto aPar : aParams) { delete aPar; } delete myFictiveConstraint; - myFictiveConstraint = 0; + myFictiveConstraint = nullptr; } } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h index c1e2068d0..41f7f0837 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h @@ -98,25 +98,25 @@ private: void removeFictiveConstraint(); private: - typedef std::map> ConstraintMap; + using ConstraintMap = std::map>; GCS::VEC_pD myParameters; ///< list of unknowns ConstraintMap myConstraints; ///< list of constraints std::shared_ptr - myEquationSystem; ///< set of equations for solving in FreeGCS - bool myDiagnoseBeforeSolve; ///< is the diagnostic necessary - bool myInitilized; ///< is the system already initialized + myEquationSystem; ///< set of equations for solving in FreeGCS + bool myDiagnoseBeforeSolve{false}; ///< is the diagnostic necessary + bool myInitilized{false}; ///< is the system already initialized GCS::SET_I myConflictingIDs; ///< list of IDs of conflicting constraints /// specifies the conflicting constraints are already collected - bool myConfCollected; + bool myConfCollected{false}; - int myDOF; ///< degrees of freedom + int myDOF{0}; ///< degrees of freedom - GCS::Constraint *myFictiveConstraint; + GCS::Constraint *myFictiveConstraint{0}; }; -typedef std::shared_ptr SolverPtr; +using SolverPtr = std::shared_ptr; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp index e3c0e44ee..1ca2e9b5f 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp @@ -100,9 +100,8 @@ EntityWrapperPtr PlaneGCSSolver_Storage::createAttribute( static bool hasReference(std::shared_ptr theFeature, const std::string &theFeatureKind) { const std::set &aRefs = theFeature->data()->refsToMe(); - for (std::set::const_iterator aRefIt = aRefs.begin(); - aRefIt != aRefs.end(); ++aRefIt) { - FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); + for (const auto &aRef : aRefs) { + FeaturePtr anOwner = ModelAPI_Feature::feature(aRef->owner()); if (anOwner && !anOwner->isMacro() && anOwner->getKind() == theFeatureKind) return true; } @@ -135,7 +134,7 @@ bool PlaneGCSSolver_Storage::update(FeaturePtr theFeature, bool theForce) { bool isExternal = (aSketchFeature && (aSketchFeature->isExternal() || isCopy || isProjReferred)); - PlaneGCSSolver_FeatureBuilder aBuilder(isExternal ? 0 : this); + PlaneGCSSolver_FeatureBuilder aBuilder(isExternal ? nullptr : this); // Reserve the feature in the map of features // (do not want to add several copies of it while adding attributes) @@ -147,7 +146,7 @@ bool PlaneGCSSolver_Storage::update(FeaturePtr theFeature, bool theForce) { std::list anAttributes = theFeature->data()->attributes(std::string()); - std::list::iterator anAttrIt = anAttributes.begin(); + auto anAttrIt = anAttributes.begin(); for (; anAttrIt != anAttributes.end(); ++anAttrIt) if (PlaneGCSSolver_Tools::isAttributeApplicable((*anAttrIt)->id(), theFeature->getKind())) @@ -201,10 +200,11 @@ bool PlaneGCSSolver_Storage::update(AttributePtr theAttribute, bool theForce) { return update( aFeature, theForce); // theAttribute has been processed while adding feature - return aRelated.get() != 0; + return aRelated.get() != nullptr; } - PlaneGCSSolver_AttributeBuilder aBuilder(aRelated->isExternal() ? 0 : this); + PlaneGCSSolver_AttributeBuilder aBuilder(aRelated->isExternal() ? nullptr + : this); bool isUpdated = aBuilder.updateAttribute(anAttribute, aRelated); if (isUpdated) { setNeedToResolve(true); @@ -283,24 +283,23 @@ static void createEllipseConstraints( const std::map &anAttributes = theEllipse->additionalAttributes(); - for (std::map::const_iterator anIt = - anAttributes.begin(); - anIt != anAttributes.end(); ++anIt) { + for (const auto &anAttribute : anAttributes) { std::shared_ptr aPoint = - std::dynamic_pointer_cast(anIt->second); + std::dynamic_pointer_cast( + anAttribute.second); if (!aPoint) continue; GCS::InternalAlignmentType anAlignmentX, anAlignmentY; - if (anIt->first == SketchPlugin_Ellipse::SECOND_FOCUS_ID()) + if (anAttribute.first == SketchPlugin_Ellipse::SECOND_FOCUS_ID()) anAlignmentX = GCS::EllipseFocus2X; - else if (anIt->first == SketchPlugin_Ellipse::MAJOR_AXIS_START_ID()) + else if (anAttribute.first == SketchPlugin_Ellipse::MAJOR_AXIS_START_ID()) anAlignmentX = GCS::EllipseNegativeMajorX; - else if (anIt->first == SketchPlugin_Ellipse::MAJOR_AXIS_END_ID()) + else if (anAttribute.first == SketchPlugin_Ellipse::MAJOR_AXIS_END_ID()) anAlignmentX = GCS::EllipsePositiveMajorX; - else if (anIt->first == SketchPlugin_Ellipse::MINOR_AXIS_START_ID()) + else if (anAttribute.first == SketchPlugin_Ellipse::MINOR_AXIS_START_ID()) anAlignmentX = GCS::EllipseNegativeMinorX; - else if (anIt->first == SketchPlugin_Ellipse::MINOR_AXIS_END_ID()) + else if (anAttribute.first == SketchPlugin_Ellipse::MINOR_AXIS_END_ID()) anAlignmentX = GCS::EllipsePositiveMinorX; anEllipseConstraints.push_back( @@ -432,8 +431,7 @@ void PlaneGCSSolver_Storage::createAuxiliaryConstraints( void PlaneGCSSolver_Storage::removeAuxiliaryConstraints( const EntityWrapperPtr &theEntity) { - std::map::iterator aFound = - myAuxConstraintMap.find(theEntity); + auto aFound = myAuxConstraintMap.find(theEntity); if (aFound != myAuxConstraintMap.end()) { mySketchSolver->removeConstraint(aFound->second->id()); myAuxConstraintMap.erase(aFound); @@ -462,8 +460,7 @@ void adjustArcParametrization(ARCTYPE &theArc, bool theReversed) { } void PlaneGCSSolver_Storage::adjustParametrizationOfArcs() { - std::map::iterator anIt = - myAuxConstraintMap.begin(); + auto anIt = myAuxConstraintMap.begin(); for (; anIt != myAuxConstraintMap.end(); ++anIt) { EdgeWrapperPtr anEdge = std::dynamic_pointer_cast(anIt->first); @@ -480,8 +477,7 @@ void PlaneGCSSolver_Storage::adjustParametrizationOfArcs() { } // update parameters of Middle point constraint for point on arc - std::map::iterator aCIt = - myConstraintMap.begin(); + auto aCIt = myConstraintMap.begin(); for (; aCIt != myConstraintMap.end(); ++aCIt) if (aCIt->second->type() == CONSTRAINT_MIDDLE_POINT) { notify(aCIt->first); @@ -489,8 +485,7 @@ void PlaneGCSSolver_Storage::adjustParametrizationOfArcs() { } bool PlaneGCSSolver_Storage::removeConstraint(ConstraintPtr theConstraint) { - std::map::iterator aFound = - myConstraintMap.find(theConstraint); + auto aFound = myConstraintMap.find(theConstraint); if (aFound != myConstraintMap.end()) { ConstraintWrapperPtr aCW = aFound->second; ConstraintID anID = aCW->id(); @@ -605,8 +600,7 @@ void PlaneGCSSolver_Storage::refresh() const { std::set anUpdatedFeatures; - std::map::const_iterator anIt = - myAttributeMap.begin(); + auto anIt = myAttributeMap.begin(); for (; anIt != myAttributeMap.end(); ++anIt) { if (!anIt->first->isInitialized()) continue; @@ -677,15 +671,14 @@ void PlaneGCSSolver_Storage::refresh() const { } // notify listeners about features update - std::set::const_iterator aFIt = anUpdatedFeatures.begin(); + auto aFIt = anUpdatedFeatures.begin(); for (; aFIt != anUpdatedFeatures.end(); ++aFIt) notify(*aFIt); } PlaneGCSSolver_Solver::SolveStatus PlaneGCSSolver_Storage::checkDegeneratedGeometry() const { - std::map::const_iterator aFIt = - myFeatureMap.begin(); + auto aFIt = myFeatureMap.begin(); for (; aFIt != myFeatureMap.end(); ++aFIt) { EdgeWrapperPtr anEdge = std::dynamic_pointer_cast(aFIt->second); @@ -702,16 +695,13 @@ void PlaneGCSSolver_Storage::getUnderconstrainedGeometry( if (aFreeParams.empty()) return; - for (std::map::const_iterator aFIt = - myFeatureMap.begin(); - aFIt != myFeatureMap.end(); ++aFIt) { - if (!aFIt->second) + for (const auto &aFIt : myFeatureMap) { + if (!aFIt.second) continue; - GCS::SET_pD aParams = PlaneGCSSolver_Tools::parameters(aFIt->second); - for (GCS::SET_pD::iterator aPIt = aParams.begin(); aPIt != aParams.end(); - ++aPIt) - if (aFreeParams.find(*aPIt) != aFreeParams.end()) { - theFeatures.insert(aFIt->first); + GCS::SET_pD aParams = PlaneGCSSolver_Tools::parameters(aFIt.second); + for (auto aParam : aParams) + if (aFreeParams.find(aParam) != aFreeParams.end()) { + theFeatures.insert(aFIt.first); break; } } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h index 74458f7bf..929a0aa59 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h @@ -41,44 +41,44 @@ public: /// a constraint applicable for corresponding solver. /// \param theConstraint [in] original SketchPlugin constraint /// \param theSolverConstraint [in] solver's constraint - virtual void addConstraint(ConstraintPtr theConstraint, - ConstraintWrapperPtr theSolverConstraint); + void addConstraint(ConstraintPtr theConstraint, + ConstraintWrapperPtr theSolverConstraint) override; /// \brief Add a movement constraint which will be destroyed /// after the next solving of the set of constraints. /// \param theSolverConstraint [in] solver's constraint - virtual void - addMovementConstraint(const ConstraintWrapperPtr &theSolverConstraint); + void addMovementConstraint( + const ConstraintWrapperPtr &theSolverConstraint) override; /// \brief Convert feature to the form applicable for specific solver and map /// it \param theFeature [in] feature to convert \param theForce [in] /// forced feature creation \return \c true if the feature has been created or /// updated - virtual bool update(FeaturePtr theFeature, bool theForce = false); + bool update(FeaturePtr theFeature, bool theForce = false) override; /// \brief Convert attribute to the form applicable for specific solver and /// map it \param theAttribute [in] attribute to convert \param theForce [in] /// forced feature creation \return \c true if the attribute has been created /// or updated - virtual bool update(AttributePtr theAttribute, bool theForce = false); + bool update(AttributePtr theAttribute, bool theForce = false) override; /// \brief Make entity external - virtual void makeExternal(const EntityWrapperPtr &theEntity); + void makeExternal(const EntityWrapperPtr &theEntity) override; /// \brief Make entity non-external - virtual void makeNonExternal(const EntityWrapperPtr &theEntity); + void makeNonExternal(const EntityWrapperPtr &theEntity) override; /// \brief Removes constraint from the storage /// \return \c true if the constraint and all its parameters are removed /// successfully - virtual bool removeConstraint(ConstraintPtr theConstraint); + bool removeConstraint(ConstraintPtr theConstraint) override; /// \brief Verify, the sketch contains degenerated geometry /// after resolving the set of constraints /// \return STATUS_OK if the geometry is valid, STATUS_DEGENERATED otherwise. - virtual PlaneGCSSolver_Solver::SolveStatus checkDegeneratedGeometry() const; + PlaneGCSSolver_Solver::SolveStatus checkDegeneratedGeometry() const override; /// \brief Update SketchPlugin features after resolving constraints - virtual void refresh() const; + void refresh() const override; /// \brief Initialize memory for new solver's parameter double *createParameter(); @@ -86,10 +86,10 @@ public: void removeParameters(const GCS::SET_pD &theParams); /// \brief Remove all features became invalid - virtual void removeInvalidEntities(); + void removeInvalidEntities() override; /// \brief Check the storage has constraints - virtual bool isEmpty() const { + bool isEmpty() const override { return SketchSolver_Storage::isEmpty() && myAuxConstraintMap.empty(); } @@ -97,11 +97,11 @@ public: /// Forward arcs should have the last parameter greater than the first /// parameter. Reversed arcs should have the last parameter lesser than /// the first parameter. - virtual void adjustParametrizationOfArcs(); + void adjustParametrizationOfArcs() override; /// \brief Return list of features which are not fully constrained - virtual void - getUnderconstrainedGeometry(std::set &theFeatures) const; + void + getUnderconstrainedGeometry(std::set &theFeatures) const override; private: /// \brief Convert feature using specified builder. diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.cpp index 9111345d8..a655c9eb3 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.cpp @@ -116,8 +116,7 @@ static ConstraintWrapperPtr createConstraintRadius(std::shared_ptr theValue, std::shared_ptr theEntity); static ConstraintWrapperPtr -createConstraintAngle(ConstraintPtr theConstraint, - std::shared_ptr theValue, +createConstraintAngle(std::shared_ptr theValue, std::shared_ptr theEntity1, std::shared_ptr theEntity2); static ConstraintWrapperPtr createConstraintHorizVert( @@ -277,8 +276,8 @@ ConstraintWrapperPtr PlaneGCSSolver_Tools::createConstraint( aResult = createConstraintRadius(GCS_SCALAR_WRAPPER(theValue), anEntity1); break; case CONSTRAINT_ANGLE: - aResult = createConstraintAngle(theConstraint, GCS_SCALAR_WRAPPER(theValue), - anEntity1, GCS_EDGE_WRAPPER(theEntity2)); + aResult = createConstraintAngle(GCS_SCALAR_WRAPPER(theValue), anEntity1, + GCS_EDGE_WRAPPER(theEntity2)); break; case CONSTRAINT_FIXED: break; @@ -398,19 +397,16 @@ PlaneGCSSolver_Tools::bspline(EntityWrapperPtr theEntity) { std::dynamic_pointer_cast(anEntity->entity()); std::list aPoles; - for (GCS::VEC_P::iterator anIt = aSpline->poles.begin(); - anIt != aSpline->poles.end(); ++anIt) - aPoles.push_back(GeomPnt2dPtr(new GeomAPI_Pnt2d(*anIt->x, *anIt->y))); + for (auto &pole : aSpline->poles) + aPoles.push_back(GeomPnt2dPtr(new GeomAPI_Pnt2d(*pole.x, *pole.y))); std::list aWeights; - for (GCS::VEC_pD::iterator anIt = aSpline->weights.begin(); - anIt != aSpline->weights.end(); ++anIt) - aWeights.push_back(**anIt); + for (auto &weight : aSpline->weights) + aWeights.push_back(*weight); std::list aKnots; - for (GCS::VEC_pD::iterator anIt = aSpline->knots.begin(); - anIt != aSpline->knots.end(); ++anIt) - aKnots.push_back(**anIt); + for (auto &knot : aSpline->knots) + aKnots.push_back(*knot); std::list aMultiplicities; aMultiplicities.assign(aSpline->mult.begin(), aSpline->mult.end()); @@ -789,8 +785,7 @@ createConstraintRadius(std::shared_ptr theValue, } ConstraintWrapperPtr -createConstraintAngle(ConstraintPtr theConstraint, - std::shared_ptr theValue, +createConstraintAngle(std::shared_ptr theValue, std::shared_ptr theEntity1, std::shared_ptr theEntity2) { std::shared_ptr aLine1 = @@ -955,10 +950,8 @@ GCS::SET_pD pointArrayParameters(const EntityWrapperPtr &theArray) { GCS::SET_pD aParams; PointArrayWrapperPtr aPoints = std::dynamic_pointer_cast(theArray); - for (std::vector::const_iterator anIt = - aPoints->array().begin(); - anIt != aPoints->array().end(); ++anIt) { - GCS::SET_pD aPointParams = PlaneGCSSolver_Tools::parameters(*anIt); + for (const auto &anIt : aPoints->array()) { + GCS::SET_pD aPointParams = PlaneGCSSolver_Tools::parameters(anIt); aParams.insert(aPointParams.begin(), aPointParams.end()); } return aParams; @@ -1029,14 +1022,12 @@ GCS::SET_pD bsplineParameters(const EdgeWrapperPtr &theEdge) { std::shared_ptr aBSpline = std::dynamic_pointer_cast(theEdge->entity()); - for (GCS::VEC_P::iterator it = aBSpline->poles.begin(); - it != aBSpline->poles.end(); ++it) { - aParams.insert(it->x); - aParams.insert(it->y); + for (auto &pole : aBSpline->poles) { + aParams.insert(pole.x); + aParams.insert(pole.y); } - for (GCS::VEC_pD::iterator it = aBSpline->weights.begin(); - it != aBSpline->weights.end(); ++it) - aParams.insert(*it); + for (auto &weight : aBSpline->weights) + aParams.insert(weight); return aParams; } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Update.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Update.h index 531a7ec68..28dbc7ead 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Update.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Update.h @@ -29,7 +29,7 @@ class SketchSolver_Constraint; class PlaneGCSSolver_Update; -typedef std::shared_ptr UpdaterPtr; +using UpdaterPtr = std::shared_ptr; /** \class PlaneGCSSolver_Update * \ingroup Plugins @@ -39,7 +39,7 @@ class PlaneGCSSolver_Update { public: PlaneGCSSolver_Update(UpdaterPtr theNext = UpdaterPtr()) : myNext(theNext) {} - virtual ~PlaneGCSSolver_Update() {} + virtual ~PlaneGCSSolver_Update() = default; /// \brief Attach listener /// \param theObserver [in] object which want to receive notifications @@ -50,7 +50,7 @@ public: /// \brief Detach listener void detach(SketchSolver_Constraint *theObserver) { - std::list::iterator anIt = myObservers.begin(); + auto anIt = myObservers.begin(); for (; anIt != myObservers.end(); ++anIt) if (*anIt == theObserver) { myObservers.erase(anIt); diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp index 27b4c5ed5..2b9ce1e26 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.cpp @@ -34,8 +34,7 @@ static bool hasSamePoint(const std::set &theList, void PlaneGCSSolver_UpdateCoincidence::attach( SketchSolver_Constraint *theObserver, const std::string &theType) { if (theType == GROUP()) { - std::list::iterator aPlaceToAdd = - myObservers.end(); + auto aPlaceToAdd = myObservers.end(); // point-point coincidence is placed first, // other constraints are sorted by their type for (aPlaceToAdd = myObservers.begin(); aPlaceToAdd != myObservers.end(); @@ -55,7 +54,7 @@ void PlaneGCSSolver_UpdateCoincidence::update(const FeaturePtr &theFeature) { theFeature->getKind() == SketchPlugin_ConstraintCollinear::ID()) { myCoincident.clear(); // notify listeners and stop procesing - std::list::iterator anIt = myObservers.begin(); + auto anIt = myObservers.begin(); for (; anIt != myObservers.end(); ++anIt) (*anIt)->notify(theFeature, this); } else @@ -65,7 +64,7 @@ void PlaneGCSSolver_UpdateCoincidence::update(const FeaturePtr &theFeature) { static bool hasAnotherExternalPoint(const std::set &theCoincidences, const EntityWrapperPtr &thePoint) { - std::set::const_iterator anIt = theCoincidences.begin(); + auto anIt = theCoincidences.begin(); for (; anIt != theCoincidences.end(); ++anIt) if ((*anIt)->type() == ENTITY_POINT && (*anIt)->isExternal() && *anIt != thePoint) @@ -112,8 +111,7 @@ bool PlaneGCSSolver_UpdateCoincidence::addCoincidence( bool PlaneGCSSolver_UpdateCoincidence::isPointOnEntity( const EntityWrapperPtr &thePoint, const EntityWrapperPtr &theEntity) { - std::list::iterator anIt = - findGroupOfCoincidence(thePoint); + auto anIt = findGroupOfCoincidence(thePoint); if (anIt == myCoincident.end()) return false; @@ -135,7 +133,7 @@ PlaneGCSSolver_UpdateCoincidence::findGroupOfCoincidence( if (theEntity->type() != ENTITY_POINT) return myCoincident.end(); - std::list::iterator aFound = myCoincident.begin(); + auto aFound = myCoincident.begin(); for (; aFound != myCoincident.end(); ++aFound) if (aFound->isExist(theEntity)) break; @@ -164,7 +162,7 @@ static double squareDistance(const GCS::Point &thePoint1, static bool hasSamePoint(const std::set &theList, const GCS::Point &thePoint) { - std::set::const_iterator anIt = theList.begin(); + auto anIt = theList.begin(); for (; anIt != theList.end(); ++anIt) if (squareDistance(thePoint, toPoint(*anIt)) < 1.e-14) return true; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.h index d1e70c028..9841fa9fe 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.h @@ -37,7 +37,7 @@ public: PlaneGCSSolver_UpdateCoincidence(UpdaterPtr theNext = UpdaterPtr()) : PlaneGCSSolver_Update(theNext) {} - virtual ~PlaneGCSSolver_UpdateCoincidence() {} + ~PlaneGCSSolver_UpdateCoincidence() override = default; /// \brief Group of entities, processed by this kind of updater static const std::string &GROUP() { @@ -49,11 +49,11 @@ public: /// \param theObserver [in] object which want to receive notifications /// \param theType [in] receive notifications about changing objects /// of theType and their derivatives - virtual void attach(SketchSolver_Constraint *theObserver, - const std::string &theType); + void attach(SketchSolver_Constraint *theObserver, + const std::string &theType) override; /// \brief Send notification about update of the feature to all interested - virtual void update(const FeaturePtr &theFeature); + void update(const FeaturePtr &theFeature) override; /// \brief Set coincidence between two given entities /// \return \c true if the entities does not coincident yet diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.cpp index 84a4061ff..d72e96c49 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.cpp @@ -30,7 +30,7 @@ void PlaneGCSSolver_UpdateFeature::attach(SketchSolver_Constraint *theObserver, } void PlaneGCSSolver_UpdateFeature::update(const FeaturePtr &theFeature) { - std::list::iterator anIt = myObservers.begin(); + auto anIt = myObservers.begin(); for (; anIt != myObservers.end(); ++anIt) (*anIt)->notify(theFeature, this); } diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.h index 55e1c3d8f..931068215 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateFeature.h @@ -42,11 +42,11 @@ public: /// \param theObserver [in] object which want to receive notifications /// \param theType [in] receive notifications about changing objects /// of theType and their derivatives - virtual void attach(SketchSolver_Constraint *theObserver, - const std::string &theType); + void attach(SketchSolver_Constraint *theObserver, + const std::string &theType) override; /// \brief Send notification about update of the feature to all interested - virtual void update(const FeaturePtr &theFeature); + void update(const FeaturePtr &theFeature) override; }; #endif diff --git a/src/SketchSolver/SketchSolver_Constraint.cpp b/src/SketchSolver/SketchSolver_Constraint.cpp index 18b363860..681dfbd76 100644 --- a/src/SketchSolver/SketchSolver_Constraint.cpp +++ b/src/SketchSolver/SketchSolver_Constraint.cpp @@ -213,7 +213,7 @@ void SketchSolver_Constraint::getAttributes( int aEntInd = 2; // index of first entity in the list of attributes std::list aConstrAttrs = aData->attributes(ModelAPI_AttributeRefAttr::typeId()); - std::list::iterator anIter = aConstrAttrs.begin(); + auto anIter = aConstrAttrs.begin(); for (; anIter != aConstrAttrs.end(); anIter++) { AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(*anIter); diff --git a/src/SketchSolver/SketchSolver_Constraint.h b/src/SketchSolver/SketchSolver_Constraint.h index 73c8d0707..fb46030e1 100644 --- a/src/SketchSolver/SketchSolver_Constraint.h +++ b/src/SketchSolver/SketchSolver_Constraint.h @@ -40,13 +40,13 @@ class SketchSolver_Constraint { protected: /// Default constructor - SketchSolver_Constraint() : myType(CONSTRAINT_UNKNOWN) {} + SketchSolver_Constraint() {} public: /// Constructor based on SketchPlugin constraint SketchSolver_Constraint(ConstraintPtr theConstraint); - virtual ~SketchSolver_Constraint() {} + virtual ~SketchSolver_Constraint() = default; /// \brief Initializes parameters and start constraint creation /// \param theStorage [in] storage where to place new constraint @@ -103,12 +103,13 @@ protected: /// storage, which contains all information about entities and constraints StoragePtr myStorage; - SketchSolver_ConstraintType myType; ///< type of constraint + SketchSolver_ConstraintType myType{ + CONSTRAINT_UNKNOWN}; ///< type of constraint std::list myAttributes; ///< attributes of constraint std::string myErrorMsg; ///< error message }; -typedef std::shared_ptr SolverConstraintPtr; +using SolverConstraintPtr = std::shared_ptr; #endif diff --git a/src/SketchSolver/SketchSolver_ConstraintAngle.h b/src/SketchSolver/SketchSolver_ConstraintAngle.h index 197b4156f..114c2c6d1 100644 --- a/src/SketchSolver/SketchSolver_ConstraintAngle.h +++ b/src/SketchSolver/SketchSolver_ConstraintAngle.h @@ -35,15 +35,15 @@ public: /// \brief This method is used in derived objects to check consistence of /// constraint. - virtual void adjustConstraint(); + void adjustConstraint() override; protected: /// \brief Generate list of attributes of constraint in order useful for /// constraints \param[out] theValue numerical characteristic of /// constraint (e.g. distance) \param[out] theAttributes list of attributes to /// be filled - virtual void getAttributes(EntityWrapperPtr &theValue, - std::vector &theAttributes); + void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes) override; private: int myType; diff --git a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp index cbc96be96..da36ee7df 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintCoincidence.cpp @@ -118,13 +118,12 @@ static void findDiameterOnEllipse(FeaturePtr theConstruction, AttributePtr &theEnd) { AttributePtr anEllipseAttr; const std::set &aRefs = theConstruction->data()->refsToMe(); - for (std::set::const_iterator aRefIt = aRefs.begin(); - aRefIt != aRefs.end(); ++aRefIt) { - FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); + for (const auto &aRef : aRefs) { + FeaturePtr anOwner = ModelAPI_Feature::feature(aRef->owner()); if (anOwner && anOwner->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID()) { AttributeRefAttrPtr aRefAttr; - if ((*aRefIt)->id() == SketchPlugin_Constraint::ENTITY_A()) + if (aRef->id() == SketchPlugin_Constraint::ENTITY_A()) aRefAttr = anOwner->refattr(SketchPlugin_Constraint::ENTITY_B()); else aRefAttr = anOwner->refattr(SketchPlugin_Constraint::ENTITY_A()); @@ -297,9 +296,8 @@ void SketchSolver_ConstraintCoincidence::getAttributes( } void SketchSolver_ConstraintCoincidence::notify( - const FeaturePtr &theFeature, PlaneGCSSolver_Update *theUpdater) { - PlaneGCSSolver_UpdateCoincidence *anUpdater = - static_cast(theUpdater); + const FeaturePtr & /*theFeature*/, PlaneGCSSolver_Update *theUpdater) { + auto *anUpdater = static_cast(theUpdater); bool isAccepted = anUpdater->addCoincidence(myAttributes.front(), myAttributes.back()); // additionally process internal coincidence, set point coincident with @@ -338,9 +336,9 @@ void SketchSolver_ConstraintCoincidence::notify( ? myAttributes.front() : myAttributes.back(); - for (int i = 0; i < 2; ++i) + for (const auto &myFeatureExtremitie : myFeatureExtremities) isAccepted = isAccepted && - !anUpdater->isPointOnEntity(aPoint, myFeatureExtremities[i]); + !anUpdater->isPointOnEntity(aPoint, myFeatureExtremitie); } if (isAccepted) { diff --git a/src/SketchSolver/SketchSolver_ConstraintCoincidence.h b/src/SketchSolver/SketchSolver_ConstraintCoincidence.h index 5a4a90dd2..c25a66c8d 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCoincidence.h +++ b/src/SketchSolver/SketchSolver_ConstraintCoincidence.h @@ -34,27 +34,27 @@ public: : SketchSolver_Constraint(theConstraint), myInSolver(false) {} /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr &theFeature, - PlaneGCSSolver_Update *theUpdater); + void notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater) override; /// \brief Remove constraint - virtual bool remove(); + bool remove() override; protected: /// \brief Converts SketchPlugin constraint to a list of solver constraints - virtual void process(); + void process() override; /// \brief Generate list of attributes of constraint in order useful for /// constraints \param[out] theValue numerical characteristic of /// constraint (e.g. distance) \param[out] theAttributes list of attributes to /// be filled - virtual void getAttributes(EntityWrapperPtr &theValue, - std::vector &theAttributes); + void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes) override; /// \brief This method is used in derived objects to check consistency of /// constraint. /// E.g. the distance between line and point may be signed. - virtual void adjustConstraint(); + void adjustConstraint() override; protected: bool myInSolver; ///< shows the constraint is added to the solver diff --git a/src/SketchSolver/SketchSolver_ConstraintCollinear.cpp b/src/SketchSolver/SketchSolver_ConstraintCollinear.cpp index fe0d648cb..986fa2aa6 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCollinear.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintCollinear.cpp @@ -85,11 +85,10 @@ void SketchSolver_ConstraintCollinear::notify( if (theFeature == myBaseConstraint && myInSolver) return; // the constraint is already being updated - PlaneGCSSolver_UpdateCoincidence *anUpdater = - static_cast(theUpdater); + auto *anUpdater = static_cast(theUpdater); bool isPointOnOppositeLine[4]; - std::list::reverse_iterator anIt = myAttributes.rbegin(); + auto anIt = myAttributes.rbegin(); for (int i = 0; i < 2; ++i, ++anIt) { isPointOnOppositeLine[2 * i] = anUpdater->isPointOnEntity(myPoints[2 * i], *anIt); diff --git a/src/SketchSolver/SketchSolver_ConstraintCollinear.h b/src/SketchSolver/SketchSolver_ConstraintCollinear.h index 26372fbdb..dfc3b9978 100644 --- a/src/SketchSolver/SketchSolver_ConstraintCollinear.h +++ b/src/SketchSolver/SketchSolver_ConstraintCollinear.h @@ -33,17 +33,17 @@ public: /// Constructor based on SketchPlugin constraint SketchSolver_ConstraintCollinear(ConstraintPtr theConstraint) : SketchSolver_Constraint(theConstraint), myInSolver(false) { - for (int i = 0; i < 4; ++i) - myIsConstraintApplied[i] = false; + for (bool &i : myIsConstraintApplied) + i = false; } /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr &theFeature, - PlaneGCSSolver_Update *theUpdater); + void notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater) override; protected: /// \brief Converts SketchPlugin constraint to a list of solver constraints - virtual void process(); + void process() override; private: EntityWrapperPtr myPoints[4]; ///< extremities on collinear lines diff --git a/src/SketchSolver/SketchSolver_ConstraintDistance.h b/src/SketchSolver/SketchSolver_ConstraintDistance.h index 57474f063..b8b5dd537 100644 --- a/src/SketchSolver/SketchSolver_ConstraintDistance.h +++ b/src/SketchSolver/SketchSolver_ConstraintDistance.h @@ -35,26 +35,26 @@ public: mySignValue(0.0) {} /// \brief Update constraint - virtual void update(); + void update() override; /// \brief Remove constraint - virtual bool remove(); + bool remove() override; /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *); + void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *) override; protected: /// \brief Generate list of attributes of constraint in order useful for /// constraints \param[out] theValue numerical characteristic of /// constraint (e.g. distance) \param[out] theAttributes list of attributes to /// be filled - virtual void getAttributes(EntityWrapperPtr &theValue, - std::vector &theAttributes); + void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes) override; /// \brief This method is used in derived objects to check consistence of /// constraint. /// E.g. the distance between line and point may be signed. - virtual void adjustConstraint(); + void adjustConstraint() override; private: void addConstraintsToKeepSign(); diff --git a/src/SketchSolver/SketchSolver_ConstraintEqual.cpp b/src/SketchSolver/SketchSolver_ConstraintEqual.cpp index 9911f499d..4ef97248d 100644 --- a/src/SketchSolver/SketchSolver_ConstraintEqual.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintEqual.cpp @@ -39,7 +39,7 @@ void SketchSolver_ConstraintEqual::getAttributes( int aNbCircs = 0; int aNbEllipses = 0; bool isArcFirst = false; // in line-arc equivalence, the line should be first - std::vector::iterator anAttrIt = theAttributes.begin() + 2; + auto anAttrIt = theAttributes.begin() + 2; for (; anAttrIt != theAttributes.end(); ++anAttrIt) { SketchSolver_EntityType aType = (*anAttrIt)->type(); if (aType == ENTITY_LINE) diff --git a/src/SketchSolver/SketchSolver_ConstraintEqual.h b/src/SketchSolver/SketchSolver_ConstraintEqual.h index 8bc61a4fb..c470fd6b4 100644 --- a/src/SketchSolver/SketchSolver_ConstraintEqual.h +++ b/src/SketchSolver/SketchSolver_ConstraintEqual.h @@ -36,15 +36,15 @@ public: /// \brief Tries to remove constraint /// \return \c false, if current constraint contains another SketchPlugin /// constraints (like for multiple coincidence) - virtual bool remove(); + bool remove() override; protected: /// \brief Generate list of attributes of constraint in order useful for /// constraints \param[out] theValue numerical characteristic of /// constraint (e.g. distance) \param[out] theAttributes list of attributes to /// be filled - virtual void getAttributes(EntityWrapperPtr &theValue, - std::vector &theAttributes); + void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes) override; private: ScalarWrapperPtr diff --git a/src/SketchSolver/SketchSolver_ConstraintFixed.cpp b/src/SketchSolver/SketchSolver_ConstraintFixed.cpp index 7cdcfa212..7bdba03cb 100644 --- a/src/SketchSolver/SketchSolver_ConstraintFixed.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintFixed.cpp @@ -162,10 +162,9 @@ GCS::VEC_pD toParameters(const EntityWrapperPtr &theEntity) { case ENTITY_BSPLINE: { std::shared_ptr aBSpline = std::dynamic_pointer_cast(anEntity->entity()); - for (GCS::VEC_P::iterator anIt = aBSpline->poles.begin(); - anIt != aBSpline->poles.end(); ++anIt) { - aParameters.push_back(anIt->x); - aParameters.push_back(anIt->y); + for (auto &pole : aBSpline->poles) { + aParameters.push_back(pole.x); + aParameters.push_back(pole.y); } break; } diff --git a/src/SketchSolver/SketchSolver_ConstraintFixed.h b/src/SketchSolver/SketchSolver_ConstraintFixed.h index dcc2f1b7e..b6d8903ce 100644 --- a/src/SketchSolver/SketchSolver_ConstraintFixed.h +++ b/src/SketchSolver/SketchSolver_ConstraintFixed.h @@ -33,19 +33,19 @@ public: SketchSolver_ConstraintFixed(ConstraintPtr theConstraint); /// \brief Block or unblock events from this constraint - virtual void blockEvents(bool isBlocked); + void blockEvents(bool isBlocked) override; protected: /// \brief Converts SketchPlugin constraint to a list of SolveSpace /// constraints - virtual void process(); + void process() override; /// \brief Generate list of attributes of constraint in order useful for /// constraints \param[out] theValue numerical characteristic of /// constraint (e.g. distance) \param[out] theAttributes list of attributes to /// be filled - virtual void getAttributes(EntityWrapperPtr &, - std::vector &) {} + void getAttributes(EntityWrapperPtr &, + std::vector &) override {} /// \brief Obtain entity to be fixed EntityWrapperPtr entityToFix(); diff --git a/src/SketchSolver/SketchSolver_ConstraintLength.h b/src/SketchSolver/SketchSolver_ConstraintLength.h index 8a05f9e8f..5bee065da 100644 --- a/src/SketchSolver/SketchSolver_ConstraintLength.h +++ b/src/SketchSolver/SketchSolver_ConstraintLength.h @@ -38,8 +38,8 @@ protected: /// constraints \param[out] theValue numerical characteristic of /// constraint (e.g. distance) \param[out] theAttributes list of attributes to /// be filled - virtual void getAttributes(EntityWrapperPtr &theValue, - std::vector &theAttributes); + void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes) override; }; #endif diff --git a/src/SketchSolver/SketchSolver_ConstraintMiddle.cpp b/src/SketchSolver/SketchSolver_ConstraintMiddle.cpp index 805eec24f..7ee27195c 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMiddle.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMiddle.cpp @@ -93,8 +93,7 @@ void SketchSolver_ConstraintMiddle::notify(const FeaturePtr &theFeature, return; } - PlaneGCSSolver_UpdateCoincidence *anUpdater = - static_cast(theUpdater); + auto *anUpdater = static_cast(theUpdater); bool isAccepted = anUpdater->addCoincidence(myAttributes.front(), myAttributes.back()); if (isAccepted) { diff --git a/src/SketchSolver/SketchSolver_ConstraintMiddle.h b/src/SketchSolver/SketchSolver_ConstraintMiddle.h index bcd501ddb..4b1cb7e14 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMiddle.h +++ b/src/SketchSolver/SketchSolver_ConstraintMiddle.h @@ -36,19 +36,19 @@ public: : SketchSolver_ConstraintCoincidence(theConstraint) {} /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr &theFeature, - PlaneGCSSolver_Update *theUpdater); + void notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater) override; /// \brief Remove constraint - virtual bool remove(); + bool remove() override; protected: /// \brief Generate list of attributes of constraint in order useful for /// constraints \param[out] theValue numerical characteristic of /// constraint (e.g. distance) \param[out] theAttributes list of attributes to /// be filled - virtual void getAttributes(EntityWrapperPtr &theValue, - std::vector &theAttributes); + void getAttributes(EntityWrapperPtr &theValue, + std::vector &theAttributes) override; private: ConstraintWrapperPtr myMiddle; diff --git a/src/SketchSolver/SketchSolver_ConstraintMirror.cpp b/src/SketchSolver/SketchSolver_ConstraintMirror.cpp index 9f16818f9..8f6e1a9c1 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMirror.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMirror.cpp @@ -70,7 +70,7 @@ void SketchSolver_ConstraintMirror::getAttributes( // store only original entities because mirrored ones // will be updated separately in adjustConstraint std::list aList = aBaseRefList->list(); - std::list::iterator anIt = aList.begin(); + auto anIt = aList.begin(); for (; anIt != aList.end(); ++anIt) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); if (aFeature) { @@ -144,7 +144,7 @@ void SketchSolver_ConstraintMirror::notify(const FeaturePtr &theFeature, } void SketchSolver_ConstraintMirror::blockEvents(bool isBlocked) { - std::set::iterator anIt = myFeatures.begin(); + auto anIt = myFeatures.begin(); for (; anIt != myFeatures.end(); ++anIt) (*anIt)->data()->blockSendAttributeUpdated(isBlocked); diff --git a/src/SketchSolver/SketchSolver_ConstraintMirror.h b/src/SketchSolver/SketchSolver_ConstraintMirror.h index b96221a00..9d37a9c5a 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMirror.h +++ b/src/SketchSolver/SketchSolver_ConstraintMirror.h @@ -34,27 +34,27 @@ public: : SketchSolver_Constraint(theConstraint), myNumberOfObjects(0) {} /// \brief Update constraint - virtual void update(); + void update() override; /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *); + void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *) override; /// \brief Block or unblock events from this constraint - virtual void blockEvents(bool isBlocked); + void blockEvents(bool isBlocked) override; protected: /// \brief Converts SketchPlugin constraint to a list of SolveSpace /// constraints - virtual void process(); + void process() override; /// \brief Generate list of entities of mirror constraint - virtual void getAttributes(EntityWrapperPtr &, - std::vector &); + void getAttributes(EntityWrapperPtr &, + std::vector &) override; /// \brief This method is used in derived objects to check consistence of /// constraint. /// E.g. the distance between line and point may be signed. - virtual void adjustConstraint(); + void adjustConstraint() override; private: size_t myNumberOfObjects; ///< number of previously mirrored objects diff --git a/src/SketchSolver/SketchSolver_ConstraintMovement.cpp b/src/SketchSolver/SketchSolver_ConstraintMovement.cpp index a21346a0e..9b6cb6ddb 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMovement.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMovement.cpp @@ -87,11 +87,11 @@ static bool isSimpleMove(FeaturePtr theMovedFeature, #ifdef CHANGE_RADIUS_WHILE_MOVE if (theMovedFeature->getKind() == SketchPlugin_Circle::ID() || theMovedFeature->getKind() == SketchPlugin_Ellipse::ID()) - isSimple = (theDraggedPoint.get() != 0); + isSimple = (theDraggedPoint.get() != nullptr); else if (theMovedFeature->getKind() == SketchPlugin_Arc::ID() || theMovedFeature->getKind() == SketchPlugin_EllipticArc::ID()) { isSimple = - (theDraggedPoint.get() != 0 && + (theDraggedPoint.get() != nullptr && (theDraggedPoint->id() == SketchPlugin_Arc::CENTER_ID() || theDraggedPoint->id() == SketchPlugin_EllipticArc::CENTER_ID())); } @@ -163,7 +163,8 @@ ConstraintWrapperPtr SketchSolver_ConstraintMovement::fixArcExtremity( PointWrapperPtr aPoint = std::dynamic_pointer_cast(theArcExtremity); - double *aParams[nbParams] = {aPoint->point()->x, aPoint->point()->y, 0, 0}; + double *aParams[nbParams] = {aPoint->point()->x, aPoint->point()->y, nullptr, + nullptr}; if (anArc) { aParams[2] = anArc->center.x; aParams[3] = anArc->center.y; diff --git a/src/SketchSolver/SketchSolver_ConstraintMovement.h b/src/SketchSolver/SketchSolver_ConstraintMovement.h index a8e840054..30f40301e 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMovement.h +++ b/src/SketchSolver/SketchSolver_ConstraintMovement.h @@ -51,7 +51,7 @@ public: void moveTo(const std::shared_ptr &theDestinationPoint); /// \brief Block or unblock events from this constraint - virtual void blockEvents(bool isBlocked); + void blockEvents(bool isBlocked) override; /// \brief Returns moved feature FeaturePtr movedFeature() const { return myMovedFeature; } @@ -59,7 +59,7 @@ public: protected: /// \brief Converts SketchPlugin constraint to a list of SolveSpace /// constraints - virtual void process(); + void process() override; /// \brief Create Fixed constraint for the feature basing on its type and /// moved point \return Fixed constraint diff --git a/src/SketchSolver/SketchSolver_ConstraintMulti.cpp b/src/SketchSolver/SketchSolver_ConstraintMulti.cpp index d21bfd990..acde45a56 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMulti.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMulti.cpp @@ -64,7 +64,7 @@ void SketchSolver_ConstraintMulti::getEntities( FeaturePtr aFeature; std::list anObjectList = aRefList->list(); - std::list::iterator anObjIt = anObjectList.begin(); + auto anObjIt = anObjectList.begin(); // execute for the feature is not called yet if ((myNumberOfCopies + 1) * myNumberOfObjects != aRefList->size()) myNumberOfCopies = aRefList->size() / myNumberOfObjects - 1; @@ -97,7 +97,7 @@ bool SketchSolver_ConstraintMulti::remove() { // "Multi" constraint has been removed, thus all copy features become // non-copied, add them once again to be a common feature - std::set::iterator anIt = myCopiedFeatures.begin(); + auto anIt = myCopiedFeatures.begin(); for (; anIt != myCopiedFeatures.end(); ++anIt) { EntityWrapperPtr anEntity = myStorage->entity(*anIt); if (anEntity) { @@ -130,7 +130,7 @@ void SketchSolver_ConstraintMulti::update() { if (aRefList && aRefList->size() != 0) { FeaturePtr aFeature; std::list anObjectList = aRefList->list(); - std::list::iterator anObjIt = anObjectList.begin(); + auto anObjIt = anObjectList.begin(); for (; anObjIt != anObjectList.end(); ++anObjIt) { aFeature = ModelAPI_Feature::feature(*anObjIt); if (aFeature && @@ -165,7 +165,7 @@ void SketchSolver_ConstraintMulti::adjustConstraint() { std::list::iterator aXIt, aYIt; std::list anObjectList = aRefList->list(); - std::list::iterator anObjIt = anObjectList.begin(); + auto anObjIt = anObjectList.begin(); while (anObjIt != anObjectList.end()) { anOriginal = ModelAPI_Feature::feature(*anObjIt++); if (!anOriginal) @@ -176,7 +176,7 @@ void SketchSolver_ConstraintMulti::adjustConstraint() { double aXCoord, aYCoord; std::list aPoints = anOriginal->data()->attributes(GeomDataAPI_Point2D::typeId()); - std::list::iterator aPtIt = aPoints.begin(); + auto aPtIt = aPoints.begin(); for (; aPtIt != aPoints.end(); ++aPtIt) { AttributePoint2DPtr aPoint2D = std::dynamic_pointer_cast(*aPtIt); @@ -257,7 +257,7 @@ void SketchSolver_ConstraintMulti::notify(const FeaturePtr &theFeature, void SketchSolver_ConstraintMulti::blockEvents(bool isBlocked) { myIsEventsBlocked = isBlocked; - std::set::iterator anIt = myOriginalFeatures.begin(); + auto anIt = myOriginalFeatures.begin(); for (; anIt != myOriginalFeatures.end(); ++anIt) (*anIt)->data()->blockSendAttributeUpdated(isBlocked); for (anIt = myCopiedFeatures.begin(); anIt != myCopiedFeatures.end(); ++anIt) diff --git a/src/SketchSolver/SketchSolver_ConstraintMulti.h b/src/SketchSolver/SketchSolver_ConstraintMulti.h index 4cbadfded..4157cb340 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMulti.h +++ b/src/SketchSolver/SketchSolver_ConstraintMulti.h @@ -38,23 +38,23 @@ public: myIsEventsBlocked(false), myIsProcessingNotify(false) {} /// \brief Update constraint - virtual void update(); + void update() override; /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *); + void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *) override; /// \brief Tries to remove constraint /// \return \c false, if current constraint contains another SketchPlugin /// constraints (like for multiple coincidence) - virtual bool remove(); + bool remove() override; /// \brief Block or unblock events from this constraint - virtual void blockEvents(bool isBlocked); + void blockEvents(bool isBlocked) override; protected: /// \brief Converts SketchPlugin constraint to a list of SolveSpace /// constraints - virtual void process() { /* do nothing here */ + void process() override { /* do nothing here */ } /// \brief Collect entities which are translated or rotated (not their copies) @@ -62,14 +62,13 @@ protected: /// \brief Generate list of attributes of constraint in order useful for /// SolveSpace constraints - virtual void - getAttributes(EntityWrapperPtr &, - std::vector &) { /* do nothing here */ + void getAttributes(EntityWrapperPtr &, std::vector &) + override { /* do nothing here */ } /// \brief This method is used in derived objects to check consistence of /// constraint. - virtual void adjustConstraint(); + void adjustConstraint() override; /// \brief Update parameters of derived classes virtual void updateLocal() = 0; diff --git a/src/SketchSolver/SketchSolver_ConstraintMultiRotation.h b/src/SketchSolver/SketchSolver_ConstraintMultiRotation.h index 0b4722304..eba376313 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMultiRotation.h +++ b/src/SketchSolver/SketchSolver_ConstraintMultiRotation.h @@ -39,7 +39,7 @@ public: protected: /// \brief Converts SketchPlugin constraint to a list of SolveSpace /// constraints - virtual void process(); + void process() override; /// \brief Generate list of rotated entities /// \param[out] theCenter central point of rotation @@ -53,24 +53,24 @@ protected: /// \brief This method is used in derived objects to check consistence of /// constraint. - virtual void adjustConstraint(); + void adjustConstraint() override; /// \brief Update parameters (called from base class) - virtual void updateLocal(); + void updateLocal() override; private: /// \brief Convert absolute coordinates to relative coordinates - virtual void getRelative(double theAbsX, double theAbsY, double &theRelX, - double &theRelY); + void getRelative(double theAbsX, double theAbsY, double &theRelX, + double &theRelY) override; /// \brief Convert relative coordinates to absolute coordinates - virtual void getAbsolute(double theRelX, double theRelY, double &theAbsX, - double &theAbsY); + void getAbsolute(double theRelX, double theRelY, double &theAbsX, + double &theAbsY) override; /// \brief Apply transformation for relative coordinates - virtual void transformRelative(double &theX, double &theY); + void transformRelative(double &theX, double &theY) override; /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding /// feature - virtual const std::string &nameNbObjects(); + const std::string &nameNbObjects() override; private: AttributePoint2DPtr myCenterPointAttribute; ///< a center of rotation diff --git a/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.h b/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.h index a2541eba4..075434418 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.h +++ b/src/SketchSolver/SketchSolver_ConstraintMultiTranslation.h @@ -39,7 +39,7 @@ public: protected: /// \brief Converts SketchPlugin constraint to a list of SolveSpace /// constraints - virtual void process(); + void process() override; /// \brief Generate list of translated entities /// \param[out] theStartPoint start point of translation @@ -52,24 +52,24 @@ protected: /// \brief This method is used in derived objects to check consistence of /// constraint. - virtual void adjustConstraint(); + void adjustConstraint() override; /// \brief Update parameters (called from base class) - virtual void updateLocal(); + void updateLocal() override; private: /// \brief Convert absolute coordinates to relative coordinates - virtual void getRelative(double theAbsX, double theAbsY, double &theRelX, - double &theRelY); + void getRelative(double theAbsX, double theAbsY, double &theRelX, + double &theRelY) override; /// \brief Convert relative coordinates to absolute coordinates - virtual void getAbsolute(double theRelX, double theRelY, double &theAbsX, - double &theAbsY); + void getAbsolute(double theRelX, double theRelY, double &theAbsX, + double &theAbsY) override; /// \brief Apply transformation for relative coordinates - virtual void transformRelative(double &theX, double &theY); + void transformRelative(double &theX, double &theY) override; /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding /// feature - virtual const std::string &nameNbObjects(); + const std::string &nameNbObjects() override; private: AttributePoint2DPtr myStartPointAttribute; diff --git a/src/SketchSolver/SketchSolver_ConstraintOffset.h b/src/SketchSolver/SketchSolver_ConstraintOffset.h index 86f2d76a3..a20be9bb6 100644 --- a/src/SketchSolver/SketchSolver_ConstraintOffset.h +++ b/src/SketchSolver/SketchSolver_ConstraintOffset.h @@ -34,16 +34,16 @@ public: : SketchSolver_Constraint(theConstraint) {} /// \brief Update constraint - virtual void update(); + void update() override; protected: /// \brief Converts SketchPlugin constraint to a list of SolveSpace /// constraints - virtual void process(); + void process() override; /// \brief Generate list of entities of mirror constraint - virtual void getAttributes(EntityWrapperPtr &, - std::vector &); + void getAttributes(EntityWrapperPtr &, + std::vector &) override; }; #endif diff --git a/src/SketchSolver/SketchSolver_ConstraintPerpendicular.cpp b/src/SketchSolver/SketchSolver_ConstraintPerpendicular.cpp index 6792cae0c..6b91f24f7 100644 --- a/src/SketchSolver/SketchSolver_ConstraintPerpendicular.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintPerpendicular.cpp @@ -106,7 +106,7 @@ void SketchSolver_ConstraintPerpendicular::rebuild() { int aNbLines = 0; int aNbCircles = 0; int aNbOther = 0; - std::list::iterator anEntIt = myAttributes.begin(); + auto anEntIt = myAttributes.begin(); for (; anEntIt != myAttributes.end(); ++anEntIt) { if (!(*anEntIt).get()) continue; @@ -192,7 +192,7 @@ void SketchSolver_ConstraintPerpendicular::rebuild() { } void SketchSolver_ConstraintPerpendicular::notify( - const FeaturePtr &theFeature, PlaneGCSSolver_Update *theUpdater) { + const FeaturePtr &theFeature, PlaneGCSSolver_Update * /*theUpdater*/) { if (theFeature->getKind() != SketchPlugin_ConstraintCoincidence::ID()) return; @@ -239,7 +239,7 @@ void SketchSolver_ConstraintPerpendicular::notify( std::set aCoincidentPoints = coincidentBoundaryPoints(aTgFeat1, aTgFeat2); isRebuild = true; - std::set::iterator anIt = aCoincidentPoints.begin(); + auto anIt = aCoincidentPoints.begin(); for (; anIt != aCoincidentPoints.end() && isRebuild; ++anIt) if (*anIt == mySharedPoint) isRebuild = @@ -298,7 +298,7 @@ std::set coincidentBoundaryPoints(FeaturePtr theFeature1, collectCoincidences(theFeature1, theFeature2); // collect points only std::set aCoincidentPoints; - std::set::const_iterator aCIt = aCoincidences.begin(); + auto aCIt = aCoincidences.begin(); for (; aCIt != aCoincidences.end(); ++aCIt) { AttributeRefAttrPtr aRefAttrA = (*aCIt)->refattr(SketchPlugin_Constraint::ENTITY_A()); @@ -324,9 +324,8 @@ std::set coincidentBoundaryPoints(FeaturePtr theFeature1, static std::set refsToFeatureAndResults(FeaturePtr theFeature) { std::set aRefs = theFeature->data()->refsToMe(); const std::list &aResults = theFeature->results(); - for (std::list::const_iterator anIt = aResults.begin(); - anIt != aResults.end(); ++anIt) { - const std::set &aResRefs = (*anIt)->data()->refsToMe(); + for (const auto &aResult : aResults) { + const std::set &aResRefs = aResult->data()->refsToMe(); aRefs.insert(aResRefs.begin(), aResRefs.end()); } return aRefs; @@ -337,9 +336,8 @@ static std::set pointsOnFeature(FeaturePtr theFeature) { std::set aPoints; std::set aRefs = refsToFeatureAndResults(theFeature); - for (std::set::const_iterator anIt = aRefs.begin(); - anIt != aRefs.end(); ++anIt) { - FeaturePtr aRef = ModelAPI_Feature::feature((*anIt)->owner()); + for (const auto &anIt : aRefs) { + FeaturePtr aRef = ModelAPI_Feature::feature(anIt->owner()); if (aRef && (aRef->getKind() == SketchPlugin_ConstraintCoincidence::ID() || aRef->getKind() == SketchPlugin_ConstraintMiddle::ID())) { for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { @@ -363,10 +361,9 @@ std::set coincidentPoints(FeaturePtr theFeature1, std::set aPointsOnF2 = pointsOnFeature(theFeature2); std::set aCommonPoints; - for (std::set::iterator anIt = aPointsOnF1.begin(); - anIt != aPointsOnF1.end(); ++anIt) - if (aPointsOnF2.find(*anIt) != aPointsOnF2.end()) - aCommonPoints.insert(*anIt); + for (const auto &anIt : aPointsOnF1) + if (aPointsOnF2.find(anIt) != aPointsOnF2.end()) + aCommonPoints.insert(anIt); return aCommonPoints; } diff --git a/src/SketchSolver/SketchSolver_ConstraintPerpendicular.h b/src/SketchSolver/SketchSolver_ConstraintPerpendicular.h index 43584b554..99cee81d1 100644 --- a/src/SketchSolver/SketchSolver_ConstraintPerpendicular.h +++ b/src/SketchSolver/SketchSolver_ConstraintPerpendicular.h @@ -34,12 +34,12 @@ public: : SketchSolver_Constraint(theConstraint), myCurveCurveAngle(0.0) {} /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr &theFeature, - PlaneGCSSolver_Update *theUpdater); + void notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater) override; protected: /// \brief Converts SketchPlugin constraint to a list of solver constraints - virtual void process(); + void process() override; /// \brief Remove current constraint from the storage and build is again void rebuild(); diff --git a/src/SketchSolver/SketchSolver_ConstraintTangent.cpp b/src/SketchSolver/SketchSolver_ConstraintTangent.cpp index 39cecf9ac..c10d4c536 100644 --- a/src/SketchSolver/SketchSolver_ConstraintTangent.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintTangent.cpp @@ -74,13 +74,13 @@ static bool isArcArcTangencyInternal(EntityWrapperPtr theArc1, static ConstraintWrapperPtr createArcLineTangency(EntityWrapperPtr theEntity1, EntityWrapperPtr theEntity2, EntityWrapperPtr theShapedPoint = EntityWrapperPtr(), - double *theAngle = 0); + double *theAngle = nullptr); static ConstraintWrapperPtr createCurveCurveTangency(EntityWrapperPtr theEntity1, EntityWrapperPtr theEntity2, bool theInternalTangency, EntityWrapperPtr theSharedPoint = EntityWrapperPtr(), - double *theAngle = 0); + double *theAngle = nullptr); static void calculateTangencyPoint(EntityWrapperPtr theCurve1, EntityWrapperPtr theCurve2, @@ -131,7 +131,7 @@ void SketchSolver_ConstraintTangent::rebuild() { int aNbCircles = 0; int aNbEllipses = 0; int aNbSplines = 0; - std::list::iterator anEntIt = myAttributes.begin(); + auto anEntIt = myAttributes.begin(); for (; anEntIt != myAttributes.end(); ++anEntIt) { if (!(*anEntIt).get()) continue; @@ -195,13 +195,13 @@ void SketchSolver_ConstraintTangent::rebuild() { // which boundary is coincident? GCS::Point aPoint1, aPoint2; - for (std::set::iterator aPIt = aCoincidentPoints.begin(); - aPIt != aCoincidentPoints.end(); ++aPIt) { - if ((*aPIt)->owner() == aFeatures[i]) { - if ((*aPIt)->id() == SketchPlugin_BSpline::START_ID()) { + for (const auto &aCoincidentPoint : aCoincidentPoints) { + if (aCoincidentPoint->owner() == aFeatures[i]) { + if (aCoincidentPoint->id() == SketchPlugin_BSpline::START_ID()) { aPoint1 = aBSpline->poles[0]; aPoint2 = aBSpline->poles[1]; - } else if ((*aPIt)->id() == SketchPlugin_BSpline::END_ID()) { + } else if (aCoincidentPoint->id() == + SketchPlugin_BSpline::END_ID()) { aPoint1 = aBSpline->poles[aBSpline->poles.size() - 2]; aPoint2 = aBSpline->poles[aBSpline->poles.size() - 1]; } @@ -285,8 +285,8 @@ void SketchSolver_ConstraintTangent::adjustConstraint() { } } -void SketchSolver_ConstraintTangent::notify(const FeaturePtr &theFeature, - PlaneGCSSolver_Update *theUpdater) { +void SketchSolver_ConstraintTangent::notify( + const FeaturePtr &theFeature, PlaneGCSSolver_Update * /*theUpdater*/) { if (theFeature->getKind() != SketchPlugin_ConstraintCoincidence::ID()) return; @@ -333,7 +333,7 @@ void SketchSolver_ConstraintTangent::notify(const FeaturePtr &theFeature, std::set aCoincidentPoints = coincidentBoundaryPoints(aTgFeat1, aTgFeat2); isRebuild = true; - std::set::iterator anIt = aCoincidentPoints.begin(); + auto anIt = aCoincidentPoints.begin(); for (; anIt != aCoincidentPoints.end() && isRebuild; ++anIt) if (*anIt == mySharedPoint) isRebuild = @@ -418,8 +418,7 @@ std::set collectCoincidences(FeaturePtr theFeature1, AttributeRefAttrPtr aRefAttr = aRef->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (aRefAttr && !aRefAttr->isObject()) { - std::map::iterator aFound = - aCoincidentPoints.find(aRefAttr->attr()); + auto aFound = aCoincidentPoints.find(aRefAttr->attr()); if (aFound != aCoincidentPoints.end()) { aCoincidencesBetweenFeatures.insert(aRef); aCoincidencesBetweenFeatures.insert(aFound->second); @@ -438,7 +437,7 @@ std::set coincidentBoundaryPoints(FeaturePtr theFeature1, collectCoincidences(theFeature1, theFeature2); // collect points only std::map> aCoincidentPoints; - std::set::const_iterator aCIt = aCoincidences.begin(); + auto aCIt = aCoincidences.begin(); for (; aCIt != aCoincidences.end(); ++aCIt) { for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { AttributeRefAttrPtr aRefAttr = @@ -478,10 +477,9 @@ std::set coincidentBoundaryPoints(FeaturePtr theFeature1, std::set aBoundaryPoints; if (aCoincidentPoints.size() == 2) { - for (std::map>::iterator anIt = - aCoincidentPoints.begin(); - anIt != aCoincidentPoints.end(); ++anIt) - aBoundaryPoints.insert(anIt->second.begin(), anIt->second.end()); + for (auto &aCoincidentPoint : aCoincidentPoints) + aBoundaryPoints.insert(aCoincidentPoint.second.begin(), + aCoincidentPoint.second.end()); } return aBoundaryPoints; } @@ -489,9 +487,8 @@ std::set coincidentBoundaryPoints(FeaturePtr theFeature1, static std::set refsToFeatureAndResults(FeaturePtr theFeature) { std::set aRefs = theFeature->data()->refsToMe(); const std::list &aResults = theFeature->results(); - for (std::list::const_iterator anIt = aResults.begin(); - anIt != aResults.end(); ++anIt) { - const std::set &aResRefs = (*anIt)->data()->refsToMe(); + for (const auto &aResult : aResults) { + const std::set &aResRefs = aResult->data()->refsToMe(); aRefs.insert(aResRefs.begin(), aResRefs.end()); } return aRefs; @@ -502,9 +499,8 @@ static std::set pointsOnFeature(FeaturePtr theFeature) { std::set aPoints; std::set aRefs = refsToFeatureAndResults(theFeature); - for (std::set::const_iterator anIt = aRefs.begin(); - anIt != aRefs.end(); ++anIt) { - FeaturePtr aRef = ModelAPI_Feature::feature((*anIt)->owner()); + for (const auto &anIt : aRefs) { + FeaturePtr aRef = ModelAPI_Feature::feature(anIt->owner()); if (aRef && (aRef->getKind() == SketchPlugin_ConstraintCoincidence::ID() || aRef->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID() || @@ -530,10 +526,9 @@ std::set coincidentPoints(FeaturePtr theFeature1, std::set aPointsOnF2 = pointsOnFeature(theFeature2); std::set aCommonPoints; - for (std::set::iterator anIt = aPointsOnF1.begin(); - anIt != aPointsOnF1.end(); ++anIt) - if (aPointsOnF2.find(*anIt) != aPointsOnF2.end()) - aCommonPoints.insert(*anIt); + for (const auto &anIt : aPointsOnF1) + if (aPointsOnF2.find(anIt) != aPointsOnF2.end()) + aCommonPoints.insert(anIt); return aCommonPoints; } diff --git a/src/SketchSolver/SketchSolver_ConstraintTangent.h b/src/SketchSolver/SketchSolver_ConstraintTangent.h index 3ee1d0f5a..825d343b7 100644 --- a/src/SketchSolver/SketchSolver_ConstraintTangent.h +++ b/src/SketchSolver/SketchSolver_ConstraintTangent.h @@ -35,17 +35,17 @@ public: myCurveCurveAngle(0.0) {} /// \brief Notify this object about the feature is changed somewhere - virtual void notify(const FeaturePtr &theFeature, - PlaneGCSSolver_Update *theUpdater); + void notify(const FeaturePtr &theFeature, + PlaneGCSSolver_Update *theUpdater) override; /// \brief Tries to remove constraint /// \return \c false, if current constraint contains another SketchPlugin /// constraints (like for multiple coincidence) - virtual bool remove(); + bool remove() override; protected: /// \brief Converts SketchPlugin constraint to a list of solver constraints - virtual void process(); + void process() override; /// \brief Remove current constraint from the storage and build is again void rebuild(); @@ -53,7 +53,7 @@ protected: /// \brief This method is used in derived objects to check consistency of /// constraint. /// E.g. the distance between line and point may be signed. - virtual void adjustConstraint(); + void adjustConstraint() override; private: bool isArcArcInternal; diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index bde8616f8..97ce8ae30 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -162,7 +162,7 @@ static SolverConstraintPtr move(StoragePtr theStorage, const EntityWrapperPtr &theSolverEntity, const std::shared_ptr &theFrom, const std::shared_ptr &theTo) { - bool isEntityExists = (theSolverEntity.get() != 0); + bool isEntityExists = (theSolverEntity.get() != nullptr); if (theSketchDOF == 0 && isEntityExists) { // avoid moving elements of fully constrained sketch theStorage->refresh(); @@ -321,7 +321,7 @@ bool SketchSolver_Group::resolveConstraints() { myStorage->getConflictingConstraints(mySketchSolver); if (!myConflictingConstraints.empty()) { - std::set::iterator anIt = aConflicting.begin(); + auto anIt = aConflicting.begin(); for (; anIt != aConflicting.end(); ++anIt) myConflictingConstraints.erase(*anIt); if (!myConflictingConstraints.empty()) { @@ -408,13 +408,12 @@ void SketchSolver_Group::repairConsistency() { if (!areConstraintsValid() || !myStorage->areFeaturesValid()) { // remove invalid constraints std::set anInvalidConstraints; - ConstraintConstraintMap::iterator aCIter = myConstraints.begin(); + auto aCIter = myConstraints.begin(); for (; aCIter != myConstraints.end(); ++aCIter) { if (!aCIter->first->data() || !aCIter->first->data()->isValid()) anInvalidConstraints.insert(aCIter->first); } - std::set::const_iterator aRemoveIt = - anInvalidConstraints.begin(); + auto aRemoveIt = anInvalidConstraints.begin(); for (; aRemoveIt != anInvalidConstraints.end(); ++aRemoveIt) removeConstraint(*aRemoveIt); @@ -436,7 +435,7 @@ void SketchSolver_Group::removeTemporaryConstraints() { if (!myTempConstraints.empty()) { mySketchSolver->removeConstraint(CID_MOVEMENT); - std::set::iterator aTmpIt = myTempConstraints.begin(); + auto aTmpIt = myTempConstraints.begin(); for (; aTmpIt != myTempConstraints.end(); ++aTmpIt) (*aTmpIt)->remove(); @@ -452,7 +451,7 @@ void SketchSolver_Group::removeTemporaryConstraints() { // Purpose: remove constraint and all unused entities // ============================================================================ void SketchSolver_Group::removeConstraint(ConstraintPtr theConstraint) { - ConstraintConstraintMap::iterator aCIter = myConstraints.begin(); + auto aCIter = myConstraints.begin(); for (; aCIter != myConstraints.end(); aCIter++) if (aCIter->first == theConstraint) { aCIter->second->remove(); // the constraint is not fully removed @@ -488,7 +487,7 @@ void SketchSolver_Group::blockEvents(bool isBlocked) { myStorage->blockEvents(isBlocked); // block/unblock events from constraints - ConstraintConstraintMap::iterator aCIt = myConstraints.begin(); + auto aCIt = myConstraints.begin(); for (; aCIt != myConstraints.end(); ++aCIt) aCIt->second->blockEvents(isBlocked); @@ -497,7 +496,7 @@ void SketchSolver_Group::blockEvents(bool isBlocked) { bool SketchSolver_Group::areConstraintsValid() const { // Check the constraints are valid - ConstraintConstraintMap::const_iterator aCIter = myConstraints.begin(); + auto aCIter = myConstraints.begin(); for (; aCIter != myConstraints.end(); ++aCIter) if (!aCIter->first->data() || !aCIter->first->data()->isValid()) return false; diff --git a/src/SketchSolver/SketchSolver_Group.h b/src/SketchSolver/SketchSolver_Group.h index 5abdea54b..c620cc9db 100644 --- a/src/SketchSolver/SketchSolver_Group.h +++ b/src/SketchSolver/SketchSolver_Group.h @@ -35,7 +35,7 @@ class GeomAPI_Dir; class GeomAPI_Pnt; class GeomAPI_Pnt2d; -typedef std::map ConstraintConstraintMap; +using ConstraintConstraintMap = std::map; /** \class SketchSolver_Group * \ingroup Plugins @@ -163,6 +163,6 @@ private: ///< constraints }; -typedef std::shared_ptr SketchGroupPtr; +using SketchGroupPtr = std::shared_ptr; #endif diff --git a/src/SketchSolver/SketchSolver_Manager.cpp b/src/SketchSolver/SketchSolver_Manager.cpp index 7c5b2e51f..cacd82a01 100644 --- a/src/SketchSolver/SketchSolver_Manager.cpp +++ b/src/SketchSolver/SketchSolver_Manager.cpp @@ -48,7 +48,7 @@ typedef std::map> IndexedFeatureMap; static void featuresOrderedByCreation(const std::set &theOriginalFeatures, IndexedFeatureMap &theOrderedFeatures) { - std::set::iterator aFeatIter = theOriginalFeatures.begin(); + auto aFeatIter = theOriginalFeatures.begin(); for (; aFeatIter != theOriginalFeatures.end(); aFeatIter++) { std::shared_ptr aFeature = std::dynamic_pointer_cast(*aFeatIter); @@ -66,7 +66,7 @@ featuresOrderedByType(const std::set &theOriginalFeatures, int aFeatureIndex = 0; int aConstraintIndex = (int)theOriginalFeatures.size(); - std::set::iterator aFeatIter = theOriginalFeatures.begin(); + auto aFeatIter = theOriginalFeatures.begin(); for (; aFeatIter != theOriginalFeatures.end(); aFeatIter++) { std::shared_ptr aFeature = std::dynamic_pointer_cast(*aFeatIter); @@ -106,7 +106,7 @@ static void setPoint(AttributePtr theAttribute, const int thePointIndex, // ======================================================== SketchSolver_Manager *SketchSolver_Manager::instance() { static SketchSolver_Manager *mySelf = - 0; // Self pointer to implement singleton functionality + nullptr; // Self pointer to implement singleton functionality if (!mySelf) mySelf = new SketchSolver_Manager(); return mySelf; @@ -233,10 +233,10 @@ void SketchSolver_Manager::processEvent( break; if (aFGrIter != aFeatureGroups.end()) { - std::list::iterator aGroupIter = myGroups.begin(); + auto aGroupIter = myGroups.begin(); while (aGroupIter != myGroups.end()) { if (!(*aGroupIter)->isWorkplaneValid()) { // the group should be removed - std::list::iterator aRemoveIt = aGroupIter++; + auto aRemoveIt = aGroupIter++; myGroups.erase(aRemoveIt); continue; } @@ -411,7 +411,7 @@ SketchGroupPtr SketchSolver_Manager::findGroup( // Obtain sketch, containing the feature CompositeFeaturePtr aSketch; const std::set &aRefsList = theFeature->data()->refsToMe(); - std::set::const_iterator aRefIt = aRefsList.begin(); + auto aRefIt = aRefsList.begin(); for (; aRefIt != aRefsList.end(); ++aRefIt) { FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner()); if (anOwner && anOwner->getKind() == SketchPlugin_Sketch::ID()) { @@ -452,7 +452,7 @@ bool SketchSolver_Manager::resolveConstraints() { } void SketchSolver_Manager::releaseFeaturesIfEventsBlocked() const { - std::list::const_iterator aGroupIter = myGroups.begin(); + auto aGroupIter = myGroups.begin(); for (; aGroupIter != myGroups.end(); ++aGroupIter) (*aGroupIter)->blockEvents(false); } diff --git a/src/SketchSolver/SketchSolver_Manager.h b/src/SketchSolver/SketchSolver_Manager.h index 2fbea6bda..893d38e9f 100644 --- a/src/SketchSolver/SketchSolver_Manager.h +++ b/src/SketchSolver/SketchSolver_Manager.h @@ -50,18 +50,18 @@ public: /** \brief Implementation of Event Listener method * \param[in] theMessage the data of the event */ - virtual void processEvent(const std::shared_ptr &theMessage); + void processEvent(const std::shared_ptr &theMessage) override; /** * The solver needs all the updated objects are transfered in one group, not * one by one. This iscreases performance and avoids problems in resolve of * only part of the made updates. */ - virtual bool groupMessages(); + bool groupMessages() override; protected: SketchSolver_Manager(); - ~SketchSolver_Manager(); + ~SketchSolver_Manager() override; /** \brief Adds or updates a constraint or an entity in the suitable group * \param[in] theFeature sketch feature to be changed diff --git a/src/SketchSolver/SketchSolver_Storage.cpp b/src/SketchSolver/SketchSolver_Storage.cpp index dc333924d..ea0993bd3 100644 --- a/src/SketchSolver/SketchSolver_Storage.cpp +++ b/src/SketchSolver/SketchSolver_Storage.cpp @@ -117,8 +117,7 @@ const ConstraintWrapperPtr & SketchSolver_Storage::constraint(const ConstraintPtr &theConstraint) const { static ConstraintWrapperPtr aDummy; - std::map::const_iterator aFound = - myConstraintMap.find(theConstraint); + auto aFound = myConstraintMap.find(theConstraint); if (aFound != myConstraintMap.end()) return aFound->second; return aDummy; @@ -126,8 +125,7 @@ SketchSolver_Storage::constraint(const ConstraintPtr &theConstraint) const { const EntityWrapperPtr & SketchSolver_Storage::entity(const FeaturePtr &theFeature) const { - std::map::const_iterator aFound = - myFeatureMap.find(theFeature); + auto aFound = myFeatureMap.find(theFeature); if (aFound != myFeatureMap.end()) return aFound->second; @@ -137,8 +135,7 @@ SketchSolver_Storage::entity(const FeaturePtr &theFeature) const { const EntityWrapperPtr & SketchSolver_Storage::entity(const AttributePtr &theAttribute) const { - std::map::const_iterator aFound = - myAttributeMap.find(theAttribute); + auto aFound = myAttributeMap.find(theAttribute); if (aFound != myAttributeMap.end()) return aFound->second; @@ -176,8 +173,7 @@ void SketchSolver_Storage::removeAttribute(AttributePtr theAttribute) { bool SketchSolver_Storage::areFeaturesValid() const { // Check the features are valid - std::map::const_iterator aFIter = - myFeatureMap.begin(); + auto aFIter = myFeatureMap.begin(); for (; aFIter != myFeatureMap.end(); aFIter++) if (!aFIter->first->data() || !aFIter->first->data()->isValid()) return false; @@ -204,8 +200,7 @@ void SketchSolver_Storage::blockEvents(bool isBlocked) { std::set SketchSolver_Storage::getConflictingConstraints(SolverPtr theSolver) const { std::set aConflicting; - std::map::const_iterator aConstrIt = - myConstraintMap.begin(); + auto aConstrIt = myConstraintMap.begin(); for (; aConstrIt != myConstraintMap.end(); ++aConstrIt) { if (theSolver->isConflicting(aConstrIt->second->id())) aConflicting.insert(aConstrIt->first); diff --git a/src/SketchSolver/SketchSolver_Storage.h b/src/SketchSolver/SketchSolver_Storage.h index 339e17116..0555c63d3 100644 --- a/src/SketchSolver/SketchSolver_Storage.h +++ b/src/SketchSolver/SketchSolver_Storage.h @@ -44,8 +44,8 @@ typedef std::map> */ class SketchSolver_Storage { private: - SketchSolver_Storage(const SketchSolver_Storage &); - SketchSolver_Storage &operator=(const SketchSolver_Storage &); + SketchSolver_Storage(const SketchSolver_Storage &) = delete; + SketchSolver_Storage &operator=(const SketchSolver_Storage &) = delete; public: SketchSolver_Storage(SolverPtr theSolver); @@ -185,6 +185,6 @@ protected: UpdaterPtr myUpdaters; }; -typedef std::shared_ptr StoragePtr; +using StoragePtr = std::shared_ptr; #endif diff --git a/src/SketcherPrs/SketcherPrs_Angle.h b/src/SketcherPrs/SketcherPrs_Angle.h index a85263351..fe42bd205 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.h +++ b/src/SketcherPrs/SketcherPrs_Angle.h @@ -45,7 +45,7 @@ public: SketchPlugin_Sketch *theSketcher); /// Destructor - Standard_EXPORT ~SketcherPrs_Angle(); + Standard_EXPORT ~SketcherPrs_Angle() override; DEFINE_STANDARD_RTTIEXT(SketcherPrs_Angle, PrsDim_AngleDimension) @@ -64,15 +64,15 @@ public: protected: /// Redefinition of virtual function - Standard_EXPORT virtual void + Standard_EXPORT void Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, const Handle(Prs3d_Presentation) & thePresentation, - const Standard_Integer theMode = 0); + const Standard_Integer theMode = 0) override; /// Redefinition of virtual function - Standard_EXPORT virtual void - ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, - const Standard_Integer aMode); + Standard_EXPORT void ComputeSelection(const Handle(SelectMgr_Selection) & + aSelection, + const Standard_Integer aMode) override; /// Checks is the angle plane has inverted direction of normal to the plane of /// current sketcher Returns true if crossed product is negative. \return diff --git a/src/SketcherPrs/SketcherPrs_Coincident.cpp b/src/SketcherPrs/SketcherPrs_Coincident.cpp index fe42f132e..67140713a 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.cpp +++ b/src/SketcherPrs/SketcherPrs_Coincident.cpp @@ -63,7 +63,7 @@ std::shared_ptr getCoincidencePoint(ModelAPI_Feature *theConstraint) { std::shared_ptr aPnt = SketcherPrs_Tools::getPoint( theConstraint, SketchPlugin_Constraint::ENTITY_A()); - if (aPnt.get() == NULL) + if (aPnt.get() == nullptr) aPnt = SketcherPrs_Tools::getPoint(theConstraint, SketchPlugin_Constraint::ENTITY_B()); @@ -76,7 +76,7 @@ bool SketcherPrs_Coincident::readyToDisplay( bool aReadyToDisplay = false; // Get point of the presentation std::shared_ptr aPnt = getCoincidencePoint(theConstraint); - aReadyToDisplay = aPnt.get() != NULL; + aReadyToDisplay = aPnt.get() != nullptr; if (aReadyToDisplay) { std::shared_ptr aPoint = thePlane->to3D(aPnt->x(), aPnt->y()); thePoint = aPoint->impl(); diff --git a/src/SketcherPrs/SketcherPrs_Coincident.h b/src/SketcherPrs/SketcherPrs_Coincident.h index 46b03badd..4b788fbd3 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.h +++ b/src/SketcherPrs/SketcherPrs_Coincident.h @@ -52,15 +52,15 @@ public: DEFINE_STANDARD_RTTIEXT(SketcherPrs_Coincident, AIS_InteractiveObject) protected: /// Redefinition of virtual function - Standard_EXPORT virtual void + Standard_EXPORT void Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, const Handle(Prs3d_Presentation) & thePresentation, - const Standard_Integer theMode = 0); + const Standard_Integer theMode = 0) override; /// Redefinition of virtual function - Standard_EXPORT virtual void - ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, - const Standard_Integer aMode); + Standard_EXPORT void ComputeSelection(const Handle(SelectMgr_Selection) & + aSelection, + const Standard_Integer aMode) override; private: static bool readyToDisplay(ModelAPI_Feature *theConstraint, diff --git a/src/SketcherPrs/SketcherPrs_Collinear.cpp b/src/SketcherPrs/SketcherPrs_Collinear.cpp index e2c716d07..50996b4cf 100644 --- a/src/SketcherPrs/SketcherPrs_Collinear.cpp +++ b/src/SketcherPrs/SketcherPrs_Collinear.cpp @@ -44,8 +44,8 @@ bool SketcherPrs_Collinear::IsReadyToDisplay( ObjectPtr aObj2 = SketcherPrs_Tools::getResult( theConstraint, SketchPlugin_Constraint::ENTITY_B()); - aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL && - SketcherPrs_Tools::getShape(aObj2).get() != NULL; + aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != nullptr && + SketcherPrs_Tools::getShape(aObj2).get() != nullptr; } return aReadyToDisplay; } diff --git a/src/SketcherPrs/SketcherPrs_Collinear.h b/src/SketcherPrs/SketcherPrs_Collinear.h index a9d38da12..ae0d05c46 100644 --- a/src/SketcherPrs/SketcherPrs_Collinear.h +++ b/src/SketcherPrs/SketcherPrs_Collinear.h @@ -47,14 +47,14 @@ public: const std::shared_ptr &thePlane); protected: - virtual const char *iconName() const { return "collinear.png"; } + const char *iconName() const override { return "collinear.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, - Quantity_Color theColor) const; + void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const override; /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; + bool updateIfReadyToDisplay(double theStep, bool withColor) const override; }; #endif diff --git a/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp b/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp index 2a55ff687..9995aff1e 100644 --- a/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp +++ b/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp @@ -53,9 +53,9 @@ void SketcherPrs_DimensionStyle::DimensionValue::init( myTextValue = Locale::Convert::toString(theAttributeValue->text()); } -SketcherPrs_DimensionStyle::SketcherPrs_DimensionStyle() {} +SketcherPrs_DimensionStyle::SketcherPrs_DimensionStyle() = default; -SketcherPrs_DimensionStyle::~SketcherPrs_DimensionStyle() {} +SketcherPrs_DimensionStyle::~SketcherPrs_DimensionStyle() = default; void SketcherPrs_DimensionStyle::updateDimensions( PrsDim_Dimension *theDimension, diff --git a/src/SketcherPrs/SketcherPrs_Equal.cpp b/src/SketcherPrs/SketcherPrs_Equal.cpp index fd7684328..e0aa578bd 100644 --- a/src/SketcherPrs/SketcherPrs_Equal.cpp +++ b/src/SketcherPrs/SketcherPrs_Equal.cpp @@ -45,8 +45,8 @@ bool SketcherPrs_Equal::IsReadyToDisplay( ObjectPtr aObj2 = SketcherPrs_Tools::getResult( theConstraint, SketchPlugin_Constraint::ENTITY_B()); - aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL && - SketcherPrs_Tools::getShape(aObj2).get() != NULL; + aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != nullptr && + SketcherPrs_Tools::getShape(aObj2).get() != nullptr; return aReadyToDisplay; } @@ -80,7 +80,7 @@ void SketcherPrs_Equal::drawLines(const Handle(Prs3d_Presentation) & thePrs, ObjectPtr aObj = SketcherPrs_Tools::getResult( myConstraint, SketchPlugin_Constraint::ENTITY_A()); std::shared_ptr aLine = SketcherPrs_Tools::getShape(aObj); - if (aLine.get() == NULL) + if (aLine.get() == nullptr) return; drawShape(aLine, thePrs, theColor); @@ -88,7 +88,7 @@ void SketcherPrs_Equal::drawLines(const Handle(Prs3d_Presentation) & thePrs, aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B()); aLine = SketcherPrs_Tools::getShape(aObj); - if (aLine.get() == NULL) + if (aLine.get() == nullptr) return; drawShape(aLine, thePrs, theColor); } diff --git a/src/SketcherPrs/SketcherPrs_Equal.h b/src/SketcherPrs/SketcherPrs_Equal.h index a7379ba44..aa7f2f7c9 100644 --- a/src/SketcherPrs/SketcherPrs_Equal.h +++ b/src/SketcherPrs/SketcherPrs_Equal.h @@ -46,14 +46,14 @@ public: const std::shared_ptr &thePlane); protected: - virtual const char *iconName() const { return "equal.png"; } + const char *iconName() const override { return "equal.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, - Quantity_Color theColor) const; + void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const override; /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; + bool updateIfReadyToDisplay(double theStep, bool withColor) const override; }; #endif diff --git a/src/SketcherPrs/SketcherPrs_HVDirection.cpp b/src/SketcherPrs/SketcherPrs_HVDirection.cpp index 35c86d336..c4873581a 100644 --- a/src/SketcherPrs/SketcherPrs_HVDirection.cpp +++ b/src/SketcherPrs/SketcherPrs_HVDirection.cpp @@ -43,7 +43,7 @@ bool SketcherPrs_HVDirection::IsReadyToDisplay( if (thePlane.get()) { ObjectPtr aObj = SketcherPrs_Tools::getResult( theConstraint, SketchPlugin_Constraint::ENTITY_A()); - aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != NULL; + aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != nullptr; } return aReadyToDisplay; } diff --git a/src/SketcherPrs/SketcherPrs_HVDirection.h b/src/SketcherPrs/SketcherPrs_HVDirection.h index 963c0e99a..591c6e155 100644 --- a/src/SketcherPrs/SketcherPrs_HVDirection.h +++ b/src/SketcherPrs/SketcherPrs_HVDirection.h @@ -50,19 +50,19 @@ public: const std::shared_ptr &thePlane); protected: - virtual const char *iconName() const { + const char *iconName() const override { return myIsHorisontal ? "horisontal.png" : "vertical.png"; } /// Redefine this function in order to add additiona lines of constraint base /// \param thePrs a presentation /// \param theColor a color of additiona lines - virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, - Quantity_Color theColor) const; + void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const override; /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; + bool updateIfReadyToDisplay(double theStep, bool withColor) const override; private: bool myIsHorisontal; diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.h b/src/SketcherPrs/SketcherPrs_LengthDimension.h index a76055d59..98093af55 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.h +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.h @@ -50,7 +50,7 @@ public: SketchPlugin_Sketch *theSketcher); /// Destructor - Standard_EXPORT ~SketcherPrs_LengthDimension(); + Standard_EXPORT ~SketcherPrs_LengthDimension() override; DEFINE_STANDARD_RTTIEXT(SketcherPrs_LengthDimension, PrsDim_LengthDimension) @@ -69,15 +69,15 @@ public: protected: /// Redefinition of virtual function - Standard_EXPORT virtual void + Standard_EXPORT void Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, const Handle(Prs3d_Presentation) & thePresentation, - const Standard_Integer theMode = 0); + const Standard_Integer theMode = 0) override; /// Redefinition of virtual function - Standard_EXPORT virtual void - ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, - const Standard_Integer aMode); + Standard_EXPORT void ComputeSelection(const Handle(SelectMgr_Selection) & + aSelection, + const Standard_Integer aMode) override; private: static bool readyToDisplay(ModelAPI_Feature *theConstraint, diff --git a/src/SketcherPrs/SketcherPrs_Middle.cpp b/src/SketcherPrs/SketcherPrs_Middle.cpp index f8fde54ec..83476c7f3 100644 --- a/src/SketcherPrs/SketcherPrs_Middle.cpp +++ b/src/SketcherPrs/SketcherPrs_Middle.cpp @@ -47,8 +47,8 @@ bool SketcherPrs_Middle::IsReadyToDisplay( // one object is a feature Line, other object is a point result. We check // shape of point result aReadyToDisplay = aObj1.get() && aObj2.get() && - (SketcherPrs_Tools::getShape(aObj1).get() != NULL || - SketcherPrs_Tools::getShape(aObj2).get() != NULL); + (SketcherPrs_Tools::getShape(aObj1).get() != nullptr || + SketcherPrs_Tools::getShape(aObj2).get() != nullptr); } return aReadyToDisplay; } @@ -117,13 +117,13 @@ void SketcherPrs_Middle::drawLine(const Handle(Prs3d_Presentation) & thePrs, ResultPtr aResult = aResults.front(); std::shared_ptr aLine = SketcherPrs_Tools::getShape(aResult); - if (aLine.get() != NULL) + if (aLine.get() != nullptr) drawShape(aLine, thePrs, theColor); } } else { std::shared_ptr aLine = SketcherPrs_Tools::getShape(theObject); - if (aLine.get() != NULL) + if (aLine.get() != nullptr) drawShape(aLine, thePrs, theColor); } } diff --git a/src/SketcherPrs/SketcherPrs_Middle.h b/src/SketcherPrs/SketcherPrs_Middle.h index 8561603f5..82af0e8b8 100644 --- a/src/SketcherPrs/SketcherPrs_Middle.h +++ b/src/SketcherPrs/SketcherPrs_Middle.h @@ -46,14 +46,14 @@ public: const std::shared_ptr &thePlane); protected: - virtual const char *iconName() const { return "middlepoint.png"; } + const char *iconName() const override { return "middlepoint.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, - Quantity_Color theColor) const; + void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const override; /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; + bool updateIfReadyToDisplay(double theStep, bool withColor) const override; /// Draw shape of the object. Find shape result if the object is feature void drawLine(const Handle(Prs3d_Presentation) & thePrs, diff --git a/src/SketcherPrs/SketcherPrs_Mirror.cpp b/src/SketcherPrs/SketcherPrs_Mirror.cpp index 7570952da..39feafcc3 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.cpp +++ b/src/SketcherPrs/SketcherPrs_Mirror.cpp @@ -45,19 +45,19 @@ bool SketcherPrs_Mirror::IsReadyToDisplay( // Get axis of mirror ObjectPtr aAxisObj = SketcherPrs_Tools::getResult( theConstraint, SketchPlugin_Constraint::ENTITY_A()); - if (SketcherPrs_Tools::getShape(aAxisObj).get() == NULL) + if (SketcherPrs_Tools::getShape(aAxisObj).get() == nullptr) return aReadyToDisplay; std::shared_ptr aData = theConstraint->data(); // Get source objects std::shared_ptr anAttrB = aData->reflist(SketchPlugin_Constraint::ENTITY_B()); - if (anAttrB.get() == NULL) + if (anAttrB.get() == nullptr) return aReadyToDisplay; // Get mirrored objects std::shared_ptr anAttrC = aData->reflist(SketchPlugin_Constraint::ENTITY_C()); - if (anAttrC.get() == NULL) + if (anAttrC.get() == nullptr) return aReadyToDisplay; int aNb = anAttrB->size(); @@ -97,7 +97,7 @@ bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep, // get position for each source object for (i = 0; i < aNb; i++) { aObj = anAttrB->object(i); - if (SketcherPrs_Tools::getShape(aObj).get() == NULL) + if (SketcherPrs_Tools::getShape(aObj).get() == nullptr) continue; aP1 = aMgr->getPosition(aObj, this, theStep); myPntArray->SetVertice(i + 1, aP1); @@ -105,7 +105,7 @@ bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep, // Get position of each mirrored object for (i = 0; i < aNb; i++) { aObj = anAttrC->object(i); - if (SketcherPrs_Tools::getShape(aObj).get() == NULL) + if (SketcherPrs_Tools::getShape(aObj).get() == nullptr) continue; aP1 = aMgr->getPosition(aObj, this, theStep); myPntArray->SetVertice(aNb + i + 1, aP1); @@ -118,11 +118,11 @@ void SketcherPrs_Mirror::drawLines(const Handle(Prs3d_Presentation) & thePrs, std::shared_ptr aData = myConstraint->data(); std::shared_ptr anAttrB = aData->reflist(SketchPlugin_Constraint::ENTITY_B()); - if (anAttrB.get() == NULL) + if (anAttrB.get() == nullptr) return; std::shared_ptr anAttrC = aData->reflist(SketchPlugin_Constraint::ENTITY_C()); - if (anAttrC.get() == NULL) + if (anAttrC.get() == nullptr) return; int aNb = anAttrB->size(); diff --git a/src/SketcherPrs/SketcherPrs_Mirror.h b/src/SketcherPrs/SketcherPrs_Mirror.h index fd49138e0..a5b86a5c4 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.h +++ b/src/SketcherPrs/SketcherPrs_Mirror.h @@ -46,14 +46,14 @@ public: const std::shared_ptr &thePlane); protected: - virtual const char *iconName() const { return "mirror.png"; } + const char *iconName() const override { return "mirror.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, - Quantity_Color theColor) const; + void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const override; /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; + bool updateIfReadyToDisplay(double theStep, bool withColor) const override; }; #endif diff --git a/src/SketcherPrs/SketcherPrs_Offset.cpp b/src/SketcherPrs/SketcherPrs_Offset.cpp index 12d2af2ab..ee26c5ef3 100644 --- a/src/SketcherPrs/SketcherPrs_Offset.cpp +++ b/src/SketcherPrs/SketcherPrs_Offset.cpp @@ -83,14 +83,14 @@ bool SketcherPrs_Offset::updateIfReadyToDisplay(double theStep, // get position for each source object for (i = 0; i < aNb; i++) { aObj = aSelectedEdges->object(i); - if (SketcherPrs_Tools::getShape(aObj).get() == NULL) + if (SketcherPrs_Tools::getShape(aObj).get() == nullptr) continue; aP1 = aMgr->getPosition(aObj, this, theStep); myPntArray->SetVertice(i + 1, aP1); } for (i = aNb; i < aNb + aOffNb; i++) { aObj = aOffcetEdges->object(i - aNb); - if (SketcherPrs_Tools::getShape(aObj).get() == NULL) + if (SketcherPrs_Tools::getShape(aObj).get() == nullptr) continue; aP1 = aMgr->getPosition(aObj, this, theStep); myPntArray->SetVertice(i + 1, aP1); @@ -102,11 +102,11 @@ void SketcherPrs_Offset::drawLines(const Handle(Prs3d_Presentation) & thePrs, Quantity_Color theColor) const { AttributeRefListPtr aSelectedEdges = myConstraint->reflist(SketchPlugin_Offset::ENTITY_A()); - if (aSelectedEdges.get() == NULL) + if (aSelectedEdges.get() == nullptr) return; AttributeRefListPtr aOffcetEdges = myConstraint->reflist(SketchPlugin_Offset::ENTITY_B()); - if (aOffcetEdges.get() == NULL) + if (aOffcetEdges.get() == nullptr) return; if (aSelectedEdges->size() == 0) diff --git a/src/SketcherPrs/SketcherPrs_Offset.h b/src/SketcherPrs/SketcherPrs_Offset.h index bfdd0899d..64370e8b1 100644 --- a/src/SketcherPrs/SketcherPrs_Offset.h +++ b/src/SketcherPrs/SketcherPrs_Offset.h @@ -48,14 +48,14 @@ public: const std::shared_ptr &thePlane); protected: - virtual const char *iconName() const { return "offset.png"; } + const char *iconName() const override { return "offset.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, - Quantity_Color theColor) const; + void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const override; /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; + bool updateIfReadyToDisplay(double theStep, bool withColor) const override; }; #endif diff --git a/src/SketcherPrs/SketcherPrs_Parallel.cpp b/src/SketcherPrs/SketcherPrs_Parallel.cpp index d0338dda9..595358792 100644 --- a/src/SketcherPrs/SketcherPrs_Parallel.cpp +++ b/src/SketcherPrs/SketcherPrs_Parallel.cpp @@ -44,8 +44,8 @@ bool SketcherPrs_Parallel::IsReadyToDisplay( ObjectPtr aObj2 = SketcherPrs_Tools::getResult( theConstraint, SketchPlugin_Constraint::ENTITY_B()); - aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL && - SketcherPrs_Tools::getShape(aObj2).get() != NULL; + aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != nullptr && + SketcherPrs_Tools::getShape(aObj2).get() != nullptr; } return aReadyToDisplay; } diff --git a/src/SketcherPrs/SketcherPrs_Parallel.h b/src/SketcherPrs/SketcherPrs_Parallel.h index 09830236f..6c5afb43a 100644 --- a/src/SketcherPrs/SketcherPrs_Parallel.h +++ b/src/SketcherPrs/SketcherPrs_Parallel.h @@ -46,14 +46,14 @@ public: const std::shared_ptr &thePlane); protected: - virtual const char *iconName() const { return "parallel.png"; } + const char *iconName() const override { return "parallel.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, - Quantity_Color theColor) const; + void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const override; /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; + bool updateIfReadyToDisplay(double theStep, bool withColor) const override; }; #endif diff --git a/src/SketcherPrs/SketcherPrs_Perpendicular.cpp b/src/SketcherPrs/SketcherPrs_Perpendicular.cpp index 18490fa74..938070470 100644 --- a/src/SketcherPrs/SketcherPrs_Perpendicular.cpp +++ b/src/SketcherPrs/SketcherPrs_Perpendicular.cpp @@ -50,8 +50,8 @@ bool SketcherPrs_Perpendicular::IsReadyToDisplay( ObjectPtr aObj2 = SketcherPrs_Tools::getResult( theConstraint, SketchPlugin_Constraint::ENTITY_B()); - aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL && - SketcherPrs_Tools::getShape(aObj2).get() != NULL; + aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != nullptr && + SketcherPrs_Tools::getShape(aObj2).get() != nullptr; } return aReadyToDisplay; } diff --git a/src/SketcherPrs/SketcherPrs_Perpendicular.h b/src/SketcherPrs/SketcherPrs_Perpendicular.h index 5042cafa7..02da48d1c 100644 --- a/src/SketcherPrs/SketcherPrs_Perpendicular.h +++ b/src/SketcherPrs/SketcherPrs_Perpendicular.h @@ -49,17 +49,17 @@ public: const std::shared_ptr &thePlane); protected: - virtual const char *iconName() const { return "perpendicular.png"; } + const char *iconName() const override { return "perpendicular.png"; } /// Redefine this function in order to add additiona lines of constraint base /// \param thePrs a presentation /// \param theColor a color of additiona lines - virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, - Quantity_Color theColor) const; + void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const override; /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; + bool updateIfReadyToDisplay(double theStep, bool withColor) const override; }; #endif diff --git a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp index a4e0dcfc4..32be0dd07 100644 --- a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp +++ b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp @@ -47,18 +47,18 @@ #include -static SketcherPrs_PositionMgr *MyPosMgr = NULL; +static SketcherPrs_PositionMgr *MyPosMgr = nullptr; #define PI 3.1415926535897932 // The class is implemented as a singlton SketcherPrs_PositionMgr *SketcherPrs_PositionMgr::get() { - if (MyPosMgr == NULL) + if (MyPosMgr == nullptr) MyPosMgr = new SketcherPrs_PositionMgr(); return MyPosMgr; } -SketcherPrs_PositionMgr::SketcherPrs_PositionMgr() {} +SketcherPrs_PositionMgr::SketcherPrs_PositionMgr() = default; int SketcherPrs_PositionMgr::getPositionIndex( ObjectPtr theLine, const SketcherPrs_SymbolPrs *thePrs) { @@ -371,7 +371,7 @@ std::list getCurves(const GeomPointPtr &thePnt, //***************************************************************** gp_Pnt -SketcherPrs_PositionMgr::getPointPosition(ObjectPtr theLine, +SketcherPrs_PositionMgr::getPointPosition(ObjectPtr /*theLine*/, const SketcherPrs_SymbolPrs *thePrs, double theStep, GeomPointPtr thePnt) { gp_Pnt aP = thePnt->impl(); diff --git a/src/SketcherPrs/SketcherPrs_PositionMgr.h b/src/SketcherPrs/SketcherPrs_PositionMgr.h index d6f3490be..73b6616b7 100644 --- a/src/SketcherPrs/SketcherPrs_PositionMgr.h +++ b/src/SketcherPrs/SketcherPrs_PositionMgr.h @@ -88,8 +88,8 @@ private: static bool isPntConstraint(const std::string &theName); private: - typedef std::map PositionsMap; - typedef std::map> FeaturesMap; + using PositionsMap = std::map; + using FeaturesMap = std::map>; /// The map contains position index std::map myShapes; diff --git a/src/SketcherPrs/SketcherPrs_Rigid.cpp b/src/SketcherPrs/SketcherPrs_Rigid.cpp index 2c89b5755..f9785a8d3 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.cpp +++ b/src/SketcherPrs/SketcherPrs_Rigid.cpp @@ -64,13 +64,13 @@ bool SketcherPrs_Rigid::IsReadyToDisplay( if (anAttr->isObject()) { // The constraint attached to an object ObjectPtr aObj = anAttr->object(); - aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != NULL; + aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != nullptr; } else { // The constraint attached to a point std::shared_ptr aPnt = SketcherPrs_Tools::getPoint( theConstraint, SketchPlugin_Constraint::ENTITY_A()); - aReadyToDisplay = aPnt.get() != NULL; + aReadyToDisplay = aPnt.get() != nullptr; } return aReadyToDisplay; } @@ -123,7 +123,7 @@ void SketcherPrs_Rigid::drawLines(const Handle(Prs3d_Presentation) & thePrs, // Else it is a result aShape = SketcherPrs_Tools::getShape(aObj); } - if (aShape.get() == NULL) + if (aShape.get() == nullptr) return; Handle(Prs3d_PointAspect) aPntAspect = diff --git a/src/SketcherPrs/SketcherPrs_Rigid.h b/src/SketcherPrs/SketcherPrs_Rigid.h index 39197111a..5810427ec 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.h +++ b/src/SketcherPrs/SketcherPrs_Rigid.h @@ -49,17 +49,17 @@ public: const std::shared_ptr &thePlane); protected: - virtual const char *iconName() const { return "anchor.png"; } + const char *iconName() const override { return "anchor.png"; } /// Redefine this function in order to add additiona lines of constraint base /// \param thePrs a presentation /// \param theColor a color of additiona lines - virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, - Quantity_Color theColor) const; + void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const override; /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; + bool updateIfReadyToDisplay(double theStep, bool withColor) const override; }; #endif diff --git a/src/SketcherPrs/SketcherPrs_SensitivePoint.h b/src/SketcherPrs/SketcherPrs_SensitivePoint.h index 3b67a88ef..120b427d8 100644 --- a/src/SketcherPrs/SketcherPrs_SensitivePoint.h +++ b/src/SketcherPrs/SketcherPrs_SensitivePoint.h @@ -45,19 +45,18 @@ public: /// Returns number of sub-elements #if OCC_VERSION_HEX > 0x070400 - Standard_EXPORT virtual Standard_Integer - NbSubElements() const Standard_OVERRIDE; + Standard_EXPORT Standard_Integer NbSubElements() const Standard_OVERRIDE; #else Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE; #endif //! Update location of the point - Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) + Standard_EXPORT Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE; //! Checks whether the point overlaps current selecting volume //! \param theMgr selection manager //! \param thePickResult returns pick result - Standard_EXPORT virtual Standard_Boolean + Standard_EXPORT Standard_Boolean Matches(SelectBasics_SelectingVolumeManager &theMgr, SelectBasics_PickResult &thePickResult) Standard_OVERRIDE; @@ -66,14 +65,14 @@ public: //! Returns center of point. If location transformation //! is set, it will be applied - Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE; + Standard_EXPORT gp_Pnt CenterOfGeometry() const Standard_OVERRIDE; //! Returns bounding box of the point. If location //! transformation is set, it will be applied - Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE; + Standard_EXPORT Select3D_BndBox3d BoundingBox() Standard_OVERRIDE; /// Clear sub-elements - Standard_EXPORT virtual void Clear() Standard_OVERRIDE; + Standard_EXPORT void Clear() Standard_OVERRIDE; DEFINE_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity) diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index 07d957522..97976e60f 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -74,7 +74,7 @@ public: theObj->myPntArray->Bounds()), myObj(theObj), myContext(theCtx) {} - virtual void Render(const Handle(OpenGl_Workspace) & theWorkspace) const { + void Render(const Handle(OpenGl_Workspace) & theWorkspace) const override { ModelAPI_Feature *aConstraint = myObj->feature(); if (aConstraint->data().get() && aConstraint->data()->isValid()) { Handle(OpenGl_View) aView = theWorkspace->View(); @@ -217,7 +217,7 @@ void SketcherPrs_SymbolPrs::addLine(const Handle(Graphic3d_Group) & theGroup, std::string theAttrName) const { ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, theAttrName); std::shared_ptr aLine = SketcherPrs_Tools::getShape(aObj); - if (aLine.get() == NULL) + if (aLine.get() == nullptr) return; std::shared_ptr aEdge = std::shared_ptr(new GeomAPI_Edge(aLine)); @@ -314,7 +314,7 @@ void SketcherPrs_SymbolPrs::Compute( } // Pint the group with custom procedure (see Render) - SketcherPrs_SymbolArray *aElem = new SketcherPrs_SymbolArray( + auto *aElem = new SketcherPrs_SymbolArray( (OpenGl_GraphicDriver *)aDriver->This(), this, GetContext()); aGroup->AddElement(aElem); @@ -415,7 +415,7 @@ void SketcherPrs_SymbolPrs::drawListOfShapes( for (i = 0; i < aNb; i++) { aObj = theListAttr->object(i); std::shared_ptr aShape = SketcherPrs_Tools::getShape(aObj); - if (aShape.get() != NULL) + if (aShape.get() != nullptr) drawShape(aShape, thePrs, theColor); } } diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.h b/src/SketcherPrs/SketcherPrs_SymbolPrs.h index 3321e81e1..7f1253732 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.h +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.h @@ -56,18 +56,18 @@ public: Standard_EXPORT SketcherPrs_SymbolPrs(ModelAPI_Feature *theConstraint, SketchPlugin_Sketch *theSketcher); - virtual ~SketcherPrs_SymbolPrs(); + ~SketcherPrs_SymbolPrs() override; //! Method which draws selected owners ( for fast presentation draw ) - Standard_EXPORT virtual void + Standard_EXPORT void HilightSelected(const Handle(PrsMgr_PresentationManager3d) & thePM, - const SelectMgr_SequenceOfOwner &theOwners); + const SelectMgr_SequenceOfOwner &theOwners) override; //! Method which hilight an owner belonging to - Standard_EXPORT virtual void - HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d) & thePM, - const Handle(Prs3d_Drawer) & theStyle, - const Handle(SelectMgr_EntityOwner) & theOwner); + Standard_EXPORT void HilightOwnerWithColor( + const Handle(PrsMgr_PresentationManager3d) & thePM, + const Handle(Prs3d_Drawer) & theStyle, + const Handle(SelectMgr_EntityOwner) & theOwner) override; /// Returns sketcher plane Standard_EXPORT std::shared_ptr plane() const { @@ -95,24 +95,23 @@ public: /// Add a bounding box of the presentation to common bounding box /// \param theBndBox the common bounding box to update - Standard_EXPORT virtual void - BoundingBox(Bnd_Box &theBndBox) Standard_OVERRIDE; + Standard_EXPORT void BoundingBox(Bnd_Box &theBndBox) Standard_OVERRIDE; DEFINE_STANDARD_RTTIEXT(SketcherPrs_SymbolPrs, AIS_InteractiveObject) protected: /// Redefinition of virtual function - Standard_EXPORT virtual void + Standard_EXPORT void Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager, const Handle(Prs3d_Presentation) & thePresentation, - const Standard_Integer theMode = 0); + const Standard_Integer theMode = 0) override; /// Redefinition of virtual function /// \param aSelection selection /// \param aMode compute mode - Standard_EXPORT virtual void - ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, - const Standard_Integer aMode); + Standard_EXPORT void ComputeSelection(const Handle(SelectMgr_Selection) & + aSelection, + const Standard_Integer aMode) override; /// Returns an icon file name. Has to be redefined in successors virtual const char *iconName() const = 0; diff --git a/src/SketcherPrs/SketcherPrs_Tangent.cpp b/src/SketcherPrs/SketcherPrs_Tangent.cpp index dfdd13594..9b255e718 100644 --- a/src/SketcherPrs/SketcherPrs_Tangent.cpp +++ b/src/SketcherPrs/SketcherPrs_Tangent.cpp @@ -52,8 +52,8 @@ bool SketcherPrs_Tangent::IsReadyToDisplay( ObjectPtr aObj2 = SketcherPrs_Tools::getResult( theConstraint, SketchPlugin_Constraint::ENTITY_B()); - aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL && - SketcherPrs_Tools::getShape(aObj2).get() != NULL; + aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != nullptr && + SketcherPrs_Tools::getShape(aObj2).get() != nullptr; return aReadyToDisplay; } @@ -110,7 +110,7 @@ void SketcherPrs_Tangent::drawLines(const Handle(Prs3d_Presentation) & thePrs, std::shared_ptr aShape1 = SketcherPrs_Tools::getShape(aObj1); std::shared_ptr aShape2 = SketcherPrs_Tools::getShape(aObj2); - if ((aShape1.get() == NULL) || (aShape2.get() == NULL)) + if ((aShape1.get() == nullptr) || (aShape2.get() == nullptr)) return; drawShape(aShape1, thePrs, theColor); drawShape(aShape2, thePrs, theColor); diff --git a/src/SketcherPrs/SketcherPrs_Tangent.h b/src/SketcherPrs/SketcherPrs_Tangent.h index 10e867cb0..38f145378 100644 --- a/src/SketcherPrs/SketcherPrs_Tangent.h +++ b/src/SketcherPrs/SketcherPrs_Tangent.h @@ -48,14 +48,14 @@ public: const std::shared_ptr &thePlane); protected: - virtual const char *iconName() const { return "tangent.png"; } + const char *iconName() const override { return "tangent.png"; } - virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, - Quantity_Color theColor) const; + void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const override; /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; + bool updateIfReadyToDisplay(double theStep, bool withColor) const override; }; #endif diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index 6594f634c..d944f57d0 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.cpp +++ b/src/SketcherPrs/SketcherPrs_Tools.cpp @@ -100,7 +100,7 @@ std::shared_ptr getShape(ObjectPtr theObject) { aRes = std::dynamic_pointer_cast( aFeature->lastResult()); } - if (aRes.get() != NULL && aRes->data()->isValid()) { + if (aRes.get() != nullptr && aRes->data()->isValid()) { /// essential check as it is called in openGl thread return aRes->shape(); } @@ -117,7 +117,7 @@ std::shared_ptr getPoint(ModelAPI_Feature *theFeature, theFeature, theAttribute, SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID()); } - if (aPointAttr.get() != NULL) + if (aPointAttr.get() != nullptr) return aPointAttr->pnt(); return std::shared_ptr(); } @@ -221,9 +221,8 @@ std::list getFreePoints(const CompositeFeaturePtr &theSketch) { if (!aFeatures) return aFreePoints; std::list anObjects = aFeatures->list(); - for (std::list::iterator anObjIt = anObjects.begin(); - anObjIt != anObjects.end(); ++anObjIt) { - FeaturePtr aCurrent = ModelAPI_Feature::feature(*anObjIt); + for (auto &anObject : anObjects) { + FeaturePtr aCurrent = ModelAPI_Feature::feature(anObject); if (aCurrent && aCurrent->getKind() == SketchPlugin_Point::ID()) { // check point is not referred by any constraints: the feature and result // of point @@ -238,7 +237,7 @@ std::list getFreePoints(const CompositeFeaturePtr &theSketch) { break; } const std::set &aRefs = aReferenced->data()->refsToMe(); - std::set::iterator aRIt = aRefs.begin(); + auto aRIt = aRefs.begin(); for (; aRIt != aRefs.end(); ++aRIt) { FeaturePtr aRefFeat = ModelAPI_Feature::feature((*aRIt)->owner()); std::shared_ptr aRefConstr = @@ -338,7 +337,7 @@ double getFlyoutDistance(const ModelAPI_Feature *theConstraint) { std::shared_ptr getAnchorPoint(const ModelAPI_Feature *theConstraint, const std::shared_ptr &thePlane) { - ModelAPI_Feature *aConstraint = const_cast(theConstraint); + auto *aConstraint = const_cast(theConstraint); AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast( aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A())); @@ -375,7 +374,7 @@ getAnchorPoint(const ModelAPI_Feature *theConstraint, } void sendEmptyPresentationError(ModelAPI_Feature *theFeature, - const std::string theError) { + const std::string /*theError*/) { Events_InfoMessage("SketcherPrs_Tools", "An empty AIS presentation: SketcherPrs_LengthDimension") .send(); diff --git a/src/SketcherPrs/SketcherPrs_Transformation.cpp b/src/SketcherPrs/SketcherPrs_Transformation.cpp index 4d96368fd..5ca4d6c45 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.cpp +++ b/src/SketcherPrs/SketcherPrs_Transformation.cpp @@ -56,7 +56,7 @@ bool SketcherPrs_Transformation::IsReadyToDisplay( // Get transformated objects list std::shared_ptr anAttrB = aData->reflist(SketchPlugin_Constraint::ENTITY_B()); - if (anAttrB.get() == NULL) + if (anAttrB.get() == nullptr) return aReadyToDisplay; int aNbB = anAttrB->size(); @@ -110,7 +110,7 @@ bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep, // Compute points of symbols for (i = 0; i < aNbB; i++) { aObj = anAttrB->object(i); - if (SketcherPrs_Tools::getShape(aObj).get() == NULL) + if (SketcherPrs_Tools::getShape(aObj).get() == nullptr) continue; aP1 = aMgr->getPosition(aObj, this, theStep); myPntArray->SetVertice(i + 1, aP1); @@ -125,7 +125,7 @@ void SketcherPrs_Transformation::drawLines(const Handle(Prs3d_Presentation) & std::shared_ptr aData = myConstraint->data(); std::shared_ptr anAttrB = aData->reflist(SketchPlugin_Constraint::ENTITY_B()); - if (anAttrB.get() == NULL) + if (anAttrB.get() == nullptr) return; // drawListOfShapes uses myDrawer for attributes definition diff --git a/src/SketcherPrs/SketcherPrs_Transformation.h b/src/SketcherPrs/SketcherPrs_Transformation.h index fd736308e..e0bf4d626 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.h +++ b/src/SketcherPrs/SketcherPrs_Transformation.h @@ -50,19 +50,19 @@ public: const std::shared_ptr &thePlane); protected: - virtual const char *iconName() const { + const char *iconName() const override { return myIsTranslation ? "translate.png" : "rotate.png"; } /// Redefine this function in order to add additiona lines of constraint base /// \param thePrs a presentation /// \param theColor a color of additiona lines - virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs, - Quantity_Color theColor) const; + void drawLines(const Handle(Prs3d_Presentation) & thePrs, + Quantity_Color theColor) const override; /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; + bool updateIfReadyToDisplay(double theStep, bool withColor) const override; private: bool myIsTranslation; diff --git a/src/XAO/XAO_BooleanField.cxx b/src/XAO/XAO_BooleanField.cxx index 61d635397..221b37536 100644 --- a/src/XAO/XAO_BooleanField.cxx +++ b/src/XAO/XAO_BooleanField.cxx @@ -38,8 +38,7 @@ BooleanStep *BooleanField::addStep(int step, int stamp) { throw XAO_Exception(MsgBuilder() << "Step with number " << step << " already exists."); - BooleanStep *bstep = - new BooleanStep(step, stamp, m_nbElements, m_nbComponents); + auto *bstep = new BooleanStep(step, stamp, m_nbElements, m_nbComponents); m_steps.push_back(bstep); return bstep; } diff --git a/src/XAO/XAO_BooleanField.hxx b/src/XAO/XAO_BooleanField.hxx index 778dcee8c..f54d31464 100644 --- a/src/XAO/XAO_BooleanField.hxx +++ b/src/XAO/XAO_BooleanField.hxx @@ -50,9 +50,9 @@ public: BooleanField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string &name); - virtual XAO::Type getType() { return XAO::BOOLEAN; } + XAO::Type getType() override { return XAO::BOOLEAN; } - virtual Step *addNewStep(int step); + Step *addNewStep(int step) override; /** * Adds a new step. diff --git a/src/XAO/XAO_BooleanStep.hxx b/src/XAO/XAO_BooleanStep.hxx index aa551388c..4402a1d5c 100644 --- a/src/XAO/XAO_BooleanStep.hxx +++ b/src/XAO/XAO_BooleanStep.hxx @@ -49,7 +49,7 @@ public: */ BooleanStep(int step, int stamp, int nbElements, int nbComponents); - virtual XAO::Type getType() { return XAO::BOOLEAN; } + XAO::Type getType() override { return XAO::BOOLEAN; } /** * Gets all the values in a vector by elements and by components. @@ -107,9 +107,9 @@ public: */ void setValue(int element, int component, bool value); - virtual const std::string getStringValue(int element, int component); - virtual void setStringValue(int element, int component, - const std::string &value); + const std::string getStringValue(int element, int component) override; + void setStringValue(int element, int component, + const std::string &value) override; private: std::vector> m_values; diff --git a/src/XAO/XAO_BrepGeometry.hxx b/src/XAO/XAO_BrepGeometry.hxx index 398e68785..e9605f0e0 100644 --- a/src/XAO/XAO_BrepGeometry.hxx +++ b/src/XAO/XAO_BrepGeometry.hxx @@ -53,37 +53,37 @@ public: */ BrepGeometry(const std::string &name); - virtual ~BrepGeometry() {} + ~BrepGeometry() override = default; /** * Gets the format of the geometry. * @return the format of the geometry. */ - virtual XAO::Format getFormat() { return XAO::BREP; } + XAO::Format getFormat() override { return XAO::BREP; } /** * Gets the shape as a string. * @return the shape as a string. */ - virtual const std::string getShapeString(); + const std::string getShapeString() override; /** * Sets the shape from a string. * @param shape the shape as a string. */ - virtual void setShapeString(const std::string &shape); + void setShapeString(const std::string &shape) override; /** * Writes shape to a file * @param fileName the path to the file */ - virtual void writeShapeFile(const std::string &fileName); + void writeShapeFile(const std::string &fileName) override; /** * Reads shape from a file * @param fileName the path to the file */ - virtual void readShapeFile(const std::string &fileName); + void readShapeFile(const std::string &fileName) override; #ifdef SWIG %pythoncode %{ diff --git a/src/XAO/XAO_DoubleField.cxx b/src/XAO/XAO_DoubleField.cxx index a649b31f0..e5c21f96b 100644 --- a/src/XAO/XAO_DoubleField.cxx +++ b/src/XAO/XAO_DoubleField.cxx @@ -48,7 +48,7 @@ DoubleStep *DoubleField::addStep(int step, int stamp) throw XAO_Exception(MsgBuilder() << "Step with number " << step << " already exists."); - DoubleStep *bstep = new DoubleStep(step, stamp, m_nbElements, m_nbComponents); + auto *bstep = new DoubleStep(step, stamp, m_nbElements, m_nbComponents); m_steps.push_back(bstep); return bstep; } diff --git a/src/XAO/XAO_DoubleField.hxx b/src/XAO/XAO_DoubleField.hxx index 689f8cfd0..44099829d 100644 --- a/src/XAO/XAO_DoubleField.hxx +++ b/src/XAO/XAO_DoubleField.hxx @@ -50,9 +50,9 @@ public: DoubleField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string &name); - virtual XAO::Type getType() { return XAO::DOUBLE; } + XAO::Type getType() override { return XAO::DOUBLE; } - virtual Step *addNewStep(int step); + Step *addNewStep(int step) override; /** * Adds a new step. diff --git a/src/XAO/XAO_DoubleStep.hxx b/src/XAO/XAO_DoubleStep.hxx index 62153e3b6..0dae1f1f1 100644 --- a/src/XAO/XAO_DoubleStep.hxx +++ b/src/XAO/XAO_DoubleStep.hxx @@ -48,7 +48,7 @@ public: */ DoubleStep(int step, int stamp, int nbElements, int nbComponents); - virtual XAO::Type getType() { return XAO::DOUBLE; } + XAO::Type getType() override { return XAO::DOUBLE; } /** * Gets all the values of the step as a list. @@ -106,9 +106,9 @@ public: */ void setValue(int element, int component, double value); - virtual const std::string getStringValue(int element, int component); - virtual void setStringValue(int element, int component, - const std::string &value); + const std::string getStringValue(int element, int component) override; + void setStringValue(int element, int component, + const std::string &value) override; private: std::vector> m_values; diff --git a/src/XAO/XAO_Exception.hxx b/src/XAO/XAO_Exception.hxx index 0e0fd6fb2..05ada0b0a 100644 --- a/src/XAO/XAO_Exception.hxx +++ b/src/XAO/XAO_Exception.hxx @@ -38,13 +38,14 @@ public: */ XAO_Exception(const char *message) : m_message(message) {} - virtual ~XAO_Exception() noexcept {}; + ~XAO_Exception() noexcept override = default; + ; /** * Returns the error message. * @return the error message. */ - virtual const char *what() const noexcept { return m_message; } + const char *what() const noexcept override { return m_message; } #ifdef SWIG %extend diff --git a/src/XAO/XAO_Field.cxx b/src/XAO/XAO_Field.cxx index dcb5c2bfb..547d2e967 100644 --- a/src/XAO/XAO_Field.cxx +++ b/src/XAO/XAO_Field.cxx @@ -40,8 +40,8 @@ Field::Field(XAO::Dimension dimension, int nbElements, int nbComponents, m_components(nbComponents, ""), m_nbElements(nbElements) {} Field::~Field() { - for (unsigned int i = 0; i < m_steps.size(); ++i) - delete m_steps[i]; + for (auto &m_step : m_steps) + delete m_step; } Field *Field::createField(XAO::Type type, XAO::Dimension dimension, @@ -77,7 +77,7 @@ void Field::setComponentsNames(const std::vector &names) { } bool Field::removeStep(Step *step) { - std::vector::iterator it = m_steps.begin(); + auto it = m_steps.begin(); for (; it != m_steps.end(); ++it) { Step *current = *it; if (step == current) { @@ -90,7 +90,7 @@ bool Field::removeStep(Step *step) { } bool Field::hasStep(int step) { - std::vector::iterator it = m_steps.begin(); + auto it = m_steps.begin(); for (; it != m_steps.end(); ++it) { Step *current = *it; if (current->getStep() == step) diff --git a/src/XAO/XAO_Field.hxx b/src/XAO/XAO_Field.hxx index ba1f02cb1..62fd4f19b 100644 --- a/src/XAO/XAO_Field.hxx +++ b/src/XAO/XAO_Field.hxx @@ -35,7 +35,7 @@ #endif namespace XAO { -typedef std::vector::iterator stepIterator; +using stepIterator = std::vector::iterator; /** * @class Field diff --git a/src/XAO/XAO_GeometricElement.cxx b/src/XAO/XAO_GeometricElement.cxx index 02b9a52c0..9632b2f95 100644 --- a/src/XAO/XAO_GeometricElement.cxx +++ b/src/XAO/XAO_GeometricElement.cxx @@ -35,7 +35,7 @@ GeometricElement::GeometricElement(const std::string &name, m_reference = reference; } -GeometricElement::~GeometricElement() {} +GeometricElement::~GeometricElement() = default; bool GeometricElement::hasName() { return !m_name.empty(); } diff --git a/src/XAO/XAO_GeometricElement.hxx b/src/XAO/XAO_GeometricElement.hxx index b66394189..86dddf102 100644 --- a/src/XAO/XAO_GeometricElement.hxx +++ b/src/XAO/XAO_GeometricElement.hxx @@ -111,7 +111,7 @@ public: /** * Destructor. */ - virtual ~GeometricElementList() {} + virtual ~GeometricElementList() = default; /** * Gets the size of the list. @@ -182,7 +182,7 @@ public: /** * Iterator on the element of the list. */ - typedef std::map::iterator iterator; + using iterator = std::map::iterator; /** * Gets an iterator on the first element. diff --git a/src/XAO/XAO_Geometry.cxx b/src/XAO/XAO_Geometry.cxx index 5e048c55f..2a53d20c9 100644 --- a/src/XAO/XAO_Geometry.cxx +++ b/src/XAO/XAO_Geometry.cxx @@ -42,7 +42,7 @@ Geometry *Geometry::createGeometry(XAO::Format format, << "Geometry format not supported: " << format); } -Geometry::~Geometry() {} +Geometry::~Geometry() = default; void Geometry::checkReadOnly() { if (m_readOnly) diff --git a/src/XAO/XAO_Group.cxx b/src/XAO/XAO_Group.cxx index 2a33eaf9a..88d846340 100644 --- a/src/XAO/XAO_Group.cxx +++ b/src/XAO/XAO_Group.cxx @@ -34,7 +34,7 @@ Group::Group(XAO::Dimension dim, int nbElements, const std::string &name) { m_nbElements = nbElements; } -Group::~Group() {} +Group::~Group() = default; void Group::checkIndex(int element) { if (element < (int)m_elements.size() && element >= 0) diff --git a/src/XAO/XAO_Group.hxx b/src/XAO/XAO_Group.hxx index 4de8f3874..4f3849838 100644 --- a/src/XAO/XAO_Group.hxx +++ b/src/XAO/XAO_Group.hxx @@ -89,7 +89,7 @@ public: */ int get(int index) { checkIndex(index); - std::set::iterator it = m_elements.begin(); + auto it = m_elements.begin(); std::advance(it, index); return (*it); } diff --git a/src/XAO/XAO_IntegerField.cxx b/src/XAO/XAO_IntegerField.cxx index 1ccc80edb..66014483c 100644 --- a/src/XAO/XAO_IntegerField.cxx +++ b/src/XAO/XAO_IntegerField.cxx @@ -48,8 +48,7 @@ IntegerStep *IntegerField::addStep(int step, int stamp) throw XAO_Exception(MsgBuilder() << "Step with number " << step << " already exists."); - IntegerStep *bstep = - new IntegerStep(step, stamp, m_nbElements, m_nbComponents); + auto *bstep = new IntegerStep(step, stamp, m_nbElements, m_nbComponents); m_steps.push_back(bstep); return bstep; } diff --git a/src/XAO/XAO_IntegerField.hxx b/src/XAO/XAO_IntegerField.hxx index 52a9b5986..c7febd209 100644 --- a/src/XAO/XAO_IntegerField.hxx +++ b/src/XAO/XAO_IntegerField.hxx @@ -50,9 +50,9 @@ public: IntegerField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string &name); - virtual XAO::Type getType() { return XAO::INTEGER; } + XAO::Type getType() override { return XAO::INTEGER; } - virtual Step *addNewStep(int step); + Step *addNewStep(int step) override; /** * Adds a new step. diff --git a/src/XAO/XAO_IntegerStep.hxx b/src/XAO/XAO_IntegerStep.hxx index b86d29c92..e936a9259 100644 --- a/src/XAO/XAO_IntegerStep.hxx +++ b/src/XAO/XAO_IntegerStep.hxx @@ -49,7 +49,7 @@ public: */ IntegerStep(int step, int stamp, int nbElements, int nbComponents); - virtual XAO::Type getType() { return XAO::INTEGER; } + XAO::Type getType() override { return XAO::INTEGER; } /** * Gets all the values of the step as a list. @@ -107,9 +107,9 @@ public: */ void setValue(int element, int component, int value); - virtual const std::string getStringValue(int element, int component); - virtual void setStringValue(int element, int component, - const std::string &value); + const std::string getStringValue(int element, int component) override; + void setStringValue(int element, int component, + const std::string &value) override; private: std::vector> m_values; diff --git a/src/XAO/XAO_Step.hxx b/src/XAO/XAO_Step.hxx index cd3772761..92175db7e 100644 --- a/src/XAO/XAO_Step.hxx +++ b/src/XAO/XAO_Step.hxx @@ -37,13 +37,13 @@ namespace XAO { class XAO_EXPORT Step { protected: /** Default constructor. */ - Step() {} + Step() = default; public: /** * Destructor. */ - virtual ~Step() {} + virtual ~Step() = default; /** * Gets the type of the step. diff --git a/src/XAO/XAO_StringField.cxx b/src/XAO/XAO_StringField.cxx index d71c897e3..a3622fad2 100644 --- a/src/XAO/XAO_StringField.cxx +++ b/src/XAO/XAO_StringField.cxx @@ -48,7 +48,7 @@ StringStep *StringField::addStep(int step, int stamp) throw XAO_Exception(MsgBuilder() << "Step with number " << step << " already exists."); - StringStep *bstep = new StringStep(step, stamp, m_nbElements, m_nbComponents); + auto *bstep = new StringStep(step, stamp, m_nbElements, m_nbComponents); m_steps.push_back(bstep); return bstep; } diff --git a/src/XAO/XAO_StringField.hxx b/src/XAO/XAO_StringField.hxx index 73b779f22..10179752e 100644 --- a/src/XAO/XAO_StringField.hxx +++ b/src/XAO/XAO_StringField.hxx @@ -50,9 +50,9 @@ public: StringField(XAO::Dimension dimension, int nbElements, int nbComponents, const std::string &name); - virtual XAO::Type getType() { return XAO::STRING; } + XAO::Type getType() override { return XAO::STRING; } - virtual Step *addNewStep(int step); + Step *addNewStep(int step) override; /** * Adds a new step. diff --git a/src/XAO/XAO_StringStep.hxx b/src/XAO/XAO_StringStep.hxx index 6002235fc..f5a7e23f1 100644 --- a/src/XAO/XAO_StringStep.hxx +++ b/src/XAO/XAO_StringStep.hxx @@ -50,7 +50,7 @@ public: */ StringStep(int step, int stamp, int nbElements, int nbComponents); - virtual XAO::Type getType() { return XAO::STRING; } + XAO::Type getType() override { return XAO::STRING; } /** * Gets all the values of the step as a list. @@ -108,9 +108,9 @@ public: */ void setValue(int element, int component, const std::string &value); - virtual const std::string getStringValue(int element, int component); - virtual void setStringValue(int element, int component, - const std::string &value); + const std::string getStringValue(int element, int component) override; + void setStringValue(int element, int component, + const std::string &value) override; private: std::vector> m_values; diff --git a/src/XAO/XAO_Xao.cxx b/src/XAO/XAO_Xao.cxx index ac50c8a87..15da91a7b 100644 --- a/src/XAO/XAO_Xao.cxx +++ b/src/XAO/XAO_Xao.cxx @@ -40,29 +40,27 @@ const xmlChar *C_XAO_VERSION = (xmlChar *)"1.0"; Xao::Xao() { m_author = ""; m_version = (char *)C_XAO_VERSION; - m_geometry = NULL; + m_geometry = nullptr; } Xao::Xao(const std::string &author, const std::string &version) { m_author = author; m_version = version; - m_geometry = NULL; + m_geometry = nullptr; } Xao::~Xao() { - if (m_geometry != NULL) { + if (m_geometry != nullptr) { delete m_geometry; - m_geometry = NULL; + m_geometry = nullptr; } - for (std::list::iterator it = m_groups.begin(); it != m_groups.end(); - ++it) { - delete (*it); + for (auto &m_group : m_groups) { + delete m_group; } - for (std::list::iterator it = m_fields.begin(); it != m_fields.end(); - ++it) { - delete (*it); + for (auto &m_field : m_fields) { + delete m_field; } } @@ -74,13 +72,12 @@ Group *Xao::getGroup(int index) checkGroupIndex(index); int i = 0; - for (std::list::iterator it = m_groups.begin(); it != m_groups.end(); - ++it, ++i) { + for (auto it = m_groups.begin(); it != m_groups.end(); ++it, ++i) { if (i == index) return (*it); } - return NULL; + return nullptr; } Group *Xao::addGroup(XAO::Dimension dim, const std::string &name) @@ -89,7 +86,7 @@ Group *Xao::addGroup(XAO::Dimension dim, const std::string &name) checkGeometry(); checkGroupDimension(dim); - Group *group = new Group(dim, m_geometry->countElements(dim), name); + auto *group = new Group(dim, m_geometry->countElements(dim), name); m_groups.push_back(group); return group; } @@ -101,7 +98,7 @@ bool Xao::removeGroup(Group *group) { bool res = (nb - 1 == countGroups()); if (res) { delete group; - group = NULL; + group = nullptr; } return res; @@ -121,8 +118,7 @@ Field *Xao::getField(int index) checkFieldIndex(index); int i = 0; - for (std::list::iterator it = m_fields.begin(); it != m_fields.end(); - ++it, ++i) { + for (auto it = m_fields.begin(); it != m_fields.end(); ++it, ++i) { if (i == index) return (*it); } @@ -187,7 +183,7 @@ IntegerField *Xao::addIntegerField(XAO::Dimension dim, int nbComponents, { checkGeometry(); int nbElts = m_geometry->countElements(dim); - IntegerField *field = new IntegerField(dim, nbElts, nbComponents, name); + auto *field = new IntegerField(dim, nbElts, nbComponents, name); m_fields.push_back(field); return field; } @@ -197,7 +193,7 @@ BooleanField *Xao::addBooleanField(XAO::Dimension dim, int nbComponents, { checkGeometry(); int nbElts = m_geometry->countElements(dim); - BooleanField *field = new BooleanField(dim, nbElts, nbComponents, name); + auto *field = new BooleanField(dim, nbElts, nbComponents, name); m_fields.push_back(field); return field; } @@ -207,7 +203,7 @@ DoubleField *Xao::addDoubleField(XAO::Dimension dim, int nbComponents, { checkGeometry(); int nbElts = m_geometry->countElements(dim); - DoubleField *field = new DoubleField(dim, nbElts, nbComponents, name); + auto *field = new DoubleField(dim, nbElts, nbComponents, name); m_fields.push_back(field); return field; } @@ -217,7 +213,7 @@ StringField *Xao::addStringField(XAO::Dimension dim, int nbComponents, { checkGeometry(); int nbElts = m_geometry->countElements(dim); - StringField *field = new StringField(dim, nbElts, nbComponents, name); + auto *field = new StringField(dim, nbElts, nbComponents, name); m_fields.push_back(field); return field; } @@ -229,7 +225,7 @@ bool Xao::removeField(Field *field) { bool res = (nb - 1 == countFields()); if (res) { delete field; - field = NULL; + field = nullptr; } return res; @@ -251,7 +247,7 @@ bool Xao::setXML(const std::string &xml) { } void Xao::checkGeometry() const { - if (m_geometry == NULL) + if (m_geometry == nullptr) throw XAO_Exception("Geometry is null"); } diff --git a/src/XAO/XAO_Xao.hxx b/src/XAO/XAO_Xao.hxx index f08a02854..9e9759069 100644 --- a/src/XAO/XAO_Xao.hxx +++ b/src/XAO/XAO_Xao.hxx @@ -100,7 +100,7 @@ public: * \param geometry the geometry to set. */ void setGeometry(Geometry *geometry) { - if (m_geometry != NULL) + if (m_geometry != nullptr) throw XAO_Exception("Geometry already set."); m_geometry = geometry; m_geometry->setReadOnly(); diff --git a/src/XAO/XAO_XaoExporter.cxx b/src/XAO/XAO_XaoExporter.cxx index 04ac3cdee..3aa7d7d16 100644 --- a/src/XAO/XAO_XaoExporter.cxx +++ b/src/XAO/XAO_XaoExporter.cxx @@ -128,7 +128,7 @@ std::string readStringProp(xmlNodePtr node, const xmlChar *attribute, bool required, const std::string &defaultValue, const std::string &exception /*= std::string() */) { xmlChar *strAttr = xmlGetProp(node, attribute); - if (strAttr == NULL) { + if (strAttr == nullptr) { if (required) { if (exception.size() > 0) throw XAO_Exception(exception.c_str()); @@ -150,7 +150,7 @@ int readIntegerProp(xmlNodePtr node, const xmlChar *attribute, bool required, int defaultValue, const std::string &exception /*= std::string() */) { xmlChar *strAttr = xmlGetProp(node, attribute); - if (strAttr == NULL) { + if (strAttr == nullptr) { if (required) { if (exception.size() > 0) throw XAO_Exception(exception.c_str()); @@ -171,13 +171,13 @@ int readIntegerProp(xmlNodePtr node, const xmlChar *attribute, bool required, xmlDocPtr exportXMLDoc(Xao *xaoObject, const std::string &shapeFileName) { // Creating the Xml document xmlDocPtr masterDocument = xmlNewDoc(BAD_CAST "1.0"); - xmlNodePtr xao = xmlNewNode(0, C_TAG_XAO); + xmlNodePtr xao = xmlNewNode(nullptr, C_TAG_XAO); xmlDocSetRootElement(masterDocument, xao); xmlNewProp(xao, C_ATTR_XAO_VERSION, BAD_CAST xaoObject->getVersion().c_str()); xmlNewProp(xao, C_ATTR_XAO_AUTHOR, BAD_CAST xaoObject->getAuthor().c_str()); - if (xaoObject->getGeometry() != NULL) { + if (xaoObject->getGeometry() != nullptr) { exportGeometry(xaoObject->getGeometry(), masterDocument, xao, shapeFileName); } @@ -191,15 +191,15 @@ xmlDocPtr exportXMLDoc(Xao *xaoObject, const std::string &shapeFileName) { void exportGeometricElements(Geometry *xaoGeometry, xmlNodePtr topology, XAO::Dimension dim, const xmlChar *colTag, const xmlChar *eltTag) { - xmlNodePtr vertices = xmlNewChild(topology, 0, colTag, 0); + xmlNodePtr vertices = xmlNewChild(topology, nullptr, colTag, nullptr); xmlNewProp( vertices, C_ATTR_COUNT, BAD_CAST XaoUtils::intToString(xaoGeometry->countElements(dim)).c_str()); - GeometricElementList::iterator it = xaoGeometry->begin(dim); + auto it = xaoGeometry->begin(dim); for (; it != xaoGeometry->end(dim); it++) { int index = it->first; GeometricElement elt = it->second; - xmlNodePtr vertex = xmlNewChild(vertices, 0, eltTag, 0); + xmlNodePtr vertex = xmlNewChild(vertices, nullptr, eltTag, nullptr); xmlNewProp(vertex, C_ATTR_ELT_INDEX, BAD_CAST XaoUtils::intToString(index).c_str()); xmlNewProp(vertex, C_ATTR_ELT_NAME, BAD_CAST elt.getName().c_str()); @@ -211,11 +211,11 @@ void exportGeometricElements(Geometry *xaoGeometry, xmlNodePtr topology, void exportGeometry(Geometry *xaoGeometry, xmlDocPtr doc, xmlNodePtr xao, const std::string &shapeFileName) { // Geometric part - xmlNodePtr geometry = xmlNewChild(xao, 0, C_TAG_GEOMETRY, 0); + xmlNodePtr geometry = xmlNewChild(xao, nullptr, C_TAG_GEOMETRY, nullptr); xmlNewProp(geometry, C_ATTR_GEOMETRY_NAME, BAD_CAST xaoGeometry->getName().c_str()); - xmlNodePtr shape = xmlNewChild(geometry, 0, C_TAG_SHAPE, 0); + xmlNodePtr shape = xmlNewChild(geometry, nullptr, C_TAG_SHAPE, nullptr); xmlNewProp( shape, C_ATTR_SHAPE_FORMAT, BAD_CAST XaoUtils::shapeFormatToString(xaoGeometry->getFormat()).c_str()); @@ -232,7 +232,7 @@ void exportGeometry(Geometry *xaoGeometry, xmlDocPtr doc, xmlNodePtr xao, xaoGeometry->writeShapeFile(shapeFileName); } - xmlNodePtr topology = xmlNewChild(geometry, 0, C_TAG_TOPOLOGY, 0); + xmlNodePtr topology = xmlNewChild(geometry, nullptr, C_TAG_TOPOLOGY, nullptr); exportGeometricElements(xaoGeometry, topology, XAO::VERTEX, C_TAG_VERTICES, C_TAG_VERTEX); @@ -245,14 +245,14 @@ void exportGeometry(Geometry *xaoGeometry, xmlDocPtr doc, xmlNodePtr xao, } void exportGroups(Xao *xaoObject, xmlNodePtr xao) { - xmlNodePtr groups = xmlNewChild(xao, 0, C_TAG_GROUPS, 0); + xmlNodePtr groups = xmlNewChild(xao, nullptr, C_TAG_GROUPS, nullptr); xmlNewProp(groups, C_ATTR_COUNT, BAD_CAST XaoUtils::intToString(xaoObject->countGroups()).c_str()); for (int i = 0; i < xaoObject->countGroups(); i++) { // Group* grp = (*it); Group *grp = xaoObject->getGroup(i); - xmlNodePtr group = xmlNewChild(groups, 0, C_TAG_GROUP, 0); + xmlNodePtr group = xmlNewChild(groups, nullptr, C_TAG_GROUP, nullptr); xmlNewProp(group, C_ATTR_GROUP_NAME, BAD_CAST grp->getName().c_str()); xmlNewProp( group, C_ATTR_GROUP_DIM, @@ -260,9 +260,8 @@ void exportGroups(Xao *xaoObject, xmlNodePtr xao) { xmlNewProp(group, C_ATTR_COUNT, BAD_CAST XaoUtils::intToString(grp->count()).c_str()); - for (std::set::iterator it = grp->begin(); it != grp->end(); ++it) { - int grpElt = (*it); - xmlNodePtr elt = xmlNewChild(group, 0, C_TAG_ELEMENT, 0); + for (int grpElt : *grp) { + xmlNodePtr elt = xmlNewChild(group, nullptr, C_TAG_ELEMENT, nullptr); xmlNewProp(elt, C_ATTR_ELEMENT_INDEX, BAD_CAST XaoUtils::intToString(grpElt).c_str()); } @@ -270,13 +269,13 @@ void exportGroups(Xao *xaoObject, xmlNodePtr xao) { } void exportFields(Xao *xaoObject, xmlNodePtr xao) { - xmlNodePtr fields = xmlNewChild(xao, 0, C_TAG_FIELDS, 0); + xmlNodePtr fields = xmlNewChild(xao, nullptr, C_TAG_FIELDS, nullptr); xmlNewProp(fields, C_ATTR_COUNT, BAD_CAST XaoUtils::intToString(xaoObject->countFields()).c_str()); for (int i = 0; i < xaoObject->countFields(); i++) { Field *field = xaoObject->getField(i); - xmlNodePtr nodeField = xmlNewChild(fields, 0, C_TAG_FIELD, 0); + xmlNodePtr nodeField = xmlNewChild(fields, nullptr, C_TAG_FIELD, nullptr); xmlNewProp(nodeField, C_ATTR_FIELD_NAME, BAD_CAST field->getName().c_str()); xmlNewProp(nodeField, C_ATTR_FIELD_TYPE, BAD_CAST XaoUtils::fieldTypeToString(field->getType()).c_str()); @@ -285,12 +284,14 @@ void exportFields(Xao *xaoObject, xmlNodePtr xao) { BAD_CAST XaoUtils::dimensionToString(field->getDimension()).c_str()); int nbComponents = field->countComponents(); - xmlNodePtr components = xmlNewChild(nodeField, 0, C_TAG_COMPONENTS, 0); + xmlNodePtr components = + xmlNewChild(nodeField, nullptr, C_TAG_COMPONENTS, nullptr); xmlNewProp(components, C_ATTR_COUNT, BAD_CAST XaoUtils::intToString(nbComponents).c_str()); for (int j = 0; j < nbComponents; j++) { - xmlNodePtr nodeComponent = xmlNewChild(components, 0, C_TAG_COMPONENT, 0); + xmlNodePtr nodeComponent = + xmlNewChild(components, nullptr, C_TAG_COMPONENT, nullptr); xmlNewProp(nodeComponent, C_ATTR_COMPONENT_COLUMN, BAD_CAST XaoUtils::intToString(j).c_str()); xmlNewProp(nodeComponent, C_ATTR_COMPONENT_NAME, @@ -298,11 +299,11 @@ void exportFields(Xao *xaoObject, xmlNodePtr xao) { } int nbSteps = field->countSteps(); - xmlNodePtr nodeSteps = xmlNewChild(nodeField, 0, C_TAG_STEPS, 0); + xmlNodePtr nodeSteps = + xmlNewChild(nodeField, nullptr, C_TAG_STEPS, nullptr); xmlNewProp(nodeSteps, C_ATTR_COUNT, BAD_CAST XaoUtils::intToString(nbSteps).c_str()); - for (stepIterator itStep = field->begin(); itStep != field->end(); - itStep++) { + for (auto itStep = field->begin(); itStep != field->end(); itStep++) { Step *step = *itStep; exportStep(step, field, nodeSteps); } @@ -310,7 +311,7 @@ void exportFields(Xao *xaoObject, xmlNodePtr xao) { } void exportStep(Step *step, Field * /*field*/, xmlNodePtr nodeSteps) { - xmlNodePtr nodeStep = xmlNewChild(nodeSteps, 0, C_TAG_STEP, 0); + xmlNodePtr nodeStep = xmlNewChild(nodeSteps, nullptr, C_TAG_STEP, nullptr); xmlNewProp(nodeStep, C_ATTR_STEP_NUMBER, BAD_CAST XaoUtils::intToString(step->getStep()).c_str()); if (step->getStamp() >= 0) { @@ -319,14 +320,14 @@ void exportStep(Step *step, Field * /*field*/, xmlNodePtr nodeSteps) { } for (int i = 0; i < step->countElements(); ++i) { - xmlNodePtr nodeElt = xmlNewChild(nodeStep, 0, C_TAG_ELEMENT, 0); + xmlNodePtr nodeElt = xmlNewChild(nodeStep, nullptr, C_TAG_ELEMENT, nullptr); xmlNewProp(nodeElt, C_ATTR_ELEMENT_INDEX, BAD_CAST XaoUtils::intToString(i).c_str()); for (int j = 0; j < step->countComponents(); ++j) { std::string content = step->getStringValue(i, j); xmlNodePtr nodeValue = - xmlNewChild(nodeElt, NULL, C_TAG_VALUE, BAD_CAST content.c_str()); + xmlNewChild(nodeElt, nullptr, C_TAG_VALUE, BAD_CAST content.c_str()); xmlNewProp(nodeValue, C_ATTR_VALUE_COMPONENT, BAD_CAST XaoUtils::intToString(j).c_str()); } @@ -367,8 +368,8 @@ void parseXaoNode(xmlDocPtr doc, xmlNodePtr xaoNode, Xao *xaoObject) { void parseGeometryNode(xmlDocPtr doc, xmlNodePtr geometryNode, Xao *xaoObject) { // get the shape and topo nodes - xmlNodePtr shapeNode = NULL; - xmlNodePtr topoNode = NULL; + xmlNodePtr shapeNode = nullptr; + xmlNodePtr topoNode = nullptr; for (xmlNodePtr node = geometryNode->children; node; node = node->next) { if (xmlStrcmp(node->name, C_TAG_SHAPE) == 0) shapeNode = node; @@ -399,7 +400,7 @@ void parseShapeNode(xmlDocPtr /*doc*/, xmlNodePtr shapeNode, } else { // read brep from node content xmlChar *data = xmlNodeGetContent(shapeNode->children); - if (data == NULL) + if (data == nullptr) throw XAO_Exception("Missing BREP"); geometry->setShapeString((char *)data); xmlFree(data); @@ -530,8 +531,8 @@ void parseFieldNode(xmlNodePtr fieldNode, Xao *xaoObject) { XAO::Type type = XaoUtils::stringToFieldType(strType); // we need to get the number of components first to create the field - xmlNodePtr componentsNode = NULL; - xmlNodePtr stepsNode = NULL; + xmlNodePtr componentsNode = nullptr; + xmlNodePtr stepsNode = nullptr; for (xmlNodePtr node = fieldNode->children; node; node = node->next) { if (xmlStrcmp(node->name, C_TAG_COMPONENTS) == 0) @@ -541,7 +542,7 @@ void parseFieldNode(xmlNodePtr fieldNode, Xao *xaoObject) { } // ensure that the components node is defined - if (componentsNode == NULL) { + if (componentsNode == nullptr) { throw XAO_Exception(MsgBuilder() << "Line " << fieldNode->line << ": " << "No components defined for field."); } @@ -567,7 +568,7 @@ void parseFieldNode(xmlNodePtr fieldNode, Xao *xaoObject) { field->setName(name); // read the steps - if (stepsNode != 0) { + if (stepsNode != nullptr) { for (xmlNodePtr stepNode = stepsNode->children; stepNode; stepNode = stepNode->next) { if (xmlStrcmp(stepNode->name, C_TAG_STEP) == 0) { @@ -605,7 +606,7 @@ void parseStepElementNode(xmlNodePtr eltNode, Step *step) { xmlChar *data = xmlNodeGetContent(valNode->children); std::string value; - if (data != NULL) { + if (data != nullptr) { value = (char *)data; } else if (step->getType() != XAO::STRING) { throw XAO_Exception(MsgBuilder() << "Line " << valNode->line @@ -654,8 +655,8 @@ bool XaoExporter::readFromFile(const std::string &fileName, Xao *xaoObject) { // parse the file and get the DOM int options = XML_PARSE_HUGE | XML_PARSE_NOCDATA; - xmlDocPtr doc = xmlReadFile(fileName.c_str(), NULL, options); - if (doc == NULL) { + xmlDocPtr doc = xmlReadFile(fileName.c_str(), nullptr, options); + if (doc == nullptr) { throw XAO_Exception("Cannot read XAO file"); } @@ -667,8 +668,8 @@ bool XaoExporter::setXML(const std::string &xml, Xao *xaoObject) { int options = XML_PARSE_HUGE | XML_PARSE_NOCDATA; - xmlDocPtr doc = xmlReadDoc(BAD_CAST xml.c_str(), "", NULL, options); - if (doc == NULL) { + xmlDocPtr doc = xmlReadDoc(BAD_CAST xml.c_str(), "", nullptr, options); + if (doc == nullptr) { throw XAO_Exception("Cannot read XAO stream"); } diff --git a/src/XAO/XAO_XaoUtils.hxx b/src/XAO/XAO_XaoUtils.hxx index 8a3800308..d48de209e 100644 --- a/src/XAO/XAO_XaoUtils.hxx +++ b/src/XAO/XAO_XaoUtils.hxx @@ -166,9 +166,11 @@ public: class MsgBuilder { public: /** Constructor. */ - MsgBuilder(){}; + MsgBuilder() = default; + ; /** Destructor. */ - ~MsgBuilder(){}; + ~MsgBuilder() = default; + ; #ifndef SWIG /** Stream operator. */ diff --git a/src/XGUI/XGUI_ActionsMgr.cpp b/src/XGUI/XGUI_ActionsMgr.cpp index 3fad0ecae..35d09be6f 100644 --- a/src/XGUI/XGUI_ActionsMgr.cpp +++ b/src/XGUI/XGUI_ActionsMgr.cpp @@ -66,10 +66,10 @@ XGUI_ActionsMgr::XGUI_ActionsMgr(XGUI_Workshop *theParent) Events_Loop *aLoop = Events_Loop::loop(); static Events_ID aStateResponseEventId = Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_RESPONSE); - aLoop->registerListener(this, aStateResponseEventId, NULL, true); + aLoop->registerListener(this, aStateResponseEventId, nullptr, true); } -XGUI_ActionsMgr::~XGUI_ActionsMgr() {} +XGUI_ActionsMgr::~XGUI_ActionsMgr() = default; void XGUI_ActionsMgr::addCommand(QAction *theCmd) { QString aId = theCmd->data().toString(); @@ -78,7 +78,7 @@ void XGUI_ActionsMgr::addCommand(QAction *theCmd) { } myActions.insert(aId, theCmd); #ifdef HAVE_SALOME - XGUI_Workshop *aWorkshop = static_cast(parent()); + auto *aWorkshop = static_cast(parent()); const std::shared_ptr &anInfo = aWorkshop->salomeConnector()->featureInfo(aId); if (anInfo.get()) @@ -117,9 +117,8 @@ void XGUI_ActionsMgr::updateCommandsStatus() { updateOnViewSelection(); FeaturePtr anActiveFeature = FeaturePtr(); - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - myOperationMgr->currentOperation()); + auto *aFOperation = dynamic_cast( + myOperationMgr->currentOperation()); if (aFOperation) { anActiveFeature = aFOperation->feature(); QStringList aNested = allNestedCommands(aFOperation); @@ -167,10 +166,9 @@ void XGUI_ActionsMgr::updateOnViewSelection() { foreach (QString aId, nestedCommands(aFeatureId)) { ModelAPI_ValidatorsFactory::Validators aValidators; aFactory->validators(aId.toStdString(), aValidators); - ModelAPI_ValidatorsFactory::Validators::iterator aValidatorIt = - aValidators.begin(); + auto aValidatorIt = aValidators.begin(); for (; aValidatorIt != aValidators.end(); ++aValidatorIt) { - const ModuleBase_SelectionValidator *aSelValidator = + const auto *aSelValidator = dynamic_cast( aFactory->validator(aValidatorIt->first)); if (aSelValidator) @@ -215,7 +213,7 @@ void XGUI_ActionsMgr::processEvent( if (!aStateMessage.get()) return; std::list aFeaturesList = aStateMessage->features(); - std::list::iterator it = aFeaturesList.begin(); + auto it = aFeaturesList.begin(); for (; it != aFeaturesList.end(); ++it) { QString anActionId = QString::fromStdString(*it); bool theDefaultState = false; @@ -234,7 +232,7 @@ void XGUI_ActionsMgr::processEvent( } QAction *XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId) { - QAction *aResult = NULL; + QAction *aResult = nullptr; if (myOperationActions.contains(theId)) { aResult = myOperationActions.value(theId); // if (theParent && aResult->parent() != theParent) { @@ -263,8 +261,9 @@ QAction *XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId) { QIcon(":pictures/button_help.png"), tr("Help"), aParent); } break; case Preview: { - aResult = ModuleBase_Tools::createAction( - QIcon(), tr("See preview"), aParent, 0, 0, tr("Compute preview")); + aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"), + aParent, nullptr, nullptr, + tr("Compute preview")); aResult->setStatusTip(aResult->toolTip()); } break; default: @@ -276,7 +275,7 @@ QAction *XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId) { } QAction *XGUI_ActionsMgr::action(const QString &theId) { - QAction *anAction = 0; + QAction *anAction = nullptr; if (myActions.contains(theId)) { anAction = myActions.value(theId); } @@ -321,8 +320,7 @@ void XGUI_ActionsMgr::setNestedCommandsEnabled(bool theEnabled, void XGUI_ActionsMgr::setNestedStackEnabled( ModuleBase_Operation *theOperation) { - ModuleBase_OperationFeature *anOperation = - dynamic_cast(theOperation); + auto *anOperation = dynamic_cast(theOperation); if (!anOperation || !anOperation->feature()) return; FeaturePtr aFeature = anOperation->feature(); @@ -336,8 +334,7 @@ void XGUI_ActionsMgr::setNestedStackEnabled( QStringList XGUI_ActionsMgr::allNestedCommands(ModuleBase_Operation *theOperation) { QStringList aFeatures; - ModuleBase_OperationFeature *anOperation = - dynamic_cast(theOperation); + auto *anOperation = dynamic_cast(theOperation); if (!anOperation || !anOperation->feature()) return aFeatures; FeaturePtr aFeature = anOperation->feature(); @@ -378,7 +375,7 @@ void XGUI_ActionsMgr::updateByDocumentKind() { std::string aStdDocKind = ModelAPI_Session::get()->activeDocument()->kind(); QString aDocKind = QString::fromStdString(aStdDocKind); #ifdef HAVE_SALOME - XGUI_Workshop *aWorkshop = static_cast(parent()); + auto *aWorkshop = static_cast(parent()); #endif foreach (QAction *eachAction, myActions.values()) { QString aCmdDocKind; diff --git a/src/XGUI/XGUI_ActionsMgr.h b/src/XGUI/XGUI_ActionsMgr.h index e0e3350ae..214e97108 100644 --- a/src/XGUI/XGUI_ActionsMgr.h +++ b/src/XGUI/XGUI_ActionsMgr.h @@ -49,7 +49,7 @@ public: /// Constructor /// \param theWorkshop an instance of workshop XGUI_ActionsMgr(XGUI_Workshop *theWorkshop); - virtual ~XGUI_ActionsMgr(); + ~XGUI_ActionsMgr() override; /// Actions on operations enum OperationStateActionId { @@ -89,7 +89,7 @@ public: QKeySequence registerShortcut(const QString &theKeySequence); /// Redefinition of Events_Listener method - virtual void processEvent(const std::shared_ptr &theMessage); + void processEvent(const std::shared_ptr &theMessage) override; /// Return property panel's action like ok, cancel, help. /// If there is no such action, it will be created. diff --git a/src/XGUI/XGUI_ActiveControlMgr.h b/src/XGUI/XGUI_ActiveControlMgr.h index 552a22059..cc93ddc87 100644 --- a/src/XGUI/XGUI_ActiveControlMgr.h +++ b/src/XGUI/XGUI_ActiveControlMgr.h @@ -74,8 +74,8 @@ protected: protected: ModuleBase_IWorkshop *myWorkshop; ///< the current workshop - QList mySelectors; ///< workshop selectors - XGUI_ActiveControlSelector *myActiveSelector{0}; ///< active selector + QList mySelectors; ///< workshop selectors + XGUI_ActiveControlSelector *myActiveSelector{nullptr}; ///< active selector bool myIsBlocked{ false}; ///< blocking flag to avoid cycling signals processing diff --git a/src/XGUI/XGUI_ColorDialog.cpp b/src/XGUI/XGUI_ColorDialog.cpp index 6bae2c4cc..d606e57fa 100644 --- a/src/XGUI/XGUI_ColorDialog.cpp +++ b/src/XGUI/XGUI_ColorDialog.cpp @@ -48,14 +48,14 @@ public: RadioButton(QWidget *buddy = nullptr, QWidget *parent = nullptr) : RadioButton(QString(), buddy, parent) {} - bool eventFilter(QObject *sender, QEvent *event) { + bool eventFilter(QObject *sender, QEvent *event) override { if (myBuddy != nullptr && sender == myBuddy && event->type() == QEvent::MouseButtonPress) setChecked(true); return QRadioButton::eventFilter(sender, event); } - void changeEvent(QEvent *event) { + void changeEvent(QEvent *event) override { if (myBuddy != nullptr && event->type() == QEvent::EnabledChange) myBuddy->setEnabled(isEnabled()); QRadioButton::changeEvent(event); @@ -67,12 +67,12 @@ XGUI_ColorDialog::XGUI_ColorDialog(QWidget *theParent) : QDialog(theParent, Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint) { setWindowTitle(tr("Color")); - QGridLayout *aLay = new QGridLayout(this); + auto *aLay = new QGridLayout(this); myColorButton = new QtxColorButton(this); myColorButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - QLabel *aRandomLabel = new QLabel(tr("Random"), this); + auto *aRandomLabel = new QLabel(tr("Random"), this); QRadioButton *aColorChoiceBtn = new RadioButton(myColorButton, this); QRadioButton *aRandomChoiceBtn = new RadioButton(aRandomLabel, this); @@ -87,7 +87,7 @@ XGUI_ColorDialog::XGUI_ColorDialog(QWidget *theParent) aLay->addWidget(aRandomChoiceBtn, 1, 0); aLay->addWidget(aRandomLabel, 1, 1); - QDialogButtonBox *aButtons = new QDialogButtonBox( + auto *aButtons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); connect(aButtons, SIGNAL(accepted()), this, SLOT(accept())); connect(aButtons, SIGNAL(rejected()), this, SLOT(reject())); diff --git a/src/XGUI/XGUI_ColorDialog.h b/src/XGUI/XGUI_ColorDialog.h index f0ecf4d70..40def4816 100644 --- a/src/XGUI/XGUI_ColorDialog.h +++ b/src/XGUI/XGUI_ColorDialog.h @@ -41,7 +41,8 @@ public: /// \param theParent a parent widget for the dialog XGUI_EXPORT XGUI_ColorDialog(QWidget *theParent); - XGUI_EXPORT virtual ~XGUI_ColorDialog(){}; + XGUI_EXPORT ~XGUI_ColorDialog() override = default; + ; /// Returns whether the random state of color is chosen /// \return a boolean value diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 4e5fb997f..9b47292fc 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -71,10 +71,10 @@ #endif XGUI_ContextMenuMgr::XGUI_ContextMenuMgr(XGUI_Workshop *theParent) - : QObject(theParent), myWorkshop(theParent), mySeparator1(0), - mySeparator2(0), mySeparator3(0) {} + : QObject(theParent), myWorkshop(theParent), mySeparator1(nullptr), + mySeparator2(nullptr), mySeparator3(nullptr) {} -XGUI_ContextMenuMgr::~XGUI_ContextMenuMgr() {} +XGUI_ContextMenuMgr::~XGUI_ContextMenuMgr() = default; void XGUI_ContextMenuMgr::createActions() { #ifdef HAVE_SALOME @@ -278,7 +278,7 @@ void XGUI_ContextMenuMgr::addAction(const QString &theId, QAction *theAction) { QAction *XGUI_ContextMenuMgr::action(const QString &theId) const { if (myActions.contains(theId)) return myActions[theId]; - return 0; + return nullptr; } QAction *XGUI_ContextMenuMgr::actionByName(const QString &theName) const { @@ -287,20 +287,20 @@ QAction *XGUI_ContextMenuMgr::actionByName(const QString &theName) const { return eachAction; } } - return NULL; + return nullptr; } QStringList XGUI_ContextMenuMgr::actionIds() const { return myActions.keys(); } void XGUI_ContextMenuMgr::onAction(bool isChecked) { - QAction *anAction = static_cast(sender()); + auto *anAction = static_cast(sender()); emit actionTriggered(anAction->data().toString(), isChecked); } void XGUI_ContextMenuMgr::updateCommandsStatus() {} void XGUI_ContextMenuMgr::onContextMenuRequest(QContextMenuEvent *theEvent) { - QMenu *aMenu = new QMenu(); + auto *aMenu = new QMenu(); if (sender() == myWorkshop->objectBrowser()) { updateObjectBrowserMenu(); addObjBrowserMenu(aMenu); @@ -639,7 +639,7 @@ void XGUI_ContextMenuMgr::updateViewerMenu() { // Only enable the "Bring To Front" command for Groups ResultGroupPtr aGroup = std::dynamic_pointer_cast(aResult); - action("BRING_TO_FRONT_CMD")->setEnabled(aGroup.get() != NULL); + action("BRING_TO_FRONT_CMD")->setEnabled(aGroup.get() != nullptr); action("BRING_TO_FRONT_CMD") ->setChecked(ModelAPI_Tools::isBringToFront(aResult)); } @@ -976,7 +976,7 @@ void XGUI_ContextMenuMgr::addViewerMenu(QMenu *theMenu) const { if (!aOpMgr->hasOperation() && myWorkshop->selectionActivate()->activeSelectionPlace() == XGUI_SelectionActivate::Workshop) { - QMenu *aSelMenu = new QMenu(tr("Selection mode"), theMenu); + auto *aSelMenu = new QMenu(tr("Selection mode"), theMenu); aSelMenu->addAction(action("SELECT_VERTEX_CMD")); aSelMenu->addAction(action("SELECT_EDGE_CMD")); aSelMenu->addAction(action("SELECT_FACE_CMD")); @@ -988,7 +988,7 @@ void XGUI_ContextMenuMgr::addViewerMenu(QMenu *theMenu) const { } if (aSelected == 1) { ObjectPtr aObject = aPrsList.first()->object(); - if (aObject.get() != NULL) { + if (aObject.get() != nullptr) { std::string aName = aObject->groupName(); if (myViewerMenu.contains(aName)) anActions = myViewerMenu[aName]; @@ -1122,12 +1122,12 @@ void XGUI_ContextMenuMgr::addFeatures(QMenu *theMenu) const { anAction->blockSignals(isBlock); \ } -void XGUI_ContextMenuMgr::onResultSelection(bool theChecked) { +void XGUI_ContextMenuMgr::onResultSelection(bool /*theChecked*/) { UNCHECK_ACTION("SELECT_VERTEX_CMD"); UNCHECK_ACTION("SELECT_EDGE_CMD"); UNCHECK_ACTION("SELECT_FACE_CMD"); } -void XGUI_ContextMenuMgr::onShapeSelection(bool theChecked) { +void XGUI_ContextMenuMgr::onShapeSelection(bool /*theChecked*/) { UNCHECK_ACTION("SHOW_RESULTS_CMD"); } diff --git a/src/XGUI/XGUI_ContextMenuMgr.h b/src/XGUI/XGUI_ContextMenuMgr.h index 9e8b456b3..d90ea3b02 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.h +++ b/src/XGUI/XGUI_ContextMenuMgr.h @@ -42,7 +42,7 @@ public: /// Constructor /// \param theParent a parent object XGUI_ContextMenuMgr(XGUI_Workshop *theParent); - virtual ~XGUI_ContextMenuMgr(); + ~XGUI_ContextMenuMgr() override; /// Create all actions for context menus. It is called on creation of /// application @@ -137,7 +137,7 @@ private: /// Reference to workshop XGUI_Workshop *myWorkshop; - typedef QList QActionsList; + using QActionsList = QList; QMap myObjBrowserMenus; QMap myViewerMenu; diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index e712b4806..afada9f61 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -44,7 +44,7 @@ #endif static bool isValidNode(const ModuleBase_ITreeNode *theNode) { - ModuleBase_ITreeNode *aParent = 0; + ModuleBase_ITreeNode *aParent = nullptr; try { aParent = theNode->parent(); } catch (...) { @@ -60,7 +60,7 @@ XGUI_DataModel::XGUI_DataModel(QObject *theParent) : QAbstractItemModel(theParent) //, // myIsEventsProcessingBlocked(false) { - XGUI_ObjectsBrowser *aOB = qobject_cast(theParent); + auto *aOB = qobject_cast(theParent); myWorkshop = aOB->workshop(); Events_Loop *aLoop = Events_Loop::loop(); @@ -281,8 +281,7 @@ void XGUI_DataModel::rebuildDataTree() { //****************************************************** ObjectPtr XGUI_DataModel::object(const QModelIndex &theIndex) const { if (theIndex.isValid()) { - ModuleBase_ITreeNode *aNode = - (ModuleBase_ITreeNode *)theIndex.internalPointer(); + auto *aNode = (ModuleBase_ITreeNode *)theIndex.internalPointer(); return aNode->object(); } return ObjectPtr(); @@ -301,16 +300,16 @@ QModelIndex XGUI_DataModel::objectIndex(const ObjectPtr theObject, //****************************************************** QVariant XGUI_DataModel::data(const QModelIndex &theIndex, int theRole) const { if (theIndex.isValid()) { - ModuleBase_ITreeNode *aNode = - (ModuleBase_ITreeNode *)theIndex.internalPointer(); + auto *aNode = (ModuleBase_ITreeNode *)theIndex.internalPointer(); return aNode->data(theIndex.column(), theRole); } return QVariant(); } //****************************************************** -QVariant XGUI_DataModel::headerData(int theSection, Qt::Orientation theOrient, - int theRole) const { +QVariant XGUI_DataModel::headerData(int /*theSection*/, + Qt::Orientation /*theOrient*/, + int /*theRole*/) const { return QVariant(); } @@ -324,7 +323,7 @@ int XGUI_DataModel::rowCount(const QModelIndex &theParent) const { } //****************************************************** -int XGUI_DataModel::columnCount(const QModelIndex &theParent) const { +int XGUI_DataModel::columnCount(const QModelIndex & /*theParent*/) const { return 3; } @@ -343,8 +342,7 @@ QModelIndex XGUI_DataModel::index(int theRow, int theColumn, //****************************************************** QModelIndex XGUI_DataModel::parent(const QModelIndex &theIndex) const { if (theIndex.isValid()) { - ModuleBase_ITreeNode *aNode = - (ModuleBase_ITreeNode *)theIndex.internalPointer(); + auto *aNode = (ModuleBase_ITreeNode *)theIndex.internalPointer(); return getParentIndex(aNode, 1); } return QModelIndex(); @@ -378,7 +376,7 @@ bool XGUI_DataModel::removeRows(int theRow, int theCount, //****************************************************** Qt::ItemFlags XGUI_DataModel::flags(const QModelIndex &theIndex) const { if (theIndex.isValid()) { - ModuleBase_ITreeNode *aNode = + auto *aNode = static_cast(theIndex.internalPointer()); // Check that the pointer is Valid if (!isValidNode(aNode)) @@ -408,9 +406,9 @@ Qt::ItemFlags XGUI_DataModel::flags(const QModelIndex &theIndex) const { return Qt::ItemIsDropEnabled | Qt::ItemFlags(); } -bool XGUI_DataModel::canDropMimeData(const QMimeData *theData, - Qt::DropAction theAction, int theRow, - int theColumn, +bool XGUI_DataModel::canDropMimeData(const QMimeData * /*theData*/, + Qt::DropAction /*theAction*/, int theRow, + int /*theColumn*/, const QModelIndex &theParent) const { if (theParent.isValid()) return false; @@ -434,18 +432,18 @@ QMimeData *XGUI_DataModel::mimeData(const QModelIndexList &theIndexes) const { } QByteArray anEncodedData; QDataStream aStream(&anEncodedData, QIODevice::WriteOnly); - for (std::set::iterator aRIter = aRows.begin(); aRIter != aRows.end(); - aRIter++) - aStream << *aRIter; + for (int aRow : aRows) + aStream << aRow; - QMimeData *aMimeData = new QMimeData(); + auto *aMimeData = new QMimeData(); aMimeData->setData("xgui/moved.rows", anEncodedData); return aMimeData; } bool XGUI_DataModel::dropMimeData(const QMimeData *theData, - Qt::DropAction theAction, int theRow, - int theColumn, const QModelIndex &theParent) { + Qt::DropAction /*theAction*/, int theRow, + int /*theColumn*/, + const QModelIndex & /*theParent*/) { FeaturePtr aDropAfter; // after this feature it is dropped, NULL if drop the // the first place if (theRow > 0) { @@ -464,7 +462,7 @@ bool XGUI_DataModel::dropMimeData(const QMimeData *theData, // system by default) std::list allFeatures = aSession->get()->moduleDocument()->allFeatures(); - std::list::iterator aFeature = allFeatures.begin(); + auto aFeature = allFeatures.begin(); for (; aFeature != allFeatures.end(); aFeature++) { if ((*aFeature)->isInHistory()) break; @@ -538,10 +536,9 @@ bool XGUI_DataModel::dropMimeData(const QMimeData *theData, aSession->startOperation("Move Part"); DocumentPtr aPartSet = aSession->moduleDocument(); - for (std::list::iterator aDrop = aDropped.begin(); - aDrop != aDropped.end(); aDrop++) { - aPartSet->moveFeature(*aDrop, aDropAfter); - aDropAfter = *aDrop; + for (auto &aDrop : aDropped) { + aPartSet->moveFeature(aDrop, aDropAfter); + aDropAfter = aDrop; } aSession->finishOperation(); @@ -560,7 +557,7 @@ QModelIndex XGUI_DataModel::documentRootIndex(DocumentPtr theDoc, if (theDoc == aRootDoc) return QModelIndex(); else { - ModuleBase_ITreeNode *aDocNode = 0; + ModuleBase_ITreeNode *aDocNode = nullptr; foreach (ModuleBase_ITreeNode *aNode, myRoot->children()) { if (aNode->document() == theDoc) { aDocNode = aNode; @@ -576,8 +573,7 @@ QModelIndex XGUI_DataModel::documentRootIndex(DocumentPtr theDoc, //****************************************************** bool XGUI_DataModel::hasHiddenState(const QModelIndex &theIndex) { if (theIndex.isValid()) { - ModuleBase_ITreeNode *aNode = - (ModuleBase_ITreeNode *)theIndex.internalPointer(); + auto *aNode = (ModuleBase_ITreeNode *)theIndex.internalPointer(); return aNode->visibilityState() == ModuleBase_ITreeNode::Hidden; } return false; @@ -585,8 +581,7 @@ bool XGUI_DataModel::hasHiddenState(const QModelIndex &theIndex) { //****************************************************** bool XGUI_DataModel::hasIndex(const QModelIndex &theIndex) const { - ModuleBase_ITreeNode *aNode = - (ModuleBase_ITreeNode *)theIndex.internalPointer(); + auto *aNode = (ModuleBase_ITreeNode *)theIndex.internalPointer(); return myRoot->hasSubNode(aNode); } @@ -623,8 +618,7 @@ void XGUI_DataModel::updateSubTree(ModuleBase_ITreeNode *theParent) { //****************************************************** DocumentPtr XGUI_DataModel::document(const QModelIndex &theIndex) const { - ModuleBase_ITreeNode *aNode = - (ModuleBase_ITreeNode *)theIndex.internalPointer(); + auto *aNode = (ModuleBase_ITreeNode *)theIndex.internalPointer(); return aNode->document(); } diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 723502848..81574a846 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -138,13 +138,13 @@ QString qIntListInfo(const QIntList &theValues, //************************************************************** XGUI_Displayer::XGUI_Displayer(XGUI_Workshop *theWorkshop) - : myWorkshop(theWorkshop), myViewerBlockedRecursiveCount(0), myContextId(0), - myNeedUpdate(false) { + : myWorkshop(theWorkshop), myViewerBlockedRecursiveCount(0), + myContextId(nullptr), myNeedUpdate(false) { BRepMesh_IncrementalMesh::SetParallelDefault(Standard_True); } //************************************************************** -XGUI_Displayer::~XGUI_Displayer() {} +XGUI_Displayer::~XGUI_Displayer() = default; //************************************************************** bool XGUI_Displayer::isVisible(ObjectPtr theObject) const { @@ -161,7 +161,7 @@ bool XGUI_Displayer::display(ObjectPtr theObject, bool theUpdateViewer) { GeomPresentablePtr aPrs = std::dynamic_pointer_cast(theObject); bool isShading = false; - if (aPrs.get() != NULL) { + if (aPrs.get() != nullptr) { GeomScreenParamsPtr aScreen = std::dynamic_pointer_cast(theObject); if (aScreen.get()) { @@ -410,7 +410,7 @@ void XGUI_Displayer::redisplayObjects() { //************************************************************** void XGUI_Displayer::deactivateObjects(const QObjectPtrList &theObjList, - const bool theUpdateViewer) { + const bool /*theUpdateViewer*/) { // Handle(AIS_InteractiveObject) aTrihedron = getTrihedron(); // if (!aTrihedron.IsNull()) // deactivateAIS(aTrihedron); @@ -442,7 +442,8 @@ bool XGUI_Displayer::isVisible(XGUI_Displayer *theDisplayer, aResult->groupName() == ModelAPI_ResultBody::group()) { ResultBodyPtr aCompsolidResult = std::dynamic_pointer_cast(aResult); - if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids + if (aCompsolidResult.get() != + nullptr) { // change colors for all sub-solids int aNumberOfSubs = aCompsolidResult->numberOfSubs(); bool anAllSubsVisible = aNumberOfSubs > 0; for (int i = 0; i < aNumberOfSubs && anAllSubsVisible; i++) { @@ -489,7 +490,7 @@ void XGUI_Displayer::setSelected( foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) { const GeomShapePtr &aGeomShape = aPrs->shape(); if (aGeomShape.get() && !aGeomShape->isNull()) { - const TopoDS_Shape &aShape = aGeomShape->impl(); + const auto &aShape = aGeomShape->impl(); #ifdef DEBUG_OCCT_SHAPE_SELECTION // problem 1: performance // problem 2: IO is not specified, so the first found owner is selected, @@ -829,7 +830,8 @@ XGUI_Displayer::displayMode(ObjectPtr theObject) const { } //************************************************************** -void XGUI_Displayer::deactivateSelectionFilters(const bool theAddFilterOnly) { +void XGUI_Displayer::deactivateSelectionFilters( + const bool /*theAddFilterOnly*/) { Handle(AIS_InteractiveContext) aContext = AISContext(); if (!myAndFilter.IsNull()) { bool aFound = false; @@ -949,7 +951,7 @@ bool XGUI_Displayer::canBeShaded(ObjectPtr theObject) const { return false; AISObjectPtr aAISObj = getAISObject(theObject); - if (aAISObj.get() == NULL) + if (aAISObj.get() == nullptr) return false; Handle(AIS_InteractiveObject) anAIS = @@ -1028,7 +1030,7 @@ void XGUI_Displayer::getPresentations( ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (aResult.get()) { AISObjectPtr aAISObj = getAISObject(aResult); - if (aAISObj.get() == NULL) { + if (aAISObj.get() == nullptr) { // if result is a result of a composite feature, it is visualized by // visualization of composite children, so we should get one of this // presentations @@ -1038,7 +1040,7 @@ void XGUI_Displayer::getPresentations( aAISObj = getAISObject(aCompSolid->subResult(0)); } } - if (aAISObj.get() != NULL) { + if (aAISObj.get() != nullptr) { Handle(AIS_InteractiveObject) anAIS = aAISObj->impl(); if (!anAIS.IsNull() && !thePresentations.Contains(anAIS)) @@ -1049,7 +1051,7 @@ void XGUI_Displayer::getPresentations( std::dynamic_pointer_cast(theObject); // find presentation of the feature AISObjectPtr aAISObj = getAISObject(aFeature); - if (aAISObj.get() != NULL) { + if (aAISObj.get() != nullptr) { Handle(AIS_InteractiveObject) anAIS = aAISObj->impl(); if (!anAIS.IsNull() && !thePresentations.Contains(anAIS)) @@ -1062,7 +1064,7 @@ void XGUI_Displayer::getPresentations( aLast = aResults.end(); for (; anIt != aLast; ++anIt) { AISObjectPtr aCurAISObj = getAISObject(*anIt); - if (aCurAISObj.get() != NULL) { + if (aCurAISObj.get() != nullptr) { Handle(AIS_InteractiveObject) anAIS = aCurAISObj->impl(); if (!anAIS.IsNull() && !thePresentations.Contains(anAIS)) diff --git a/src/XGUI/XGUI_ErrorDialog.cpp b/src/XGUI/XGUI_ErrorDialog.cpp index 4533e5653..aa6de4bee 100644 --- a/src/XGUI/XGUI_ErrorDialog.cpp +++ b/src/XGUI/XGUI_ErrorDialog.cpp @@ -34,12 +34,12 @@ XGUI_ErrorDialog::XGUI_ErrorDialog(QWidget *parent) : QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint) { - QVBoxLayout *aDlgLay = new QVBoxLayout(this); + auto *aDlgLay = new QVBoxLayout(this); setWindowTitle(tr("Application errors")); myErrorLog = new QTextEdit(this); myErrorLog->setReadOnly(true); aDlgLay->addWidget(myErrorLog); - QDialogButtonBox *aButtonBox = + auto *aButtonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this); aDlgLay->addWidget(aButtonBox); aDlgLay->setContentsMargins(2, 2, 2, 2); @@ -51,7 +51,7 @@ XGUI_ErrorDialog::XGUI_ErrorDialog(QWidget *parent) connect(aButtonBox, SIGNAL(rejected()), this, SLOT(clear())); } -XGUI_ErrorDialog::~XGUI_ErrorDialog() {} +XGUI_ErrorDialog::~XGUI_ErrorDialog() = default; void XGUI_ErrorDialog::refresh() { myErrorLog->clear(); diff --git a/src/XGUI/XGUI_ErrorDialog.h b/src/XGUI/XGUI_ErrorDialog.h index 1f73bf1e5..1a19a385e 100644 --- a/src/XGUI/XGUI_ErrorDialog.h +++ b/src/XGUI/XGUI_ErrorDialog.h @@ -37,7 +37,7 @@ public: /// Constructor /// \param parent a parent widget XGUI_EXPORT XGUI_ErrorDialog(QWidget *parent); - XGUI_EXPORT virtual ~XGUI_ErrorDialog(); + XGUI_EXPORT ~XGUI_ErrorDialog() override; public slots: /// Update dialog box diff --git a/src/XGUI/XGUI_ErrorMgr.cpp b/src/XGUI/XGUI_ErrorMgr.cpp index abb446400..6eb952196 100644 --- a/src/XGUI/XGUI_ErrorMgr.cpp +++ b/src/XGUI/XGUI_ErrorMgr.cpp @@ -53,17 +53,16 @@ const QString INVALID_VALUE = "invalid_action"; XGUI_ErrorMgr::XGUI_ErrorMgr(QObject *theParent, ModuleBase_IWorkshop *theWorkshop) : ModuleBase_IErrorMgr(theParent), myWorkshop(theWorkshop), - myErrorDialog(0), myErrorLabel(0), myAcceptToolTip(""), + myErrorDialog(nullptr), myErrorLabel(nullptr), myAcceptToolTip(""), myAcceptAllToolTip(""), myAcceptStatusTip(""), myAcceptAllStatusTip("") {} -XGUI_ErrorMgr::~XGUI_ErrorMgr() {} +XGUI_ErrorMgr::~XGUI_ErrorMgr() = default; void XGUI_ErrorMgr::updateActions(const FeaturePtr &theFeature) { // update Ok Action and header of property panel if the current operation // started for the feature - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - workshop()->operationMgr()->currentOperation()); + auto *aFOperation = dynamic_cast( + workshop()->operationMgr()->currentOperation()); if (aFOperation && aFOperation->feature() == theFeature) { ModuleBase_ModelWidget *anActiveWidget = activeWidget(); bool isApplyEnabledByActiveWidget = false; @@ -130,9 +129,8 @@ void XGUI_ErrorMgr::updateAcceptAllAction(const FeaturePtr &theFeature) { bool XGUI_ErrorMgr::isApplyEnabled() const { bool isEnabled = false; XGUI_ActionsMgr *anActionsMgr = workshop()->actionsMgr(); - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - workshop()->operationMgr()->currentOperation()); + auto *aFOperation = dynamic_cast( + workshop()->operationMgr()->currentOperation()); if (aFOperation) { QAction *anOkAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept); @@ -179,8 +177,7 @@ void XGUI_ErrorMgr::updateAcceptActionState(const QString &theError) { } } void XGUI_ErrorMgr::onWidgetChanged() { - ModuleBase_ModelWidget *aModelWidget = - dynamic_cast(sender()); + auto *aModelWidget = dynamic_cast(sender()); if (!aModelWidget || !aModelWidget->feature().get()) return; @@ -195,7 +192,7 @@ void XGUI_ErrorMgr::updateToolTip(ModuleBase_ModelWidget *theWidget, QList aWidgetList = theWidget->getControls(); foreach (QWidget *aWidget, aWidgetList) { - QLabel *aLabel = qobject_cast(aWidget); + auto *aLabel = qobject_cast(aWidget); // We won't set the effect to QLabels - it looks ugly if (aLabel) continue; @@ -216,17 +213,15 @@ void XGUI_ErrorMgr::updateToolTip(ModuleBase_ModelWidget *theWidget, } XGUI_Workshop *XGUI_ErrorMgr::workshop() const { - XGUI_ModuleConnector *aConnector = - dynamic_cast(myWorkshop); + auto *aConnector = dynamic_cast(myWorkshop); return aConnector->workshop(); } ModuleBase_ModelWidget *XGUI_ErrorMgr::activeWidget() const { - ModuleBase_ModelWidget *anActiveWidget = 0; + ModuleBase_ModelWidget *anActiveWidget = nullptr; - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - workshop()->operationMgr()->currentOperation()); + auto *aFOperation = dynamic_cast( + workshop()->operationMgr()->currentOperation()); if (aFOperation) { ModuleBase_IPropertyPanel *aPropertyPanel = aFOperation->propertyPanel(); if (aPropertyPanel) { diff --git a/src/XGUI/XGUI_ErrorMgr.h b/src/XGUI/XGUI_ErrorMgr.h index 128f44767..a8b3a7a07 100644 --- a/src/XGUI/XGUI_ErrorMgr.h +++ b/src/XGUI/XGUI_ErrorMgr.h @@ -47,11 +47,11 @@ public: /// \param theWorkshop a workshop object XGUI_ErrorMgr(QObject *theParent, ModuleBase_IWorkshop *theWorkshop); /// Virtual destructor - virtual ~XGUI_ErrorMgr(); + ~XGUI_ErrorMgr() override; /// Update actions for the given feature /// \param theFeature a feature - virtual void updateActions(const FeaturePtr &theFeature); + void updateActions(const FeaturePtr &theFeature) override; /// Update enable state of AcceptAll action if the feature uses it /// \param theFeature a feature @@ -62,7 +62,7 @@ public: protected slots: /// Reimplemented from ModuleBase_ErrorMgr::onWidgetChanged(). - virtual void onWidgetChanged(); + void onWidgetChanged() override; private: /// Stores initial values of accept/accept all tool/status tip to internal diff --git a/src/XGUI/XGUI_FacesPanel.cpp b/src/XGUI/XGUI_FacesPanel.cpp index c8761d146..8fcb6af80 100644 --- a/src/XGUI/XGUI_FacesPanel.cpp +++ b/src/XGUI/XGUI_FacesPanel.cpp @@ -105,8 +105,8 @@ XGUI_FacesPanel::XGUI_FacesPanel(QWidget *theParent, XGUI_Workshop *theWorkshop) setStyleSheet("::title { position: relative; padding-left: 5px; text-align: " "left center }"); - QWidget *aContent = new QWidget(this); - QGridLayout *aMainLayout = new QGridLayout(aContent); + auto *aContent = new QWidget(this); + auto *aMainLayout = new QGridLayout(aContent); aMainLayout->setContentsMargins(LayoutMargin, LayoutMargin, LayoutMargin, LayoutMargin); setWidget(aContent); @@ -131,7 +131,7 @@ XGUI_FacesPanel::XGUI_FacesPanel(QWidget *theParent, XGUI_Workshop *theWorkshop) } //******************************************************************** -void XGUI_FacesPanel::reset(const bool isToFlushRedisplay) { +void XGUI_FacesPanel::reset(const bool /*isToFlushRedisplay*/) { if (myLastItemIndex == 0) // do nothing because there was no activity in the pane after reset return; @@ -253,11 +253,10 @@ void XGUI_FacesPanel::restoreObjects( updateProcessedObjects(myItems, myItemObjects); // remove from container of hidden objects - for (std::set::const_iterator aHiddenIt = theHiddenObjects.begin(); - aHiddenIt != theHiddenObjects.end(); aHiddenIt++) { - if (myHiddenObjects.find(*aHiddenIt) != + for (const auto &theHiddenObject : theHiddenObjects) { + if (myHiddenObjects.find(theHiddenObject) != myHiddenObjects.end()) /// found objects - myHiddenObjects.erase(*aHiddenIt); + myHiddenObjects.erase(theHiddenObject); } } @@ -280,7 +279,7 @@ bool XGUI_FacesPanel::processAction(ModuleBase_ActionType theActionType) { //******************************************************************** void XGUI_FacesPanel::getObjectsMapFromResult( - ResultGroupPtr theResGroup, FeaturePtr theGroupFeature, + ResultGroupPtr /*theResGroup*/, FeaturePtr theGroupFeature, std::map &theObjectToShapes, std::map &theObjectToPrs) { XGUI_Displayer *aDisplayer = myWorkshop->displayer(); @@ -368,8 +367,7 @@ void XGUI_FacesPanel::processSelection() { std::map anObjectToPrs; std::set aToRemove; - for (int i = 0; i < aSelected.size(); i++) { - ModuleBase_ViewerPrsPtr aPrs = aSelected[i]; + for (auto aPrs : aSelected) { ObjectPtr anObject = aPrs->object(); if (!anObject.get()) continue; @@ -503,7 +501,7 @@ bool XGUI_FacesPanel::processDelete() { ResultGroupPtr aResGroup; FeaturePtr aGroupFeature; if (getGroup((*aIt), aResGroup, aGroupFeature)) { - std::set::iterator aGrpIt = myHiddenGroups.find(aResGroup); + auto aGrpIt = myHiddenGroups.find(aResGroup); if (aGrpIt != myHiddenGroups.end()) { aResGroup->setDisplayed(true); myHiddenGroups.erase(aGrpIt); @@ -541,9 +539,7 @@ bool XGUI_FacesPanel::redisplayObjects(const std::set &theObjects) { bool isModified = false; static Events_ID aDispEvent = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY); - for (std::set::const_iterator anIt = theObjects.begin(); - anIt != theObjects.end(); anIt++) { - ObjectPtr anObject = *anIt; + for (auto anObject : theObjects) { if (!anObject->isDisplayed()) continue; ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent); @@ -684,8 +680,7 @@ void XGUI_FacesPanel::onObjectDisplay(ObjectPtr theObject, } aIdsToRem.insert(aIt.key()); } else { - std::map::iterator aPIt = - aObjectToPrs.find(theObject); + auto aPIt = aObjectToPrs.find(theObject); if (aPIt != aObjectToPrs.end()) { ObjectPtr aObj = aPIt->first; if (aObj == theObject) { diff --git a/src/XGUI/XGUI_FacesPanel.h b/src/XGUI/XGUI_FacesPanel.h index ab1a57caf..4493a2f5b 100644 --- a/src/XGUI/XGUI_FacesPanel.h +++ b/src/XGUI/XGUI_FacesPanel.h @@ -77,7 +77,7 @@ public: /// Constructor /// \param theParent is a parent of the property panel XGUI_FacesPanel(QWidget *theParent, XGUI_Workshop *theWorkshop); - ~XGUI_FacesPanel() {} + ~XGUI_FacesPanel() override = default; /// Clear content of list widget /// \param isToFlushRedisplay flag if redisplay should be flushed immediatelly @@ -131,7 +131,7 @@ public: /// Processing focus in/out for the faces control /// \param theObject source object of event /// \param theEvent an event - virtual bool eventFilter(QObject *theObject, QEvent *theEvent); + bool eventFilter(QObject *theObject, QEvent *theEvent) override; XGUI_Workshop *workshop() const { return myWorkshop; } @@ -141,7 +141,7 @@ public slots: protected: /// Reimplementation to emit a signal about the panel close - virtual void closeEvent(QCloseEvent *theEvent); + void closeEvent(QCloseEvent *theEvent) override; signals: /// Signal about activating pane diff --git a/src/XGUI/XGUI_FacesPanelSelector.h b/src/XGUI/XGUI_FacesPanelSelector.h index 332d0c17b..a54acf600 100644 --- a/src/XGUI/XGUI_FacesPanelSelector.h +++ b/src/XGUI/XGUI_FacesPanelSelector.h @@ -38,24 +38,25 @@ public: /// \param thePanel the workshop faces panel XGUI_EXPORT XGUI_FacesPanelSelector(XGUI_FacesPanel *thePanel); /// Destructor - XGUI_EXPORT virtual ~XGUI_FacesPanelSelector(){}; + XGUI_EXPORT ~XGUI_FacesPanelSelector() override = default; + ; /// Returns name of the selector XGUI_EXPORT static QString Type() { return "XGUI_FacesPanelSelector"; } /// Returns name of the selector - XGUI_EXPORT virtual QString getType() { return Type(); } + XGUI_EXPORT QString getType() override { return Type(); } /// Set empty widget that need to be activated widget if it is not empty - XGUI_EXPORT virtual void reset(); + XGUI_EXPORT void reset() override; /// Sets control active. It should activates/deactivates selection and /// selection filters. \param isActive if true, the control becomes active - XGUI_EXPORT virtual void setActive(const bool &isActive); + XGUI_EXPORT void setActive(const bool &isActive) override; /// Processes current selection of workshop. Reaction to selection change in /// workshop. - XGUI_EXPORT virtual void processSelection(); + XGUI_EXPORT void processSelection() override; protected: XGUI_FacesPanel *myPanel; ///< processed panel diff --git a/src/XGUI/XGUI_HistoryMenu.cpp b/src/XGUI/XGUI_HistoryMenu.cpp index 67f13777e..6c70b7565 100644 --- a/src/XGUI/XGUI_HistoryMenu.cpp +++ b/src/XGUI/XGUI_HistoryMenu.cpp @@ -28,7 +28,7 @@ #include XGUI_HistoryMenu::XGUI_HistoryMenu(QAction *theParent) - : QMenu(NULL), myHistoryList(NULL) { + : QMenu(nullptr), myHistoryList(nullptr) { theParent->setMenu(this); initMenu(); @@ -36,7 +36,7 @@ XGUI_HistoryMenu::XGUI_HistoryMenu(QAction *theParent) } XGUI_HistoryMenu::XGUI_HistoryMenu(QToolButton *theParent) - : QMenu(theParent), myHistoryList(NULL) { + : QMenu(theParent), myHistoryList(nullptr) { theParent->setMenu(this); theParent->setPopupMode(QToolButton::MenuButtonPopup); @@ -45,7 +45,7 @@ XGUI_HistoryMenu::XGUI_HistoryMenu(QToolButton *theParent) void XGUI_HistoryMenu::initMenu() { myHistoryList = new QListWidget(this); - QWidgetAction *aListAction = new QWidgetAction(this); + auto *aListAction = new QWidgetAction(this); aListAction->setDefaultWidget(myHistoryList); this->addAction(aListAction); myHistoryList->setMouseTracking(true); // track mouse hover @@ -56,7 +56,7 @@ void XGUI_HistoryMenu::initMenu() { SLOT(onItemPressed(QListWidgetItem *))); } -XGUI_HistoryMenu::~XGUI_HistoryMenu() {} +XGUI_HistoryMenu::~XGUI_HistoryMenu() = default; void XGUI_HistoryMenu::setHistory(const QList &theActions) { myHistoryList->clear(); @@ -69,13 +69,13 @@ void XGUI_HistoryMenu::setHistory(const QList &theActions) { } void XGUI_HistoryMenu::leaveEvent(QEvent *theEvent) { - setStackSelectedTo(NULL); + setStackSelectedTo(nullptr); QMenu::leaveEvent(theEvent); } void XGUI_HistoryMenu::setStackSelectedTo(QListWidgetItem *theItem) { - QListWidgetItem *eachItem = NULL; - bool isSelect = theItem != NULL; + QListWidgetItem *eachItem = nullptr; + bool isSelect = theItem != nullptr; for (int aRow = 0; aRow < myHistoryList->count(); ++aRow) { eachItem = myHistoryList->item(aRow); myHistoryList->setItemSelected(eachItem, isSelect); @@ -91,7 +91,7 @@ void XGUI_HistoryMenu::setStackSelectedTo(QListWidgetItem *theItem) { void hideUpToMenuBar(QMenu *theMenu) { theMenu->hide(); foreach (QWidget *aWidget, theMenu->menuAction()->associatedWidgets()) { - QMenu *aMenu = qobject_cast(aWidget); + auto *aMenu = qobject_cast(aWidget); if (aMenu) { aMenu->hide(); hideUpToMenuBar(aMenu); diff --git a/src/XGUI/XGUI_HistoryMenu.h b/src/XGUI/XGUI_HistoryMenu.h index fb0e865c1..154d2e9f4 100644 --- a/src/XGUI/XGUI_HistoryMenu.h +++ b/src/XGUI/XGUI_HistoryMenu.h @@ -43,7 +43,7 @@ public: explicit XGUI_HistoryMenu(QToolButton *theParent); /// Creates history menu for action explicit XGUI_HistoryMenu(QAction *theParent); - virtual ~XGUI_HistoryMenu(); + ~XGUI_HistoryMenu() override; signals: /// Signal. Emited then n-th action is selected in stack @@ -55,7 +55,7 @@ public slots: protected: /// Unselects all items when cursor leaves the list - virtual void leaveEvent(QEvent *); + void leaveEvent(QEvent *) override; protected slots: /// Selects all items in stack to the given item including it diff --git a/src/XGUI/XGUI_InspectionPanel.cpp b/src/XGUI/XGUI_InspectionPanel.cpp index e7ccba0dc..aa2cf8ff7 100644 --- a/src/XGUI/XGUI_InspectionPanel.cpp +++ b/src/XGUI/XGUI_InspectionPanel.cpp @@ -64,11 +64,11 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget *theParent, myStackWgt = new QStackedWidget(this); // Create shape selection page - QSplitter *aSplitter = new QSplitter(Qt::Vertical, myStackWgt); + auto *aSplitter = new QSplitter(Qt::Vertical, myStackWgt); // Create an internal widget - QWidget *aNameWgt = new QWidget(aSplitter); - QHBoxLayout *aNameLayout = new QHBoxLayout(aNameWgt); + auto *aNameWgt = new QWidget(aSplitter); + auto *aNameLayout = new QHBoxLayout(aNameWgt); aNameLayout->setContentsMargins(3, 0, 3, 0); aNameLayout->addWidget(new QLabel(tr("Object"), aNameWgt)); myNameEdt = new QLineEdit(aNameWgt); @@ -91,12 +91,12 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget *theParent, << tr("VERTEX"); int i = 0; foreach (QString aType, aSubShapes) { - QTableWidgetItem *aItem = new QTableWidgetItem(aType); + auto *aItem = new QTableWidgetItem(aType); aItem->setFlags(Qt::ItemIsEnabled); mySubShapesTab->setItem(i++, 0, aItem); } for (i = 0; i < 9; i++) { - QTableWidgetItem *aItem = new QTableWidgetItem(""); + auto *aItem = new QTableWidgetItem(""); aItem->setFlags(Qt::ItemIsEnabled); aItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); mySubShapesTab->setItem(i, 1, aItem); @@ -107,8 +107,8 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget *theParent, aSplitter->addWidget(mySubShapesTab); // Type of object - QWidget *aTypeWgt = new QWidget(aSplitter); - QHBoxLayout *aTypeLayout = new QHBoxLayout(aTypeWgt); + auto *aTypeWgt = new QWidget(aSplitter); + auto *aTypeLayout = new QHBoxLayout(aTypeWgt); aTypeLayout->setContentsMargins(3, 0, 3, 0); aTypeLayout->addWidget(new QLabel(tr("Type:"), aTypeWgt)); @@ -136,7 +136,7 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget *theParent, myShapePanelId = myStackWgt->addWidget(aSplitter); // Create feature selection page - QScrollArea *aScroll = new QScrollArea(myStackWgt); + auto *aScroll = new QScrollArea(myStackWgt); aScroll->setWidgetResizable(true); aScroll->setFrameStyle(QFrame::NoFrame); @@ -154,7 +154,7 @@ XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget *theParent, } //******************************************************************** -XGUI_InspectionPanel::~XGUI_InspectionPanel() {} +XGUI_InspectionPanel::~XGUI_InspectionPanel() = default; //******************************************************************** void XGUI_InspectionPanel::setSubShapeValue(SudShape theId, int theVal) { diff --git a/src/XGUI/XGUI_InspectionPanel.h b/src/XGUI/XGUI_InspectionPanel.h index d3e294380..2d14b7b44 100644 --- a/src/XGUI/XGUI_InspectionPanel.h +++ b/src/XGUI/XGUI_InspectionPanel.h @@ -76,13 +76,13 @@ public: XGUI_InspectionPanel(QWidget *theParent, XGUI_Workshop *theWorkshop); // Destructor - virtual ~XGUI_InspectionPanel(); + ~XGUI_InspectionPanel() override; // A translator of resource strings, needed for ShapeInfo. - virtual std::string translate(const char *theSource) override; + std::string translate(const char *theSource) override; protected: - virtual void showEvent(QShowEvent *theEvent); + void showEvent(QShowEvent *theEvent) override; private slots: /// A slot to react on selection changed diff --git a/src/XGUI/XGUI_MenuGroup.h b/src/XGUI/XGUI_MenuGroup.h index 9af74c491..c8330e9d7 100644 --- a/src/XGUI/XGUI_MenuGroup.h +++ b/src/XGUI/XGUI_MenuGroup.h @@ -44,7 +44,7 @@ class XGUI_EXPORT XGUI_MenuGroup { public: /// Constructor XGUI_MenuGroup(const std::string &theName); - virtual ~XGUI_MenuGroup() {} + virtual ~XGUI_MenuGroup() = default; /// Returns a name of the workbench /// \return workbench name diff --git a/src/XGUI/XGUI_MenuMgr.cpp b/src/XGUI/XGUI_MenuMgr.cpp index 2f852c6b3..0b9d4b6e5 100644 --- a/src/XGUI/XGUI_MenuMgr.cpp +++ b/src/XGUI/XGUI_MenuMgr.cpp @@ -177,17 +177,13 @@ void XGUI_MenuMgr::createFeatureActions() { std::string aWchName = aWorkbench->getName(); const std::list> &aGroups = aWorkbench->groups(); - std::list>::const_iterator - aGIt = aGroups.begin(), - aGLast = aGroups.end(); + auto aGIt = aGroups.begin(), aGLast = aGroups.end(); for (; aGIt != aGLast; aGIt++) { const std::shared_ptr aGroup = *aGIt; std::string aGName = aGroup->getName(); const std::list> &aFeaturesInfo = aGroup->featuresInfo(); - std::list>::const_iterator - aFIt = aFeaturesInfo.begin(), - aFLast = aFeaturesInfo.end(); + auto aFIt = aFeaturesInfo.begin(), aFLast = aFeaturesInfo.end(); size_t aFSize = aFeaturesInfo.size(); for (size_t i = 0; aFIt != aFLast; aFIt++, i++) { std::shared_ptr aMessage = *aFIt; @@ -207,7 +203,7 @@ void XGUI_MenuMgr::createFeatureActions() { QAction *XGUI_MenuMgr::buildAction( const std::shared_ptr &theMessage, const std::string &theWchName, const bool aUseSeparator) const { - QAction *anAction = 0; + QAction *anAction = nullptr; #ifdef HAVE_SALOME XGUI_SalomeConnector *aSalomeConnector = myWorkshop->salomeConnector(); diff --git a/src/XGUI/XGUI_MenuMgr.h b/src/XGUI/XGUI_MenuMgr.h index fcd6618eb..2eb1bf1a7 100644 --- a/src/XGUI/XGUI_MenuMgr.h +++ b/src/XGUI/XGUI_MenuMgr.h @@ -47,15 +47,15 @@ public: /// Constructor /// \param theWorkshop the current workshop XGUI_EXPORT XGUI_MenuMgr(XGUI_Workshop *theWorkshop); - XGUI_EXPORT virtual ~XGUI_MenuMgr() {} + XGUI_EXPORT ~XGUI_MenuMgr() override = default; /// Creates feature actions XGUI_EXPORT void createFeatureActions(); /// Redefinition of Events_Listener method /// \param theMessage a message - XGUI_EXPORT virtual void - processEvent(const std::shared_ptr &theMessage); + XGUI_EXPORT void + processEvent(const std::shared_ptr &theMessage) override; protected: /// Process event "Add a feature" diff --git a/src/XGUI/XGUI_MenuWorkbench.h b/src/XGUI/XGUI_MenuWorkbench.h index 71ecf11fe..692ce682a 100644 --- a/src/XGUI/XGUI_MenuWorkbench.h +++ b/src/XGUI/XGUI_MenuWorkbench.h @@ -45,7 +45,7 @@ public: /// Constructor XGUI_MenuWorkbench(const std::string &theName); /// Destructor - virtual ~XGUI_MenuWorkbench() {} + virtual ~XGUI_MenuWorkbench() = default; /// Returns a name of the workbench /// \return workbench name diff --git a/src/XGUI/XGUI_ModuleConnector.cpp b/src/XGUI/XGUI_ModuleConnector.cpp index 29e4e18c6..a1c49f707 100644 --- a/src/XGUI/XGUI_ModuleConnector.cpp +++ b/src/XGUI/XGUI_ModuleConnector.cpp @@ -50,7 +50,7 @@ XGUI_ModuleConnector::XGUI_ModuleConnector(XGUI_Workshop *theWorkshop) SIGNAL(selectionChanged())); } -XGUI_ModuleConnector::~XGUI_ModuleConnector() {} +XGUI_ModuleConnector::~XGUI_ModuleConnector() = default; ModuleBase_ISelection *XGUI_ModuleConnector::selection() const { return myWorkshop->selector()->selection(); @@ -134,7 +134,7 @@ void XGUI_ModuleConnector::processLaunchOperation( XGUI_OperationMgr *anOperationMgr = workshop()->operationMgr(); if (anOperationMgr->startOperation(theOperation)) { - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(theOperation); if (aFOperation) { workshop()->propertyPanel()->updateContentWidget(aFOperation->feature()); diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index b03f36891..70d257ab7 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -66,12 +66,12 @@ public: /// Set data for item editor (name of the item) /// \param editor a widget of editor /// \param index the tree item index - virtual void setEditorData(QWidget *editor, const QModelIndex &index) const { - QLineEdit *aEditor = dynamic_cast(editor); + void setEditorData(QWidget *editor, const QModelIndex &index) const override { + auto *aEditor = dynamic_cast(editor); if (aEditor) { XGUI_DataModel *aModel = myTreedView->dataModel(); ObjectPtr aObj = aModel->object(index); - if (aObj.get() != NULL) { + if (aObj.get() != nullptr) { aEditor->setText(QString::fromStdWString(aObj->data()->name())); return; } @@ -103,7 +103,7 @@ XGUI_DataTree::XGUI_DataTree(QWidget *theParent) : QTreeView(theParent) { SLOT(onDoubleClick(const QModelIndex &))); } -XGUI_DataTree::~XGUI_DataTree() {} +XGUI_DataTree::~XGUI_DataTree() = default; XGUI_DataModel *XGUI_DataTree::dataModel() const { return static_cast(model()); @@ -119,7 +119,7 @@ void XGUI_DataTree::commitData(QWidget *theEditor) { // We have to check number of enter and exit of this function because it can // be called recursively by Qt in order to avoid double modifying of a data aEntrance = 1; - QLineEdit *aEditor = dynamic_cast(theEditor); + auto *aEditor = dynamic_cast(theEditor); if (aEditor) { QString aName = aEditor->text(); QModelIndexList aIndexList = selectionModel()->selectedIndexes(); @@ -226,14 +226,12 @@ void XGUI_DataTree::processHistoryChange(const QModelIndex &theIndex) { update(aModel->index(i, 1, aParent)); update(aModel->index(i, 2, aParent)); } - XGUI_ObjectsBrowser *aObjBrowser = - qobject_cast(parent()); + auto *aObjBrowser = qobject_cast(parent()); aObjBrowser->workshop()->displayer()->updateViewer(); } void XGUI_DataTree::processEyeClick(const QModelIndex &theIndex) { - XGUI_ObjectsBrowser *aObjBrowser = - qobject_cast(parent()); + auto *aObjBrowser = qobject_cast(parent()); XGUI_DataModel *aModel = dataModel(); ObjectPtr aObj = aModel->object(theIndex); if (aObj.get()) { @@ -359,20 +357,20 @@ void XGUI_ActiveDocLbl::unselect() { //******************************************************************** XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget *theParent, XGUI_Workshop *theWorkshop) - : QWidget(theParent), myDocModel(0), myWorkshop(theWorkshop) { - QVBoxLayout *aLayout = new QVBoxLayout(this); + : QWidget(theParent), myDocModel(nullptr), myWorkshop(theWorkshop) { + auto *aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); aLayout->setSpacing(0); - QWidget *aLabelWgt = new QWidget(this); + auto *aLabelWgt = new QWidget(this); aLabelWgt->setAutoFillBackground(true); aLayout->addWidget(aLabelWgt); - QHBoxLayout *aLabelLay = new QHBoxLayout(aLabelWgt); + auto *aLabelLay = new QHBoxLayout(aLabelWgt); ModuleBase_Tools::zeroMargins(aLabelLay); aLabelLay->setSpacing(0); - QLabel *aLbl = new QLabel(aLabelWgt); + auto *aLbl = new QLabel(aLabelWgt); aLbl->setPixmap(QPixmap(":pictures/assembly.png")); aLbl->setMargin(2); // Do not paint background of the label (in order to show icon) @@ -412,7 +410,7 @@ XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget *theParent, } //*************************************************** -XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser() {} +XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser() = default; void XGUI_ObjectsBrowser::initialize(ModuleBase_ITreeNode *theRoot) { // myDocModel->setXMLReader(theReader); diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 3f15d12ab..bc13eb76a 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -73,13 +73,13 @@ public: myIsActive(false) { qApp->installEventFilter(this); } - ~XGUI_ShortCutListener() {} + ~XGUI_ShortCutListener() override = default; /// Switch on short cut listener void setActive(const bool theIsActive) { myIsActive = theIsActive; } /// Redefinition of virtual function to process Delete key release - virtual bool eventFilter(QObject *theObject, QEvent *theEvent); + bool eventFilter(QObject *theObject, QEvent *theEvent) override; private: XGUI_OperationMgr *myOperationMgr; /// processor for key event @@ -101,7 +101,7 @@ bool XGUI_ShortCutListener::eventFilter(QObject *theObject, QEvent *theEvent) { } if (aName == "NoModal") { if (theEvent->type() == QEvent::KeyRelease) { - QKeyEvent *aKeyEvent = dynamic_cast(theEvent); + auto *aKeyEvent = dynamic_cast(theEvent); if (aKeyEvent) { myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() & Qt::ShiftModifier); @@ -129,7 +129,7 @@ bool XGUI_ShortCutListener::eventFilter(QObject *theObject, QEvent *theEvent) { } } else if (theEvent->type() == QEvent::KeyPress) { if (myOperationMgr->hasOperation()) { - QKeyEvent *aKeyEvent = dynamic_cast(theEvent); + auto *aKeyEvent = dynamic_cast(theEvent); myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() & Qt::ShiftModifier); isAccepted = myOperationMgr->onKeyPressed(theObject, aKeyEvent); @@ -144,7 +144,7 @@ bool XGUI_ShortCutListener::eventFilter(QObject *theObject, QEvent *theEvent) { XGUI_OperationMgr::XGUI_OperationMgr(QObject *theParent, ModuleBase_IWorkshop *theWorkshop) - : QObject(theParent), myWorkshop(theWorkshop), myActiveMessageBox(0), + : QObject(theParent), myWorkshop(theWorkshop), myActiveMessageBox(nullptr), mySHIFTPressed(false) { /// we need to install filter to the application in order to react to 'Delete' /// key button this key can not be a short cut for a corresponded action @@ -152,7 +152,7 @@ XGUI_OperationMgr::XGUI_OperationMgr(QObject *theParent, myShortCutListener = new XGUI_ShortCutListener(this); } -XGUI_OperationMgr::~XGUI_OperationMgr() {} +XGUI_OperationMgr::~XGUI_OperationMgr() = default; void XGUI_OperationMgr::activate() { myShortCutListener->setActive(true); } @@ -189,7 +189,7 @@ XGUI_OperationMgr::findOperation(const QString &theId) const { if (anOperation->id() == theId) return anOperation; } - return 0; + return nullptr; } int XGUI_OperationMgr::operationsCount() const { return myOperations.count(); } @@ -197,7 +197,7 @@ int XGUI_OperationMgr::operationsCount() const { return myOperations.count(); } QStringList XGUI_OperationMgr::operationList() const { QStringList result; foreach (ModuleBase_Operation *eachOperation, myOperations) { - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(eachOperation); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); @@ -213,13 +213,13 @@ ModuleBase_Operation * XGUI_OperationMgr::previousOperation(ModuleBase_Operation *theOperation) const { int idx = myOperations.lastIndexOf(theOperation); if (idx == -1 || idx == 0) { - return NULL; + return nullptr; } return myOperations.at(idx - 1); } ModuleBase_ModelWidget *XGUI_OperationMgr::activeWidget() const { - ModuleBase_ModelWidget *anActiveWidget = 0; + ModuleBase_ModelWidget *anActiveWidget = nullptr; ModuleBase_Operation *anOperation = currentOperation(); if (anOperation) { ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel(); @@ -271,13 +271,13 @@ bool XGUI_OperationMgr::abortAllOperations( myActiveMessageBox = createMessageBox(tr("All active operations will be aborted.")); aResult = myActiveMessageBox->exec() == QMessageBox::Ok; - myActiveMessageBox = 0; + myActiveMessageBox = nullptr; } else if (theMessageKind == XGUI_InformationMessage) { QString aMessage = tr("Please validate all your active operations before saving."); myActiveMessageBox = createInformationBox(aMessage); myActiveMessageBox->exec(); - myActiveMessageBox = 0; + myActiveMessageBox = nullptr; aResult = false; // do not perform abort } while (aResult && hasOperation()) { @@ -297,7 +297,7 @@ bool XGUI_OperationMgr::commitAllOperations() { abortOperation(anOperation); anOperationProcessed = true; } - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(anOperation); if (aFOperation) { FeaturePtr aFeature = aFOperation->feature(); @@ -320,7 +320,7 @@ bool XGUI_OperationMgr::commitAllOperations() { void XGUI_OperationMgr::onValidateOperation() { if (!hasOperation()) return; - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(currentOperation()); if (aFOperation && aFOperation->feature().get()) XGUI_Tools::workshop(myWorkshop) @@ -332,7 +332,7 @@ void XGUI_OperationMgr::updateApplyOfOperations( ModuleBase_Operation *theOperation) { XGUI_ErrorMgr *anErrorMgr = XGUI_Tools::workshop(myWorkshop)->errorMgr(); if (theOperation) { - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(theOperation); if (aFOperation) anErrorMgr->updateAcceptAllAction(aFOperation->feature()); @@ -353,8 +353,7 @@ bool XGUI_OperationMgr::canStopOperation( if (isGrantedOperation(theOperation->id())) return true; if (theOperation && theOperation->isModified()) { - ModuleBase_OperationFeature *aOp = - dynamic_cast(theOperation); + auto *aOp = dynamic_cast(theOperation); std::string aContext; if (aOp && aOp->feature()) aContext = aOp->feature()->getKind(); @@ -368,14 +367,14 @@ bool XGUI_OperationMgr::canStopOperation( QString aMessage = tr("%1 operation will be aborted.").arg(aTitle); myActiveMessageBox = createMessageBox(aMessage); bool aResult = myActiveMessageBox->exec() == QMessageBox::Ok; - myActiveMessageBox = 0; + myActiveMessageBox = nullptr; return aResult; } else if (theMessageKind == XGUI_InformationMessage) { QString aMessage = tr("Please validate your %1 before saving.").arg(aTitle); myActiveMessageBox = createInformationBox(aMessage); myActiveMessageBox->exec(); - myActiveMessageBox = 0; + myActiveMessageBox = nullptr; return false; } } @@ -496,13 +495,12 @@ void XGUI_OperationMgr::onAbortOperation() { void XGUI_OperationMgr::onAbortAllOperation() { abortAllOperations(); } void XGUI_OperationMgr::onBeforeOperationStarted() { - ModuleBase_Operation *aCurrentOperation = - dynamic_cast(sender()); + auto *aCurrentOperation = dynamic_cast(sender()); if (!aCurrentOperation) return; /// Set current feature and remeber old current feature - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(aCurrentOperation); if (aFOperation) { SessionPtr aMgr = ModelAPI_Session::get(); @@ -560,8 +558,7 @@ void XGUI_OperationMgr::onBeforeOperationStarted() { } void XGUI_OperationMgr::onOperationStarted() { - ModuleBase_Operation *aSenderOperation = - dynamic_cast(sender()); + auto *aSenderOperation = dynamic_cast(sender()); updateApplyOfOperations(aSenderOperation); XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); aWorkshop->operationStarted(aSenderOperation); @@ -572,21 +569,19 @@ void XGUI_OperationMgr::onBeforeOperationAborted() { } void XGUI_OperationMgr::onOperationAborted() { - ModuleBase_Operation *aSenderOperation = - dynamic_cast(sender()); + auto *aSenderOperation = dynamic_cast(sender()); XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop); aWorkshop->setStatusBarMessage(""); emit operationAborted(aSenderOperation); } void XGUI_OperationMgr::onBeforeOperationCommitted() { - ModuleBase_Operation *aCurrentOperation = - dynamic_cast(sender()); + auto *aCurrentOperation = dynamic_cast(sender()); if (!aCurrentOperation) return; /// Restore the previous current feature - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(aCurrentOperation); if (aFOperation) { #ifdef DEBUG_CURRENT_FEATURE @@ -628,20 +623,17 @@ void XGUI_OperationMgr::onOperationCommitted() { // apply state for all features from the stack of operations should be updated updateApplyOfOperations(); - ModuleBase_Operation *aSenderOperation = - dynamic_cast(sender()); + auto *aSenderOperation = dynamic_cast(sender()); emit operationCommitted(aSenderOperation); } void XGUI_OperationMgr::onOperationResumed() { - ModuleBase_Operation *aSenderOperation = - dynamic_cast(sender()); + auto *aSenderOperation = dynamic_cast(sender()); emit operationResumed(aSenderOperation); } void XGUI_OperationMgr::onOperationStopped() { - ModuleBase_Operation *aSenderOperation = - dynamic_cast(sender()); + auto *aSenderOperation = dynamic_cast(sender()); ModuleBase_Operation *aCurrentOperation = currentOperation(); if (!aSenderOperation || !aCurrentOperation || aSenderOperation != aCurrentOperation) @@ -653,7 +645,7 @@ void XGUI_OperationMgr::onOperationStopped() { emit operationStopped(aCurrentOperation); // get last operation which can be resumed - ModuleBase_Operation *aResultOp = 0; + ModuleBase_Operation *aResultOp = nullptr; QListIterator anIt(myOperations); anIt.toBack(); while (anIt.hasPrevious()) { @@ -689,7 +681,7 @@ bool XGUI_OperationMgr::onKeyReleased(QObject *theObject, QKeyEvent *theEvent) { if (!isPPChildObject) { // check for case when the operation is started but property panel is // not filled - XGUI_PropertyPanel *aPP = dynamic_cast(aPanel); + auto *aPP = dynamic_cast(aPanel); aPP->setFocusNextPrevChild(theEvent->key() == Qt::Key_Tab); isAccepted = true; } @@ -731,7 +723,8 @@ bool XGUI_OperationMgr::onKeyReleased(QObject *theObject, QKeyEvent *theEvent) { return isAccepted; } -bool XGUI_OperationMgr::onKeyPressed(QObject *theObject, QKeyEvent *theEvent) { +bool XGUI_OperationMgr::onKeyPressed(QObject * /*theObject*/, + QKeyEvent *theEvent) { // Let the manager decide what to do with the given key combination. bool isAccepted = false; switch (theEvent->key()) { @@ -750,7 +743,7 @@ bool XGUI_OperationMgr::onKeyPressed(QObject *theObject, QKeyEvent *theEvent) { if (anActiveWgt) { isAccepted = anActiveWgt && anActiveWgt->processAction(ActionEscape); if (isAccepted) { - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(currentOperation()); if (aFOperation) aFOperation->setNeedToBeAborted(true); @@ -783,7 +776,7 @@ bool XGUI_OperationMgr::onKeyPressed(QObject *theObject, QKeyEvent *theEvent) { return isAccepted; } -bool XGUI_OperationMgr::onProcessEnter(QObject *theObject) { +bool XGUI_OperationMgr::onProcessEnter(QObject * /*theObject*/) { bool isAccepted = false; ModuleBase_Operation *aOperation = currentOperation(); // to avoid enter processing when operation has not been started yet @@ -819,7 +812,7 @@ bool XGUI_OperationMgr::onProcessEnter(QObject *theObject) { anActiveWgt ? anActiveWgt->attributeID() : ""); if (!isAccepted) { /// functionality is similar to Apply click - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(currentOperation()); if (!aFOperation || myWorkshop->module() ->getFeatureError(aFOperation->feature()) @@ -838,14 +831,14 @@ bool XGUI_OperationMgr::onProcessEnter(QObject *theObject) { } bool editorControl(QObject *theObject) { - QLineEdit *aLineEdit = dynamic_cast(theObject); + auto *aLineEdit = dynamic_cast(theObject); return aLineEdit; } bool XGUI_OperationMgr::onProcessDelete(QObject *theObject) { bool isAccepted = false; ModuleBase_Operation *aOperation = currentOperation(); - ModuleBase_ModelWidget *anActiveWgt = 0; + ModuleBase_ModelWidget *anActiveWgt = nullptr; // firstly the widget should process Delete action ModuleBase_IPropertyPanel *aPanel; bool isPPChildObject = false; @@ -912,7 +905,7 @@ bool XGUI_OperationMgr::isChildObject(const QObject *theObject, const QObject *theParent) { bool isPPChild = false; if (theParent && theObject) { - QObject *aParent = (QObject *)theObject; + auto *aParent = (QObject *)theObject; while (aParent) { isPPChild = aParent == theParent; if (isPPChild) @@ -924,7 +917,7 @@ bool XGUI_OperationMgr::isChildObject(const QObject *theObject, } QMessageBox *XGUI_OperationMgr::createMessageBox(const QString &theMessage) { - QMessageBox *aMessageBox = new QMessageBox( + auto *aMessageBox = new QMessageBox( QMessageBox::Question, QObject::tr("Abort operation"), theMessage, QMessageBox::Ok | QMessageBox::Cancel, qApp->activeWindow()); aMessageBox->setDefaultButton(QMessageBox::Cancel); @@ -936,7 +929,7 @@ QMessageBox *XGUI_OperationMgr::createMessageBox(const QString &theMessage) { QMessageBox * XGUI_OperationMgr::createInformationBox(const QString &theMessage) { - QMessageBox *aMessageBox = + auto *aMessageBox = new QMessageBox(QMessageBox::Question, QObject::tr("Validate operation"), theMessage, QMessageBox::Ok, qApp->activeWindow()); aMessageBox->setDefaultButton(QMessageBox::Ok); @@ -947,6 +940,6 @@ XGUI_OperationMgr::createInformationBox(const QString &theMessage) { } XGUI_Workshop *XGUI_OperationMgr::xworkshop() const { - XGUI_ModuleConnector *aConnector = (XGUI_ModuleConnector *)myWorkshop; + auto *aConnector = (XGUI_ModuleConnector *)myWorkshop; return aConnector->workshop(); } diff --git a/src/XGUI/XGUI_PropertyDialog.cpp b/src/XGUI/XGUI_PropertyDialog.cpp index 3aa0ea33a..2b2faff37 100644 --- a/src/XGUI/XGUI_PropertyDialog.cpp +++ b/src/XGUI/XGUI_PropertyDialog.cpp @@ -28,10 +28,10 @@ XGUI_PropertyDialog::XGUI_PropertyDialog(QWidget *theParent) : QDialog(theParent, Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint), - myContentWidget(0) { + myContentWidget(nullptr) { myLayout = new QGridLayout(this); - QDialogButtonBox *aButtons = new QDialogButtonBox( + auto *aButtons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); connect(aButtons, SIGNAL(accepted()), this, SLOT(accept())); connect(aButtons, SIGNAL(rejected()), this, SLOT(reject())); diff --git a/src/XGUI/XGUI_PropertyDialog.h b/src/XGUI/XGUI_PropertyDialog.h index 40cec6d2e..c0c7849f8 100644 --- a/src/XGUI/XGUI_PropertyDialog.h +++ b/src/XGUI/XGUI_PropertyDialog.h @@ -37,7 +37,8 @@ public: /// \param theParent a parent widget for the dialog XGUI_EXPORT XGUI_PropertyDialog(QWidget *theParent); - XGUI_EXPORT virtual ~XGUI_PropertyDialog(){}; + XGUI_EXPORT ~XGUI_PropertyDialog() override = default; + ; /// Set content of the dialog /// \param theWidget a content widget diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index c8ea77b5c..8b795aaf9 100644 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -66,26 +66,26 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget *theParent, XGUI_OperationMgr *theMgr) - : ModuleBase_IPropertyPanel(theParent), myPanelPage(NULL), - myActiveWidget(NULL), myPreselectionWidget(NULL), - myInternalActiveWidget(NULL), myOperationMgr(theMgr) { + : ModuleBase_IPropertyPanel(theParent), myPanelPage(nullptr), + myActiveWidget(nullptr), myPreselectionWidget(nullptr), + myInternalActiveWidget(nullptr), myOperationMgr(theMgr) { setWindowTitle(tr("Property Panel")); // MAYBE_UNUSED QAction* aViewAct = toggleViewAction(); setObjectName(PROP_PANEL); setStyleSheet("::title { position: relative; padding-left: 5px; text-align: " "left center }"); - QWidget *aContent = new QWidget(this); - QGridLayout *aMainLayout = new QGridLayout(aContent); + auto *aContent = new QWidget(this); + auto *aMainLayout = new QGridLayout(aContent); const int kPanelColumn = 0; int aPanelRow = 0; aMainLayout->setContentsMargins(3, 3, 3, 3); setWidget(aContent); - QFrame *aFrm = new QFrame(aContent); + auto *aFrm = new QFrame(aContent); aFrm->setFrameStyle(QFrame::Raised); aFrm->setFrameShape(QFrame::Panel); - QHBoxLayout *aBtnLay = new QHBoxLayout(aFrm); + auto *aBtnLay = new QHBoxLayout(aFrm); ModuleBase_Tools::zeroMargins(aBtnLay); aMainLayout->addWidget(aFrm, aPanelRow++, kPanelColumn); @@ -95,7 +95,7 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget *theParent, aBtnNames << QString(PROP_PANEL_HELP) << QString(PROP_PANEL_OK) << QString(PROP_PANEL_OK_PLUS) << QString(PROP_PANEL_CANCEL); foreach (QString eachBtnName, aBtnNames) { - QToolButton *aBtn = new QToolButton(aFrm); + auto *aBtn = new QToolButton(aFrm); aBtn->setObjectName(eachBtnName); aBtn->setAutoRaise(true); aBtnLay->addWidget(aBtn); @@ -117,12 +117,12 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget *theParent, ModuleBase_Tools::zeroMargins(aBtnLay); aMainLayout->addWidget(aFrm, aPanelRow++, kPanelColumn); - QToolButton *aBtn = new QToolButton(aFrm); + auto *aBtn = new QToolButton(aFrm); aBtn->setObjectName(PROP_PANEL_PREVIEW); aBtnLay->addWidget(aBtn); } -XGUI_PropertyPanel::~XGUI_PropertyPanel() {} +XGUI_PropertyPanel::~XGUI_PropertyPanel() = default; void XGUI_PropertyPanel::cleanContent() { if (myActiveWidget) @@ -151,7 +151,7 @@ void XGUI_PropertyPanel::cleanContent() { myWidgets.clear(); myPanelPage->clearPage(); - myActiveWidget = NULL; + myActiveWidget = nullptr; emit propertyPanelDeactivated(); // VSV: It seems that this code is not necessary: // it is called on propertyPanelDeactivated() event @@ -193,7 +193,7 @@ ModuleBase_PageBase *XGUI_PropertyPanel::contentWidget() { void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature) { // Invalid feature case on abort of the operation - if (theFeature.get() == NULL) + if (theFeature.get() == nullptr) return; if (theFeature->isAction() || !theFeature->data()) return; @@ -208,7 +208,7 @@ void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature) { void XGUI_PropertyPanel::createContentPanel(FeaturePtr theFeature) { // Invalid feature case on abort of the operation - if (theFeature.get() == NULL) + if (theFeature.get() == nullptr) return; if (theFeature->isAction() || !theFeature->data()) return; @@ -226,8 +226,7 @@ void XGUI_PropertyPanel::createContentPanel(FeaturePtr theFeature) { // Apply button should be update if the feature was modified by the panel myOperationMgr->onValidateOperation(); } - ModuleBase_OperationFeature *aFeatureOp = - dynamic_cast(anOperation); + auto *aFeatureOp = dynamic_cast(anOperation); if (aFeatureOp && (!aFeatureOp->isEditOperation())) updateApplyPlusButton(theFeature); else @@ -289,7 +288,7 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget *theWidget, const bool isCheckVisibility) { // TO CHECK: Editing operation does not have automatical activation of widgets if (isEditingMode()) { - activateWidget(NULL); + activateWidget(nullptr); return; } ModelAPI_ValidatorsFactory *aValidators = @@ -329,7 +328,7 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget *theWidget, // widgets it should be performed before activateWidget(NULL) because it emits // some signals which can be processed by moudule for example as to activate // another widget with setting focus - QWidget *aNewFocusWidget = 0; + QWidget *aNewFocusWidget = nullptr; QToolButton *anOkBtn = findButton(PROP_PANEL_OK); if (anOkBtn->isEnabled()) aNewFocusWidget = anOkBtn; @@ -342,11 +341,11 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget *theWidget, ModuleBase_Tools::setFocus(aNewFocusWidget, "XGUI_PropertyPanel::activateNextWidget"); - activateWidget(NULL); + activateWidget(nullptr); } void findDirectChildren(QWidget *theParent, QList &theWidgets, - const bool theDebug) { + const bool /*theDebug*/) { QList aWidgets; if (theParent) { @@ -354,7 +353,7 @@ void findDirectChildren(QWidget *theParent, QList &theWidgets, if (aLayout) { for (int i = 0, aCount = aLayout->count(); i < aCount; i++) { QLayoutItem *anItem = aLayout->itemAt(i); - QWidget *aWidget = anItem ? anItem->widget() : 0; + QWidget *aWidget = anItem ? anItem->widget() : nullptr; if (aWidget) { if (aWidget->isVisible()) { if (aWidget->focusPolicy() != Qt::NoFocus) @@ -365,7 +364,7 @@ void findDirectChildren(QWidget *theParent, QList &theWidgets, QLayout *anItemLayout = anItem->layout(); for (int it = 0, cnt = anItemLayout->count(); it < cnt; it++) { QLayoutItem *aCurItem = anItemLayout->itemAt(it); - QWidget *aCurWidget = aCurItem ? aCurItem->widget() : 0; + QWidget *aCurWidget = aCurItem ? aCurItem->widget() : nullptr; if (aCurWidget) { if (aCurWidget->isVisible()) { if (aCurWidget->focusPolicy() != Qt::NoFocus) @@ -424,7 +423,7 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) { // if (aFocusMWidget) // aFocusMWidget->setHighlighted(false); - QWidget *aNewFocusWidget = 0; + QWidget *aNewFocusWidget = nullptr; if (aFocusWidget) { QList aChildren; findDirectChildren(this, aChildren, true); @@ -467,7 +466,7 @@ bool XGUI_PropertyPanel::focusNextPrevChild(bool theIsNext) { QWidget *aLastFocusControl = myActiveWidget->getControlAcceptingFocus(isFirstControl); if (aFocusWidget == aLastFocusControl) { - setActiveWidget(NULL, false); + setActiveWidget(nullptr, false); } } @@ -512,7 +511,8 @@ bool XGUI_PropertyPanel::setActiveWidget(ModuleBase_ModelWidget *theWidget, return false; } std::string aPreviosAttributeID; - ModuleBase_ModelWidget *aDeactivatedWidget = NULL, *anActivatedWidget = NULL; + ModuleBase_ModelWidget *aDeactivatedWidget = nullptr, + *anActivatedWidget = nullptr; if (myActiveWidget) { aPreviosAttributeID = myActiveWidget->attributeID(); myActiveWidget->processValueState(); @@ -618,7 +618,7 @@ void XGUI_PropertyPanel::setInternalActiveWidget( } else { if (myInternalActiveWidget) { delete myInternalActiveWidget; - myInternalActiveWidget = 0; + myInternalActiveWidget = nullptr; } emit propertyPanelDeactivated(); } diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index c959ebdc8..dc01b2d01 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -66,10 +66,10 @@ public: /// \param theMgr operation manager XGUI_PropertyPanel(QWidget *theParent, XGUI_OperationMgr *theMgr); - virtual ~XGUI_PropertyPanel(); + ~XGUI_PropertyPanel() override; /// Returns header widget - virtual QWidget *headerWidget() const { return myHeaderWidget; } + QWidget *headerWidget() const override { return myHeaderWidget; } /// Returns main widget of the property panel, which children will be created /// by WidgetFactory using the XML definition @@ -80,49 +80,49 @@ public: void setModelWidgets(const QList &theWidgets); /// Returns all property panel's widget created by WidgetFactory - virtual const QList &modelWidgets() const; + const QList &modelWidgets() const override; /// Removes all widgets in the widget area of the property panel - virtual void cleanContent(); + void cleanContent() override; /// Returns currently active widget. This is a widget from internal container /// of widgets (myWidgets) activated/deactivated by focus in property panel. /// If parameter is true, the method finds firstly the custom widget, after /// the direct active widget. \param isUseCustomWidget boolean state if the /// custom widget might be a result - virtual ModuleBase_ModelWidget * - activeWidget(const bool isUseCustomWidget = false) const; + ModuleBase_ModelWidget * + activeWidget(const bool isUseCustomWidget = false) const override; /// Activate the next widget in the property panel /// \param theWidget a widget. The next widget should be activated - virtual void activateNextWidget(ModuleBase_ModelWidget *theWidget); + void activateNextWidget(ModuleBase_ModelWidget *theWidget) override; /// Activate the next from current widget in the property panel - virtual void activateNextWidget(); + void activateNextWidget() override; /// Set focus on the Ok button - virtual void setFocusOnOkButton(); + void setFocusOnOkButton() override; /// Set Enable/Disable state of Cancel button /// \param theEnabled Enable/Disable state of Cancel button - virtual void setCancelEnabled(bool theEnabled); + void setCancelEnabled(bool theEnabled) override; /// \return Enable/Disable state of Cancel button - virtual bool isCancelEnabled() const; + bool isCancelEnabled() const override; /// Editing mode depends on mode of current operation. This value is defined /// by it. \param isEditing state of editing mode flag - virtual void setEditingMode(bool isEditing); + void setEditingMode(bool isEditing) override; //! Allows to set predefined actions for the property panel fetched from the //! ActionsMgr void setupActions(XGUI_ActionsMgr *theMgr); /// Returns widget processed by preselection - virtual ModuleBase_ModelWidget *preselectionWidget() const; + ModuleBase_ModelWidget *preselectionWidget() const override; /// Sets widget processed by preselection - virtual void setPreselectionWidget(ModuleBase_ModelWidget *theWidget); + void setPreselectionWidget(ModuleBase_ModelWidget *theWidget) override; /// Returns operation manager XGUI_OperationMgr *operationMgr() const { return myOperationMgr; } @@ -138,7 +138,7 @@ public: bool setFocusNextPrevChild(bool theIsNext); /// The method is called on accepting of operation - virtual void onAcceptData(); + void onAcceptData() override; /// Set internal active widget, that can be returned as active widget and /// participate in active selection filters/modes in application. It emits @@ -166,8 +166,8 @@ public slots: * \param theWidget which has to be activated * \param theEmitSignal a flag to prohibit signal emit */ - virtual void activateWidget(ModuleBase_ModelWidget *theWidget, - const bool theEmitSignal = true); + void activateWidget(ModuleBase_ModelWidget *theWidget, + const bool theEmitSignal = true) override; /// Activates the parameter widget if it can accept focus /// \param theWidget a widget where focus in event happened @@ -197,7 +197,7 @@ protected: /// Emits a signal about focus change /// If theIsNext is true, this function searches forward, if next is false, it /// searches backward. - virtual bool focusNextPrevChild(bool theIsNext); + bool focusNextPrevChild(bool theIsNext) override; /// Activate the next widget in the property panel /// \param theWidget a widget. The next widget should be activated /// \param isCheckVisibility flag whether the next widget visibility is @@ -208,7 +208,7 @@ protected: protected: /// A method called on the property panel closed /// \param theEvent a close event - void closeEvent(QCloseEvent *theEvent); + void closeEvent(QCloseEvent *theEvent) override; private: QWidget *myHeaderWidget; ///< A header widget diff --git a/src/XGUI/XGUI_PropertyPanelSelector.cpp b/src/XGUI/XGUI_PropertyPanelSelector.cpp index a35cb094c..57340e52a 100644 --- a/src/XGUI/XGUI_PropertyPanelSelector.cpp +++ b/src/XGUI/XGUI_PropertyPanelSelector.cpp @@ -24,21 +24,21 @@ //******************************************************************** XGUI_PropertyPanelSelector::XGUI_PropertyPanelSelector( XGUI_PropertyPanel *thePanel) - : myPanel(thePanel), myWidgetToBeActivated(NULL) { + : myPanel(thePanel), myWidgetToBeActivated(nullptr) { connect(myPanel, SIGNAL(propertyPanelActivated()), this, SIGNAL(activated())); connect(myPanel, SIGNAL(propertyPanelDeactivated()), this, SIGNAL(deactivated())); } //******************************************************************** -void XGUI_PropertyPanelSelector::reset() { myWidgetToBeActivated = NULL; } +void XGUI_PropertyPanelSelector::reset() { myWidgetToBeActivated = nullptr; } //******************************************************************** void XGUI_PropertyPanelSelector::setActive(const bool &isActive) { if (isActive && myWidgetToBeActivated) { // e.g. widget sketch label myPanel->activateWidget(myWidgetToBeActivated, true); - myWidgetToBeActivated = NULL; + myWidgetToBeActivated = nullptr; return; } @@ -47,13 +47,13 @@ void XGUI_PropertyPanelSelector::setActive(const bool &isActive) { if (aWidget && aWidget->needToBeActivated()) { myWidgetToBeActivated = aWidget; } - myPanel->activateWidget(NULL, false); + myPanel->activateWidget(nullptr, false); } } //******************************************************************** bool XGUI_PropertyPanelSelector::needToBeActivated() const { - return myWidgetToBeActivated != NULL; + return myWidgetToBeActivated != nullptr; } //******************************************************************** diff --git a/src/XGUI/XGUI_PropertyPanelSelector.h b/src/XGUI/XGUI_PropertyPanelSelector.h index db430ebc4..a80a7d01c 100644 --- a/src/XGUI/XGUI_PropertyPanelSelector.h +++ b/src/XGUI/XGUI_PropertyPanelSelector.h @@ -39,28 +39,29 @@ public: /// \param thePanel the workshop property panel XGUI_EXPORT XGUI_PropertyPanelSelector(XGUI_PropertyPanel *thePanel); /// Destructor - XGUI_EXPORT virtual ~XGUI_PropertyPanelSelector(){}; + XGUI_EXPORT ~XGUI_PropertyPanelSelector() override = default; + ; /// Returns name of the selector XGUI_EXPORT static QString Type() { return "XGUI_PropertyPanelSelector"; } /// Returns name of the selector - XGUI_EXPORT virtual QString getType() { return Type(); } + XGUI_EXPORT QString getType() override { return Type(); } /// Clear need to be activated widget if it exists - XGUI_EXPORT virtual void reset(); + XGUI_EXPORT void reset() override; /// Sets control active. It should activates/deactivates selection and /// selection filters. \param isActive if true, the control becomes active - XGUI_EXPORT virtual void setActive(const bool &isActive); + XGUI_EXPORT void setActive(const bool &isActive) override; /// Returns whether the selector should be activated as soon as possible (by /// deactivatate other) \return boolean result - XGUI_EXPORT virtual bool needToBeActivated() const; + XGUI_EXPORT bool needToBeActivated() const override; /// Processes current selection of workshop. Reaction to selection change in /// workshop. - XGUI_EXPORT virtual void processSelection(); + XGUI_EXPORT void processSelection() override; protected: XGUI_PropertyPanel *myPanel; ///< processed panel diff --git a/src/XGUI/XGUI_SalomeConnector.cpp b/src/XGUI/XGUI_SalomeConnector.cpp index 86b3a970b..112ef98e8 100644 --- a/src/XGUI/XGUI_SalomeConnector.cpp +++ b/src/XGUI/XGUI_SalomeConnector.cpp @@ -20,6 +20,6 @@ #include "XGUI_SalomeConnector.h" -XGUI_SalomeConnector::XGUI_SalomeConnector() {} +XGUI_SalomeConnector::XGUI_SalomeConnector() = default; -XGUI_SalomeConnector::~XGUI_SalomeConnector() {} +XGUI_SalomeConnector::~XGUI_SalomeConnector() = default; diff --git a/src/XGUI/XGUI_Selection.cpp b/src/XGUI/XGUI_Selection.cpp index 18a86b766..01ecc6f1b 100644 --- a/src/XGUI/XGUI_Selection.cpp +++ b/src/XGUI/XGUI_Selection.cpp @@ -203,9 +203,9 @@ void XGUI_Selection::getSelectedInBrowser( aLast = anObjects.end(); for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; - if (anObject.get() != NULL && !aPresentationObjects.contains(anObject)) { + if (anObject.get() != nullptr && !aPresentationObjects.contains(anObject)) { thePresentations.append(std::shared_ptr( - new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), nullptr))); } } } diff --git a/src/XGUI/XGUI_Selection.h b/src/XGUI/XGUI_Selection.h index 2e117b3fe..2517aed7b 100644 --- a/src/XGUI/XGUI_Selection.h +++ b/src/XGUI/XGUI_Selection.h @@ -47,28 +47,28 @@ public: /// Returns a list of viewer selected presentations /// \return list of presentations - virtual QList> - getSelected(const SelectionPlace &thePlace = Browser) const; + QList> + getSelected(const SelectionPlace &thePlace = Browser) const override; /// Fills the viewer presentation parameters by the parameters from the owner /// \param thePrs a container for selection /// \param theOwner a selection owner - virtual void fillPresentation(std::shared_ptr &thePrs, - const Handle(SelectMgr_EntityOwner) & - theOwner) const; + void fillPresentation(std::shared_ptr &thePrs, + const Handle(SelectMgr_EntityOwner) & + theOwner) const override; /// Returns a list of viewer highlited presentations /// \return list of presentations - virtual QList> getHighlighted() const; + QList> getHighlighted() const override; /// Returns list of currently selected objects in object browser - virtual QObjectPtrList selectedObjects() const; + QObjectPtrList selectedObjects() const override; /// Returns list of currently selected results - virtual QObjectPtrList selectedPresentations() const; + QObjectPtrList selectedPresentations() const override; /// Returns list of currently selected QModelIndexes - virtual QModelIndexList selectedIndexes() const; + QModelIndexList selectedIndexes() const override; /// Returns list of currently selected owners /// \return list of owners @@ -84,15 +84,15 @@ public: /// Return the IO from the viewer presentation. /// \param thePrs a selected object /// \return an interactive object - virtual Handle(AIS_InteractiveObject) - getIO(const std::shared_ptr &thePrs); + Handle(AIS_InteractiveObject) + getIO(const std::shared_ptr &thePrs) override; protected: /// Return a selectable object by the entity owner. It founds AIS object in /// the viewer and returns the corresponded object \param theOwner an entity /// owner \return a found object or NULL ObjectPtr getSelectableObject(const Handle(SelectMgr_EntityOwner) & - theOwner) const; + theOwner) const override; /// Fills the list of presentations by objects selected in the viewer. /// \param thePresentations an output list of presentation diff --git a/src/XGUI/XGUI_SelectionActivate.cpp b/src/XGUI/XGUI_SelectionActivate.cpp index 775c571b2..00631b8d6 100644 --- a/src/XGUI/XGUI_SelectionActivate.cpp +++ b/src/XGUI/XGUI_SelectionActivate.cpp @@ -190,7 +190,7 @@ bool XGUI_SelectionActivate::isActive(ObjectPtr theObject) const { //************************************************************** void XGUI_SelectionActivate::activateObjects(const QIntList &theModes, const QObjectPtrList &theObjList, - const bool theUpdateViewer) { + const bool /*theUpdateViewer*/) { setSelectionModes(theModes); Handle(AIS_InteractiveContext) aContext = AISContext(); diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index ce7b1715c..bdde96025 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -123,7 +123,7 @@ void XGUI_SelectionMgr::onObjectBrowserSelection() { std::list::iterator aRes; for (aRes = allRes.begin(); aRes != allRes.end(); aRes++) { aSelectedPrs.append(std::shared_ptr( - new ModuleBase_ViewerPrs(*aRes, GeomShapePtr(), NULL))); + new ModuleBase_ViewerPrs(*aRes, GeomShapePtr(), nullptr))); } } } @@ -224,7 +224,8 @@ void XGUI_SelectionMgr::convertToObjectBrowserSelection( ResultPtr aResult; FeaturePtr aFeature; - bool aHasOperation = (myWorkshop->operationMgr()->currentOperation() != 0); + bool aHasOperation = + (myWorkshop->operationMgr()->currentOperation() != nullptr); SessionPtr aMgr = ModelAPI_Session::get(); DocumentPtr anActiveDocument = aMgr->activeDocument(); diff --git a/src/XGUI/XGUI_Tools.cpp b/src/XGUI/XGUI_Tools.cpp index 186a86788..b09d00182 100644 --- a/src/XGUI/XGUI_Tools.cpp +++ b/src/XGUI/XGUI_Tools.cpp @@ -161,8 +161,8 @@ bool canRemoveOrRename(QWidget *theParent, //****************************************************************** bool isAscii(const QString &theStr) { char aCh; - for (int i = 0; i < theStr.size(); i++) { - aCh = theStr[i].toLatin1(); + for (auto i : theStr) { + aCh = i.toLatin1(); if (aCh == 0) return false; if ((aCh >= 0x30) && (aCh <= 0x39)) @@ -182,8 +182,8 @@ bool isAscii(const QString &theStr) { //****************************************************************** bool isValidName(const QString &theName) { QChar aChar; - for (int i = 0; i < theName.size(); i++) { - aChar = theName[i]; + for (auto i : theName) { + aChar = i; if (!aChar.isLetterOrNumber()) { if ((aChar != "_") && (!aChar.isSpace())) return false; @@ -237,9 +237,8 @@ bool canRename(const ObjectPtr &theObject, const QString &theName) { //************************************************************** XGUI_Workshop *workshop(ModuleBase_IWorkshop *theWorkshop) { - XGUI_ModuleConnector *aConnector = - dynamic_cast(theWorkshop); - return aConnector ? aConnector->workshop() : 0; + auto *aConnector = dynamic_cast(theWorkshop); + return aConnector ? aConnector->workshop() : nullptr; } //******************************************************************** @@ -329,7 +328,7 @@ std::string getTmpDirByPath(const std::string &theTmpPath) { if (aTmpDir.back() != _separator_) aTmpDir += _separator_; - srand((unsigned int)time(NULL)); + srand((unsigned int)time(nullptr)); // Get a random number to present a name of a sub directory int aRND = 999 + (int)(100000.0 * rand() / (RAND_MAX + 1.0)); char buffer[127]; @@ -359,7 +358,7 @@ std::string getTmpDirByPath(const std::string &theTmpPath) { } std::string getTmpDirByEnv(const char *thePathEnv) { - char *aVal = thePathEnv[0] == 0 ? 0 : getenv(thePathEnv); + char *aVal = thePathEnv[0] == 0 ? nullptr : getenv(thePathEnv); std::string dir = aVal ? aVal : ""; return getTmpDirByPath(dir).c_str(); } @@ -368,7 +367,7 @@ void removeTemporaryFiles(const std::string &theDirectory, const std::list &theFiles) { std::string aDirName = theDirectory; - std::list::const_iterator aFilesIter = theFiles.cbegin(); + auto aFilesIter = theFiles.cbegin(); for (; aFilesIter != theFiles.cend(); aFilesIter++) { const std::string &aFile = *aFilesIter; if (access(aFile.c_str(), F_OK) != 0) diff --git a/src/XGUI/XGUI_TransparencyWidget.cpp b/src/XGUI/XGUI_TransparencyWidget.cpp index 7eb24295e..dcd587071 100644 --- a/src/XGUI/XGUI_TransparencyWidget.cpp +++ b/src/XGUI/XGUI_TransparencyWidget.cpp @@ -30,11 +30,11 @@ XGUI_TransparencyWidget::XGUI_TransparencyWidget( QWidget *theParent, const QString & /*theLabelText*/) : QWidget(theParent) { - QVBoxLayout *aLay = new QVBoxLayout(this); + auto *aLay = new QVBoxLayout(this); aLay->setContentsMargins(0, 0, 0, 0); - QWidget *aInfoWgt = new QWidget(this); - QHBoxLayout *aInfoLay = new QHBoxLayout(aInfoWgt); + auto *aInfoWgt = new QWidget(this); + auto *aInfoLay = new QHBoxLayout(aInfoWgt); aInfoLay->setContentsMargins(0, 0, 0, 0); aInfoLay->addWidget(new QLabel(tr("Opaque"))); diff --git a/src/XGUI/XGUI_TransparencyWidget.h b/src/XGUI/XGUI_TransparencyWidget.h index f4951a8a7..7e22ae5bf 100644 --- a/src/XGUI/XGUI_TransparencyWidget.h +++ b/src/XGUI/XGUI_TransparencyWidget.h @@ -42,7 +42,8 @@ public: /// the widget XGUI_EXPORT XGUI_TransparencyWidget(QWidget *theParent, const QString &theLabelText = QString()); - XGUI_EXPORT virtual ~XGUI_TransparencyWidget(){}; + XGUI_EXPORT ~XGUI_TransparencyWidget() override = default; + ; /// Initializes the dialog with the given value. /// \param theValue transparency value diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index d97ba56c4..64797cb94 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -207,10 +207,7 @@ static QString MyImportPartFilter( //****************************************************** XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector *theConnector) - : QObject(), myModule(NULL), myObjectBrowser(0), myPropertyPanel(0), - myFacesPanel(0), myDisplayer(0), mySalomeConnector(theConnector), - // myViewerSelMode(TopAbs_FACE), - myInspectionPanel(0) { + : QObject(), myModule(nullptr), mySalomeConnector(theConnector) { mySelector = new XGUI_SelectionMgr(this); myModuleConnector = new XGUI_ModuleConnector(this); myOperationMgr = new XGUI_OperationMgr(this, myModuleConnector); @@ -317,7 +314,7 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector *theConnector) } //****************************************************** -XGUI_Workshop::~XGUI_Workshop(void) { +XGUI_Workshop::~XGUI_Workshop() { #ifdef _DEBUG #ifdef MISSED_TRANSLATION // Save Missed translations @@ -618,9 +615,8 @@ void XGUI_Workshop::onStartWaiting() { void XGUI_Workshop::onAcceptActionClicked() { XGUI_OperationMgr *anOperationMgr = operationMgr(); if (anOperationMgr) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - anOperationMgr->currentOperation()); + auto *aFOperation = dynamic_cast( + anOperationMgr->currentOperation()); if (aFOperation) { myOperationMgr->commitOperation(); } @@ -631,9 +627,8 @@ void XGUI_Workshop::onAcceptActionClicked() { void XGUI_Workshop::onAcceptPlusActionClicked() { XGUI_OperationMgr *anOperationMgr = operationMgr(); if (anOperationMgr) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - anOperationMgr->currentOperation()); + auto *aFOperation = dynamic_cast( + anOperationMgr->currentOperation()); if (aFOperation) { if (myOperationMgr->commitOperation()) module()->launchOperation(aFOperation->id(), false); @@ -741,8 +736,7 @@ bool XGUI_Workshop::isFeatureOfNested(const FeaturePtr &theFeature) { //****************************************************** void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation *theOperation) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast(theOperation); + auto *aFOperation = dynamic_cast(theOperation); if (!aFOperation) return; @@ -882,7 +876,7 @@ void XGUI_Workshop::onOperationResumed(ModuleBase_Operation *theOperation) { ->hasXmlRepresentation()) { //!< No need for property panel fillPropertyPanel(theOperation); connectToPropertyPanel(true); - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(theOperation); if (aFOperation) myPropertyPanel->updateApplyPlusButton(aFOperation->feature()); @@ -898,8 +892,7 @@ void XGUI_Workshop::onOperationResumed(ModuleBase_Operation *theOperation) { void XGUI_Workshop::onOperationStopped(ModuleBase_Operation *theOperation) { updateCommandStatus(); - ModuleBase_OperationFeature *aFOperation = - dynamic_cast(theOperation); + auto *aFOperation = dynamic_cast(theOperation); if (!aFOperation) return; @@ -951,8 +944,7 @@ void XGUI_Workshop::onOperationAborted(ModuleBase_Operation *theOperation) { //****************************************************** void XGUI_Workshop::setGrantedFeatures(ModuleBase_Operation *theOperation) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast(theOperation); + auto *aFOperation = dynamic_cast(theOperation); if (!aFOperation) return; @@ -1131,7 +1123,7 @@ void XGUI_Workshop::openFile(const QString &theDirectory) { //****************************************************** void XGUI_Workshop::onNew() { QApplication::setOverrideCursor(Qt::WaitCursor); - if (objectBrowser() == 0) { + if (objectBrowser() == nullptr) { createDockWidgets(); mySelector->connectViewers(); } @@ -1322,7 +1314,7 @@ void XGUI_Workshop::processUndoRedo(const ModuleBase_ActionType theActionType, objectBrowser()->treeView()->setCurrentIndex(QModelIndex()); std::list anActionList = theActionType == ActionUndo ? aMgr->undoList() : aMgr->redoList(); - std::list::const_iterator aIt = anActionList.cbegin(); + auto aIt = anActionList.cbegin(); for (int i = 0; (i < aTimes) && (aIt != anActionList.cend()); ++i, ++aIt) { if (theActionType == ActionUndo) aMgr->undo(); @@ -1366,11 +1358,11 @@ void XGUI_Workshop::onWidgetStateChanged(int thePreviousState) { //****************************************************** void XGUI_Workshop::onValuesChanged() { - ModuleBase_ModelWidget *aSenderWidget = (ModuleBase_ModelWidget *)(sender()); + auto *aSenderWidget = (ModuleBase_ModelWidget *)(sender()); if (!aSenderWidget || aSenderWidget->canAcceptFocus()) return; - ModuleBase_ModelWidget *anActiveWidget = 0; + ModuleBase_ModelWidget *anActiveWidget = nullptr; ModuleBase_Operation *anOperation = myOperationMgr->currentOperation(); if (anOperation) { ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel(); @@ -1378,7 +1370,7 @@ void XGUI_Workshop::onValuesChanged() { anActiveWidget = aPanel->activeWidget(); } if (anActiveWidget) { - ModuleBase_WidgetValidated *aWidgetValidated = + auto *aWidgetValidated = dynamic_cast(anActiveWidget); if (aWidgetValidated) aWidgetValidated->clearValidatedCash(); @@ -1394,9 +1386,8 @@ void XGUI_Workshop::onWidgetObjectUpdated() { //****************************************************** void XGUI_Workshop::onImportPart() { if (abortAllOperations()) { - ModuleBase_OperationFeature *anImportPartOp = - dynamic_cast( - module()->createOperation(ExchangePlugin_ImportPart::ID())); + auto *anImportPartOp = dynamic_cast( + module()->createOperation(ExchangePlugin_ImportPart::ID())); anImportPartOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() + "importFeature.html"); myPropertyPanel->updateApplyPlusButton(anImportPartOp->feature()); @@ -1407,9 +1398,8 @@ void XGUI_Workshop::onImportPart() { //****************************************************** void XGUI_Workshop::onImportShape() { if (abortAllOperations()) { - ModuleBase_OperationFeature *anImportOp = - dynamic_cast( - module()->createOperation(ExchangePlugin_Import::ID())); + auto *anImportOp = dynamic_cast( + module()->createOperation(ExchangePlugin_Import::ID())); anImportOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() + "importFeature.html"); myPropertyPanel->updateApplyPlusButton(anImportOp->feature()); @@ -1420,9 +1410,8 @@ void XGUI_Workshop::onImportShape() { //****************************************************** void XGUI_Workshop::onImportImage() { if (abortAllOperations()) { - ModuleBase_OperationFeature *anImportOp = - dynamic_cast( - module()->createOperation(ExchangePlugin_Import_Image::ID())); + auto *anImportOp = dynamic_cast( + module()->createOperation(ExchangePlugin_Import_Image::ID())); anImportOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() + "importFeature.html"); myPropertyPanel->updateApplyPlusButton(anImportOp->feature()); @@ -1433,9 +1422,8 @@ void XGUI_Workshop::onImportImage() { //****************************************************** void XGUI_Workshop::onExportShape() { if (abortAllOperations()) { - ModuleBase_OperationFeature *anExportOp = - dynamic_cast( - module()->createOperation(ExchangePlugin_ExportFeature::ID())); + auto *anExportOp = dynamic_cast( + module()->createOperation(ExchangePlugin_ExportFeature::ID())); anExportOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() + "exportFeature.html"); myPropertyPanel->updateApplyPlusButton(anExportOp->feature()); @@ -1446,9 +1434,8 @@ void XGUI_Workshop::onExportShape() { //****************************************************** void XGUI_Workshop::onExportPart() { if (abortAllOperations()) { - ModuleBase_OperationFeature *anExportPartOp = - dynamic_cast( - module()->createOperation(ExchangePlugin_ExportPart::ID())); + auto *anExportPartOp = dynamic_cast( + module()->createOperation(ExchangePlugin_ExportPart::ID())); anExportPartOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() + "exportFeature.html"); myPropertyPanel->updateApplyPlusButton(anExportPartOp->feature()); @@ -1460,13 +1447,14 @@ void XGUI_Workshop::onExportPart() { ModuleBase_IModule *XGUI_Workshop::loadModule(const QString &theModule) { QString libName = QString::fromStdString(library(theModule.toStdString())); if (libName.isEmpty()) { - qWarning(qPrintable( - tr("Information about module \"%1\" doesn't exist.").arg(theModule))); - return 0; + qWarning("%s", + qPrintable(tr("Information about module \"%1\" doesn't exist.") + .arg(theModule))); + return nullptr; } QString err; - CREATE_FUNC crtInst = 0; + CREATE_FUNC crtInst = nullptr; #ifdef WIN32 HINSTANCE modLib = ::LoadLibraryA(qPrintable(libName)); @@ -1508,13 +1496,13 @@ ModuleBase_IModule *XGUI_Workshop::loadModule(const QString &theModule) { } #endif - ModuleBase_IModule *aModule = crtInst ? crtInst(myModuleConnector) : 0; + ModuleBase_IModule *aModule = crtInst ? crtInst(myModuleConnector) : nullptr; if (!err.isEmpty()) { if (desktop()) { Events_InfoMessage("XGUI_Workshop", err.toStdString()).send(); } else { - qWarning(qPrintable(err)); + qWarning("%s", qPrintable(err)); } } return aModule; @@ -1622,7 +1610,7 @@ void XGUI_Workshop::updateHistory() { //****************************************************** QDockWidget *XGUI_Workshop::createObjectBrowser(QWidget *theParent) { - QDockWidget *aObjDock = new QDockWidget(theParent); + auto *aObjDock = new QDockWidget(theParent); aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); aObjDock->setWindowTitle(tr("Object browser")); aObjDock->setStyleSheet("::title { position: relative; padding-left: 5px; " @@ -1798,7 +1786,8 @@ ModuleBase_IViewer *XGUI_Workshop::salomeViewer() const { } //************************************************************** -void XGUI_Workshop::onContextMenuCommand(const QString &theId, bool isChecked) { +void XGUI_Workshop::onContextMenuCommand(const QString &theId, + bool /*isChecked*/) { QObjectPtrList anObjects = mySelector->selection()->selectedObjects(); if (theId == "DELETE_CMD") deleteObjects(); @@ -1985,9 +1974,7 @@ bool XGUI_Workshop::prepareForDisplay( // generate container of objects taking into account sub elments of compsolid std::set anAllProcessedObjects; - for (std::set::const_iterator anObjectsIt = theObjects.begin(); - anObjectsIt != theObjects.end(); anObjectsIt++) { - ObjectPtr anObject = *anObjectsIt; + for (auto anObject : theObjects) { ResultBodyPtr aCompRes = std::dynamic_pointer_cast(anObject); if (aCompRes.get()) { @@ -1996,10 +1983,9 @@ bool XGUI_Workshop::prepareForDisplay( if (allRes.empty()) { anAllProcessedObjects.insert(anObject); } else { - for (std::list::iterator aRes = allRes.begin(); - aRes != allRes.end(); aRes++) { + for (auto &allRe : allRes) { ResultBodyPtr aBody = - std::dynamic_pointer_cast(*aRes); + std::dynamic_pointer_cast(allRe); if (aBody.get() && aBody->numberOfSubs() == 0) anAllProcessedObjects.insert(aBody); } @@ -2011,14 +1997,12 @@ bool XGUI_Workshop::prepareForDisplay( // find hidden objects in faces panel std::set aHiddenObjects; QStringList aHiddenObjectNames; - for (std::set::const_iterator anObjectsIt = - anAllProcessedObjects.begin(); - anObjectsIt != anAllProcessedObjects.end(); anObjectsIt++) { - if (!facesPanel()->isObjectHiddenByPanel(*anObjectsIt)) + for (const auto &anAllProcessedObject : anAllProcessedObjects) { + if (!facesPanel()->isObjectHiddenByPanel(anAllProcessedObject)) continue; - aHiddenObjects.insert(*anObjectsIt); + aHiddenObjects.insert(anAllProcessedObject); aHiddenObjectNames.append( - QString::fromStdWString((*anObjectsIt)->data()->name())); + QString::fromStdWString(anAllProcessedObject->data()->name())); } if (aHiddenObjects.empty()) // in parameter objects there are no hidden // objects in hide face @@ -2100,8 +2084,7 @@ void XGUI_Workshop::deleteObjects() { QString aDescription = contextMenuMgr()->action("DELETE_CMD")->text() + " %1"; aDescription = aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", ")); - ModuleBase_Operation *anOpAction = - new ModuleBase_Operation(aDescription, module()); + auto *anOpAction = new ModuleBase_Operation(aDescription, module()); operationMgr()->startOperation(anOpAction); @@ -2120,8 +2103,7 @@ void XGUI_Workshop::deleteObjects() { aDone = ModelAPI_Tools::removeFeatures(aFeatures, false); } if (aFolders.size() > 0) { - std::set::const_iterator anIt = aFolders.begin(), - aLast = aFolders.end(); + auto anIt = aFolders.begin(), aLast = aFolders.end(); for (; anIt != aLast; anIt++) { FolderPtr aFolder = *anIt; if (aFolder.get()) { @@ -2166,8 +2148,7 @@ void addRefsToFeature( // references to it std::set aMainReferences = theMainList.at(theFeature); - std::set::const_iterator anIt = aMainReferences.begin(), - aLast = aMainReferences.end(); + auto anIt = aMainReferences.begin(), aLast = aMainReferences.end(); for (; anIt != aLast; anIt++) { FeaturePtr aRefFeature = *anIt; if (theReferences.find(aRefFeature) == theReferences.end()) @@ -2216,8 +2197,7 @@ void XGUI_Workshop::cleanHistory() { for (; aMainIt != aMainLast; aMainIt++) { FeaturePtr aMainListFeature = aMainIt->first; std::set aMainRefList = aMainIt->second; - std::set::const_iterator aRefIt = aMainRefList.begin(), - aRefLast = aMainRefList.end(); + auto aRefIt = aMainRefList.begin(), aRefLast = aMainRefList.end(); bool aFeatureOutOfTheList = false; for (; aRefIt != aRefLast && !aFeatureOutOfTheList; aRefIt++) { FeaturePtr aRefFeature = *aRefIt; @@ -2272,8 +2252,7 @@ void XGUI_Workshop::cleanHistory() { aDescription += "by deleting of " + aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", ")); - ModuleBase_Operation *anOpAction = - new ModuleBase_Operation(aDescription, module()); + auto *anOpAction = new ModuleBase_Operation(aDescription, module()); operationMgr()->startOperation(anOpAction); // WORKAROUND, should be done before each object remove, if it presents in @@ -2381,7 +2360,7 @@ bool hasResults(QObjectPtrList theObjects, bool isFoundResultType = false; foreach (ObjectPtr anObj, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); - if (aResult.get() == NULL) + if (aResult.get() == nullptr) continue; isFoundResultType = theTypes.find(aResult->groupName()) != theTypes.end(); @@ -2429,14 +2408,13 @@ std::list toCurrentFeatures(const ObjectPtr &theObject) { DocumentPtr aDocument = theObject->document(); std::list anAllFeatures = allFeatures(aDocument); // find the object iterator - std::list::iterator anObjectIt = + auto anObjectIt = std::find(anAllFeatures.begin(), anAllFeatures.end(), theObject); if (anObjectIt == anAllFeatures.end()) return aResult; // find the current feature iterator - std::list::iterator aCurrentIt = - std::find(anAllFeatures.begin(), anAllFeatures.end(), - aDocument->currentFeature(true)); + auto aCurrentIt = std::find(anAllFeatures.begin(), anAllFeatures.end(), + aDocument->currentFeature(true)); if (aCurrentIt == anAllFeatures.end()) return aResult; // check the right order @@ -2550,10 +2528,10 @@ bool XGUI_Workshop::canBeShaded(const ObjectPtr &theObject) const { if (!aCanBeShaded) { ResultBodyPtr aCompRes = std::dynamic_pointer_cast(theObject); - if (aCompRes.get() != NULL) { // change colors for all sub-solids + if (aCompRes.get() != nullptr) { // change colors for all sub-solids std::list allRes; ModelAPI_Tools::allSubs(aCompRes, allRes); - std::list::iterator aRes = allRes.begin(); + auto aRes = allRes.begin(); for (; aRes != allRes.end() && !aCanBeShaded; aRes++) { aCanBeShaded = myDisplayer->canBeShaded(*aRes); } @@ -2641,7 +2619,7 @@ void XGUI_Workshop::changeColor(const QObjectPtrList &theObjects) { if (!abortAllOperations()) return; // 2. show the dialog to change the value - XGUI_ColorDialog *aDlg = new XGUI_ColorDialog(desktop()); + auto *aDlg = new XGUI_ColorDialog(desktop()); aDlg->setColor(aColor); aDlg->move(QCursor::pos()); bool isDone = aDlg->exec() == QDialog::Accepted; @@ -2660,16 +2638,15 @@ void XGUI_Workshop::changeColor(const QObjectPtrList &theObjects) { std::vector aColorResult = aDlg->getColor(); foreach (ObjectPtr anObj, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); - if (aResult.get() != NULL) { + if (aResult.get() != nullptr) { ResultBodyPtr aBodyResult = std::dynamic_pointer_cast(aResult); - if (aBodyResult.get() != NULL) { // change colors for all sub-solids + if (aBodyResult.get() != nullptr) { // change colors for all sub-solids std::list allRes; ModelAPI_Tools::allSubs(aBodyResult, allRes); - for (std::list::iterator aRes = allRes.begin(); - aRes != allRes.end(); aRes++) { + for (auto &allRe : allRes) { ModelAPI_Tools::setColor( - *aRes, !isRandomColor ? aColorResult : aDlg->getRandomColor()); + allRe, !isRandomColor ? aColorResult : aDlg->getRandomColor()); } } ModelAPI_Tools::setColor( @@ -2705,7 +2682,7 @@ void XGUI_Workshop::changeAutoColor(const QObjectPtrList &theObjects) { DocumentPtr aDocument = anObj->document(); std::list anAllFeatures = allFeatures(aDocument); // find the object iterator - std::list::iterator anObjectIt = anAllFeatures.begin(); + auto anObjectIt = anAllFeatures.begin(); for (; anObjectIt != anAllFeatures.end(); ++anObjectIt) { FeaturePtr aFeature = *anObjectIt; if (aFeature.get()) { @@ -2739,10 +2716,10 @@ void XGUI_Workshop::changeAutoColor(const QObjectPtrList &theObjects) { void setTransparency(double theTransparency, const QObjectPtrList &theObjects) { foreach (ObjectPtr anObj, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); - if (aResult.get() != NULL) { + if (aResult.get() != nullptr) { ResultBodyPtr aBodyResult = std::dynamic_pointer_cast(aResult); - if (aBodyResult.get() != NULL) { // change property for all sub-solids + if (aBodyResult.get() != nullptr) { // change property for all sub-solids std::list allRes; ModelAPI_Tools::allSubs(aBodyResult, allRes); std::list::iterator aRes; @@ -2817,7 +2794,7 @@ void XGUI_Workshop::changeDeflection(const QObjectPtrList &theObjects) { if (!abortAllOperations()) return; // 2. show the dialog to change the value - XGUI_DeflectionDialog *aDlg = new XGUI_DeflectionDialog(desktop()); + auto *aDlg = new XGUI_DeflectionDialog(desktop()); aDlg->setDeflection(aDeflection); aDlg->move(QCursor::pos()); bool isDone = aDlg->exec() == QDialog::Accepted; @@ -2833,15 +2810,14 @@ void XGUI_Workshop::changeDeflection(const QObjectPtrList &theObjects) { aDeflection = aDlg->getDeflection(); foreach (ObjectPtr anObj, theObjects) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); - if (aResult.get() != NULL) { + if (aResult.get() != nullptr) { ResultBodyPtr aBodyResult = std::dynamic_pointer_cast(aResult); - if (aBodyResult.get() != NULL) { // change property for all sub-solids + if (aBodyResult.get() != nullptr) { // change property for all sub-solids std::list allRes; ModelAPI_Tools::allSubs(aBodyResult, allRes); - for (std::list::iterator aRes = allRes.begin(); - aRes != allRes.end(); aRes++) { - ModelAPI_Tools::setDeflection(*aRes, aDeflection); + for (auto &allRe : allRes) { + ModelAPI_Tools::setDeflection(allRe, aDeflection); } } ModelAPI_Tools::setDeflection(aResult, aDeflection); @@ -2854,7 +2830,7 @@ void XGUI_Workshop::changeDeflection(const QObjectPtrList &theObjects) { } //************************************************************** -double getDefaultTransparency(const ResultPtr &theResult) { +double getDefaultTransparency(const ResultPtr & /*theResult*/) { return Config_PropManager::integer("Visualization", "shaper_default_transparency") / 100.; @@ -2883,10 +2859,9 @@ void XGUI_Workshop::changeTransparency(const QObjectPtrList &theObjects) { return; // 2. show the dialog to change the value - XGUI_PropertyDialog *aDlg = new XGUI_PropertyDialog(desktop()); + auto *aDlg = new XGUI_PropertyDialog(desktop()); aDlg->setWindowTitle(tr("Transparency")); - XGUI_TransparencyWidget *aTransparencyWidget = - new XGUI_TransparencyWidget(aDlg); + auto *aTransparencyWidget = new XGUI_TransparencyWidget(aDlg); connect(aTransparencyWidget, SIGNAL(transparencyValueChanged()), this, SLOT(onTransparencyValueChanged())); aDlg->setContent(aTransparencyWidget); @@ -2913,8 +2888,7 @@ void XGUI_Workshop::changeTransparency(const QObjectPtrList &theObjects) { //************************************************************** void XGUI_Workshop::onTransparencyValueChanged() { - XGUI_TransparencyWidget *aTransparencyWidget = - (XGUI_TransparencyWidget *)sender(); + auto *aTransparencyWidget = (XGUI_TransparencyWidget *)sender(); if (!aTransparencyWidget) return; @@ -3004,8 +2978,7 @@ void XGUI_Workshop::updateColorScaleVisibility() { AISObjectPtr aAisPtr = myDisplayer->getAISObject(aStep); Handle(AIS_InteractiveObject) aIO = aAisPtr->impl(); - ModuleBase_IStepPrs *aPrs = - dynamic_cast(aIO.get()); + auto *aPrs = dynamic_cast(aIO.get()); if (aPrs) { ModelAPI_AttributeTables::ValueType aType = aPrs->dataType(); if ((aType == ModelAPI_AttributeTables::DOUBLE) || @@ -3139,12 +3112,12 @@ void XGUI_Workshop::setDisplayMode(const QObjectPtrList &theList, int theMode) { ResultBodyPtr aBodyResult = std::dynamic_pointer_cast(anObj); - if (aBodyResult.get() != NULL) { // change display mode for all sub-solids + if (aBodyResult.get() != + nullptr) { // change display mode for all sub-solids std::list allRes; ModelAPI_Tools::allSubs(aBodyResult, allRes); - for (std::list::iterator aRes = allRes.begin(); - aRes != allRes.end(); aRes++) { - myDisplayer->setDisplayMode(*aRes, (XGUI_Displayer::DisplayMode)theMode, + for (auto &allRe : allRes) { + myDisplayer->setDisplayMode(allRe, (XGUI_Displayer::DisplayMode)theMode, false); } } @@ -3157,11 +3130,11 @@ void XGUI_Workshop::setDisplayMode(const QObjectPtrList &theList, int theMode) { void XGUI_Workshop::toggleEdgesDirection(const QObjectPtrList &theList) { foreach (ObjectPtr anObj, theList) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); - if (aResult.get() != NULL) { + if (aResult.get() != nullptr) { bool aToShow = !ModelAPI_Tools::isShowEdgesDirection(aResult); ResultBodyPtr aBodyResult = std::dynamic_pointer_cast(aResult); - if (aBodyResult.get() != NULL) { // change property for all sub-solids + if (aBodyResult.get() != nullptr) { // change property for all sub-solids std::list allRes; ModelAPI_Tools::allSubs(aBodyResult, allRes); std::list::iterator aRes; @@ -3183,7 +3156,7 @@ void XGUI_Workshop::toggleBringToFront(const QObjectPtrList &theList) { // Toggle the "BringToFront" state of all objects in the list foreach (ObjectPtr anObj, theList) { ResultPtr aResult = std::dynamic_pointer_cast(anObj); - if (aResult.get() != NULL) { + if (aResult.get() != nullptr) { bool aBringToFront = !ModelAPI_Tools::isBringToFront(aResult); ModelAPI_Tools::bringToFront(aResult, aBringToFront); myDisplayer->redisplay(anObj, false); @@ -3222,14 +3195,14 @@ void XGUI_Workshop::closeDocument() { //****************************************************** void XGUI_Workshop::addHistoryMenu(QObject *theObject, const char *theSignal, const char *theSlot) { - XGUI_HistoryMenu *aMenu = NULL; + XGUI_HistoryMenu *aMenu = nullptr; if (isSalomeMode()) { - QAction *anAction = qobject_cast(theObject); + auto *anAction = qobject_cast(theObject); if (!anAction) return; aMenu = new XGUI_HistoryMenu(anAction); } else { - QToolButton *aButton = qobject_cast(theObject); + auto *aButton = qobject_cast(theObject); aMenu = new XGUI_HistoryMenu(aButton); } connect(this, theSignal, aMenu, SLOT(setHistory(const QList &))); @@ -3240,7 +3213,7 @@ void XGUI_Workshop::addHistoryMenu(QObject *theObject, const char *theSignal, QList XGUI_Workshop::processHistoryList(const std::list &theList) const { QList aResult; - std::list::const_iterator it = theList.cbegin(); + auto it = theList.cbegin(); for (; it != theList.cend(); it++) { QString anId = QString::fromStdString(*it); bool isEditing = anId.endsWith(ModuleBase_OperationFeature::EditSuffix()); @@ -3400,7 +3373,7 @@ void XGUI_Workshop::insertFeatureFolder() { return; ObjectPtr aObj = anObjects.first(); FeaturePtr aFeature = std::dynamic_pointer_cast(aObj); - if (aFeature.get() == NULL) + if (aFeature.get() == nullptr) return; SessionPtr aMgr = ModelAPI_Session::get(); DocumentPtr aDoc = aMgr->activeDocument(); @@ -3510,8 +3483,7 @@ void XGUI_Workshop::clearTemporaryDir() { } void XGUI_Workshop::onDockSizeChanged() { - QDockWidget *aDockWgt = - dynamic_cast(myObjectBrowser->parentWidget()); + auto *aDockWgt = dynamic_cast(myObjectBrowser->parentWidget()); int aObWidth = aDockWgt->size().width(); if (myPropertyPanel->width() != aObWidth) { QList aWgtList; @@ -3560,16 +3532,16 @@ void XGUI_Workshop::changeIsoLines(const QObjectPtrList &theObjects) { XGUI_PropertyDialog aDlg(desktop()); aDlg.setWindowTitle(tr("Number of Iso-lines")); - QWidget *aIsosWgt = new QWidget(&aDlg); - QFormLayout *aLayout = new QFormLayout(aIsosWgt); + auto *aIsosWgt = new QWidget(&aDlg); + auto *aLayout = new QFormLayout(aIsosWgt); ModuleBase_Tools::adjustMargins(aLayout); aDlg.setContent(aIsosWgt); - QSpinBox *aUNb = new QSpinBox(&aDlg); + auto *aUNb = new QSpinBox(&aDlg); aUNb->setValue(aValues[0]); aLayout->addRow("U:", aUNb); - QSpinBox *aVNb = new QSpinBox(&aDlg); + auto *aVNb = new QSpinBox(&aDlg); aVNb->setValue(aValues[1]); aLayout->addRow("V:", aVNb); diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 6e087bd56..fe14157fb 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -581,16 +581,16 @@ private: AppElements_MainWindow *myMainWindow; ///< desktop window #endif - ModuleBase_IModule *myModule; ///< current module - XGUI_ErrorMgr *myErrorMgr; ///< updator of error message - XGUI_ObjectsBrowser *myObjectBrowser; ///< data tree widget - XGUI_PropertyPanel - *myPropertyPanel; ///< container of feature attributes widgets - XGUI_FacesPanel *myFacesPanel; ///< panel for hide object faces - XGUI_SelectionMgr *mySelector; ///< handler of selection processing + ModuleBase_IModule *myModule; ///< current module + XGUI_ErrorMgr *myErrorMgr; ///< updator of error message + XGUI_ObjectsBrowser *myObjectBrowser{0}; ///< data tree widget + XGUI_PropertyPanel *myPropertyPanel{ + 0}; ///< container of feature attributes widgets + XGUI_FacesPanel *myFacesPanel{0}; ///< panel for hide object faces + XGUI_SelectionMgr *mySelector; ///< handler of selection processing XGUI_SelectionActivate - *mySelectionActivate; /// manager of selection activating - XGUI_Displayer *myDisplayer; ///< handler of objects display + *mySelectionActivate; /// manager of selection activating + XGUI_Displayer *myDisplayer{0}; ///< handler of objects display XGUI_OperationMgr *myOperationMgr; ///< manager to manipulate through the operations XGUI_ActionsMgr *myActionsMgr; ///< manager of workshop actions @@ -610,8 +610,8 @@ private: QString myCurrentFile; ///< cached the last open directory QIntList myViewerSelMode; ///< selection modes set in the viewer Config_DataModelReader *myDataModelXMLReader; ///< XML reader of data model - XGUI_InspectionPanel - *myInspectionPanel; ///< container of feature attributes widgets + XGUI_InspectionPanel *myInspectionPanel{ + 0}; ///< container of feature attributes widgets QTemporaryDir myTmpDir; ///< a direcory for uncompressed files }; diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index 498e85ea6..dd975fd45 100644 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -94,7 +94,7 @@ XGUI_WorkshopListener::XGUI_WorkshopListener(XGUI_Workshop *theWorkshop) : myWorkshop(theWorkshop), myUpdatePrefs(false) {} //****************************************************** -XGUI_WorkshopListener::~XGUI_WorkshopListener(void) {} +XGUI_WorkshopListener::~XGUI_WorkshopListener() = default; //****************************************************** void XGUI_WorkshopListener::initializeEventListening() { @@ -139,8 +139,7 @@ void XGUI_WorkshopListener::processEvent( << "Working in another thread." << std::endl; #endif SessionPtr aMgr = ModelAPI_Session::get(); - PostponeMessageQtEvent *aPostponeEvent = - new PostponeMessageQtEvent(theMessage); + auto *aPostponeEvent = new PostponeMessageQtEvent(theMessage); QApplication::postEvent(this, aPostponeEvent); return; } @@ -201,7 +200,7 @@ void XGUI_WorkshopListener::processEvent( ModuleBase_ModelWidget *aWidget = workshop()->propertyPanel()->activeWidget(); if (aWidget) { - ModuleBase_WidgetSelector *aWidgetSelector = + auto *aWidgetSelector = dynamic_cast(aWidget); if (aWidgetSelector) workshop()->selector()->setSelected( @@ -287,9 +286,8 @@ void XGUI_WorkshopListener::onFeatureUpdatedMsg( std::set aFeatures = theMsg->objects(); XGUI_OperationMgr *anOperationMgr = workshop()->operationMgr(); if (anOperationMgr->hasOperation()) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - anOperationMgr->currentOperation()); + auto *aFOperation = dynamic_cast( + anOperationMgr->currentOperation()); if (aFOperation) { FeaturePtr aCurrentFeature = aFOperation->feature(); std::set::const_iterator aIt; @@ -539,8 +537,7 @@ void XGUI_WorkshopListener::onFeatureEmptyPresentationMsg( } bool XGUI_WorkshopListener::event(QEvent *theEvent) { - PostponeMessageQtEvent *aPostponedEv = - dynamic_cast(theEvent); + auto *aPostponedEv = dynamic_cast(theEvent); if (aPostponedEv) { std::shared_ptr aEventPtr = aPostponedEv->postponedMessage(); @@ -582,9 +579,8 @@ bool XGUI_WorkshopListener::customizeFeature( XGUI_OperationMgr *anOperationMgr = workshop()->operationMgr(); FeaturePtr aCurrentFeature; if (anOperationMgr->hasOperation()) { - ModuleBase_OperationFeature *aFOperation = - dynamic_cast( - anOperationMgr->currentOperation()); + auto *aFOperation = dynamic_cast( + anOperationMgr->currentOperation()); if (aFOperation) { aCurrentFeature = aFOperation->feature(); } diff --git a/src/XGUI/XGUI_WorkshopListener.h b/src/XGUI/XGUI_WorkshopListener.h index 13b6c27ae..ce033f2a3 100644 --- a/src/XGUI/XGUI_WorkshopListener.h +++ b/src/XGUI/XGUI_WorkshopListener.h @@ -51,13 +51,13 @@ public: /// Constructor. Used only if the workshop is launched in Salome environment /// \param theWorkshop a reference to workshop. XGUI_WorkshopListener(XGUI_Workshop *theWorkshop); - virtual ~XGUI_WorkshopListener(); + ~XGUI_WorkshopListener() override; /// Register this class in the events loop for several types of events void initializeEventListening(); //! Redefinition of Events_Listener method - virtual void processEvent(const std::shared_ptr &theMessage); + void processEvent(const std::shared_ptr &theMessage) override; signals: /// Emitted when error in applivation happens @@ -65,7 +65,7 @@ signals: protected: /// Procedure to process postponed events - bool event(QEvent *theEvent); + bool event(QEvent *theEvent) override; /// Process feature update message /// \param theMsg a message with a container of objects