From 1c93e5ac876938d31609385ff0d6c485e6488036 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 23 Mar 2022 19:08:33 +0100 Subject: [PATCH] MeshPart: modernize C++11 * use nullptr --- src/Mod/MeshPart/App/AppMeshPart.cpp | 2 +- src/Mod/MeshPart/App/AppMeshPartPy.cpp | 24 ++++++++++++------------ src/Mod/MeshPart/App/Mesher.cpp | 2 +- src/Mod/MeshPart/Gui/AppMeshPartGui.cpp | 2 +- src/Mod/MeshPart/Gui/CrossSections.cpp | 2 +- src/Mod/MeshPart/Gui/CrossSections.h | 2 +- src/Mod/MeshPart/Gui/CurveOnMesh.cpp | 8 ++++---- src/Mod/MeshPart/Gui/CurveOnMesh.h | 2 +- src/Mod/MeshPart/Gui/TaskCurveOnMesh.cpp | 2 +- src/Mod/MeshPart/Gui/TaskCurveOnMesh.h | 2 +- src/Mod/MeshPart/Gui/Tessellation.cpp | 2 +- src/Mod/MeshPart/Gui/Tessellation.h | 4 ++-- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Mod/MeshPart/App/AppMeshPart.cpp b/src/Mod/MeshPart/App/AppMeshPart.cpp index 6cd2b4a712..d49a1d96d7 100644 --- a/src/Mod/MeshPart/App/AppMeshPart.cpp +++ b/src/Mod/MeshPart/App/AppMeshPart.cpp @@ -41,7 +41,7 @@ PyMOD_INIT_FUNC(MeshPart) } catch(const Base::Exception& e) { PyErr_SetString(PyExc_ImportError, e.what()); - PyMOD_Return(0); + PyMOD_Return(nullptr); } PyObject* mod = MeshPart::initModule(); Base::Console().Log("Loading MeshPart module... done\n"); diff --git a/src/Mod/MeshPart/App/AppMeshPartPy.cpp b/src/Mod/MeshPart/App/AppMeshPartPy.cpp index 95e9f0f2cc..041cabea31 100644 --- a/src/Mod/MeshPart/App/AppMeshPartPy.cpp +++ b/src/Mod/MeshPart/App/AppMeshPartPy.cpp @@ -254,7 +254,7 @@ private: } Py::Object projectShapeOnMesh(const Py::Tuple& args, const Py::Dict& kwds) { - static char* kwds_maxdist[] = {"Shape", "Mesh", "MaxDistance", NULL}; + static char* kwds_maxdist[] = {"Shape", "Mesh", "MaxDistance", nullptr}; PyObject *s, *m; double maxDist; if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), @@ -284,7 +284,7 @@ private: return list; } - static char* kwds_dir[] = {"Shape", "Mesh", "Direction", NULL}; + static char* kwds_dir[] = {"Shape", "Mesh", "Direction", nullptr}; PyErr_Clear(); PyObject *v; if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), @@ -316,7 +316,7 @@ private: return list; } - static char* kwds_poly[] = {"Polygons", "Mesh", "Direction", NULL}; + static char* kwds_poly[] = {"Polygons", "Mesh", "Direction", nullptr}; PyErr_Clear(); PyObject *seq; if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), @@ -479,13 +479,13 @@ private: PyObject *shape; static char* kwds_lindeflection[] = {"Shape", "LinearDeflection", "AngularDeflection", - "Relative", "Segments", "GroupColors", NULL}; + "Relative", "Segments", "GroupColors", nullptr}; PyErr_Clear(); double lindeflection=0; double angdeflection=0.5; PyObject* relative = Py_False; PyObject* segment = Py_False; - PyObject* groupColors = 0; + PyObject* groupColors = nullptr; if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!d|dO!O!O", kwds_lindeflection, &(Part::TopoShapePy::Type), &shape, &lindeflection, &angdeflection, &(PyBool_Type), &relative, @@ -516,7 +516,7 @@ private: return Py::asObject(new Mesh::MeshPy(mesher.createMesh())); } - static char* kwds_maxLength[] = {"Shape", "MaxLength",NULL}; + static char* kwds_maxLength[] = {"Shape", "MaxLength",nullptr}; PyErr_Clear(); double maxLength=0; if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!d", kwds_maxLength, @@ -528,7 +528,7 @@ private: return Py::asObject(new Mesh::MeshPy(mesher.createMesh())); } - static char* kwds_maxArea[] = {"Shape", "MaxArea",NULL}; + static char* kwds_maxArea[] = {"Shape", "MaxArea",nullptr}; PyErr_Clear(); double maxArea=0; if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!d", kwds_maxArea, @@ -540,7 +540,7 @@ private: return Py::asObject(new Mesh::MeshPy(mesher.createMesh())); } - static char* kwds_localLen[] = {"Shape", "LocalLength",NULL}; + static char* kwds_localLen[] = {"Shape", "LocalLength",nullptr}; PyErr_Clear(); double localLen=0; if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!d", kwds_localLen, @@ -552,7 +552,7 @@ private: return Py::asObject(new Mesh::MeshPy(mesher.createMesh())); } - static char* kwds_deflection[] = {"Shape", "Deflection",NULL}; + static char* kwds_deflection[] = {"Shape", "Deflection",nullptr}; PyErr_Clear(); double deflection=0; if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!d", kwds_deflection, @@ -564,7 +564,7 @@ private: return Py::asObject(new Mesh::MeshPy(mesher.createMesh())); } - static char* kwds_minmaxLen[] = {"Shape", "MinLength","MaxLength",NULL}; + static char* kwds_minmaxLen[] = {"Shape", "MinLength","MaxLength",nullptr}; PyErr_Clear(); double minLen=0, maxLen=0; if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!dd", kwds_minmaxLen, @@ -576,7 +576,7 @@ private: return Py::asObject(new Mesh::MeshPy(mesher.createMesh())); } - static char* kwds_fineness[] = {"Shape", "Fineness", "SecondOrder", "Optimize", "AllowQuad", "MinLength", "MaxLength", NULL}; + static char* kwds_fineness[] = {"Shape", "Fineness", "SecondOrder", "Optimize", "AllowQuad", "MinLength", "MaxLength", nullptr}; PyErr_Clear(); int fineness=0, secondOrder=0, optimize=1, allowquad=0; if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!i|iiidd", kwds_fineness, @@ -597,7 +597,7 @@ private: } static char* kwds_user[] = {"Shape", "GrowthRate", "SegPerEdge", "SegPerRadius", "SecondOrder", - "Optimize", "AllowQuad", "MinLength", "MaxLength", NULL }; + "Optimize", "AllowQuad", "MinLength", "MaxLength", nullptr }; PyErr_Clear(); double growthRate=0, nbSegPerEdge=0, nbSegPerRadius=0; if (PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!|dddiiidd", kwds_user, diff --git a/src/Mod/MeshPart/App/Mesher.cpp b/src/Mod/MeshPart/App/Mesher.cpp index 2f51741111..bc86eecfbd 100644 --- a/src/Mod/MeshPart/App/Mesher.cpp +++ b/src/Mod/MeshPart/App/Mesher.cpp @@ -81,7 +81,7 @@ using namespace MeshPart; -SMESH_Gen* Mesher::_mesh_gen = 0; +SMESH_Gen* Mesher::_mesh_gen = nullptr; MeshingOutput::MeshingOutput() diff --git a/src/Mod/MeshPart/Gui/AppMeshPartGui.cpp b/src/Mod/MeshPart/Gui/AppMeshPartGui.cpp index b7815134a6..fc838d3194 100644 --- a/src/Mod/MeshPart/Gui/AppMeshPartGui.cpp +++ b/src/Mod/MeshPart/Gui/AppMeshPartGui.cpp @@ -70,7 +70,7 @@ PyMOD_INIT_FUNC(MeshPartGui) { if (!Gui::Application::Instance) { PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application."); - PyMOD_Return(0); + PyMOD_Return(nullptr); } PyObject* mod = MeshPartGui::initModule(); diff --git a/src/Mod/MeshPart/Gui/CrossSections.cpp b/src/Mod/MeshPart/Gui/CrossSections.cpp index 751d9b074c..44460217bc 100644 --- a/src/Mod/MeshPart/Gui/CrossSections.cpp +++ b/src/Mod/MeshPart/Gui/CrossSections.cpp @@ -586,7 +586,7 @@ TaskCrossSections::TaskCrossSections(const Base::BoundBox3d& bb) widget = new CrossSections(bb); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Mesh_CrossSections"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/MeshPart/Gui/CrossSections.h b/src/Mod/MeshPart/Gui/CrossSections.h index a3abc64eb4..97a4fa5f34 100644 --- a/src/Mod/MeshPart/Gui/CrossSections.h +++ b/src/Mod/MeshPart/Gui/CrossSections.h @@ -44,7 +44,7 @@ class CrossSections : public QDialog enum Plane { XY, XZ, YZ }; public: - CrossSections(const Base::BoundBox3d& bb, QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + CrossSections(const Base::BoundBox3d& bb, QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~CrossSections(); void accept(); void apply(); diff --git a/src/Mod/MeshPart/Gui/CurveOnMesh.cpp b/src/Mod/MeshPart/Gui/CurveOnMesh.cpp index 19714736c4..2f7ec6b6a1 100644 --- a/src/Mod/MeshPart/Gui/CurveOnMesh.cpp +++ b/src/Mod/MeshPart/Gui/CurveOnMesh.cpp @@ -246,9 +246,9 @@ public: , cosAngle(0.7071) // 45 degree , approximate(true) , curve(new ViewProviderCurveOnMesh) - , mesh(0) - , grid(0) - , viewer(0) + , mesh(nullptr) + , grid(nullptr) + , viewer(nullptr) , editcursor(QPixmap(cursor_curveonmesh), 7, 7) { } @@ -450,7 +450,7 @@ void CurveOnMeshHandler::disableCallback() view3d->removeViewProvider(d_ptr->curve); view3d->removeEventCallback(SoEvent::getClassTypeId(), Private::vertexCallback, this); } - d_ptr->viewer = 0; + d_ptr->viewer = nullptr; } std::vector CurveOnMeshHandler::getVertexes() const diff --git a/src/Mod/MeshPart/Gui/CurveOnMesh.h b/src/Mod/MeshPart/Gui/CurveOnMesh.h index b0dc032153..7886ab524a 100644 --- a/src/Mod/MeshPart/Gui/CurveOnMesh.h +++ b/src/Mod/MeshPart/Gui/CurveOnMesh.h @@ -68,7 +68,7 @@ class CurveOnMeshHandler : public QObject Q_OBJECT public: - CurveOnMeshHandler(QObject* parent = 0); + CurveOnMeshHandler(QObject* parent = nullptr); ~CurveOnMeshHandler(); void enableApproximation(bool); void setParameters(int maxDegree, GeomAbs_Shape cont, double tol3d, double angle); diff --git a/src/Mod/MeshPart/Gui/TaskCurveOnMesh.cpp b/src/Mod/MeshPart/Gui/TaskCurveOnMesh.cpp index 8693168ae9..7786df1ef4 100644 --- a/src/Mod/MeshPart/Gui/TaskCurveOnMesh.cpp +++ b/src/Mod/MeshPart/Gui/TaskCurveOnMesh.cpp @@ -101,7 +101,7 @@ TaskCurveOnMesh::TaskCurveOnMesh(Gui::View3DInventor* view) widget = new CurveOnMeshWidget(view); taskbox = new Gui::TaskView::TaskBox( QPixmap(), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/MeshPart/Gui/TaskCurveOnMesh.h b/src/Mod/MeshPart/Gui/TaskCurveOnMesh.h index cc08757663..dc54612c3f 100644 --- a/src/Mod/MeshPart/Gui/TaskCurveOnMesh.h +++ b/src/Mod/MeshPart/Gui/TaskCurveOnMesh.h @@ -42,7 +42,7 @@ class CurveOnMeshWidget : public QWidget Q_OBJECT public: - CurveOnMeshWidget(Gui::View3DInventor* view, QWidget* parent=0); + CurveOnMeshWidget(Gui::View3DInventor* view, QWidget* parent=nullptr); ~CurveOnMeshWidget(); void reject(); diff --git a/src/Mod/MeshPart/Gui/Tessellation.cpp b/src/Mod/MeshPart/Gui/Tessellation.cpp index f84d528412..ce7f1bfe41 100644 --- a/src/Mod/MeshPart/Gui/Tessellation.cpp +++ b/src/Mod/MeshPart/Gui/Tessellation.cpp @@ -608,7 +608,7 @@ TaskTessellation::TaskTessellation() widget = new Tessellation(); Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox( QPixmap()/*Gui::BitmapFactory().pixmap("MeshPart_Mesher")*/, - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/MeshPart/Gui/Tessellation.h b/src/Mod/MeshPart/Gui/Tessellation.h index 78ad45bc63..82fb69c119 100644 --- a/src/Mod/MeshPart/Gui/Tessellation.h +++ b/src/Mod/MeshPart/Gui/Tessellation.h @@ -47,7 +47,7 @@ class Mesh2ShapeGmsh : public MeshGui::GmshWidget Q_OBJECT public: - Mesh2ShapeGmsh(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + Mesh2ShapeGmsh(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~Mesh2ShapeGmsh(); void process(App::Document* doc, const std::list&); @@ -77,7 +77,7 @@ class Tessellation : public QWidget }; public: - Tessellation(QWidget* parent = 0); + Tessellation(QWidget* parent = nullptr); ~Tessellation(); bool accept();