From: SONOLET Aymeric Date: Wed, 3 Jan 2024 10:43:10 +0000 (+0100) Subject: refactor: Running clang-tidy again X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6a0f46a82487b7ca442a7b2c90e6f32088302418;p=modules%2Fshaper.git refactor: Running clang-tidy again --- diff --git a/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp b/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp index ea6c76bb8..aceeeba22 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportPart.cpp @@ -158,9 +158,8 @@ static void allReferencedFeatures(const std::set &theFeatures, theFeature->data()->referencesToObjects(aRefs); for (auto &aRef : aRefs) { - for (auto anObjIt = aRef.second.begin(); anObjIt != aRef.second.end(); - ++anObjIt) { - FeaturePtr aFeature = ModelAPI_Feature::feature(*anObjIt); + for (auto &anObjIt : aRef.second) { + FeaturePtr aFeature = ModelAPI_Feature::feature(anObjIt); if (aFeature && !isCoordinate(aFeature) && theReferencedFeatures.find(aFeature) == theReferencedFeatures.end()) aReferences.insert(aFeature); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp index 7f3df9557..91857a3db 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp @@ -54,7 +54,7 @@ #include #include -FeaturesPlugin_Measurement::FeaturesPlugin_Measurement() {} +FeaturesPlugin_Measurement::FeaturesPlugin_Measurement() = default; void FeaturesPlugin_Measurement::initAttributes() { data()->addAttribute(FeaturesPlugin_Measurement::MEASURE_KIND(), diff --git a/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp b/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp index a8d1415a5..927882ddc 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp @@ -34,7 +34,7 @@ #include #include -FeaturesPlugin_Recover::FeaturesPlugin_Recover() {} +FeaturesPlugin_Recover::FeaturesPlugin_Recover() = default; void FeaturesPlugin_Recover::initAttributes() { data()->addAttribute(BASE_FEATURE(), ModelAPI_AttributeReference::typeId()); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h index 8985f2d87..c02c899ff 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeInfo.h @@ -39,7 +39,7 @@ class GeomAlgoAPI_InfoValue { bool myBool; //< type 2 public: - GeomAlgoAPI_InfoValue() {} // invalid case + GeomAlgoAPI_InfoValue() = default; // invalid case GeomAlgoAPI_InfoValue(const char *theVal) : myType(0), myStr(theVal) {} GeomAlgoAPI_InfoValue(const std::string theVal) : myType(0), myStr(theVal) {} GeomAlgoAPI_InfoValue(const double theVal) : myType(1), myDouble(theVal) {} diff --git a/src/GeomAlgoImpl/GEOMAlgo_Algo.cxx b/src/GeomAlgoImpl/GEOMAlgo_Algo.cxx index a76caa311..bebae4be8 100644 --- a/src/GeomAlgoImpl/GEOMAlgo_Algo.cxx +++ b/src/GeomAlgoImpl/GEOMAlgo_Algo.cxx @@ -34,7 +34,7 @@ //======================================================================= GEOMAlgo_Algo::GEOMAlgo_Algo() -{} + = default; //======================================================================= // function: ~ diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index 8c42c9702..e83545fd1 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -56,7 +56,7 @@ protected: ConnectedTopologyFlag myConnect; ModelAPI_BodyBuilder *myBuilder{ - 0}; ///< provides the body processing in naming shape + nullptr}; ///< provides the body processing in naming shape public: MODELAPI_EXPORT ~ModelAPI_ResultBody() override; diff --git a/src/ModelHighAPI/ModelHighAPI_RefAttr.cpp b/src/ModelHighAPI/ModelHighAPI_RefAttr.cpp index 6e5817773..06d7fdf35 100644 --- a/src/ModelHighAPI/ModelHighAPI_RefAttr.cpp +++ b/src/ModelHighAPI/ModelHighAPI_RefAttr.cpp @@ -27,7 +27,7 @@ #include #include //-------------------------------------------------------------------------------------- -ModelHighAPI_RefAttr::ModelHighAPI_RefAttr() {} +ModelHighAPI_RefAttr::ModelHighAPI_RefAttr() = default; ModelHighAPI_RefAttr::ModelHighAPI_RefAttr( const std::shared_ptr &theValue) @@ -35,12 +35,11 @@ ModelHighAPI_RefAttr::ModelHighAPI_RefAttr( ModelHighAPI_RefAttr::ModelHighAPI_RefAttr( const std::shared_ptr &theValue) - : myVariantType(VT_OBJECT), myObject(theValue) {} + : myObject(theValue) {} ModelHighAPI_RefAttr::ModelHighAPI_RefAttr( const std::shared_ptr &theValue) - : myVariantType(VT_OBJECT), - myObject(std::shared_ptr(theValue->defaultResult())) {} + : myObject(std::shared_ptr(theValue->defaultResult())) {} ModelHighAPI_RefAttr::~ModelHighAPI_RefAttr() = default; diff --git a/src/ModelHighAPI/ModelHighAPI_Selection.cpp b/src/ModelHighAPI/ModelHighAPI_Selection.cpp index bb6ee66d4..7c103930f 100644 --- a/src/ModelHighAPI/ModelHighAPI_Selection.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Selection.cpp @@ -32,7 +32,7 @@ //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- -ModelHighAPI_Selection::ModelHighAPI_Selection() {} +ModelHighAPI_Selection::ModelHighAPI_Selection() = default; ModelHighAPI_Selection::ModelHighAPI_Selection( const std::shared_ptr &theContext, diff --git a/src/ModuleBase/ModuleBase_IErrorMgr.cpp b/src/ModuleBase/ModuleBase_IErrorMgr.cpp index 932ea809a..d507203c8 100644 --- a/src/ModuleBase/ModuleBase_IErrorMgr.cpp +++ b/src/ModuleBase/ModuleBase_IErrorMgr.cpp @@ -24,7 +24,7 @@ #include "ModuleBase_ModelWidget.h" ModuleBase_IErrorMgr::ModuleBase_IErrorMgr(QObject *theParent /*= 0*/) - : QObject(theParent), myPropertyPanel(nullptr) {} + : QObject(theParent) {} ModuleBase_IErrorMgr::~ModuleBase_IErrorMgr() = default; diff --git a/src/ModuleBase/ModuleBase_IErrorMgr.h b/src/ModuleBase/ModuleBase_IErrorMgr.h index 5f410eb95..a40daf7c5 100644 --- a/src/ModuleBase/ModuleBase_IErrorMgr.h +++ b/src/ModuleBase/ModuleBase_IErrorMgr.h @@ -63,7 +63,7 @@ protected slots: protected: /// Access to property panel - ModuleBase_IPropertyPanel *myPropertyPanel; + ModuleBase_IPropertyPanel *myPropertyPanel{nullptr}; }; #endif // ModuleBase_IErrorMgr_H diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index 5e6cb9874..04b0d2857 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -51,7 +51,7 @@ ModuleBase_Operation::ModuleBase_Operation(const QString &theId, QObject *theParent) - : QObject(theParent), myPropertyPanel(nullptr) { + : QObject(theParent) { myDescription = new ModuleBase_OperationDescription(theId); } diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index 90f63547e..373580746 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -218,7 +218,7 @@ private: QStringList myGrantedIds; /// Access to property panel - ModuleBase_IPropertyPanel *myPropertyPanel; + ModuleBase_IPropertyPanel *myPropertyPanel{nullptr}; QString myHelpFileName; diff --git a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.h b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.h index 46603c1b9..ef0386ae4 100644 --- a/src/ModuleBase/ModuleBase_WidgetCreatorFactory.h +++ b/src/ModuleBase/ModuleBase_WidgetCreatorFactory.h @@ -113,7 +113,7 @@ private: QMap myCreators; }; -typedef std::shared_ptr - WidgetCreatorFactoryPtr; +using WidgetCreatorFactoryPtr = + std::shared_ptr; #endif /* MODULEBASE_WIDGETCREATORFACTORY_H_ */ diff --git a/src/PartSet/PartSet_PreviewPlanes.cpp b/src/PartSet/PartSet_PreviewPlanes.cpp index 85c814ddc..f2b7898fd 100644 --- a/src/PartSet/PartSet_PreviewPlanes.cpp +++ b/src/PartSet/PartSet_PreviewPlanes.cpp @@ -35,7 +35,7 @@ #include -PartSet_PreviewPlanes::PartSet_PreviewPlanes() {} +PartSet_PreviewPlanes::PartSet_PreviewPlanes() = default; bool PartSet_PreviewPlanes::hasVisualizedBodies( ModuleBase_IWorkshop *theWorkshop) { diff --git a/src/PartSet/PartSet_PreviewSketchPlane.cpp b/src/PartSet/PartSet_PreviewSketchPlane.cpp index e34488b02..3c0624f51 100644 --- a/src/PartSet/PartSet_PreviewSketchPlane.cpp +++ b/src/PartSet/PartSet_PreviewSketchPlane.cpp @@ -43,7 +43,7 @@ #include -PartSet_PreviewSketchPlane::PartSet_PreviewSketchPlane() {} +PartSet_PreviewSketchPlane::PartSet_PreviewSketchPlane() = default; void PartSet_PreviewSketchPlane::eraseSketchPlane( ModuleBase_IWorkshop *theWorkshop, const bool isClearPlane) { diff --git a/src/PartSet/PartSet_TreeNodes.h b/src/PartSet/PartSet_TreeNodes.h index 623384021..0eeee11c0 100644 --- a/src/PartSet/PartSet_TreeNodes.h +++ b/src/PartSet/PartSet_TreeNodes.h @@ -233,7 +233,7 @@ private: PartSet_FolderNode *myConstrFolder; PartSet_FolderNode *myPartsFolder; - ModuleBase_IWorkshop *myWorkshop{0}; + ModuleBase_IWorkshop *myWorkshop{nullptr}; }; ///////////////////////////////////////////////////////////////////// diff --git a/src/SHAPERGUI/SHAPERGUI.h b/src/SHAPERGUI/SHAPERGUI.h index 6d2e8f0e1..cace686f0 100644 --- a/src/SHAPERGUI/SHAPERGUI.h +++ b/src/SHAPERGUI/SHAPERGUI.h @@ -284,7 +284,7 @@ private: XGUI_Workshop *myWorkshop; /// OCC viewer selector instance - SHAPERGUI_OCCSelector *mySelector{0}; + SHAPERGUI_OCCSelector *mySelector{nullptr}; /// Proxy viewer for connection to OCC Viewer in SALOME SHAPERGUI_SalomeViewer *myProxyViewer; @@ -293,19 +293,19 @@ private: QMap> myFeaturesInfo; /// Flag of opened document state - bool myIsOpened{0}; + bool myIsOpened{false}; // the next parameter should be restored after this module deactivation /// The application value bool myIsEditEnabled; /// Popup manager - QtxPopupMgr *myPopupMgr{0}; + QtxPopupMgr *myPopupMgr{nullptr}; QAction *myWhatIsAction; bool myIsInspectionVisible{false}; - QDockWidget *myInspectionPanel{0}; + QDockWidget *myInspectionPanel{nullptr}; bool myIsFacesPanelVisible{false}; /// List of registered actions diff --git a/src/SketchPlugin/SketchPlugin_MacroBSpline.cpp b/src/SketchPlugin/SketchPlugin_MacroBSpline.cpp index cf8053721..e0908f02c 100644 --- a/src/SketchPlugin/SketchPlugin_MacroBSpline.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroBSpline.cpp @@ -58,7 +58,7 @@ SketchPlugin_MacroBSpline::SketchPlugin_MacroBSpline() : SketchPlugin_SketchEntity() {} SketchPlugin_MacroBSpline::SketchPlugin_MacroBSpline(bool isPeriodic) - : SketchPlugin_SketchEntity(), myDegree(3), myIsPeriodic(isPeriodic) {} + : SketchPlugin_SketchEntity(), myIsPeriodic(isPeriodic) {} void SketchPlugin_MacroBSpline::initAttributes() { data()->addAttribute(POLES_ID(), GeomDataAPI_Point2DArray::typeId()); diff --git a/src/SketchPlugin/SketchPlugin_MultiRotation.cpp b/src/SketchPlugin/SketchPlugin_MultiRotation.cpp index 954495230..df33e67f4 100644 --- a/src/SketchPlugin/SketchPlugin_MultiRotation.cpp +++ b/src/SketchPlugin/SketchPlugin_MultiRotation.cpp @@ -48,7 +48,7 @@ static const double PI = 3.1415926535897932; static const double PERIOD = 360.0; static const double ANGLETOL = 1.e-7; -SketchPlugin_MultiRotation::SketchPlugin_MultiRotation() {} +SketchPlugin_MultiRotation::SketchPlugin_MultiRotation() = default; void SketchPlugin_MultiRotation::initAttributes() { data()->addAttribute(CENTER_ID(), ModelAPI_AttributeRefAttr::typeId()); diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityWrapper.h index a2e6f74fd..8df6df3fc 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_EntityWrapper.h @@ -36,7 +36,7 @@ using EntityWrapperPtr = std::shared_ptr; */ class PlaneGCSSolver_EntityWrapper { public: - PlaneGCSSolver_EntityWrapper() {} + PlaneGCSSolver_EntityWrapper() = default; virtual ~PlaneGCSSolver_EntityWrapper() = default; /// \brief Return type of current entity diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.h index ffaa326c5..fbd948af4 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_PointArrayWrapper.h @@ -60,6 +60,6 @@ private: std::vector myPoints; }; -typedef std::shared_ptr PointArrayWrapperPtr; +using PointArrayWrapperPtr = std::shared_ptr; #endif diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp index d864f88aa..acf68f7ea 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp @@ -292,10 +292,9 @@ void PlaneGCSSolver_Solver::getFreeParameters(GCS::SET_pD &theFreeParams) { } anEqualParams; for (auto &myConstraint : myConstraints) - for (auto aCIt = myConstraint.second.begin(); - aCIt != myConstraint.second.end(); ++aCIt) { - if ((*aCIt)->getTypeId() == GCS::Equal) - anEqualParams.add((*aCIt)->params()[0], (*aCIt)->params()[1]); + for (auto &aCIt : myConstraint.second) { + if (aCIt->getTypeId() == GCS::Equal) + anEqualParams.add(aCIt->params()[0], aCIt->params()[1]); } GCS::SET_pD aFreeParamsCopy = theFreeParams; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h index 41f7f0837..15da9d552 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h @@ -114,7 +114,7 @@ private: int myDOF{0}; ///< degrees of freedom - GCS::Constraint *myFictiveConstraint{0}; + GCS::Constraint *myFictiveConstraint{nullptr}; }; using SolverPtr = std::shared_ptr; diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.cpp index a655c9eb3..355c63f0f 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.cpp @@ -230,7 +230,7 @@ PlaneGCSSolver_Tools::createMovementConstraint( } ConstraintWrapperPtr PlaneGCSSolver_Tools::createConstraint( - ConstraintPtr theConstraint, const SketchSolver_ConstraintType &theType, + ConstraintPtr /*theConstraint*/, const SketchSolver_ConstraintType &theType, const EntityWrapperPtr &theValue, const EntityWrapperPtr &thePoint1, const EntityWrapperPtr &thePoint2, const EntityWrapperPtr &theEntity1, const EntityWrapperPtr &theEntity2) { diff --git a/src/SketchSolver/SketchSolver_Constraint.cpp b/src/SketchSolver/SketchSolver_Constraint.cpp index 681dfbd76..b62f3fd27 100644 --- a/src/SketchSolver/SketchSolver_Constraint.cpp +++ b/src/SketchSolver/SketchSolver_Constraint.cpp @@ -55,7 +55,7 @@ #include SketchSolver_Constraint::SketchSolver_Constraint(ConstraintPtr theConstraint) - : myBaseConstraint(theConstraint), myType(CONSTRAINT_UNKNOWN) {} + : myBaseConstraint(theConstraint) {} void SketchSolver_Constraint::process(StoragePtr theStorage, bool theEvensBlocked) { diff --git a/src/SketchSolver/SketchSolver_Constraint.h b/src/SketchSolver/SketchSolver_Constraint.h index fb46030e1..de7e6b633 100644 --- a/src/SketchSolver/SketchSolver_Constraint.h +++ b/src/SketchSolver/SketchSolver_Constraint.h @@ -40,7 +40,7 @@ class SketchSolver_Constraint { protected: /// Default constructor - SketchSolver_Constraint() {} + SketchSolver_Constraint() = default; public: /// Constructor based on SketchPlugin constraint diff --git a/src/SketchSolver/SketchSolver_Storage.h b/src/SketchSolver/SketchSolver_Storage.h index 0555c63d3..bc5408632 100644 --- a/src/SketchSolver/SketchSolver_Storage.h +++ b/src/SketchSolver/SketchSolver_Storage.h @@ -34,8 +34,8 @@ class SketchSolver_ConstraintDistance; class SketchSolver_ConstraintFixedArcRadius; -typedef std::map> - CoincidentPointsMap; +using CoincidentPointsMap = + std::map>; /** \class SketchSolver_Storage * \ingroup Plugins diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 64797cb94..46005ff76 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -207,7 +207,7 @@ static QString MyImportPartFilter( //****************************************************** XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector *theConnector) - : QObject(), myModule(nullptr), mySalomeConnector(theConnector) { + : QObject(), mySalomeConnector(theConnector) { mySelector = new XGUI_SelectionMgr(this); myModuleConnector = new XGUI_ModuleConnector(this); myOperationMgr = new XGUI_OperationMgr(this, myModuleConnector); diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index fe14157fb..26df5c7be 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -581,16 +581,16 @@ private: AppElements_MainWindow *myMainWindow; ///< desktop window #endif - ModuleBase_IModule *myModule; ///< current module - XGUI_ErrorMgr *myErrorMgr; ///< updator of error message - XGUI_ObjectsBrowser *myObjectBrowser{0}; ///< data tree widget + ModuleBase_IModule *myModule{nullptr}; ///< current module + XGUI_ErrorMgr *myErrorMgr; ///< updator of error message + XGUI_ObjectsBrowser *myObjectBrowser{nullptr}; ///< data tree widget XGUI_PropertyPanel *myPropertyPanel{ - 0}; ///< container of feature attributes widgets - XGUI_FacesPanel *myFacesPanel{0}; ///< panel for hide object faces - XGUI_SelectionMgr *mySelector; ///< handler of selection processing + nullptr}; ///< container of feature attributes widgets + XGUI_FacesPanel *myFacesPanel{nullptr}; ///< panel for hide object faces + XGUI_SelectionMgr *mySelector; ///< handler of selection processing XGUI_SelectionActivate - *mySelectionActivate; /// manager of selection activating - XGUI_Displayer *myDisplayer{0}; ///< handler of objects display + *mySelectionActivate; /// manager of selection activating + XGUI_Displayer *myDisplayer{nullptr}; ///< handler of objects display XGUI_OperationMgr *myOperationMgr; ///< manager to manipulate through the operations XGUI_ActionsMgr *myActionsMgr; ///< manager of workshop actions @@ -611,7 +611,7 @@ private: QIntList myViewerSelMode; ///< selection modes set in the viewer Config_DataModelReader *myDataModelXMLReader; ///< XML reader of data model XGUI_InspectionPanel *myInspectionPanel{ - 0}; ///< container of feature attributes widgets + nullptr}; ///< container of feature attributes widgets QTemporaryDir myTmpDir; ///< a direcory for uncompressed files };