From 51186c018e845e46db54ae99e81bf502283a6742 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 23 Mar 2022 19:13:52 +0100 Subject: [PATCH] Sketcher: modernize C++11 * use nullptr --- src/Mod/Sketcher/App/AppSketcher.cpp | 2 +- src/Mod/Sketcher/App/ConstraintPyImp.cpp | 18 +- .../App/ExternalGeometryExtensionPyImp.cpp | 8 +- .../App/ExternalGeometryFacadePyImp.cpp | 62 ++-- src/Mod/Sketcher/App/GeometryFacadePyImp.cpp | 62 ++-- .../Sketcher/App/PropertyConstraintList.cpp | 2 +- src/Mod/Sketcher/App/PropertyConstraintList.h | 2 +- src/Mod/Sketcher/App/Sketch.cpp | 10 +- src/Mod/Sketcher/App/Sketch.h | 8 +- .../App/SketchGeometryExtensionPyImp.cpp | 8 +- src/Mod/Sketcher/App/SketchObject.cpp | 18 +- src/Mod/Sketcher/App/SketchObject.h | 4 +- src/Mod/Sketcher/App/SketchObjectPyImp.cpp | 272 +++++++++--------- src/Mod/Sketcher/App/SketchObjectSF.cpp | 2 +- src/Mod/Sketcher/App/SketchObjectSFPyImp.cpp | 2 +- src/Mod/Sketcher/App/SketchPyImp.cpp | 12 +- src/Mod/Sketcher/App/planegcs/Constraints.cpp | 54 ++-- src/Mod/Sketcher/App/planegcs/GCS.cpp | 6 +- src/Mod/Sketcher/App/planegcs/Geo.cpp | 4 +- src/Mod/Sketcher/App/planegcs/Geo.h | 46 +-- src/Mod/Sketcher/Gui/AppSketcherGui.cpp | 4 +- src/Mod/Sketcher/Gui/Command.cpp | 18 +- src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp | 2 +- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 4 +- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 18 +- .../Sketcher/Gui/CommandSketcherBSpline.cpp | 12 +- src/Mod/Sketcher/Gui/CommandSketcherTools.cpp | 18 +- src/Mod/Sketcher/Gui/DrawSketchHandler.cpp | 2 +- .../Gui/EditModeConstraintCoinManager.cpp | 4 +- .../Gui/EditModeConstraintCoinManager.h | 4 +- src/Mod/Sketcher/Gui/SketcherSettings.h | 6 +- src/Mod/Sketcher/Gui/SoDatumLabel.cpp | 2 +- .../Sketcher/Gui/TaskSketcherConstraints.cpp | 10 +- .../Sketcher/Gui/TaskSketcherConstraints.h | 2 +- .../Sketcher/Gui/TaskSketcherCreateCommands.h | 2 +- src/Mod/Sketcher/Gui/TaskSketcherElements.cpp | 6 +- src/Mod/Sketcher/Gui/TaskSketcherElements.h | 2 +- src/Mod/Sketcher/Gui/TaskSketcherGeneral.cpp | 2 +- src/Mod/Sketcher/Gui/TaskSketcherGeneral.h | 2 +- src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp | 2 +- .../Gui/TaskSketcherSolverAdvanced.cpp | 2 +- .../Sketcher/Gui/TaskSketcherValidation.cpp | 4 +- src/Mod/Sketcher/Gui/TaskSketcherValidation.h | 2 +- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 10 +- 44 files changed, 371 insertions(+), 371 deletions(-) diff --git a/src/Mod/Sketcher/App/AppSketcher.cpp b/src/Mod/Sketcher/App/AppSketcher.cpp index f10a3fb567..8f9ed001a7 100644 --- a/src/Mod/Sketcher/App/AppSketcher.cpp +++ b/src/Mod/Sketcher/App/AppSketcher.cpp @@ -56,7 +56,7 @@ PyMOD_INIT_FUNC(Sketcher) } catch(const Base::Exception& e) { PyErr_SetString(PyExc_ImportError, e.what()); - PyMOD_Return(0); + PyMOD_Return(nullptr); } PyObject* sketcherModule = Sketcher::initModule(); diff --git a/src/Mod/Sketcher/App/ConstraintPyImp.cpp b/src/Mod/Sketcher/App/ConstraintPyImp.cpp index d6b19c72a1..fe7942c590 100644 --- a/src/Mod/Sketcher/App/ConstraintPyImp.cpp +++ b/src/Mod/Sketcher/App/ConstraintPyImp.cpp @@ -105,13 +105,13 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/) this->getConstraintPtr()->Type = Equal; valid = true; } - else if (strstr(ConstraintType,"InternalAlignment") != NULL) { + else if (strstr(ConstraintType,"InternalAlignment") != nullptr) { this->getConstraintPtr()->Type = InternalAlignment; valid = true; - if(strstr(ConstraintType,"EllipseMajorDiameter") != NULL) + if(strstr(ConstraintType,"EllipseMajorDiameter") != nullptr) this->getConstraintPtr()->AlignmentType=EllipseMajorDiameter; - else if(strstr(ConstraintType,"EllipseMinorDiameter") != NULL) + else if(strstr(ConstraintType,"EllipseMinorDiameter") != nullptr) this->getConstraintPtr()->AlignmentType=EllipseMinorDiameter; else { this->getConstraintPtr()->AlignmentType=Undef; @@ -198,14 +198,14 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/) this->getConstraintPtr()->Type = PointOnObject; valid = true; } - else if (strstr(ConstraintType,"InternalAlignment") != NULL) { + else if (strstr(ConstraintType,"InternalAlignment") != nullptr) { this->getConstraintPtr()->Type = InternalAlignment; valid = true; - if(strstr(ConstraintType,"EllipseFocus1") != NULL) + if(strstr(ConstraintType,"EllipseFocus1") != nullptr) this->getConstraintPtr()->AlignmentType=EllipseFocus1; - else if(strstr(ConstraintType,"EllipseFocus2") != NULL) + else if(strstr(ConstraintType,"EllipseFocus2") != nullptr) this->getConstraintPtr()->AlignmentType=EllipseFocus2; else { this->getConstraintPtr()->AlignmentType=Undef; @@ -313,12 +313,12 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/) this->getConstraintPtr()->ThirdPos = (Sketcher::PointPos) intArg4; return 0; } - else if (strstr(ConstraintType,"InternalAlignment") != NULL) { // InteralAlignment with InternalElementIndex argument + else if (strstr(ConstraintType,"InternalAlignment") != nullptr) { // InteralAlignment with InternalElementIndex argument this->getConstraintPtr()->Type = InternalAlignment; valid = true; - if(strstr(ConstraintType,"BSplineControlPoint") != NULL) { + if(strstr(ConstraintType,"BSplineControlPoint") != nullptr) { this->getConstraintPtr()->AlignmentType=BSplineControlPoint; } else { @@ -673,7 +673,7 @@ Py::Boolean ConstraintPy::getIsActive(void) const PyObject *ConstraintPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int ConstraintPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Sketcher/App/ExternalGeometryExtensionPyImp.cpp b/src/Mod/Sketcher/App/ExternalGeometryExtensionPyImp.cpp index 2336c5f7d2..4b4819ef21 100644 --- a/src/Mod/Sketcher/App/ExternalGeometryExtensionPyImp.cpp +++ b/src/Mod/Sketcher/App/ExternalGeometryExtensionPyImp.cpp @@ -110,12 +110,12 @@ PyObject* ExternalGeometryExtensionPy::testFlag(PyObject *args) return new_reference_to(Py::Boolean(this->getExternalGeometryExtensionPtr()->testFlag(flagtype))); PyErr_SetString(PyExc_TypeError, "Flag string does not exist."); - return NULL; + return nullptr; } PyErr_SetString(PyExc_TypeError, "No flag string provided."); - return NULL; + return nullptr; } PyObject* ExternalGeometryExtensionPy::setFlag(PyObject *args) @@ -133,7 +133,7 @@ PyObject* ExternalGeometryExtensionPy::setFlag(PyObject *args) } PyErr_SetString(PyExc_TypeError, "Flag string does not exist."); - return NULL; + return nullptr; } PyErr_SetString(PyExc_TypeError, "No flag string provided."); @@ -153,7 +153,7 @@ void ExternalGeometryExtensionPy::setRef(Py::String value) PyObject *ExternalGeometryExtensionPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int ExternalGeometryExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Sketcher/App/ExternalGeometryFacadePyImp.cpp b/src/Mod/Sketcher/App/ExternalGeometryFacadePyImp.cpp index bc8fdf6bd4..c2375823f1 100644 --- a/src/Mod/Sketcher/App/ExternalGeometryFacadePyImp.cpp +++ b/src/Mod/Sketcher/App/ExternalGeometryFacadePyImp.cpp @@ -98,12 +98,12 @@ PyObject* ExternalGeometryFacadePy::testFlag(PyObject *args) } PyErr_SetString(PyExc_TypeError, "Flag string does not exist."); - return NULL; + return nullptr; } PyErr_SetString(PyExc_TypeError, "No flag string provided."); - return NULL; + return nullptr; } PyObject* ExternalGeometryFacadePy::setFlag(PyObject *args) @@ -126,7 +126,7 @@ PyObject* ExternalGeometryFacadePy::setFlag(PyObject *args) } PyErr_SetString(PyExc_TypeError, "Flag string does not exist."); - return NULL; + return nullptr; } PyErr_SetString(PyExc_TypeError, "No flag string provided."); @@ -208,14 +208,14 @@ PyObject* ExternalGeometryFacadePy::mirror(PyObject *args) } PyErr_SetString(Part::PartExceptionOCCError, "either a point (vector) or axis (vector, vector) must be given"); - return 0; + return nullptr; } PyObject* ExternalGeometryFacadePy::rotate(PyObject *args) { PyObject* o; if (!PyArg_ParseTuple(args, "O!", &(Base::PlacementPy::Type),&o)) - return 0; + return nullptr; Base::Placement* plm = static_cast(o)->getPlacementPtr(); getExternalGeometryFacadePtr()->rotate(*plm); @@ -241,14 +241,14 @@ PyObject* ExternalGeometryFacadePy::scale(PyObject *args) } PyErr_SetString(Part::PartExceptionOCCError, "either vector or tuple and float expected"); - return 0; + return nullptr; } PyObject* ExternalGeometryFacadePy::transform(PyObject *args) { PyObject* o; if (!PyArg_ParseTuple(args, "O!", &(Base::MatrixPy::Type),&o)) - return 0; + return nullptr; Base::Matrix4D mat = static_cast(o)->value(); getExternalGeometryFacadePtr()->transform(mat); Py_Return; @@ -272,7 +272,7 @@ PyObject* ExternalGeometryFacadePy::translate(PyObject *args) } PyErr_SetString(Part::PartExceptionOCCError, "either vector or tuple expected"); - return 0; + return nullptr; } PyObject* ExternalGeometryFacadePy::setExtension(PyObject *args) @@ -290,7 +290,7 @@ PyObject* ExternalGeometryFacadePy::setExtension(PyObject *args) } PyErr_SetString(Part::PartExceptionOCCError, "A geometry extension object was expected"); - return 0; + return nullptr; } PyObject* ExternalGeometryFacadePy::getExtensionOfType(PyObject *args) @@ -310,27 +310,27 @@ PyObject* ExternalGeometryFacadePy::getExtensionOfType(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } catch(const std::bad_weak_ptr&) { PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not exist anymore."); - return 0; + return nullptr; } catch(Base::NotImplementedError&) { PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not implement a Python counterpart."); - return 0; + return nullptr; } } else { PyErr_SetString(Part::PartExceptionOCCError, "Exception type does not exist"); - return 0; + return nullptr; } } PyErr_SetString(Part::PartExceptionOCCError, "A string with the name of the geometry extension type was expected"); - return 0; + return nullptr; } PyObject* ExternalGeometryFacadePy::getExtensionOfName(PyObject *args) @@ -347,21 +347,21 @@ PyObject* ExternalGeometryFacadePy::getExtensionOfName(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } catch(const std::bad_weak_ptr&) { PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not exist anymore."); - return 0; + return nullptr; } catch(Base::NotImplementedError&) { PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not implement a Python counterpart."); - return 0; + return nullptr; } } PyErr_SetString(Part::PartExceptionOCCError, "A string with the name of the geometry extension was expected"); - return 0; + return nullptr; } PyObject* ExternalGeometryFacadePy::hasExtensionOfType(PyObject *args) @@ -377,19 +377,19 @@ PyObject* ExternalGeometryFacadePy::hasExtensionOfType(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } else { PyErr_SetString(Part::PartExceptionOCCError, "Exception type does not exist"); - return 0; + return nullptr; } } PyErr_SetString(Part::PartExceptionOCCError, "A string with the type of the geometry extension was expected"); - return 0; + return nullptr; } PyObject* ExternalGeometryFacadePy::hasExtensionOfName(PyObject *args) @@ -402,13 +402,13 @@ PyObject* ExternalGeometryFacadePy::hasExtensionOfName(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } PyErr_SetString(Part::PartExceptionOCCError, "A string with the type of the geometry extension was expected"); - return 0; + return nullptr; } PyObject* ExternalGeometryFacadePy::deleteExtensionOfType(PyObject *args) @@ -425,19 +425,19 @@ PyObject* ExternalGeometryFacadePy::deleteExtensionOfType(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } else { PyErr_SetString(Part::PartExceptionOCCError, "Type does not exist"); - return 0; + return nullptr; } } PyErr_SetString(Part::PartExceptionOCCError, "A string with a type object was expected"); - return 0; + return nullptr; } PyObject* ExternalGeometryFacadePy::deleteExtensionOfName(PyObject *args) @@ -451,19 +451,19 @@ PyObject* ExternalGeometryFacadePy::deleteExtensionOfName(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } PyErr_SetString(Part::PartExceptionOCCError, "A string with the name of the extension was expected"); - return 0; + return nullptr; } PyObject* ExternalGeometryFacadePy::getExtensions(PyObject *args) { if (!PyArg_ParseTuple(args, "")){ PyErr_SetString(Part::PartExceptionOCCError, "No arguments were expected"); - return NULL; + return nullptr; } try { @@ -490,7 +490,7 @@ PyObject* ExternalGeometryFacadePy::getExtensions(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } @@ -541,7 +541,7 @@ void ExternalGeometryFacadePy::setGeometry(Py::Object arg) PyObject *ExternalGeometryFacadePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int ExternalGeometryFacadePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Sketcher/App/GeometryFacadePyImp.cpp b/src/Mod/Sketcher/App/GeometryFacadePyImp.cpp index 89a94e2f5c..3f97e6481c 100644 --- a/src/Mod/Sketcher/App/GeometryFacadePyImp.cpp +++ b/src/Mod/Sketcher/App/GeometryFacadePyImp.cpp @@ -138,11 +138,11 @@ PyObject* GeometryFacadePy::testGeometryMode(PyObject *args) return new_reference_to(Py::Boolean(getGeometryFacadePtr()->testGeometryMode(mode))); PyErr_SetString(PyExc_TypeError, "Flag string does not exist."); - return NULL; + return nullptr; } PyErr_SetString(PyExc_TypeError, "No flag string provided."); - return NULL; + return nullptr; } PyObject* GeometryFacadePy::setGeometryMode(PyObject *args) @@ -159,7 +159,7 @@ PyObject* GeometryFacadePy::setGeometryMode(PyObject *args) } PyErr_SetString(PyExc_TypeError, "Flag string does not exist."); - return NULL; + return nullptr; } PyErr_SetString(PyExc_TypeError, "No flag string provided."); @@ -187,14 +187,14 @@ PyObject* GeometryFacadePy::mirror(PyObject *args) } PyErr_SetString(Part::PartExceptionOCCError, "either a point (vector) or axis (vector, vector) must be given"); - return 0; + return nullptr; } PyObject* GeometryFacadePy::rotate(PyObject *args) { PyObject* o; if (!PyArg_ParseTuple(args, "O!", &(Base::PlacementPy::Type),&o)) - return 0; + return nullptr; Base::Placement* plm = static_cast(o)->getPlacementPtr(); getGeometryFacadePtr()->rotate(*plm); @@ -220,14 +220,14 @@ PyObject* GeometryFacadePy::scale(PyObject *args) } PyErr_SetString(Part::PartExceptionOCCError, "either vector or tuple and float expected"); - return 0; + return nullptr; } PyObject* GeometryFacadePy::transform(PyObject *args) { PyObject* o; if (!PyArg_ParseTuple(args, "O!", &(Base::MatrixPy::Type),&o)) - return 0; + return nullptr; Base::Matrix4D mat = static_cast(o)->value(); getGeometryFacadePtr()->transform(mat); Py_Return; @@ -251,7 +251,7 @@ PyObject* GeometryFacadePy::translate(PyObject *args) } PyErr_SetString(Part::PartExceptionOCCError, "either vector or tuple expected"); - return 0; + return nullptr; } PyObject* GeometryFacadePy::setExtension(PyObject *args) @@ -269,7 +269,7 @@ PyObject* GeometryFacadePy::setExtension(PyObject *args) } PyErr_SetString(Part::PartExceptionOCCError, "A geometry extension object was expected"); - return 0; + return nullptr; } PyObject* GeometryFacadePy::getExtensionOfType(PyObject *args) @@ -289,27 +289,27 @@ PyObject* GeometryFacadePy::getExtensionOfType(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } catch(const std::bad_weak_ptr&) { PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not exist anymore."); - return 0; + return nullptr; } catch(Base::NotImplementedError&) { PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not implement a Python counterpart."); - return 0; + return nullptr; } } else { PyErr_SetString(Part::PartExceptionOCCError, "Exception type does not exist"); - return 0; + return nullptr; } } PyErr_SetString(Part::PartExceptionOCCError, "A string with the name of the geometry extension type was expected"); - return 0; + return nullptr; } PyObject* GeometryFacadePy::getExtensionOfName(PyObject *args) @@ -326,20 +326,20 @@ PyObject* GeometryFacadePy::getExtensionOfName(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } catch(const std::bad_weak_ptr&) { PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not exist anymore."); - return 0; + return nullptr; } catch(Base::NotImplementedError&) { PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not implement a Python counterpart."); - return 0; + return nullptr; } } PyErr_SetString(Part::PartExceptionOCCError, "A string with the name of the geometry extension was expected"); - return 0; + return nullptr; } PyObject* GeometryFacadePy::hasExtensionOfType(PyObject *args) @@ -355,19 +355,19 @@ PyObject* GeometryFacadePy::hasExtensionOfType(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } else { PyErr_SetString(Part::PartExceptionOCCError, "Exception type does not exist"); - return 0; + return nullptr; } } PyErr_SetString(Part::PartExceptionOCCError, "A string with the type of the geometry extension was expected"); - return 0; + return nullptr; } PyObject* GeometryFacadePy::hasExtensionOfName(PyObject *args) @@ -380,13 +380,13 @@ PyObject* GeometryFacadePy::hasExtensionOfName(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } PyErr_SetString(Part::PartExceptionOCCError, "A string with the type of the geometry extension was expected"); - return 0; + return nullptr; } PyObject* GeometryFacadePy::deleteExtensionOfType(PyObject *args) @@ -403,19 +403,19 @@ PyObject* GeometryFacadePy::deleteExtensionOfType(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } else { PyErr_SetString(Part::PartExceptionOCCError, "Type does not exist"); - return 0; + return nullptr; } } PyErr_SetString(Part::PartExceptionOCCError, "A string with a type object was expected"); - return 0; + return nullptr; } PyObject* GeometryFacadePy::deleteExtensionOfName(PyObject *args) @@ -429,19 +429,19 @@ PyObject* GeometryFacadePy::deleteExtensionOfName(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } PyErr_SetString(Part::PartExceptionOCCError, "A string with the name of the extension was expected"); - return 0; + return nullptr; } PyObject* GeometryFacadePy::getExtensions(PyObject *args) { if (!PyArg_ParseTuple(args, "")){ PyErr_SetString(Part::PartExceptionOCCError, "No arguments were expected"); - return NULL; + return nullptr; } try { @@ -468,7 +468,7 @@ PyObject* GeometryFacadePy::getExtensions(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(Part::PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } @@ -518,7 +518,7 @@ void GeometryFacadePy::setGeometry(Py::Object arg) PyObject *GeometryFacadePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int GeometryFacadePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Sketcher/App/PropertyConstraintList.cpp b/src/Mod/Sketcher/App/PropertyConstraintList.cpp index 1c8f2d9af7..879074d532 100644 --- a/src/Mod/Sketcher/App/PropertyConstraintList.cpp +++ b/src/Mod/Sketcher/App/PropertyConstraintList.cpp @@ -256,7 +256,7 @@ bool PropertyConstraintList::getPyPathValue(const App::ObjectIdentifier &path, P const ObjectIdentifier::Component & c1 = path.getPropertyComponent(1); - const Constraint *cstr = 0; + const Constraint *cstr = nullptr; if (c1.isArray()) cstr = _lValueList[c1.getIndex(_lValueList.size())]; diff --git a/src/Mod/Sketcher/App/PropertyConstraintList.h b/src/Mod/Sketcher/App/PropertyConstraintList.h index 27ff8aec6f..f2daec8cf6 100644 --- a/src/Mod/Sketcher/App/PropertyConstraintList.h +++ b/src/Mod/Sketcher/App/PropertyConstraintList.h @@ -99,7 +99,7 @@ public: returns null. This must be checked by the caller. */ const Constraint *operator[] (const int idx) const { - return (invalidGeometry || invalidIndices) ? 0 : _lValueList[idx]; + return (invalidGeometry || invalidIndices) ? nullptr : _lValueList[idx]; } const std::vector &getValues(void) const { diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index 24bddae3c7..5d3032de47 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -1526,7 +1526,7 @@ GCS::Curve* Sketch::getGCSCurveByGeoId(int geoId) return &BSplines[Geoms[geoId].index]; break; default: - return 0; + return nullptr; }; } @@ -2429,7 +2429,7 @@ int Sketch::addAngleAtPointConstraint( return -1; } GCS::Point &p = Points[pointId]; - GCS::Point* p2 = 0; + GCS::Point* p2 = nullptr; if(e2e){//we need second point int pointId = getPointId(geoId2, pos2); if (pointId < 0 || pointId >= int(Points.size())){ @@ -2631,7 +2631,7 @@ int Sketch::addAngleConstraint(int geoId1, PointPos pos1, int geoId2, PointPos p Geoms[geoId2].type != Line) return -1; - GCS::Point *l1p1=0, *l1p2=0; + GCS::Point *l1p1=nullptr, *l1p2=nullptr; if (pos1 == PointPos::start) { l1p1 = &Points[Geoms[geoId1].startPointId]; l1p2 = &Points[Geoms[geoId1].endPointId]; @@ -2640,7 +2640,7 @@ int Sketch::addAngleConstraint(int geoId1, PointPos pos1, int geoId2, PointPos p l1p2 = &Points[Geoms[geoId1].startPointId]; } - GCS::Point *l2p1=0, *l2p2=0; + GCS::Point *l2p1=nullptr, *l2p2=nullptr; if (pos2 == PointPos::start) { l2p1 = &Points[Geoms[geoId2].startPointId]; l2p2 = &Points[Geoms[geoId2].endPointId]; @@ -2649,7 +2649,7 @@ int Sketch::addAngleConstraint(int geoId1, PointPos pos1, int geoId2, PointPos p l2p2 = &Points[Geoms[geoId2].startPointId]; } - if (l1p1 == 0 || l2p1 == 0) + if (l1p1 == nullptr || l2p1 == nullptr) return -1; int tag = ++ConstraintsCounter; diff --git a/src/Mod/Sketcher/App/Sketch.h b/src/Mod/Sketcher/App/Sketch.h index 2d60779cfe..3c9439a943 100644 --- a/src/Mod/Sketcher/App/Sketch.h +++ b/src/Mod/Sketcher/App/Sketch.h @@ -408,7 +408,7 @@ protected: protected: /// container element to store and work with the geometric elements of this sketch struct GeoDef { - GeoDef() : geo(0),type(None),external(false),index(-1), + GeoDef() : geo(nullptr),type(None),external(false),index(-1), startPointId(-1),midPointId(-1),endPointId(-1) {} Part::Geometry * geo; // pointer to the geometry GeoType type; // type of the geometry @@ -420,10 +420,10 @@ protected: }; /// container element to store and work with the constraints of this sketch struct ConstrDef { - ConstrDef() : constr(0) + ConstrDef() : constr(nullptr) , driving(true) - , value(0) - , secondvalue(0) {} + , value(nullptr) + , secondvalue(nullptr) {} Constraint * constr; // pointer to the constraint bool driving; double * value; diff --git a/src/Mod/Sketcher/App/SketchGeometryExtensionPyImp.cpp b/src/Mod/Sketcher/App/SketchGeometryExtensionPyImp.cpp index 833953a63a..bdb9546897 100644 --- a/src/Mod/Sketcher/App/SketchGeometryExtensionPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchGeometryExtensionPyImp.cpp @@ -145,11 +145,11 @@ PyObject* SketchGeometryExtensionPy::testGeometryMode(PyObject *args) return new_reference_to(Py::Boolean(getSketchGeometryExtensionPtr()->testGeometryMode(mode))); PyErr_SetString(PyExc_TypeError, "Flag string does not exist."); - return NULL; + return nullptr; } PyErr_SetString(PyExc_TypeError, "No flag string provided."); - return NULL; + return nullptr; } PyObject* SketchGeometryExtensionPy::setGeometryMode(PyObject *args) @@ -166,7 +166,7 @@ PyObject* SketchGeometryExtensionPy::setGeometryMode(PyObject *args) } PyErr_SetString(PyExc_TypeError, "Flag string does not exist."); - return NULL; + return nullptr; } PyErr_SetString(PyExc_TypeError, "No flag string provided."); @@ -185,7 +185,7 @@ void SketchGeometryExtensionPy::setGeometryLayerId(Py::Long Id) PyObject *SketchGeometryExtensionPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int SketchGeometryExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 7ac77f6d7a..9f2d2e7991 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -103,9 +103,9 @@ PROPERTY_SOURCE(Sketcher::SketchObject, Part::Part2DObject) SketchObject::SketchObject() { - ADD_PROPERTY_TYPE(Geometry, (0) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch geometry"); - ADD_PROPERTY_TYPE(Constraints, (0) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch constraints"); - ADD_PROPERTY_TYPE(ExternalGeometry,(0,0),"Sketch",(App::PropertyType)(App::Prop_None),"Sketch external geometry"); + ADD_PROPERTY_TYPE(Geometry, (nullptr) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch geometry"); + ADD_PROPERTY_TYPE(Constraints, (nullptr) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch constraints"); + ADD_PROPERTY_TYPE(ExternalGeometry,(nullptr,nullptr),"Sketch",(App::PropertyType)(App::Prop_None),"Sketch external geometry"); ADD_PROPERTY_TYPE(FullyConstrained, (false),"Sketch",(App::PropertyType)(App::Prop_Output|App::Prop_ReadOnly |App::Prop_Hidden),"Sketch is fully constrained"); Geometry.setOrderRelevant(true); @@ -3326,7 +3326,7 @@ bool SketchObject::isExternalAllowed(App::Document *pDoc, App::DocumentObject *p App::Part* part_this = App::Part::getPartOfObject(this); App::Part* part_obj = App::Part::getPartOfObject(pObj); if (part_this == part_obj){ //either in the same part, or in the root of document - if (body_this == NULL) { + if (body_this == nullptr) { return true; } else if (body_this == body_obj) { return true; @@ -3385,7 +3385,7 @@ bool SketchObject::isCarbonCopyAllowed(App::Document *pDoc, App::DocumentObject App::Part* part_this = App::Part::getPartOfObject(this); App::Part* part_obj = App::Part::getPartOfObject(pObj); if (part_this == part_obj){ //either in the same part, or in the root of document - if (body_this != NULL) { + if (body_this != nullptr) { if (body_this != body_obj) { if (!this->allowOtherBody) { if (rsn) @@ -7681,7 +7681,7 @@ std::string SketchObject::validateExpression(const App::ObjectIdentifier &path, { const App::Property * prop = path.getProperty(); - assert(expr != 0); + assert(expr != nullptr); if (!prop) return "Property not found"; @@ -7720,7 +7720,7 @@ double SketchObject::calculateAngleViaPoint(int GeoId1, int GeoId2, double px, d const Part::Geometry *p1=this->getGeometry(GeoId1); const Part::Geometry *p2=this->getGeometry(GeoId2); - if(p1!=0 && p2!=0) { + if(p1!=nullptr && p2!=nullptr) { int i1 = sk.addGeometry(this->getGeometry(GeoId1)); int i2 = sk.addGeometry(this->getGeometry(GeoId2)); @@ -8208,7 +8208,7 @@ bool SketchObject::constraintHasExpression(int constrid) const App::PropertyExpressionEngine::ExpressionInfo expr_info = this->getExpression(spath); - return (expr_info.expression != 0); + return (expr_info.expression != nullptr); } @@ -8229,7 +8229,7 @@ int SketchObject::port_reversedExternalArcs(bool justAnalyze) for(std::size_t ic = 0; icgetSketchObjectPtr()->solve(); return Py_BuildValue("i", ret); } @@ -73,7 +73,7 @@ PyObject* SketchObjectPy::addGeometry(PyObject *args) if (!PyArg_ParseTuple(args, "OO!", &pcObj, &PyBool_Type, &construction)) { PyErr_Clear(); if (!PyArg_ParseTuple(args, "O", &pcObj)) - return 0; + return nullptr; else isConstruction=false; } @@ -105,7 +105,7 @@ PyObject* SketchObjectPy::addGeometry(PyObject *args) std::stringstream str; str << "Unsupported geometry type: " << geo->getTypeId().getName(); PyErr_SetString(PyExc_TypeError, str.str().c_str()); - return 0; + return nullptr; } } else if (geo->getTypeId() == Part::GeomPoint::getClassTypeId() || @@ -123,7 +123,7 @@ PyObject* SketchObjectPy::addGeometry(PyObject *args) std::stringstream str; str << "Unsupported geometry type: " << geo->getTypeId().getName(); PyErr_SetString(PyExc_TypeError, str.str().c_str()); - return 0; + return nullptr; } return Py::new_reference_to(Py::Long(ret)); } @@ -159,7 +159,7 @@ PyObject* SketchObjectPy::addGeometry(PyObject *args) std::stringstream str; str << "Unsupported geometry type: " << geo->getTypeId().getName(); PyErr_SetString(PyExc_TypeError, str.str().c_str()); - return 0; + return nullptr; } } else if (geo->getTypeId() == Part::GeomPoint::getClassTypeId() || @@ -177,7 +177,7 @@ PyObject* SketchObjectPy::addGeometry(PyObject *args) std::stringstream str; str << "Unsupported geometry type: " << geo->getTypeId().getName(); PyErr_SetString(PyExc_TypeError, str.str().c_str()); - return 0; + return nullptr; } } } @@ -202,13 +202,13 @@ PyObject* SketchObjectPy::delGeometry(PyObject *args) { int Index; if (!PyArg_ParseTuple(args, "i", &Index)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->delGeometry(Index)) { std::stringstream str; str << "Not able to delete a geometry with the given index: " << Index; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -219,7 +219,7 @@ PyObject* SketchObjectPy::delGeometries(PyObject *args) PyObject *pcObj; if (!PyArg_ParseTuple(args, "O", &pcObj)) - return 0; + return nullptr; if (PyObject_TypeCheck(pcObj, &(PyList_Type)) || PyObject_TypeCheck(pcObj, &(PyTuple_Type)) ) { @@ -235,7 +235,7 @@ PyObject* SketchObjectPy::delGeometries(PyObject *args) std::stringstream str; str << "Not able to delete geometries"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -250,13 +250,13 @@ PyObject* SketchObjectPy::delGeometries(PyObject *args) PyObject* SketchObjectPy::deleteAllGeometry(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; if (this->getSketchObjectPtr()->deleteAllGeometry()) { std::stringstream str; str << "Unable to delete Geometry"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -265,13 +265,13 @@ PyObject* SketchObjectPy::deleteAllGeometry(PyObject *args) PyObject* SketchObjectPy::deleteAllConstraints(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; if (this->getSketchObjectPtr()->deleteAllConstraints()) { std::stringstream str; str << "Unable to delete Constraints"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -282,13 +282,13 @@ PyObject* SketchObjectPy::toggleConstruction(PyObject *args) { int Index; if (!PyArg_ParseTuple(args, "i", &Index)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->toggleConstruction(Index)) { std::stringstream str; str << "Not able to toggle a geometry with the given index: " << Index; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -299,13 +299,13 @@ PyObject* SketchObjectPy::setConstruction(PyObject *args) int Index; PyObject *Mode; if (!PyArg_ParseTuple(args, "iO!", &Index, &PyBool_Type, &Mode)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->setConstruction(Index, PyObject_IsTrue(Mode) ? true : false)) { std::stringstream str; str << "Not able to set construction mode of a geometry with the given index: " << Index; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -315,7 +315,7 @@ PyObject* SketchObjectPy::getConstruction(PyObject *args) { int Index; if (!PyArg_ParseTuple(args, "i", &Index)) - return 0; + return nullptr; auto gf = this->getSketchObjectPtr()->getGeometryFacade(Index); @@ -325,7 +325,7 @@ PyObject* SketchObjectPy::getConstruction(PyObject *args) std::stringstream str; str << "Not able to retrieve construction mode of a geometry with the given index: " << Index; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } @@ -333,13 +333,13 @@ PyObject* SketchObjectPy::addConstraint(PyObject *args) { PyObject *pcObj; if (!PyArg_ParseTuple(args, "O", &pcObj)) - return 0; + return nullptr; if (PyObject_TypeCheck(pcObj, &(Sketcher::ConstraintPy::Type))) { Sketcher::Constraint *constr = static_cast(pcObj)->getConstraintPtr(); if (!this->getSketchObjectPtr()->evaluateConstraint(constr)) { PyErr_SetString(PyExc_IndexError, "Constraint has invalid indexes"); - return 0; + return nullptr; } int ret = this->getSketchObjectPtr()->addConstraint(constr); // this solve is necessary because: @@ -379,7 +379,7 @@ PyObject* SketchObjectPy::addConstraint(PyObject *args) for (std::vector::iterator it = values.begin(); it != values.end(); ++it) { if (!this->getSketchObjectPtr()->evaluateConstraint(*it)) { PyErr_SetString(PyExc_IndexError, "Constraint has invalid indexes"); - return 0; + return nullptr; } } int ret = getSketchObjectPtr()->addConstraints(values) + 1; @@ -401,13 +401,13 @@ PyObject* SketchObjectPy::delConstraint(PyObject *args) { int Index; if (!PyArg_ParseTuple(args, "i", &Index)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->delConstraint(Index)) { std::stringstream str; str << "Not able to delete a constraint with the given index: " << Index; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -418,7 +418,7 @@ PyObject* SketchObjectPy::renameConstraint(PyObject *args) int Index; char* utf8Name; if (!PyArg_ParseTuple(args, "iet", &Index, "utf-8", &utf8Name)) - return 0; + return nullptr; std::string Name = utf8Name; PyMem_Free(utf8Name); @@ -427,7 +427,7 @@ PyObject* SketchObjectPy::renameConstraint(PyObject *args) std::stringstream str; str << "Not able to rename a constraint with the given index: " << Index; PyErr_SetString(PyExc_IndexError, str.str().c_str()); - return 0; + return nullptr; } if (!Name.empty()) { @@ -436,14 +436,14 @@ PyObject* SketchObjectPy::renameConstraint(PyObject *args) std::stringstream str; str << "Invalid constraint name with the given index: " << Index; PyErr_SetString(PyExc_IndexError, str.str().c_str()); - return 0; + return nullptr; } const std::vector< Sketcher::Constraint * > &vals = getSketchObjectPtr()->Constraints.getValues(); for (std::size_t i = 0; i < vals.size(); ++i) { if (static_cast(i) != Index && Name == vals[i]->Name) { PyErr_SetString(PyExc_ValueError, "Duplicate constraint not allowed"); - return 0; + return nullptr; } } } @@ -457,14 +457,14 @@ PyObject* SketchObjectPy::getIndexByName(PyObject *args) { char* utf8Name; if (!PyArg_ParseTuple(args, "et", "utf-8", &utf8Name)) - return 0; + return nullptr; std::string Name = utf8Name; PyMem_Free(utf8Name); if (Name.empty()) { PyErr_SetString(PyExc_ValueError, "Passed string is empty"); - return 0; + return nullptr; } const std::vector< Sketcher::Constraint * > &vals = getSketchObjectPtr()->Constraints.getValues(); @@ -475,7 +475,7 @@ PyObject* SketchObjectPy::getIndexByName(PyObject *args) } PyErr_SetString(PyExc_LookupError, "No such constraint found"); - return 0; + return nullptr; } PyObject* SketchObjectPy::carbonCopy(PyObject *args) @@ -483,7 +483,7 @@ PyObject* SketchObjectPy::carbonCopy(PyObject *args) char *ObjectName; PyObject *construction = Py_True; if (!PyArg_ParseTuple(args, "s|O!:Give an object", &ObjectName, &PyBool_Type, &construction)) - return 0; + return nullptr; Sketcher::SketchObject* skObj = this->getSketchObjectPtr(); App::DocumentObject * Obj = skObj->getDocument()->getObject(ObjectName); @@ -492,14 +492,14 @@ PyObject* SketchObjectPy::carbonCopy(PyObject *args) std::stringstream str; str << ObjectName << " does not exist in the document"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } // check if this type of external geometry is allowed if (!skObj->isExternalAllowed(Obj->getDocument(), Obj) && (Obj->getTypeId() != Sketcher::SketchObject::getClassTypeId())) { std::stringstream str; str << ObjectName << " is not allowed for a carbon copy operation in this sketch"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } // add the external @@ -507,7 +507,7 @@ PyObject* SketchObjectPy::carbonCopy(PyObject *args) std::stringstream str; str << "Not able to add the requested geometry"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -518,7 +518,7 @@ PyObject* SketchObjectPy::addExternal(PyObject *args) char *ObjectName; char *SubName; if (!PyArg_ParseTuple(args, "ss:Give an object and subelement name", &ObjectName,&SubName)) - return 0; + return nullptr; // get the target object for the external link Sketcher::SketchObject* skObj = this->getSketchObjectPtr(); @@ -527,14 +527,14 @@ PyObject* SketchObjectPy::addExternal(PyObject *args) std::stringstream str; str << ObjectName << " does not exist in the document"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } // check if this type of external geometry is allowed if (!skObj->isExternalAllowed(Obj->getDocument(), Obj)) { std::stringstream str; str << ObjectName << " is not allowed as external geometry of this sketch"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } // add the external @@ -542,7 +542,7 @@ PyObject* SketchObjectPy::addExternal(PyObject *args) std::stringstream str; str << "Not able to add external shape element"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -552,13 +552,13 @@ PyObject* SketchObjectPy::delExternal(PyObject *args) { int Index; if (!PyArg_ParseTuple(args, "i", &Index)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->delExternal(Index)) { std::stringstream str; str << "Not able to delete an external geometry with the given index: " << Index; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -568,7 +568,7 @@ PyObject* SketchObjectPy::delConstraintOnPoint(PyObject *args) { int Index, pos=-1; if (!PyArg_ParseTuple(args, "i|i", &Index, &pos)) - return 0; + return nullptr; if (pos >= static_cast(Sketcher::PointPos::none) && pos <= static_cast(Sketcher::PointPos::mid)) { // This is the whole range of valid positions if (this->getSketchObjectPtr()->delConstraintOnPoint(Index,(Sketcher::PointPos)pos)) { @@ -576,7 +576,7 @@ PyObject* SketchObjectPy::delConstraintOnPoint(PyObject *args) str << "Not able to delete a constraint on point with the given index: " << Index << " and position: " << pos; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } } else if (pos==-1) { @@ -584,12 +584,12 @@ PyObject* SketchObjectPy::delConstraintOnPoint(PyObject *args) std::stringstream str; str << "Not able to delete a constraint on point with the given index: " << Index; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } } else { PyErr_SetString(PyExc_ValueError, "Wrong PointPos argument"); - return 0; + return nullptr; } Py_Return; @@ -652,7 +652,7 @@ PyObject* SketchObjectPy::setDatum(PyObject *args) std::stringstream str; str << "Invalid constraint name: '" << constrName << "'"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } } @@ -677,13 +677,13 @@ PyObject* SketchObjectPy::setDatum(PyObject *args) std::stringstream str; str << "Invalid constraint name: '" << constrName << "'"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } } // error handling PyErr_SetString(PyExc_TypeError, "Wrong arguments"); - return 0; + return nullptr; } while (false); @@ -705,7 +705,7 @@ PyObject* SketchObjectPy::setDatum(PyObject *args) else str << "Unexpected problem at setting datum " << (const char*)Quantity.getUserString().toUtf8() << " for the constraint with index " << Index; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -714,14 +714,14 @@ PyObject* SketchObjectPy::setDatum(PyObject *args) PyObject* SketchObjectPy::getDatum(PyObject *args) { const std::vector& vals = this->getSketchObjectPtr()->Constraints.getValues(); - Constraint* constr = 0; + Constraint* constr = nullptr; do { int index = 0; if (PyArg_ParseTuple(args,"i", &index)) { if (index < 0 || index >= static_cast(vals.size())) { PyErr_SetString(PyExc_IndexError, "index out of range"); - return 0; + return nullptr; } constr = vals[index]; @@ -743,7 +743,7 @@ PyObject* SketchObjectPy::getDatum(PyObject *args) std::stringstream str; str << "Invalid constraint name: '" << name << "'"; PyErr_SetString(PyExc_NameError, str.str().c_str()); - return 0; + return nullptr; } else { break; @@ -752,7 +752,7 @@ PyObject* SketchObjectPy::getDatum(PyObject *args) // error handling PyErr_SetString(PyExc_TypeError, "Wrong arguments"); - return 0; + return nullptr; } while (false); @@ -764,7 +764,7 @@ PyObject* SketchObjectPy::getDatum(PyObject *args) type != Diameter && type != Angle) { PyErr_SetString(PyExc_TypeError, "Constraint is not a datum"); - return 0; + return nullptr; } Base::Quantity datum; @@ -786,13 +786,13 @@ PyObject* SketchObjectPy::setDriving(PyObject *args) int constrid; if (!PyArg_ParseTuple(args, "iO!", &constrid, &PyBool_Type, &driving)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->setDriving(constrid, PyObject_IsTrue(driving) ? true : false)) { std::stringstream str; str << "Not able set Driving/reference for constraint with the given index: " << constrid; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -803,13 +803,13 @@ PyObject* SketchObjectPy::setDatumsDriving(PyObject *args) PyObject* driving; if (!PyArg_ParseTuple(args, "O!", &PyBool_Type, &driving)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->setDatumsDriving(PyObject_IsTrue(driving) ? true : false)) { std::stringstream str; str << "Not able set all dimensionals driving/reference"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -818,13 +818,13 @@ PyObject* SketchObjectPy::setDatumsDriving(PyObject *args) PyObject* SketchObjectPy::moveDatumsToEnd(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; if (this->getSketchObjectPtr()->moveDatumsToEnd()) { std::stringstream str; str << "Not able move all dimensionals to end"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -837,11 +837,11 @@ PyObject* SketchObjectPy::getDriving(PyObject *args) bool driving; if (!PyArg_ParseTuple(args, "i", &constrid)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->getDriving(constrid, driving)) { PyErr_SetString(PyExc_ValueError, "Invalid constraint id"); - return 0; + return nullptr; } return Py::new_reference_to(Py::Boolean(driving)); @@ -852,13 +852,13 @@ PyObject* SketchObjectPy::toggleDriving(PyObject *args) int constrid; if (!PyArg_ParseTuple(args, "i", &constrid)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->toggleDriving(constrid)) { std::stringstream str; str << "Not able toggle Driving for constraint with the given index: " << constrid; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -870,7 +870,7 @@ PyObject* SketchObjectPy::setVirtualSpace(PyObject *args) PyObject* id_or_ids; if (!PyArg_ParseTuple(args, "OO!", &id_or_ids, &PyBool_Type, &invirtualspace)) { - return 0; + return nullptr; } if (PyObject_TypeCheck(id_or_ids, &(PyList_Type)) || @@ -900,7 +900,7 @@ PyObject* SketchObjectPy::setVirtualSpace(PyObject *args) std::stringstream str; str << "Not able set virtual space for constraint with the given index: " << PyLong_AsLong(id_or_ids); PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -918,11 +918,11 @@ PyObject* SketchObjectPy::getVirtualSpace(PyObject *args) bool invirtualspace; if (!PyArg_ParseTuple(args, "i", &constrid)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->getVirtualSpace(constrid, invirtualspace)) { PyErr_SetString(PyExc_ValueError, "Invalid constraint id"); - return 0; + return nullptr; } return Py::new_reference_to(Py::Boolean(invirtualspace)); @@ -933,13 +933,13 @@ PyObject* SketchObjectPy::toggleVirtualSpace(PyObject *args) int constrid; if (!PyArg_ParseTuple(args, "i", &constrid)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->toggleVirtualSpace(constrid)) { std::stringstream str; str << "Not able toggle virtual space for constraint with the given index: " << constrid; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -951,13 +951,13 @@ PyObject* SketchObjectPy::setActive(PyObject *args) int constrid; if (!PyArg_ParseTuple(args, "iO!", &constrid, &PyBool_Type, &isactive)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->setActive(constrid, PyObject_IsTrue(isactive) ? true : false)) { std::stringstream str; str << "Not able set active/disabled status for constraint with the given index: " << constrid; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -969,11 +969,11 @@ PyObject* SketchObjectPy::getActive(PyObject *args) bool isactive; if (!PyArg_ParseTuple(args, "i", &constrid)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->getActive(constrid, isactive)) { PyErr_SetString(PyExc_ValueError, "Invalid constraint id"); - return 0; + return nullptr; } return Py::new_reference_to(Py::Boolean(isactive)); @@ -984,13 +984,13 @@ PyObject* SketchObjectPy::toggleActive(PyObject *args) int constrid; if (!PyArg_ParseTuple(args, "i", &constrid)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->toggleActive(constrid)) { std::stringstream str; str << "Not able toggle on/off constraint with the given index: " << constrid; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1003,7 +1003,7 @@ PyObject* SketchObjectPy::movePoint(PyObject *args) int relative=0; if (!PyArg_ParseTuple(args, "iiO!|i", &GeoId, &PointType, &(Base::VectorPy::Type), &pcObj, &relative)) - return 0; + return nullptr; Base::Vector3d v1 = static_cast(pcObj)->value(); @@ -1011,7 +1011,7 @@ PyObject* SketchObjectPy::movePoint(PyObject *args) std::stringstream str; str << "Not able to move point with the id and type: (" << GeoId << ", " << PointType << ")"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1022,7 +1022,7 @@ PyObject* SketchObjectPy::getGeoVertexIndex(PyObject *args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; SketchObject* obj = this->getSketchObjectPtr(); int geoId; @@ -1038,17 +1038,17 @@ PyObject* SketchObjectPy::getPoint(PyObject *args) { int GeoId, PointType; if (!PyArg_ParseTuple(args, "ii", &GeoId, &PointType)) - return 0; + return nullptr; if (PointType < 0 || PointType > 3) { PyErr_SetString(PyExc_ValueError, "Invalid point type"); - return 0; + return nullptr; } SketchObject* obj = this->getSketchObjectPtr(); if (GeoId > obj->getHighestCurveIndex() || -GeoId > obj->getExternalGeometryCount()) { PyErr_SetString(PyExc_ValueError, "Invalid geometry Id"); - return 0; + return nullptr; } return new Base::VectorPy(new Base::Vector3d(obj->getPoint(GeoId,(Sketcher::PointPos)PointType))); @@ -1058,7 +1058,7 @@ PyObject* SketchObjectPy::getAxis(PyObject *args) { int AxId; if (!PyArg_ParseTuple(args, "i", &AxId)) - return 0; + return nullptr; return new Base::AxisPy(new Base::Axis(this->getSketchObjectPtr()->getAxis(AxId))); } @@ -1085,7 +1085,7 @@ PyObject* SketchObjectPy::fillet(PyObject *args) str << "Not able to fillet curves with ids : (" << geoId1 << ", " << geoId2 << ") and points (" << v1.x << ", " << v1.y << ", " << v1.z << ") & " << "(" << v2.x << ", " << v2.y << ", " << v2.z << ")"; THROWM(Base::ValueError, str.str().c_str()) - return 0; + return nullptr; } Py_Return; } @@ -1098,7 +1098,7 @@ PyObject* SketchObjectPy::fillet(PyObject *args) std::stringstream str; str << "Not able to fillet point with ( geoId: " << geoId1 << ", PointPos: " << posId1 << " )"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; } @@ -1106,7 +1106,7 @@ PyObject* SketchObjectPy::fillet(PyObject *args) PyErr_SetString(PyExc_TypeError, "fillet() method accepts:\n" "-- int,int,Vector,Vector,float,[bool],[bool]\n" "-- int,int,float,[bool],[bool]\n"); - return 0; + return nullptr; } PyObject* SketchObjectPy::trim(PyObject *args) @@ -1115,7 +1115,7 @@ PyObject* SketchObjectPy::trim(PyObject *args) int GeoId; if (!PyArg_ParseTuple(args, "iO!", &GeoId, &(Base::VectorPy::Type), &pcObj)) - return 0; + return nullptr; Base::Vector3d v1 = static_cast(pcObj)->value(); @@ -1123,7 +1123,7 @@ PyObject* SketchObjectPy::trim(PyObject *args) std::stringstream str; str << "Not able to trim curve with the given index: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1140,14 +1140,14 @@ PyObject* SketchObjectPy::extend(PyObject *args) std::stringstream str; str << "Not able to extend geometry with id : (" << GeoId << ") for increment (" << increment << ") and point position (" << endPoint << ")"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; } PyErr_SetString(PyExc_TypeError, "extend() method accepts:\n" "-- int,float,int\n"); - return 0; + return nullptr; } PyObject* SketchObjectPy::split(PyObject *args) @@ -1156,14 +1156,14 @@ PyObject* SketchObjectPy::split(PyObject *args) int GeoId; if (!PyArg_ParseTuple(args, "iO!", &GeoId, &(Base::VectorPy::Type), &pcObj)) - return 0; + return nullptr; Base::Vector3d v1 = static_cast(pcObj)->value(); if (this->getSketchObjectPtr()->split(GeoId,v1)) { std::stringstream str; str << "Not able to split curve with the given index: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1176,7 +1176,7 @@ PyObject* SketchObjectPy::addSymmetric(PyObject *args) int refPosId = static_cast(Sketcher::PointPos::none); if (!PyArg_ParseTuple(args, "Oi|i", &pcObj, &refGeoId, &refPosId)) - return 0; + return nullptr; if (PyObject_TypeCheck(pcObj, &(PyList_Type)) || PyObject_TypeCheck(pcObj, &(PyTuple_Type))) { @@ -1213,7 +1213,7 @@ PyObject* SketchObjectPy::addCopy(PyObject *args) PyObject* clone= Py_False; if (!PyArg_ParseTuple(args, "OO!|O!", &pcObj, &(Base::VectorPy::Type), &pcVect, &PyBool_Type, &clone)) - return 0; + return nullptr; Base::Vector3d vect = static_cast(pcVect)->value(); @@ -1257,7 +1257,7 @@ PyObject* SketchObjectPy::addMove(PyObject *args) PyObject *pcObj, *pcVect; if (!PyArg_ParseTuple(args, "OO!", &pcObj, &(Base::VectorPy::Type), &pcVect)) - return 0; + return nullptr; Base::Vector3d vect = static_cast(pcVect)->value(); @@ -1290,7 +1290,7 @@ PyObject* SketchObjectPy::addRectangularArray(PyObject *args) if (!PyArg_ParseTuple(args, "OO!O!ii|O!d", &pcObj, &(Base::VectorPy::Type), &pcVect, &PyBool_Type, &clone, &rows, &cols, &PyBool_Type, &constraindisplacement,&perpscale)) - return 0; + return nullptr; Base::Vector3d vect = static_cast(pcVect)->value(); @@ -1328,7 +1328,7 @@ PyObject* SketchObjectPy::removeAxesAlignment(PyObject *args) PyObject *pcObj; if (!PyArg_ParseTuple(args, "O", &pcObj)) - return 0; + return nullptr; if (PyObject_TypeCheck(pcObj, &(PyList_Type)) || PyObject_TypeCheck(pcObj, &(PyTuple_Type))) { @@ -1357,13 +1357,13 @@ PyObject* SketchObjectPy::calculateAngleViaPoint(PyObject *args) int GeoId1=0, GeoId2=0; double px=0, py=0; if (!PyArg_ParseTuple(args, "iidd", &GeoId1, &GeoId2, &px, &py)) - return 0; + return nullptr; SketchObject* obj = this->getSketchObjectPtr(); if (GeoId1 > obj->getHighestCurveIndex() || -GeoId1 > obj->getExternalGeometryCount() || GeoId2 > obj->getHighestCurveIndex() || -GeoId2 > obj->getExternalGeometryCount() ) { PyErr_SetString(PyExc_ValueError, "Invalid geometry Id"); - return 0; + return nullptr; } double ang = obj->calculateAngleViaPoint(GeoId1, GeoId2, px, py); @@ -1375,12 +1375,12 @@ PyObject* SketchObjectPy::isPointOnCurve(PyObject *args) int GeoId=GeoEnum::GeoUndef; double px=0, py=0; if (!PyArg_ParseTuple(args, "idd", &GeoId, &px, &py)) - return 0; + return nullptr; SketchObject* obj = this->getSketchObjectPtr(); if (GeoId > obj->getHighestCurveIndex() || -GeoId > obj->getExternalGeometryCount()) { PyErr_SetString(PyExc_ValueError, "Invalid geometry Id"); - return 0; + return nullptr; } return Py::new_reference_to(Py::Boolean(obj->isPointOnCurve(GeoId, px, py))); @@ -1390,12 +1390,12 @@ PyObject* SketchObjectPy::calculateConstraintError(PyObject *args) { int ic=-1; if (!PyArg_ParseTuple(args, "i", &ic)) - return 0; + return nullptr; SketchObject* obj = this->getSketchObjectPtr(); if (ic >= obj->Constraints.getSize() || ic < 0) { PyErr_SetString(PyExc_ValueError, "Invalid constraint Id"); - return 0; + return nullptr; } double err = obj->calculateConstraintError(ic); @@ -1406,7 +1406,7 @@ PyObject* SketchObjectPy::changeConstraintsLocking(PyObject *args) { int bLock=0; if (!PyArg_ParseTuple(args, "i", &bLock)) - return 0; + return nullptr; SketchObject* obj = this->getSketchObjectPtr(); @@ -1421,13 +1421,13 @@ PyObject* SketchObjectPy::ExposeInternalGeometry(PyObject *args) int GeoId; if (!PyArg_ParseTuple(args, "i", &GeoId)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->exposeInternalGeometry(GeoId)==-1) { std::stringstream str; str << "Object does not support internal geometry: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1439,13 +1439,13 @@ PyObject* SketchObjectPy::DeleteUnusedInternalGeometry(PyObject *args) int GeoId; if (!PyArg_ParseTuple(args, "i", &GeoId)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->deleteUnusedInternalGeometry(GeoId)==-1) { std::stringstream str; str << "Object does not support internal geometry: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1456,13 +1456,13 @@ PyObject* SketchObjectPy::exposeInternalGeometry(PyObject *args) int GeoId; if (!PyArg_ParseTuple(args, "i", &GeoId)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->exposeInternalGeometry(GeoId)==-1) { std::stringstream str; str << "Object does not support internal geometry: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1473,13 +1473,13 @@ PyObject* SketchObjectPy::deleteUnusedInternalGeometry(PyObject *args) int GeoId; if (!PyArg_ParseTuple(args, "i", &GeoId)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->deleteUnusedInternalGeometry(GeoId)==-1) { std::stringstream str; str << "Object does not support internal geometry: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1490,13 +1490,13 @@ PyObject* SketchObjectPy::convertToNURBS(PyObject *args) int GeoId; if (!PyArg_ParseTuple(args, "i", &GeoId)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->convertToNURBS(GeoId)==false) { std::stringstream str; str << "Object does not support NURBS conversion: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1508,13 +1508,13 @@ PyObject* SketchObjectPy::increaseBSplineDegree(PyObject *args) int incr = 1; if (!PyArg_ParseTuple(args, "i|i", &GeoId, &incr)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->increaseBSplineDegree(GeoId, incr)==false) { std::stringstream str; str << "Degree increase failed for: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1539,13 +1539,13 @@ PyObject* SketchObjectPy::modifyBSplineKnotMultiplicity(PyObject *args) int multiplicity = 1; if (!PyArg_ParseTuple(args, "ii|i", &GeoId, &knotIndex, &multiplicity)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->modifyBSplineKnotMultiplicity(GeoId, knotIndex, multiplicity)==false) { std::stringstream str; str << "Multiplicity modification failed for: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1558,13 +1558,13 @@ PyObject* SketchObjectPy::insertBSplineKnot(PyObject *args) int multiplicity = 1; if (!PyArg_ParseTuple(args, "id|i", &GeoId, &knotParam, &multiplicity)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->insertBSplineKnot(GeoId, knotParam, multiplicity)==false) { std::stringstream str; str << "Knot insertion failed for: " << GeoId; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1578,13 +1578,13 @@ PyObject* SketchObjectPy::autoconstraint(PyObject *args) if (!PyArg_ParseTuple(args, "|ddO!", &precision, &angleprecision, &PyBool_Type, &includeconstruction)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->autoConstraint(precision, angleprecision, PyObject_IsTrue(includeconstruction) ? true : false)) { std::stringstream str; str << "Unable to autoconstraint"; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1596,7 +1596,7 @@ PyObject* SketchObjectPy::detectMissingPointOnPointConstraints(PyObject *args) PyObject* includeconstruction = Py_True; if (!PyArg_ParseTuple(args, "|dO!", &precision, &PyBool_Type, &includeconstruction)) - return 0; + return nullptr; return Py::new_reference_to(Py::Long(this->getSketchObjectPtr()->detectMissingPointOnPointConstraints(precision, PyObject_IsTrue(includeconstruction) ? true : false))); } @@ -1606,7 +1606,7 @@ PyObject* SketchObjectPy::detectMissingVerticalHorizontalConstraints(PyObject *a double angleprecision = M_PI/8; if (!PyArg_ParseTuple(args, "|d", &angleprecision)) - return 0; + return nullptr; return Py::new_reference_to(Py::Long(this->getSketchObjectPtr()->detectMissingVerticalHorizontalConstraints(angleprecision))); } @@ -1616,7 +1616,7 @@ PyObject* SketchObjectPy::detectMissingEqualityConstraints(PyObject *args) double precision = Precision::Confusion() * 1000; if (!PyArg_ParseTuple(args, "|d", &precision)) - return 0; + return nullptr; return Py::new_reference_to(Py::Long(this->getSketchObjectPtr()->detectMissingEqualityConstraints(precision))); } @@ -1626,7 +1626,7 @@ PyObject* SketchObjectPy::analyseMissingPointOnPointCoincident(PyObject *args) double angleprecision = M_PI/8; if (!PyArg_ParseTuple(args, "|d", &angleprecision)) - return 0; + return nullptr; this->getSketchObjectPtr()->analyseMissingPointOnPointCoincident(angleprecision); @@ -1639,7 +1639,7 @@ PyObject* SketchObjectPy::makeMissingPointOnPointCoincident(PyObject *args) PyObject* onebyone = Py_False; if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &onebyone)) - return 0; + return nullptr; this->getSketchObjectPtr()->makeMissingPointOnPointCoincident(PyObject_IsTrue(onebyone) ? true : false); @@ -1651,7 +1651,7 @@ PyObject* SketchObjectPy::makeMissingVerticalHorizontal(PyObject *args) PyObject* onebyone = Py_False; if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &onebyone)) - return 0; + return nullptr; this->getSketchObjectPtr()->makeMissingVerticalHorizontal(PyObject_IsTrue(onebyone) ? true : false); @@ -1663,7 +1663,7 @@ PyObject* SketchObjectPy::makeMissingEquality(PyObject *args) PyObject* onebyone = Py_True; if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &onebyone)) - return 0; + return nullptr; this->getSketchObjectPtr()->makeMissingEquality(PyObject_IsTrue(onebyone) ? true : false); @@ -1675,7 +1675,7 @@ PyObject* SketchObjectPy::autoRemoveRedundants(PyObject *args) PyObject* updategeo = Py_True; if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &updategeo)) - return 0; + return nullptr; this->getSketchObjectPtr()->autoRemoveRedundants(PyObject_IsTrue(updategeo) ? true : false); @@ -1847,7 +1847,7 @@ void SketchObjectPy::setMissingRadiusConstraints(Py::List arg) PyObject* SketchObjectPy::getGeometryWithDependentParameters(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; std::vector> geometrymap; @@ -1936,7 +1936,7 @@ PyObject* SketchObjectPy::getGeometryId(PyObject *args) { int Index; if (!PyArg_ParseTuple(args, "i", &Index)) - return 0; + return nullptr; long Id; @@ -1955,13 +1955,13 @@ PyObject* SketchObjectPy::setGeometryId(PyObject *args) int Index; long Id; if (!PyArg_ParseTuple(args, "il", &Index, &Id)) - return 0; + return nullptr; if (this->getSketchObjectPtr()->setGeometryId(Index, Id)) { std::stringstream str; str << "Not able to set geometry Id of a geometry with the given index: " << Index; PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return 0; + return nullptr; } Py_Return; @@ -1972,7 +1972,7 @@ PyObject* SketchObjectPy::setGeometryId(PyObject *args) PyObject *SketchObjectPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int SketchObjectPy::setCustomAttributes(const char* attr, PyObject* obj) diff --git a/src/Mod/Sketcher/App/SketchObjectSF.cpp b/src/Mod/Sketcher/App/SketchObjectSF.cpp index ef6c0e8d8c..62cda0f236 100644 --- a/src/Mod/Sketcher/App/SketchObjectSF.cpp +++ b/src/Mod/Sketcher/App/SketchObjectSF.cpp @@ -39,7 +39,7 @@ PROPERTY_SOURCE(Sketcher::SketchObjectSF, Part::Part2DObject) SketchObjectSF::SketchObjectSF() { - ADD_PROPERTY_TYPE(SketchFlatFile,(0),"",(App::PropertyType)(App::Prop_None), + ADD_PROPERTY_TYPE(SketchFlatFile,(nullptr),"",(App::PropertyType)(App::Prop_None), "SketchFlat file (*.skf) which defines this sketch"); } diff --git a/src/Mod/Sketcher/App/SketchObjectSFPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectSFPyImp.cpp index 61014422ca..0e29918fe9 100644 --- a/src/Mod/Sketcher/App/SketchObjectSFPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchObjectSFPyImp.cpp @@ -40,7 +40,7 @@ std::string SketchObjectSFPy::representation(void) const PyObject *SketchObjectSFPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int SketchObjectSFPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Sketcher/App/SketchPyImp.cpp b/src/Mod/Sketcher/App/SketchPyImp.cpp index 39778e2fff..52f5455490 100644 --- a/src/Mod/Sketcher/App/SketchPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchPyImp.cpp @@ -63,7 +63,7 @@ int SketchPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/) PyObject* SketchPy::solve(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; getSketchPtr()->resetSolver(); return Py::new_reference_to(Py::Long(getSketchPtr()->solve())); } @@ -72,7 +72,7 @@ PyObject* SketchPy::addGeometry(PyObject *args) { PyObject *pcObj; if (!PyArg_ParseTuple(args, "O", &pcObj)) - return 0; + return nullptr; if (PyObject_TypeCheck(pcObj, &(Part::GeometryPy::Type))) { Part::Geometry *geo = static_cast(pcObj)->getGeometryPtr(); @@ -108,7 +108,7 @@ PyObject* SketchPy::addConstraint(PyObject *args) { PyObject *pcObj; if (!PyArg_ParseTuple(args, "O", &pcObj)) - return 0; + return nullptr; if (PyObject_TypeCheck(pcObj, &(PyList_Type)) || PyObject_TypeCheck(pcObj, &(PyTuple_Type))) { std::vector values; @@ -144,7 +144,7 @@ PyObject* SketchPy::addConstraint(PyObject *args) PyObject* SketchPy::clear(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; getSketchPtr()->clear(); @@ -157,7 +157,7 @@ PyObject* SketchPy::movePoint(PyObject *args) PyObject *pcObj; int relative=0; if (!PyArg_ParseTuple(args, "iiO!|i", &index1,&index2,&(Base::VectorPy::Type),&pcObj,&relative)) - return 0; + return nullptr; Base::Vector3d* toPoint = static_cast(pcObj)->getVectorPtr(); return Py::new_reference_to(Py::Long(getSketchPtr()->movePoint(index1,(Sketcher::PointPos)index2,*toPoint,(relative>0)))); @@ -209,7 +209,7 @@ Py::Object SketchPy::getShape(void) const PyObject *SketchPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int SketchPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Sketcher/App/planegcs/Constraints.cpp b/src/Mod/Sketcher/App/planegcs/Constraints.cpp index 9260cd2c83..e28c3ad8d7 100644 --- a/src/Mod/Sketcher/App/planegcs/Constraints.cpp +++ b/src/Mod/Sketcher/App/planegcs/Constraints.cpp @@ -553,7 +553,7 @@ void ConstraintPointOnPerpBisector::errorgrad(double *err, double *grad, double double ConstraintPointOnPerpBisector::error() { double err; - errorgrad(&err,0,0); + errorgrad(&err,nullptr,nullptr); return scale * err; } @@ -563,7 +563,7 @@ double ConstraintPointOnPerpBisector::grad(double *param) if ( findParamInPvec(param) == -1 ) return 0.0; double deriv; - errorgrad(0, &deriv, param); + errorgrad(nullptr, &deriv, param); return deriv*scale; } @@ -1095,7 +1095,7 @@ void ConstraintEllipseTangentLine::errorgrad(double *err, double *grad, double * double ConstraintEllipseTangentLine::error() { double err; - errorgrad(&err,0,0); + errorgrad(&err,nullptr,nullptr); return scale * err; } @@ -1105,7 +1105,7 @@ double ConstraintEllipseTangentLine::grad(double *param) if ( findParamInPvec(param) == -1 ) return 0.0; double deriv; - errorgrad(0, &deriv, param); + errorgrad(nullptr, &deriv, param); //use numeric for testing #if 0 @@ -1220,7 +1220,7 @@ void ConstraintInternalAlignmentPoint2Ellipse::errorgrad(double *err, double *gr double ConstraintInternalAlignmentPoint2Ellipse::error() { double err; - errorgrad(&err,0,0); + errorgrad(&err,nullptr,nullptr); return scale * err; } @@ -1231,7 +1231,7 @@ double ConstraintInternalAlignmentPoint2Ellipse::grad(double *param) if ( findParamInPvec(param) == -1 ) return 0.0; double deriv; - errorgrad(0, &deriv, param); + errorgrad(nullptr, &deriv, param); //use numeric for testing #if 0 @@ -1353,7 +1353,7 @@ void ConstraintInternalAlignmentPoint2Hyperbola::errorgrad(double *err, double * double ConstraintInternalAlignmentPoint2Hyperbola::error() { double err; - errorgrad(&err,0,0); + errorgrad(&err,nullptr,nullptr); return scale * err; } @@ -1364,7 +1364,7 @@ double ConstraintInternalAlignmentPoint2Hyperbola::grad(double *param) if ( findParamInPvec(param) == -1 ) return 0.0; double deriv; - errorgrad(0, &deriv, param); + errorgrad(nullptr, &deriv, param); return deriv*scale; @@ -1416,7 +1416,7 @@ void ConstraintEqualMajorAxesConic::errorgrad(double *err, double *grad, double double ConstraintEqualMajorAxesConic::error() { double err; - errorgrad(&err,0,0); + errorgrad(&err,nullptr,nullptr); return scale * err; } @@ -1426,7 +1426,7 @@ double ConstraintEqualMajorAxesConic::grad(double *param) if ( findParamInPvec(param) == -1 ) return 0.0; double deriv; - errorgrad(0, &deriv, param); + errorgrad(nullptr, &deriv, param); return deriv * scale; } @@ -1492,7 +1492,7 @@ void ConstraintEqualFocalDistance::errorgrad(double *err, double *grad, double * double ConstraintEqualFocalDistance::error() { double err; - errorgrad(&err,0,0); + errorgrad(&err,nullptr,nullptr); return scale * err; } @@ -1502,7 +1502,7 @@ double ConstraintEqualFocalDistance::grad(double *param) if ( findParamInPvec(param) == -1 ) return 0.0; double deriv; - errorgrad(0, &deriv, param); + errorgrad(nullptr, &deriv, param); return deriv * scale; } @@ -1523,7 +1523,7 @@ ConstraintCurveValue::ConstraintCurveValue(Point &p, double* pcoord, Curve& crv, ConstraintCurveValue::~ConstraintCurveValue() { - delete this->crv; this->crv = 0; + delete this->crv; this->crv = nullptr; } void ConstraintCurveValue::ReconstructGeomPointers() @@ -1580,7 +1580,7 @@ void ConstraintCurveValue::errorgrad(double *err, double *grad, double *param) double ConstraintCurveValue::error() { double err; - errorgrad(&err,0,0); + errorgrad(&err,nullptr,nullptr); return scale * err; } @@ -1590,7 +1590,7 @@ double ConstraintCurveValue::grad(double *param) if ( findParamInPvec(param) == -1 ) return 0.0; double deriv; - errorgrad(0, &deriv, param); + errorgrad(nullptr, &deriv, param); return deriv*scale; } @@ -1748,7 +1748,7 @@ ConstraintPointOnParabola::ConstraintPointOnParabola(Point &p, ArcOfParabola &e) ConstraintPointOnParabola::~ConstraintPointOnParabola() { - delete this->parab; this->parab = 0; + delete this->parab; this->parab = nullptr; } void ConstraintPointOnParabola::ReconstructGeomPointers() @@ -1807,7 +1807,7 @@ void ConstraintPointOnParabola::errorgrad(double *err, double *grad, double *par double ConstraintPointOnParabola::error() { double err; - errorgrad(&err,0,0); + errorgrad(&err,nullptr,nullptr); return scale * err; } @@ -1817,7 +1817,7 @@ double ConstraintPointOnParabola::grad(double *param) if ( findParamInPvec(param) == -1 ) return 0.0; double deriv; - errorgrad(0, &deriv, param); + errorgrad(nullptr, &deriv, param); return deriv*scale; } @@ -1838,8 +1838,8 @@ ConstraintAngleViaPoint::ConstraintAngleViaPoint(Curve &acrv1, Curve &acrv2, Poi } ConstraintAngleViaPoint::~ConstraintAngleViaPoint() { - delete crv1; crv1 = 0; - delete crv2; crv2 = 0; + delete crv1; crv1 = nullptr; + delete crv2; crv2 = nullptr; } void ConstraintAngleViaPoint::ReconstructGeomPointers() @@ -1941,9 +1941,9 @@ ConstraintSnell::ConstraintSnell(Curve &ray1, Curve &ray2, Curve &boundary, Poin } ConstraintSnell::~ConstraintSnell() { - delete ray1; ray1 = 0; - delete ray2; ray2 = 0; - delete boundary; boundary = 0; + delete ray1; ray1 = nullptr; + delete ray2; ray2 = nullptr; + delete boundary; boundary = nullptr; } void ConstraintSnell::ReconstructGeomPointers() @@ -1992,7 +1992,7 @@ void ConstraintSnell::errorgrad(double *err, double *grad, double* param) double ConstraintSnell::error() { double err; - errorgrad(&err, 0, 0); + errorgrad(&err, nullptr, nullptr); return scale * err; } @@ -2003,7 +2003,7 @@ double ConstraintSnell::grad(double *param) if ( findParamInPvec(param) == -1 ) return 0.0; double deriv; - errorgrad(0, &deriv, param); + errorgrad(nullptr, &deriv, param); //use numeric for testing @@ -2111,7 +2111,7 @@ void ConstraintEqualLineLength::errorgrad(double *err, double *grad, double *par double ConstraintEqualLineLength::error() { double err; - errorgrad(&err,0,0); + errorgrad(&err,nullptr,nullptr); return scale * err; } @@ -2120,7 +2120,7 @@ double ConstraintEqualLineLength::grad(double *param) if ( findParamInPvec(param) == -1 ) return 0.0; double deriv; - errorgrad(0, &deriv, param); + errorgrad(nullptr, &deriv, param); return deriv*scale; } diff --git a/src/Mod/Sketcher/App/planegcs/GCS.cpp b/src/Mod/Sketcher/App/planegcs/GCS.cpp index 68bc17d22a..3b6bf45ec7 100644 --- a/src/Mod/Sketcher/App/planegcs/GCS.cpp +++ b/src/Mod/Sketcher/App/planegcs/GCS.cpp @@ -1521,8 +1521,8 @@ void System::initSolution(Algorithm alg) clist1.push_back(*constr); } - subSystems.push_back(NULL); - subSystemsAux.push_back(NULL); + subSystems.push_back(nullptr); + subSystemsAux.push_back(nullptr); if (clist0.size() > 0) subSystems[cid] = new SubSystem(clist0, plists[cid], reductionmaps[cid]); if (clist1.size() > 0) @@ -4477,7 +4477,7 @@ void System::identifyConflictingRedundantConstraints( Algorithm alg, break; int maxPopularity = 0; - Constraint *mostPopular = NULL; + Constraint *mostPopular = nullptr; for (std::map< Constraint *, SET_I >::const_iterator it=conflictingMap.begin(); it != conflictingMap.end(); ++it) { if (static_cast(it->second.size()) > maxPopularity || diff --git a/src/Mod/Sketcher/App/planegcs/Geo.cpp b/src/Mod/Sketcher/App/planegcs/Geo.cpp index fe96c9fbc3..9b1fc8d61c 100644 --- a/src/Mod/Sketcher/App/planegcs/Geo.cpp +++ b/src/Mod/Sketcher/App/planegcs/Geo.cpp @@ -236,7 +236,7 @@ double Ellipse::getRadMaj(double *derivparam, double &ret_dRadMaj) const double Ellipse::getRadMaj() const { double dradmaj;//dummy - return getRadMaj(0,dradmaj); + return getRadMaj(nullptr,dradmaj); } DeriVector2 Ellipse::CalculateNormal(const Point &p, const double* derivparam) const @@ -394,7 +394,7 @@ double Hyperbola::getRadMaj(double *derivparam, double &ret_dRadMaj) const double Hyperbola::getRadMaj() const { double dradmaj;//dummy - return getRadMaj(0,dradmaj); + return getRadMaj(nullptr,dradmaj); } DeriVector2 Hyperbola::CalculateNormal(const Point &p, const double* derivparam) const diff --git a/src/Mod/Sketcher/App/planegcs/Geo.h b/src/Mod/Sketcher/App/planegcs/Geo.h index 9018003f17..a3a8915285 100644 --- a/src/Mod/Sketcher/App/planegcs/Geo.h +++ b/src/Mod/Sketcher/App/planegcs/Geo.h @@ -31,7 +31,7 @@ namespace GCS class Point { public: - Point(){x = 0; y = 0;} + Point(){x = nullptr; y = nullptr;} Point(double *px, double *py) {x=px; y=py;} double *x; double *y; @@ -65,7 +65,7 @@ namespace GCS //unlike other vectors in FreeCAD, this normalization creates a new vector instead of modifying existing one. DeriVector2 getNormalized() const; //returns zero vector if the original is zero. - double scalarProd(const DeriVector2 &v2, double* dprd=0) const;//calculates scalar product of two vectors and returns the result. The derivative of the result is written into argument dprd. + double scalarProd(const DeriVector2 &v2, double* dprd=nullptr) const;//calculates scalar product of two vectors and returns the result. The derivative of the result is written into argument dprd. DeriVector2 sum(const DeriVector2 &v2) const {//adds two vectors and returns result return DeriVector2(x + v2.x, y + v2.y, dx + v2.dx, dy + v2.dy);} @@ -100,7 +100,7 @@ namespace GCS //derivparam is a pointer to a curve parameter (or point coordinate) to // compute the derivative for. The derivative is returned through dx,dy // fields of DeriVector2. - virtual DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const = 0; + virtual DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const = 0; /** * @brief Value: returns point (vector) given the value of parameter @@ -109,7 +109,7 @@ namespace GCS * @param derivparam: pointer to sketch parameter to calculate the derivative for * @return */ - virtual DeriVector2 Value(double u, double du, const double* derivparam = 0) const; + virtual DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const; //adds curve's parameters to pvec (used by constraints) virtual int PushOwnParams(VEC_pD &pvec) = 0; @@ -126,8 +126,8 @@ namespace GCS virtual ~Line(){} Point p1; Point p2; - DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const override; - DeriVector2 Value(double u, double du, const double* derivparam = 0) const override; + DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const override; + DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override; virtual int PushOwnParams(VEC_pD &pvec) override; virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt) override; virtual Line* Copy() override; @@ -136,12 +136,12 @@ namespace GCS class Circle: public Curve { public: - Circle(){rad = 0;} + Circle(){rad = nullptr;} virtual ~Circle(){} Point center; double *rad; - DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const override; - DeriVector2 Value(double u, double du, const double* derivparam = 0) const override; + DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const override; + DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override; virtual int PushOwnParams(VEC_pD &pvec) override; virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt) override; virtual Circle* Copy() override; @@ -150,7 +150,7 @@ namespace GCS class Arc: public Circle { public: - Arc(){startAngle=0;endAngle=0;rad=0;} + Arc(){startAngle=nullptr;endAngle=nullptr;rad=nullptr;} virtual ~Arc(){} double *startAngle; double *endAngle; @@ -176,7 +176,7 @@ namespace GCS class Ellipse: public MajorRadiusConic { public: - Ellipse(){ radmin = 0;} + Ellipse(){ radmin = nullptr;} virtual ~Ellipse(){} Point center; Point focus1; @@ -184,8 +184,8 @@ namespace GCS virtual double getRadMaj(const DeriVector2 ¢er, const DeriVector2 &f1, double b, double db, double &ret_dRadMaj) const override; virtual double getRadMaj(double* derivparam, double &ret_dRadMaj) const override; virtual double getRadMaj() const override; - DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const override; - DeriVector2 Value(double u, double du, const double* derivparam = 0) const override; + DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const override; + DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override; virtual int PushOwnParams(VEC_pD &pvec) override; virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt) override; virtual Ellipse* Copy() override; @@ -194,7 +194,7 @@ namespace GCS class ArcOfEllipse: public Ellipse { public: - ArcOfEllipse(){startAngle=0;endAngle=0;radmin = 0;} + ArcOfEllipse(){startAngle=nullptr;endAngle=nullptr;radmin = nullptr;} virtual ~ArcOfEllipse(){} double *startAngle; double *endAngle; @@ -212,7 +212,7 @@ namespace GCS class Hyperbola: public MajorRadiusConic { public: - Hyperbola(){ radmin = 0;} + Hyperbola(){ radmin = nullptr;} virtual ~Hyperbola(){} Point center; Point focus1; @@ -220,8 +220,8 @@ namespace GCS virtual double getRadMaj(const DeriVector2 ¢er, const DeriVector2 &f1, double b, double db, double &ret_dRadMaj) const override; virtual double getRadMaj(double* derivparam, double &ret_dRadMaj) const override; virtual double getRadMaj() const override; - DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const override; - virtual DeriVector2 Value(double u, double du, const double* derivparam = 0) const override; + DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const override; + virtual DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override; virtual int PushOwnParams(VEC_pD &pvec) override; virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt) override; virtual Hyperbola* Copy() override; @@ -230,7 +230,7 @@ namespace GCS class ArcOfHyperbola: public Hyperbola { public: - ArcOfHyperbola(){startAngle=0;endAngle=0;radmin = 0;} + ArcOfHyperbola(){startAngle=nullptr;endAngle=nullptr;radmin = nullptr;} virtual ~ArcOfHyperbola(){} // parameters double *startAngle; @@ -250,8 +250,8 @@ namespace GCS virtual ~Parabola(){} Point vertex; Point focus1; - DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const override; - virtual DeriVector2 Value(double u, double du, const double* derivparam = 0) const override; + DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const override; + virtual DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override; virtual int PushOwnParams(VEC_pD &pvec) override; virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt) override; virtual Parabola* Copy() override; @@ -260,7 +260,7 @@ namespace GCS class ArcOfParabola: public Parabola { public: - ArcOfParabola(){startAngle=0;endAngle=0;} + ArcOfParabola(){startAngle=nullptr;endAngle=nullptr;} virtual ~ArcOfParabola(){} // parameters double *startAngle; @@ -293,8 +293,8 @@ namespace GCS bool periodic; VEC_I knotpointGeoids; // geoids of knotpoints as to index Geom array // interface helpers - DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const override; - virtual DeriVector2 Value(double u, double du, const double* derivparam = 0) const override; + DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const override; + virtual DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override; virtual int PushOwnParams(VEC_pD &pvec) override; virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt) override; virtual BSpline* Copy() override; diff --git a/src/Mod/Sketcher/Gui/AppSketcherGui.cpp b/src/Mod/Sketcher/Gui/AppSketcherGui.cpp index 8433d85b6b..d7d6104f1f 100644 --- a/src/Mod/Sketcher/Gui/AppSketcherGui.cpp +++ b/src/Mod/Sketcher/Gui/AppSketcherGui.cpp @@ -85,7 +85,7 @@ PyMOD_INIT_FUNC(SketcherGui) { if (!Gui::Application::Instance) { PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application."); - PyMOD_Return(0); + PyMOD_Return(nullptr); } try { Base::Interpreter().runString("import PartGui"); @@ -93,7 +93,7 @@ PyMOD_INIT_FUNC(SketcherGui) } catch(const Base::Exception& e) { PyErr_SetString(PyExc_ImportError, e.what()); - PyMOD_Return(0); + PyMOD_Return(nullptr); } PyObject* mod = SketcherGui::initModule(); diff --git a/src/Mod/Sketcher/Gui/Command.cpp b/src/Mod/Sketcher/Gui/Command.cpp index fa5fad09f9..d88e826657 100644 --- a/src/Mod/Sketcher/Gui/Command.cpp +++ b/src/Mod/Sketcher/Gui/Command.cpp @@ -82,16 +82,16 @@ namespace SketcherGui { }; - Attacher::eMapMode SuggestAutoMapMode(Attacher::SuggestResult::eSuggestResult* pMsgId = 0, - QString* message = 0, - std::vector* allmodes = 0){ + Attacher::eMapMode SuggestAutoMapMode(Attacher::SuggestResult::eSuggestResult* pMsgId = nullptr, + QString* message = nullptr, + std::vector* allmodes = nullptr){ //convert pointers into valid references, to avoid checking for null pointers everywhere Attacher::SuggestResult::eSuggestResult buf; - if (pMsgId == 0) + if (pMsgId == nullptr) pMsgId = &buf; Attacher::SuggestResult::eSuggestResult &msg = *pMsgId; QString buf2; - if (message == 0) + if (message == nullptr) message = &buf2; QString &msg_str = *message; @@ -399,7 +399,7 @@ void CmdSketcherReorientSketch::activated(int iMsg) QMessageBox::Yes|QMessageBox::No); if (ret == QMessageBox::No) return; - sketch->Support.setValue(0); + sketch->Support.setValue(nullptr); } // ask user for orientation @@ -733,7 +733,7 @@ CmdSketcherValidateSketch::CmdSketcherValidateSketch() void CmdSketcherValidateSketch::activated(int iMsg) { Q_UNUSED(iMsg); - std::vector selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + std::vector selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); if (selection.size() != 1) { QMessageBox::warning(Gui::getMainWindow(), qApp->translate("CmdSketcherValidateSketch", "Wrong selection"), @@ -772,7 +772,7 @@ CmdSketcherMirrorSketch::CmdSketcherMirrorSketch() void CmdSketcherMirrorSketch::activated(int iMsg) { Q_UNUSED(iMsg); - std::vector selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + std::vector selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); if (selection.size() < 1) { QMessageBox::warning(Gui::getMainWindow(), qApp->translate("CmdSketcherMirrorSketch", "Wrong selection"), @@ -877,7 +877,7 @@ CmdSketcherMergeSketches::CmdSketcherMergeSketches() void CmdSketcherMergeSketches::activated(int iMsg) { Q_UNUSED(iMsg); - std::vector selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + std::vector selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); if (selection.size() < 2) { QMessageBox::warning(Gui::getMainWindow(), qApp->translate("CmdSketcherMergeSketches", "Wrong selection"), diff --git a/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp b/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp index 35ce7092cc..44681cf8e7 100644 --- a/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp +++ b/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp @@ -115,7 +115,7 @@ void CmdSketcherToggleConstruction::activated(int iMsg) { // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 97bf3daa0a..1dea34d355 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -521,7 +521,7 @@ int SketchSelection::setUp(void) { std::vector selection = Gui::Selection().getSelectionEx(); - Sketcher::SketchObject *SketchObj=0; + Sketcher::SketchObject *SketchObj=nullptr; std::vector SketchSubNames; std::vector SupportSubNames; @@ -605,7 +605,7 @@ namespace SketcherGui { App::DocumentObject* object; public: GenericConstraintSelection(App::DocumentObject* obj) - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr) , object(obj), allowedSelTypes(0) {} diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index d9b1dbf3a1..f583f8048e 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -120,7 +120,7 @@ SketcherGui::ViewProviderSketch* getSketchViewprovider(Gui::Document *doc) (SketcherGui::ViewProviderSketch::getClassTypeId()) ) return dynamic_cast(doc->getInEdit()); } - return 0; + return nullptr; } void removeRedundantHorizontalVertical(Sketcher::SketchObject* psketch, @@ -5686,7 +5686,7 @@ namespace SketcherGui { App::DocumentObject* object; public: FilletSelection(App::DocumentObject* obj) - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0), object(obj) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj) {} bool allow(App::Document * /*pDoc*/, App::DocumentObject *pObj, const char *sSubName) @@ -6099,7 +6099,7 @@ namespace SketcherGui { App::DocumentObject* object; public: TrimmingSelection(App::DocumentObject* obj) - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0), object(obj) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj) {} bool allow(App::Document * /*pDoc*/, App::DocumentObject *pObj, const char *sSubName) @@ -6262,7 +6262,7 @@ namespace SketcherGui { App::DocumentObject* object; public: ExtendSelection(App::DocumentObject* obj) - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr) , object(obj) , disabled(false) {} @@ -6577,7 +6577,7 @@ namespace SketcherGui { App::DocumentObject* object; public: SplittingSelection(App::DocumentObject* obj) - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0), object(obj) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj) {} bool allow(App::Document * /*pDoc*/, App::DocumentObject *pObj, const char *sSubName) @@ -6695,7 +6695,7 @@ namespace SketcherGui { App::DocumentObject* object; public: ExternalSelection(App::DocumentObject* obj) - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0), object(obj) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj) {} bool allow(App::Document *pDoc, App::DocumentObject *pObj, const char *sSubName) @@ -6785,7 +6785,7 @@ public: { if (msg.Type == Gui::SelectionChanges::AddSelection) { App::DocumentObject* obj = sketchgui->getObject()->getDocument()->getObject(msg.pObjectName); - if (obj == NULL) + if (obj == nullptr) throw Base::ValueError("Sketcher: External geometry: Invalid object in selection"); std::string subName(msg.pSubName); if (obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId()) || @@ -6882,7 +6882,7 @@ namespace SketcherGui { App::DocumentObject* object; public: CarbonCopySelection(App::DocumentObject* obj) - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0), object(obj) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj) {} bool allow(App::Document *pDoc, App::DocumentObject *pObj, const char *sSubName) @@ -6971,7 +6971,7 @@ public: { if (msg.Type == Gui::SelectionChanges::AddSelection) { App::DocumentObject* obj = sketchgui->getObject()->getDocument()->getObject(msg.pObjectName); - if (obj == NULL) + if (obj == nullptr) throw Base::ValueError("Sketcher: Carbon Copy: Invalid object in selection"); if (obj->getTypeId() == Sketcher::SketchObject::getClassTypeId()) { diff --git a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp index 3e4ea3e6c6..2912d77225 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp @@ -431,7 +431,7 @@ void CmdSketcherConvertToNURBS::activated(int iMsg) // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { @@ -505,7 +505,7 @@ void CmdSketcherIncreaseDegree::activated(int iMsg) // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { @@ -578,7 +578,7 @@ void CmdSketcherDecreaseDegree::activated(int iMsg) // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { @@ -664,7 +664,7 @@ void CmdSketcherIncreaseKnotMultiplicity::activated(int iMsg) // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { @@ -811,7 +811,7 @@ void CmdSketcherDecreaseKnotMultiplicity::activated(int iMsg) // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { @@ -1186,7 +1186,7 @@ void CmdSketcherInsertKnot::activated(int iMsg) // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // TODO: let user click on a curve after pressing command. // only one sketch with its subelements are allowed to be selected diff --git a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp index bce3f729c1..c5ae118a39 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp @@ -123,7 +123,7 @@ void CmdSketcherCloseShape::activated(int iMsg) // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { @@ -234,7 +234,7 @@ void CmdSketcherConnect::activated(int iMsg) // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { @@ -317,7 +317,7 @@ void CmdSketcherSelectConstraints::activated(int iMsg) // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // Cancel any in-progress operation Gui::Document* doc = Gui::Application::Instance->activeDocument(); @@ -967,7 +967,7 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg) // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { @@ -1080,7 +1080,7 @@ void CmdSketcherSymmetry::activated(int iMsg) // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { @@ -1484,7 +1484,7 @@ void SketcherCopy::activate(SketcherCopy::Op op) int LastGeoId = 0; Sketcher::PointPos LastPointPos = Sketcher::PointPos::none; - const Part::Geometry *LastGeo = 0; + const Part::Geometry *LastGeo = nullptr; // create python command with list of elements std::stringstream stream; @@ -2015,7 +2015,7 @@ void CmdSketcherRectangularArray::activated(int iMsg) Q_UNUSED(iMsg); // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { @@ -2040,7 +2040,7 @@ void CmdSketcherRectangularArray::activated(int iMsg) int LastGeoId = 0; Sketcher::PointPos LastPointPos = Sketcher::PointPos::none; - const Part::Geometry *LastGeo = 0; + const Part::Geometry *LastGeo = nullptr; // create python command with list of elements std::stringstream stream; @@ -2282,7 +2282,7 @@ void CmdSketcherRemoveAxesAlignment::activated(int iMsg) Q_UNUSED(iMsg); // get the selection std::vector selection; - selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp index be268c3279..8349c209c0 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp @@ -217,7 +217,7 @@ void CurveConverter::OnChange(Base::Subject &rCaller, const char * //************************************************************************** // Construction/Destruction -DrawSketchHandler::DrawSketchHandler() : sketchgui(0) {} +DrawSketchHandler::DrawSketchHandler() : sketchgui(nullptr) {} DrawSketchHandler::~DrawSketchHandler() {} diff --git a/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.cpp b/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.cpp index a5f78101d8..58d1e77209 100644 --- a/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.cpp +++ b/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.cpp @@ -1289,7 +1289,7 @@ void EditModeConstraintCoinManager::updateConstraintColor(const std::vector(s->getChild(static_cast(ConstraintNodePosition::MaterialIndex))); @@ -1727,7 +1727,7 @@ std::set EditModeConstraintCoinManager::detectPreselectionConstr(const SoPi if (editModeScenegraphNodes.constrGroup->getChild(i) == tailFather) { SoSeparator *sep = static_cast(tailFather); if (sep->getNumChildren() > static_cast(ConstraintNodePosition::FirstConstraintIdIndex)) { - SoInfo *constrIds = NULL; + SoInfo *constrIds = nullptr; if (tail == sep->getChild(static_cast(ConstraintNodePosition::FirstIconIndex))) { // First icon was hit constrIds = static_cast(sep->getChild(static_cast(ConstraintNodePosition::FirstConstraintIdIndex))); diff --git a/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.h b/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.h index fbcb2c546d..ffe1a212b0 100644 --- a/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.h +++ b/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.h @@ -225,10 +225,10 @@ private: //! Gets populated with bounding boxes (in icon //! image coordinates) for the icon at left, then //! labels for different constraints. - std::vector *boundingBoxes = NULL, + std::vector *boundingBoxes = nullptr, //! If not NULL, gets set to the number of pixels //! that the text extends below the icon base. - int *vPad = NULL); + int *vPad = nullptr); /// Copies a QImage constraint icon into a SoImage* /*! Used by drawTypicalConstraintIcon() and drawMergedConstraintIcons() */ diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.h b/src/Mod/Sketcher/Gui/SketcherSettings.h index 003c0fe0b9..d833fcce7d 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.h +++ b/src/Mod/Sketcher/Gui/SketcherSettings.h @@ -41,7 +41,7 @@ class SketcherSettings : public Gui::Dialog::PreferencePage Q_OBJECT public: - SketcherSettings(QWidget* parent = 0); + SketcherSettings(QWidget* parent = nullptr); ~SketcherSettings(); void saveSettings(); @@ -64,7 +64,7 @@ class SketcherSettingsDisplay : public Gui::Dialog::PreferencePage Q_OBJECT public: - SketcherSettingsDisplay(QWidget* parent = 0); + SketcherSettingsDisplay(QWidget* parent = nullptr); ~SketcherSettingsDisplay(); void saveSettings(); @@ -89,7 +89,7 @@ class SketcherSettingsColors : public Gui::Dialog::PreferencePage Q_OBJECT public: - SketcherSettingsColors(QWidget* parent = 0); + SketcherSettingsColors(QWidget* parent = nullptr); ~SketcherSettingsColors(); void saveSettings(); diff --git a/src/Mod/Sketcher/Gui/SoDatumLabel.cpp b/src/Mod/Sketcher/Gui/SoDatumLabel.cpp index d31ae8fe49..944f2819f1 100644 --- a/src/Mod/Sketcher/Gui/SoDatumLabel.cpp +++ b/src/Mod/Sketcher/Gui/SoDatumLabel.cpp @@ -458,7 +458,7 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action) } const unsigned char * dataptr = this->image.getValue(imgsize, nc); - if (dataptr == NULL) return; // no image + if (dataptr == nullptr) return; // no image srcw = imgsize[0]; srch = imgsize[1]; diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp index 388ef3c4ec..0046b7a483 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp @@ -515,10 +515,10 @@ void ConstraintView::contextMenuEvent (QContextMenuEvent* event) ,QKeySequence(Qt::Key_F2) #endif ); - rename->setEnabled(item != 0); + rename->setEnabled(item != nullptr); QAction* center = menu.addAction(tr("Center sketch"), this, SLOT(centerSelectedItems())); - center->setEnabled(item != 0); + center->setEnabled(item != nullptr); QAction* remove = menu.addAction(tr("Delete"), this, SLOT(deleteSelectedItems()), QKeySequence(QKeySequence::Delete)); @@ -636,7 +636,7 @@ void ConstraintView::swapNamedOfSelectedItems() // ---------------------------------------------------------------------------- TaskSketcherConstraints::TaskSketcherConstraints(ViewProviderSketch *sketchView) : - TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Constraints"), true, 0), + TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Constraints"), true, nullptr), sketchView(sketchView), inEditMode(false), ui(new Ui_TaskSketcherConstraints) { @@ -763,7 +763,7 @@ void TaskSketcherConstraints::updateAssociatedConstraintsFilter() assert(sketchView); std::vector selection; - selection = Gui::Selection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = Gui::Selection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { @@ -1422,7 +1422,7 @@ void TaskSketcherConstraints::slotConstraintsChanged(void) for (int i = 0; i < ui->listWidgetConstraints->count(); ++i) { ConstraintItem * it = dynamic_cast(ui->listWidgetConstraints->item(i)); - assert(it != 0); + assert(it != nullptr); it->ConstraintNbr = i; it->value = QVariant(); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.h b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.h index 5f2941aa35..319e044ba3 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.h @@ -47,7 +47,7 @@ class ConstraintView : public QListWidget Q_OBJECT public: - explicit ConstraintView(QWidget *parent = 0); + explicit ConstraintView(QWidget *parent = nullptr); ~ConstraintView(); protected: diff --git a/src/Mod/Sketcher/Gui/TaskSketcherCreateCommands.h b/src/Mod/Sketcher/Gui/TaskSketcherCreateCommands.h index 96673165e9..f72e3819a3 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherCreateCommands.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherCreateCommands.h @@ -45,7 +45,7 @@ class TaskSketcherCreateCommands : public TaskBox, public Gui::SelectionSingleto Q_OBJECT public: - TaskSketcherCreateCommands(QWidget *parent = 0); + TaskSketcherCreateCommands(QWidget *parent = nullptr); ~TaskSketcherCreateCommands(); /// Observer message from the Selection void OnChange(Gui::SelectionSingleton::SubjectType &rCaller, diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp index 800725646a..1b3199833e 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp @@ -257,7 +257,7 @@ void ElementView::keyPressEvent(QKeyEvent * event) /* TRANSLATOR SketcherGui::TaskSketcherElements */ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView) - : TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Elements"),true, 0) + : TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Elements"),true, nullptr) , sketchView(sketchView) , ui(new Ui_TaskSketcherElements()) , focusItemIndex(-1) @@ -468,13 +468,13 @@ void TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(void) if(focusItemIndex>-1 && focusItemIndexlistWidgetElements->count()) itf=static_cast(ui->listWidgetElements->item(focusItemIndex)); else - itf=NULL; + itf=nullptr; bool multipleselection=true; // ctrl type of selection in listWidget bool multipleconsecutiveselection=false; // shift type of selection in listWidget if (!inhibitSelectionUpdate) { - if(itf!=NULL) { + if(itf!=nullptr) { switch(element){ case 0: itf->isLineSelected=!itf->isLineSelected; diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.h b/src/Mod/Sketcher/Gui/TaskSketcherElements.h index f6c35ad31d..ca2a8c1773 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.h @@ -44,7 +44,7 @@ class ElementView : public QListWidget Q_OBJECT public: - explicit ElementView(QWidget *parent = 0); + explicit ElementView(QWidget *parent = nullptr); ~ElementView(); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherGeneral.cpp b/src/Mod/Sketcher/Gui/TaskSketcherGeneral.cpp index 81a2ec0077..959b64f697 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherGeneral.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherGeneral.cpp @@ -190,7 +190,7 @@ void SketcherGeneralWidget::changeEvent(QEvent *e) // ---------------------------------------------------------------------------- TaskSketcherGeneral::TaskSketcherGeneral(ViewProviderSketch *sketchView) - : TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Edit controls"),true, 0) + : TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Edit controls"),true, nullptr) , sketchView(sketchView) { // we need a separate container widget to add all controls to diff --git a/src/Mod/Sketcher/Gui/TaskSketcherGeneral.h b/src/Mod/Sketcher/Gui/TaskSketcherGeneral.h index 2c267714f4..f6c94019cb 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherGeneral.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherGeneral.h @@ -46,7 +46,7 @@ class SketcherGeneralWidget : public QWidget Q_OBJECT public: - SketcherGeneralWidget(QWidget *parent=0); + SketcherGeneralWidget(QWidget *parent=nullptr); ~SketcherGeneralWidget(); bool eventFilter(QObject *object, QEvent *event); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp b/src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp index 85bf3d7e0f..e7eff19f60 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp @@ -48,7 +48,7 @@ using namespace Gui::TaskView; namespace bp = boost::placeholders; TaskSketcherMessages::TaskSketcherMessages(ViewProviderSketch *sketchView) : - TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Solver messages"), true, 0), + TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Solver messages"), true, nullptr), sketchView(sketchView), ui(new Ui_TaskSketcherMessages) { diff --git a/src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp b/src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp index 1b59b7e1b9..affe5cc06e 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherSolverAdvanced.cpp @@ -61,7 +61,7 @@ using namespace SketcherGui; using namespace Gui::TaskView; TaskSketcherSolverAdvanced::TaskSketcherSolverAdvanced(ViewProviderSketch *sketchView) : - TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Advanced solver control"), true, 0), + TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Advanced solver control"), true, nullptr), sketchView(sketchView), ui(new Ui_TaskSketcherSolverAdvanced) { diff --git a/src/Mod/Sketcher/Gui/TaskSketcherValidation.cpp b/src/Mod/Sketcher/Gui/TaskSketcherValidation.cpp index 11b9eb0cd2..462b721032 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherValidation.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherValidation.cpp @@ -64,7 +64,7 @@ using namespace Gui::TaskView; /* TRANSLATOR SketcherGui::SketcherValidation */ SketcherValidation::SketcherValidation(Sketcher::SketchObject* Obj, QWidget* parent) -: QWidget(parent), ui(new Ui_TaskSketcherValidation()), sketch(Obj), sketchAnalyser(Obj), coincidenceRoot(0) +: QWidget(parent), ui(new Ui_TaskSketcherValidation()), sketch(Obj), sketchAnalyser(Obj), coincidenceRoot(nullptr) { ui->setupUi(this); ui->fixButton->setEnabled(false); @@ -431,7 +431,7 @@ TaskSketcherValidation::TaskSketcherValidation(Sketcher::SketchObject* Obj) { QWidget* widget = new SketcherValidation(Obj); Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox( - QPixmap(), widget->windowTitle(), true, 0); + QPixmap(), widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Sketcher/Gui/TaskSketcherValidation.h b/src/Mod/Sketcher/Gui/TaskSketcherValidation.h index c787587385..3a51f5c7a6 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherValidation.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherValidation.h @@ -42,7 +42,7 @@ class SketcherValidation : public QWidget Q_OBJECT public: - SketcherValidation(Sketcher::SketchObject* Obj, QWidget* parent = 0); + SketcherValidation(Sketcher::SketchObject* Obj, QWidget* parent = nullptr); ~SketcherValidation(); protected: diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 67af2d64cf..1dc00982dc 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -282,7 +282,7 @@ PROPERTY_SOURCE_WITH_EXTENSIONS(SketcherGui::ViewProviderSketch, PartGui::ViewPr ViewProviderSketch::ViewProviderSketch() : SelectionObserver(false), Mode(STATUS_NONE), - listener(0), + listener(nullptr), editCoinManager(nullptr), pObserver(std::make_unique(*this)), sketchHandler(nullptr) @@ -2656,7 +2656,7 @@ bool ViewProviderSketch::setEdit(int ModNum) Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog(); TaskDlgEditSketch *sketchDlg = qobject_cast(dlg); if (sketchDlg && sketchDlg->getSketchView() != this) - sketchDlg = 0; // another sketch left open its task panel + sketchDlg = nullptr; // another sketch left open its task panel if (dlg && !sketchDlg) { QMessageBox msgBox; msgBox.setText(tr("A dialog is already open in the task panel")); @@ -2705,7 +2705,7 @@ bool ViewProviderSketch::setEdit(int ModNum) auto editDoc = Gui::Application::Instance->editDocument(); App::DocumentObject *editObj = getSketchObject(); std::string editSubName; - ViewProviderDocumentObject *editVp = 0; + ViewProviderDocumentObject *editVp = nullptr; if(editDoc) { editDoc->getInEdit(&editVp,&editSubName); if(editVp) @@ -3003,7 +3003,7 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo auto editDoc = Gui::Application::Instance->editDocument(); editDocName.clear(); if(editDoc) { - ViewProviderDocumentObject *parent=0; + ViewProviderDocumentObject *parent=nullptr; editDoc->getInEdit(&parent,&editSubName); if(parent) { editDocName = editDoc->getDocument()->getName(); @@ -3101,7 +3101,7 @@ const Sketcher::Sketch &ViewProviderSketch::getSolvedSketch(void) const void ViewProviderSketch::deleteSelected() { std::vector selection; - selection = Gui::Selection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId()); + selection = Gui::Selection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId()); // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) {