From 204f6add60cb132f38db3a3205439b8afd74ef1f Mon Sep 17 00:00:00 2001 From: SONOLET Aymeric Date: Fri, 29 Dec 2023 23:06:42 +0100 Subject: [PATCH] fix: modernize with clang-tidy and format with pre-commit Tests are passing --- .clang-tidy | 9 +- .pre-commit-config.yaml | 8 +- dev-tools/format | 2 +- scripts/doxy2swig.py | 2 +- src/BuildAPI/BuildAPI_CompSolid.cpp | 2 +- src/BuildAPI/BuildAPI_CompSolid.h | 6 +- src/BuildAPI/BuildAPI_Filling.cpp | 2 +- src/BuildAPI/BuildAPI_Filling.h | 6 +- src/BuildPlugin/BuildPlugin_CompSolid.h | 4 +- src/BuildPlugin/BuildPlugin_Filling.h | 8 +- src/BuildPlugin/BuildPlugin_Interpolation.cpp | 7 +- src/BuildPlugin/BuildPlugin_Interpolation.h | 8 +- src/BuildPlugin/BuildPlugin_Solid.h | 6 +- src/CollectionPlugin/CollectionPlugin_Group.h | 12 +- .../CollectionPlugin_GroupIntersection.cpp | 9 +- .../CollectionPlugin_GroupIntersection.h | 6 +- .../CollectionPlugin_GroupOperation.h | 2 +- src/Config/Config_Common.cpp | 14 +- src/Config/Config_Common.h | 10 +- src/Config/Config_FeatureMessage.h | 4 +- src/Config/Config_ModuleReader.h | 8 +- src/Config/Config_Prop.h | 2 +- src/Config/Config_Translator.h | 2 +- src/Config/Config_WidgetAPI.h | 8 +- src/Config/Config_XMLReader.cpp | 17 +- src/Config/Config_XMLReader.h | 8 +- .../ConnectorPlugin_ExportFeature.py | 2 +- .../ConnectorPlugin_PublishToStudyFeature.py | 3 +- .../ConstructionPlugin_Axis.cpp | 10 +- .../ConstructionPlugin_Axis.h | 8 +- .../ConstructionPlugin_Point.cpp | 10 +- .../ConstructionPlugin_Point.h | 8 +- src/Events/Events_InfoMessage.h | 6 +- src/Events/Events_Listener.h | 2 +- src/Events/Events_Loop.h | 6 +- src/Events/Events_Message.h | 4 +- src/Events/Events_MessageGroup.h | 4 +- src/FeaturesAPI/FeaturesAPI_Pipe.cpp | 2 +- src/FeaturesAPI/FeaturesAPI_Pipe.h | 6 +- src/FeaturesAPI/FeaturesAPI_Recover.cpp | 2 +- src/FeaturesAPI/FeaturesAPI_Recover.h | 6 +- src/FeaturesAPI/FeaturesAPI_Revolution.cpp | 2 +- src/FeaturesAPI/FeaturesAPI_Revolution.h | 6 +- .../FeaturesPlugin_CommonSharedFaces.h | 4 +- .../FeaturesPlugin_CompositeSketch.h | 21 ++- .../FeaturesPlugin_GroupSharedFaces.cpp | 2 +- .../FeaturesPlugin_GroupSharedFaces.h | 17 +- src/FeaturesPlugin/FeaturesPlugin_Pipe.h | 6 +- src/FeaturesPlugin/FeaturesPlugin_Recover.h | 9 +- .../FeaturesPlugin_RemoveResults.cpp | 2 +- .../FeaturesPlugin_RemoveResults.h | 8 +- .../FeaturesPlugin_RemoveSubShapes.cpp | 24 +-- .../FeaturesPlugin_RemoveSubShapes.h | 11 +- .../FeaturesPlugin_Revolution.h | 6 +- src/FiltersPlugin/FiltersPlugin_OnLine.cpp | 10 +- src/FiltersPlugin/FiltersPlugin_OnLine.h | 14 +- src/GeomAPI/GeomAPI_AISObject.h | 4 +- src/GeomAPI/GeomAPI_Ax3.h | 2 +- src/GeomAPI/GeomAPI_BSpline.h | 2 +- src/GeomAPI/GeomAPI_Circ.cpp | 6 +- src/GeomAPI/GeomAPI_Circ.h | 8 +- src/GeomAPI/GeomAPI_Curve.h | 2 +- .../GeomAPI_DataMapOfShapeMapOfShapes.h | 8 +- src/GeomAPI/GeomAPI_DataMapOfShapeShape.h | 2 +- src/GeomAPI/GeomAPI_Dir.h | 2 +- src/GeomAPI/GeomAPI_Edge.h | 10 +- src/GeomAPI/GeomAPI_Ellipse.h | 2 +- src/GeomAPI/GeomAPI_Face.h | 10 +- src/GeomAPI/GeomAPI_ICustomPrs.h | 2 +- src/GeomAPI/GeomAPI_IPresentable.h | 2 +- src/GeomAPI/GeomAPI_Lin.h | 2 +- src/GeomAPI/GeomAPI_Lin2d.h | 2 +- src/GeomAPI/GeomAPI_Pln.h | 2 +- src/GeomAPI/GeomAPI_Pnt.h | 2 +- src/GeomAPI/GeomAPI_Pnt2d.h | 2 +- src/GeomAPI/GeomAPI_Shape.h | 4 +- src/GeomAPI/GeomAPI_Vertex.h | 4 +- src/GeomAPI/GeomAPI_Wire.h | 4 +- src/GeomAPI/GeomAPI_XYZ.h | 2 +- src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.h | 4 +- src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.cpp | 7 +- src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.h | 12 +- src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp | 12 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp | 51 +++-- src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h | 12 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.h | 6 +- src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.h | 12 +- .../GeomAlgoAPI_MapShapesAndAncestors.h | 6 +- src/GeomAlgoAPI/GeomAlgoAPI_Offset.h | 4 +- src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h | 2 +- src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h | 8 +- src/GeomAlgoAPI/GeomAlgoAPI_Sphere.h | 4 +- src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.h | 2 +- src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.cxx | 4 +- src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.hxx | 13 +- src/GeomAlgoImpl/GEOMAlgo_BuilderShape.cxx | 2 +- src/GeomAlgoImpl/GEOMAlgo_BuilderShape.hxx | 2 +- src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.cxx | 2 +- src/GeomDataAPI/GeomDataAPI_Dir.h | 6 +- src/GeomDataAPI/GeomDataAPI_Point.cpp | 4 +- src/GeomDataAPI/GeomDataAPI_Point.h | 6 +- src/GeomDataAPI/GeomDataAPI_Point2D.h | 6 +- src/GeomDataAPI/GeomDataAPI_Point2DArray.h | 6 +- src/GeomValidators/GeomValidators_Finite.h | 4 +- src/Model/Model_AttributeSelection.cpp | 2 +- src/Model/Model_AttributeString.h | 12 +- src/Model/Model_BodyBuilder.cpp | 4 +- src/Model/Model_Document.cpp | 4 +- src/Model/Model_Document.h | 177 +++++++++--------- src/Model/Model_ResultParameter.cpp | 4 +- src/Model/Model_ResultParameter.h | 4 +- src/Model/Model_Update.cpp | 2 +- src/ModelAPI/ModelAPI_Attribute.h | 2 +- src/ModelAPI/ModelAPI_AttributeBoolean.h | 6 +- src/ModelAPI/ModelAPI_AttributeDocRef.h | 6 +- src/ModelAPI/ModelAPI_AttributeDouble.h | 6 +- src/ModelAPI/ModelAPI_AttributeDoubleArray.h | 6 +- src/ModelAPI/ModelAPI_AttributeImage.cpp | 4 +- src/ModelAPI/ModelAPI_AttributeImage.h | 6 +- src/ModelAPI/ModelAPI_AttributeIntArray.h | 6 +- src/ModelAPI/ModelAPI_AttributeInteger.h | 6 +- src/ModelAPI/ModelAPI_AttributeRefAttr.h | 6 +- .../ModelAPI_AttributeRefAttrList.cpp | 4 +- src/ModelAPI/ModelAPI_AttributeRefAttrList.h | 6 +- src/ModelAPI/ModelAPI_AttributeRefList.h | 6 +- src/ModelAPI/ModelAPI_AttributeReference.h | 6 +- src/ModelAPI/ModelAPI_AttributeSelection.h | 6 +- .../ModelAPI_AttributeSelectionList.h | 12 +- src/ModelAPI/ModelAPI_AttributeString.h | 6 +- src/ModelAPI/ModelAPI_AttributeTables.h | 6 +- src/ModelAPI/ModelAPI_AttributeValidator.h | 2 +- src/ModelAPI/ModelAPI_CompositeFeature.h | 6 +- src/ModelAPI/ModelAPI_Data.h | 2 +- src/ModelAPI/ModelAPI_Document.cpp | 4 +- src/ModelAPI/ModelAPI_Document.h | 8 +- src/ModelAPI/ModelAPI_Entity.h | 2 +- src/ModelAPI/ModelAPI_EventReentrantMessage.h | 4 +- src/ModelAPI/ModelAPI_Events.cpp | 2 +- src/ModelAPI/ModelAPI_Events.h | 97 +++++----- src/ModelAPI/ModelAPI_Feature.h | 16 +- src/ModelAPI/ModelAPI_Filter.h | 4 +- src/ModelAPI/ModelAPI_FiltersArgs.h | 2 +- src/ModelAPI/ModelAPI_FiltersFeature.h | 2 +- src/ModelAPI/ModelAPI_Folder.h | 12 +- src/ModelAPI/ModelAPI_IReentrant.h | 2 +- src/ModelAPI/ModelAPI_Object.h | 4 +- src/ModelAPI/ModelAPI_Result.h | 12 +- src/ModelAPI/ModelAPI_ResultBody.h | 10 +- src/ModelAPI/ModelAPI_ResultConstruction.h | 4 +- src/ModelAPI/ModelAPI_ResultField.h | 22 +-- src/ModelAPI/ModelAPI_ResultGroup.h | 6 +- src/ModelAPI/ModelAPI_ResultParameter.h | 8 +- src/ModelAPI/ModelAPI_ResultPart.h | 4 +- src/ModelAPI/ModelAPI_Session.h | 4 +- src/ModelAPI/ModelAPI_Tools.cpp | 6 +- src/ModelAPI/ModelAPI_Validator.h | 10 +- src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp | 2 +- src/ModelHighAPI/ModelHighAPI_Dumper.h | 36 ++-- src/ModelHighAPI/ModelHighAPI_Interface.cpp | 8 +- src/ModelHighAPI/ModelHighAPI_Interface.h | 2 +- src/ModelHighAPI/ModelHighAPI_Reference.cpp | 4 +- src/ModelHighAPI/ModelHighAPI_Selection.h | 11 +- src/ModuleBase/ModuleBase_ActionInfo.h | 2 +- src/ModuleBase/ModuleBase_ActionParameter.h | 4 +- src/ModuleBase/ModuleBase_Definitions.h | 8 +- src/ModuleBase/ModuleBase_DoubleSpinBox.h | 12 +- src/ModuleBase/ModuleBase_Filter.h | 2 +- src/ModuleBase/ModuleBase_FilterValidated.h | 6 +- src/ModuleBase/ModuleBase_IModule.h | 33 ++-- src/ModuleBase/ModuleBase_ISelection.h | 2 +- .../ModuleBase_ISelectionActivate.h | 2 +- src/ModuleBase/ModuleBase_IViewWindow.cpp | 4 +- src/ModuleBase/ModuleBase_IViewer.h | 4 +- src/ModuleBase/ModuleBase_IWorkshop.h | 2 +- src/ModuleBase/ModuleBase_IconFactory.h | 2 +- src/ModuleBase/ModuleBase_IntSpinBox.h | 7 +- src/ModuleBase/ModuleBase_LabelValue.h | 2 +- src/ModuleBase/ModuleBase_ModelWidget.cpp | 6 +- src/ModuleBase/ModuleBase_ModelWidget.h | 12 +- src/ModuleBase/ModuleBase_Operation.h | 4 +- .../ModuleBase_OperationFeature.cpp | 2 +- src/ModuleBase/ModuleBase_OperationFeature.h | 20 +- src/ModuleBase/ModuleBase_ParamIntSpinBox.cpp | 4 +- src/ModuleBase/ModuleBase_ParamIntSpinBox.h | 16 +- src/ModuleBase/ModuleBase_ParamSpinBox.h | 16 +- src/ModuleBase/ModuleBase_Preferences.cpp | 2 +- src/ModuleBase/ModuleBase_ResultPrs.h | 22 +-- src/ModuleBase/ModuleBase_Tools.cpp | 4 +- src/ModuleBase/ModuleBase_Tools.h | 2 +- src/ModuleBase/ModuleBase_ViewerPrs.h | 4 +- .../ModuleBase_WidgetConcealedObjects.cpp | 13 +- .../ModuleBase_WidgetConcealedObjects.h | 10 +- .../ModuleBase_WidgetFeatureSelector.cpp | 8 +- .../ModuleBase_WidgetFeatureSelector.h | 28 +-- .../ModuleBase_WidgetMultiSelector.cpp | 2 +- src/ModuleBase/ModuleBase_WidgetSelector.h | 21 ++- src/ModuleBase/ModuleBase_WidgetValidated.cpp | 2 +- src/ModuleBase/ModuleBase_WidgetValidated.h | 14 +- src/PartSet/PartSet_BSplineWidget.cpp | 20 +- src/PartSet/PartSet_BSplineWidget.h | 16 +- src/PartSet/PartSet_CustomPrs.cpp | 13 +- src/PartSet/PartSet_CustomPrs.h | 13 +- src/PartSet/PartSet_MenuMgr.cpp | 50 +++-- src/PartSet/PartSet_MenuMgr.h | 4 +- src/PartSet/PartSet_Module.h | 166 ++++++++-------- src/PartSet/PartSet_OperationPrs.cpp | 6 +- src/PartSet/PartSet_OperationPrs.h | 10 +- .../PartSet_OverconstraintListener.cpp | 2 +- src/PartSet/PartSet_OverconstraintListener.h | 5 +- src/PartSet/PartSet_PreviewSketchPlane.h | 3 +- src/PartSet/PartSet_ResultSketchPrs.cpp | 2 +- src/PartSet/PartSet_SketcherMgr.cpp | 28 +-- src/PartSet/PartSet_SketcherMgr.h | 12 +- src/PartSet/PartSet_SketcherReentrantMgr.cpp | 2 +- src/PartSet/PartSet_WidgetSketchCreator.cpp | 2 +- src/PartSetPlugin/PartSetPlugin_Part.h | 24 +-- .../PrimitivesPlugin_Sphere.cpp | 10 +- .../PrimitivesPlugin_Sphere.h | 6 +- src/PythonAPI/examples/Platine.py | 1 - src/PythonAPI/initConfig.py | 1 - src/PythonAPI/model/dump/DumpAssistant.py | 1 - src/PythonAPI/model/tests/tests.py | 14 +- .../macros/compoundVertices/feature.py | 1 - .../macros/importParameters/feature.py | 1 - .../macros/midSurface/surfaceMediane.py | 1 - .../macros/pipeNetwork/feature.py | 2 +- src/SHAPERGUI/SHAPERGUI_NestedButton.cpp | 15 +- src/SHAPERGUI/SHAPERGUI_NestedButton.h | 16 +- .../SamplePanelPlugin_Plugin.h | 2 +- src/Selector/Selector_Algo.h | 2 +- src/Selector/Selector_NameGenerator.h | 3 +- src/Selector/Selector_Primitive.h | 10 +- src/SketchAPI/SketchAPI_MacroArc.cpp | 2 +- src/SketchAPI/SketchAPI_MacroArc.h | 4 +- src/SketchAPI/SketchAPI_MacroMiddlePoint.cpp | 9 +- src/SketchAPI/SketchAPI_MacroMiddlePoint.h | 2 +- src/SketchAPI/SketchAPI_Point.h | 6 +- src/SketchAPI/SketchAPI_SketchEntity.h | 6 +- src/SketchPlugin/SketchPlugin_Arc.h | 10 +- src/SketchPlugin/SketchPlugin_BSpline.h | 8 +- src/SketchPlugin/SketchPlugin_BSplineBase.h | 11 +- .../SketchPlugin_BSplinePeriodic.h | 4 +- src/SketchPlugin/SketchPlugin_Circle.h | 10 +- src/SketchPlugin/SketchPlugin_Constraint.h | 2 +- .../SketchPlugin_ConstraintBase.h | 2 +- .../SketchPlugin_ConstraintCoincidence.h | 10 +- .../SketchPlugin_ConstraintEqual.cpp | 2 +- .../SketchPlugin_ConstraintEqual.h | 10 +- .../SketchPlugin_ConstraintHorizontal.cpp | 2 +- .../SketchPlugin_ConstraintMiddle.h | 12 +- .../SketchPlugin_ConstraintRadius.h | 20 +- .../SketchPlugin_ConstraintRigid.h | 10 +- .../SketchPlugin_ConstraintTangent.h | 10 +- src/SketchPlugin/SketchPlugin_Ellipse.h | 10 +- src/SketchPlugin/SketchPlugin_EllipticArc.h | 10 +- src/SketchPlugin/SketchPlugin_Feature.h | 2 +- src/SketchPlugin/SketchPlugin_Line.cpp | 2 +- src/SketchPlugin/SketchPlugin_Line.h | 16 +- src/SketchPlugin/SketchPlugin_MacroArc.h | 18 +- src/SketchPlugin/SketchPlugin_Offset.cpp | 95 +++++----- src/SketchPlugin/SketchPlugin_Offset.h | 17 +- src/SketchPlugin/SketchPlugin_Plugin.cpp | 2 +- src/SketchPlugin/SketchPlugin_Point.h | 10 +- src/SketchPlugin/SketchPlugin_Projection.cpp | 12 +- src/SketchPlugin/SketchPlugin_Projection.h | 18 +- src/SketchPlugin/SketchPlugin_Sketch.h | 29 +-- src/SketchPlugin/SketchPlugin_SketchEntity.h | 16 +- src/SketchPlugin/SketchPlugin_Split.cpp | 2 +- src/SketcherPrs/SketcherPrs_Angle.cpp | 6 +- .../SketcherPrs_DimensionStyle.cpp | 6 +- src/SketcherPrs/SketcherPrs_DimensionStyle.h | 2 +- src/SketcherPrs/SketcherPrs_Radius.h | 12 +- src/XGUI/XGUI.h | 2 +- src/XGUI/XGUI_ActiveControlMgr.cpp | 16 +- src/XGUI/XGUI_ActiveControlMgr.h | 8 +- src/XGUI/XGUI_ActiveControlSelector.h | 6 +- src/XGUI/XGUI_ContextMenuMgr.cpp | 2 +- src/XGUI/XGUI_DataModel.h | 50 ++--- src/XGUI/XGUI_DeflectionDialog.cpp | 4 +- src/XGUI/XGUI_DeflectionDialog.h | 3 +- src/XGUI/XGUI_Displayer.cpp | 16 +- src/XGUI/XGUI_Displayer.h | 2 +- src/XGUI/XGUI_ErrorMgr.cpp | 2 +- src/XGUI/XGUI_ModuleConnector.h | 66 +++---- src/XGUI/XGUI_ObjectsBrowser.h | 22 +-- src/XGUI/XGUI_OperationMgr.cpp | 2 +- src/XGUI/XGUI_OperationMgr.h | 8 +- src/XGUI/XGUI_PropertyPanel.cpp | 6 +- src/XGUI/XGUI_SelectionActivate.cpp | 8 +- src/XGUI/XGUI_SelectionActivate.h | 10 +- src/XGUI/XGUI_SelectionMgr.h | 2 +- src/XGUI/XGUI_ViewerProxy.h | 70 +++---- src/XGUI/XGUI_Workshop.cpp | 16 +- src/XGUI/XGUI_Workshop.h | 6 +- src/XGUI/XGUI_WorkshopListener.cpp | 8 +- test.models/coronavirus.py | 4 +- 296 files changed, 1416 insertions(+), 1437 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index f79ac434d..7af9d2341 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,11 +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 +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 WarningsAsErrors: '' HeaderFilterRegex: .*SHAPER.* AnalyzeTemporaryDtors: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70a5c0398..0623571e2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -61,6 +61,7 @@ repos: - id: ruff types_or: [python, pyi, jupyter] args: [--fix] + exclude: .*[Tt]est.* # Run the formatter. - id: ruff-format types_or: [python, pyi, jupyter] @@ -68,7 +69,12 @@ repos: rev: v0.1 # Use the sha / tag you want to point at hooks: - id: clang-format - - id: clang-tidy + # - id: clang-tidy + # files: | + # (?x)^( + # .*\.cpp| + # .*\.cxx + # )$ - repo: https://github.com/scop/pre-commit-shfmt rev: v3.7.0-4 hooks: diff --git a/dev-tools/format b/dev-tools/format index d705bac35..5412ace5d 100755 --- a/dev-tools/format +++ b/dev-tools/format @@ -52,7 +52,7 @@ if __name__ == "__main__": return True if not (find_bin(args.black_bin) and find_bin(args.clang_format_bin)): - print(f"Missing binaries must be installed. Abort.") + print("Missing binaries must be installed. Abort.") sys.exit(1) # collect paths of all the C++ source files diff --git a/scripts/doxy2swig.py b/scripts/doxy2swig.py index b1306143f..c295001c8 100755 --- a/scripts/doxy2swig.py +++ b/scripts/doxy2swig.py @@ -756,7 +756,7 @@ class Doxy2SWIG: name = self.extract_text(first["name"]) if name[:8] == "operator": # Don't handle operators yet. return - if not "definition" in first or kind in ["variable", "typedef"]: + if "definition" not in first or kind in ["variable", "typedef"]: return data = self.extract_text(first["definition"]) diff --git a/src/BuildAPI/BuildAPI_CompSolid.cpp b/src/BuildAPI/BuildAPI_CompSolid.cpp index d9932fc42..8fa1bfbe5 100644 --- a/src/BuildAPI/BuildAPI_CompSolid.cpp +++ b/src/BuildAPI/BuildAPI_CompSolid.cpp @@ -41,7 +41,7 @@ BuildAPI_CompSolid::BuildAPI_CompSolid( } //================================================================================================== -BuildAPI_CompSolid::~BuildAPI_CompSolid() {} +BuildAPI_CompSolid::~BuildAPI_CompSolid() = default; //================================================================================================== void BuildAPI_CompSolid::setBase( diff --git a/src/BuildAPI/BuildAPI_CompSolid.h b/src/BuildAPI/BuildAPI_CompSolid.h index 966bb3c19..0c03efb9d 100644 --- a/src/BuildAPI/BuildAPI_CompSolid.h +++ b/src/BuildAPI/BuildAPI_CompSolid.h @@ -48,7 +48,7 @@ public: /// Destructor. BUILDAPI_EXPORT - virtual ~BuildAPI_CompSolid(); + ~BuildAPI_CompSolid() override; INTERFACE_1(BuildPlugin_CompSolid::ID(), baseObjects, BuildPlugin_CompSolid::BASE_OBJECTS_ID(), @@ -61,11 +61,11 @@ public: /// Dump wrapped feature BUILDAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on CompSolid object. -typedef std::shared_ptr CompSolidPtr; +using CompSolidPtr = std::shared_ptr; /// \ingroup CPPHighAPI /// \brief Create CompSolid feature. diff --git a/src/BuildAPI/BuildAPI_Filling.cpp b/src/BuildAPI/BuildAPI_Filling.cpp index 58514cea1..e28bcd101 100644 --- a/src/BuildAPI/BuildAPI_Filling.cpp +++ b/src/BuildAPI/BuildAPI_Filling.cpp @@ -59,7 +59,7 @@ BuildAPI_Filling::BuildAPI_Filling( } } -BuildAPI_Filling::~BuildAPI_Filling() {} +BuildAPI_Filling::~BuildAPI_Filling() = default; void BuildAPI_Filling::execIfBaseNotEmpty() { if (baseObjects()->size() > 0) diff --git a/src/BuildAPI/BuildAPI_Filling.h b/src/BuildAPI/BuildAPI_Filling.h index 95b608c8e..a007272ff 100644 --- a/src/BuildAPI/BuildAPI_Filling.h +++ b/src/BuildAPI/BuildAPI_Filling.h @@ -55,7 +55,7 @@ public: const double theTolerance3D, const bool theApproximate); /// Destructor. - BUILDAPI_EXPORT virtual ~BuildAPI_Filling(); + BUILDAPI_EXPORT ~BuildAPI_Filling() override; INTERFACE_8( BuildPlugin_Filling::ID(), baseObjects, @@ -102,7 +102,7 @@ public: BUILDAPI_EXPORT void setApproximation(const bool theApproximate); /// Dump wrapped feature - BUILDAPI_EXPORT virtual void dump(ModelHighAPI_Dumper &theDumper) const; + BUILDAPI_EXPORT void dump(ModelHighAPI_Dumper &theDumper) const override; private: void execIfBaseNotEmpty(); @@ -110,7 +110,7 @@ private: }; /// Pointer on Face object. -typedef std::shared_ptr FillingPtr; +using FillingPtr = std::shared_ptr; /// \ingroup CPPHighAPI /// \brief Create Filling feature. diff --git a/src/BuildPlugin/BuildPlugin_CompSolid.h b/src/BuildPlugin/BuildPlugin_CompSolid.h index 8102355c7..6820c8b71 100644 --- a/src/BuildPlugin/BuildPlugin_CompSolid.h +++ b/src/BuildPlugin/BuildPlugin_CompSolid.h @@ -45,14 +45,14 @@ 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_CompSolid::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; }; #endif diff --git a/src/BuildPlugin/BuildPlugin_Filling.h b/src/BuildPlugin/BuildPlugin_Filling.h index 7764f0cc8..e46140e0d 100644 --- a/src/BuildPlugin/BuildPlugin_Filling.h +++ b/src/BuildPlugin/BuildPlugin_Filling.h @@ -48,7 +48,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_Filling::ID(); return MY_KIND; } @@ -142,14 +142,14 @@ 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; /// 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; private: /// Convert shape to edge according to construction method diff --git a/src/BuildPlugin/BuildPlugin_Interpolation.cpp b/src/BuildPlugin/BuildPlugin_Interpolation.cpp index 4bcdb5a64..b3ed0320f 100644 --- a/src/BuildPlugin/BuildPlugin_Interpolation.cpp +++ b/src/BuildPlugin/BuildPlugin_Interpolation.cpp @@ -49,7 +49,7 @@ #include //================================================================================================= -BuildPlugin_Interpolation::BuildPlugin_Interpolation() {} +BuildPlugin_Interpolation::BuildPlugin_Interpolation() = default; //================================================================================================= void BuildPlugin_Interpolation::initAttributes() { @@ -223,7 +223,7 @@ void BuildPlugin_Interpolation::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, anEdge, aContextIt == aContexts.begin()); @@ -327,8 +327,7 @@ void BuildPlugin_Interpolation::evaluate(std::string &theError) { // store the list of parameters to store if changed AttributeRefListPtr aParams = reflist(ARGUMENTS_ID()); 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/BuildPlugin/BuildPlugin_Interpolation.h b/src/BuildPlugin/BuildPlugin_Interpolation.h index 638458b8f..e5644ff51 100644 --- a/src/BuildPlugin/BuildPlugin_Interpolation.h +++ b/src/BuildPlugin/BuildPlugin_Interpolation.h @@ -157,21 +157,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_Interpolation::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; /// 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; protected: /// Evaluates the expression x(t), y(t),z(t) in value table. diff --git a/src/BuildPlugin/BuildPlugin_Solid.h b/src/BuildPlugin/BuildPlugin_Solid.h index beef610bc..9b68b2dcb 100644 --- a/src/BuildPlugin/BuildPlugin_Solid.h +++ b/src/BuildPlugin/BuildPlugin_Solid.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_Solid::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: /// Explode compound to get single shape diff --git a/src/CollectionPlugin/CollectionPlugin_Group.h b/src/CollectionPlugin/CollectionPlugin_Group.h index 0994b19fa..1eae7eeb7 100644 --- a/src/CollectionPlugin/CollectionPlugin_Group.h +++ b/src/CollectionPlugin/CollectionPlugin_Group.h @@ -46,27 +46,27 @@ 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_Group::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; /// Result of groups is created on the fly and don't stored to the document - COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() { return true; } + COLLECTIONPLUGIN_EXPORT bool isPersistentResult() override { return true; } /// Use plugin manager for features creation CollectionPlugin_Group(); /// Used for the split action of the group (Move to the end and split) - COLLECTIONPLUGIN_EXPORT virtual bool - customAction(const std::string &theActionId); + COLLECTIONPLUGIN_EXPORT bool + customAction(const std::string &theActionId) override; }; #endif diff --git a/src/CollectionPlugin/CollectionPlugin_GroupIntersection.cpp b/src/CollectionPlugin/CollectionPlugin_GroupIntersection.cpp index 05c0532e9..79081e1f0 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupIntersection.cpp +++ b/src/CollectionPlugin/CollectionPlugin_GroupIntersection.cpp @@ -31,9 +31,10 @@ #include #include -typedef std::set SetOfShape; +using SetOfShape = std::set; -CollectionPlugin_GroupIntersection::CollectionPlugin_GroupIntersection() {} +CollectionPlugin_GroupIntersection::CollectionPlugin_GroupIntersection() = + default; void CollectionPlugin_GroupIntersection::initAttributes() { data()->addAttribute(CollectionPlugin_GroupIntersection::LIST_ID(), @@ -55,11 +56,11 @@ static void keepCommonShapes(const GeomShapePtr &theCompound, SetOfShape aSubs; explodeCompound(theCompound, aSubs); - ListOfShape::iterator anIt = theShapes.begin(); + auto anIt = theShapes.begin(); while (anIt != theShapes.end()) { if (aSubs.find(*anIt) == aSubs.end()) { // the shape is not found - ListOfShape::iterator aRemoveIt = anIt++; + auto aRemoveIt = anIt++; theShapes.erase(aRemoveIt); } else ++anIt; diff --git a/src/CollectionPlugin/CollectionPlugin_GroupIntersection.h b/src/CollectionPlugin/CollectionPlugin_GroupIntersection.h index 4df08889d..a8bde33a0 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupIntersection.h +++ b/src/CollectionPlugin/CollectionPlugin_GroupIntersection.h @@ -43,17 +43,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_GroupIntersection::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_GroupIntersection(); diff --git a/src/CollectionPlugin/CollectionPlugin_GroupOperation.h b/src/CollectionPlugin/CollectionPlugin_GroupOperation.h index 9b8db711b..1e4e9fe57 100644 --- a/src/CollectionPlugin/CollectionPlugin_GroupOperation.h +++ b/src/CollectionPlugin/CollectionPlugin_GroupOperation.h @@ -31,7 +31,7 @@ class CollectionPlugin_GroupOperation : public CollectionPlugin_Group { public: /// Result of groups is created on the fly and don't stored to the document - COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() { return true; } + COLLECTIONPLUGIN_EXPORT bool isPersistentResult() override { return true; } protected: /// Updates the type of selection list based on types of selected groups diff --git a/src/Config/Config_Common.cpp b/src/Config/Config_Common.cpp index f8a50d2b7..dbe6ada31 100644 --- a/src/Config/Config_Common.cpp +++ b/src/Config/Config_Common.cpp @@ -48,7 +48,7 @@ bool isNode(xmlNodePtr theNode, const char *theNodeName, ...) { va_start(args, theNodeName); // init list; point to last defined argument while (true) { char *anArg = va_arg(args, char *); // get next argument - if (anArg == NULL) + if (anArg == nullptr) break; if (!xmlStrcmp(aName, (const xmlChar *)anArg)) { va_end(args); // cleanup the system stack @@ -138,7 +138,7 @@ bool hasParent(xmlNodePtr theNode, const char *theNodeName, ...) { va_start(args, theNodeName); // init list; point to last defined argument while (true) { char *anArg = va_arg(args, char *); // get next argument - if (anArg == NULL) + if (anArg == nullptr) break; if (!xmlStrcmp(aName, (const xmlChar *)anArg)) { va_end(args); // cleanup the system stack @@ -152,15 +152,15 @@ bool hasParent(xmlNodePtr theNode, const char *theNodeName, ...) { xmlNodePtr hasParentRecursive(xmlNodePtr theNode, const std::vector &theNodeNames) { if (!hasParent(theNode)) { - return 0; // have no parents at all + return nullptr; // have no parents at all } xmlNodePtr aNode = theNode->parent; const xmlChar *aName = aNode->name; if (!aName || !isElementNode(aNode)) { - return 0; + return nullptr; } - for (size_t anIndex = 0; anIndex < theNodeNames.size(); ++anIndex) { - if (!xmlStrcmp(aName, (const xmlChar *)theNodeNames[anIndex])) + for (auto theNodeName : theNodeNames) { + if (!xmlStrcmp(aName, (const xmlChar *)theNodeName)) return aNode; } return hasParentRecursive(aNode, theNodeNames); @@ -174,7 +174,7 @@ xmlNodePtr hasParentRecursive(xmlNodePtr theNode, const char *theNodeName, aNodeNames.push_back(theNodeName); while (true) { char *anArg = va_arg(args, char *); // get next argument - if (anArg == NULL) + if (anArg == nullptr) break; aNodeNames.push_back(anArg); } diff --git a/src/Config/Config_Common.h b/src/Config/Config_Common.h index 6abd2adba..7acaf4958 100644 --- a/src/Config/Config_Common.h +++ b/src/Config/Config_Common.h @@ -28,14 +28,14 @@ #include //>> Forward declaration of xmlNodePtr. -typedef struct _xmlNode xmlNode; -typedef xmlNode *xmlNodePtr; +using xmlNode = struct _xmlNode; +using xmlNodePtr = xmlNode *; struct _xmlNode; //<< //>> Forward declaration of xmlDocPtr. -typedef struct _xmlDoc xmlDoc; -typedef xmlDoc *xmlDocPtr; +using xmlDoc = struct _xmlDoc; +using xmlDocPtr = xmlDoc *; struct _xmlDoc; //<< @@ -54,7 +54,7 @@ CONFIG_EXPORT bool isElementNode(xmlNodePtr theNode); */ CONFIG_EXPORT bool isNode(xmlNodePtr theNode, const char *theNodeName, ...); -//#define isNode(p) _isNode(p, NULL) +// #define isNode(p) _isNode(p, NULL) /*! * Checks if the given node is attribute node. diff --git a/src/Config/Config_FeatureMessage.h b/src/Config/Config_FeatureMessage.h index c3fd66b3f..338da4964 100644 --- a/src/Config/Config_FeatureMessage.h +++ b/src/Config/Config_FeatureMessage.h @@ -83,9 +83,9 @@ public: /// Constructs Config_FeatureMessage CONFIG_EXPORT Config_FeatureMessage(const Events_ID theId, - const void *theParent = 0); + const void *theParent = nullptr); /// Deletes Config_FeatureMessage - CONFIG_EXPORT virtual ~Config_FeatureMessage(); + CONFIG_EXPORT ~Config_FeatureMessage() override; // Auto-generated getters/setters /// Feature's Id diff --git a/src/Config/Config_ModuleReader.h b/src/Config/Config_ModuleReader.h index 09a7a079a..2cab76cc0 100644 --- a/src/Config/Config_ModuleReader.h +++ b/src/Config/Config_ModuleReader.h @@ -40,9 +40,9 @@ class Config_ModuleReader : public Config_XMLReader { public: /// Constructor - CONFIG_EXPORT Config_ModuleReader(const char *theEventGenerated = 0); + CONFIG_EXPORT Config_ModuleReader(const char *theEventGenerated = nullptr); /// Destructor - CONFIG_EXPORT virtual ~Config_ModuleReader(); + CONFIG_EXPORT ~Config_ModuleReader() override; /// Returns map that describes which file contains a feature /// (the feature is key, the file is value) CONFIG_EXPORT const std::map & @@ -79,9 +79,9 @@ public: protected: /// Recursively process the given xmlNode - virtual void processNode(xmlNodePtr aNode); + void processNode(xmlNodePtr aNode) override; /// Defines if the reader should process children of the given node - virtual bool processChildren(xmlNodePtr aNode); + bool processChildren(xmlNodePtr aNode) override; /// check if dependencies of the given node are in the list of loaded modules bool hasRequiredModules(xmlNodePtr aNode) const; /// reads info about plugin's features from plugin xml description diff --git a/src/Config/Config_Prop.h b/src/Config/Config_Prop.h index d7eb4b977..583caa7d1 100644 --- a/src/Config/Config_Prop.h +++ b/src/Config/Config_Prop.h @@ -133,6 +133,6 @@ private: std::string myMax; // Maximal value }; -typedef std::list Config_Properties; +using Config_Properties = std::list; #endif diff --git a/src/Config/Config_Translator.h b/src/Config/Config_Translator.h index 83ceb64e1..54186372a 100644 --- a/src/Config/Config_Translator.h +++ b/src/Config/Config_Translator.h @@ -28,7 +28,7 @@ #include /// The definition provides collection and writing of missed translations -//#define MISSED_TRANSLATION +// #define MISSED_TRANSLATION /** * \class Config_Translator diff --git a/src/Config/Config_WidgetAPI.h b/src/Config/Config_WidgetAPI.h index f47425a11..04ff23dc4 100644 --- a/src/Config/Config_WidgetAPI.h +++ b/src/Config/Config_WidgetAPI.h @@ -27,14 +27,14 @@ #include //>> Forward declaration of xmlNodePtr. -typedef struct _xmlNode xmlNode; -typedef xmlNode *xmlNodePtr; +using xmlNode = struct _xmlNode; +using xmlNodePtr = xmlNode *; struct _xmlNode; //<< //>> Forward declaration of xmlDocPtr. -typedef struct _xmlDoc xmlDoc; -typedef xmlDoc *xmlDocPtr; +using xmlDoc = struct _xmlDoc; +using xmlDocPtr = xmlDoc *; struct _xmlDoc; //<< diff --git a/src/Config/Config_XMLReader.cpp b/src/Config/Config_XMLReader.cpp index 1d0a86839..3fa444a4e 100644 --- a/src/Config/Config_XMLReader.cpp +++ b/src/Config/Config_XMLReader.cpp @@ -48,7 +48,7 @@ static const char FSEP = '/'; Config_XMLReader::Config_XMLReader(const std::string &theXmlFileName, bool isXMLContent) - : myXmlDoc(NULL), myRootFileName(theXmlFileName) { + : myXmlDoc(nullptr), myRootFileName(theXmlFileName) { isFromMemory = isXMLContent; if (!isXMLContent) { myDocumentPath = findConfigFile(theXmlFileName); @@ -179,10 +179,10 @@ void Config_XMLReader::readAll() { break; // no more solutions } - if (myXmlDoc != NULL) { // clear the previous XML document - now the new one - // will be opened + if (myXmlDoc != nullptr) { // clear the previous XML document - now the new + // one will be opened xmlFreeDoc(myXmlDoc); - myXmlDoc = NULL; + myXmlDoc = nullptr; } xmlNodePtr aRoot = findRoot(aFoundFile); readRecursively(aRoot); @@ -212,16 +212,16 @@ bool Config_XMLReader::processChildren(xmlNodePtr /*aNode*/) { return true; } xmlNodePtr Config_XMLReader::findRoot(const std::string theDocumentPath) { std::string aDocPath = theDocumentPath.empty() ? myDocumentPath : theDocumentPath; - if (myXmlDoc == NULL) { + if (myXmlDoc == nullptr) { myXmlDoc = xmlParseFile(aDocPath.c_str()); } - if (myXmlDoc == NULL) { + if (myXmlDoc == nullptr) { #ifdef _DEBUG std::cout << "Config_XMLReader::import: " << "Document " << aDocPath << " is not parsed successfully." << std::endl; #endif - return NULL; + return nullptr; } xmlNodePtr aRoot = xmlDocGetRootElement(myXmlDoc); #ifdef _DEBUG @@ -301,8 +301,7 @@ bool Config_XMLReader::cleanupAttribute(const char *theNodeName, std::string aKey = std::string(theNodeName) + ":" + std::string(theNodeAttribute); bool result = false; - std::map::iterator anEntry = - myCachedAttributes.find(aKey); + auto anEntry = myCachedAttributes.find(aKey); if (anEntry != myCachedAttributes.end()) { myCachedAttributes.erase(anEntry); result = true; diff --git a/src/Config/Config_XMLReader.h b/src/Config/Config_XMLReader.h index 681c1bd5f..c51367401 100644 --- a/src/Config/Config_XMLReader.h +++ b/src/Config/Config_XMLReader.h @@ -28,14 +28,14 @@ #include //>> Forward declaration of xmlNodePtr. -typedef struct _xmlNode xmlNode; -typedef xmlNode *xmlNodePtr; +using xmlNode = struct _xmlNode; +using xmlNodePtr = xmlNode *; struct _xmlNode; //<< //>> Forward declaration of xmlDocPtr. -typedef struct _xmlDoc xmlDoc; -typedef xmlDoc *xmlDocPtr; +using xmlDoc = struct _xmlDoc; +using xmlDocPtr = xmlDoc *; struct _xmlDoc; //<< diff --git a/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py b/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py index 95e9a6837..aa6ab3a7a 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py @@ -70,7 +70,7 @@ class ExportFeature(ModelAPI.ModelAPI_Feature): # do not export picture if aResult.hasTexture() is True: continue - if not aResult is None: + if aResult is not None: if (not aResult.shape() or aResult.shape().isNull()) and isPart: aPart = model.modelAPI_ResultPart(aResult) aPartDoc = aPart.partDoc() diff --git a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py index 9c27c38d9..e644c80a1 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py @@ -21,7 +21,6 @@ # ExportFeature class definition import ModelAPI -import ExchangeAPI import EventsAPI from GeomAPI import GeomAPI_Shape, GeomAPI_ShapeExplorer import GeomAlgoAPI @@ -216,7 +215,7 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): anId = GeomAlgoAPI.GeomAlgoAPI_CompoundBuilder.id( aResShape, anExplorer.current() ) - if anId > 0 and not anId in aGroupHasIndex: + if anId > 0 and anId not in aGroupHasIndex: aGroupIndices.append(anId) aGroupHasIndex[anId] = 0 anExplorer.next() diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp index b819d1e82..d68fa5aa3 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp @@ -47,7 +47,7 @@ static const double defaultAxisSize = 100; -ConstructionPlugin_Axis::ConstructionPlugin_Axis() {} +ConstructionPlugin_Axis::ConstructionPlugin_Axis() = default; void ConstructionPlugin_Axis::initAttributes() { data()->addAttribute(ConstructionPlugin_Axis::METHOD(), @@ -106,7 +106,7 @@ void ConstructionPlugin_Axis::createAxisByTwoPoints() { data()->selection(ConstructionPlugin_Axis::POINT_FIRST()); AttributeSelectionPtr aRef2 = data()->selection(ConstructionPlugin_Axis::POINT_SECOND()); - if ((aRef1.get() != NULL) && (aRef2.get() != NULL)) { + if ((aRef1.get() != nullptr) && (aRef2.get() != nullptr)) { GeomShapePtr aShape1 = aRef1->value(); if (!aShape1.get()) aShape1 = aRef1->context()->shape(); @@ -141,8 +141,8 @@ void ConstructionPlugin_Axis::createAxisByPointAndDirection() { data()->real(ConstructionPlugin_Axis::Y_DIRECTION()); AttributeDoublePtr aZAttr = data()->real(ConstructionPlugin_Axis::Z_DIRECTION()); - if ((aRef1.get() != NULL) && (aXAttr.get() != NULL) && - (aYAttr.get() != NULL) && (aZAttr.get() != NULL)) { + if ((aRef1.get() != nullptr) && (aXAttr.get() != nullptr) && + (aYAttr.get() != nullptr) && (aZAttr.get() != nullptr)) { GeomShapePtr aShape1 = aRef1->value(); if (!aShape1.get()) aShape1 = aRef1->context()->shape(); @@ -394,7 +394,7 @@ void ConstructionPlugin_Axis::execute() { } } -bool ConstructionPlugin_Axis::customisePresentation(ResultPtr theResult, +bool ConstructionPlugin_Axis::customisePresentation(ResultPtr /*theResult*/, AISObjectPtr thePrs) { bool isCustomized = false; diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.h b/src/ConstructionPlugin/ConstructionPlugin_Axis.h index 7270790be..78ba16e16 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.h @@ -34,7 +34,7 @@ class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomPrs { public: /// Returns 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_Axis::ID(); return MY_KIND; } @@ -212,17 +212,17 @@ public: inline static const double MINIMAL_LENGTH() { return 1.e-5; } /// 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_Axis(); /// Customize presentation of the feature - virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs); + bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs) override; protected: /// Creates a new axis by two defined points diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp index 59b621686..57261ca7d 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp @@ -42,7 +42,7 @@ #include //================================================================================================== -ConstructionPlugin_Point::ConstructionPlugin_Point() {} +ConstructionPlugin_Point::ConstructionPlugin_Point() = default; //================================================================================================== const std::string &ConstructionPlugin_Point::getKind() { @@ -131,8 +131,7 @@ void ConstructionPlugin_Point::execute() { if (!aPoints.empty()) { // if no points found produce the standard error // later int anIndex = 0; - std::list>::iterator aPIter = - aPoints.begin(); + auto aPIter = aPoints.begin(); for (; aPIter != aPoints.end(); aPIter++, anIndex++) { std::shared_ptr aConstr = document()->createConstruction(data(), anIndex); @@ -176,8 +175,9 @@ bool ConstructionPlugin_Point::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()) { diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.h b/src/ConstructionPlugin/ConstructionPlugin_Point.h index db9c1b976..096112dc8 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.h @@ -38,7 +38,7 @@ class ConstructionPlugin_Point : public ModelAPI_Feature, public GeomAPI_ICustomPrs { public: /// Returns the kind of a feature. - CONSTRUCTIONPLUGIN_EXPORT virtual const std::string &getKind(); + CONSTRUCTIONPLUGIN_EXPORT const std::string &getKind() override; /// Default color for a point. inline static const std::string &DEFAULT_COLOR() { @@ -299,17 +299,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_Point(); /// Customize presentation of the feature - virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs); + bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs) override; private: std::shared_ptr createByXYZ(); diff --git a/src/Events/Events_InfoMessage.h b/src/Events/Events_InfoMessage.h index 2e2a2c636..6c9b2afcd 100644 --- a/src/Events/Events_InfoMessage.h +++ b/src/Events/Events_InfoMessage.h @@ -37,18 +37,18 @@ class Events_InfoMessage : public Events_Message { public: /// Constructor /// \param theSender a pointer on sender object - explicit Events_InfoMessage(const void *theSender = 0) + explicit Events_InfoMessage(const void *theSender = nullptr) : Events_Message(Events_Loop::eventByName("InfoMessage"), theSender) {} /// Constructor /// \param theSender a pointer on sender object Events_InfoMessage(const std::string &theContext, const std::string &theMsg, - const void *theSender = 0) + const void *theSender = nullptr) : Events_Message(Events_Loop::eventByName("InfoMessage"), theSender), myContext(theContext), myMessage(theMsg) {} /// default destructor - virtual ~Events_InfoMessage() {} + ~Events_InfoMessage() override = default; /// Identifier of this event (one for all errors) static Events_ID errorID() { diff --git a/src/Events/Events_Listener.h b/src/Events/Events_Listener.h index 00bbadfcf..9cad019cd 100644 --- a/src/Events/Events_Listener.h +++ b/src/Events/Events_Listener.h @@ -41,7 +41,7 @@ class Events_Listener { std::map> myGroups; public: - virtual ~Events_Listener() {} + virtual ~Events_Listener() = default; //! This method is called by loop when the event is started to process. EVENTS_EXPORT virtual void diff --git a/src/Events/Events_Loop.h b/src/Events/Events_Loop.h index 82b97a47b..2fee2471f 100644 --- a/src/Events/Events_Loop.h +++ b/src/Events/Events_Loop.h @@ -56,11 +56,11 @@ class Events_Loop { std::set myFlushed; /// to process flushes or not - bool myFlushActive; + bool myFlushActive{true}; //! The empty constructor, will be called at startup of the application, only //! once - Events_Loop() : myFlushActive(true) {} + Events_Loop() {} public: ///! Returns the main object of the loop, one per application. @@ -85,7 +85,7 @@ public: //! is used for it) EVENTS_EXPORT void registerListener(Events_Listener *theListener, const Events_ID theID, - void *theSender = 0, + void *theSender = nullptr, bool theImmediate = false); //! Remove the listener from internal maps if it was registered there diff --git a/src/Events/Events_Message.h b/src/Events/Events_Message.h index 79c1b481b..406131442 100644 --- a/src/Events/Events_Message.h +++ b/src/Events/Events_Message.h @@ -60,10 +60,10 @@ class EVENTS_EXPORT Events_Message { public: //! Creates the message - Events_Message(const Events_ID theID, const void *theSender = 0) + Events_Message(const Events_ID theID, const void *theSender = nullptr) : myEventsId(theID), mySender((void *)theSender) {} //! do nothing in the destructor yet - virtual ~Events_Message() {} + virtual ~Events_Message() = default; //! Returns identifier of the message const Events_ID &eventID() const { return myEventsId; } diff --git a/src/Events/Events_MessageGroup.h b/src/Events/Events_MessageGroup.h index c5ddc535a..fb5e8ddda 100644 --- a/src/Events/Events_MessageGroup.h +++ b/src/Events/Events_MessageGroup.h @@ -36,9 +36,9 @@ class EVENTS_EXPORT Events_MessageGroup : public Events_Message { public: //! Creates the message - Events_MessageGroup(const Events_ID theID, const void *theSender = 0); + Events_MessageGroup(const Events_ID theID, const void *theSender = nullptr); //! do nothing in the destructor yet - virtual ~Events_MessageGroup(); + ~Events_MessageGroup() override; //! Creates a new empty group (to store it in the loop before flush) virtual std::shared_ptr newEmpty() = 0; diff --git a/src/FeaturesAPI/FeaturesAPI_Pipe.cpp b/src/FeaturesAPI/FeaturesAPI_Pipe.cpp index b26fe63e4..f8f330d41 100644 --- a/src/FeaturesAPI/FeaturesAPI_Pipe.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Pipe.cpp @@ -66,7 +66,7 @@ FeaturesAPI_Pipe::FeaturesAPI_Pipe( } //================================================================================================== -FeaturesAPI_Pipe::~FeaturesAPI_Pipe() {} +FeaturesAPI_Pipe::~FeaturesAPI_Pipe() = default; //================================================================================================== void FeaturesAPI_Pipe::setBase( diff --git a/src/FeaturesAPI/FeaturesAPI_Pipe.h b/src/FeaturesAPI/FeaturesAPI_Pipe.h index e95b617d2..c4e0098be 100644 --- a/src/FeaturesAPI/FeaturesAPI_Pipe.h +++ b/src/FeaturesAPI/FeaturesAPI_Pipe.h @@ -66,7 +66,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Pipe(); + ~FeaturesAPI_Pipe() override; INTERFACE_5(FeaturesPlugin_Pipe::ID(), baseObjects, FeaturesPlugin_Pipe::BASE_OBJECTS_ID(), @@ -109,11 +109,11 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Pipe object. -typedef std::shared_ptr PipePtr; +using PipePtr = std::shared_ptr; /// \ingroup CPPHighAPI /// \brief Create Pipe feature. diff --git a/src/FeaturesAPI/FeaturesAPI_Recover.cpp b/src/FeaturesAPI/FeaturesAPI_Recover.cpp index e399fb8b3..3eeebe616 100644 --- a/src/FeaturesAPI/FeaturesAPI_Recover.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Recover.cpp @@ -51,7 +51,7 @@ FeaturesAPI_Recover::FeaturesAPI_Recover( } //================================================================================================= -FeaturesAPI_Recover::~FeaturesAPI_Recover() {} +FeaturesAPI_Recover::~FeaturesAPI_Recover() = default; //================================================================================================= void FeaturesAPI_Recover::setBaseFeature( diff --git a/src/FeaturesAPI/FeaturesAPI_Recover.h b/src/FeaturesAPI/FeaturesAPI_Recover.h index eacf68078..4aecccd97 100644 --- a/src/FeaturesAPI/FeaturesAPI_Recover.h +++ b/src/FeaturesAPI/FeaturesAPI_Recover.h @@ -50,7 +50,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Recover(); + ~FeaturesAPI_Recover() override; INTERFACE_2(FeaturesPlugin_Recover::ID(), baseFeature, FeaturesPlugin_Recover::BASE_FEATURE(), @@ -70,11 +70,11 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; /// Pointer on Recover object. -typedef std::shared_ptr RecoverPtr; +using RecoverPtr = std::shared_ptr; /// \ingroup CPPHighAPI /// \brief Create Recover feature. diff --git a/src/FeaturesAPI/FeaturesAPI_Revolution.cpp b/src/FeaturesAPI/FeaturesAPI_Revolution.cpp index 62e69b5de..4f41eaec0 100644 --- a/src/FeaturesAPI/FeaturesAPI_Revolution.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Revolution.cpp @@ -84,7 +84,7 @@ FeaturesAPI_Revolution::FeaturesAPI_Revolution( } //================================================================================================== -FeaturesAPI_Revolution::~FeaturesAPI_Revolution() {} +FeaturesAPI_Revolution::~FeaturesAPI_Revolution() = default; //================================================================================================== void FeaturesAPI_Revolution::setNestedSketch( diff --git a/src/FeaturesAPI/FeaturesAPI_Revolution.h b/src/FeaturesAPI/FeaturesAPI_Revolution.h index b1e196a02..c06cd8c95 100644 --- a/src/FeaturesAPI/FeaturesAPI_Revolution.h +++ b/src/FeaturesAPI/FeaturesAPI_Revolution.h @@ -74,7 +74,7 @@ public: /// Destructor. FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Revolution(); + ~FeaturesAPI_Revolution() override; INTERFACE_10( FeaturesPlugin_Revolution::ID(), sketch, @@ -127,14 +127,14 @@ public: /// Dump wrapped feature FEATURESAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; private: void execIfBaseNotEmpty(); }; /// Pointer on Revolution object. -typedef std::shared_ptr RevolutionPtr; +using RevolutionPtr = std::shared_ptr; /// \ingroup CPPHighAPI /// \brief Create Revolution feature. diff --git a/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.h b/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.h index 4a4a7d6cd..ac632a4e6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CommonSharedFaces.h @@ -34,7 +34,7 @@ class FeaturesPlugin_CommonSharedFaces : 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 attributObject() = 0; @@ -49,7 +49,7 @@ public: virtual AttributePtr attributIsCompute() = 0; protected: - FeaturesPlugin_CommonSharedFaces() {} + FeaturesPlugin_CommonSharedFaces() = default; // Set group of faces void setFacesGroup(const std::wstring &theName); diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h index fd809c4f6..77c9add9a 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h @@ -45,34 +45,35 @@ public: } /// Appends a feature to the sketch sub-elements container. - 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; protected: enum InitFlags { InitSketchLauncher = 1 << 0, InitBaseObjectsList = 1 << 1 }; - FeaturesPlugin_CompositeSketch(){}; + FeaturesPlugin_CompositeSketch() = default; + ; /// Initializes composite sketch attributes. void initCompositeSketchAttribtues(const int theInitFlags); diff --git a/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.cpp b/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.cpp index c1e98395c..4b22ff65b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.cpp @@ -34,7 +34,7 @@ #include //================================================================================================= -FeaturesPlugin_GroupSharedFaces::FeaturesPlugin_GroupSharedFaces() {} +FeaturesPlugin_GroupSharedFaces::FeaturesPlugin_GroupSharedFaces() = default; //================================================================================================= void FeaturesPlugin_GroupSharedFaces::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.h b/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.h index 5b43fc7cb..58867806e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.h +++ b/src/FeaturesPlugin/FeaturesPlugin_GroupSharedFaces.h @@ -73,34 +73,35 @@ 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_GroupSharedFaces(); 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; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Pipe.h b/src/FeaturesPlugin/FeaturesPlugin_Pipe.h index a3ee291a8..d13813286 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Pipe.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Pipe.h @@ -94,17 +94,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_Pipe::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_Pipe(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Recover.h b/src/FeaturesPlugin/FeaturesPlugin_Recover.h index b1d728a5a..5f1bc2c35 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Recover.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Recover.h @@ -78,21 +78,22 @@ 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_Recover::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; /// 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_Recover(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.cpp b/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.cpp index 33559729c..a8625db89 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.cpp @@ -23,7 +23,7 @@ #include //================================================================================================== -FeaturesPlugin_RemoveResults::FeaturesPlugin_RemoveResults() {} +FeaturesPlugin_RemoveResults::FeaturesPlugin_RemoveResults() = default; //================================================================================================== void FeaturesPlugin_RemoveResults::initAttributes() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.h b/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.h index 9abdda408..6593c7ce3 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RemoveResults.h @@ -46,20 +46,20 @@ 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_RemoveResults::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; /// Does nothing, has no results. - FEATURESPLUGIN_EXPORT virtual void execute() {} + FEATURESPLUGIN_EXPORT void execute() override {} /// Hidden from the user. - FEATURESPLUGIN_EXPORT virtual bool isInHistory() { return false; } + FEATURESPLUGIN_EXPORT bool isInHistory() override { return false; } }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp index 247d71325..860954e66 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.cpp @@ -37,8 +37,7 @@ #include //================================================================================================== -FeaturesPlugin_RemoveSubShapes::FeaturesPlugin_RemoveSubShapes() - : myChangedInCode(false) {} +FeaturesPlugin_RemoveSubShapes::FeaturesPlugin_RemoveSubShapes() {} //================================================================================================== void FeaturesPlugin_RemoveSubShapes::initAttributes() { @@ -101,13 +100,13 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged( std::list aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); - ListOfShape::const_iterator anIt = aSubShapes.cbegin(); + auto anIt = aSubShapes.cbegin(); for (; anIt != aSubShapes.cend(); ++anIt) { GeomShapePtr aSubShape = *anIt; if (!isHasSubs) { aSubShapesToKeepAttrList->append(aContext, aSubShape); } else { - std::list::iterator aSubsIt = anAllSubs.begin(); + auto aSubsIt = anAllSubs.begin(); for (; aSubsIt != anAllSubs.end(); aSubsIt++) { ResultBodyPtr aSub = std::dynamic_pointer_cast(*aSubsIt); @@ -140,7 +139,7 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged( std::list aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); - ListOfShape::const_iterator anIt = aSubShapes.cbegin(); + auto anIt = aSubShapes.cbegin(); for (; anIt != aSubShapes.cend(); ++anIt) { GeomShapePtr aSubShape = *anIt; if (aSubShapesToKeep.isBound(aSubShape)) @@ -149,7 +148,7 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged( if (!isHasSubs) { aSubShapesToRemoveAttrList->append(aContext, aSubShape); } else { - std::list::iterator aSubsIt = anAllSubs.begin(); + auto aSubsIt = anAllSubs.begin(); for (; aSubsIt != anAllSubs.end(); aSubsIt++) { ResultBodyPtr aSub = std::dynamic_pointer_cast(*aSubsIt); @@ -181,7 +180,7 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged( std::list aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); - ListOfShape::const_iterator anIt = aSubShapes.cbegin(); + auto anIt = aSubShapes.cbegin(); for (; anIt != aSubShapes.cend(); ++anIt) { GeomShapePtr aSubShape = *anIt; if (aSubShapesToRemove.isBound(aSubShape)) @@ -190,7 +189,7 @@ void FeaturesPlugin_RemoveSubShapes::attributeChanged( if (!isHasSubs) { aSubShapesToKeepAttrList->append(aContext, aSubShape); } else { - std::list::iterator aSubsIt = anAllSubs.begin(); + auto aSubsIt = anAllSubs.begin(); for (; aSubsIt != anAllSubs.end(); aSubsIt++) { ResultBodyPtr aSub = std::dynamic_pointer_cast(*aSubsIt); @@ -252,9 +251,7 @@ void FeaturesPlugin_RemoveSubShapes::execute() { std::list aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape); - for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); - anIt != aSubShapes.cend(); ++anIt) { - GeomShapePtr aSubShape = *anIt; + for (auto aSubShape : aSubShapes) { if (!aSubShape.get() || aSubShape->isNull()) continue; @@ -300,9 +297,8 @@ void FeaturesPlugin_RemoveSubShapes::execute() { std::list anOldShapes; anOldShapes.push_back(aBaseShape); aResultBody->storeModified(anOldShapes, aResultShape, aMakeShapeList); - for (std::set::iterator aTypeIter = aTypes.begin(); - aTypeIter != aTypes.end(); ++aTypeIter) { - aResultBody->loadDeletedShapes(aMakeShapeList, aBaseShape, *aTypeIter); + for (auto aType : aTypes) { + aResultBody->loadDeletedShapes(aMakeShapeList, aBaseShape, aType); } aResultBody->loadModifiedShapes(aMakeShapeList, aBaseShape, diff --git a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.h b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.h index 2d736a8c3..047d531a9 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RemoveSubShapes.h @@ -77,24 +77,25 @@ 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_RemoveSubShapes::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; /// Called on change of any argument-attribute of this object. /// \param[in] 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 algorithm and stores results it in the data structure. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT void execute() override; private: - bool myChangedInCode; + bool myChangedInCode{false}; }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Revolution.h b/src/FeaturesPlugin/FeaturesPlugin_Revolution.h index 8dfa69099..04501ca47 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Revolution.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Revolution.h @@ -107,17 +107,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_Revolution::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_Revolution(); diff --git a/src/FiltersPlugin/FiltersPlugin_OnLine.cpp b/src/FiltersPlugin/FiltersPlugin_OnLine.cpp index e906767d1..d4369ee46 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnLine.cpp +++ b/src/FiltersPlugin/FiltersPlugin_OnLine.cpp @@ -59,9 +59,8 @@ bool FiltersPlugin_OnLine::isOk(const GeomShapePtr &theShape, const ResultPtr &, if (theShape->isVertex()) { GeomPointPtr aPnt = theShape->vertex()->point(); - for (std::list::iterator anIt = aLines.begin(); - anIt != aLines.end(); ++anIt) { - if ((*anIt)->contains(aPnt)) + for (auto &aLine : aLines) { + if (aLine->contains(aPnt)) return true; } } else if (theShape->isEdge()) { @@ -69,9 +68,8 @@ bool FiltersPlugin_OnLine::isOk(const GeomShapePtr &theShape, const ResultPtr &, if (aEdge->isLine()) { GeomPointPtr aPnt1 = aEdge->firstPoint(); GeomPointPtr aPnt2 = aEdge->lastPoint(); - for (std::list::iterator anIt = aLines.begin(); - anIt != aLines.end(); ++anIt) { - if ((*anIt)->contains(aPnt1) && (*anIt)->contains(aPnt2)) + for (auto &aLine : aLines) { + if (aLine->contains(aPnt1) && aLine->contains(aPnt2)) return true; } } diff --git a/src/FiltersPlugin/FiltersPlugin_OnLine.h b/src/FiltersPlugin/FiltersPlugin_OnLine.h index 492409a63..2a712747a 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnLine.h +++ b/src/FiltersPlugin/FiltersPlugin_OnLine.h @@ -33,28 +33,28 @@ class FiltersPlugin_OnLine : public ModelAPI_Filter { public: FiltersPlugin_OnLine() : ModelAPI_Filter() {} - virtual const std::string &name() const { + const std::string &name() const override { static const std::string kName("On line"); 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/GeomAPI/GeomAPI_AISObject.h b/src/GeomAPI/GeomAPI_AISObject.h index ad2150fda..cada52d58 100644 --- a/src/GeomAPI/GeomAPI_AISObject.h +++ b/src/GeomAPI/GeomAPI_AISObject.h @@ -43,7 +43,7 @@ public: GeomAPI_AISObject(); GEOMAPI_EXPORT - ~GeomAPI_AISObject(); + ~GeomAPI_AISObject() override; /// \brief Creates AIS_Shape object using specified shape GEOMAPI_EXPORT @@ -196,6 +196,6 @@ public: }; //! Pointer on attribute object -typedef std::shared_ptr AISObjectPtr; +using AISObjectPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Ax3.h b/src/GeomAPI/GeomAPI_Ax3.h index faeb57271..d9c9d8187 100644 --- a/src/GeomAPI/GeomAPI_Ax3.h +++ b/src/GeomAPI/GeomAPI_Ax3.h @@ -93,6 +93,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomAx3Ptr; +using GeomAx3Ptr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_BSpline.h b/src/GeomAPI/GeomAPI_BSpline.h index e0c0e7d6f..789083fa7 100644 --- a/src/GeomAPI/GeomAPI_BSpline.h +++ b/src/GeomAPI/GeomAPI_BSpline.h @@ -31,7 +31,7 @@ class GeomAPI_Pnt; class GeomAPI_BSpline; //! Pointer on the object -typedef std::shared_ptr GeomBSplinePtr; +using GeomBSplinePtr = std::shared_ptr; /**\class GeomAPI_BSpline * \ingroup DataModel diff --git a/src/GeomAPI/GeomAPI_Circ.cpp b/src/GeomAPI/GeomAPI_Circ.cpp index 77d8ffb41..8201aecf9 100644 --- a/src/GeomAPI/GeomAPI_Circ.cpp +++ b/src/GeomAPI/GeomAPI_Circ.cpp @@ -101,9 +101,9 @@ GeomAPI_Circ::project(const std::shared_ptr &thePoint) const { } //================================================================================================= -const bool GeomAPI_Circ::parameter(const std::shared_ptr thePoint, - const double theTolerance, - double &theParameter) const { +bool GeomAPI_Circ::parameter(const std::shared_ptr thePoint, + const double theTolerance, + double &theParameter) const { Handle(Geom_Circle) aCurve = new Geom_Circle(*MY_CIRC); return GeomLib_Tool::Parameter(aCurve, thePoint->impl(), theTolerance, theParameter) == Standard_True; diff --git a/src/GeomAPI/GeomAPI_Circ.h b/src/GeomAPI/GeomAPI_Circ.h index 73c0fade8..0a3303fb5 100644 --- a/src/GeomAPI/GeomAPI_Circ.h +++ b/src/GeomAPI/GeomAPI_Circ.h @@ -77,12 +77,12 @@ 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 -typedef std::shared_ptr GeomCirclePtr; +using GeomCirclePtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Curve.h b/src/GeomAPI/GeomAPI_Curve.h index a565f9194..e653fca84 100644 --- a/src/GeomAPI/GeomAPI_Curve.h +++ b/src/GeomAPI/GeomAPI_Curve.h @@ -103,6 +103,6 @@ private: }; //! Pointer on the object -typedef std::shared_ptr GeomCurvePtr; +using GeomCurvePtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.h b/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.h index f59ab8a91..42074c86f 100644 --- a/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.h +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.h @@ -69,9 +69,9 @@ public: public: class iterator { public: - typedef GeomShapePtr key_type; - typedef ListOfShape mapped_type; - typedef std::pair value_type; + using key_type = GeomShapePtr; + using mapped_type = ListOfShape; + using value_type = std::pair; public: GEOMAPI_EXPORT iterator(); @@ -91,7 +91,7 @@ public: std::shared_ptr mySelf; }; - typedef iterator const_iterator; + using const_iterator = iterator; GEOMAPI_EXPORT iterator begin(); GEOMAPI_EXPORT const_iterator begin() const; diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.h b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.h index c0a5e5358..37a0f22ab 100644 --- a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.h +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.h @@ -73,7 +73,7 @@ public: /// Destructor GEOMAPI_EXPORT - ~GeomAPI_DataMapOfShapeShape(); + ~GeomAPI_DataMapOfShapeShape() override; }; #endif diff --git a/src/GeomAPI/GeomAPI_Dir.h b/src/GeomAPI/GeomAPI_Dir.h index 4d6a027d8..71ec5a7ed 100644 --- a/src/GeomAPI/GeomAPI_Dir.h +++ b/src/GeomAPI/GeomAPI_Dir.h @@ -77,6 +77,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomDirPtr; +using GeomDirPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Edge.h b/src/GeomAPI/GeomAPI_Edge.h index 8e9cff786..13cc2e682 100644 --- a/src/GeomAPI/GeomAPI_Edge.h +++ b/src/GeomAPI/GeomAPI_Edge.h @@ -52,8 +52,8 @@ public: /// Returns \c true if edges have same underlying curve GEOMAPI_EXPORT - virtual bool - isSameGeometry(const std::shared_ptr theShape) const; + bool + isSameGeometry(const std::shared_ptr theShape) const override; /// Verifies that the edge is a line GEOMAPI_EXPORT @@ -97,7 +97,7 @@ public: /// Returns true if the current edge is geometrically equal to the given edge GEOMAPI_EXPORT - bool isEqual(const std::shared_ptr theEdge) const; + bool isEqual(const std::shared_ptr theEdge) const override; /// Change parametric range of the curve GEOMAPI_EXPORT @@ -143,10 +143,10 @@ public: /// Return middle point on the edge GEOMAPI_EXPORT - virtual std::shared_ptr middlePoint() const; + std::shared_ptr middlePoint() const override; }; //! Pointer on object -typedef std::shared_ptr GeomEdgePtr; +using GeomEdgePtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Ellipse.h b/src/GeomAPI/GeomAPI_Ellipse.h index 411fc7261..5add41e4b 100644 --- a/src/GeomAPI/GeomAPI_Ellipse.h +++ b/src/GeomAPI/GeomAPI_Ellipse.h @@ -93,6 +93,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomEllipsePtr; +using GeomEllipsePtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Face.h b/src/GeomAPI/GeomAPI_Face.h index 2977ef93d..c589c73f5 100644 --- a/src/GeomAPI/GeomAPI_Face.h +++ b/src/GeomAPI/GeomAPI_Face.h @@ -45,12 +45,12 @@ public: /// Returns true if the current face is geometrically equal to the given face GEOMAPI_EXPORT - virtual bool isEqual(const std::shared_ptr theFace) const; + bool isEqual(const std::shared_ptr theFace) const override; /// Returns \c true if faces have same underlying surface GEOMAPI_EXPORT - virtual bool - isSameGeometry(const std::shared_ptr theShape) const; + bool + isSameGeometry(const std::shared_ptr theShape) const override; /// Returns true if the face is a cylindrical face GEOMAPI_EXPORT @@ -74,10 +74,10 @@ public: GEOMAPI_EXPORT std::shared_ptr getTorus() const; /// Return inner point in the face - GEOMAPI_EXPORT virtual std::shared_ptr middlePoint() const; + GEOMAPI_EXPORT std::shared_ptr middlePoint() const override; }; //! Pointer on attribute object -typedef std::shared_ptr GeomFacePtr; +using GeomFacePtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_ICustomPrs.h b/src/GeomAPI/GeomAPI_ICustomPrs.h index c33ebb2b8..a2c10698e 100644 --- a/src/GeomAPI/GeomAPI_ICustomPrs.h +++ b/src/GeomAPI/GeomAPI_ICustomPrs.h @@ -42,6 +42,6 @@ public: AISObjectPtr thePrs) = 0; }; -typedef std::shared_ptr GeomCustomPrsPtr; +using GeomCustomPrsPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_IPresentable.h b/src/GeomAPI/GeomAPI_IPresentable.h index 8263febd5..c6321e3fb 100644 --- a/src/GeomAPI/GeomAPI_IPresentable.h +++ b/src/GeomAPI/GeomAPI_IPresentable.h @@ -36,6 +36,6 @@ public: virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious) = 0; }; -typedef std::shared_ptr GeomPresentablePtr; +using GeomPresentablePtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Lin.h b/src/GeomAPI/GeomAPI_Lin.h index 3ca8ad06c..3f9c527b0 100644 --- a/src/GeomAPI/GeomAPI_Lin.h +++ b/src/GeomAPI/GeomAPI_Lin.h @@ -89,6 +89,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomLinePtr; +using GeomLinePtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Lin2d.h b/src/GeomAPI/GeomAPI_Lin2d.h index a8966c771..a7e7e886b 100644 --- a/src/GeomAPI/GeomAPI_Lin2d.h +++ b/src/GeomAPI/GeomAPI_Lin2d.h @@ -77,6 +77,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomLine2dPtr; +using GeomLine2dPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Pln.h b/src/GeomAPI/GeomAPI_Pln.h index 49e9780da..b2c76d62d 100644 --- a/src/GeomAPI/GeomAPI_Pln.h +++ b/src/GeomAPI/GeomAPI_Pln.h @@ -101,6 +101,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomPlanePtr; +using GeomPlanePtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Pnt.h b/src/GeomAPI/GeomAPI_Pnt.h index 82470ed04..b1e55aed0 100644 --- a/src/GeomAPI/GeomAPI_Pnt.h +++ b/src/GeomAPI/GeomAPI_Pnt.h @@ -109,6 +109,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomPointPtr; +using GeomPointPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Pnt2d.h b/src/GeomAPI/GeomAPI_Pnt2d.h index d001a0ea9..7fd12793f 100644 --- a/src/GeomAPI/GeomAPI_Pnt2d.h +++ b/src/GeomAPI/GeomAPI_Pnt2d.h @@ -78,6 +78,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomPnt2dPtr; +using GeomPnt2dPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Shape.h b/src/GeomAPI/GeomAPI_Shape.h index d6bdc92e8..cd07936d5 100644 --- a/src/GeomAPI/GeomAPI_Shape.h +++ b/src/GeomAPI/GeomAPI_Shape.h @@ -285,9 +285,9 @@ public: }; //! Pointer on list of shapes -typedef std::list> ListOfShape; +using ListOfShape = std::list>; //! Pointer on attribute object -typedef std::shared_ptr GeomShapePtr; +using GeomShapePtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Vertex.h b/src/GeomAPI/GeomAPI_Vertex.h index a90dbdbf4..b465600ec 100644 --- a/src/GeomAPI/GeomAPI_Vertex.h +++ b/src/GeomAPI/GeomAPI_Vertex.h @@ -52,7 +52,7 @@ public: /// Returns true if the current edge is geometrically equal to the given edge. GEOMAPI_EXPORT - virtual bool isEqual(const std::shared_ptr theVert) const; + bool isEqual(const std::shared_ptr theVert) const override; public: /// \brief Compare vertices geometrically @@ -73,6 +73,6 @@ public: }; //! Pointer on the object -typedef std::shared_ptr GeomVertexPtr; +using GeomVertexPtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_Wire.h b/src/GeomAPI/GeomAPI_Wire.h index 47c6d5b57..913b84a56 100644 --- a/src/GeomAPI/GeomAPI_Wire.h +++ b/src/GeomAPI/GeomAPI_Wire.h @@ -50,9 +50,9 @@ public: isRectangle(std::list> &thePoints) const; /// Return middle point on the wire - GEOMAPI_EXPORT virtual std::shared_ptr middlePoint() const; + GEOMAPI_EXPORT std::shared_ptr middlePoint() const override; }; -typedef std::shared_ptr GeomWirePtr; +using GeomWirePtr = std::shared_ptr; #endif diff --git a/src/GeomAPI/GeomAPI_XYZ.h b/src/GeomAPI/GeomAPI_XYZ.h index 1f7634e26..b6873b3d3 100644 --- a/src/GeomAPI/GeomAPI_XYZ.h +++ b/src/GeomAPI/GeomAPI_XYZ.h @@ -84,6 +84,6 @@ public: }; //! Pointer on object -typedef std::shared_ptr GeomXYZPtr; +using GeomXYZPtr = std::shared_ptr; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.h b/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.h index 4edf9fc6d..378424be5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Chamfer.h @@ -25,8 +25,8 @@ #include #include -//#include -//#include +// #include +// #include /// \class GeomAlgoAPI_Chamfer /// \ingroup DataAlgo diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.cpp index 1ae192eac..89a61fdd0 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Defeaturing.cpp @@ -33,15 +33,14 @@ void GeomAlgoAPI_Defeaturing::build(const GeomShapePtr &theBaseSolid, if (!theBaseSolid || theFacesToRemove.empty()) return; - BRepAlgoAPI_Defeaturing *aDefeaturing = new BRepAlgoAPI_Defeaturing; + auto *aDefeaturing = new BRepAlgoAPI_Defeaturing; aDefeaturing->SetShape(theBaseSolid->impl()); aDefeaturing->SetRunParallel(Standard_True); // collect faces to remove TopTools_ListOfShape aFaces; - for (ListOfShape::const_iterator anIt = theFacesToRemove.begin(); - anIt != theFacesToRemove.end(); ++anIt) - aDefeaturing->AddFaceToRemove((*anIt)->impl()); + for (const auto &anIt : theFacesToRemove) + aDefeaturing->AddFaceToRemove(anIt->impl()); setImpl(aDefeaturing); setBuilderType(OCCT_BRepBuilderAPI_MakeShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.h b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.h index 284b978b5..38bb94cae 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.h @@ -30,8 +30,8 @@ /// \ingroup DataAlgo /// \brief Perform fillet on vertices of a wire class GeomAlgoAPI_Fillet1D : public GeomAlgoAPI_MakeShape { - typedef std::map - MapModified; + using MapModified = + std::map; public: /// Run fillet operation on a set of vertices with fixed radius. @@ -46,15 +46,15 @@ public: /// \param[in] theOldShape base shape. /// \param[out] theNewShapes shapes generated from \a theShape. Does not /// cleared! - GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theOldShape, - ListOfShape &theNewShapes); + GEOMALGOAPI_EXPORT void generated(const GeomShapePtr theOldShape, + ListOfShape &theNewShapes) override; /// \return the list of shapes modified from the shape \a theShape. /// \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; /// \return List of failed vertices const ListOfShape &failedVertices() const { return myFailedVertices; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp index 17fb451cc..141986952 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Filling.cpp @@ -36,9 +36,8 @@ static void edgesToCurves(const std::list &theEdges, std::list &theCurves) { - for (std::list::const_iterator anIt = theEdges.begin(); - anIt != theEdges.end(); ++anIt) { - const TopoDS_Edge &anEdge = (*anIt)->impl(); + for (const auto &theEdge : theEdges) { + const auto &anEdge = theEdge->impl(); if (BRep_Tool::Degenerated(anEdge)) continue; @@ -81,9 +80,8 @@ void GeomAlgoAPI_Filling::buildByEdges() { // obtain section curves std::list aCurves; edgesToCurves(myConstraints, aCurves); - for (std::list::iterator anIt = aCurves.begin(); - anIt != aCurves.end(); ++anIt) - aSection.AddCurve(*anIt); + for (auto &aCurve : aCurves) + aSection.AddCurve(aCurve); // a 'tolerance' is used to compare 2 knots aSection.Perform(Precision::PConfusion()); @@ -143,7 +141,7 @@ void GeomAlgoAPI_Filling::buildByControlPoints() { // compute maximal number of poles in B-spline curves int aMaxPoles = 0; - std::list::iterator anIt = aCurves.begin(); + auto anIt = aCurves.begin(); for (; anIt != aCurves.end(); ++anIt) { Handle(Geom_BSplineCurve) aBC = Handle(Geom_BSplineCurve)::DownCast(removeTrim(*anIt)); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp index 7c4c69e45..41bce69eb 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp @@ -37,20 +37,16 @@ #include // new shape -> old shapes -> index in the old shape -typedef NCollection_DataMap< +using MapNewToOld = NCollection_DataMap< TopoDS_Shape, NCollection_DataMap, - TopTools_ShapeMapHasher> - MapNewToOld; -typedef NCollection_DataMap> - HistoryMap; + TopTools_ShapeMapHasher>; +using HistoryMap = + NCollection_DataMap>; //================================================================================================== -GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape() - : myBuilderType(Unknown), myDone(false) { - myHist = 0; -} +GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape() { myHist = nullptr; } //================================================================================================== GeomAlgoAPI_MakeShape::~GeomAlgoAPI_MakeShape() { @@ -82,10 +78,10 @@ void GeomAlgoAPI_MakeShape::generated(const GeomShapePtr theOldShape, ListOfShape &theNewShapes) { TopTools_ListOfShape aList; if (myBuilderType == OCCT_BRepBuilderAPI_MakeShape) { - BRepBuilderAPI_MakeShape *aMakeShape = implPtr(); + auto *aMakeShape = implPtr(); aList = aMakeShape->Generated(theOldShape->impl()); } else if (myBuilderType == OCCT_BOPAlgo_Builder) { - BOPAlgo_Builder *aBOPBuilder = implPtr(); + auto *aBOPBuilder = implPtr(); aList = aBOPBuilder->Generated(theOldShape->impl()); } for (TopTools_ListIteratorOfListOfShape anIt(aList); anIt.More(); @@ -104,13 +100,13 @@ void GeomAlgoAPI_MakeShape::modified(const GeomShapePtr theOldShape, ListOfShape &theNewShapes) { TopTools_ListOfShape aList; if (myBuilderType == OCCT_BRepBuilderAPI_MakeShape) { - BRepBuilderAPI_MakeShape *aMakeShape = implPtr(); + auto *aMakeShape = implPtr(); try { aList = aMakeShape->Modified(theOldShape->impl()); } catch (Standard_NoSuchObject) { } } else if (myBuilderType == OCCT_BOPAlgo_Builder) { - BOPAlgo_Builder *aBOPBuilder = implPtr(); + auto *aBOPBuilder = implPtr(); aList = aBOPBuilder->Modified(theOldShape->impl()); } for (TopTools_ListIteratorOfListOfShape anIt(aList); anIt.More(); @@ -128,11 +124,11 @@ void GeomAlgoAPI_MakeShape::modified(const GeomShapePtr theOldShape, bool GeomAlgoAPI_MakeShape::isDeleted(const GeomShapePtr theOldShape) { bool isDeleted = false; if (myBuilderType == OCCT_BRepBuilderAPI_MakeShape) { - BRepBuilderAPI_MakeShape *aMakeShape = implPtr(); + auto *aMakeShape = implPtr(); isDeleted = aMakeShape->IsDeleted(theOldShape->impl()) == Standard_True; } else if (myBuilderType == OCCT_BOPAlgo_Builder) { - BOPAlgo_Builder *aBOPBuilder = implPtr(); + auto *aBOPBuilder = implPtr(); isDeleted = aBOPBuilder->IsDeleted(theOldShape->impl()) == Standard_True; } @@ -164,7 +160,7 @@ void GeomAlgoAPI_MakeShape::setShape(const GeomShapePtr theShape) { myMap.reset(new GeomAPI_DataMapOfShapeShape); } - const TopoDS_Shape &aTopoDSShape = myShape->impl(); + const auto &aTopoDSShape = myShape->impl(); for (TopExp_Explorer anExp(aTopoDSShape, TopAbs_VERTEX); anExp.More(); anExp.Next()) { GeomShapePtr aCurrentShape(new GeomAPI_Shape()); @@ -195,7 +191,7 @@ bool GeomAlgoAPI_MakeShape::isValidForHistory(const GeomShapePtr theShape) { if (!theShape.get()) return false; - const TopoDS_Shape &aShape_ = theShape->impl(); + const auto &aShape_ = theShape->impl(); if (aShape_.IsNull()) return false; @@ -240,14 +236,14 @@ void GeomAlgoAPI_MakeShape::initialize() { myMap.reset(new GeomAPI_DataMapOfShapeShape); } - const TopoDS_Shape &aTopoDSShape = myShape->impl(); + const auto &aTopoDSShape = myShape->impl(); for (TopExp_Explorer anExp(aTopoDSShape, TopAbs_FACE); anExp.More(); anExp.Next()) { GeomShapePtr aCurrentShape(new GeomAPI_Shape()); aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current())); myMap->bind(aCurrentShape, aCurrentShape); } - myHist = 0; + myHist = nullptr; } //================================================================================================== @@ -290,7 +286,7 @@ bool GeomAlgoAPI_MakeShape::isNewShapesCollected(GeomShapePtr theWholeOld, const int theShapeType) { if (!myHist) return false; - HistoryMap *aHist = (HistoryMap *)myHist; + auto *aHist = (HistoryMap *)myHist; if (!aHist->IsBound(theShapeType)) return false; return aHist->Find(theShapeType).IsBound(theWholeOld->impl()); @@ -300,7 +296,7 @@ void GeomAlgoAPI_MakeShape::collectNewShapes(GeomShapePtr theWholeOld, const int theShapeType) { if (!myHist) myHist = new HistoryMap; - HistoryMap *aHist = (HistoryMap *)myHist; + auto *aHist = (HistoryMap *)myHist; if (!aHist->IsBound(theShapeType)) aHist->Bind(theShapeType, NCollection_DataMap()); @@ -319,9 +315,8 @@ void GeomAlgoAPI_MakeShape::collectNewShapes(GeomShapePtr theWholeOld, continue; aNewList.clear(); modified(anExp.current(), aNewList); - for (ListOfShape::iterator aNew = aNewList.begin(); aNew != aNewList.end(); - aNew++) { - const TopoDS_Shape &aNewShape = (*aNew)->impl(); + for (auto &aNew : aNewList) { + const auto &aNewShape = aNew->impl(); if (!aCurrent.IsBound(aNewShape)) { aCurrent.Bind( aNewShape, @@ -360,10 +355,10 @@ GeomShapePtr GeomAlgoAPI_MakeShape::oldShapesForNew(GeomShapePtr theWholeOld, aBuilder.MakeCompound(aResComp); aResult->setImpl(new TopoDS_Shape(aResComp)); - HistoryMap *aHist = (HistoryMap *)myHist; + auto *aHist = (HistoryMap *)myHist; if (!aHist->IsBound(theShapeType)) return aResult; // not found, empty compound - const TopoDS_Shape &aWholeOld = theWholeOld->impl(); + const auto &aWholeOld = theWholeOld->impl(); if (!aHist->Find(theShapeType).IsBound(aWholeOld)) return aResult; // not found, empty compound std::map @@ -373,7 +368,7 @@ GeomShapePtr GeomAlgoAPI_MakeShape::oldShapesForNew(GeomShapePtr theWholeOld, // theShapeType, so, iterate all addAllSubs(theNewShape->impl(), aCurrent, aResMap); - std::map::iterator anOldIter = aResMap.begin(); + auto anOldIter = aResMap.begin(); for (; anOldIter != aResMap.end(); anOldIter++) { if (anOldIter->second.ShapeType() == (TopAbs_ShapeEnum)theShapeType) aBuilder.Add(aResComp, anOldIter->second); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h index a9542e84d..1397194bc 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.h @@ -46,7 +46,7 @@ public: GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(); /// Destructor for remove myHist - GEOMALGOAPI_EXPORT ~GeomAlgoAPI_MakeShape(); + GEOMALGOAPI_EXPORT ~GeomAlgoAPI_MakeShape() override; /// \brief Constructor by builder and builder type. /// \param[in] theBuilder pointer to the builder. @@ -177,9 +177,9 @@ private: void initialize(); private: - GeomAlgoAPI_MakeShape::BuilderType - myBuilderType; ///< Type of make shape builder. - bool myDone; ///< Builder status. + GeomAlgoAPI_MakeShape::BuilderType myBuilderType{ + Unknown}; ///< Type of make shape builder. + bool myDone{false}; ///< Builder status. GeomShapePtr myShape; ///< Resulting shape. /// map that is used to keep the optimization structure for access to the @@ -188,7 +188,7 @@ private: void *myHist; }; -typedef std::shared_ptr GeomMakeShapePtr; -typedef std::list ListOfMakeShape; +using GeomMakeShapePtr = std::shared_ptr; +using ListOfMakeShape = std::list; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.h index f5f27b5f3..431dfbf72 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeCustom.h @@ -51,14 +51,14 @@ public: /// \return the list of shapes generated from the shape theShape GEOMALGOAPI_EXPORT void generated(const GeomShapePtr theOldShape, - ListOfShape &theNewShapes); + ListOfShape &theNewShapes) override; /// \return the list of shapes modified from the shape theShape GEOMALGOAPI_EXPORT void modified(const GeomShapePtr theShape, - ListOfShape &theNewShapes); + ListOfShape &theNewShapes) override; /// \return whether the shape is deleted - GEOMALGOAPI_EXPORT bool isDeleted(const GeomShapePtr theOldShape); + GEOMALGOAPI_EXPORT bool isDeleted(const GeomShapePtr theOldShape) override; private: GeomAPI_DataMapOfShapeMapOfShapes myGenerated; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.h b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.h index 9a233264c..052f3fbae 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShapeList.h @@ -54,18 +54,18 @@ public: GEOMALGOAPI_EXPORT void appendAlgo(const GeomMakeShapePtr theMakeShape); /// \return a shape built by the shape construction algorithms - GEOMALGOAPI_EXPORT virtual const GeomShapePtr shape() const; + GEOMALGOAPI_EXPORT const GeomShapePtr shape() const override; /// \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; /// \return whether the shape is deleted - GEOMALGOAPI_EXPORT virtual bool isDeleted(const GeomShapePtr theShape); + GEOMALGOAPI_EXPORT bool isDeleted(const GeomShapePtr theShape) override; private: void result(const GeomShapePtr theShape, ListOfShape &theHistory); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MapShapesAndAncestors.h b/src/GeomAlgoAPI/GeomAlgoAPI_MapShapesAndAncestors.h index 2079b6054..b5a835610 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MapShapesAndAncestors.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MapShapesAndAncestors.h @@ -28,9 +28,9 @@ #include #include -typedef std::set SetOfShapes; -typedef std::map - MapShapeToShapes; +using SetOfShapes = std::set; +using MapShapeToShapes = + std::map; /// \class GeomAlgoAPI_MapShapesAndAncestors /// \ingroup DataAlgo diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Offset.h b/src/GeomAlgoAPI/GeomAlgoAPI_Offset.h index f6ecc206f..70f944972 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Offset.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Offset.h @@ -63,8 +63,8 @@ public: /// \param[in] theOldShape base shape. /// \param[out] theNewShapes shapes generated from \a theShape. Does not /// cleared! - GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theOldShape, - ListOfShape &theNewShapes); + GEOMALGOAPI_EXPORT void generated(const GeomShapePtr theOldShape, + ListOfShape &theNewShapes) override; private: /// \brief Perform offset operation diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h index 7bbdc0dc0..4d0f50bda 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Pipe.h @@ -67,7 +67,7 @@ public: /// \param[in] theShape base shape. /// \param[out] theHistory generated shapes. GEOMALGOAPI_EXPORT void generated(const GeomShapePtr theShape, - ListOfShape &theHistory); + ListOfShape &theHistory) override; private: void build(const GeomShapePtr theBaseShape, const GeomShapePtr thePathShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h index 9910b5baf..eb7591817 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h @@ -195,10 +195,10 @@ public: intersect(const std::shared_ptr theEdge, const std::shared_ptr theFace); - typedef std::map, - std::pair>, - std::list>>> - PointToRefsMap; + using PointToRefsMap = + std::map, + std::pair>, + std::list>>>; /// \brief Performs the split of the shape by points. /// \param[in] theBaseShape shape that should be divided. /// \param[in] thePoints container of points to split diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.h b/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.h index 9dacdef39..f6fbd37f6 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Sphere.h @@ -54,10 +54,10 @@ public: const double theThetaMin, const double theThetaMax); /// Checks if data for the sphere construction is OK. - GEOMALGOAPI_EXPORT bool check(); + GEOMALGOAPI_EXPORT bool check() override; /// Builds the sphere. - GEOMALGOAPI_EXPORT void build(); + GEOMALGOAPI_EXPORT void build() override; /// Builds the sphere. GEOMALGOAPI_EXPORT void buildRootSphere(); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.h b/src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.h index 15092d5db..05c3047e3 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ThroughAll.h @@ -24,7 +24,7 @@ #include #include #include -//#include +// #include #include diff --git a/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.cxx b/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.cxx index 9a78c40dc..a689efdb0 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.cxx @@ -28,12 +28,12 @@ // function : // purpose : //======================================================================= -GEOMAlgo_BndSphereTreeSelector::GEOMAlgo_BndSphereTreeSelector() {} +GEOMAlgo_BndSphereTreeSelector::GEOMAlgo_BndSphereTreeSelector() = default; //======================================================================= // function : ~ // purpose : //======================================================================= -GEOMAlgo_BndSphereTreeSelector::~GEOMAlgo_BndSphereTreeSelector() {} +GEOMAlgo_BndSphereTreeSelector::~GEOMAlgo_BndSphereTreeSelector() = default; //======================================================================= // function : Reject // purpose : diff --git a/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.hxx b/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.hxx index 40720fa82..e35e3c015 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_BndSphereTree.hxx @@ -33,16 +33,17 @@ #include #include -typedef NCollection_UBTree - GEOMAlgo_BndSphereTree; +using GEOMAlgo_BndSphereTree = + NCollection_UBTree; class GEOMAlgo_BndSphereTreeSelector : public GEOMAlgo_BndSphereTree::Selector { public: GEOMALGOIMPL_EXPORT GEOMAlgo_BndSphereTreeSelector(); - GEOMALGOIMPL_EXPORT virtual Standard_Boolean - Reject(const GEOMAlgo_BndSphere &) const; - GEOMALGOIMPL_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &); - GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_BndSphereTreeSelector(); + GEOMALGOIMPL_EXPORT Standard_Boolean + Reject(const GEOMAlgo_BndSphere &) const override; + GEOMALGOIMPL_EXPORT Standard_Boolean + Accept(const Standard_Integer &) override; + GEOMALGOIMPL_EXPORT ~GEOMAlgo_BndSphereTreeSelector() override; GEOMALGOIMPL_EXPORT void Clear(); GEOMALGOIMPL_EXPORT void SetBox(const GEOMAlgo_BndSphere &); diff --git a/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.cxx b/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.cxx index afbef96c9..04477bc08 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.cxx @@ -40,7 +40,7 @@ GEOMAlgo_BuilderShape::GEOMAlgo_BuilderShape() : GEOMAlgo_Algo() { // function : ~ // purpose : //======================================================================= -GEOMAlgo_BuilderShape::~GEOMAlgo_BuilderShape() {} +GEOMAlgo_BuilderShape::~GEOMAlgo_BuilderShape() = default; //======================================================================= // function : Shape // purpose : diff --git a/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.hxx b/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.hxx index 988dbc4c0..6ed9c5900 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.hxx +++ b/src/GeomAlgoImpl/GEOMAlgo_BuilderShape.hxx @@ -91,7 +91,7 @@ protected: GEOMAlgo_BuilderShape(); GEOMALGOIMPL_EXPORT - virtual ~GEOMAlgo_BuilderShape(); + ~GEOMAlgo_BuilderShape() override; //! Prepare information for history support
GEOMALGOIMPL_EXPORT diff --git a/src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.cxx b/src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.cxx index d50594cd1..87b1c04c6 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_GluerAlgo.cxx @@ -40,7 +40,7 @@ GEOMAlgo_GluerAlgo::GEOMAlgo_GluerAlgo() { // function : ~GEOMAlgo_GluerAlgo // purpose : //======================================================================= -GEOMAlgo_GluerAlgo::~GEOMAlgo_GluerAlgo() {} +GEOMAlgo_GluerAlgo::~GEOMAlgo_GluerAlgo() = default; //======================================================================= // function : SetArgument // purpose : diff --git a/src/GeomDataAPI/GeomDataAPI_Dir.h b/src/GeomDataAPI/GeomDataAPI_Dir.h index 3a4dd264b..5a9b371c1 100644 --- a/src/GeomDataAPI/GeomDataAPI_Dir.h +++ b/src/GeomDataAPI/GeomDataAPI_Dir.h @@ -55,15 +55,15 @@ public: static std::string typeId() { return std::string("Dir"); } /// Returns the type of this class of attributes, not static method - GEOMDATAAPI_EXPORT virtual std::string attributeType(); + GEOMDATAAPI_EXPORT std::string attributeType() override; protected: /// Objects are created for features automatically GEOMDATAAPI_EXPORT GeomDataAPI_Dir(); - GEOMDATAAPI_EXPORT virtual ~GeomDataAPI_Dir(); + GEOMDATAAPI_EXPORT ~GeomDataAPI_Dir() override; }; //! Pointer on attribute object -typedef std::shared_ptr AttributeDirPtr; +using AttributeDirPtr = std::shared_ptr; #endif diff --git a/src/GeomDataAPI/GeomDataAPI_Point.cpp b/src/GeomDataAPI/GeomDataAPI_Point.cpp index 7707a4460..4ae260759 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point.cpp +++ b/src/GeomDataAPI/GeomDataAPI_Point.cpp @@ -22,6 +22,6 @@ std::string GeomDataAPI_Point::attributeType() { return typeId(); } -GeomDataAPI_Point::GeomDataAPI_Point() {} +GeomDataAPI_Point::GeomDataAPI_Point() = default; -GeomDataAPI_Point::~GeomDataAPI_Point() {} +GeomDataAPI_Point::~GeomDataAPI_Point() = default; diff --git a/src/GeomDataAPI/GeomDataAPI_Point.h b/src/GeomDataAPI/GeomDataAPI_Point.h index 7eae6f6c2..9cb254ae7 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point.h +++ b/src/GeomDataAPI/GeomDataAPI_Point.h @@ -116,15 +116,15 @@ public: static std::string typeId() { return std::string("Point"); } /// Returns the type of this class of attributes, not static method - GEOMDATAAPI_EXPORT virtual std::string attributeType(); + GEOMDATAAPI_EXPORT std::string attributeType() override; protected: /// Objects are created for features automatically GEOMDATAAPI_EXPORT GeomDataAPI_Point(); - GEOMDATAAPI_EXPORT virtual ~GeomDataAPI_Point(); + GEOMDATAAPI_EXPORT ~GeomDataAPI_Point() override; }; //! Pointer on attribute object -typedef std::shared_ptr AttributePointPtr; +using AttributePointPtr = std::shared_ptr; #endif diff --git a/src/GeomDataAPI/GeomDataAPI_Point2D.h b/src/GeomDataAPI/GeomDataAPI_Point2D.h index 672ca1a8c..917e50691 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point2D.h +++ b/src/GeomDataAPI/GeomDataAPI_Point2D.h @@ -99,7 +99,7 @@ public: static std::string typeId() { return std::string("Point2D"); } /// Returns the type of this class of attributes, not static method - GEOMDATAAPI_EXPORT virtual std::string attributeType(); + GEOMDATAAPI_EXPORT std::string attributeType() override; /// Returns this attribute from the data if it is possible /// \param theData a model data @@ -110,10 +110,10 @@ public: protected: /// Objects are created for features automatically GEOMDATAAPI_EXPORT GeomDataAPI_Point2D(); - GEOMDATAAPI_EXPORT virtual ~GeomDataAPI_Point2D(); + GEOMDATAAPI_EXPORT ~GeomDataAPI_Point2D() override; }; //! Pointer on attribute object -typedef std::shared_ptr AttributePoint2DPtr; +using AttributePoint2DPtr = std::shared_ptr; #endif diff --git a/src/GeomDataAPI/GeomDataAPI_Point2DArray.h b/src/GeomDataAPI/GeomDataAPI_Point2DArray.h index 3ebea1385..882a48edc 100644 --- a/src/GeomDataAPI/GeomDataAPI_Point2DArray.h +++ b/src/GeomDataAPI/GeomDataAPI_Point2DArray.h @@ -61,14 +61,14 @@ public: static std::string typeId() { return std::string("Point2DArray"); } /// Returns the type of this class of attributes, not static method - GEOMDATAAPI_EXPORT virtual std::string attributeType(); + GEOMDATAAPI_EXPORT std::string attributeType() override; protected: /// Objects are created for features automatically GEOMDATAAPI_EXPORT GeomDataAPI_Point2DArray(); - GEOMDATAAPI_EXPORT virtual ~GeomDataAPI_Point2DArray(); + GEOMDATAAPI_EXPORT ~GeomDataAPI_Point2DArray() override; }; -typedef std::shared_ptr AttributePoint2DArrayPtr; +using AttributePoint2DArrayPtr = std::shared_ptr; #endif diff --git a/src/GeomValidators/GeomValidators_Finite.h b/src/GeomValidators/GeomValidators_Finite.h index a3072b4bf..e45939f4a 100644 --- a/src/GeomValidators/GeomValidators_Finite.h +++ b/src/GeomValidators/GeomValidators_Finite.h @@ -35,10 +35,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/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 9789adb83..f6779ad55 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -73,7 +73,7 @@ #include #include -//#define DEB_NAMING 1 +// #define DEB_NAMING 1 #ifdef DEB_NAMING #include #endif diff --git a/src/Model/Model_AttributeString.h b/src/Model/Model_AttributeString.h index a9ce797b7..f624a8d1f 100644 --- a/src/Model/Model_AttributeString.h +++ b/src/Model/Model_AttributeString.h @@ -39,23 +39,23 @@ class Model_AttributeString : public ModelAPI_AttributeString { TDF_Label myLab; ///< if attribute is not initialized, store label here public: /// Defines the std::string value - MODEL_EXPORT virtual void setValue(const std::string &theValue); + MODEL_EXPORT void setValue(const std::string &theValue) override; /// Defines the std::wstring value - MODEL_EXPORT virtual void setValue(const std::wstring &theValue); + MODEL_EXPORT void setValue(const std::wstring &theValue) override; /// Returns the std::string value - MODEL_EXPORT virtual std::string value(); + MODEL_EXPORT std::string value() override; /// Returns a pointer to Unicode string - MODEL_EXPORT virtual char16_t *valueU(); + MODEL_EXPORT char16_t *valueU() override; /// Returns true if Unicode string was stored - MODEL_EXPORT virtual bool isUValue() const; + MODEL_EXPORT bool isUValue() const override; protected: /// Initializes attributes Model_AttributeString(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_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index f37caa256..801f0f3ba 100644 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -60,8 +60,8 @@ #include #include // DEB -//#include -//#define DEB_IMPORT 1 +// #include +// #define DEB_IMPORT 1 /// reference to the shape in external document: sting list attribute identifier static const Standard_GUID diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 805644215..b1aa727a5 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -1469,8 +1469,8 @@ Model_Document::objectByName(const std::string &theGroupID, return myObjs->objectByName(theGroupID, theName); } -const int Model_Document::index(std::shared_ptr theObject, - const bool theAllowFolder) { +int Model_Document::index(std::shared_ptr theObject, + const bool theAllowFolder) { return myObjs->index(theObject, theAllowFolder); } diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index f4aa78ed7..fcb0d21a1 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -47,7 +47,7 @@ public: //! This kind is used for feature buttons enable/disable depending on active //! document (it uses workbench "document" identifier in XML configuration //! file for this) - MODEL_EXPORT virtual const std::string &kind() const { return myKind; } + MODEL_EXPORT const std::string &kind() const override { return myKind; } //! Loads the OCAF document from the file. //! \param theDirName directory of the loaded file @@ -65,10 +65,10 @@ public: //! features //! (useful for import to PartSet), but do not import it //! \returns true if file was loaded successfully - MODEL_EXPORT virtual bool + MODEL_EXPORT bool importPart(const char *theFileName, std::list> &theImported, - bool theCheckOnly = false); + bool theCheckOnly = false) override; //! Saves the OCAF document to the file. //! \param theDirName directory where the document will be saved @@ -82,15 +82,14 @@ public: //! Export the list of features to the file //! \param theFilename path to save the file //! \param theExportFeatures list of features to export - MODEL_EXPORT virtual bool - save(const char *theFilename, - const std::list> &theExportFeatures) - const; + MODEL_EXPORT bool save(const char *theFilename, + const std::list> + &theExportFeatures) const override; //! Removes document data //! \param theForever if it is false, document is just hidden //! (to keep possibility make it back on Undo/Redo) - MODEL_EXPORT virtual void close(const bool theForever = false); + MODEL_EXPORT void close(const bool theForever = false) override; //! Starts a new operation (opens a transaction) MODEL_EXPORT virtual void startOperation(); @@ -120,168 +119,167 @@ public: //! Adds to the document the new feature of the given feature id //! \param theID creates feature and puts it in the document //! \param theMakeCurrent to make current this new feature in this document - MODEL_EXPORT virtual FeaturePtr addFeature(std::string theID, - const bool theMakeCurrent = true); + MODEL_EXPORT FeaturePtr addFeature(std::string theID, + const bool theMakeCurrent = true) override; //! Return a list of features, which refers to the feature //! \param theFeature a feature //! \param theRefs a list of reference features //! \param isSendError a flag whether the error message should be send - MODEL_EXPORT virtual void refsToFeature(FeaturePtr theFeature, - std::set &theRefs, - const bool isSendError = true); + MODEL_EXPORT void refsToFeature(FeaturePtr theFeature, + std::set &theRefs, + const bool isSendError = true) override; //! Removes the feature from the document (with result) //! It is necessary to flush REDISPLAY signal manually after this method //! because the method sends it, but for the performance purpose does not //! flush it \param theFeature a removed feature - MODEL_EXPORT virtual void removeFeature(FeaturePtr theFeature); + MODEL_EXPORT void removeFeature(FeaturePtr theFeature) override; //! Moves the feature to make it after the given one in the history. - MODEL_EXPORT virtual void moveFeature(FeaturePtr theMoved, - FeaturePtr theAfterThis, - const bool theSplit = false); + MODEL_EXPORT void moveFeature(FeaturePtr theMoved, FeaturePtr theAfterThis, + const bool theSplit = false) override; //! Returns the first found object in the group by the object name //! \param theGroupID group that contains an object //! \param theName name of the object to search //! \returns null if such object is not found - MODEL_EXPORT virtual std::shared_ptr - objectByName(const std::string &theGroupID, const std::wstring &theName); + MODEL_EXPORT std::shared_ptr + objectByName(const std::string &theGroupID, + const std::wstring &theName) override; //! Returns the object index in the group. Object must be visible. Otherwise //! 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 - MODEL_EXPORT virtual const int - index(std::shared_ptr theObject, - const bool theAllowFolder = false); + MODEL_EXPORT int index(std::shared_ptr theObject, + const bool theAllowFolder = false) override; //! Internal sub-document by ID MODEL_EXPORT virtual std::shared_ptr subDoc(int theDocID); ///! Returns the id of the document - MODEL_EXPORT virtual const int id() const { return myID; } + MODEL_EXPORT int id() const override { return myID; } //! Returns the feature in the group by the index (started from zero) //! \param theGroupID group that contains a feature //! \param theIndex zero-based index of feature in the group //! \param theAllowFolder take into account grouping feature by folders - MODEL_EXPORT virtual ObjectPtr object(const std::string &theGroupID, - const int theIndex, - const bool theAllowFolder = false); + MODEL_EXPORT ObjectPtr object(const std::string &theGroupID, + const int theIndex, + const bool theAllowFolder = false) override; //! Returns the number of features in the group //! \param theGroupID group of objects //! \param theAllowFolder take into account grouping feature by folders - MODEL_EXPORT virtual int size(const std::string &theGroupID, - const bool theAllowFolder = false); + MODEL_EXPORT int size(const std::string &theGroupID, + const bool theAllowFolder = false) override; //! Returns the parent object of this child. This may be result or feature, //! parent of a top result. Fast method, that uses internal data structure //! specifics. - MODEL_EXPORT virtual std::shared_ptr - parent(const std::shared_ptr theChild); + MODEL_EXPORT std::shared_ptr + parent(const std::shared_ptr theChild) override; //! Returns the feature that is currently edited in this document, normally //! this is the latest created feature //! \param theVisible use visible features only: flag is true for Object //! Browser functionality \returns null if next created feature must be the //! first - MODEL_EXPORT virtual std::shared_ptr - currentFeature(const bool theVisible); + MODEL_EXPORT std::shared_ptr + currentFeature(const bool theVisible) override; //! Sets the current feature: all features below will be disabled, new //! features will be appended after this one. \param theCurrent the selected //! feature as current: below it everything becomes disabled \param theVisible //! use visible features only: flag is true for Object Browser functionality - MODEL_EXPORT virtual void + MODEL_EXPORT void setCurrentFeature(std::shared_ptr theCurrent, - const bool theVisible); + const bool theVisible) override; //! Makes the current feature one feature upper - MODEL_EXPORT virtual void setCurrentFeatureUp(); + MODEL_EXPORT void setCurrentFeatureUp() override; //! Returns the number of all features: in the history or not - MODEL_EXPORT virtual int numInternalFeatures(); + MODEL_EXPORT int numInternalFeatures() override; //! Returns the feature by zero-based index: features in the history or not - MODEL_EXPORT virtual std::shared_ptr - internalFeature(const int theIndex); + MODEL_EXPORT std::shared_ptr + internalFeature(const int theIndex) override; //! Performs synchronization of transactions with the module document: //! If some document is not active (by undo of activation) but in memory, //! on activation the transactions must be synchronized because all redo-s //! performed without this participation - MODEL_EXPORT virtual void synchronizeTransactions(); + MODEL_EXPORT void synchronizeTransactions() override; /// Creates construction results - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT std::shared_ptr createConstruction(const std::shared_ptr &theFeatureData, - const int theIndex = 0); + const int theIndex = 0) override; /// Creates a body results - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT std::shared_ptr createBody(const std::shared_ptr &theFeatureData, - const int theIndex = 0); + const int theIndex = 0) override; /// Creates a part results - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT std::shared_ptr createPart(const std::shared_ptr &theFeatureData, - const int theIndex = 0); + const int theIndex = 0) override; //! Copies a part result, keeping the reference to origin - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT std::shared_ptr copyPart(const std::shared_ptr &theOrigin, const std::shared_ptr &theFeatureData, - const int theIndex = 0); + const int theIndex = 0) override; /// Creates a group result - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT std::shared_ptr createGroup(const std::shared_ptr &theFeatureData, - const int theIndex = 0); + const int theIndex = 0) override; /// Creates a field result - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT std::shared_ptr createField(const std::shared_ptr &theFeatureData, - const int theIndex = 0); + const int theIndex = 0) override; /// Creates a parameter result - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT std::shared_ptr createParameter(const std::shared_ptr &theFeatureData, - const int theIndex = 0); + const int theIndex = 0) override; //! Returns a feature by result (owner of result) - MODEL_EXPORT virtual std::shared_ptr - feature(const std::shared_ptr &theResult); + MODEL_EXPORT std::shared_ptr + feature(const std::shared_ptr &theResult) override; //! Creates a folder (group of the features in the object browser) //! \param theAddBefore a feature, the folder is added before //! (if empty, the folder is added after the last feature) - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT std::shared_ptr addFolder(std::shared_ptr theAddBefore = - std::shared_ptr()); + std::shared_ptr()) override; //! Removes the folder from the document (all features in the folder will be //! kept). - MODEL_EXPORT virtual void - removeFolder(std::shared_ptr theFolder); + MODEL_EXPORT void + removeFolder(std::shared_ptr theFolder) override; //! Search a folder above the list of features applicable to store them //! (it means the list of features stored in the folder should be //! consequential) \return Empty pointer if there is no applicable folder - MODEL_EXPORT virtual std::shared_ptr findFolderAbove( - const std::list> &theFeatures); + MODEL_EXPORT std::shared_ptr findFolderAbove( + const std::list> &theFeatures) override; //! Search a folder below the list of features applicable to store them //! (it means the list of features stored in the folder should be //! consequential) \return Empty pointer if there is no applicable folder - MODEL_EXPORT virtual std::shared_ptr findFolderBelow( - const std::list> &theFeatures); + MODEL_EXPORT std::shared_ptr findFolderBelow( + const std::list> &theFeatures) override; //! Search a folder containing the given feature. //! Additionally calculates a zero-based index of the feature in this folder. //! \param theFeature feature to search //! \param theIndexInFolder zero-based index in the folder or -1 if the //! feature is top-level. \return the folder containing the feature or empty //! pointer if the feature is top-level. - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT std::shared_ptr findContainingFolder(const std::shared_ptr &theFeature, - int &theIndexInFolder); + int &theIndexInFolder) override; //! Add a list of features to the folder. The correctness of the adding is not //! performed (such checks have been done in corresponding find.. method). //! \return \c true if the movement is successful - MODEL_EXPORT virtual bool + MODEL_EXPORT bool moveToFolder(const std::list> &theFeatures, - const std::shared_ptr &theFolder); + const std::shared_ptr &theFolder) override; //! Remove features from the folder //! \param theFeatures list of features to be removed //! \param theBefore extract features before the folder (this parameter is @@ -289,9 +287,9 @@ public: //! when all features in the folder are taking out, //! in other cases the direction is taken automatically) //! \return \c true if the features have been moved out - MODEL_EXPORT virtual bool removeFromFolder( + MODEL_EXPORT bool removeFromFolder( const std::list> &theFeatures, - const bool theBefore = true); + const bool theBefore = true) override; ///! Returns true if parametric updater need to execute feature on /// recomputation ! On abort, undo or redo it is not necessary: results in @@ -321,13 +319,14 @@ public: ///! Returns all features of the document including the hidden features which /// are not in ! history. Not very fast method, for calling once, not in big /// cycles. - MODEL_EXPORT virtual std::list> - allFeatures(); + MODEL_EXPORT std::list> + allFeatures() override; //! Returns all objects of the document including the hidden features which //! are not in history. Not very fast method, for calling once, not in big //! cycles. - MODEL_EXPORT virtual std::list> allObjects(); + MODEL_EXPORT std::list> + allObjects() override; /// Returns the global identifier of the current transaction (needed for the /// update algo) @@ -336,36 +335,36 @@ public: MODEL_EXPORT virtual void incrementTransactionID(); /// Returns true if document is opened and valid - MODEL_EXPORT virtual bool isOpened(); + MODEL_EXPORT bool isOpened() override; /// Returns the last feature in the document (even not visible or disabled) /// \returns null if there is no features FeaturePtr lastFeature(); /// Returns the feature that produced the given face of the given result. - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT std::shared_ptr producedByFeature(std::shared_ptr theResult, - const std::shared_ptr &theShape); + const std::shared_ptr &theShape) override; /// Returns true if theLater is in history of features creation later than /// theCurrent - MODEL_EXPORT virtual bool isLater(FeaturePtr theLater, - FeaturePtr theCurrent) const; + MODEL_EXPORT bool isLater(FeaturePtr theLater, + FeaturePtr theCurrent) const override; /// Just removes all features without touching the document data (to be able /// undo) - MODEL_EXPORT virtual void eraseAllFeatures(); + MODEL_EXPORT void eraseAllFeatures() override; /// Returns the next (from the history point of view) feature, any: invisible /// or disabled \param theCurrent previous to the resulting feature \param /// theReverse if it is true, iterates in reversed order (next becomes /// previous) - MODEL_EXPORT virtual std::shared_ptr + MODEL_EXPORT std::shared_ptr nextFeature(std::shared_ptr theCurrent, - const bool theReverse = false) const; + const bool theReverse = false) const override; //! Erases the document structure. - ~Model_Document(); + ~Model_Document() override; protected: //! Returns (creates if needed) the general label @@ -402,10 +401,10 @@ protected: //! Internally makes document know that feature was removed or added in //! history after creation - virtual void updateHistory(const std::shared_ptr theObject); + void updateHistory(const std::shared_ptr theObject) override; //! Internally makes document know that feature was removed or added in //! history after creation - virtual void updateHistory(const std::string theGroup); + void updateHistory(const std::string theGroup) override; //! Returns true if the document is root module document bool isRoot() const; @@ -418,9 +417,9 @@ protected: ///! Informs the document that it becomes active and some actions must be /// performed - virtual void setActive(const bool theFlag); + void setActive(const bool theFlag) override; //! Returns true if this document is currently active - virtual bool isActive() const; + bool isActive() const override; //! Returns the selection attribute that is used //! for calculation of selection externally from the document @@ -429,11 +428,11 @@ protected: /// Stores in the document boolean flags: states of the nodes in the object /// browser. Normally is called outside of the transaction, just before /// "save". - virtual void storeNodesState(const std::list &theStates); + void storeNodesState(const std::list &theStates) override; /// Returns the stored nodes states. Normally it is called just after "open". /// Appends the values to theStates list. - virtual void restoreNodesState(std::list &theStates) const; + void restoreNodesState(std::list &theStates) const override; /// Label that contains structures for selection of constructions of another /// document @@ -489,11 +488,11 @@ private: //! Information related to the every user-transaction struct Transaction { - int myOCAFNum; ///< number of OCAF transactions related to each "this" + int myOCAFNum{0}; ///< number of OCAF transactions related to each "this" ///< transaction, may be 0 std::string myId; ///< user-identifier string of transaction //! default constructor with default Id - Transaction() : myOCAFNum(0), myId("") {} + Transaction() : myId("") {} }; //! transaction indexes (related to myTransactionsAfterSave) and info about diff --git a/src/Model/Model_ResultParameter.cpp b/src/Model/Model_ResultParameter.cpp index 2ca252ef5..58dceadbc 100644 --- a/src/Model/Model_ResultParameter.cpp +++ b/src/Model/Model_ResultParameter.cpp @@ -22,11 +22,11 @@ #include #include -Model_ResultParameter::~Model_ResultParameter() {} +Model_ResultParameter::~Model_ResultParameter() = default; void Model_ResultParameter::initAttributes() { data()->addAttribute(ModelAPI_ResultParameter::VALUE(), ModelAPI_AttributeDouble::typeId()); } -Model_ResultParameter::Model_ResultParameter() {} +Model_ResultParameter::Model_ResultParameter() = default; diff --git a/src/Model/Model_ResultParameter.h b/src/Model/Model_ResultParameter.h index a9fcddbb9..76b5349fe 100644 --- a/src/Model/Model_ResultParameter.h +++ b/src/Model/Model_ResultParameter.h @@ -34,8 +34,8 @@ */ class Model_ResultParameter : public ModelAPI_ResultParameter { public: - MODEL_EXPORT virtual ~Model_ResultParameter(); - MODEL_EXPORT virtual void initAttributes(); + MODEL_EXPORT ~Model_ResultParameter() override; + MODEL_EXPORT void initAttributes() override; protected: Model_ResultParameter(); diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index f677ab2d3..8d18adb0d 100644 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -50,7 +50,7 @@ Model_Update MY_UPDATER_INSTANCE; /// the only one instance initialized on load /// of the library -//#define DEB_UPDATE +// #define DEB_UPDATE #ifdef DEB_UPDATE #include diff --git a/src/ModelAPI/ModelAPI_Attribute.h b/src/ModelAPI/ModelAPI_Attribute.h index 0d45487d0..ec00ca2ff 100644 --- a/src/ModelAPI/ModelAPI_Attribute.h +++ b/src/ModelAPI/ModelAPI_Attribute.h @@ -107,6 +107,6 @@ protected: }; //! Pointer on attribute object -typedef std::shared_ptr AttributePtr; +using AttributePtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeBoolean.h b/src/ModelAPI/ModelAPI_AttributeBoolean.h index e26322177..adc3bb06a 100644 --- a/src/ModelAPI/ModelAPI_AttributeBoolean.h +++ b/src/ModelAPI/ModelAPI_AttributeBoolean.h @@ -40,16 +40,16 @@ public: MODELAPI_EXPORT static std::string typeId() { return "Boolean"; } /// 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_AttributeBoolean(); + MODELAPI_EXPORT ~ModelAPI_AttributeBoolean() override; protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeBoolean(); }; -typedef std::shared_ptr AttributeBooleanPtr; +using AttributeBooleanPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeDocRef.h b/src/ModelAPI/ModelAPI_AttributeDocRef.h index b91d527b7..84680a4c7 100644 --- a/src/ModelAPI/ModelAPI_AttributeDocRef.h +++ b/src/ModelAPI/ModelAPI_AttributeDocRef.h @@ -45,16 +45,16 @@ public: MODELAPI_EXPORT static std::string typeId() { return "DocRef"; } /// 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_AttributeDocRef(); + MODELAPI_EXPORT ~ModelAPI_AttributeDocRef() override; protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeDocRef(); }; -typedef std::shared_ptr AttributeDocRefPtr; +using AttributeDocRefPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeDouble.h b/src/ModelAPI/ModelAPI_AttributeDouble.h index 6572b61e5..39192bbcd 100644 --- a/src/ModelAPI/ModelAPI_AttributeDouble.h +++ b/src/ModelAPI/ModelAPI_AttributeDouble.h @@ -72,10 +72,10 @@ public: MODELAPI_EXPORT static std::string typeId() { return "Double"; } /// 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_AttributeDouble(); + MODELAPI_EXPORT ~ModelAPI_AttributeDouble() override; protected: /// Objects are created for features automatically @@ -83,6 +83,6 @@ protected: }; //! Pointer on double attribute -typedef std::shared_ptr AttributeDoublePtr; +using AttributeDoublePtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeDoubleArray.h b/src/ModelAPI/ModelAPI_AttributeDoubleArray.h index de965308e..6a2ac5127 100644 --- a/src/ModelAPI/ModelAPI_AttributeDoubleArray.h +++ b/src/ModelAPI/ModelAPI_AttributeDoubleArray.h @@ -49,10 +49,10 @@ public: MODELAPI_EXPORT static std::string typeId() { return "DoubleArray"; } /// 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_AttributeDoubleArray(); + MODELAPI_EXPORT ~ModelAPI_AttributeDoubleArray() override; protected: /// Objects are created for features automatically @@ -60,6 +60,6 @@ protected: }; /// Pointer on double attribute -typedef std::shared_ptr AttributeDoubleArrayPtr; +using AttributeDoubleArrayPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeImage.cpp b/src/ModelAPI/ModelAPI_AttributeImage.cpp index ba4bb3d26..8bd154fec 100644 --- a/src/ModelAPI/ModelAPI_AttributeImage.cpp +++ b/src/ModelAPI/ModelAPI_AttributeImage.cpp @@ -23,6 +23,6 @@ std::string ModelAPI_AttributeImage::attributeType() { return typeId(); } /// To virtually destroy the fields of successors -ModelAPI_AttributeImage::~ModelAPI_AttributeImage() {} +ModelAPI_AttributeImage::~ModelAPI_AttributeImage() = default; -ModelAPI_AttributeImage::ModelAPI_AttributeImage() {} +ModelAPI_AttributeImage::ModelAPI_AttributeImage() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeImage.h b/src/ModelAPI/ModelAPI_AttributeImage.h index c21dfd070..d0642bcf4 100644 --- a/src/ModelAPI/ModelAPI_AttributeImage.h +++ b/src/ModelAPI/ModelAPI_AttributeImage.h @@ -57,10 +57,10 @@ public: MODELAPI_EXPORT static std::string typeId() { return "Image"; } /// 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_AttributeImage(); + MODELAPI_EXPORT ~ModelAPI_AttributeImage() override; protected: /// Objects are created for features automatically @@ -68,6 +68,6 @@ protected: }; //! Pointer on image attribute -typedef std::shared_ptr AttributeImagePtr; +using AttributeImagePtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeIntArray.h b/src/ModelAPI/ModelAPI_AttributeIntArray.h index e5b535520..917d8847f 100644 --- a/src/ModelAPI/ModelAPI_AttributeIntArray.h +++ b/src/ModelAPI/ModelAPI_AttributeIntArray.h @@ -53,10 +53,10 @@ public: MODELAPI_EXPORT static std::string typeId() { return "IntArray"; } /// 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_AttributeIntArray(); + MODELAPI_EXPORT ~ModelAPI_AttributeIntArray() override; protected: /// Objects are created for features automatically @@ -64,6 +64,6 @@ protected: }; //! Pointer on double attribute -typedef std::shared_ptr AttributeIntArrayPtr; +using AttributeIntArrayPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeInteger.h b/src/ModelAPI/ModelAPI_AttributeInteger.h index 94e995f02..26202ad2b 100644 --- a/src/ModelAPI/ModelAPI_AttributeInteger.h +++ b/src/ModelAPI/ModelAPI_AttributeInteger.h @@ -72,10 +72,10 @@ public: MODELAPI_EXPORT static std::string typeId() { return "Integer"; } /// 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_AttributeInteger(); + MODELAPI_EXPORT ~ModelAPI_AttributeInteger() override; protected: /// Objects are created for features automatically @@ -83,6 +83,6 @@ protected: }; //! Pointer on double attribute -typedef std::shared_ptr AttributeIntegerPtr; +using AttributeIntegerPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeRefAttr.h b/src/ModelAPI/ModelAPI_AttributeRefAttr.h index 255291fe2..1a1628c90 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefAttr.h +++ b/src/ModelAPI/ModelAPI_AttributeRefAttr.h @@ -52,16 +52,16 @@ public: MODELAPI_EXPORT static std::string typeId() { return "RefAttr"; } /// 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_AttributeRefAttr(); + MODELAPI_EXPORT ~ModelAPI_AttributeRefAttr() override; protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeRefAttr(); }; -typedef std::shared_ptr AttributeRefAttrPtr; +using AttributeRefAttrPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeRefAttrList.cpp b/src/ModelAPI/ModelAPI_AttributeRefAttrList.cpp index 2385e4176..364bd992e 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefAttrList.cpp +++ b/src/ModelAPI/ModelAPI_AttributeRefAttrList.cpp @@ -22,6 +22,6 @@ std::string ModelAPI_AttributeRefAttrList::attributeType() { return typeId(); } -ModelAPI_AttributeRefAttrList::~ModelAPI_AttributeRefAttrList() {} +ModelAPI_AttributeRefAttrList::~ModelAPI_AttributeRefAttrList() = default; -ModelAPI_AttributeRefAttrList::ModelAPI_AttributeRefAttrList() {} +ModelAPI_AttributeRefAttrList::ModelAPI_AttributeRefAttrList() = default; diff --git a/src/ModelAPI/ModelAPI_AttributeRefAttrList.h b/src/ModelAPI/ModelAPI_AttributeRefAttrList.h index cdfc68b53..7099128f7 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefAttrList.h +++ b/src/ModelAPI/ModelAPI_AttributeRefAttrList.h @@ -38,7 +38,7 @@ public: MODELAPI_EXPORT static std::string typeId() { return "RefAttrList"; } /// Returns the type of this class of attributes, not static method - MODELAPI_EXPORT virtual std::string attributeType(); + MODELAPI_EXPORT std::string attributeType() override; /// Appends the feature to the end of a list virtual void append(ObjectPtr theObject) = 0; @@ -82,13 +82,13 @@ public: /// \param theIndices a list of indices of elements to be removed virtual void remove(const std::set &theIndices) = 0; - MODELAPI_EXPORT virtual ~ModelAPI_AttributeRefAttrList(); + MODELAPI_EXPORT ~ModelAPI_AttributeRefAttrList() override; protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeRefAttrList(); }; -typedef std::shared_ptr AttributeRefAttrListPtr; +using AttributeRefAttrListPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeRefList.h b/src/ModelAPI/ModelAPI_AttributeRefList.h index e487e39ae..631315fee 100644 --- a/src/ModelAPI/ModelAPI_AttributeRefList.h +++ b/src/ModelAPI/ModelAPI_AttributeRefList.h @@ -37,7 +37,7 @@ public: MODELAPI_EXPORT static std::string typeId() { return "RefList"; } /// Returns the type of this class of attributes, not static method - MODELAPI_EXPORT virtual std::string attributeType(); + MODELAPI_EXPORT std::string attributeType() override; /// Appends the feature to the end of a list virtual void append(ObjectPtr theObject) = 0; @@ -78,13 +78,13 @@ public: /// \param theIndices a list of indices of elements to be removed virtual void remove(const std::set &theIndices) = 0; - MODELAPI_EXPORT virtual ~ModelAPI_AttributeRefList(); + MODELAPI_EXPORT ~ModelAPI_AttributeRefList() override; protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeRefList(); }; -typedef std::shared_ptr AttributeRefListPtr; +using AttributeRefListPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeReference.h b/src/ModelAPI/ModelAPI_AttributeReference.h index 126f160f2..f986dc9b4 100644 --- a/src/ModelAPI/ModelAPI_AttributeReference.h +++ b/src/ModelAPI/ModelAPI_AttributeReference.h @@ -42,16 +42,16 @@ public: MODELAPI_EXPORT static std::string typeId() { return "Reference"; } /// 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_AttributeReference(); + MODELAPI_EXPORT ~ModelAPI_AttributeReference() override; protected: /// Objects are created for features automatically MODELAPI_EXPORT ModelAPI_AttributeReference(); }; -typedef std::shared_ptr AttributeReferencePtr; +using AttributeReferencePtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeSelection.h b/src/ModelAPI/ModelAPI_AttributeSelection.h index 5d6b0aeb4..1c6bab551 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelection.h +++ b/src/ModelAPI/ModelAPI_AttributeSelection.h @@ -88,7 +88,7 @@ public: static std::string typeId() { return "Selection"; } /// Returns the type of this class of attributes, not static method - MODELAPI_EXPORT virtual std::string attributeType(); + MODELAPI_EXPORT std::string attributeType() override; /// Returns a textual string of the selection /// \param theDefaultValue a value, which is used if the naming name can not @@ -119,7 +119,7 @@ public: virtual bool isGeometricalSelection() const = 0; /// To virtually destroy the fields of successors - MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection(); + MODELAPI_EXPORT ~ModelAPI_AttributeSelection() override; /// Returns the name by context. Adds the part name if the context is located /// in other document @@ -141,6 +141,6 @@ protected: }; //! Pointer on double attribute -typedef std::shared_ptr AttributeSelectionPtr; +using AttributeSelectionPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeSelectionList.h b/src/ModelAPI/ModelAPI_AttributeSelectionList.h index 9d43979c1..35d8f1bd5 100644 --- a/src/ModelAPI/ModelAPI_AttributeSelectionList.h +++ b/src/ModelAPI/ModelAPI_AttributeSelectionList.h @@ -127,10 +127,10 @@ public: static std::string typeId() { return "SelectionList"; } /// 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_AttributeSelectionList(); + MODELAPI_EXPORT ~ModelAPI_AttributeSelectionList() override; /// Returns a selection filters feature if it is defined for this selection /// list @@ -141,7 +141,7 @@ public: /// Returns true if the whole result selection corresponds to selection of all /// sub-shapes. - MODELAPI_EXPORT virtual const bool isWholeResultAllowed() const { + MODELAPI_EXPORT virtual bool isWholeResultAllowed() const { return myIsWholeResultAllowed; } @@ -152,7 +152,7 @@ public: } /// Returns true if a copy features must be used in update in history. - MODELAPI_EXPORT virtual const bool isMakeCopy() const { return myMakeCopy; } + MODELAPI_EXPORT virtual bool isMakeCopy() const { return myMakeCopy; } /// Sets true if a copy features must be used in update in history. MODELAPI_EXPORT virtual void setMakeCopy(const bool theFlag) { @@ -168,7 +168,7 @@ protected: }; //! Pointer on double attribute -typedef std::shared_ptr - AttributeSelectionListPtr; +using AttributeSelectionListPtr = + std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeString.h b/src/ModelAPI/ModelAPI_AttributeString.h index bfda520e0..cca26e849 100644 --- a/src/ModelAPI/ModelAPI_AttributeString.h +++ b/src/ModelAPI/ModelAPI_AttributeString.h @@ -47,10 +47,10 @@ public: MODELAPI_EXPORT static std::string typeId() { return "String"; } /// 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_AttributeString(); + MODELAPI_EXPORT ~ModelAPI_AttributeString() override; protected: /// Objects are created for features automatically @@ -58,6 +58,6 @@ protected: }; //! Pointer on string attribute -typedef std::shared_ptr AttributeStringPtr; +using AttributeStringPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeTables.h b/src/ModelAPI/ModelAPI_AttributeTables.h index b196ca0f9..df9a871af 100644 --- a/src/ModelAPI/ModelAPI_AttributeTables.h +++ b/src/ModelAPI/ModelAPI_AttributeTables.h @@ -83,9 +83,9 @@ public: /// Returns the type of this class of attributes MODELAPI_EXPORT static std::string typeId() { return "Tables"; } /// 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_AttributeTables(); + MODELAPI_EXPORT ~ModelAPI_AttributeTables() override; protected: /// Objects are created for features automatically @@ -93,6 +93,6 @@ protected: }; /// Pointer on double attribute -typedef std::shared_ptr AttributeTablesPtr; +using AttributeTablesPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_AttributeValidator.h b/src/ModelAPI/ModelAPI_AttributeValidator.h index 73c51d4f4..3c66afbdc 100644 --- a/src/ModelAPI/ModelAPI_AttributeValidator.h +++ b/src/ModelAPI/ModelAPI_AttributeValidator.h @@ -38,7 +38,7 @@ public: const std::list &theArguments, Events_InfoMessage &theError) const = 0; - MODELAPI_EXPORT ~ModelAPI_AttributeValidator(); + MODELAPI_EXPORT ~ModelAPI_AttributeValidator() override; }; #endif diff --git a/src/ModelAPI/ModelAPI_CompositeFeature.h b/src/ModelAPI/ModelAPI_CompositeFeature.h index b8113b10e..076e3f80b 100644 --- a/src/ModelAPI/ModelAPI_CompositeFeature.h +++ b/src/ModelAPI/ModelAPI_CompositeFeature.h @@ -32,7 +32,7 @@ */ class ModelAPI_CompositeFeature : public ModelAPI_Feature { public: - MODELAPI_EXPORT virtual ~ModelAPI_CompositeFeature(); + MODELAPI_EXPORT ~ModelAPI_CompositeFeature() override; /// Adds feature to the sketch and to its document virtual std::shared_ptr addFeature(std::string theID) = 0; @@ -57,10 +57,10 @@ public: virtual void removeFeature(std::shared_ptr theFeature) = 0; /// in addition removes all subs - MODELAPI_EXPORT virtual void erase(); + MODELAPI_EXPORT void erase() override; }; //! Pointer on the composite feature object -typedef std::shared_ptr CompositeFeaturePtr; +using CompositeFeaturePtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_Data.h b/src/ModelAPI/ModelAPI_Data.h index 7e5809f1a..789b05885 100644 --- a/src/ModelAPI/ModelAPI_Data.h +++ b/src/ModelAPI/ModelAPI_Data.h @@ -283,6 +283,6 @@ protected: friend class ModelAPI_Object; }; -typedef std::shared_ptr DataPtr; +using DataPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_Document.cpp b/src/ModelAPI/ModelAPI_Document.cpp index 2011de1d8..77e6c7698 100644 --- a/src/ModelAPI/ModelAPI_Document.cpp +++ b/src/ModelAPI/ModelAPI_Document.cpp @@ -20,7 +20,7 @@ #include -ModelAPI_Document::~ModelAPI_Document() {} +ModelAPI_Document::~ModelAPI_Document() = default; /// Only for SWIG wrapping it is here -ModelAPI_Document::ModelAPI_Document() {} +ModelAPI_Document::ModelAPI_Document() = default; diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h index 6ea7dd63e..3cb94ecb7 100644 --- a/src/ModelAPI/ModelAPI_Document.h +++ b/src/ModelAPI/ModelAPI_Document.h @@ -88,7 +88,7 @@ public: const bool theSplit = false) = 0; ///! Returns the id of the document - virtual const int id() const = 0; + virtual int id() const = 0; //! Returns the object in the group by the index (started from zero) //! \param theGroupID group that contains an object @@ -109,8 +109,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 - virtual const int index(std::shared_ptr theObject, - const bool theAllowFolder = false) = 0; + virtual int index(std::shared_ptr theObject, + const bool theAllowFolder = false) = 0; //! Returns the number of objects in the group of objects //! \param theGroupID group of objects @@ -327,6 +327,6 @@ protected: }; //! Pointer on document object -typedef std::shared_ptr DocumentPtr; +using DocumentPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_Entity.h b/src/ModelAPI/ModelAPI_Entity.h index f047adbcb..e21523cea 100644 --- a/src/ModelAPI/ModelAPI_Entity.h +++ b/src/ModelAPI/ModelAPI_Entity.h @@ -35,6 +35,6 @@ public: virtual void emptyFunction() const {} }; -typedef std::shared_ptr EntityPtr; +using EntityPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_EventReentrantMessage.h b/src/ModelAPI/ModelAPI_EventReentrantMessage.h index 73410b652..7ce28a729 100644 --- a/src/ModelAPI/ModelAPI_EventReentrantMessage.h +++ b/src/ModelAPI/ModelAPI_EventReentrantMessage.h @@ -41,7 +41,7 @@ public: MODELAPI_EXPORT ModelAPI_EventReentrantMessage(const Events_ID theID, const void *theSender); /// The virtual destructor - MODELAPI_EXPORT virtual ~ModelAPI_EventReentrantMessage() {} + MODELAPI_EXPORT ~ModelAPI_EventReentrantMessage() override = default; /// Static. Returns EventID of the message. MODELAPI_EXPORT static Events_ID eventId() { static const char *MY_EVENT_REENTRANT_MESSAGE_ID("EventReentrantMessage"); @@ -106,6 +106,6 @@ private: std::shared_ptr myClickedPoint; ///< clicked point }; -typedef std::shared_ptr ReentrantMessagePtr; +using ReentrantMessagePtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_Events.cpp b/src/ModelAPI/ModelAPI_Events.cpp index 23f6c41d1..a5134f87d 100644 --- a/src/ModelAPI/ModelAPI_Events.cpp +++ b/src/ModelAPI/ModelAPI_Events.cpp @@ -24,7 +24,7 @@ #include #include -//#define DEBUG_OBJECT_MOVED_MESSAGE +// #define DEBUG_OBJECT_MOVED_MESSAGE #ifdef DEBUG_OBJECT_MOVED_MESSAGE #include #endif diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h index 044cf6a8e..bf0bcc28c 100644 --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@ -167,19 +167,19 @@ class MODELAPI_EXPORT ModelAPI_ObjectUpdatedMessage protected: /// Creates an empty message ModelAPI_ObjectUpdatedMessage(const Events_ID theID, - const void *theSender = 0); + const void *theSender = nullptr); /// The virtual destructor - virtual ~ModelAPI_ObjectUpdatedMessage(); + ~ModelAPI_ObjectUpdatedMessage() override; public: /// Returns the feature that has been updated virtual const std::set &objects() const = 0; //! Creates a new empty group (to store it in the loop before flush) - virtual std::shared_ptr newEmpty() = 0; + std::shared_ptr newEmpty() override = 0; //! Allows to join the given message with the current one - virtual void Join(const std::shared_ptr &theJoined) = 0; + void Join(const std::shared_ptr &theJoined) override = 0; }; /// Message that feature was deleted (used for Object Browser update) @@ -188,9 +188,9 @@ class MODELAPI_EXPORT ModelAPI_ObjectDeletedMessage protected: /// Creates an empty message ModelAPI_ObjectDeletedMessage(const Events_ID theID, - const void *theSender = 0); + const void *theSender = nullptr); /// The virtual destructor - virtual ~ModelAPI_ObjectDeletedMessage(); + ~ModelAPI_ObjectDeletedMessage() override; public: /// Returns the groups where the objects were deleted @@ -199,13 +199,13 @@ public: groups() const = 0; /// Creates the new empty message of this kind - virtual std::shared_ptr newEmpty() = 0; + std::shared_ptr newEmpty() override = 0; /// Returns the identifier of the kind of a message virtual const Events_ID messageId() = 0; /// Appends to this message the given one. - virtual void Join(const std::shared_ptr &theJoined) = 0; + void Join(const std::shared_ptr &theJoined) override = 0; }; /// Message that order changed (used for Object Browser update) @@ -213,9 +213,9 @@ class MODELAPI_EXPORT ModelAPI_OrderUpdatedMessage : public Events_Message { protected: /// Creates a message: ModelAPI_OrderUpdatedMessage(const Events_ID theID, - const void *theSender = 0); + const void *theSender = nullptr); /// The virtual destructor - virtual ~ModelAPI_OrderUpdatedMessage(); + ~ModelAPI_OrderUpdatedMessage() override; public: /// Returns the document that has been updated @@ -228,7 +228,7 @@ public: /// Allows to create ModelAPI messages class MODELAPI_EXPORT ModelAPI_EventCreator { public: - virtual ~ModelAPI_EventCreator() {} + virtual ~ModelAPI_EventCreator() = default; /// creates created, updated or moved messages and sends to the loop virtual void sendUpdated(const ObjectPtr &theObject, @@ -258,9 +258,9 @@ class ModelAPI_FeatureStateMessage : public Events_Message { public: /// Creates an empty message MODELAPI_EXPORT ModelAPI_FeatureStateMessage(const Events_ID theID, - const void *theSender = 0); + const void *theSender = nullptr); /// The virtual destructor - MODELAPI_EXPORT virtual ~ModelAPI_FeatureStateMessage(); + MODELAPI_EXPORT ~ModelAPI_FeatureStateMessage() override; /// Returns the feature this message is related to MODELAPI_EXPORT std::shared_ptr feature() const; @@ -291,10 +291,11 @@ class ModelAPI_DocumentCreatedMessage : public Events_Message { public: /// Creates an empty message - MODELAPI_EXPORT ModelAPI_DocumentCreatedMessage(const Events_ID theID, - const void *theSender = 0); + MODELAPI_EXPORT + ModelAPI_DocumentCreatedMessage(const Events_ID theID, + const void *theSender = nullptr); /// The virtual destructor - MODELAPI_EXPORT virtual ~ModelAPI_DocumentCreatedMessage(); + MODELAPI_EXPORT ~ModelAPI_DocumentCreatedMessage() override; /// Static. Returns EventID of the message. MODELAPI_EXPORT static Events_ID eventId() { static const char *MY_DOCUMENT_CREATED_EVENT_ID("DocumentCreated"); @@ -332,10 +333,11 @@ public: } /// Creates an empty message - MODELAPI_EXPORT ModelAPI_AttributeEvalMessage(const Events_ID theID, - const void *theSender = 0); + MODELAPI_EXPORT + ModelAPI_AttributeEvalMessage(const Events_ID theID, + const void *theSender = nullptr); /// The virtual destructor - MODELAPI_EXPORT virtual ~ModelAPI_AttributeEvalMessage(); + MODELAPI_EXPORT ~ModelAPI_AttributeEvalMessage() override; /// Returns a document stored in the message MODELAPI_EXPORT AttributePtr attribute() const; @@ -377,10 +379,11 @@ public: } /// Creates an empty message - MODELAPI_EXPORT ModelAPI_ParameterEvalMessage(const Events_ID theID, - const void *theSender = 0); + MODELAPI_EXPORT + ModelAPI_ParameterEvalMessage(const Events_ID theID, + const void *theSender = nullptr); /// The virtual destructor - MODELAPI_EXPORT virtual ~ModelAPI_ParameterEvalMessage(); + MODELAPI_EXPORT ~ModelAPI_ParameterEvalMessage() override; /// Returns a parameter stored in the message MODELAPI_EXPORT FeaturePtr parameter() const; @@ -429,10 +432,11 @@ public: } /// Creates an empty message - MODELAPI_EXPORT ModelAPI_ImportParametersMessage(const Events_ID theID, - const void *theSender = 0); + MODELAPI_EXPORT + ModelAPI_ImportParametersMessage(const Events_ID theID, + const void *theSender = nullptr); /// The virtual destructor - MODELAPI_EXPORT virtual ~ModelAPI_ImportParametersMessage(); + MODELAPI_EXPORT ~ModelAPI_ImportParametersMessage() override; /// Returns a filename stored in the message MODELAPI_EXPORT std::string filename() const; @@ -470,9 +474,9 @@ public: /// Creates an empty message MODELAPI_EXPORT ModelAPI_BuildEvalMessage(const Events_ID theID, - const void *theSender = 0); + const void *theSender = nullptr); /// The virtual destructor - MODELAPI_EXPORT virtual ~ModelAPI_BuildEvalMessage(); + MODELAPI_EXPORT ~ModelAPI_BuildEvalMessage() override; /// Returns a parameter stored in the message MODELAPI_EXPORT FeaturePtr parameter() const; @@ -523,10 +527,11 @@ public: } /// Creates an empty message - MODELAPI_EXPORT ModelAPI_ComputePositionsMessage(const Events_ID theID, - const void *theSender = 0); + MODELAPI_EXPORT + ModelAPI_ComputePositionsMessage(const Events_ID theID, + const void *theSender = nullptr); /// The virtual destructor - MODELAPI_EXPORT virtual ~ModelAPI_ComputePositionsMessage(); + MODELAPI_EXPORT ~ModelAPI_ComputePositionsMessage() override; /// Returns an expression stored in the message MODELAPI_EXPORT const std::wstring &expression() const; @@ -564,10 +569,11 @@ public: const void *theSender); /// Creates an empty message - MODELAPI_EXPORT ModelAPI_ObjectRenamedMessage(const Events_ID theID, - const void *theSender = 0); + MODELAPI_EXPORT + ModelAPI_ObjectRenamedMessage(const Events_ID theID, + const void *theSender = nullptr); /// The virtual destructor - MODELAPI_EXPORT virtual ~ModelAPI_ObjectRenamedMessage(); + MODELAPI_EXPORT ~ModelAPI_ObjectRenamedMessage() override; /// Returns an object MODELAPI_EXPORT ObjectPtr object() const; @@ -601,9 +607,9 @@ public: /// Creates an empty message MODELAPI_EXPORT ModelAPI_ReplaceParameterMessage(const Events_ID theID, - const void *theSender = 0); + const void *theSender = nullptr); /// The virtual destructor - MODELAPI_EXPORT virtual ~ModelAPI_ReplaceParameterMessage(); + MODELAPI_EXPORT ~ModelAPI_ReplaceParameterMessage() override; /// Returns an object MODELAPI_EXPORT ObjectPtr object() const; @@ -617,9 +623,9 @@ class ModelAPI_SolverFailedMessage : public Events_Message { public: /// Creates an message MODELAPI_EXPORT ModelAPI_SolverFailedMessage(const Events_ID theID, - const void *theSender = 0); + const void *theSender = nullptr); /// Default destructor - MODELAPI_EXPORT virtual ~ModelAPI_SolverFailedMessage(); + MODELAPI_EXPORT ~ModelAPI_SolverFailedMessage() override; /// Sets list of conflicting constraints MODELAPI_EXPORT void setObjects(const std::set &theObjects); @@ -647,7 +653,7 @@ class ModelAPI_ObjectMovedMessage : public Events_Message { std::shared_ptr myCurrentPosition; public: - MODELAPI_EXPORT ModelAPI_ObjectMovedMessage(const void *theSender = 0); + MODELAPI_EXPORT ModelAPI_ObjectMovedMessage(const void *theSender = nullptr); /// Set object which is being moved (if the message already contains attribute /// it will be cleared) @@ -693,9 +699,9 @@ class ModelAPI_ShapesFailedMessage : public Events_Message { public: /// Creates an message MODELAPI_EXPORT ModelAPI_ShapesFailedMessage(const Events_ID theID, - const void *theSender = 0); + const void *theSender = nullptr); /// Default destructor - MODELAPI_EXPORT virtual ~ModelAPI_ShapesFailedMessage(); + MODELAPI_EXPORT ~ModelAPI_ShapesFailedMessage() override; /// Static. Returns EventID of the message. MODELAPI_EXPORT static Events_ID eventId() { return Events_Loop::eventByName(EVENT_OPERATION_SHAPES_FAILED); @@ -716,10 +722,11 @@ private: class ModelAPI_CheckConstraintsMessage : public Events_Message { public: /// Creates an empty message - MODELAPI_EXPORT ModelAPI_CheckConstraintsMessage(const Events_ID theID, - const void *theSender = 0); + MODELAPI_EXPORT + ModelAPI_CheckConstraintsMessage(const Events_ID theID, + const void *theSender = nullptr); /// The virtual destructor - MODELAPI_EXPORT virtual ~ModelAPI_CheckConstraintsMessage(); + MODELAPI_EXPORT ~ModelAPI_CheckConstraintsMessage() override; /// Get list of constrains MODELAPI_EXPORT const std::set &constraints() const; @@ -738,9 +745,9 @@ public: /// Creates an message MODELAPI_EXPORT ModelAPI_FeaturesLicenseValidMessage(const Events_ID theID, - const void *theSender = 0); + const void *theSender = nullptr); /// Default destructor - MODELAPI_EXPORT virtual ~ModelAPI_FeaturesLicenseValidMessage(); + MODELAPI_EXPORT ~ModelAPI_FeaturesLicenseValidMessage() override; /// Static. Returns EventID of the message. MODELAPI_EXPORT static Events_ID eventId() { return Events_Loop::eventByName(EVENT_FEATURE_LICENSE_VALID); diff --git a/src/ModelAPI/ModelAPI_Feature.h b/src/ModelAPI/ModelAPI_Feature.h index d7a95c011..b2dfe9dd2 100644 --- a/src/ModelAPI/ModelAPI_Feature.h +++ b/src/ModelAPI/ModelAPI_Feature.h @@ -55,12 +55,12 @@ public: } /// Returns document this feature belongs to - virtual std::shared_ptr document() const { + std::shared_ptr document() const override { return ModelAPI_Object::document(); } /// Returns the group identifier of this result - virtual std::string groupName() { return group(); } + std::string groupName() override { return group(); } /// Computes or recomputes the results virtual void execute() = 0; @@ -105,7 +105,7 @@ public: /// removes all results from the feature MODELAPI_EXPORT void eraseResults(const bool theForever = true); /// removes all fields from this feature: results, data, etc - MODELAPI_EXPORT virtual void erase(); + MODELAPI_EXPORT void erase() override; /// removes the result from the list of feature (not doing in disabled): /// normally this method is not used from features. only internally MODELAPI_EXPORT void @@ -140,10 +140,10 @@ public: MODELAPI_EXPORT virtual bool setDisabled(const bool theFlag); /// Returns the feature is disabled or not. - MODELAPI_EXPORT virtual bool isDisabled(); + MODELAPI_EXPORT bool isDisabled() override; /// To virtually destroy the fields of successors - MODELAPI_EXPORT virtual ~ModelAPI_Feature(); + MODELAPI_EXPORT ~ModelAPI_Feature() override; /// Returns the feature by the object (result). MODELAPI_EXPORT static std::shared_ptr @@ -248,20 +248,20 @@ public: protected: /// This method is called just after creation of the object: it must /// initialize all fields, normally initialized in the constructor - MODELAPI_EXPORT virtual void init(); + MODELAPI_EXPORT void init() override; friend class Model_Document; friend class Model_Objects; }; //! Pointer on feature object -typedef std::shared_ptr FeaturePtr; +using FeaturePtr = std::shared_ptr; //! An interface for performing special copy actions. To give feature which is //! moved (a group) over this feature. class ModelAPI_FeatureCopyInterface { public: - virtual ~ModelAPI_FeatureCopyInterface() {} + virtual ~ModelAPI_FeatureCopyInterface() = default; /// An algorithm to update the moved feature by the separate Copy feature /// \param theContext the original context object diff --git a/src/ModelAPI/ModelAPI_Filter.h b/src/ModelAPI/ModelAPI_Filter.h index 4c7b477af..f95024ed0 100644 --- a/src/ModelAPI/ModelAPI_Filter.h +++ b/src/ModelAPI/ModelAPI_Filter.h @@ -32,7 +32,7 @@ */ class ModelAPI_Filter { public: - virtual ~ModelAPI_Filter() {} + virtual ~ModelAPI_Filter() = default; /// Returns name of the filter to represent it in GUI virtual const std::string &name() const = 0; @@ -67,6 +67,6 @@ private: bool myIsReverse; }; -typedef std::shared_ptr FilterPtr; +using FilterPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_FiltersArgs.h b/src/ModelAPI/ModelAPI_FiltersArgs.h index 5c9f9be56..1c0ca8747 100644 --- a/src/ModelAPI/ModelAPI_FiltersArgs.h +++ b/src/ModelAPI/ModelAPI_FiltersArgs.h @@ -37,7 +37,7 @@ class ModelAPI_FiltersArgs { FiltersFeaturePtr myFeature; ///< the feature is stored to minimize initAttribute interface public: - ModelAPI_FiltersArgs() {} + ModelAPI_FiltersArgs() = default; /// Sets the current filter ID void setFilter(const std::string &theFilterID) { diff --git a/src/ModelAPI/ModelAPI_FiltersFeature.h b/src/ModelAPI/ModelAPI_FiltersFeature.h index acd4120d5..4bdd69954 100644 --- a/src/ModelAPI/ModelAPI_FiltersFeature.h +++ b/src/ModelAPI/ModelAPI_FiltersFeature.h @@ -62,6 +62,6 @@ public: virtual const AttributePtr &baseAttribute() const = 0; }; -typedef std::shared_ptr FiltersFeaturePtr; +using FiltersFeaturePtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_Folder.h b/src/ModelAPI/ModelAPI_Folder.h index a85b1c00a..c70e61efa 100644 --- a/src/ModelAPI/ModelAPI_Folder.h +++ b/src/ModelAPI/ModelAPI_Folder.h @@ -32,7 +32,7 @@ class ModelAPI_Folder : public ModelAPI_Object { public: MODELAPI_EXPORT ModelAPI_Folder(); /// To virtually destroy the fields of successors - MODELAPI_EXPORT virtual ~ModelAPI_Folder(); + MODELAPI_EXPORT ~ModelAPI_Folder() override; /// Folder feature ID static const std::string &ID() { @@ -47,7 +47,7 @@ public: } /// Returns the group identifier of this result - virtual std::string groupName() { return group(); } + std::string groupName() override { return group(); } /// Attribute referring first feature in the folder static const std::string &FIRST_FEATURE_ID() { @@ -63,13 +63,13 @@ public: /// Request for initialization of data model of the object: adding all /// attributes - MODELAPI_EXPORT virtual void initAttributes(); + MODELAPI_EXPORT void initAttributes() override; /// Computes or recomputes the results MODELAPI_EXPORT virtual void execute(); /// Returns the feature is disabled or not. - virtual bool isDisabled() { return false; } + bool isDisabled() override { return false; } // // Helper methods, aliases for data()->method() @@ -89,10 +89,10 @@ public: protected: /// This method is called just after creation of the object: it must /// initialize all fields, normally initialized in the constructor - MODELAPI_EXPORT virtual void init(); + MODELAPI_EXPORT void init() override; }; //! Pointer on a folder object -typedef std::shared_ptr FolderPtr; +using FolderPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_IReentrant.h b/src/ModelAPI/ModelAPI_IReentrant.h index 890d609e8..eb39e56aa 100644 --- a/src/ModelAPI/ModelAPI_IReentrant.h +++ b/src/ModelAPI/ModelAPI_IReentrant.h @@ -43,6 +43,6 @@ public: processEvent(const std::shared_ptr &theMessage) = 0; }; -typedef std::shared_ptr ModelReentrantPtr; +using ModelReentrantPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_Object.h b/src/ModelAPI/ModelAPI_Object.h index 2f3c45215..ebf008a23 100644 --- a/src/ModelAPI/ModelAPI_Object.h +++ b/src/ModelAPI/ModelAPI_Object.h @@ -32,7 +32,7 @@ class ModelAPI_Document; // sometimes it is useful for debug to see name of each object (bad for memory // and performance) -//#define DEBUG_NAMES +// #define DEBUG_NAMES /**\class ModelAPI_Object * \ingroup DataModel @@ -127,6 +127,6 @@ protected: friend class Model_Document; }; -typedef std::shared_ptr ObjectPtr; +using ObjectPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_Result.h b/src/ModelAPI/ModelAPI_Result.h index 07ff3e4d3..2f702e729 100644 --- a/src/ModelAPI/ModelAPI_Result.h +++ b/src/ModelAPI/ModelAPI_Result.h @@ -108,14 +108,14 @@ public: setDisabled(std::shared_ptr theThis, const bool theFlag); /// Returns the result is disabled or not. - MODELAPI_EXPORT virtual bool isDisabled(); + MODELAPI_EXPORT bool isDisabled() override; /// Request for initialization of data model of the result: adding all /// attributes - MODELAPI_EXPORT virtual void initAttributes(); + MODELAPI_EXPORT void initAttributes() override; /// To virtually destroy the fields of successors - MODELAPI_EXPORT virtual ~ModelAPI_Result(); + MODELAPI_EXPORT ~ModelAPI_Result() override; /// Returns the shape-result produced by this feature (or null if no shapes) MODELAPI_EXPORT virtual std::shared_ptr shape(); @@ -123,17 +123,17 @@ public: /// On change of attribute of the result update presentation of this result: /// for the current moment there are only presentation attributes assigned to /// results - MODELAPI_EXPORT virtual void attributeChanged(const std::string &theID); + MODELAPI_EXPORT void attributeChanged(const std::string &theID) override; protected: /// This method is called just after creation of the object: it must /// initialize all fields, normally initialized in the constructor - MODELAPI_EXPORT virtual void init(); + MODELAPI_EXPORT void init() override; friend class Model_Objects; }; //! Pointer on feature object -typedef std::shared_ptr ResultPtr; +using ResultPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index 9812df1f1..562f5ac2f 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -59,7 +59,7 @@ protected: *myBuilder; ///< provides the body processing in naming shape public: - MODELAPI_EXPORT virtual ~ModelAPI_ResultBody(); + MODELAPI_EXPORT ~ModelAPI_ResultBody() override; /// Reference to the image attribute of the result body. inline static const std::string &IMAGE_ID() { @@ -68,7 +68,7 @@ public: } /// Returns the group identifier of this result - MODELAPI_EXPORT virtual std::string groupName(); + MODELAPI_EXPORT std::string groupName() override; /// Returns the group identifier of this result inline static std::string group() { @@ -127,7 +127,7 @@ public: const std::shared_ptr theMakeShape); /// Returns the shape-result produced by this feature - MODELAPI_EXPORT virtual GeomShapePtr shape(); + MODELAPI_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 @@ -185,7 +185,7 @@ public: /// Set displayed flag to the result and all sub results /// \param theDisplay a boolean value - MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay); + MODELAPI_EXPORT void setDisplayed(const bool theDisplay) override; /// Updates the sub-bodies if shape of this object is compsolid or compound MODELAPI_EXPORT virtual void @@ -233,6 +233,6 @@ protected: }; //! Pointer on feature object -typedef std::shared_ptr ResultBodyPtr; +using ResultBodyPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_ResultConstruction.h b/src/ModelAPI/ModelAPI_ResultConstruction.h index 07a3ccb08..7346d3449 100644 --- a/src/ModelAPI/ModelAPI_ResultConstruction.h +++ b/src/ModelAPI/ModelAPI_ResultConstruction.h @@ -37,7 +37,7 @@ class ModelAPI_ResultConstruction : public ModelAPI_Result { public: /// Returns the group identifier of this result - MODELAPI_EXPORT virtual std::string groupName(); + MODELAPI_EXPORT std::string groupName() override; /// Returns the group identifier of this result inline static std::string group() { @@ -88,6 +88,6 @@ public: }; //! Pointer on feature object -typedef std::shared_ptr ResultConstructionPtr; +using ResultConstructionPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_ResultField.h b/src/ModelAPI/ModelAPI_ResultField.h index c8dde9e2e..c9cc1cfe5 100644 --- a/src/ModelAPI/ModelAPI_ResultField.h +++ b/src/ModelAPI/ModelAPI_ResultField.h @@ -47,23 +47,23 @@ public: } /// Returns the group identifier of this object - virtual std::string groupName() { return group(); } + std::string groupName() override { return group(); } /// Request for initialization of data model of the object: adding all /// attributes - virtual void initAttributes() {} + void initAttributes() override {} /// Returns the feature is disabled or not. - virtual bool isDisabled() { return false; } + bool isDisabled() override { return false; } /// 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. - virtual bool isDisplayed() { return myIsDisplayed; } + bool isDisplayed() override { return myIsDisplayed; } /// Sets the displayed/hidden state of the object. If it is changed, sends /// the "redisplay" signal. - MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay); + MODELAPI_EXPORT void setDisplayed(const bool theDisplay) override; /// Returns a GUI name of this step MODELAPI_EXPORT virtual std::wstring name() = 0; @@ -71,15 +71,15 @@ public: protected: /// This method is called just after creation of the object: it must /// initialize all fields, normally initialized in the constructor - MODELAPI_EXPORT virtual void init() {} + MODELAPI_EXPORT void init() override {} private: bool myIsDisplayed; }; - MODELAPI_EXPORT virtual ~ModelAPI_ResultField(); + MODELAPI_EXPORT ~ModelAPI_ResultField() override; /// Returns the group identifier of this result - MODELAPI_EXPORT virtual std::string groupName(); + MODELAPI_EXPORT std::string groupName() override; /// Returns the group identifier of this result inline static std::string group() { @@ -107,14 +107,14 @@ public: /// Sets the displayed/hidden state of the object. If it is changed, sends the /// "redisplay" signal. - MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay); + MODELAPI_EXPORT void setDisplayed(const bool theDisplay) override; /// To refresh the steps of a field MODELAPI_EXPORT virtual void updateSteps() = 0; }; //! Pointer on feature object -typedef std::shared_ptr ResultFieldPtr; -typedef std::shared_ptr FieldStepPtr; +using ResultFieldPtr = std::shared_ptr; +using FieldStepPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_ResultGroup.h b/src/ModelAPI/ModelAPI_ResultGroup.h index 8ebfcdcb8..b6934c722 100644 --- a/src/ModelAPI/ModelAPI_ResultGroup.h +++ b/src/ModelAPI/ModelAPI_ResultGroup.h @@ -34,9 +34,9 @@ */ class ModelAPI_ResultGroup : public ModelAPI_Result { public: - MODELAPI_EXPORT virtual ~ModelAPI_ResultGroup(); + MODELAPI_EXPORT ~ModelAPI_ResultGroup() override; /// Returns the group identifier of this result - MODELAPI_EXPORT virtual std::string groupName(); + MODELAPI_EXPORT std::string groupName() override; /// Returns the group identifier of this result inline static std::string group() { @@ -57,6 +57,6 @@ public: }; //! Pointer on feature object -typedef std::shared_ptr ResultGroupPtr; +using ResultGroupPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_ResultParameter.h b/src/ModelAPI/ModelAPI_ResultParameter.h index c122a14ae..49778e3e0 100644 --- a/src/ModelAPI/ModelAPI_ResultParameter.h +++ b/src/ModelAPI/ModelAPI_ResultParameter.h @@ -34,7 +34,7 @@ class ModelAPI_ResultParameter : public ModelAPI_Result { public: /// Returns the group identifier of this result - virtual std::string groupName() { return group(); } + std::string groupName() override { return group(); } /// Returns the group identifier of this result inline static std::string group() { @@ -54,13 +54,13 @@ public: } /// The generic initialization of attributes - virtual void initAttributes() = 0; + void initAttributes() override = 0; /// Destructor - MODELAPI_EXPORT ~ModelAPI_ResultParameter(); + MODELAPI_EXPORT ~ModelAPI_ResultParameter() override; }; //! Pointer on feature object -typedef std::shared_ptr ResultParameterPtr; +using ResultParameterPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_ResultPart.h b/src/ModelAPI/ModelAPI_ResultPart.h index 35a1efec7..bd4f35d54 100644 --- a/src/ModelAPI/ModelAPI_ResultPart.h +++ b/src/ModelAPI/ModelAPI_ResultPart.h @@ -36,7 +36,7 @@ class GeomAPI_Trsf; class ModelAPI_ResultPart : public ModelAPI_Result { public: /// Returns the group identifier of this result - MODELAPI_EXPORT virtual std::string groupName(); + MODELAPI_EXPORT std::string groupName() override; /// Returns the group identifier of this result inline static std::string group() { @@ -103,6 +103,6 @@ public: }; //! Pointer on feature object -typedef std::shared_ptr ResultPartPtr; +using ResultPartPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_Session.h b/src/ModelAPI/ModelAPI_Session.h index 2da1c16c7..c378df2e5 100644 --- a/src/ModelAPI/ModelAPI_Session.h +++ b/src/ModelAPI/ModelAPI_Session.h @@ -144,7 +144,7 @@ public: virtual ModelAPI_FiltersFactory *filters() = 0; /// To virtually destroy the fields of successors - virtual ~ModelAPI_Session() {} + virtual ~ModelAPI_Session() = default; /// Returns the global identifier of the current transaction (needed for the /// update algo) @@ -161,6 +161,6 @@ protected: static void setSession(std::shared_ptr theManager); }; -typedef std::shared_ptr SessionPtr; +using SessionPtr = std::shared_ptr; #endif diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index 8185da429..c6a9c3324 100644 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -56,9 +56,9 @@ #define RECURSE_TOP_LEVEL 50 -//#define DEBUG_REMOVE_FEATURES -//#define DEBUG_REMOVE_FEATURES_RECURSE -//#define DEBUG_CYCLING_1550 +// #define DEBUG_REMOVE_FEATURES +// #define DEBUG_REMOVE_FEATURES_RECURSE +// #define DEBUG_CYCLING_1550 #ifdef DEBUG_REMOVE_FEATURES_RECURSE #include diff --git a/src/ModelAPI/ModelAPI_Validator.h b/src/ModelAPI/ModelAPI_Validator.h index d9596e6aa..da3d65fbe 100644 --- a/src/ModelAPI/ModelAPI_Validator.h +++ b/src/ModelAPI/ModelAPI_Validator.h @@ -44,10 +44,10 @@ class Events_InfoMessage; class MODELAPI_EXPORT ModelAPI_Validator { public: // Make virtual destructor in order to make the class polymorphic - virtual ~ModelAPI_Validator() {} + virtual ~ModelAPI_Validator() = default; }; -typedef std::shared_ptr ValidatorPtr; +using ValidatorPtr = std::shared_ptr; /**\class ModelAPI_ValidatorsFactory * \ingroup DataModel @@ -63,7 +63,7 @@ typedef std::shared_ptr ValidatorPtr; */ class MODELAPI_EXPORT ModelAPI_ValidatorsFactory { public: - virtual ~ModelAPI_ValidatorsFactory() {} + virtual ~ModelAPI_ValidatorsFactory() = default; /// Registers the instance of the validator by the ID virtual void registerValidator(const std::string &theID, @@ -85,7 +85,7 @@ public: const std::list &theArguments) = 0; /// Validators is a list of pairs - typedef std::list>> Validators; + using Validators = std::list>>; /// Provides a validator for the feature, returns NULL if no validator virtual void validators(const std::string &theFeatureID, Validators &theResult) const = 0; @@ -154,7 +154,7 @@ public: protected: /// Get instance from Session - ModelAPI_ValidatorsFactory() {} + ModelAPI_ValidatorsFactory() = default; }; #endif diff --git a/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp b/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp index 068ee0c7e..6d4f96f9f 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp +++ b/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp @@ -42,7 +42,7 @@ #include #include -//#define DEBUG_POINT_INSIDE_SHAPE +// #define DEBUG_POINT_INSIDE_SHAPE #ifdef DEBUG_POINT_INSIDE_SHAPE #include #endif diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.h b/src/ModelHighAPI/ModelHighAPI_Dumper.h index 8f23e0067..c7403407e 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.h +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.h @@ -61,15 +61,15 @@ class ModelAPI_Folder; class ModelAPI_Object; class ModelAPI_Result; -typedef std::shared_ptr DocumentPtr; -typedef std::shared_ptr EntityPtr; -typedef std::shared_ptr FeaturePtr; -typedef std::shared_ptr FolderPtr; -typedef std::shared_ptr ResultPtr; +using DocumentPtr = std::shared_ptr; +using EntityPtr = std::shared_ptr; +using FeaturePtr = std::shared_ptr; +using FolderPtr = std::shared_ptr; +using ResultPtr = std::shared_ptr; -typedef std::set ModulesSet; -typedef std::map>> - NbFeaturesMap; +using ModulesSet = std::set; +using NbFeaturesMap = + std::map>>; /**\class ModelHighAPI_Dumper * \ingroup CPPHighAPI @@ -89,12 +89,12 @@ public: */ class DumpStorage { public: - DumpStorage() {} + DumpStorage() = default; MODELHIGHAPI_EXPORT DumpStorage(const DumpStorage &theOther); MODELHIGHAPI_EXPORT const DumpStorage & operator=(const DumpStorage &theOther); - virtual ~DumpStorage() {} + virtual ~DumpStorage() = default; void setFilenameSuffix(const std::string &theSuffix) { myFilenameSuffix = theSuffix; @@ -124,7 +124,7 @@ public: friend class ModelHighAPI_Dumper; }; - typedef std::shared_ptr DumpStoragePtr; + using DumpStoragePtr = std::shared_ptr; /** \class DumpStorageGeom * \ingroup CPPHighAPI @@ -133,8 +133,8 @@ public: class DumpStorageGeom : public DumpStorage { protected: MODELHIGHAPI_EXPORT - virtual void - write(const std::shared_ptr &theAttrSelect); + void write(const std::shared_ptr + &theAttrSelect) override; }; /** \class DumpStorageWeak @@ -144,8 +144,8 @@ public: class DumpStorageWeak : public DumpStorage { protected: MODELHIGHAPI_EXPORT - virtual void - write(const std::shared_ptr &theAttrSelect); + void write(const std::shared_ptr + &theAttrSelect) override; }; public: @@ -453,14 +453,14 @@ private: bool myIsDefault; ///< \c true if the name is default bool myIsDumped; ///< shows that the names of the feature are already stored - EntityName() {} + EntityName() = default; EntityName(const std::string &theCurName, const std::string &theUserName, bool theDefault) : myCurrentName(theCurName), myUserName(theUserName), myIsDefault(theDefault), myIsDumped(false) {} }; - typedef std::map EntityNameMap; + using EntityNameMap = std::map; struct LastDumpedEntity { EntityPtr myEntity; ///< last dumped entity @@ -473,7 +473,7 @@ private: const std::list &theResults = std::list()) : myEntity(theEntity), myUserName(theUserName), myResults(theResults) {} }; - typedef std::stack DumpStack; + using DumpStack = std::stack; static ModelHighAPI_Dumper *mySelf; diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.cpp b/src/ModelHighAPI/ModelHighAPI_Interface.cpp index 3e306a1a8..9854485fa 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Interface.cpp @@ -35,7 +35,7 @@ ModelHighAPI_Interface::ModelHighAPI_Interface( const std::shared_ptr &theFeature) : myFeature(theFeature) {} -ModelHighAPI_Interface::~ModelHighAPI_Interface() {} +ModelHighAPI_Interface::~ModelHighAPI_Interface() = default; //-------------------------------------------------------------------------------------- std::shared_ptr ModelHighAPI_Interface::feature() const { @@ -105,9 +105,9 @@ std::list ModelHighAPI_Interface::results() const { if (feature().get()) { std::list> aResults = feature()->results(); - for (auto it = aResults.begin(), end = aResults.end(); it != end; ++it) { - if (!(*it)->isDisabled()) - aSelectionList.push_back(ModelHighAPI_Selection(*it)); + for (auto &aResult : aResults) { + if (!aResult->isDisabled()) + aSelectionList.push_back(ModelHighAPI_Selection(aResult)); } } diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.h b/src/ModelHighAPI/ModelHighAPI_Interface.h index 5354db082..11778f731 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.h +++ b/src/ModelHighAPI/ModelHighAPI_Interface.h @@ -108,7 +108,7 @@ protected: }; //! Pointer on Interface object -typedef std::shared_ptr InterfacePtr; +using InterfacePtr = std::shared_ptr; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/ModelHighAPI/ModelHighAPI_Reference.cpp b/src/ModelHighAPI/ModelHighAPI_Reference.cpp index a9a6b1745..f004a4464 100644 --- a/src/ModelHighAPI/ModelHighAPI_Reference.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Reference.cpp @@ -26,7 +26,7 @@ #include #include //-------------------------------------------------------------------------------------- -ModelHighAPI_Reference::ModelHighAPI_Reference() {} +ModelHighAPI_Reference::ModelHighAPI_Reference() = default; ModelHighAPI_Reference::ModelHighAPI_Reference( const std::shared_ptr &theValue) @@ -47,7 +47,7 @@ ModelHighAPI_Reference::ModelHighAPI_Reference( } } -ModelHighAPI_Reference::~ModelHighAPI_Reference() {} +ModelHighAPI_Reference::~ModelHighAPI_Reference() = default; //-------------------------------------------------------------------------------------- void ModelHighAPI_Reference::fillAttribute( diff --git a/src/ModelHighAPI/ModelHighAPI_Selection.h b/src/ModelHighAPI/ModelHighAPI_Selection.h index 6404cf72d..1b86084eb 100644 --- a/src/ModelHighAPI/ModelHighAPI_Selection.h +++ b/src/ModelHighAPI/ModelHighAPI_Selection.h @@ -36,12 +36,11 @@ class ModelAPI_AttributeSelectionList; class ModelAPI_FiltersFeature; class ModelAPI_Result; //-------------------------------------------------------------------------------------- -typedef std::pair, - std::shared_ptr> - ResultSubShapePair; -typedef std::pair TypeSubShapeNamePair; -typedef std::pair> TypeInnerPointPair; -typedef std::pair> TypeWeakNamingPair; +using ResultSubShapePair = + std::pair, std::shared_ptr>; +using TypeSubShapeNamePair = std::pair; +using TypeInnerPointPair = std::pair>; +using TypeWeakNamingPair = std::pair>; //-------------------------------------------------------------------------------------- /**\class ModelHighAPI_Selection * \ingroup CPPHighAPI diff --git a/src/ModuleBase/ModuleBase_ActionInfo.h b/src/ModuleBase/ModuleBase_ActionInfo.h index 96eea3f06..a1b7a43f4 100644 --- a/src/ModuleBase/ModuleBase_ActionInfo.h +++ b/src/ModuleBase/ModuleBase_ActionInfo.h @@ -75,6 +75,6 @@ protected: void initDefault(); }; -typedef ModuleBase_ActionInfo ActionInfo; +using ActionInfo = ModuleBase_ActionInfo; #endif /* XGUI_ACTIONINFO_H_ */ diff --git a/src/ModuleBase/ModuleBase_ActionParameter.h b/src/ModuleBase/ModuleBase_ActionParameter.h index 842350c7a..34ce4cd54 100644 --- a/src/ModuleBase/ModuleBase_ActionParameter.h +++ b/src/ModuleBase/ModuleBase_ActionParameter.h @@ -26,9 +26,9 @@ class ModuleBase_ActionParameter { public: /// Destuctor is added in order to virtualize the class - virtual ~ModuleBase_ActionParameter() {} + virtual ~ModuleBase_ActionParameter() = default; }; -typedef std::shared_ptr ActionParamPtr; +using ActionParamPtr = std::shared_ptr; #endif diff --git a/src/ModuleBase/ModuleBase_Definitions.h b/src/ModuleBase/ModuleBase_Definitions.h index 797f4fc4c..3ee64ca9a 100644 --- a/src/ModuleBase/ModuleBase_Definitions.h +++ b/src/ModuleBase/ModuleBase_Definitions.h @@ -24,8 +24,8 @@ #include #include -typedef QList QIntList; //!< list of int values -typedef QList QShortList; //!< list of short int values -typedef QList QDoubleList; //!< list of double values -typedef QList QObjectPtrList; //!< List of ModelAPI_Objects +using QIntList = QList; //!< list of int values +using QShortList = QList; //!< list of short int values +using QDoubleList = QList; //!< list of double values +using QObjectPtrList = QList; //!< List of ModelAPI_Objects #endif diff --git a/src/ModuleBase/ModuleBase_DoubleSpinBox.h b/src/ModuleBase/ModuleBase_DoubleSpinBox.h index bced28810..93853f4ea 100644 --- a/src/ModuleBase/ModuleBase_DoubleSpinBox.h +++ b/src/ModuleBase/ModuleBase_DoubleSpinBox.h @@ -38,9 +38,9 @@ class MODULEBASE_EXPORT ModuleBase_DoubleSpinBox : public QDoubleSpinBox { Q_OBJECT public: - explicit ModuleBase_DoubleSpinBox(QWidget *theParent = 0, + explicit ModuleBase_DoubleSpinBox(QWidget *theParent = nullptr, int thePrecision = -12); - virtual ~ModuleBase_DoubleSpinBox(); + ~ModuleBase_DoubleSpinBox() override; /// Returns true if the control is clear bool isCleared() const; @@ -55,16 +55,16 @@ public: void setPrecision(const int); /// Set step - virtual void stepBy(int); + void stepBy(int) override; /// Converts value from string to double - virtual double valueFromText(const QString &) const; + double valueFromText(const QString &) const override; /// Convert value from double to string - virtual QString textFromValue(double) const; + QString textFromValue(double) const override; /// Validate current value - virtual QValidator::State validate(QString &, int &) const; + QValidator::State validate(QString &, int &) const override; /// Imitation of disable control value. If theEnable is false, the control /// becomes read only and base color is disabled. diff --git a/src/ModuleBase/ModuleBase_Filter.h b/src/ModuleBase/ModuleBase_Filter.h index 8da085e5c..635798993 100644 --- a/src/ModuleBase/ModuleBase_Filter.h +++ b/src/ModuleBase/ModuleBase_Filter.h @@ -39,7 +39,7 @@ class ModuleBase_Filter { public: /// Constructor - MODULEBASE_EXPORT ModuleBase_Filter() {} + MODULEBASE_EXPORT ModuleBase_Filter() = default; /** * Returns an OCC selection filter. It can be appended into the context of a diff --git a/src/ModuleBase/ModuleBase_FilterValidated.h b/src/ModuleBase/ModuleBase_FilterValidated.h index 66e06b296..5d1059e36 100644 --- a/src/ModuleBase/ModuleBase_FilterValidated.h +++ b/src/ModuleBase/ModuleBase_FilterValidated.h @@ -26,7 +26,7 @@ class ModuleBase_IWorkshop; -//#define DEBUG_FILTERS +// #define DEBUG_FILTERS /** * \ingroup GUI @@ -51,8 +51,8 @@ public: * \param theOwner the result of selection * \return whether the owner is selectable in the viewer */ - 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_FilterValidated, SelectMgr_Filter) protected: diff --git a/src/ModuleBase/ModuleBase_IModule.h b/src/ModuleBase/ModuleBase_IModule.h index 34512cbb3..8f28be384 100644 --- a/src/ModuleBase/ModuleBase_IModule.h +++ b/src/ModuleBase/ModuleBase_IModule.h @@ -82,7 +82,7 @@ public: /// \param theParent instance of workshop interface ModuleBase_IModule(ModuleBase_IWorkshop *theParent); - virtual ~ModuleBase_IModule(); + ~ModuleBase_IModule() override; /// Stores the current selection virtual void storeSelection() {} @@ -143,9 +143,9 @@ public: /// \param theMenuActions map of action/menu for the desirable index in the /// viewer menu \return true if items are added and there is no necessity to /// provide standard menu - virtual bool addViewerMenu(const QMap &theStdActions, - QWidget *theParent, - QMap &theMenuActions) const { + virtual bool addViewerMenu(const QMap & /*theStdActions*/, + QWidget * /*theParent*/, + QMap & /*theMenuActions*/) const { return false; } @@ -159,9 +159,9 @@ public: /// \param theWidgetApi the widget configuration. /// The attribute of the model widget is obtained from virtual ModuleBase_ModelWidget * - createWidgetByType(const std::string &theType, QWidget *theParent, - Config_WidgetAPI *theWidgetApi) { - return 0; + createWidgetByType(const std::string & /*theType*/, QWidget * /*theParent*/, + Config_WidgetAPI * /*theWidgetApi*/) { + return nullptr; } /// Returns the active widget, by default it is the property panel active @@ -183,8 +183,9 @@ public: /// \param theWidgets a list of created widgets /// \return boolean result, false by default virtual bool - createWidgets(const FeaturePtr &theFeature, const QString &theXmlRepr, - QList &theWidgets) const { + createWidgets(const FeaturePtr & /*theFeature*/, + const QString & /*theXmlRepr*/, + QList & /*theWidgets*/) const { return false; } @@ -279,7 +280,7 @@ public: /// \param theFlag a flag of level of customization, which means that only /// part of sub-elements \return boolean value virtual bool - isCustomPrsActivated(const ModuleBase_CustomizeFlag &theFlag) const { + isCustomPrsActivated(const ModuleBase_CustomizeFlag & /*theFlag*/) const { return false; }; @@ -322,9 +323,9 @@ public: /// be updated(e.g. only highlighted elements) \param theUpdateViewer the /// parameter whether the viewer should be update immediately \returns true if /// the object is modified - virtual bool customizeFeature(ObjectPtr theObject, - const ModuleBase_CustomizeFlag &theFlag, - const bool theUpdateViewer) { + virtual bool customizeFeature(ObjectPtr /*theObject*/, + const ModuleBase_CustomizeFlag & /*theFlag*/, + const bool /*theUpdateViewer*/) { return false; } @@ -377,7 +378,7 @@ public: /// Returns true if the action should be always enabled /// \param theActionId an action index: Accept or Accept All /// \return boolean value - virtual bool isActionEnableStateFixed(const int theActionId) const { + virtual bool isActionEnableStateFixed(const int /*theActionId*/) const { return false; } @@ -402,7 +403,7 @@ public: /// Returns true if the event is processed. /// \param thePreviousAttributeID an index of the previous active attribute - virtual bool processEnter(const std::string &thePreviousAttributeID) { + virtual bool processEnter(const std::string & /*thePreviousAttributeID*/) { return false; }; @@ -505,7 +506,7 @@ protected: //! This function must return a new module instance. extern "C" { -typedef ModuleBase_IModule *(*CREATE_FUNC)(ModuleBase_IWorkshop *); +using CREATE_FUNC = ModuleBase_IModule *(*)(ModuleBase_IWorkshop *); } #define CREATE_MODULE "createModule" diff --git a/src/ModuleBase/ModuleBase_ISelection.h b/src/ModuleBase/ModuleBase_ISelection.h index 7141c230c..4dd716846 100644 --- a/src/ModuleBase/ModuleBase_ISelection.h +++ b/src/ModuleBase/ModuleBase_ISelection.h @@ -47,7 +47,7 @@ public: /// Types of the selection place, where the selection is obtained enum SelectionPlace { Browser, Viewer, AllControls }; - virtual ~ModuleBase_ISelection() {} + virtual ~ModuleBase_ISelection() = default; /// Returns a list of viewer selected presentations /// \return list of presentations diff --git a/src/ModuleBase/ModuleBase_ISelectionActivate.h b/src/ModuleBase/ModuleBase_ISelectionActivate.h index dc165e23c..e281d9c94 100644 --- a/src/ModuleBase/ModuleBase_ISelectionActivate.h +++ b/src/ModuleBase/ModuleBase_ISelectionActivate.h @@ -39,7 +39,7 @@ public: : myWorkshop(theWorkshop) {} /// Destructor - virtual ~ModuleBase_ISelectionActivate() {} + virtual ~ModuleBase_ISelectionActivate() = default; /// Updates active selection modes in the viewer depending on the application /// state diff --git a/src/ModuleBase/ModuleBase_IViewWindow.cpp b/src/ModuleBase/ModuleBase_IViewWindow.cpp index f96270214..84fb93d66 100644 --- a/src/ModuleBase/ModuleBase_IViewWindow.cpp +++ b/src/ModuleBase/ModuleBase_IViewWindow.cpp @@ -20,6 +20,6 @@ #include "ModuleBase_IViewWindow.h" -ModuleBase_IViewWindow::ModuleBase_IViewWindow() {} +ModuleBase_IViewWindow::ModuleBase_IViewWindow() = default; -ModuleBase_IViewWindow::~ModuleBase_IViewWindow() {} +ModuleBase_IViewWindow::~ModuleBase_IViewWindow() = default; diff --git a/src/ModuleBase/ModuleBase_IViewer.h b/src/ModuleBase/ModuleBase_IViewer.h index 906b649c5..dd2c2e3a0 100644 --- a/src/ModuleBase/ModuleBase_IViewer.h +++ b/src/ModuleBase/ModuleBase_IViewer.h @@ -117,7 +117,7 @@ public: /// Returns a scale factor of the given view /// \param theView a view object - const double Scale(const Handle(V3d_View) & theView) { + double Scale(const Handle(V3d_View) & theView) { if (!myWindowScale.contains(theView)) myWindowScale.insert(theView, theView->Camera()->Scale()); return myWindowScale[theView]; @@ -188,7 +188,7 @@ public: //! Type for mapping from text to color to display the names lines in //! different colors - typedef std::list>> TextColor; + using TextColor = std::list>>; //! Sets the text displayed in right-top corner of the 3D view //! \param theText the text to display, or empty string to erase presentation; diff --git a/src/ModuleBase/ModuleBase_IWorkshop.h b/src/ModuleBase/ModuleBase_IWorkshop.h index 50b64568b..d8c72d365 100644 --- a/src/ModuleBase/ModuleBase_IWorkshop.h +++ b/src/ModuleBase/ModuleBase_IWorkshop.h @@ -52,7 +52,7 @@ public: /// \param theParent parent object ModuleBase_IWorkshop(QObject *theParent); - virtual ~ModuleBase_IWorkshop() {} + ~ModuleBase_IWorkshop() override = default; /// Return current selection instance virtual ModuleBase_ISelection *selection() const = 0; diff --git a/src/ModuleBase/ModuleBase_IconFactory.h b/src/ModuleBase/ModuleBase_IconFactory.h index 607cebfd2..c1d16e6a9 100644 --- a/src/ModuleBase/ModuleBase_IconFactory.h +++ b/src/ModuleBase/ModuleBase_IconFactory.h @@ -34,7 +34,7 @@ */ class MODULEBASE_EXPORT ModuleBase_IconFactory { public: - virtual ~ModuleBase_IconFactory() {} + virtual ~ModuleBase_IconFactory() = default; /// Returns icons factory instance static ModuleBase_IconFactory *get(); diff --git a/src/ModuleBase/ModuleBase_IntSpinBox.h b/src/ModuleBase/ModuleBase_IntSpinBox.h index baa84f511..639fad38d 100644 --- a/src/ModuleBase/ModuleBase_IntSpinBox.h +++ b/src/ModuleBase/ModuleBase_IntSpinBox.h @@ -39,12 +39,13 @@ class MODULEBASE_EXPORT ModuleBase_IntSpinBox : public QSpinBox { public: /// Constructor /// \param theParent a parent widget - explicit ModuleBase_IntSpinBox(QWidget *theParent = 0); - virtual ~ModuleBase_IntSpinBox(){}; + explicit ModuleBase_IntSpinBox(QWidget *theParent = nullptr); + ~ModuleBase_IntSpinBox() override = default; + ; protected: /// Called on key press event - virtual void keyPressEvent(QKeyEvent *theEvent); + void keyPressEvent(QKeyEvent *theEvent) override; }; #endif diff --git a/src/ModuleBase/ModuleBase_LabelValue.h b/src/ModuleBase/ModuleBase_LabelValue.h index 092f73ab2..89360a894 100644 --- a/src/ModuleBase/ModuleBase_LabelValue.h +++ b/src/ModuleBase/ModuleBase_LabelValue.h @@ -43,7 +43,7 @@ public: const QString &theToolTip = "", const QString &theIcon = "", int thePrecision = -12); - virtual ~ModuleBase_LabelValue(); + ~ModuleBase_LabelValue() override; /// Fills the label value with the given value /// \param theValue a value diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index 9a570546a..e6a26625a 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -44,10 +44,10 @@ #include #include -//#define DEBUG_VALUE_STATE +// #define DEBUG_VALUE_STATE -//#define DEBUG_WIDGET_INSTANCE -//#define DEBUG_ENABLE_SKETCH_INPUT_FIELDS +// #define DEBUG_WIDGET_INSTANCE +// #define DEBUG_ENABLE_SKETCH_INPUT_FIELDS //************************************************************** ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget *theParent, diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index 7473f2132..a71141f29 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -83,7 +83,7 @@ public: /// is obtained from a low-level API for reading xml definitions of widgets ModuleBase_ModelWidget(QWidget *theParent, const Config_WidgetAPI *theData); /// Destructor - virtual ~ModuleBase_ModelWidget(); + ~ModuleBase_ModelWidget() override; /// Fills the widget with default values. It calls the resetCustom method and /// change the widget state to Reset if the reset is performed. \return true @@ -168,8 +168,8 @@ public: /// \param theToValidate the boolean value whether the value should be checked /// by filters virtual bool - setSelection(QList> &theValues, - const bool theToValidate) { + setSelection(QList> & /*theValues*/, + const bool /*theToValidate*/) { return false; } @@ -182,7 +182,7 @@ public: /// \param theValue a selected presentation in the view /// \return a boolean value virtual bool isValidSelectionCustom( - const std::shared_ptr &theValue) { + const std::shared_ptr & /*theValue*/) { return true; } @@ -235,7 +235,7 @@ public: QWidget *getControlAcceptingFocus(const bool isFirst); /// FocusIn events processing - virtual bool eventFilter(QObject *theObject, QEvent *theEvent); + bool eventFilter(QObject *theObject, QEvent *theEvent) override; /// \brief Enables processing of focus event on all controls by the widget /// if this widget is not obligatory and set no-focus policy otherwise @@ -301,7 +301,7 @@ public: /// returns empty list. \param theActionType type of action. It can be /// ActionUndo or ActionRedo. virtual QList - actionsList(ModuleBase_ActionType theActionType) const { + actionsList(ModuleBase_ActionType /*theActionType*/) const { return QList(); } diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index bc088e881..fd4bf82e5 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -57,10 +57,10 @@ public: /// Constructor /// \param theId the operation identifier /// \param theParent the QObject parent - ModuleBase_Operation(const QString &theId = "", QObject *theParent = 0); + ModuleBase_Operation(const QString &theId = "", QObject *theParent = nullptr); /// Destructor - virtual ~ModuleBase_Operation(); + ~ModuleBase_Operation() override; /// Returns the operation description /// /returns the instance of the description class diff --git a/src/ModuleBase/ModuleBase_OperationFeature.cpp b/src/ModuleBase/ModuleBase_OperationFeature.cpp index 3abd14c52..74d7f092d 100644 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@ -53,7 +53,7 @@ #include #endif -//#define DEBUG_OPERATION_START +// #define DEBUG_OPERATION_START #ifdef _DEBUG #include diff --git a/src/ModuleBase/ModuleBase_OperationFeature.h b/src/ModuleBase/ModuleBase_OperationFeature.h index 8a10b3270..8bae28d8b 100644 --- a/src/ModuleBase/ModuleBase_OperationFeature.h +++ b/src/ModuleBase/ModuleBase_OperationFeature.h @@ -70,9 +70,9 @@ public: /// \param theId the operation identifier /// \param theParent the QObject parent ModuleBase_OperationFeature(const QString &theId = "", - QObject *theParent = 0); + QObject *theParent = nullptr); /// Destructor - virtual ~ModuleBase_OperationFeature(); + ~ModuleBase_OperationFeature() override; /// Returns True id the current operation is launched in editing mode bool isEditOperation() const { return myIsEditing; } @@ -94,7 +94,7 @@ public: /// Must return True if the operation's feature is valid. /// Since IOperation does not have any feature returns false. - virtual bool isValid() const; + bool isValid() const override; /// Sets the operation feature void setFeature(FeaturePtr theFeature); @@ -120,7 +120,7 @@ public: /// \brief Set property pane to the operation /// \param theProp a property panel instance - virtual void setPropertyPanel(ModuleBase_IPropertyPanel *theProp); + void setPropertyPanel(ModuleBase_IPropertyPanel *theProp) override; // \return Currently installed property panel // ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; @@ -169,31 +169,31 @@ public slots: /// in using this method. It would be better to inherit own operator from base /// one and redefine startOperation method instead. \return true if the start /// is successful - virtual bool start(); + bool start() override; /// Aborts operation /// Public slot. Aborts operation. This slot is not virtual and cannot be /// redefined. Redefine abortOperation method to change behavior of operation /// instead - void abort(); + void abort() override; /// Commits operation /// Public slot. Commits operation. This slot is not virtual and cannot be /// redefined. Redefine commitOperation method to change behavior of operation /// instead - bool commit(); + bool commit() override; protected: /// Displays the feature/results if it is hidden. It will be hided in /// stopOperation - virtual void startOperation(); + void startOperation() override; /// Hide feature/results if they were hided on start - virtual void stopOperation(); + void stopOperation() override; /// Virtual method called after operation resume (see resume() method for more /// description) - virtual void resumeOperation(); + void resumeOperation() override; /// Creates an operation new feature /// \param theFlushMessage the flag whether the create message should be diff --git a/src/ModuleBase/ModuleBase_ParamIntSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamIntSpinBox.cpp index 1e48a41aa..149e80079 100644 --- a/src/ModuleBase/ModuleBase_ParamIntSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamIntSpinBox.cpp @@ -38,14 +38,14 @@ #include ModuleBase_ParamIntSpinBox::ModuleBase_ParamIntSpinBox(QWidget *theParent) - : ModuleBase_IntSpinBox(theParent), myAcceptVariables(true) { + : ModuleBase_IntSpinBox(theParent) { connectSignalsAndSlots(); } /*! \brief Destructor. */ -ModuleBase_ParamIntSpinBox::~ModuleBase_ParamIntSpinBox() {} +ModuleBase_ParamIntSpinBox::~ModuleBase_ParamIntSpinBox() = default; /*! \brief Perform \a steps increment/decrement steps. diff --git a/src/ModuleBase/ModuleBase_ParamIntSpinBox.h b/src/ModuleBase/ModuleBase_ParamIntSpinBox.h index a7c31b766..f3b505627 100644 --- a/src/ModuleBase/ModuleBase_ParamIntSpinBox.h +++ b/src/ModuleBase/ModuleBase_ParamIntSpinBox.h @@ -48,19 +48,19 @@ public: \param theParent a parent object */ - explicit ModuleBase_ParamIntSpinBox(QWidget *theParent = 0); - virtual ~ModuleBase_ParamIntSpinBox(); + explicit ModuleBase_ParamIntSpinBox(QWidget *theParent = nullptr); + ~ModuleBase_ParamIntSpinBox() override; - virtual void stepBy(int); + void stepBy(int) override; /// Convert Int value from text string - virtual int valueFromText(const QString &) const; + int valueFromText(const QString &) const override; /// Convert text string from int value - virtual QString textFromValue(int) const; + QString textFromValue(int) const override; /// Validate the value - virtual QValidator::State validate(QString &, int &) const; + QValidator::State validate(QString &, int &) const override; /// Set current int value virtual void setValue(int); @@ -94,7 +94,7 @@ protected: bool findVariable(const QString &theName, double &outValue) const; protected: - virtual void showEvent(QShowEvent *); + void showEvent(QShowEvent *) override; protected slots: /// A slot called on text change @@ -106,7 +106,7 @@ private: private: QString myTextValue; - bool myAcceptVariables; + bool myAcceptVariables{true}; }; #endif diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.h b/src/ModuleBase/ModuleBase_ParamSpinBox.h index d679f2913..16026341f 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.h +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.h @@ -51,19 +51,19 @@ public: \param theParent a parent object \param thePrecision a precision of values display */ - ModuleBase_ParamSpinBox(QWidget *theParent = 0, int thePrecision = 12); + ModuleBase_ParamSpinBox(QWidget *theParent = nullptr, int thePrecision = 12); /// Set list of completion strings void setCompletionList(QStringList &); - virtual ~ModuleBase_ParamSpinBox(); + ~ModuleBase_ParamSpinBox() override; - virtual void stepBy(int); + void stepBy(int) override; // virtual double valueFromText(const QString&) const; // virtual QString textFromValue (double value) const; - virtual QValidator::State validate(QString &, int &) const; + QValidator::State validate(QString &, int &) const override; virtual void setValue(double); @@ -106,15 +106,15 @@ protected: /*! \brief This function is called when the spinbox receives key release event. */ - virtual void keyReleaseEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *event) override; - virtual bool eventFilter(QObject *theObj, QEvent *theEvent); + bool eventFilter(QObject *theObj, QEvent *theEvent) override; /// The virtual function is reimplemented in order to avoid extra increasing /// of value by StepBy method - virtual void timerEvent(QTimerEvent * /*event*/) {} + void timerEvent(QTimerEvent * /*event*/) override {} - virtual StepEnabled stepEnabled() const { + StepEnabled stepEnabled() const override { return StepUpEnabled | StepDownEnabled; } diff --git a/src/ModuleBase/ModuleBase_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp index c3ed71442..c61d85984 100644 --- a/src/ModuleBase/ModuleBase_Preferences.cpp +++ b/src/ModuleBase/ModuleBase_Preferences.cpp @@ -19,7 +19,7 @@ // #include "ModuleBase_Preferences.h" -//#include "ModuleBase_Constants.h" +// #include "ModuleBase_Constants.h" #include diff --git a/src/ModuleBase/ModuleBase_ResultPrs.h b/src/ModuleBase/ModuleBase_ResultPrs.h index 56dcbaa4c..bb969b77b 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.h +++ b/src/ModuleBase/ModuleBase_ResultPrs.h @@ -61,16 +61,16 @@ public: Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult); //! 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 //! this selectable object ( for fast presentation draw ) - 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 result object Standard_EXPORT ResultPtr getResult() const { return myResult; } @@ -87,7 +87,7 @@ public: Standard_EXPORT void setAdditionalSelectionPriority(const int thePriority); //! Updates color of sub shape drawer - Standard_EXPORT virtual void SetColor(const Quantity_Color &theColor); + Standard_EXPORT void SetColor(const Quantity_Color &theColor) override; /// Change presentation to have given shape hidden. /// It suports FACE type of the shape to be hidden. @@ -132,15 +132,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 + Standard_EXPORT void ComputeSelection(const Handle(SelectMgr_Selection) & aSelection, - const Standard_Integer theMode); + const Standard_Integer theMode) override; private: /// If the shape of this presentation is Vertex, it appends custom sensitive diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 347fdf705..df139c3de 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -107,8 +107,8 @@ const double tolerance = 1e-7; const double DEFAULT_DEVIATION_COEFFICIENT = 1.e-4; -//#define DEBUG_ACTIVATE_WINDOW -//#define DEBUG_SET_FOCUS +// #define DEBUG_ACTIVATE_WINDOW +// #define DEBUG_SET_FOCUS #ifdef WIN32 #define FSEP "\\" diff --git a/src/ModuleBase/ModuleBase_Tools.h b/src/ModuleBase/ModuleBase_Tools.h index 76bd401aa..cd8a70b36 100644 --- a/src/ModuleBase/ModuleBase_Tools.h +++ b/src/ModuleBase/ModuleBase_Tools.h @@ -162,7 +162,7 @@ MODULEBASE_EXPORT void setSpinText(ModuleBase_ParamIntSpinBox *theSpin, /// used MODULEBASE_EXPORT QAction * createAction(const QIcon &theIcon, const QString &theText, QObject *theParent, - const QObject *theReceiver = 0, const char *theMember = "", + const QObject *theReceiver = nullptr, const char *theMember = "", const QString &theToolTip = QString(), const QString &theStatusTip = QString()); diff --git a/src/ModuleBase/ModuleBase_ViewerPrs.h b/src/ModuleBase/ModuleBase_ViewerPrs.h index e67ee3265..6d0b391a1 100644 --- a/src/ModuleBase/ModuleBase_ViewerPrs.h +++ b/src/ModuleBase/ModuleBase_ViewerPrs.h @@ -44,7 +44,7 @@ public: MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult = ObjectPtr(), const GeomShapePtr &theShape = GeomShapePtr(), - Handle(SelectMgr_EntityOwner) theOwner = NULL); + Handle(SelectMgr_EntityOwner) theOwner = nullptr); /// Destructor MODULEBASE_EXPORT virtual ~ModuleBase_ViewerPrs(); @@ -115,6 +115,6 @@ private: Handle(AIS_InteractiveObject) myInteractive; /// interactive object }; -typedef std::shared_ptr ModuleBase_ViewerPrsPtr; +using ModuleBase_ViewerPrsPtr = std::shared_ptr; #endif diff --git a/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp b/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp index 2d5d6192c..f1cbbaa26 100644 --- a/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp +++ b/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp @@ -53,7 +53,7 @@ ModuleBase_WidgetConcealedObjects::ModuleBase_WidgetConcealedObjects( myPickConcealedParents = aPickParents == "1" || aPickParents == "true" || aPickParents == "yes"; - QGridLayout *aMainLay = new QGridLayout(this); + auto *aMainLay = new QGridLayout(this); ModuleBase_Tools::adjustMargins(aMainLay); myView = new QTableWidget(this); @@ -64,7 +64,8 @@ ModuleBase_WidgetConcealedObjects::ModuleBase_WidgetConcealedObjects( myView->verticalHeader()->setVisible(false); } -ModuleBase_WidgetConcealedObjects::~ModuleBase_WidgetConcealedObjects() {} +ModuleBase_WidgetConcealedObjects::~ModuleBase_WidgetConcealedObjects() = + default; bool ModuleBase_WidgetConcealedObjects::storeValueCustom() { if (!myFeature) @@ -87,7 +88,7 @@ bool ModuleBase_WidgetConcealedObjects::restoreValueCustom() { if (myFeature) { anObject = ModuleBase_Tools::getObject(myFeature->attribute(myBaseShapeAttribute)); - if (anObject.get() != NULL) + if (anObject.get() != nullptr) aBaseFeature = ModelAPI_Feature::feature(anObject); } if (myBaseFeature != aBaseFeature) { @@ -148,10 +149,10 @@ void ModuleBase_WidgetConcealedObjects::addViewRow( int anId = myView->rowCount(); myView->setRowCount(anId + 1); - QWidget *aVisibilityWdg = new QWidget(this); - QVBoxLayout *aVisibilityLay = new QVBoxLayout(aVisibilityWdg); + auto *aVisibilityWdg = new QWidget(this); + auto *aVisibilityLay = new QVBoxLayout(aVisibilityWdg); aVisibilityLay->setContentsMargins(2, 2, 2, 2); - QCheckBox *aVisibilityBtn = new QCheckBox(aVisibilityWdg); + auto *aVisibilityBtn = new QCheckBox(aVisibilityWdg); aVisibilityLay->addWidget(aVisibilityBtn, 0, Qt::AlignHCenter); connect(aVisibilityBtn, SIGNAL(toggled(bool)), this, SLOT(onItemToggled(bool))); diff --git a/src/ModuleBase/ModuleBase_WidgetConcealedObjects.h b/src/ModuleBase/ModuleBase_WidgetConcealedObjects.h index 3b8547119..97b883eed 100644 --- a/src/ModuleBase/ModuleBase_WidgetConcealedObjects.h +++ b/src/ModuleBase/ModuleBase_WidgetConcealedObjects.h @@ -46,21 +46,21 @@ public: /// \param theData the widget configuration. ModuleBase_WidgetConcealedObjects(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetConcealedObjects(); + ~ModuleBase_WidgetConcealedObjects() override; /// Redefinition of virtual method - virtual QList getControls() const; + QList getControls() const override; /// The widget can not accept focus - virtual bool canAcceptFocus() const { return false; }; + bool canAcceptFocus() const 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; private: /// Creates a row in view diff --git a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp index 6d4781058..c12fc080f 100644 --- a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp @@ -67,7 +67,7 @@ ModuleBase_WidgetFeatureSelector::ModuleBase_WidgetFeatureSelector( QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData) : ModuleBase_WidgetValidated(theParent, theWorkshop, theData) { - QFormLayout *aLayout = new QFormLayout(this); + auto *aLayout = new QFormLayout(this); ModuleBase_Tools::adjustMargins(aLayout); QString aLabelText = translate(theData->widgetLabel()); @@ -89,7 +89,7 @@ ModuleBase_WidgetFeatureSelector::ModuleBase_WidgetFeatureSelector( } //******************************************************************** -ModuleBase_WidgetFeatureSelector::~ModuleBase_WidgetFeatureSelector() {} +ModuleBase_WidgetFeatureSelector::~ModuleBase_WidgetFeatureSelector() = default; //******************************************************************** bool ModuleBase_WidgetFeatureSelector::setSelectionCustom( @@ -134,7 +134,7 @@ bool ModuleBase_WidgetFeatureSelector::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 @@ -175,7 +175,7 @@ void ModuleBase_WidgetFeatureSelector::updateSelectionName() { 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 { diff --git a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.h b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.h index fef68ad53..6ce0d60be 100644 --- a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.h @@ -55,7 +55,7 @@ public: ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetFeatureSelector(); + ~ModuleBase_WidgetFeatureSelector() override; /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs @@ -63,33 +63,33 @@ 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; /// 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; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - virtual bool - setSelectionCustom(const std::shared_ptr &thePrs); + bool setSelectionCustom( + const std::shared_ptr &thePrs) override; protected: /// The method 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; - virtual bool restoreValueCustom(); + bool restoreValueCustom() override; /// Computes and updates name of selected object in the widget virtual void updateSelectionName(); @@ -100,8 +100,8 @@ protected: /// Checks whether all active viewer filters validate the presentation /// \param thePrs a selected presentation in the view /// \return a boolean value - virtual bool - isValidInFilters(const std::shared_ptr &thePrs); + bool isValidInFilters( + const std::shared_ptr &thePrs) override; /// Emits model changed info, updates the current control by selection change /// \param theDone a state whether the selection is set @@ -109,7 +109,7 @@ protected: protected: /// Returns true if envent is processed. - virtual bool processSelection(); + bool processSelection() override; //----------- Class members ------------- protected: diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index fc4d3a9b7..6b700dfc8 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -69,7 +69,7 @@ #include #include -//#define DEBUG_UNDO_REDO +// #define DEBUG_UNDO_REDO #ifdef DEBUG_UNDO_REDO void printHistoryInfo(const QString &theMethodName, int theCurrentHistoryIndex, diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.h b/src/ModuleBase/ModuleBase_WidgetSelector.h index a94b8c64b..b277b6649 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetSelector.h @@ -54,15 +54,16 @@ public: ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetSelector(); + ~ModuleBase_WidgetSelector() override; /// 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; /// Defines if it is supposed that the widget should interact with the viewer. - virtual bool isViewerSelector() { return true; } + bool isViewerSelector() override { return true; } /// Activate or deactivate selection and selection filters virtual void updateSelectionModesAndFilters(bool toActivate); @@ -70,16 +71,16 @@ public: /// 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; /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner - virtual bool - setSelectionCustom(const std::shared_ptr &thePrs); + bool setSelectionCustom( + const std::shared_ptr &thePrs) override; /// The methiod called when widget is deactivated - virtual void deactivate(); + void deactivate() override; /// Return the attribute values wrapped in a list of viewer presentations /// \return a list of viewer presentations, which contains an attribute result @@ -92,7 +93,7 @@ public: protected: /// Returns true if envent is processed. The default implementation is empty, /// returns false. - virtual bool processSelection(); + bool processSelection() override; /// Emits model changed info, updates the current control by selection change /// \param theDone a state whether the selection is set @@ -115,7 +116,7 @@ protected: virtual void updateSelectionName(){}; /// The methiod called when widget is activated - virtual void activateCustom(); + void activateCustom() override; /// Returns true if selected shape corresponds to requested shape types. /// If the widget type of shapes contains the faces item, the result is diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index f0a0ecff7..8426253a7 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -44,7 +44,7 @@ #include -//#define DEBUG_VALID_STATE +// #define DEBUG_VALID_STATE ModuleBase_WidgetValidated::ModuleBase_WidgetValidated( QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.h b/src/ModuleBase/ModuleBase_WidgetValidated.h index 901790782..103ef4791 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.h +++ b/src/ModuleBase/ModuleBase_WidgetValidated.h @@ -45,7 +45,7 @@ class ModuleBase_WidgetSelectorStore; class ModelAPI_Validator; class Config_WidgetAPI; -//#define LIST_OF_VALID_PRS +// #define LIST_OF_VALID_PRS /** * \ingroup GUI @@ -63,7 +63,7 @@ public: ModuleBase_WidgetValidated(QWidget *theParent, ModuleBase_IWorkshop *theWorkshop, const Config_WidgetAPI *theData); - virtual ~ModuleBase_WidgetValidated(); + ~ModuleBase_WidgetValidated() override; /// Checks all widget validator if the owner is valid. Firstly it checks /// custom widget validating, next, the attribute's validating. It trying on @@ -79,7 +79,7 @@ public: ObjectPtr findPresentedObject(const AISObjectPtr &theAIS) const; /// The method called when widget is deactivated - virtual void deactivate(); + void deactivate() override; //! Clear all validated cash in the widget void clearValidatedCash(); @@ -91,8 +91,8 @@ public: /// Appends into container of workshop selection filters /// \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; /// Block the model flush of update and intialization of attribute /// \param theAttribute an attribute of blocking @@ -153,8 +153,8 @@ 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; /// Fills the attribute with the value of the selected owner /// \param thePrs a selected owner diff --git a/src/PartSet/PartSet_BSplineWidget.cpp b/src/PartSet/PartSet_BSplineWidget.cpp index 0d5e2aced..7e09ba97d 100644 --- a/src/PartSet/PartSet_BSplineWidget.cpp +++ b/src/PartSet/PartSet_BSplineWidget.cpp @@ -42,14 +42,14 @@ static const double THE_MIN_WEIGHT = 1.e-7; PartSet_BSplineWidget::PartSet_BSplineWidget(QWidget *theParent, const Config_WidgetAPI *theData) : ModuleBase_ModelWidget(theParent, theData) { - QVBoxLayout *aMainLayout = new QVBoxLayout(this); + auto *aMainLayout = new QVBoxLayout(this); aMainLayout->setContentsMargins(0, 0, 0, 0); // GroupBox to keep widgets for B-spline poles and weights myPolesGroupBox = new QGroupBox(translate("Poles and weights"), this); aMainLayout->addWidget(myPolesGroupBox); - QVBoxLayout *aLayout = new QVBoxLayout(myPolesGroupBox); + auto *aLayout = new QVBoxLayout(myPolesGroupBox); ModuleBase_Tools::adjustMargins(aLayout); myScrollArea = new QScrollArea(myPolesGroupBox); @@ -58,13 +58,13 @@ PartSet_BSplineWidget::PartSet_BSplineWidget(QWidget *theParent, 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); // layout of GroupBox myPolesWgt = new QWidget(aContainer); - QGridLayout *aGroupLayout = new QGridLayout(myPolesWgt); + auto *aGroupLayout = new QGridLayout(myPolesWgt); aGroupLayout->setColumnStretch(1, 1); ModuleBase_Tools::adjustMargins(aGroupLayout); @@ -98,7 +98,7 @@ void PartSet_BSplineWidget::storePolesAndWeights() const { AttributeDoubleArrayPtr aWeightsArray = aData->realArray(SketchPlugin_BSpline::WEIGHTS_ID()); - std::list::const_iterator anIt = myPoles.begin(); + auto anIt = myPoles.begin(); for (int anIndex = 0; anIt != myPoles.end(); ++anIndex, ++anIt) { double aWeight = anIt->myWeight->value(); if (aWeight < THE_MIN_WEIGHT) @@ -139,7 +139,7 @@ bool PartSet_BSplineWidget::restoreValueCustom() { while ((int)myPoles.size() < aPoles->size()) addPoleWidget(); - std::list::iterator anIt = myPoles.begin(); + auto anIt = myPoles.begin(); for (int anIndex = 0; anIt != myPoles.end(); ++anIt, ++anIndex) { GeomPnt2dPtr aPoint = aPoles->pnt(anIndex); anIt->myX->setValue(aPoint->x()); @@ -153,7 +153,7 @@ bool PartSet_BSplineWidget::restoreValueCustom() { } void PartSet_BSplineWidget::addPoleWidget() { - QGridLayout *aGroupLay = dynamic_cast(myPolesWgt->layout()); + auto *aGroupLay = dynamic_cast(myPolesWgt->layout()); int aNbPoles = (int)myPoles.size(); QString aPoleStr = translate("Pole %1").arg(aNbPoles + 1); @@ -166,8 +166,8 @@ void PartSet_BSplineWidget::addPoleWidget() { QGroupBox *PartSet_BSplineWidget::createPoleWidget(BSplinePoleWidgets &thePole, const QString &theName, QWidget *theParent) { - QGroupBox *aPoleGroupBox = new QGroupBox(theName, theParent); - QGridLayout *aPoleLay = new QGridLayout(aPoleGroupBox); + auto *aPoleGroupBox = new QGroupBox(theName, theParent); + auto *aPoleLay = new QGridLayout(aPoleGroupBox); aPoleLay->setSpacing(0); ModuleBase_Tools::zeroMargins(aPoleLay); diff --git a/src/PartSet/PartSet_BSplineWidget.h b/src/PartSet/PartSet_BSplineWidget.h index f9d931844..4508489f8 100644 --- a/src/PartSet/PartSet_BSplineWidget.h +++ b/src/PartSet/PartSet_BSplineWidget.h @@ -45,31 +45,31 @@ public: /// is obtained from PartSet_BSplineWidget(QWidget *theParent, const Config_WidgetAPI *theData); - virtual ~PartSet_BSplineWidget() {} + ~PartSet_BSplineWidget() override = default; /// The methiod called when widget is deactivated - virtual void deactivate(); + void deactivate() override; /// Returns list of widget controls /// \return a control list - virtual QList getControls() const; + QList getControls() const override; /// Set feature which is processing by active operation /// \param theFeature a feature object /// \param theToStoreValue a value about necessity to store the widget value /// to the feature \param isUpdateFlushed a flag if update should be flushed /// on store value - virtual void setFeature(const FeaturePtr &theFeature, - const bool theToStoreValue = false, - const bool isUpdateFlushed = true); + void setFeature(const FeaturePtr &theFeature, + const bool theToStoreValue = false, + const bool isUpdateFlushed = true) 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; /// Create group of widgets related to coordinates of pole and its weight void addPoleWidget(); diff --git a/src/PartSet/PartSet_CustomPrs.cpp b/src/PartSet/PartSet_CustomPrs.cpp index 670f34918..044607fac 100644 --- a/src/PartSet/PartSet_CustomPrs.cpp +++ b/src/PartSet/PartSet_CustomPrs.cpp @@ -44,11 +44,10 @@ #include #include -//#define DO_NOT_VISUALIZE_CUSTOM_PRESENTATION +// #define DO_NOT_VISUALIZE_CUSTOM_PRESENTATION PartSet_CustomPrs::PartSet_CustomPrs(ModuleBase_IWorkshop *theWorkshop) - : myWorkshop(theWorkshop), myFeature(FeaturePtr()), - myPresentationIsEmpty(false), myDisabledMode(-1) { + : myWorkshop(theWorkshop), myFeature(FeaturePtr()) { Events_Loop *aLoop = Events_Loop::loop(); aLoop->registerListener( this, Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION)); @@ -163,8 +162,7 @@ bool PartSet_CustomPrs::displayPresentation( Quantity_Color aShapeColor = getShapeColor(theFlag); anOperationPrs->setShapeColor(aShapeColor); - PartSet_Module *aModule = - dynamic_cast(myWorkshop->module()); + auto *aModule = dynamic_cast(myWorkshop->module()); XGUI_Workshop *aWorkshop = workshop(); aRedisplayed = aWorkshop->displayer()->displayAIS( myPresentations[theFlag], false /*load object in selection*/, 0, @@ -242,7 +240,7 @@ AISObjectPtr PartSet_CustomPrs::getPresentation( } bool PartSet_CustomPrs::redisplay( - const ObjectPtr &theObject, + const ObjectPtr & /*theObject*/, const ModuleBase_IModule::ModuleBase_CustomizeFlag &theFlag, const bool theUpdateViewer) { #ifdef DO_NOT_VISUALIZE_CUSTOM_PRESENTATION @@ -351,7 +349,6 @@ Quantity_Color PartSet_CustomPrs::getShapeColor( } XGUI_Workshop *PartSet_CustomPrs::workshop() const { - XGUI_ModuleConnector *aConnector = - dynamic_cast(myWorkshop); + auto *aConnector = dynamic_cast(myWorkshop); return aConnector->workshop(); } diff --git a/src/PartSet/PartSet_CustomPrs.h b/src/PartSet/PartSet_CustomPrs.h index d660920cf..4899a0f01 100644 --- a/src/PartSet/PartSet_CustomPrs.h +++ b/src/PartSet/PartSet_CustomPrs.h @@ -65,7 +65,8 @@ public: /// Constructor /// \param theWorkshop a reference to workshop PARTSET_EXPORT PartSet_CustomPrs(ModuleBase_IWorkshop *theWorkshop); - PARTSET_EXPORT virtual ~PartSet_CustomPrs(){}; + PARTSET_EXPORT ~PartSet_CustomPrs() override = default; + ; /// Returns true if the presentation is active /// \param theFlag an object AIS presentation type @@ -115,7 +116,7 @@ public: //! Redefinition of Events_Listener method to listen a moment that the //! presentation becomes empty - virtual void processEvent(const std::shared_ptr &theMessage); + void processEvent(const std::shared_ptr &theMessage) override; private: /// Creates the AIS operation presentation @@ -169,16 +170,16 @@ private: void clearErrorShape(); private: - ModuleBase_IWorkshop *myWorkshop; /// current workshop - FeaturePtr myFeature; /// Reference to a feature object - bool myPresentationIsEmpty; /// Boolean state about empty presentation + ModuleBase_IWorkshop *myWorkshop; /// current workshop + FeaturePtr myFeature; /// Reference to a feature object + bool myPresentationIsEmpty{false}; /// Boolean state about empty presentation /// map of presentation type to AIS object QMap myPresentations; /// State whether the presentation is activated/deactivated QMap myIsActive; - int myDisabledMode; + int myDisabledMode{-1}; Handle(AIS_Shape) myErrorShapes; }; diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index 91d8b5dcb..5105bf7de 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -65,14 +65,14 @@ #include PartSet_MenuMgr::PartSet_MenuMgr(PartSet_Module *theModule) - : QObject(theModule), myModule(theModule), myPrevId(-1) { + : QObject(theModule), myModule(theModule) { createActions(); } QAction *PartSet_MenuMgr::action(const QString &theId) const { if (myActions.contains(theId)) return myActions[theId]; - return 0; + return nullptr; } void PartSet_MenuMgr::addAction(const QString &theId, QAction *theAction) { @@ -114,7 +114,7 @@ void PartSet_MenuMgr::createActions() { } void PartSet_MenuMgr::onAction(bool isChecked) { - QAction *aAction = static_cast(sender()); + auto *aAction = static_cast(sender()); QString anId = aAction->data().toString(); if (anId == "AUXILIARY_CMD") { @@ -148,7 +148,7 @@ bool PartSet_MenuMgr::addViewerMenu( FeaturePtr aFeature; foreach (ModuleBase_ViewerPrsPtr aPrs, aPrsList) { aResult = std::dynamic_pointer_cast(aPrs->object()); - if (aResult.get() != NULL) { + if (aResult.get() != nullptr) { const GeomShapePtr &aShape = aPrs->shape(); if (aShape.get() && aShape->isEqual(aResult->shape())) hasFeature = true; @@ -156,7 +156,7 @@ bool PartSet_MenuMgr::addViewerMenu( hasAttribute = true; } else { aFeature = std::dynamic_pointer_cast(aPrs->object()); - hasFeature = (aFeature.get() != NULL); + hasFeature = (aFeature.get() != nullptr); } } @@ -166,7 +166,7 @@ bool PartSet_MenuMgr::addViewerMenu( // Find 2d coordinates FeaturePtr aSketchFea = myModule->sketchMgr()->activeSketch(); if (aSketchFea->getKind() == SketchPlugin_Sketch::ID()) { - const TopoDS_Shape &aTDShape = aShape->impl(); + const auto &aTDShape = aShape->impl(); gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aTDShape)); std::shared_ptr aPnt3d( new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); @@ -178,7 +178,7 @@ bool PartSet_MenuMgr::addViewerMenu( FeaturePtr aCoincident = PartSet_Tools::findFirstCoincidence( ModelAPI_Feature::feature(aObj), aSelPnt); // If we have coincidence then add Detach menu - if (aCoincident.get() != NULL) { + if (aCoincident.get() != nullptr) { QList aCoins; mySelectedFeature = aCoincident; QList anIsAttributes; @@ -190,7 +190,7 @@ bool PartSet_MenuMgr::addViewerMenu( SketchPlugin_ConstraintCoincidence::ENTITY_B(), anIsAttributes); if (myCoinsideLines.size() > 0) { aIsDetach = true; - QMenu *aSubMenu = new QMenu(tr("Detach"), theParent); + auto *aSubMenu = new QMenu(tr("Detach"), theParent); theMenuActions[anIndex++] = aSubMenu->menuAction(); QAction *aAction; int i = 0; @@ -258,10 +258,9 @@ void PartSet_MenuMgr::onLineHighlighted(QAction *theAction) { myColor = setLineColor(myPrevId, Qt::white, true); } -QColor PartSet_MenuMgr::setLineColor(int theId, const QColor theColor, +QColor PartSet_MenuMgr::setLineColor(int /*theId*/, const QColor theColor, bool theUpdate) { - XGUI_ModuleConnector *aConnector = - dynamic_cast(myModule->workshop()); + auto *aConnector = dynamic_cast(myModule->workshop()); XGUI_Workshop *aWorkshop = aConnector->workshop(); XGUI_Displayer *aDisplayer = aWorkshop->displayer(); @@ -288,7 +287,7 @@ void addRefCoincidentFeatures(const std::set &theRefList, if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) { std::shared_ptr aPnt = PartSet_Tools::getCoincedencePoint(aConstrFeature); - if (aPnt.get() == NULL) + if (aPnt.get() == nullptr) return; if (theRefPnt->isEqual(aPnt) && (!theOutList.contains(aConstrFeature))) { theOutList.append(aConstrFeature); @@ -319,11 +318,11 @@ void PartSet_MenuMgr::onLineDetach(QAction *theAction) { addRefCoincidentFeatures(aRefList, aOrig, aToDelFeatures); } if (aToDelFeatures.size() > 0) { - XGUI_ModuleConnector *aConnector = + auto *aConnector = dynamic_cast(myModule->workshop()); XGUI_Workshop *aWorkshop = aConnector->workshop(); - ModuleBase_Operation *anOpAction = new ModuleBase_Operation( + auto *anOpAction = new ModuleBase_Operation( tr("Detach %1").arg(QString::fromStdWString(aLine->data()->name())), myModule); XGUI_OperationMgr *anOpMgr = aConnector->workshop()->operationMgr(); @@ -366,7 +365,7 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) { // 1. change auxiliary type of a created feature if (myModule->sketchMgr()->isNestedCreateOperation(anOperation, aSketch) && PartSet_SketcherMgr::isEntity(anOperation->id().toStdString())) { - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(anOperation); if (aFOperation) anObjects.append(aFOperation->feature()); @@ -379,9 +378,8 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) { QAction *anAction = action("AUXILIARY_CMD"); // SessionPtr aMgr = ModelAPI_Session::get(); - ModuleBase_Operation *anOpAction = 0; - XGUI_ModuleConnector *aConnector = - dynamic_cast(myModule->workshop()); + ModuleBase_Operation *anOpAction = nullptr; + auto *aConnector = dynamic_cast(myModule->workshop()); XGUI_OperationMgr *anOpMgr = aConnector->workshop()->operationMgr(); if (isUseTransaction) { anOpAction = new ModuleBase_Operation(anAction->text(), myModule); @@ -399,10 +397,10 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) { aLast = anObjects.end(); for (; anIt != aLast; anIt++) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); - if (aFeature.get() != NULL) { + if (aFeature.get() != nullptr) { std::shared_ptr aSketchFeature = std::dynamic_pointer_cast(aFeature); - if (aSketchFeature.get() != NULL) { + if (aSketchFeature.get() != nullptr) { std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID(); std::shared_ptr anAuxiliaryAttr = @@ -438,7 +436,7 @@ bool PartSet_MenuMgr::canSetAuxiliary(bool &theValue) const { // 1. change auxiliary type of a created feature if (myModule->sketchMgr()->isNestedCreateOperation(anOperation, aSketch) && PartSet_SketcherMgr::isEntity(anOperation->id().toStdString())) { - ModuleBase_OperationFeature *aFOperation = + auto *aFOperation = dynamic_cast(anOperation); if (aFOperation) anObjects.append(aFOperation->feature()); @@ -458,12 +456,12 @@ bool PartSet_MenuMgr::canSetAuxiliary(bool &theValue) const { aLast = anObjects.end(); for (; anIt != aLast && !isNotAuxiliaryFound; anIt++) { FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); - if ((aFeature.get() != NULL) && + if ((aFeature.get() != nullptr) && PartSet_SketcherMgr::isEntity(aFeature->getKind())) { anEnabled = true; std::shared_ptr aSketchFeature = std::dynamic_pointer_cast(aFeature); - if (aSketchFeature.get() != NULL) { + if (aSketchFeature.get() != nullptr) { std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID(); std::shared_ptr anAuxiliaryAttr = @@ -592,17 +590,17 @@ void PartSet_MenuMgr::onEdit(bool) { if (aFeature.get()) break; } - if (aFeature.get() == NULL) { + if (aFeature.get() == nullptr) { ResultParameterPtr aParam; foreach (ObjectPtr aObj, aObjects) { aParam = std::dynamic_pointer_cast(aObj); if (aParam.get()) break; } - if (aParam.get() != NULL) + if (aParam.get() != nullptr) aFeature = ModelAPI_Feature::feature(aParam); } - if (aFeature.get() != NULL) + if (aFeature.get() != nullptr) myModule->editFeature(aFeature); } diff --git a/src/PartSet/PartSet_MenuMgr.h b/src/PartSet/PartSet_MenuMgr.h index 4c732dcdc..57d478f58 100644 --- a/src/PartSet/PartSet_MenuMgr.h +++ b/src/PartSet/PartSet_MenuMgr.h @@ -109,7 +109,7 @@ protected: /// Redefinition of virtual method /// \param theObj an object /// \param theEvent an event - virtual bool eventFilter(QObject *theObj, QEvent *theEvent); + bool eventFilter(QObject *theObj, QEvent *theEvent) override; private: /// Returns true if the current operation is sketch entity create operation @@ -150,7 +150,7 @@ private: mutable FeaturePtr mySelectedFeature; /// Id of menu item in Detach menu previously selected - int myPrevId; + int myPrevId{-1}; /// Original color of highlighted line QColor myColor; diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 1280117eb..54695f652 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -34,7 +34,7 @@ #include -//#include +// #include #include #include #include @@ -85,26 +85,26 @@ public: /// Constructor /// \param theWshop a pointer to a workshop PartSet_Module(ModuleBase_IWorkshop *theWshop); - virtual ~PartSet_Module(); + ~PartSet_Module() override; // Stores the current selection - virtual void storeSelection(); + void storeSelection() override; // Restores the current selection - virtual void restoreSelection(); + void restoreSelection() override; /// Creates custom widgets for property panel - virtual ModuleBase_ModelWidget * + ModuleBase_ModelWidget * createWidgetByType(const std::string &theType, QWidget *theParent, - Config_WidgetAPI *theWidgetApi); + Config_WidgetAPI *theWidgetApi) override; /// Returns the active widget, by default it is the property panel active /// widget If the internal edit operation is started, this is the first widget /// of the operation - virtual ModuleBase_ModelWidget *activeWidget() const; + ModuleBase_ModelWidget *activeWidget() const override; /// Call back forlast tuning of property panel before operation performance - virtual void propertyPanelDefined(ModuleBase_Operation *theOperation); + void propertyPanelDefined(ModuleBase_Operation *theOperation) override; /// If there is found selected attribute, widgets are created and contains /// only a widget for the attribute @@ -113,70 +113,70 @@ public: /// \param theXmlRepr an XML representation of the operation /// \param theWidgets a list of created widgets /// \return boolean result, false by default - virtual bool createWidgets(const FeaturePtr &theFeature, - const QString &theXmlRepr, - QList &theWidgets) const; + bool + createWidgets(const FeaturePtr &theFeature, const QString &theXmlRepr, + QList &theWidgets) const override; /// Launching of a edit operation on the feature /// \param theFeature feature for editing - virtual void editFeature(FeaturePtr theFeature); + void editFeature(FeaturePtr theFeature) override; /// Returns true if the operation can be committed. Result in default /// implementation is true. \return boolean value - virtual bool canCommitOperation() const; + bool canCommitOperation() const override; /// Creates an operation and send it to loop /// \param theCmdId the operation name /// \param isStartAfterCommitOnly operation is launched if there is no active /// operation or /// it is committed - virtual void launchOperation(const QString &theCmdId, - const bool &isStartAfterCommitOnly); + void launchOperation(const QString &theCmdId, + const bool &isStartAfterCommitOnly) override; /// Realizes some functionality by an operation start /// Displays all sketcher sub-Objects, hides sketcher result, appends /// selection filters Activate the operation presentation \param theOperation /// a started operation - virtual void operationStarted(ModuleBase_Operation *theOperation); + void operationStarted(ModuleBase_Operation *theOperation) override; /// Realizes some functionality by an operation resume /// Activate the operation presentation /// \param theOperation a resumed operation - virtual void operationResumed(ModuleBase_Operation *theOperation); + void operationResumed(ModuleBase_Operation *theOperation) override; /// Realizes some functionality by an operation commit /// Restarts sketcher operation automatically of it is necessary /// \param theOperation a committed operation - virtual void operationCommitted(ModuleBase_Operation *theOperation); + void operationCommitted(ModuleBase_Operation *theOperation) override; /// Realizes some functionality by an operation abort /// Hides all sketcher sub-Objects, displays sketcher result and removes /// selection filters \param theOperation an aborted operation - virtual void operationAborted(ModuleBase_Operation *theOperation); + void operationAborted(ModuleBase_Operation *theOperation) override; /// Realizes some functionality by an operation stop /// Hides all sketcher sub-Objects, displays sketcher result and removes /// selection filters \param theOperation a stopped operation - virtual void operationStopped(ModuleBase_Operation *theOperation); + void operationStopped(ModuleBase_Operation *theOperation) override; /// Returns current operation - virtual ModuleBase_Operation *currentOperation() const; + ModuleBase_Operation *currentOperation() const override; /// Returns True if there are available Undos and the sketch manager allows /// undo \return the boolean result - virtual bool canUndo() const; + bool canUndo() const override; //! Returns True if there are available Redos and the sketch manager allows //! redo /// \return the boolean result - virtual bool canRedo() const; + bool canRedo() const override; /// Returnas true if the action can be applyed to the object /// \param theObject a checked object /// \param theActionId an identifier of action, to be found in the menu /// manager like "DELETE_CMD" \return the a booean result - virtual bool canApplyAction(const ObjectPtr &theObject, - const QString &theActionId) const; + bool canApplyAction(const ObjectPtr &theObject, + const QString &theActionId) const override; /// Returns True if the current operation can be committed. Asks the sketch /// manager. \return a boolean value @@ -185,20 +185,20 @@ public: /// Returns whether the object can be erased at the bounds of the active /// operation. The sub-objects of the current operation can not be erased /// \param theObject a model object - virtual bool canEraseObject(const ObjectPtr &theObject) const; + bool canEraseObject(const ObjectPtr &theObject) const override; /// Returns whether the object can be displayed at the bounds of the active /// operation. Display only current operation results for usual operation and /// ask the sketcher manager if it is a sketch operation \param theObject a /// model object - virtual bool canDisplayObject(const ObjectPtr &theObject) const; + bool canDisplayObject(const ObjectPtr &theObject) const override; /// Returns parent result if accepted, true if the started operation is a /// nested operation of the previous operation \param thePreviousOperationKind /// a kind of previous operation \param theStartedOperationKind a kind of a /// new operation - virtual bool canUsePreselection(const QString &thePreviousOperationKind, - const QString &theStartedOperationKind); + bool canUsePreselection(const QString &thePreviousOperationKind, + const QString &theStartedOperationKind) override; /// Make some functionality after the objects are hidden in viewer /// \param theObjects a list of hidden objects @@ -208,11 +208,11 @@ public: /// For sketch operation allow the selection activation if the operation is /// edit, for other operation uses the default result \param theObject a model /// object - virtual bool canActivateSelection(const ObjectPtr &theObject) const; + bool canActivateSelection(const ObjectPtr &theObject) const override; /// Add menu atems for object browser into the given menu /// \param theMenu a popup menu to be shown in the object browser - virtual void addObjectBrowserMenu(QMenu *theMenu) const; + void addObjectBrowserMenu(QMenu *theMenu) const override; /// Add menu items for viewer into the actions map /// \param theStdActions a map of standard actions @@ -220,25 +220,25 @@ public: /// \param theMenuActions map of action/menu for the desirable index in the /// viewer menu \return true if items are added and there is no necessity to /// provide standard menu - virtual bool addViewerMenu(const QMap &theStdActions, - QWidget *theParent, - QMap &theMenuActions) const; + bool addViewerMenu(const QMap &theStdActions, + QWidget *theParent, + QMap &theMenuActions) const override; /// Returns a list of modes, where the AIS objects should be activated /// \param theModes a list of modes - virtual void activeSelectionModes(QIntList &theModes); + void activeSelectionModes(QIntList &theModes) override; /// Appends specific selection modes for the module to the list of types /// \param theModesType combination of available selection filters /// \param theModes a selection modes to be extended - virtual void moduleSelectionModes(int theModesType, QIntList &theModes); + void moduleSelectionModes(int theModesType, QIntList &theModes) override; /// Appends into container of filters module filters corresponded to the modes /// type \param theFilterTypes container of available selection filters \param /// theSelectionFilters [out] container to be extend by elements - virtual void + void moduleSelectionFilters(const QIntList &theFilterTypes, - SelectMgr_ListOfFilter &theSelectionFilters); + SelectMgr_ListOfFilter &theSelectionFilters) override; /// Returns whether the mouse enter the viewer's window /// \return true if items are added and there is no necessity to provide @@ -273,14 +273,14 @@ public: bool isSketchNeutralPointActivated() const; /// Performs functionality on closing document - virtual void closeDocument(); + void closeDocument() override; /// Clears specific presentations in the viewer - virtual void clearViewer(); + void clearViewer() 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; /// Set the object with the object results are customized /// \param theFeature a feature @@ -289,24 +289,24 @@ public: /// Return true if the custom presentation is activated /// \param theFlag a flag of level of customization, which means that only /// part of sub-elements \return boolean value - virtual bool - isCustomPrsActivated(const ModuleBase_CustomizeFlag &theFlag) const; + bool + isCustomPrsActivated(const ModuleBase_CustomizeFlag &theFlag) const override; /// Activate custom presentation for the object /// \param theFeature a feature instance /// \param theFlag a flag of level of customization, which means that only /// part of sub-elements \param theUpdateViewer the parameter whether the /// viewer should be update immediately - virtual void activateCustomPrs(const FeaturePtr &theFeature, - const ModuleBase_CustomizeFlag &theFlag, - const bool theUpdateViewer); + void activateCustomPrs(const FeaturePtr &theFeature, + const ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer) override; /// Deactivate custom presentation for the object /// \param theFlag a flag of level of customization, which means that only /// part of sub-elements \param theUpdateViewer the parameter whether the /// viewer should be update immediately - virtual void deactivateCustomPrs(const ModuleBase_CustomizeFlag &theFlag, - const bool theUpdateViewer); + void deactivateCustomPrs(const ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer) override; /// Modifies the given presentation in the custom way. // virtual bool customisePresentation(std::shared_ptr @@ -330,21 +330,21 @@ public: /// be updated(e.g. only highlighted elements) \param theUpdateViewer the /// parameter whether the viewer should be update immediatelly \returns true /// if the object is modified - virtual bool customizeFeature(ObjectPtr theObject, - const ModuleBase_CustomizeFlag &theFlag, - const bool theUpdateViewer); + bool customizeFeature(ObjectPtr theObject, + const ModuleBase_CustomizeFlag &theFlag, + const bool theUpdateViewer) override; /// Disable displaying of custom mode /// \param theMode a mode to disable - virtual void disableCustomMode(ModuleBase_CustomizeFlag theMode); + void disableCustomMode(ModuleBase_CustomizeFlag theMode) override; /// Enables disabled custom mode - virtual void enableCustomModes(); + void enableCustomModes() override; /// This method is called on object browser creation for customisation of /// module specific features \param theObjectBrowser a pinter on Object /// Browser widget - virtual void customizeObjectBrowser(QWidget *theObjectBrowser); + void customizeObjectBrowser(QWidget *theObjectBrowser) override; /// Returns the viewer Z layer int getVisualLayerId() const { return myVisualLayerId; } @@ -352,81 +352,81 @@ public: /// Create specific for the module presentation /// \param theResult an object for presentation /// \return created presentation or NULL(default value) - virtual AISObjectPtr createPresentation(const ObjectPtr &theResult); + AISObjectPtr createPresentation(const ObjectPtr &theResult) override; /// Customize presentation according to objects attributes /// \param theObject an object for presentation /// \param thePrs a presentation object - virtual void customizePresentation(const ObjectPtr &theObject, - const AISObjectPtr &thePrs) const; + void customizePresentation(const ObjectPtr &theObject, + const AISObjectPtr &thePrs) const override; //! Returns data object by AIS - virtual ObjectPtr findPresentedObject(const AISObjectPtr &theAIS) const; + ObjectPtr findPresentedObject(const AISObjectPtr &theAIS) const override; //! Returns true if the presentation can be shown in shading mode //! \param theAIS presentation to be checked //! \return boolean value - virtual bool canBeShaded(Handle(AIS_InteractiveObject) theAIS) const; + bool canBeShaded(Handle(AIS_InteractiveObject) theAIS) const override; /// Update state of pop-up menu items in viewer /// \param theStdActions - a map of standard actions - virtual void updateViewerMenu(const QMap &theStdActions); + void updateViewerMenu(const QMap &theStdActions) override; /// Returns true if the action should be always enabled /// \param theActionId an action index: Accept or Accept All /// \return boolean value - virtual bool isActionEnableStateFixed(const int theActionId) const; + bool isActionEnableStateFixed(const int theActionId) const override; //! Returns the feature error if the current state of the feature in the //! module is not correct If the feature is correct, it returns an empty value //! \return string value - virtual QString getFeatureError(const FeaturePtr &theFeature); + QString getFeatureError(const FeaturePtr &theFeature) override; /// Returns list of granted operation indices - virtual void grantedOperationIds(ModuleBase_Operation *theOperation, - QStringList &theIds) const; + void grantedOperationIds(ModuleBase_Operation *theOperation, + QStringList &theIds) const override; /// Validates the current operation and send the state change to sketch /// manager \param thePreviousState the previous widget value state - virtual void widgetStateChanged(int thePreviousState); + void widgetStateChanged(int thePreviousState) override; /// Returns true if the event is processed. It gives the reentrance manager to /// process the enter. \param thePreviousAttributeID an index of the previous /// active attribute - virtual bool processEnter(const std::string &thePreviousAttributeID); + bool processEnter(const std::string &thePreviousAttributeID) override; /// Performs some GUI actions before an operation transaction is stopped /// Default realization is empty - virtual void beforeOperationStopped(ModuleBase_Operation *theOperation); + void beforeOperationStopped(ModuleBase_Operation *theOperation) override; /// Finds a shape by attribute if it is possible /// \param theAttribute an attribute /// \return a geom shape - virtual GeomShapePtr findShape(const AttributePtr &theAttribute); + GeomShapePtr findShape(const AttributePtr &theAttribute) override; /// Finds an attribute by geom shape if it is possible /// \param theObject an object of the attribute /// \param theGeomShape a geom shape /// \return theAttribute - virtual AttributePtr findAttribute(const ObjectPtr &theObject, - const GeomShapePtr &theGeomShape); + AttributePtr findAttribute(const ObjectPtr &theObject, + const GeomShapePtr &theGeomShape) override; /// Returns reentrant message if it was accepted - virtual std::shared_ptr reentrantMessage(); + std::shared_ptr reentrantMessage() override; /// Put current selection into reentrant message /// \param theMessage a message of reentrant operation - virtual void - setReentrantPreSelection(const std::shared_ptr &theMessage); + void setReentrantPreSelection( + const std::shared_ptr &theMessage) override; /// Returns root tree node which represents a data model - virtual ModuleBase_ITreeNode *rootNode() const; + ModuleBase_ITreeNode *rootNode() const override; /// Returns the workshop XGUI_Workshop *getWorkshop() const; /// Reads description of features from XML file - virtual void createFeatures(); + void createFeatures() override; /// add texture static void setTexture(const AISObjectPtr &thePrs, @@ -436,23 +436,23 @@ public slots: /// Slolt called on object display /// \param theObject a data object /// \param theAIS a presentation object - virtual void onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS); + void onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS) override; /// Slot called on before object erase /// \param theObject a data object /// \param theAIS a presentation object - virtual void onBeforeObjectErase(ObjectPtr theObject, AISObjectPtr theAIS); + void onBeforeObjectErase(ObjectPtr theObject, AISObjectPtr theAIS) override; /// Called on transformation in current viewer /// \param theTrsfType type of tranformation - virtual void onViewTransformed(int theTrsfType = 2); + void onViewTransformed(int theTrsfType = 2) override; /// Called on remove conflicting constraints void onRemoveConflictingConstraints(); protected slots: /// Called when previous operation is finished - virtual void onSelectionChanged(); + void onSelectionChanged() override; /// SLOT, that is called by key release in the viewer. /// \param theWnd a view window @@ -483,13 +483,13 @@ protected: void updateConstraintsState(const std::string &theFeatureKind); /// Register validators for this module - virtual void registerValidators(); + void registerValidators() override; /// Connects or disconnects to the value changed signal of the property panel /// widgets \param theWidget a property contol widget \param isToConnect a /// boolean value whether connect or disconnect - virtual void connectToPropertyPanel(ModuleBase_ModelWidget *theWidget, - const bool isToConnect); + void connectToPropertyPanel(ModuleBase_ModelWidget *theWidget, + const bool isToConnect) override; /// Updates reentrant manager state or sketcher operations for the started /// operation \param theOperation the started operation @@ -506,7 +506,7 @@ private slots: private: //! Delete features - virtual bool deleteObjects(); + bool deleteObjects() override; void setDefaultConstraintShown(); diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index 674958a1a..64e60560d 100644 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -61,11 +61,11 @@ #include #include -//#define DEBUG_EMPTY_SHAPE -//#define DEBUG_OPERATION_PRS +// #define DEBUG_EMPTY_SHAPE +// #define DEBUG_OPERATION_PRS // multi-rotation/translation operation -//#define DEBUG_HIDE_COPY_ATTRIBUTE +// #define DEBUG_HIDE_COPY_ATTRIBUTE #ifdef DEBUG_HIDE_COPY_ATTRIBUTE #include #include diff --git a/src/PartSet/PartSet_OperationPrs.h b/src/PartSet/PartSet_OperationPrs.h index 7a6c782d3..074c045f4 100644 --- a/src/PartSet/PartSet_OperationPrs.h +++ b/src/PartSet/PartSet_OperationPrs.h @@ -80,15 +80,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; protected: /// list of visualized shapes diff --git a/src/PartSet/PartSet_OverconstraintListener.cpp b/src/PartSet/PartSet_OverconstraintListener.cpp index 36ad3602a..1f4579368 100644 --- a/src/PartSet/PartSet_OverconstraintListener.cpp +++ b/src/PartSet/PartSet_OverconstraintListener.cpp @@ -55,7 +55,7 @@ #include #include -//#define DEBUG_FEATURE_OVERCONSTRAINT_LISTENER +// #define DEBUG_FEATURE_OVERCONSTRAINT_LISTENER PartSet_OverconstraintListener::PartSet_OverconstraintListener( ModuleBase_IWorkshop *theWorkshop) diff --git a/src/PartSet/PartSet_OverconstraintListener.h b/src/PartSet/PartSet_OverconstraintListener.h index d049299f6..17d1ba107 100644 --- a/src/PartSet/PartSet_OverconstraintListener.h +++ b/src/PartSet/PartSet_OverconstraintListener.h @@ -44,7 +44,8 @@ public: /// displayer PartSet_OverconstraintListener(ModuleBase_IWorkshop *theWorkshop); - virtual ~PartSet_OverconstraintListener(){}; + ~PartSet_OverconstraintListener() override = default; + ; /// If active state is changed, update fully defined state and sketch /// sub-entities color \param theActive a state @@ -57,7 +58,7 @@ public: void getCustomColor(const ObjectPtr &theObject, std::vector &theColor); /// Redefinition of Events_Listener method - virtual void processEvent(const std::shared_ptr &theMessage); + void processEvent(const std::shared_ptr &theMessage) override; bool isConflictingObject(const ObjectPtr &theObject) const { return (myConflictingObjects.find(theObject) != myConflictingObjects.end()); diff --git a/src/PartSet/PartSet_PreviewSketchPlane.h b/src/PartSet/PartSet_PreviewSketchPlane.h index ba8268023..9a184b93d 100644 --- a/src/PartSet/PartSet_PreviewSketchPlane.h +++ b/src/PartSet/PartSet_PreviewSketchPlane.h @@ -41,7 +41,8 @@ public: /// Constructor PartSet_PreviewSketchPlane(); - ~PartSet_PreviewSketchPlane(){}; + ~PartSet_PreviewSketchPlane() = default; + ; /// Erase preview planes /// \param theWorkshop the application workshop diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index d8fc2fc22..b3b2abd8e 100644 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -49,7 +49,7 @@ #include #include -//#define DEBUG_WIRE +// #define DEBUG_WIRE #ifdef DEBUG_WIRE #include diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 9f64a4167..f3d981d4e 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -119,11 +119,11 @@ #include -//#define DEBUG_DO_NOT_BY_ENTER -//#define DEBUG_SKETCHER_ENTITIES -//#define DEBUG_SKETCH_ENTITIES_ON_MOVE -//#define DRAGGING_DEBUG -//#define DEBUG_CURSOR +// #define DEBUG_DO_NOT_BY_ENTER +// #define DEBUG_SKETCHER_ENTITIES +// #define DEBUG_SKETCH_ENTITIES_ON_MOVE +// #define DRAGGING_DEBUG +// #define DEBUG_CURSOR #ifdef DRAGGING_DEBUG #include @@ -232,9 +232,9 @@ void PartSet_SketcherMgr::onEnterViewPort() { QCursor *aCurrentCursor = QApplication::overrideCursor(); if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) { QApplication::setOverrideCursor(PartSet_Tools::getOperationCursor()); - //#ifdef DEBUG_CURSOR - // qDebug("onEnterViewPort() : Qt::CrossCursor"); - //#endif + // #ifdef DEBUG_CURSOR + // qDebug("onEnterViewPort() : Qt::CrossCursor"); + // #endif } } @@ -271,9 +271,9 @@ void PartSet_SketcherMgr::onLeaveViewPort() { if (canChangeCursor(getCurrentOperation())) { QApplication::restoreOverrideCursor(); - //#ifdef DEBUG_CURSOR - // qDebug("onLeaveViewPort() : None"); - //#endif + // #ifdef DEBUG_CURSOR + // qDebug("onLeaveViewPort() : None"); + // #endif } if (!isNestedCreateOperation(getCurrentOperation(), activeSketch())) @@ -1334,9 +1334,9 @@ void PartSet_SketcherMgr::startNestedSketch( QCursor *aCurrentCursor = QApplication::overrideCursor(); if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) { QApplication::setOverrideCursor(PartSet_Tools::getOperationCursor()); - //#ifdef DEBUG_CURSOR - // qDebug("startNestedSketch() : Qt::CrossCursor"); - //#endif + // #ifdef DEBUG_CURSOR + // qDebug("startNestedSketch() : Qt::CrossCursor"); + // #endif } } } diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index ca312055f..a7c49604f 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -83,11 +83,11 @@ public: PartSet_Fitter(PartSet_SketcherMgr *theSketchMgr) : mySketchMgr(theSketchMgr) {} - virtual ~PartSet_Fitter() {} + virtual ~PartSet_Fitter() = default; /// A method which has top be reimplemented to provide alterantive /// implementation FitAll command \param theView - a view which has to be fit - virtual void fitAll(Handle(V3d_View) theView); + void fitAll(Handle(V3d_View) theView) override; private: PartSet_SketcherMgr *mySketchMgr; @@ -108,7 +108,7 @@ class PARTSET_EXPORT PartSet_SketcherMgr : public QObject, /// Constructor Point() { myIsInitialized = false; } /// Destructor - ~Point() {} + ~Point() = default; /// clear the initialized flag. void clear() { myIsInitialized = false; } @@ -133,14 +133,14 @@ public: TopoDS_Shape myFirstResultShape; /// the first shape of feature result TopTools_MapOfShape myLocalSelectedShapes; /// shapes of local selection }; - typedef QMap FeatureToSelectionMap; + using FeatureToSelectionMap = QMap; public: /// Constructor /// \param theModule a pointer to PartSet module PartSet_SketcherMgr(PartSet_Module *theModule); - virtual ~PartSet_SketcherMgr(); + ~PartSet_SketcherMgr() override; /// Returns true if the operation is the sketch /// \param theOperation an operation @@ -375,7 +375,7 @@ 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; /// Returns true if current mode of objects creation is by drag mouse bool isDragModeCreation() const; diff --git a/src/PartSet/PartSet_SketcherReentrantMgr.cpp b/src/PartSet/PartSet_SketcherReentrantMgr.cpp index 50ef2239d..6f5c84d0c 100644 --- a/src/PartSet/PartSet_SketcherReentrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReentrantMgr.cpp @@ -67,7 +67,7 @@ #include -//#define DEBUG_RESTART +// #define DEBUG_RESTART PartSet_SketcherReentrantMgr::PartSet_SketcherReentrantMgr( ModuleBase_IWorkshop *theWorkshop) diff --git a/src/PartSet/PartSet_WidgetSketchCreator.cpp b/src/PartSet/PartSet_WidgetSketchCreator.cpp index aa2dd3306..3bda0345a 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.cpp +++ b/src/PartSet/PartSet_WidgetSketchCreator.cpp @@ -65,7 +65,7 @@ #include #include #include -//#include +// #include #include #include #include diff --git a/src/PartSetPlugin/PartSetPlugin_Part.h b/src/PartSetPlugin/PartSetPlugin_Part.h index 76b7d2714..436f2b9b5 100644 --- a/src/PartSetPlugin/PartSetPlugin_Part.h +++ b/src/PartSetPlugin/PartSetPlugin_Part.h @@ -37,7 +37,7 @@ public: return MY_PART_KIND; } /// 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_Part::ID(); return MY_KIND; } @@ -51,45 +51,45 @@ public: // LCOV_EXCL_STOP /// Creates a new part document if needed - PARTSETPLUGIN_EXPORT virtual void execute(); + PARTSETPLUGIN_EXPORT void execute() override; /// Request for initialization of data model of the feature: adding all /// attributes - PARTSETPLUGIN_EXPORT virtual void initAttributes(); + PARTSETPLUGIN_EXPORT void initAttributes() override; /// Part must be added only to PartSet - PARTSETPLUGIN_EXPORT virtual const std::string &documentToAdd(); + PARTSETPLUGIN_EXPORT const std::string &documentToAdd() override; // composite feature methods /// Adds feature to its document - virtual std::shared_ptr addFeature(std::string theID); + std::shared_ptr addFeature(std::string theID) override; /// Returns the number of sub-features of the document - virtual int numberOfSubs(bool forTree = false) const; + int numberOfSubs(bool forTree = false) const override; /// Returns the sub-feature by zero-base index - virtual std::shared_ptr subFeature(const int theIndex, - bool forTree = false); + std::shared_ptr subFeature(const int theIndex, + bool forTree = false) override; /// Returns the sub-feature unique identifier in this composite feature by /// zero-base index - virtual int subFeatureId(const int theIndex) const; + int subFeatureId(const int theIndex) const override; /// Returns true if feature or reuslt belong to this composite feature as subs - virtual bool isSub(ObjectPtr theObject) const; + 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) - virtual void removeFeature(std::shared_ptr theFeature) {} + void removeFeature(std::shared_ptr theFeature) override {} /// Use plugin manager for features creation PartSetPlugin_Part(); /// Just removes all features of the part without touching the document data /// (to be able undo) - PARTSETPLUGIN_EXPORT virtual void erase(); + PARTSETPLUGIN_EXPORT void erase() override; }; #endif diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp index f323805c9..7128ecce0 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp @@ -38,7 +38,7 @@ #include //================================================================================================= -PrimitivesPlugin_Sphere::PrimitivesPlugin_Sphere() {} +PrimitivesPlugin_Sphere::PrimitivesPlugin_Sphere() = default; //================================================================================================= void PrimitivesPlugin_Sphere::initAttributes() { @@ -134,7 +134,7 @@ void PrimitivesPlugin_Sphere::createSphereByPtRadius() { std::shared_ptr aCenterPoint; std::shared_ptr aPointRef = selection(PrimitivesPlugin_Sphere::CENTER_POINT_ID()); - if (aPointRef.get() != NULL) { + if (aPointRef.get() != nullptr) { GeomShapePtr aShape1 = aPointRef->value(); if (!aShape1.get()) { aShape1 = aPointRef->context()->shape(); @@ -235,10 +235,8 @@ void PrimitivesPlugin_Sphere::loadNamingDS( // Naming for faces and edges std::map> listOfFaces = theSphereAlgo->getCreatedFaces(); - for (std::map>::iterator it = - listOfFaces.begin(); - it != listOfFaces.end(); ++it) { - theResultSphere->generated((*it).second, (*it).first); + for (auto &listOfFace : listOfFaces) { + theResultSphere->generated(listOfFace.second, listOfFace.first); } // Naming vertices diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.h b/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.h index f217fbc20..2e74a995e 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.h @@ -112,17 +112,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_Sphere::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_Sphere(); diff --git a/src/PythonAPI/examples/Platine.py b/src/PythonAPI/examples/Platine.py index d78030eb0..54086a56e 100644 --- a/src/PythonAPI/examples/Platine.py +++ b/src/PythonAPI/examples/Platine.py @@ -26,7 +26,6 @@ from salome.shaper import model # START DEBUG PURPOSES # Should be removed -import ModelAPI # END DEBUG PURPOSES diff --git a/src/PythonAPI/initConfig.py b/src/PythonAPI/initConfig.py index caf0d7a76..af5cec4b2 100644 --- a/src/PythonAPI/initConfig.py +++ b/src/PythonAPI/initConfig.py @@ -22,7 +22,6 @@ Module reader """ import salome -import SALOME_ModuleCatalog import ConfigAPI # needed on immediate start of SHAPER from SALOME: salome.naming_service is not initialized then diff --git a/src/PythonAPI/model/dump/DumpAssistant.py b/src/PythonAPI/model/dump/DumpAssistant.py index 6d529ae80..9e1d5d2b4 100644 --- a/src/PythonAPI/model/dump/DumpAssistant.py +++ b/src/PythonAPI/model/dump/DumpAssistant.py @@ -22,7 +22,6 @@ import ModelHighAPI -import ModelAPI import SketchAPI import sys diff --git a/src/PythonAPI/model/tests/tests.py b/src/PythonAPI/model/tests/tests.py index 4ddb80c7d..410819bb1 100644 --- a/src/PythonAPI/model/tests/tests.py +++ b/src/PythonAPI/model/tests/tests.py @@ -262,10 +262,9 @@ def testResultsVolumes(theFeature, theExpectedResultsVolumes, theNbSignificantDi .lstrip(".") .lstrip("0") ) - assert math.fabs( - aResultVolume - anExpectedResultVolume - ) <= aTolerance * math.fabs( - anExpectedResultVolume + assert ( + math.fabs(aResultVolume - anExpectedResultVolume) + <= aTolerance * math.fabs(anExpectedResultVolume) ), "Volume of result[{}]: {:0.27f}. Expected: {:0.27f}. The first {} significant digits not equal.".format( anIndex, aResultVolume, anExpectedResultVolume, theNbSignificantDigits ) @@ -296,10 +295,9 @@ def testResultsAreas(theFeature, theExpectedResultsVolumes, theNbSignificantDigi .lstrip(".") .lstrip("0") ) - assert math.fabs( - aResultVolume - anExpectedResultVolume - ) <= aTolerance * math.fabs( - anExpectedResultVolume + assert ( + math.fabs(aResultVolume - anExpectedResultVolume) + <= aTolerance * math.fabs(anExpectedResultVolume) ), "Area of result[{}]: {:0.27f}. Expected: {:0.27f}. The first {} significant digits not equal.".format( anIndex, aResultVolume, anExpectedResultVolume, theNbSignificantDigits ) diff --git a/src/PythonAddons/macros/compoundVertices/feature.py b/src/PythonAddons/macros/compoundVertices/feature.py index 914eeac44..5f640256b 100755 --- a/src/PythonAddons/macros/compoundVertices/feature.py +++ b/src/PythonAddons/macros/compoundVertices/feature.py @@ -22,7 +22,6 @@ Author: Nathalie Gore """ from salome.shaper import model -from salome.shaper import geom import ModelAPI diff --git a/src/PythonAddons/macros/importParameters/feature.py b/src/PythonAddons/macros/importParameters/feature.py index 9a9b121d1..63493e76d 100755 --- a/src/PythonAddons/macros/importParameters/feature.py +++ b/src/PythonAddons/macros/importParameters/feature.py @@ -22,7 +22,6 @@ Author: Nathalie Gore """ from salome.shaper import model -from salome.shaper import geom import ModelAPI import ParametersAPI diff --git a/src/PythonAddons/macros/midSurface/surfaceMediane.py b/src/PythonAddons/macros/midSurface/surfaceMediane.py index 0890cd2d1..e94fd6f12 100755 --- a/src/PythonAddons/macros/midSurface/surfaceMediane.py +++ b/src/PythonAddons/macros/midSurface/surfaceMediane.py @@ -47,7 +47,6 @@ import salome salome.salome_init() -import SALOMEDS from SketchAPI import * from salome.shaper import model from salome.shaper import geom diff --git a/src/PythonAddons/macros/pipeNetwork/feature.py b/src/PythonAddons/macros/pipeNetwork/feature.py index 78c314336..27c0ab0d6 100755 --- a/src/PythonAddons/macros/pipeNetwork/feature.py +++ b/src/PythonAddons/macros/pipeNetwork/feature.py @@ -294,7 +294,7 @@ class pipeNetwork(model.Feature): if len(splitLine) != 2: print(line) diagno = 1 - elif not splitLine[0] in self.infoPoints: + elif splitLine[0] not in self.infoPoints: print(line) diagno = 2 elif splitLine[1] == "angular_connection": diff --git a/src/SHAPERGUI/SHAPERGUI_NestedButton.cpp b/src/SHAPERGUI/SHAPERGUI_NestedButton.cpp index 881be87a9..f835fe4aa 100644 --- a/src/SHAPERGUI/SHAPERGUI_NestedButton.cpp +++ b/src/SHAPERGUI/SHAPERGUI_NestedButton.cpp @@ -36,10 +36,9 @@ SHAPERGUI_NestedButton::SHAPERGUI_NestedButton( QObject *theParent, const QList &theNestedActions) - : QWidgetAction(theParent), myNestedActions(theNestedActions), - myAdditionalButtonsWidget(0), myButtonFrame(0), myThisButton(0) {} + : QWidgetAction(theParent), myNestedActions(theNestedActions) {} -SHAPERGUI_NestedButton::~SHAPERGUI_NestedButton() {} +SHAPERGUI_NestedButton::~SHAPERGUI_NestedButton() = default; void SHAPERGUI_NestedButton::showAdditionalButtons(bool isShow) { myAdditionalButtonsWidget->setVisible(isShow); @@ -57,12 +56,12 @@ void SHAPERGUI_NestedButton::showAdditionalButtons(bool isShow) { QWidget *SHAPERGUI_NestedButton::createWidget(QWidget *theParent) { // the action has widget only in tool bar, in menu bar, the default // action presentation is shown - QToolBar *aToolBar = dynamic_cast(theParent); + auto *aToolBar = dynamic_cast(theParent); if (!aToolBar) - return 0; + return nullptr; myButtonFrame = new QFrame(theParent); - QHBoxLayout *aBoxLay = new QHBoxLayout(myButtonFrame); + auto *aBoxLay = new QHBoxLayout(myButtonFrame); aBoxLay->setContentsMargins(2, 0, 0, 0); aBoxLay->setSpacing(1); QSizePolicy aSizePolicy; @@ -75,11 +74,11 @@ QWidget *SHAPERGUI_NestedButton::createWidget(QWidget *theParent) { aBoxLay->addWidget(myThisButton, 1); myAdditionalButtonsWidget = new QWidget(myButtonFrame); - QHBoxLayout *aAdditionalBoxLay = new QHBoxLayout(myAdditionalButtonsWidget); + auto *aAdditionalBoxLay = new QHBoxLayout(myAdditionalButtonsWidget); aAdditionalBoxLay->setContentsMargins(0, 0, 0, 0); aAdditionalBoxLay->setSpacing(1); foreach (QAction *eachAct, myNestedActions) { - QToolButton *aButton = new QToolButton(myButtonFrame); + auto *aButton = new QToolButton(myButtonFrame); aButton->setDefaultAction(eachAct); aButton->setAutoRaise(true); aAdditionalBoxLay->addWidget(aButton); diff --git a/src/SHAPERGUI/SHAPERGUI_NestedButton.h b/src/SHAPERGUI/SHAPERGUI_NestedButton.h index 7aa1b5976..569ed243e 100644 --- a/src/SHAPERGUI/SHAPERGUI_NestedButton.h +++ b/src/SHAPERGUI/SHAPERGUI_NestedButton.h @@ -47,7 +47,7 @@ public: /// \param theNestedActions a list of nested actions SHAPERGUI_NestedButton(QObject *theParent, const QList &theNestedActions); - virtual ~SHAPERGUI_NestedButton(); + ~SHAPERGUI_NestedButton() override; private slots: /// Shows/hides the additional buttons widget @@ -59,16 +59,16 @@ private slots: protected: /// Creates the button representation /// \param theParent a parent widget - virtual QWidget *createWidget(QWidget *theParent); + QWidget *createWidget(QWidget *theParent) override; - virtual bool event(QEvent *theEvent); + bool event(QEvent *theEvent) override; private: - QList myNestedActions; ///< list of nested actions - QWidget *myAdditionalButtonsWidget; ///< widget to precess additional buttons - ///< visibility - QFrame *myButtonFrame; ///< frame arround button representation - QToolButton *myThisButton; ///< main button + 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 }; #endif /* SRC_SHAPERGUI_NESTEDBUTTON_H_ */ diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.h b/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.h index fd98370e4..a2f7b4a1b 100644 --- a/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.h +++ b/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.h @@ -23,7 +23,7 @@ #include #include -//#include +// #include #include #include diff --git a/src/Selector/Selector_Algo.h b/src/Selector/Selector_Algo.h index f7612b161..4e4db376e 100644 --- a/src/Selector/Selector_Algo.h +++ b/src/Selector/Selector_Algo.h @@ -64,7 +64,7 @@ public: /// Initializes the algorithm SELECTOR_EXPORT Selector_Algo(); - virtual ~Selector_Algo() {} + virtual ~Selector_Algo() = default; /// Initializes the selector structure on the label. /// Stores the name data to restore after modification. diff --git a/src/Selector/Selector_NameGenerator.h b/src/Selector/Selector_NameGenerator.h index 53af8479f..b9eebc75d 100644 --- a/src/Selector/Selector_NameGenerator.h +++ b/src/Selector/Selector_NameGenerator.h @@ -35,7 +35,8 @@ class Selector_NameGenerator { public: /// empty constructor, nothing to add - Selector_NameGenerator(){}; + Selector_NameGenerator() = default; + ; /// This method returns the context name by the label of the sub-selected /// shape diff --git a/src/Selector/Selector_Primitive.h b/src/Selector/Selector_Primitive.h index 27d0764c9..59d44f915 100644 --- a/src/Selector/Selector_Primitive.h +++ b/src/Selector/Selector_Primitive.h @@ -36,23 +36,23 @@ public: SELECTOR_EXPORT void select(const TDF_Label theFinalLabel); /// 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_MacroArc.cpp b/src/SketchAPI/SketchAPI_MacroArc.cpp index b18c7a9d9..3d3e8d7fa 100644 --- a/src/SketchAPI/SketchAPI_MacroArc.cpp +++ b/src/SketchAPI/SketchAPI_MacroArc.cpp @@ -108,7 +108,7 @@ SketchAPI_MacroArc::SketchAPI_MacroArc( } //================================================================================================ -SketchAPI_MacroArc::~SketchAPI_MacroArc() {} +SketchAPI_MacroArc::~SketchAPI_MacroArc() = default; //================================================================================================ void SketchAPI_MacroArc::setByCenterStartEnd(double theCenterX, diff --git a/src/SketchAPI/SketchAPI_MacroArc.h b/src/SketchAPI/SketchAPI_MacroArc.h index e28721a82..ec1da3689 100644 --- a/src/SketchAPI/SketchAPI_MacroArc.h +++ b/src/SketchAPI/SketchAPI_MacroArc.h @@ -84,7 +84,7 @@ public: /// Destructor. SKETCHAPI_EXPORT - virtual ~SketchAPI_MacroArc(); + ~SketchAPI_MacroArc() override; INTERFACE_14( SketchPlugin_MacroArc::ID(), arcType, SketchPlugin_MacroArc::ARC_TYPE(), @@ -161,6 +161,6 @@ public: }; /// Pointer on Arc object. -typedef std::shared_ptr MacroArcPtr; +using MacroArcPtr = std::shared_ptr; #endif // SketchAPI_MacroArc_H_ diff --git a/src/SketchAPI/SketchAPI_MacroMiddlePoint.cpp b/src/SketchAPI/SketchAPI_MacroMiddlePoint.cpp index 30d48f55f..fa8f15e32 100644 --- a/src/SketchAPI/SketchAPI_MacroMiddlePoint.cpp +++ b/src/SketchAPI/SketchAPI_MacroMiddlePoint.cpp @@ -48,11 +48,10 @@ void SketchAPI_MacroMiddlePoint::createConstraint( // Find sketch CompositeFeaturePtr aSketch; const std::set &aRefs = feature()->data()->refsToMe(); - for (std::set::const_iterator anIt = aRefs.begin(); - anIt != aRefs.end(); ++anIt) - if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID()) { - aSketch = std::dynamic_pointer_cast( - (*anIt)->owner()); + for (const auto &aRef : aRefs) + if (aRef->id() == SketchPlugin_Sketch::FEATURES_ID()) { + aSketch = + std::dynamic_pointer_cast(aRef->owner()); break; } if (!aSketch) diff --git a/src/SketchAPI/SketchAPI_MacroMiddlePoint.h b/src/SketchAPI/SketchAPI_MacroMiddlePoint.h index 3634d3e67..b8b4b0e29 100644 --- a/src/SketchAPI/SketchAPI_MacroMiddlePoint.h +++ b/src/SketchAPI/SketchAPI_MacroMiddlePoint.h @@ -49,7 +49,7 @@ public: static const std::string MY_SKETCH_CONSTRAINT_ID = "MacroConstraintMiddle"; return MY_SKETCH_CONSTRAINT_ID; } - virtual std::string getID() { return ID(); } + std::string getID() override { return ID(); } protected: void createConstraint(const ModelHighAPI_RefAttr &theLine); diff --git a/src/SketchAPI/SketchAPI_Point.h b/src/SketchAPI/SketchAPI_Point.h index a6dd9e45b..446c9a48f 100644 --- a/src/SketchAPI/SketchAPI_Point.h +++ b/src/SketchAPI/SketchAPI_Point.h @@ -59,7 +59,7 @@ public: const std::wstring &theExternalName); /// Destructor SKETCHAPI_EXPORT - virtual ~SketchAPI_Point(); + ~SketchAPI_Point() override; INTERFACE_2(SketchPlugin_Point::ID(), coordinates, SketchPlugin_Point::COORD_ID(), GeomDataAPI_Point2D, @@ -86,11 +86,11 @@ public: /// Dump wrapped feature SKETCHAPI_EXPORT - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; }; //! Pointer on Point object -typedef std::shared_ptr PointPtr; +using PointPtr = std::shared_ptr; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/SketchAPI/SketchAPI_SketchEntity.h b/src/SketchAPI/SketchAPI_SketchEntity.h index 40c2664d4..39513cd50 100644 --- a/src/SketchAPI/SketchAPI_SketchEntity.h +++ b/src/SketchAPI/SketchAPI_SketchEntity.h @@ -43,7 +43,7 @@ public: const std::shared_ptr &theFeature); /// Destructor SKETCHAPI_EXPORT - virtual ~SketchAPI_SketchEntity(); + ~SketchAPI_SketchEntity() override; /// Auxiliary SKETCHAPI_EXPORT @@ -54,7 +54,7 @@ public: void setAuxiliary(bool theAuxiliary); /// Dump wrapped feature - virtual void dump(ModelHighAPI_Dumper &theDumper) const; + void dump(ModelHighAPI_Dumper &theDumper) const override; /// Convert list of features to list of appropriate wrappers SKETCHAPI_EXPORT @@ -71,7 +71,7 @@ protected: }; //! Pointer on SketchEntity object -typedef std::shared_ptr SketchEntityPtr; +using SketchEntityPtr = std::shared_ptr; //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- diff --git a/src/SketchPlugin/SketchPlugin_Arc.h b/src/SketchPlugin/SketchPlugin_Arc.h index 9c5dd8f72..d5aa5f2b7 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.h +++ b/src/SketchPlugin/SketchPlugin_Arc.h @@ -78,20 +78,20 @@ 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_Arc::ID(); return MY_KIND; } /// Returns true is sketch element is under the rigid constraint - SKETCHPLUGIN_EXPORT virtual bool isFixed(); + SKETCHPLUGIN_EXPORT bool isFixed() 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; /// Creates an arc-shape - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Updates the "reversed" flag /// \param isReversed whether the arc will be reversed @@ -105,7 +105,7 @@ public: protected: /// \brief Initializes attributes of derived class. - virtual void initDerivedClassAttributes(); + void initDerivedClassAttributes() override; private: /// to define in which direction draw arc diff --git a/src/SketchPlugin/SketchPlugin_BSpline.h b/src/SketchPlugin/SketchPlugin_BSpline.h index ec3dd265b..6a85f34f1 100644 --- a/src/SketchPlugin/SketchPlugin_BSpline.h +++ b/src/SketchPlugin/SketchPlugin_BSpline.h @@ -47,22 +47,22 @@ 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_BSpline::ID(); return MY_KIND; } /// 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; /// Use plugin manager for features creation SketchPlugin_BSpline(); protected: /// \brief Initializes attributes of derived class. - virtual void initDerivedClassAttributes(); + void initDerivedClassAttributes() override; - virtual bool isPeriodic() const { return false; } + bool isPeriodic() const override { return false; } }; #endif diff --git a/src/SketchPlugin/SketchPlugin_BSplineBase.h b/src/SketchPlugin/SketchPlugin_BSplineBase.h index b98cb27d1..6639b61a1 100644 --- a/src/SketchPlugin/SketchPlugin_BSplineBase.h +++ b/src/SketchPlugin/SketchPlugin_BSplineBase.h @@ -67,25 +67,26 @@ public: } /// Returns true is sketch element is under the rigid constraint - SKETCHPLUGIN_EXPORT virtual bool isFixed(); + SKETCHPLUGIN_EXPORT bool isFixed() 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; /// Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Updates the B-spline curve. /// \param[in] theActionId action key id (in following form: Action#Index) /// \return \c false in case the action not performed. - SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string &theActionId); + SKETCHPLUGIN_EXPORT bool + customAction(const std::string &theActionId) override; protected: /// Called from the derived class SketchPlugin_BSplineBase(); /// \brief Initializes attributes of derived class. - virtual void initDerivedClassAttributes(); + void initDerivedClassAttributes() override; /// \brief Return \c true if the B-spline curve is periodic virtual bool isPeriodic() const = 0; diff --git a/src/SketchPlugin/SketchPlugin_BSplinePeriodic.h b/src/SketchPlugin/SketchPlugin_BSplinePeriodic.h index 5d248f637..63aa2dcd9 100644 --- a/src/SketchPlugin/SketchPlugin_BSplinePeriodic.h +++ b/src/SketchPlugin/SketchPlugin_BSplinePeriodic.h @@ -36,7 +36,7 @@ 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_BSplinePeriodic::ID(); return MY_KIND; } @@ -45,7 +45,7 @@ public: SketchPlugin_BSplinePeriodic(); protected: - virtual bool isPeriodic() const { return true; } + bool isPeriodic() const override { return true; } }; #endif diff --git a/src/SketchPlugin/SketchPlugin_Circle.h b/src/SketchPlugin/SketchPlugin_Circle.h index a637febf5..0128b00ef 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.h +++ b/src/SketchPlugin/SketchPlugin_Circle.h @@ -50,26 +50,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_Circle::ID(); return MY_KIND; } /// Returns true is sketch element is under the rigid constraint - SKETCHPLUGIN_EXPORT virtual bool isFixed(); + SKETCHPLUGIN_EXPORT bool isFixed() 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; /// Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Use plugin manager for features creation SketchPlugin_Circle(); protected: /// \brief Initializes attributes of derived class. - virtual void initDerivedClassAttributes(); + void initDerivedClassAttributes() override; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_Constraint.h b/src/SketchPlugin/SketchPlugin_Constraint.h index ab3118f53..2b52e2e3e 100644 --- a/src/SketchPlugin/SketchPlugin_Constraint.h +++ b/src/SketchPlugin/SketchPlugin_Constraint.h @@ -88,6 +88,6 @@ protected: SketchPlugin_Constraint(); }; -typedef std::shared_ptr ConstraintPtr; +using ConstraintPtr = std::shared_ptr; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintBase.h b/src/SketchPlugin/SketchPlugin_ConstraintBase.h index 333709b48..a7f0bf2be 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintBase.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintBase.h @@ -57,7 +57,7 @@ class SketchPlugin_ConstraintBase : public SketchPlugin_Constraint, public GeomAPI_IPresentable { protected: /// \brief Use plugin manager for features creation - SketchPlugin_ConstraintBase() {} + SketchPlugin_ConstraintBase() = default; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h index 1d54ab5ad..b9a762897 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h @@ -45,21 +45,21 @@ 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_ConstraintCoincidence::ID(); return MY_KIND; } /// 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; /// Creates a constraint on two points /// \param theSketch a sketch feature diff --git a/src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp b/src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp index cdd644e97..066162a5e 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp @@ -31,7 +31,7 @@ #include -SketchPlugin_ConstraintEqual::SketchPlugin_ConstraintEqual() {} +SketchPlugin_ConstraintEqual::SketchPlugin_ConstraintEqual() = default; void SketchPlugin_ConstraintEqual::initAttributes() { data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), diff --git a/src/SketchPlugin/SketchPlugin_ConstraintEqual.h b/src/SketchPlugin/SketchPlugin_ConstraintEqual.h index 28b7c051d..dd3eac726 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintEqual.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintEqual.h @@ -41,21 +41,21 @@ public: return MY_CONSTRAINT_EQUAL_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_ConstraintEqual::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_ConstraintEqual(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp b/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp index ae28b92ab..163c4769f 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp @@ -28,7 +28,7 @@ #include #include -//#include +// #include #include diff --git a/src/SketchPlugin/SketchPlugin_ConstraintMiddle.h b/src/SketchPlugin/SketchPlugin_ConstraintMiddle.h index 6cd4afd92..7584f1822 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintMiddle.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintMiddle.h @@ -68,24 +68,24 @@ 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_ConstraintMiddle::ID(); return MY_KIND; } /// 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; /// \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_ConstraintMiddle(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.h b/src/SketchPlugin/SketchPlugin_ConstraintRadius.h index 601d2e5cd..e001d96f8 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.h @@ -42,7 +42,7 @@ public: return MY_CONSTRAINT_RADIUS_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_ConstraintRadius::ID(); return MY_KIND; } @@ -54,29 +54,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_ConstraintRadius(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRigid.h b/src/SketchPlugin/SketchPlugin_ConstraintRigid.h index c6c5ba388..d8f7184f5 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRigid.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintRigid.h @@ -43,21 +43,21 @@ public: return MY_CONSTRAINT_RIGID_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_ConstraintRigid::ID(); return MY_KIND; } /// 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_ConstraintRigid(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintTangent.h b/src/SketchPlugin/SketchPlugin_ConstraintTangent.h index e8800d7e1..a2c63e7af 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintTangent.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintTangent.h @@ -42,21 +42,21 @@ public: return MY_CONSTRAINT_TANGENT_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_ConstraintTangent::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_ConstraintTangent(); diff --git a/src/SketchPlugin/SketchPlugin_Ellipse.h b/src/SketchPlugin/SketchPlugin_Ellipse.h index d30f510cc..03a9f3105 100644 --- a/src/SketchPlugin/SketchPlugin_Ellipse.h +++ b/src/SketchPlugin/SketchPlugin_Ellipse.h @@ -88,26 +88,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_Ellipse::ID(); return MY_KIND; } /// Returns true is sketch element is under the rigid constraint - SKETCHPLUGIN_EXPORT virtual bool isFixed(); + SKETCHPLUGIN_EXPORT bool isFixed() 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; /// Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Use plugin manager for features creation SketchPlugin_Ellipse(); protected: /// \brief Initializes attributes of derived class. - virtual void initDerivedClassAttributes(); + void initDerivedClassAttributes() override; private: bool fillCharacteristicPoints(); diff --git a/src/SketchPlugin/SketchPlugin_EllipticArc.h b/src/SketchPlugin/SketchPlugin_EllipticArc.h index 284afc032..c979d9e4d 100644 --- a/src/SketchPlugin/SketchPlugin_EllipticArc.h +++ b/src/SketchPlugin/SketchPlugin_EllipticArc.h @@ -105,26 +105,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_EllipticArc::ID(); return MY_KIND; } /// Returns true is sketch element is under the rigid constraint - SKETCHPLUGIN_EXPORT virtual bool isFixed(); + SKETCHPLUGIN_EXPORT bool isFixed() 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; /// Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Use plugin manager for features creation SketchPlugin_EllipticArc(); protected: /// \brief Initializes attributes of derived class. - virtual void initDerivedClassAttributes(); + void initDerivedClassAttributes() override; private: bool fillCharacteristicPoints(); diff --git a/src/SketchPlugin/SketchPlugin_Feature.h b/src/SketchPlugin/SketchPlugin_Feature.h index 0580b9d81..7c2b29a0f 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.h +++ b/src/SketchPlugin/SketchPlugin_Feature.h @@ -41,7 +41,7 @@ class SketchPlugin_Feature : public ModelAPI_Feature { public: /// Returns true if this feature must be displayed in the history (top level /// of Part tree) - SKETCHPLUGIN_EXPORT virtual bool isInHistory() { return false; } + SKETCHPLUGIN_EXPORT bool isInHistory() override { return false; } /// Returns true of the feature is created basing on the external shape of /// not-this-sketch object diff --git a/src/SketchPlugin/SketchPlugin_Line.cpp b/src/SketchPlugin/SketchPlugin_Line.cpp index ee4643346..8dd6665a1 100644 --- a/src/SketchPlugin/SketchPlugin_Line.cpp +++ b/src/SketchPlugin/SketchPlugin_Line.cpp @@ -114,7 +114,7 @@ const std::string &SketchPlugin_Line::getKind() { } bool SketchPlugin_Line::isFixed() { - return data()->selection(EXTERNAL_ID())->context().get() != NULL; + return data()->selection(EXTERNAL_ID())->context().get() != nullptr; } void SketchPlugin_Line::attributeChanged(const std::string &theID) { diff --git a/src/SketchPlugin/SketchPlugin_Line.h b/src/SketchPlugin/SketchPlugin_Line.h index 216d8f0da..4b6cc2107 100644 --- a/src/SketchPlugin/SketchPlugin_Line.h +++ b/src/SketchPlugin/SketchPlugin_Line.h @@ -60,26 +60,26 @@ public: } /// Returns the kind of a feature - SKETCHPLUGIN_EXPORT virtual const std::string &getKind(); + SKETCHPLUGIN_EXPORT const std::string &getKind() override; /// Returns true is sketch element is under the rigid constraint - SKETCHPLUGIN_EXPORT virtual bool isFixed(); + SKETCHPLUGIN_EXPORT bool isFixed() override; /// Request for initialization of data model of the feature: adding all /// attributes - virtual void initAttributes(); + void initAttributes() override; /// Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Apply information of the message to current object. It fills start /// attribute of the current feature by last attribute of the message feature, /// build coincidence if message has selected object - virtual std::string - processEvent(const std::shared_ptr &theMessage); + std::string + processEvent(const std::shared_ptr &theMessage) 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; /// Use plugin manager for features creation SketchPlugin_Line(); @@ -91,7 +91,7 @@ private: protected: /// \brief Initializes attributes of derived class. - virtual void initDerivedClassAttributes(); + void initDerivedClassAttributes() override; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_MacroArc.h b/src/SketchPlugin/SketchPlugin_MacroArc.h index bf0a17371..ea57f40a5 100644 --- a/src/SketchPlugin/SketchPlugin_MacroArc.h +++ b/src/SketchPlugin/SketchPlugin_MacroArc.h @@ -176,34 +176,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_MacroArc::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 /// \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 - virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); + AISObjectPtr getAISObject(AISObjectPtr thePrevious) override; /// Creates an arc-shape - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; /// Reimplemented from ModelAPI_Feature::isMacro(). - 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_MacroArc(); diff --git a/src/SketchPlugin/SketchPlugin_Offset.cpp b/src/SketchPlugin/SketchPlugin_Offset.cpp index 9225f35f5..2e2a78ed0 100644 --- a/src/SketchPlugin/SketchPlugin_Offset.cpp +++ b/src/SketchPlugin/SketchPlugin_Offset.cpp @@ -70,7 +70,7 @@ static const double tolerance = 1.e-7; -SketchPlugin_Offset::SketchPlugin_Offset() {} +SketchPlugin_Offset::SketchPlugin_Offset() = default; void SketchPlugin_Offset::initAttributes() { AttributeRefListPtr anEdgesAttr = @@ -236,7 +236,7 @@ void SketchPlugin_Offset::execute() { // 5.c. Make wire ListOfShape aTopoChain; - std::list::iterator aChainIt = aChain.begin(); + auto aChainIt = aChain.begin(); for (; aChainIt != aChain.end(); ++aChainIt) { FeaturePtr aChainFeature = (*aChainIt); GeomShapePtr aTopoEdge = aChainFeature->lastResult()->shape(); @@ -320,7 +320,7 @@ bool SketchPlugin_Offset::findWireOneWay( std::set aCoincPoints = SketchPlugin_Tools::findPointsCoincidentToPoint(theEndPoint); - std::set::iterator aPointsIt = aCoincPoints.begin(); + auto aPointsIt = aCoincPoints.begin(); for (; aPointsIt != aCoincPoints.end(); aPointsIt++) { AttributePoint2DPtr aP = (*aPointsIt); FeaturePtr aCoincFeature = @@ -446,9 +446,8 @@ void SketchPlugin_Offset::addToSketch(const ListOfMakeShape &theOffsetAlgos) { std::map> aMapExistent; std::list anObjectsToRemove; std::list aSelectedList = aSelectedRefList->list(); - for (std::list::iterator aSIt = aSelectedList.begin(); - aSIt != aSelectedList.end(); ++aSIt) { - aMapExistent[*aSIt] = std::list(); + for (auto &aSIt : aSelectedList) { + aMapExistent[aSIt] = std::list(); } for (int anIndex = 0, aSize = anOffsetRefList->size(); anIndex < aSize; ++anIndex) { @@ -456,8 +455,7 @@ void SketchPlugin_Offset::addToSketch(const ListOfMakeShape &theOffsetAlgos) { int aBaseIndex = anOffsetToBaseMap->value(anIndex); if (aBaseIndex >= 0) { ObjectPtr aBaseObj = aBaseRefList->object(aBaseIndex); - std::map>::iterator aFound = - aMapExistent.find(aBaseObj); + auto aFound = aMapExistent.find(aBaseObj); if (aFound != aMapExistent.end()) aFound->second.push_back(aCurrent); else @@ -472,34 +470,31 @@ void SketchPlugin_Offset::addToSketch(const ListOfMakeShape &theOffsetAlgos) { int aBaseListIndex = 0, anOffsetListIndex = 0; std::list anOffsetBaseBackRefs; std::set aProcessedOffsets; - for (std::list::iterator aSIt = aSelectedList.begin(); - aSIt != aSelectedList.end(); ++aSIt) { + for (auto &aSIt : aSelectedList) { // find an offseted edge - FeaturePtr aBaseFeature = ModelAPI_Feature::feature(*aSIt); + FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aSIt); GeomShapePtr aBaseShape = aBaseFeature->lastResult()->shape(); ListOfShape aNewShapes; - for (ListOfMakeShape::const_iterator anAlgoIt = theOffsetAlgos.begin(); - anAlgoIt != theOffsetAlgos.end(); ++anAlgoIt) { - (*anAlgoIt)->generated(aBaseShape, aNewShapes); + for (const auto &theOffsetAlgo : theOffsetAlgos) { + theOffsetAlgo->generated(aBaseShape, aNewShapes); if (!aNewShapes.empty()) { - reorderShapes(aNewShapes, (*anAlgoIt)->shape()); + reorderShapes(aNewShapes, theOffsetAlgo->shape()); break; } } // store base feature - setRefListValue(aBaseRefList, aBaseListSize, *aSIt, aBaseListIndex); + setRefListValue(aBaseRefList, aBaseListSize, aSIt, aBaseListIndex); // create or update an offseted feature - const std::list &anImages = aMapExistent[*aSIt]; - std::list::const_iterator anImgIt = anImages.begin(); - for (ListOfShape::iterator aNewIt = aNewShapes.begin(); - aNewIt != aNewShapes.end(); ++aNewIt) { + const std::list &anImages = aMapExistent[aSIt]; + auto anImgIt = anImages.begin(); + for (auto &aNewShape : aNewShapes) { FeaturePtr aNewFeature; if (anImgIt != anImages.end()) aNewFeature = ModelAPI_Feature::feature(*anImgIt++); - updateExistentOrCreateNew(*aNewIt, aNewFeature, anObjectsToRemove); - aProcessedOffsets.insert(*aNewIt); + updateExistentOrCreateNew(aNewShape, aNewFeature, anObjectsToRemove); + aProcessedOffsets.insert(aNewShape); // store an offseted feature setRefListValue(anOffsetRefList, anOffsetListSize, aNewFeature, @@ -512,9 +507,8 @@ void SketchPlugin_Offset::addToSketch(const ListOfMakeShape &theOffsetAlgos) { anObjectsToRemove.insert(anObjectsToRemove.end(), anImgIt, anImages.end()); } // create arcs generated from vertices - for (ListOfMakeShape::const_iterator anAlgoIt = theOffsetAlgos.begin(); - anAlgoIt != theOffsetAlgos.end(); ++anAlgoIt) { - GeomShapePtr aCurWire = (*anAlgoIt)->shape(); + for (const auto &theOffsetAlgo : theOffsetAlgos) { + GeomShapePtr aCurWire = theOffsetAlgo->shape(); GeomAPI_ShapeExplorer anExp(aCurWire, GeomAPI_Shape::EDGE); for (; anExp.more(); anExp.next()) { GeomShapePtr aCurEdge = anExp.current(); @@ -538,16 +532,14 @@ void SketchPlugin_Offset::addToSketch(const ListOfMakeShape &theOffsetAlgos) { anOffsetToBaseMap->setSize((int)anOffsetBaseBackRefs.size(), false); int anIndex = 0; - for (std::list::iterator anIt = anOffsetBaseBackRefs.begin(); - anIt != anOffsetBaseBackRefs.end(); ++anIt) { - anOffsetToBaseMap->setValue(anIndex++, *anIt, false); + for (int &anOffsetBaseBackRef : anOffsetBaseBackRefs) { + anOffsetToBaseMap->setValue(anIndex++, anOffsetBaseBackRef, false); } // remove unused objects std::set aSet; - for (std::list::iterator anIt = anObjectsToRemove.begin(); - anIt != anObjectsToRemove.end(); ++anIt) { - FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); + for (auto &anIt : anObjectsToRemove) { + FeaturePtr aFeature = ModelAPI_Feature::feature(anIt); if (aFeature) aSet.insert(aFeature); } @@ -568,8 +560,8 @@ static void findOrCreateFeatureByKind(SketchPlugin_Sketch *theSketch, } if (!theFeature) { // try to find appropriate feature in the pool - for (std::list::iterator it = thePoolOfFeatures.begin(); - it != thePoolOfFeatures.end(); ++it) { + for (auto it = thePoolOfFeatures.begin(); it != thePoolOfFeatures.end(); + ++it) { FeaturePtr aCurFeature = ModelAPI_Feature::feature(*it); if (aCurFeature->getKind() == theFeatureKind) { theFeature = aCurFeature; @@ -701,9 +693,8 @@ void SketchPlugin_Offset::updateExistentOrCreateNew( Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY); ModelAPI_EventCreator::get()->sendUpdated(theFeature, aRedisplayEvent); const std::list &aResults = theFeature->results(); - for (std::list::const_iterator anIt = aResults.begin(); - anIt != aResults.end(); ++anIt) - ModelAPI_EventCreator::get()->sendUpdated(*anIt, aRedisplayEvent); + for (const auto &aResult : aResults) + ModelAPI_EventCreator::get()->sendUpdated(aResult, aRedisplayEvent); } } @@ -728,7 +719,7 @@ void SketchPlugin_Offset::mkBSpline(FeaturePtr &theResult, theResult->attribute(SketchPlugin_BSpline::POLES_ID())); std::list aPoles = aBSpline->poles(); aPolesAttr->setSize((int)aPoles.size()); - std::list::iterator anIt = aPoles.begin(); + auto anIt = aPoles.begin(); for (int anIndex = 0; anIt != aPoles.end(); ++anIt, ++anIndex) { GeomPnt2dPtr aPoleInSketch = sketch()->to2D(*anIt); aPolesAttr->setPnt(anIndex, aPoleInSketch); @@ -744,7 +735,7 @@ void SketchPlugin_Offset::mkBSpline(FeaturePtr &theResult, aWeightsAttr->setValue(anIndex, 1.0); } else { // non-rational B-spline aWeightsAttr->setSize((int)aWeights.size()); - std::list::iterator aWIt = aWeights.begin(); + auto aWIt = aWeights.begin(); for (int anIndex = 0; aWIt != aWeights.end(); ++aWIt, ++anIndex) aWeightsAttr->setValue(anIndex, *aWIt); } @@ -754,7 +745,7 @@ void SketchPlugin_Offset::mkBSpline(FeaturePtr &theResult, std::list aKnots = aBSpline->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); @@ -763,7 +754,7 @@ void SketchPlugin_Offset::mkBSpline(FeaturePtr &theResult, std::list aMultiplicities = aBSpline->mults(); aSize = (int)aMultiplicities.size(); aMultsAttr->setSize(aSize); - std::list::iterator aMIt = aMultiplicities.begin(); + auto aMIt = aMultiplicities.begin(); for (int index = 0; index < aSize; ++index, ++aMIt) aMultsAttr->setValue(index, *aMIt); } @@ -777,9 +768,8 @@ void SketchPlugin_Offset::attributeChanged(const std::string &theID) { reflist(SketchPlugin_Constraint::ENTITY_B()); std::list anOffsetList = anOffsetAttr->list(); std::set aFeaturesToBeRemoved; - for (std::list::iterator anIt = anOffsetList.begin(); - anIt != anOffsetList.end(); ++anIt) { - FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt); + for (auto &anIt : anOffsetList) { + FeaturePtr aFeature = ModelAPI_Feature::feature(anIt); if (aFeature) aFeaturesToBeRemoved.insert(aFeature); } @@ -853,7 +843,7 @@ bool SketchPlugin_Offset::findWires() { aProcessedEdgesSet, aChain, false); } - std::list::iterator aChainIt = aChain.begin(); + auto aChainIt = aChain.begin(); for (; aChainIt != aChain.end(); ++aChainIt) { FeaturePtr aChainFeature = (*aChainIt); if (aSelectedSet.find(aChainFeature) == aSelectedSet.end()) { @@ -895,26 +885,26 @@ void SketchPlugin_Offset::makeFillet( // find vertices for fillet 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; // both edges should be linear ListOfShape anEdges; - anEdges.insert(anEdges.end(), anIt->second.begin(), anIt->second.end()); + anEdges.insert(anEdges.end(), aSubshape.second.begin(), + aSubshape.second.end()); GeomEdgePtr anEdge1(new GeomAPI_Edge(anEdges.front())); GeomEdgePtr anEdge2(new GeomAPI_Edge(anEdges.back())); if (!anEdge1->isLine() || !anEdge2->isLine()) continue; // skip vertices, which smoothly connect adjacent edges - 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()) { @@ -935,13 +925,12 @@ void SketchPlugin_Offset::makeFillet( if (aFailedVertices.size() != 0) { // Exclude failed vertices and also vertices, joined // with failed by one edge, and run algorithm once again - ListOfShape::iterator itVertices = aFailedVertices.begin(); + auto itVertices = aFailedVertices.begin(); for (; itVertices != aFailedVertices.end(); itVertices++) { GeomShapePtr aFailedVertex = *itVertices; aFilletVertices.erase(aFailedVertex); // remove also neighbour vertices - MapShapeToShapes::const_iterator anIt = - aSubshapes.find(aFailedVertex); + auto anIt = aSubshapes.find(aFailedVertex); if (anIt != aSubshapes.end()) { // should be always true ListOfShape anEdges; anEdges.insert(anEdges.end(), anIt->second.begin(), diff --git a/src/SketchPlugin/SketchPlugin_Offset.h b/src/SketchPlugin/SketchPlugin_Offset.h index be0c45970..8bc82d860 100644 --- a/src/SketchPlugin/SketchPlugin_Offset.h +++ b/src/SketchPlugin/SketchPlugin_Offset.h @@ -45,7 +45,7 @@ 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_Offset::ID(); return MY_KIND; } @@ -105,30 +105,31 @@ public: } /// 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; /// Creates a new part document if needed - SKETCHPLUGIN_EXPORT virtual void execute(); + SKETCHPLUGIN_EXPORT void execute() override; - SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return true; } + SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return true; } /// Find edges connected by coincident boundary constraint and composing a /// wire with the already selected segments. It means that not more than 2 /// edges can be connected with the coincident point. \param[in] theActionId /// action key id (in following form: Action#Index) \return \c false in case /// the action not performed. - SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string &theActionId); + SKETCHPLUGIN_EXPORT bool + customAction(const std::string &theActionId) override; /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual AISObjectPtr - getAISObject(AISObjectPtr thePrevious); + SKETCHPLUGIN_EXPORT AISObjectPtr + getAISObject(AISObjectPtr thePrevious) override; /// Use plugin manager for features creation. SketchPlugin_Offset(); protected: /// \brief Initializes attributes of derived class. - virtual void initAttributes(); + void initAttributes() override; private: /// Find all wires connected with the selected edges diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index 7650e73fc..fa606d13e 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -90,7 +90,7 @@ #define SKETCH_OVERCONSTRAINT_COLOR "255,0,0" #define SKETCH_FULLY_CONSTRAINED_COLOR "0,150,0" -//#define SET_PLANES_COLOR_IN_PREFERENCES +// #define SET_PLANES_COLOR_IN_PREFERENCES // the only created instance of this plugin static SketchPlugin_Plugin *MY_SKETCH_INSTANCE = new SketchPlugin_Plugin(); diff --git a/src/SketchPlugin/SketchPlugin_Point.h b/src/SketchPlugin/SketchPlugin_Point.h index 26828c0b2..1669dedc0 100644 --- a/src/SketchPlugin/SketchPlugin_Point.h +++ b/src/SketchPlugin/SketchPlugin_Point.h @@ -43,27 +43,27 @@ public: return MY_COORD_ID; } /// 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_Point::ID(); return MY_KIND; } /// Returns true is sketch element is under the rigid constraint - SKETCHPLUGIN_EXPORT virtual bool isFixed(); + SKETCHPLUGIN_EXPORT bool isFixed() override; /// 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_Point(); protected: /// \brief Initializes attributes of derived class. - virtual void initDerivedClassAttributes(); + void initDerivedClassAttributes() override; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_Projection.cpp b/src/SketchPlugin/SketchPlugin_Projection.cpp index 25258b3cb..24a209fc8 100644 --- a/src/SketchPlugin/SketchPlugin_Projection.cpp +++ b/src/SketchPlugin/SketchPlugin_Projection.cpp @@ -69,7 +69,7 @@ static bool isKeepReference(AttributeStringPtr theAttr) { } SketchPlugin_Projection::SketchPlugin_Projection() - : SketchPlugin_SketchEntity(), myIsComputing(false) {} + : SketchPlugin_SketchEntity() {} void SketchPlugin_Projection::initDerivedClassAttributes() { data()->addAttribute(EXTERNAL_FEATURE_ID(), @@ -117,7 +117,7 @@ void SketchPlugin_Projection::execute() { FeaturePtr aProjection = ModelAPI_Feature::feature(aRefAttr->object()); if (isKeepReference(string(KEEP_REFERENCE_ID())) && !lastResult().get()) { - bool hasProjResult = aProjection->lastResult().get() != NULL; + bool hasProjResult = aProjection->lastResult().get() != nullptr; ResultConstructionPtr aConstr = document()->createConstruction(data()); if (hasProjResult) aConstr->setShape(aProjection->lastResult()->shape()); @@ -598,7 +598,7 @@ bool SketchPlugin_Projection::fillBSpline(FeaturePtr &theProjection, theProjection->attribute(SketchPlugin_BSpline::POLES_ID())); std::list aPoles = aBSpline.poles(); aPolesAttr->setSize((int)aPoles.size()); - std::list::iterator anIt = aPoles.begin(); + auto anIt = aPoles.begin(); for (int anIndex = 0; anIt != aPoles.end(); ++anIt, ++anIndex) { GeomPnt2dPtr aPoleInSketch = sketch()->to2D(*anIt); aPolesAttr->setPnt(anIndex, aPoleInSketch); @@ -614,7 +614,7 @@ bool SketchPlugin_Projection::fillBSpline(FeaturePtr &theProjection, aWeightsAttr->setValue(anIndex, 1.0); } else { // non-rational B-spline aWeightsAttr->setSize((int)aWeights.size()); - std::list::iterator aWIt = aWeights.begin(); + auto aWIt = aWeights.begin(); for (int anIndex = 0; aWIt != aWeights.end(); ++aWIt, ++anIndex) aWeightsAttr->setValue(anIndex, *aWIt); } @@ -624,7 +624,7 @@ bool SketchPlugin_Projection::fillBSpline(FeaturePtr &theProjection, std::list aKnots = aBSpline.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); @@ -633,7 +633,7 @@ bool SketchPlugin_Projection::fillBSpline(FeaturePtr &theProjection, std::list aMultiplicities = aBSpline.mults(); aSize = (int)aMultiplicities.size(); aMultsAttr->setSize(aSize); - std::list::iterator aMIt = aMultiplicities.begin(); + auto aMIt = aMultiplicities.begin(); for (int index = 0; index < aSize; ++index, ++aMIt) aMultsAttr->setValue(index, *aMIt); diff --git a/src/SketchPlugin/SketchPlugin_Projection.h b/src/SketchPlugin/SketchPlugin_Projection.h index fc1498511..b5768b9e5 100644 --- a/src/SketchPlugin/SketchPlugin_Projection.h +++ b/src/SketchPlugin/SketchPlugin_Projection.h @@ -38,7 +38,7 @@ public: return MY_PROJECTION_ID; } /// Returns the kind of a feature - virtual const std::string &getKind() { + const std::string &getKind() override { static std::string MY_KIND = SketchPlugin_Projection::ID(); return MY_KIND; } @@ -74,34 +74,34 @@ public: } /// Returns true because projected feature 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 - SKETCHPLUGIN_EXPORT virtual bool canBeDisplayed() const { return false; } + SKETCHPLUGIN_EXPORT 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; /// Returns true if this feature is used as macro: creates other features and /// then removed. This feature may change its macro-state according to /// selected item. \returns false by default - SKETCHPLUGIN_EXPORT virtual bool isMacro() const; + SKETCHPLUGIN_EXPORT bool isMacro() const override; /// Use plugin manager for features creation SketchPlugin_Projection(); protected: /// \brief Initializes attributes of derived class. - virtual void initDerivedClassAttributes(); + void initDerivedClassAttributes() override; /// \brief Initializes attributes of keeping the reference to the original /// shape. - virtual void initDerivedClassAttributes2(); + void initDerivedClassAttributes2() override; private: /// \brief Find projection of a feature onto sketch plane @@ -151,7 +151,7 @@ private: FeaturePtr &theProjection, const std::set &theSupportedTypes, const std::string &theRequestedFeature = std::string()); - bool myIsComputing; + bool myIsComputing{false}; }; #endif diff --git a/src/SketchPlugin/SketchPlugin_Sketch.h b/src/SketchPlugin/SketchPlugin_Sketch.h index 82def5a2b..19feddf81 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.h +++ b/src/SketchPlugin/SketchPlugin_Sketch.h @@ -93,17 +93,17 @@ 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_Sketch::ID(); return MY_KIND; } /// Creates a new part document if needed - 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; /// Converts a 2D sketch space point into point in 3D space /// \param theX an X coordinate @@ -151,7 +151,7 @@ public: /// Returns true if this feature must be displayed in the history (top level /// of Part tree) - SKETCHPLUGIN_EXPORT virtual bool isInHistory() { return true; } + SKETCHPLUGIN_EXPORT bool isInHistory() override { return true; } /// Use plugin manager for features creation SketchPlugin_Sketch(); @@ -204,32 +204,33 @@ public: } /// appends a feature to the sketch sub-elements container - SKETCHPLUGIN_EXPORT virtual std::shared_ptr - addFeature(std::string theID); + SKETCHPLUGIN_EXPORT std::shared_ptr + addFeature(std::string theID) override; /// Just to synchronise the container of sub-features - virtual void removeFeature(std::shared_ptr theFeature); + void removeFeature(std::shared_ptr theFeature) override; /// Returns the number of sub-elements - SKETCHPLUGIN_EXPORT virtual int numberOfSubs(bool forTree = false) const; + SKETCHPLUGIN_EXPORT int numberOfSubs(bool forTree = false) const override; /// Returns the sub-feature by zero-base index - SKETCHPLUGIN_EXPORT virtual std::shared_ptr - subFeature(const int theIndex, bool forTree = false); + SKETCHPLUGIN_EXPORT std::shared_ptr + subFeature(const int theIndex, bool forTree = false) override; /// Returns the sub-feature unique identifier in this composite feature by /// index - SKETCHPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const; + SKETCHPLUGIN_EXPORT int subFeatureId(const int theIndex) const override; /// Returns true if feature or reuslt belong to this composite feature as subs - SKETCHPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const; + SKETCHPLUGIN_EXPORT bool isSub(ObjectPtr theObject) const override; - SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID); + SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override; /// Performs some custom feature specific functionality (normally called by /// some GUI button) \param theActionId an action key \return a boolean value /// about it is performed - SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string &theActionId); + SKETCHPLUGIN_EXPORT bool + customAction(const std::string &theActionId) override; /// \brief Create a result for the point in the attribute if the attribute is /// initialized \param theFeature a source feature \param theSketch a sketch diff --git a/src/SketchPlugin/SketchPlugin_SketchEntity.h b/src/SketchPlugin/SketchPlugin_SketchEntity.h index cc7a97d65..8667c5e14 100644 --- a/src/SketchPlugin/SketchPlugin_SketchEntity.h +++ b/src/SketchPlugin/SketchPlugin_SketchEntity.h @@ -72,34 +72,34 @@ public: } /// Width of the auxiliary line - inline static const int SKETCH_LINE_WIDTH_AUXILIARY() { return 2; } + inline static int SKETCH_LINE_WIDTH_AUXILIARY() { return 2; } /// Width of the line - inline static const int SKETCH_LINE_WIDTH() { + inline static int SKETCH_LINE_WIDTH() { return Config_PropManager::integer("Visualization", "sketch_line_width"); } /// Style of the auxiliary line - inline static const int SKETCH_LINE_STYLE_AUXILIARY() { return 3; } + inline static int SKETCH_LINE_STYLE_AUXILIARY() { return 3; } /// Style of the line - inline static const int SKETCH_LINE_STYLE() { return 0; } + inline static int SKETCH_LINE_STYLE() { return 0; } /// Request for initialization of data model of the feature: adding all /// attributes - virtual void initAttributes(); + void initAttributes() override; /// Returns true of the feature is created basing on the external shape of /// not-this-sketch object - virtual bool isExternal() const { + bool isExternal() const override { AttributeSelectionPtr aAttr = data()->selection(EXTERNAL_ID()); if (aAttr) - return aAttr->context().get() != NULL && !aAttr->isInvalid(); + return aAttr->context().get() != nullptr && !aAttr->isInvalid(); return false; } /// Returns true of the feature is a copy of other feature - virtual bool isCopy() const { + bool isCopy() const override { AttributeBooleanPtr anAttr = data()->boolean(COPY_ID()); if (anAttr.get()) { return anAttr->value(); diff --git a/src/SketchPlugin/SketchPlugin_Split.cpp b/src/SketchPlugin/SketchPlugin_Split.cpp index 9219f4288..4e066a650 100644 --- a/src/SketchPlugin/SketchPlugin_Split.cpp +++ b/src/SketchPlugin/SketchPlugin_Split.cpp @@ -66,7 +66,7 @@ #include -//#define CREATE_CONSTRAINTS +// #define CREATE_CONSTRAINTS #ifdef DEBUG_SPLIT #include diff --git a/src/SketcherPrs/SketcherPrs_Angle.cpp b/src/SketcherPrs/SketcherPrs_Angle.cpp index 2a3991bbe..1148977e3 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.cpp +++ b/src/SketcherPrs/SketcherPrs_Angle.cpp @@ -55,9 +55,9 @@ extern void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, #define PI 3.1415926535897932 -//#ifndef WNT -// #define COMPILATION_CORRECTION -//#endif +// #ifndef WNT +// #define COMPILATION_CORRECTION +// #endif IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Angle, PrsDim_AngleDimension); diff --git a/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp b/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp index d0f74d31e..2a55ff687 100644 --- a/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp +++ b/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp @@ -30,9 +30,9 @@ #include #include -//#ifndef WNT -// #define COMPILATION_CORRECTION -//#endif +// #ifndef WNT +// #define COMPILATION_CORRECTION +// #endif // it is not possible to use 0x2211 as summ symbol because it is not supported // by debian Linux platform diff --git a/src/SketcherPrs/SketcherPrs_DimensionStyle.h b/src/SketcherPrs/SketcherPrs_DimensionStyle.h index 87c742b7b..f2ebe93ea 100644 --- a/src/SketcherPrs/SketcherPrs_DimensionStyle.h +++ b/src/SketcherPrs/SketcherPrs_DimensionStyle.h @@ -21,7 +21,7 @@ #ifndef SketcherPrs_DimensionStyleListener_H #define SketcherPrs_DimensionStyleListener_H -//#include +// #include #include #include diff --git a/src/SketcherPrs/SketcherPrs_Radius.h b/src/SketcherPrs/SketcherPrs_Radius.h index ca3561497..57ce7ee14 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.h +++ b/src/SketcherPrs/SketcherPrs_Radius.h @@ -45,7 +45,7 @@ public: SketchPlugin_Sketch *theSketcher); /// Destructor - Standard_EXPORT ~SketcherPrs_Radius(); + Standard_EXPORT ~SketcherPrs_Radius() override; DEFINE_STANDARD_RTTIEXT(SketcherPrs_Radius, PrsDim_RadiusDimension) @@ -75,15 +75,15 @@ private: 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: /// Constraint feature diff --git a/src/XGUI/XGUI.h b/src/XGUI/XGUI.h index e7de74f92..533600072 100644 --- a/src/XGUI/XGUI.h +++ b/src/XGUI/XGUI.h @@ -21,7 +21,7 @@ #ifndef XGUI_H #define XGUI_H -//#define BEFORE_TRIHEDRON_PATCH +// #define BEFORE_TRIHEDRON_PATCH #if defined XGUI_EXPORTS #if defined WIN32 diff --git a/src/XGUI/XGUI_ActiveControlMgr.cpp b/src/XGUI/XGUI_ActiveControlMgr.cpp index c07776151..7df22ee6b 100644 --- a/src/XGUI/XGUI_ActiveControlMgr.cpp +++ b/src/XGUI/XGUI_ActiveControlMgr.cpp @@ -28,7 +28,7 @@ #include #include -//#define DEBUG_ACTIVE_SELECTOR +// #define DEBUG_ACTIVE_SELECTOR #ifdef DEBUG_ACTIVE_SELECTOR void debugInfo(const QString &theMessage, @@ -42,7 +42,7 @@ void debugInfo(const QString &theMessage, //******************************************************************** XGUI_ActiveControlMgr::XGUI_ActiveControlMgr(ModuleBase_IWorkshop *theWorkshop) - : myWorkshop(theWorkshop), myActiveSelector(0), myIsBlocked(false) { + : myWorkshop(theWorkshop) { connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); } @@ -59,7 +59,7 @@ void XGUI_ActiveControlMgr::addSelector( //******************************************************************** XGUI_ActiveControlSelector * XGUI_ActiveControlMgr::getSelector(const QString &theType) { - XGUI_ActiveControlSelector *aSelector = 0; + XGUI_ActiveControlSelector *aSelector = nullptr; for (int i = 0, aCount = mySelectors.count(); i < aCount; i++) { if (mySelectors[i]->getType() != theType) continue; @@ -71,8 +71,7 @@ XGUI_ActiveControlMgr::getSelector(const QString &theType) { //******************************************************************** void XGUI_ActiveControlMgr::onSelectorActivated() { - XGUI_ActiveControlSelector *aSelector = - qobject_cast(sender()); + auto *aSelector = qobject_cast(sender()); if (!aSelector || aSelector == myActiveSelector) return; @@ -96,8 +95,7 @@ void XGUI_ActiveControlMgr::onSelectorActivated() { //******************************************************************** void XGUI_ActiveControlMgr::onSelectorDeactivated() { - XGUI_ActiveControlSelector *aSelector = - qobject_cast(sender()); + auto *aSelector = qobject_cast(sender()); deactivateSelector(aSelector); } @@ -112,9 +110,9 @@ void XGUI_ActiveControlMgr::deactivateSelector( myIsBlocked = true; myActiveSelector->setActive(false); - activateSelector(NULL); + activateSelector(nullptr); - XGUI_ActiveControlSelector *aSelectorToBeActivated = 0; + XGUI_ActiveControlSelector *aSelectorToBeActivated = nullptr; for (int i = 0, aCount = mySelectors.count(); i < aCount; i++) { if (!mySelectors[i]->needToBeActivated()) continue; diff --git a/src/XGUI/XGUI_ActiveControlMgr.h b/src/XGUI/XGUI_ActiveControlMgr.h index 511bdfb23..552a22059 100644 --- a/src/XGUI/XGUI_ActiveControlMgr.h +++ b/src/XGUI/XGUI_ActiveControlMgr.h @@ -41,7 +41,8 @@ public: /// \param theWorkshop the current workshop instance XGUI_EXPORT XGUI_ActiveControlMgr(ModuleBase_IWorkshop *theWorkshop); - XGUI_EXPORT virtual ~XGUI_ActiveControlMgr(){}; + XGUI_EXPORT ~XGUI_ActiveControlMgr() override = default; + ; /// Register selector to process activation of control void addSelector(XGUI_ActiveControlSelector *theSelector); @@ -74,9 +75,10 @@ protected: ModuleBase_IWorkshop *myWorkshop; ///< the current workshop QList mySelectors; ///< workshop selectors - XGUI_ActiveControlSelector *myActiveSelector; ///< active selector + XGUI_ActiveControlSelector *myActiveSelector{0}; ///< active selector - bool myIsBlocked; ///< blocking flag to avoid cycling signals processing + bool myIsBlocked{ + false}; ///< blocking flag to avoid cycling signals processing }; #endif diff --git a/src/XGUI/XGUI_ActiveControlSelector.h b/src/XGUI/XGUI_ActiveControlSelector.h index 043040f0e..3f7004b16 100644 --- a/src/XGUI/XGUI_ActiveControlSelector.h +++ b/src/XGUI/XGUI_ActiveControlSelector.h @@ -36,9 +36,11 @@ class XGUI_ActiveControlSelector : public QObject { public: /// Constructor /// \param theWorkshop the current workshop instance - XGUI_EXPORT XGUI_ActiveControlSelector(){}; + XGUI_EXPORT XGUI_ActiveControlSelector() = default; + ; /// Destructor - XGUI_EXPORT virtual ~XGUI_ActiveControlSelector(){}; + XGUI_EXPORT ~XGUI_ActiveControlSelector() override = default; + ; /// Returns name of the selector XGUI_EXPORT virtual QString getType() = 0; diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 185a54e23..4e5fb997f 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -36,7 +36,7 @@ #include #endif -//#include "PartSetPlugin_Part.h" +// #include "PartSetPlugin_Part.h" #include #include diff --git a/src/XGUI/XGUI_DataModel.h b/src/XGUI/XGUI_DataModel.h index 5bdcf3fe5..6c351dddb 100644 --- a/src/XGUI/XGUI_DataModel.h +++ b/src/XGUI/XGUI_DataModel.h @@ -52,7 +52,7 @@ public: XGUI_DataModel(QObject *theParent); /// Destructor - virtual ~XGUI_DataModel(); + ~XGUI_DataModel() override; void setRoot(ModuleBase_ITreeNode *theRoot) { myRoot = theRoot; } @@ -60,7 +60,7 @@ public: /// Event Listener method /// \param theMessage an event message - virtual void processEvent(const std::shared_ptr &theMessage); + void processEvent(const std::shared_ptr &theMessage) override; //! Returns an object by the given Model index. //! Returns 0 if the given index is not index of an object @@ -80,73 +80,73 @@ public: /// Returns the data stored under the given role for the item referred to by /// the index. \param theIndex a model index \param theRole a data role (see /// Qt::ItemDataRole) - virtual QVariant data(const QModelIndex &theIndex, int theRole) const; + QVariant data(const QModelIndex &theIndex, int theRole) const override; /// Returns the data for the given role and section in the header with the /// specified orientation. \param theSection a section \param theOrient an /// orientation \param theRole a data role (see Qt::ItemDataRole) - virtual QVariant headerData(int theSection, Qt::Orientation theOrient, - int theRole = Qt::DisplayRole) const; + QVariant headerData(int theSection, Qt::Orientation theOrient, + int theRole = Qt::DisplayRole) const override; /// Returns the number of rows under the given parent. When the parent is /// valid it means that rowCount is returning the number of children of /// parent. \param theParent a parent model index - virtual int rowCount(const QModelIndex &theParent = QModelIndex()) const; + int rowCount(const QModelIndex &theParent = QModelIndex()) const override; /// Returns the number of columns for the children of the given parent. /// It has a one column /// \param theParent a parent model index - virtual int columnCount(const QModelIndex &theParent = QModelIndex()) const; + int columnCount(const QModelIndex &theParent = QModelIndex()) const override; /// Returns the index of the item in the model specified by the given row, /// column and parent index. /// \param theRow a row /// \param theColumn a column /// \param theParent a parent model index - virtual QModelIndex index(int theRow, int theColumn, - const QModelIndex &theParent = QModelIndex()) const; + QModelIndex + index(int theRow, int theColumn, + const QModelIndex &theParent = QModelIndex()) const override; /// Returns the parent of the model item with the given index. /// If the item has no parent, an invalid QModelIndex is returned. /// \param theIndex a model index - virtual QModelIndex parent(const QModelIndex &theIndex) const; + QModelIndex parent(const QModelIndex &theIndex) const override; /// Returns true if parent has any children; otherwise returns false. /// \param theParent a parent model index - virtual bool hasChildren(const QModelIndex &theParent = QModelIndex()) const; + bool hasChildren(const QModelIndex &theParent = QModelIndex()) const override; /// Inserts count rows into the model before the given row. /// Items in the new row will be children of the item represented by the /// parent model index. \param theRow a start row \param theCount a nember of /// rows to insert \param theParent a parent model index - virtual bool insertRows(int theRow, int theCount, - const QModelIndex &theParent = QModelIndex()); + bool insertRows(int theRow, int theCount, + const QModelIndex &theParent = QModelIndex()) override; /// Removes count rows starting with the given row under parent parent from /// the model. \param theRow a start row \param theCount a nember of rows to /// remove \param theParent a parent model index - virtual bool removeRows(int theRow, int theCount, - const QModelIndex &theParent = QModelIndex()); + bool removeRows(int theRow, int theCount, + const QModelIndex &theParent = QModelIndex()) override; /// Returns the item flags for the given index. /// \param theIndex a model index - virtual Qt::ItemFlags flags(const QModelIndex &theIndex) const; + Qt::ItemFlags flags(const QModelIndex &theIndex) const override; /// Returns true if a model can accept a drop of the data (used for drag and /// drop functionality). - virtual bool canDropMimeData(const QMimeData *theData, - Qt::DropAction theAction, int theRow, - int theColumn, - const QModelIndex &theParent) const override; + bool canDropMimeData(const QMimeData *theData, Qt::DropAction theAction, + int theRow, int theColumn, + const QModelIndex &theParent) const override; /// Converts the dragged items information into mime data format (to be /// encoded in dropMimeData) - virtual QMimeData *mimeData(const QModelIndexList &indexes) const override; + QMimeData *mimeData(const QModelIndexList &indexes) const override; /// Performs a drag and drop of Part feature operation when it is droped. - virtual bool dropMimeData(const QMimeData *theData, Qt::DropAction theAction, - int theRow, int theColumn, - const QModelIndex &theParent) override; + bool dropMimeData(const QMimeData *theData, Qt::DropAction theAction, + int theRow, int theColumn, + const QModelIndex &theParent) override; /// Returns an index which is root of the given document /// \param theDoc a document @@ -175,7 +175,7 @@ public: QModelIndex getIndex(ModuleBase_ITreeNode *theNode, int thCol) const; /// Allows to support drag and drop of some model items - virtual Qt::DropActions supportedDropActions() const override { + Qt::DropActions supportedDropActions() const override { return Qt::MoveAction; } diff --git a/src/XGUI/XGUI_DeflectionDialog.cpp b/src/XGUI/XGUI_DeflectionDialog.cpp index 297cd8585..8cd720523 100644 --- a/src/XGUI/XGUI_DeflectionDialog.cpp +++ b/src/XGUI/XGUI_DeflectionDialog.cpp @@ -34,7 +34,7 @@ XGUI_DeflectionDialog::XGUI_DeflectionDialog(QWidget *theParent) : QDialog(theParent, Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint) { setWindowTitle(tr("Deflection")); - QGridLayout *aLay = new QGridLayout(this); + auto *aLay = new QGridLayout(this); myDeflection = new ModuleBase_DoubleSpinBox(this); myDeflection->setDecimals(12); @@ -42,7 +42,7 @@ XGUI_DeflectionDialog::XGUI_DeflectionDialog(QWidget *theParent) myDeflection->setSingleStep(0.001); aLay->addWidget(myDeflection, 0, 0); - 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_DeflectionDialog.h b/src/XGUI/XGUI_DeflectionDialog.h index 2b1baf01e..2ad0c6ee8 100644 --- a/src/XGUI/XGUI_DeflectionDialog.h +++ b/src/XGUI/XGUI_DeflectionDialog.h @@ -40,7 +40,8 @@ public: /// \param theParent a parent widget for the dialog XGUI_EXPORT XGUI_DeflectionDialog(QWidget *theParent); - XGUI_EXPORT virtual ~XGUI_DeflectionDialog(){}; + XGUI_EXPORT ~XGUI_DeflectionDialog() override = default; + ; /// Initializes the dialog with the given value. /// \param theValue the deflection value diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 991c8e1dc..723502848 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -105,15 +105,15 @@ constexpr int FRONT_DISPLAY_PRIORITY = constexpr int DEFAULT_DISPLAY_PRIORITY = 5; /* = Graphic3d_DisplayPriority_Normal */ -//#define DEBUG_DISPLAY -//#define DEBUG_FEATURE_REDISPLAY -//#define DEBUG_SELECTION_FILTERS +// #define DEBUG_DISPLAY +// #define DEBUG_FEATURE_REDISPLAY +// #define DEBUG_SELECTION_FILTERS -//#define DEBUG_OCCT_SHAPE_SELECTION +// #define DEBUG_OCCT_SHAPE_SELECTION #define CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY -//#define DEBUG_VIEWER_BLOCKED_COUNT +// #define DEBUG_VIEWER_BLOCKED_COUNT //************************************************************** void displayedObjects(const Handle(AIS_InteractiveContext) & theAIS, @@ -360,9 +360,9 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer) { } // myWorkshop->module()->storeSelection(); - //#ifdef CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY - // myWorkshop->selector()->deselectPresentation(aAISIO); - //#endif + // #ifdef CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY + // myWorkshop->selector()->deselectPresentation(aAISIO); + // #endif if (aContext->IsDisplayed(aAISIO)) aContext->Redisplay(aAISIO, false); diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index f4b5e3a9c..5055105f2 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -182,7 +182,7 @@ public: XGUI_Displayer(XGUI_Workshop *theWorkshop); /// Destructor - virtual ~XGUI_Displayer(); + ~XGUI_Displayer() override; /// Returns the feature visibility state. /// \param theObject an object instance diff --git a/src/XGUI/XGUI_ErrorMgr.cpp b/src/XGUI/XGUI_ErrorMgr.cpp index b142b3003..abb446400 100644 --- a/src/XGUI/XGUI_ErrorMgr.cpp +++ b/src/XGUI/XGUI_ErrorMgr.cpp @@ -48,7 +48,7 @@ const QString INVALID_VALUE = "invalid_action"; -//#define DEBUG_ERROR_STATE +// #define DEBUG_ERROR_STATE XGUI_ErrorMgr::XGUI_ErrorMgr(QObject *theParent, ModuleBase_IWorkshop *theWorkshop) diff --git a/src/XGUI/XGUI_ModuleConnector.h b/src/XGUI/XGUI_ModuleConnector.h index 202d36cdb..3aa3076ae 100644 --- a/src/XGUI/XGUI_ModuleConnector.h +++ b/src/XGUI/XGUI_ModuleConnector.h @@ -40,98 +40,98 @@ public: /// \param theWorkshop a workshop XGUI_ModuleConnector(XGUI_Workshop *theWorkshop); - virtual ~XGUI_ModuleConnector(); + ~XGUI_ModuleConnector() override; //! Returns list of currently selected data objects - virtual ModuleBase_ISelection *selection() const; + ModuleBase_ISelection *selection() const override; //! Returns instance of loaded module - virtual ModuleBase_IModule *module() const; + ModuleBase_IModule *module() const override; //! Returns current viewer - virtual ModuleBase_IViewer *viewer() const; + ModuleBase_IViewer *viewer() const override; //! Returns property panel - virtual ModuleBase_IPropertyPanel *propertyPanel() const; + ModuleBase_IPropertyPanel *propertyPanel() const override; //! Returns error manager - virtual ModuleBase_IErrorMgr *errorMgr() const; + ModuleBase_IErrorMgr *errorMgr() const override; /// A selection activate in 3D View handler - virtual ModuleBase_ISelectionActivate *selectionActivate() const; + ModuleBase_ISelectionActivate *selectionActivate() const override; //! Returns currently active operation - virtual ModuleBase_Operation *currentOperation() const; + ModuleBase_Operation *currentOperation() const override; //! Returns true if the operation with id theId can be started /// \param theId id of the operation which is going to start /// \param isCommitted boolean value if the operation was committed otherwise /// it was aborted - virtual bool canStartOperation(QString theId, bool &isCommitted); + bool canStartOperation(QString theId, bool &isCommitted) override; //! Performs the operation launch //! \param theOperation an operation to be launched - virtual void processLaunchOperation(ModuleBase_Operation *theOperation); + void processLaunchOperation(ModuleBase_Operation *theOperation) override; //! Returns started operation by the operation identifier. The operation //! manager is called. \param theId an operation id \return an operation //! instance or NULL - virtual ModuleBase_Operation *findStartedOperation(const QString &theId); + ModuleBase_Operation *findStartedOperation(const QString &theId) override; //! Returns true if the operation with id theId can be stopped. The operation //! manager is called. \param theOperation a stopped operation \return boolean //! result - virtual bool canStopOperation(ModuleBase_Operation *theOperation); + bool canStopOperation(ModuleBase_Operation *theOperation) override; //! Commits if possible or aborts the given operation. //! \param theOperation an aborted operation /// \param isCommitted boolean value if the operation was committed otherwise /// it was aborted - virtual void stopOperation(ModuleBase_Operation *theOperation, - bool &isCommitted); + void stopOperation(ModuleBase_Operation *theOperation, + bool &isCommitted) override; //! Returns AIS object by data object - virtual AISObjectPtr findPresentation(const ObjectPtr &theObject) const; + AISObjectPtr findPresentation(const ObjectPtr &theObject) const override; //! Returns data object by AIS - virtual ObjectPtr findPresentedObject(const AISObjectPtr &theAIS) const; + ObjectPtr findPresentedObject(const AISObjectPtr &theAIS) const override; //! Returns true if the object is displayed //! \param theObject a data object - virtual bool isVisible(const ObjectPtr &theObject) const; + bool isVisible(const ObjectPtr &theObject) const override; //! Returns list of currently displayed objects - virtual QObjectPtrList displayedObjects() const; + QObjectPtrList displayedObjects() const override; //! Select features clearing previous selection. //! If the list is empty then selection will be cleared - virtual void - setSelected(const QList> &theValues); + void setSelected( + const QList> &theValues) override; //! Shows the message in the status bar //! \param theMessage a message - virtual void setStatusBarMessage(const QString &theMessage); + void setStatusBarMessage(const QString &theMessage) override; /// Update of commands status - virtual void updateCommandStatus(); + void updateCommandStatus() override; /// Returns Information about feature defined in corresponded XML /// \param theId - id of the feature - virtual std::shared_ptr - featureInfo(const QString &theId) const; + std::shared_ptr + featureInfo(const QString &theId) const override; /// Return application main window - virtual QMainWindow *desktop() const; + QMainWindow *desktop() const override; /// Returns true if SHIFT is pressed /// \return boolean value - virtual bool hasSHIFTPressed() const; + bool hasSHIFTPressed() const override; - virtual void deactivateCurrentSelector(); + void deactivateCurrentSelector() override; //! Temporary enable or disable viewer update. Returns previous state of //! updating \param isEnabled new state of the viewer update - virtual bool enableUpdateViewer(bool isEnabled); + bool enableUpdateViewer(bool isEnabled) override; //! Returns workshop XGUI_Workshop *workshop() const { return myWorkshop; } @@ -140,19 +140,19 @@ public: //! presentation. The AIS presentation has to be already displayed. After //! activation viewer has to be updated \param theAIS the object which has to //! be activated - virtual void applyCurrentSelectionModes(const AISObjectPtr &theAIS); + void applyCurrentSelectionModes(const AISObjectPtr &theAIS) override; //! Undo last command - virtual void undo(); + void undo() override; //! Set enabled state of cancel button in property panel - virtual void setCancelEnabled(bool toEnable); + void setCancelEnabled(bool toEnable) override; //! Returns current state of cancel button - virtual bool isCancelEnabled() const; + bool isCancelEnabled() const override; //! Show help of a current operation - virtual void showHelpPage(const QString &thePage) const; + void showHelpPage(const QString &thePage) const override; private: QObjectPtrList activeObjects(const QObjectPtrList &theObjList) const; diff --git a/src/XGUI/XGUI_ObjectsBrowser.h b/src/XGUI/XGUI_ObjectsBrowser.h index 60c568075..8691c369f 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.h +++ b/src/XGUI/XGUI_ObjectsBrowser.h @@ -39,7 +39,7 @@ class Config_DataModelReader; class XGUI_Workshop; class ModuleBase_ITreeNode; -//#define DEBUG_INDXES +// #define DEBUG_INDXES /** * \ingroup GUI @@ -70,10 +70,10 @@ public slots: protected: /// On mouse release - virtual void mouseReleaseEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e) override; /// Filter event - bool eventFilter(QObject *theObj, QEvent *theEvent); + bool eventFilter(QObject *theObj, QEvent *theEvent) override; private: QString myPreSelectionStyle; @@ -95,7 +95,7 @@ public: /// \param theParent a parent widget XGUI_DataTree(QWidget *theParent); - virtual ~XGUI_DataTree(); + ~XGUI_DataTree() override; /// Returns current data model XGUI_DataModel *dataModel() const; @@ -110,20 +110,20 @@ public slots: protected slots: /// Commit modified data (used for renaming of objects) - virtual void commitData(QWidget *theEditor); + void commitData(QWidget *theEditor) override; /// A slot which is called on mouse double click void onDoubleClick(const QModelIndex &); protected: /// Redefinition of virtual method - virtual void contextMenuEvent(QContextMenuEvent *theEvent); + void contextMenuEvent(QContextMenuEvent *theEvent) override; /// Redefinition of virtual method - virtual void resizeEvent(QResizeEvent *theEvent); + void resizeEvent(QResizeEvent *theEvent) override; /// Redefinition of virtual method - virtual void mouseReleaseEvent(QMouseEvent *theEvent); + void mouseReleaseEvent(QMouseEvent *theEvent) override; #ifdef DEBUG_INDXES virtual void mousePressEvent(QMouseEvent *theEvent); @@ -150,14 +150,14 @@ public: /// Constructor /// \param theParent a parent widget XGUI_ObjectsBrowser(QWidget *theParent, XGUI_Workshop *theWorkshop); - virtual ~XGUI_ObjectsBrowser(); + ~XGUI_ObjectsBrowser() override; //! Returns Model which provides access to data objects XGUI_DataModel *dataModel() const { return myDocModel; } //! Returns list of currently selected objects //! \param theIndexes - output list of corresponded indexes (can be NULL) - QObjectPtrList selectedObjects(QModelIndexList *theIndexes = 0) const; + QObjectPtrList selectedObjects(QModelIndexList *theIndexes = nullptr) const; /// Set selected list of objects /// \param theObjects list of objects to select @@ -235,7 +235,7 @@ signals: protected: //! redefinition of a virtual method - void resizeEvent(QResizeEvent *theEvent); + void resizeEvent(QResizeEvent *theEvent) override; private slots: /// Show context menu diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 45ad37c48..3f15d12ab 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -57,7 +57,7 @@ #include #include -//#define DEBUG_CURRENT_FEATURE +// #define DEBUG_CURRENT_FEATURE /// Processes "Delete" key event of application. This key is used by several /// application actions. There is a logical order of the actions processing. So diff --git a/src/XGUI/XGUI_OperationMgr.h b/src/XGUI/XGUI_OperationMgr.h index 5e89325c5..a3d9772bb 100644 --- a/src/XGUI/XGUI_OperationMgr.h +++ b/src/XGUI/XGUI_OperationMgr.h @@ -66,7 +66,7 @@ public: XGUI_OperationMgr(QObject *theParent, ModuleBase_IWorkshop *theWorkshop); /// Destructor - virtual ~XGUI_OperationMgr(); + ~XGUI_OperationMgr() override; /// Switch on short cut listener void activate(); @@ -198,7 +198,7 @@ public: // TEMPORARY, it should be protected and be performed automatically /// Emits nestedStateChange for operations with an information about validity /// of the operation \param theOperation the sent operation. If it is NULL, /// all operations in the stack are sent. - void updateApplyOfOperations(ModuleBase_Operation *theOperation = 0); + void updateApplyOfOperations(ModuleBase_Operation *theOperation = nullptr); protected: // TEMPORARY /// Sets the current operation or NULL @@ -287,8 +287,8 @@ private: static QMessageBox *createInformationBox(const QString &theMessage); private: - typedef QList - Operations; ///< definition for a list of operations + using Operations = + QList; ///< definition for a list of operations Operations myOperations; ///< a stack of started operations. The active ///< operation is on top, // others are suspended and started by the active is diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 3817b6a13..c8ea77b5c 100644 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -28,7 +28,7 @@ #include #include -//#include +// #include #include #include #include @@ -60,9 +60,9 @@ #include #endif -//#define DEBUG_TAB_WIDGETS +// #define DEBUG_TAB_WIDGETS -//#define DEBUG_ACTIVE_WIDGET +// #define DEBUG_ACTIVE_WIDGET XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget *theParent, XGUI_OperationMgr *theMgr) diff --git a/src/XGUI/XGUI_SelectionActivate.cpp b/src/XGUI/XGUI_SelectionActivate.cpp index 772e40d81..775c571b2 100644 --- a/src/XGUI/XGUI_SelectionActivate.cpp +++ b/src/XGUI/XGUI_SelectionActivate.cpp @@ -44,10 +44,10 @@ #include -//#define DEBUG_ACTIVATE_OBJECTS -//#define DEBUG_DEACTIVATE -//#define DEBUG_ACTIVATE_AIS -//#define DEBUG_DEACTIVATE_AIS +// #define DEBUG_ACTIVATE_OBJECTS +// #define DEBUG_DEACTIVATE +// #define DEBUG_ACTIVATE_AIS +// #define DEBUG_DEACTIVATE_AIS #ifdef TINSPECTOR #include diff --git a/src/XGUI/XGUI_SelectionActivate.h b/src/XGUI/XGUI_SelectionActivate.h index b9badda7c..f58168e97 100644 --- a/src/XGUI/XGUI_SelectionActivate.h +++ b/src/XGUI/XGUI_SelectionActivate.h @@ -49,7 +49,7 @@ public: XGUI_EXPORT XGUI_SelectionActivate(ModuleBase_IWorkshop *theWorkshop); /// Destructor - ~XGUI_SelectionActivate() {} + ~XGUI_SelectionActivate() override = default; /// Returns place of activation modes that now is active /// \return place @@ -57,17 +57,17 @@ public: /// Updates active selection modes in the viewer depending on the application /// state - XGUI_EXPORT virtual void updateSelectionModes(); + XGUI_EXPORT void updateSelectionModes() override; /// Updates active selection filters in the viewer depending on the /// application state - XGUI_EXPORT virtual void updateSelectionFilters(); + XGUI_EXPORT void updateSelectionFilters() override; /// Activates parameter filters in the workshop, deactivate active out of the /// container Please find a possibility to use updateSelectionFilters instead /// of direct call this method. \param theSelectionFilters a filtes - XGUI_EXPORT virtual void - activateSelectionFilters(const SelectMgr_ListOfFilter &theSelectionFilters); + XGUI_EXPORT void activateSelectionFilters( + const SelectMgr_ListOfFilter &theSelectionFilters) override; /// Returns list of currently active selection modes /// Selection modes will be returned according to TopAbs_ShapeEnum diff --git a/src/XGUI/XGUI_SelectionMgr.h b/src/XGUI/XGUI_SelectionMgr.h index 2467875c3..e4f504268 100644 --- a/src/XGUI/XGUI_SelectionMgr.h +++ b/src/XGUI/XGUI_SelectionMgr.h @@ -49,7 +49,7 @@ public: /// Constructor /// \param theParent a parent workshop XGUI_SelectionMgr(XGUI_Workshop *theParent); - virtual ~XGUI_SelectionMgr(); + ~XGUI_SelectionMgr() override; /// Returns current selection XGUI_Selection *selection() const { return mySelection; } diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index db12c0fef..be6638af3 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -55,112 +55,112 @@ public: void connectViewProxy(); //! Returns AIS_InteractiveContext from current OCCViewer - virtual Handle(AIS_InteractiveContext) AISContext() const; + Handle(AIS_InteractiveContext) AISContext() const override; //! Trihedron 3d object shown in the viewer - virtual Handle(AIS_Trihedron) trihedron() const; + Handle(AIS_Trihedron) trihedron() const override; //! Retrurns V3d_Vioewer from current viewer - virtual Handle(V3d_Viewer) v3dViewer() const; + Handle(V3d_Viewer) v3dViewer() const override; //! Returns Vsd_View object from currently active view window - virtual Handle(V3d_View) activeView() const; + Handle(V3d_View) activeView() const override; - 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; //! 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; //! Sets the view fitted all - virtual void fitAll(); + void fitAll() override; //! Erases all presentations from the viewer - virtual void eraseAll(); + void eraseAll() override; /// Connects to a viewer according to current environment void connectToViewer(); /// 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(); /// 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; - virtual void updateHighlight(); + void updateHighlight() override; // 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; //! Set color scale parameters according to user preferences and window size void setupColorScale(); @@ -169,15 +169,15 @@ public: //! \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; // Fit all along Z (perpendicular to display) // virtual void Zfitall(); #ifdef HAVE_SALOME - virtual void setFitter(OCCViewer_Fitter *theFitter); - virtual OCCViewer_Fitter *fitter() const; + void setFitter(OCCViewer_Fitter *theFitter) override; + OCCViewer_Fitter *fitter() const override; #else virtual void setFitter(AppElements_Fitter *theFitter); virtual AppElements_Fitter *fitter() const; @@ -193,7 +193,7 @@ signals: protected: /// processes the application signals to catch the mouse leaving state of the /// main window \param theObject \param theEvent - bool eventFilter(QObject *theObject, QEvent *theEvent); + bool eventFilter(QObject *theObject, QEvent *theEvent) override; private slots: void onViewCreated(ModuleBase_IViewWindow *theWnd); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index debac0ec2..d97ba56c4 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -85,7 +85,7 @@ #include #include -//#include +// #include #include #include @@ -181,15 +181,15 @@ static Handle(VInspector_CallBack) MyVCallBack; #include #endif -//#define DEBUG_WITH_MESSAGE_REPORT +// #define DEBUG_WITH_MESSAGE_REPORT QString XGUI_Workshop::MOVE_TO_END_COMMAND = QObject::tr("Move to the end"); QString XGUI_Workshop::MOVE_TO_END_SPLIT_COMMAND = QObject::tr("Move to the end and split"); -//#define DEBUG_DELETE -//#define DEBUG_FEATURE_NAME -//#define DEBUG_CLEAN_HISTORY +// #define DEBUG_DELETE +// #define DEBUG_FEATURE_NAME +// #define DEBUG_CLEAN_HISTORY #ifdef HAVE_SALOME static QString MyFilter(QObject::tr("SHAPER files (*.shaper *.cadbld)")); @@ -673,11 +673,11 @@ void XGUI_Workshop::showHelpPage(const QString &thePage) const { const QChar aSep = QDir::separator(); // QString platform; // SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); - //#ifdef WIN32 + // #ifdef WIN32 // platform = "winapplication"; - //#else + // #else // platform = "application"; - //#endif + // #endif // QString aBrowserName = aResMgr->stringValue("ExternalBrowser", // platform); diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index d985699a0..6e087bd56 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -86,8 +86,8 @@ public: /// Constructor /// \param theConnector a Salome connector object. /// Used only if the workshop is launched in Salome environment - XGUI_Workshop(XGUI_SalomeConnector *theConnector = 0); - virtual ~XGUI_Workshop(); + XGUI_Workshop(XGUI_SalomeConnector *theConnector = nullptr); + ~XGUI_Workshop() override; /// Starting of the application void startApplication(); @@ -153,7 +153,7 @@ public: ModuleBase_IViewer *salomeViewer() const; /// Returns true if the application works as SALOME module - bool isSalomeMode() const { return mySalomeConnector != 0; } + bool isSalomeMode() const { return mySalomeConnector != nullptr; } /// Returns Object browser XGUI_ObjectsBrowser *objectBrowser() const { return myObjectBrowser; } diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index cf9b52fa3..498e85ea6 100644 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -81,10 +81,10 @@ disable : 4189) // for declaration of unused variables (MAYBE_UNUSED) #endif -//#define DEBUG_FEATURE_CREATED -//#define DEBUG_FEATURE_REDISPLAY -//#define DEBUG_FEATURE_UPDATED -//#define DEBUG_RESULT_COMPSOLID +// #define DEBUG_FEATURE_CREATED +// #define DEBUG_FEATURE_REDISPLAY +// #define DEBUG_FEATURE_UPDATED +// #define DEBUG_RESULT_COMPSOLID #ifdef DEBUG_FEATURE_REDISPLAY const std::string DebugFeatureKind = ""; //"Extrusion"; diff --git a/test.models/coronavirus.py b/test.models/coronavirus.py index 5d4e7d672..c2c438c6f 100644 --- a/test.models/coronavirus.py +++ b/test.models/coronavirus.py @@ -333,9 +333,7 @@ model.do() # Boucle de répétition des tubes autour de la sphère : # ============================================================================= i = 1 -CutTools = ( - [] -) # liste pour accumulation des tubes int. et cut de la sphère ext. par tous ces tubes int. +CutTools = [] # liste pour accumulation des tubes int. et cut de la sphère ext. par tous ces tubes int. IntTools = [ Sphere_ext.result() ] # liste pour accumulation de la sphère ext. et de tous les tubes ext. et calcul d'intersection entre tous ces objets (pour déterminer les arêtes sur lesquelles on mettra des fillets). -- 2.39.2