diff --git a/src/Mod/Part/App/AppPart.cpp b/src/Mod/Part/App/AppPart.cpp index 79384818c4..9f3cf265d4 100644 --- a/src/Mod/Part/App/AppPart.cpp +++ b/src/Mod/Part/App/AppPart.cpp @@ -194,35 +194,35 @@ PyMOD_INIT_FUNC(Part) // Python exceptions // - PyObject* OCCError = 0; + PyObject* OCCError = nullptr; if (PyObject_IsSubclass(Base::PyExc_FC_GeneralError, PyExc_RuntimeError)) { - OCCError = PyErr_NewException("Part.OCCError", Base::PyExc_FC_GeneralError, NULL); + OCCError = PyErr_NewException("Part.OCCError", Base::PyExc_FC_GeneralError, nullptr); } else { Base::Console().Error("Can not inherit Part.OCCError form BaseFreeCADError.\n"); - OCCError = PyErr_NewException("Part.OCCError", PyExc_RuntimeError, NULL); + OCCError = PyErr_NewException("Part.OCCError", PyExc_RuntimeError, nullptr); } Py_INCREF(OCCError); PyModule_AddObject(partModule, "OCCError", OCCError); PartExceptionOCCError = OCCError; //set global variable ;( // domain error - PartExceptionOCCDomainError = PyErr_NewException("Part.OCCDomainError", PartExceptionOCCError, NULL); + PartExceptionOCCDomainError = PyErr_NewException("Part.OCCDomainError", PartExceptionOCCError, nullptr); Py_INCREF(PartExceptionOCCDomainError); PyModule_AddObject(partModule, "OCCDomainError", PartExceptionOCCDomainError); // range error - PartExceptionOCCRangeError = PyErr_NewException("Part.OCCRangeError", PartExceptionOCCDomainError, NULL); + PartExceptionOCCRangeError = PyErr_NewException("Part.OCCRangeError", PartExceptionOCCDomainError, nullptr); Py_INCREF(PartExceptionOCCRangeError); PyModule_AddObject(partModule, "OCCRangeError", PartExceptionOCCRangeError); // construction error - PartExceptionOCCConstructionError = PyErr_NewException("Part.OCCConstructionError", PartExceptionOCCDomainError, NULL); + PartExceptionOCCConstructionError = PyErr_NewException("Part.OCCConstructionError", PartExceptionOCCDomainError, nullptr); Py_INCREF(PartExceptionOCCConstructionError); PyModule_AddObject(partModule, "OCCConstructionError", PartExceptionOCCConstructionError); // dimension error - PartExceptionOCCDimensionError = PyErr_NewException("Part.OCCDimensionError", PartExceptionOCCDomainError, NULL); + PartExceptionOCCDimensionError = PyErr_NewException("Part.OCCDimensionError", PartExceptionOCCDomainError, nullptr); Py_INCREF(PartExceptionOCCConstructionError); PyModule_AddObject(partModule, "OCCDimensionError", PartExceptionOCCDimensionError); diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index 58def5877f..64dd4f46bf 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -874,7 +874,7 @@ private: Py::Object makeFace(const Py::Tuple& args) { try { - char* className = 0; + char* className = nullptr; PyObject* pcPyShapeOrList = nullptr; PyErr_Clear(); if (PyArg_ParseTuple(args.ptr(), "Os", &pcPyShapeOrList, &className)) { @@ -923,7 +923,7 @@ private: { // TODO: BRepFeat_SplitShape PyObject *obj; - PyObject *surf=0; + PyObject *surf=nullptr; if (!PyArg_ParseTuple(args.ptr(), "O|O!", &obj, &TopoShapeFacePy::Type, &surf)) throw Py::Exception(); @@ -1031,7 +1031,7 @@ private: Py::Object makePlane(const Py::Tuple& args) { double length, width; - PyObject *pPnt=0, *pDirZ=0, *pDirX=0; + PyObject *pPnt=nullptr, *pDirZ=nullptr, *pDirX=nullptr; if (!PyArg_ParseTuple(args.ptr(), "dd|O!O!O!", &length, &width, &(Base::VectorPy::Type), &pPnt, &(Base::VectorPy::Type), &pDirZ, @@ -1084,7 +1084,7 @@ private: Py::Object makeBox(const Py::Tuple& args) { double length, width, height; - PyObject *pPnt=0, *pDir=0; + PyObject *pPnt=nullptr, *pDir=nullptr; if (!PyArg_ParseTuple(args.ptr(), "ddd|O!O!", &length, &width, &height, &(Base::VectorPy::Type), &pPnt, @@ -1123,7 +1123,7 @@ private: Py::Object makeWedge(const Py::Tuple& args) { double xmin, ymin, zmin, z2min, x2min, xmax, ymax, zmax, z2max, x2max; - PyObject *pPnt=0, *pDir=0; + PyObject *pPnt=nullptr, *pDir=nullptr; if (!PyArg_ParseTuple(args.ptr(), "dddddddddd|O!O!", &xmin, &ymin, &zmin, &z2min, &x2min, &xmax, &ymax, &zmax, &z2max, &x2max, &(Base::VectorPy::Type), &pPnt, &(Base::VectorPy::Type), &pDir)) @@ -1200,7 +1200,7 @@ private: BRepBuilderAPI_MakeEdge makeEdge(gp_Pnt(pnt1.x, pnt1.y, pnt1.z), gp_Pnt(pnt2.x, pnt2.y, pnt2.z)); - const char *error=0; + const char *error=nullptr; switch (makeEdge.Error()) { case BRepBuilderAPI_EdgeDone: @@ -1272,7 +1272,7 @@ private: Py::Object makeCircle(const Py::Tuple& args) { double radius, angle1=0.0, angle2=360; - PyObject *pPnt=0, *pDir=0; + PyObject *pPnt=nullptr, *pDir=nullptr; if (!PyArg_ParseTuple(args.ptr(), "d|O!O!dd", &radius, &(Base::VectorPy::Type), &pPnt, @@ -1308,7 +1308,7 @@ private: Py::Object makeSphere(const Py::Tuple& args) { double radius, angle1=-90, angle2=90, angle3=360; - PyObject *pPnt=0, *pDir=0; + PyObject *pPnt=nullptr, *pDir=nullptr; if (!PyArg_ParseTuple(args.ptr(), "d|O!O!ddd", &radius, &(Base::VectorPy::Type), &pPnt, @@ -1338,7 +1338,7 @@ private: Py::Object makeCylinder(const Py::Tuple& args) { double radius, height, angle=360; - PyObject *pPnt=0, *pDir=0; + PyObject *pPnt=nullptr, *pDir=nullptr; if (!PyArg_ParseTuple(args.ptr(), "dd|O!O!d", &radius, &height, &(Base::VectorPy::Type), &pPnt, @@ -1368,7 +1368,7 @@ private: Py::Object makeCone(const Py::Tuple& args) { double radius1, radius2, height, angle=360; - PyObject *pPnt=0, *pDir=0; + PyObject *pPnt=nullptr, *pDir=nullptr; if (!PyArg_ParseTuple(args.ptr(), "ddd|O!O!d", &radius1, &radius2, &height, &(Base::VectorPy::Type), &pPnt, @@ -1398,7 +1398,7 @@ private: Py::Object makeTorus(const Py::Tuple& args) { double radius1, radius2, angle1=0.0, angle2=360, angle=360; - PyObject *pPnt=0, *pDir=0; + PyObject *pPnt=nullptr, *pDir=nullptr; if (!PyArg_ParseTuple(args.ptr(), "dd|O!O!ddd", &radius1, &radius2, &(Base::VectorPy::Type), &pPnt, @@ -1486,7 +1486,7 @@ private: { double vmin = DBL_MAX, vmax=-DBL_MAX; double angle=360; - PyObject *pPnt=0, *pDir=0, *pCrv; + PyObject *pPnt=nullptr, *pDir=nullptr, *pCrv; Handle(Geom_Curve) curve; union PyType_Object defaultType = {&Part::TopoShapeSolidPy::Type}; PyObject* type = defaultType.o; @@ -1868,7 +1868,7 @@ private: double height; double track = 0; - Py_UNICODE *unichars = NULL; + Py_UNICODE *unichars = nullptr; Py_ssize_t pysize; PyObject *CharList; @@ -1965,7 +1965,7 @@ private: } Py::Object exportUnits(const Py::Tuple& args) { - char* unit=0; + char* unit=nullptr; if (!PyArg_ParseTuple(args.ptr(), "|s", &unit)) throw Py::Exception(); @@ -2144,7 +2144,7 @@ private: try { TopoDS_Shape* shape = new TopoDS_Shape(); (*shape) = static_cast(pcObj)->getTopoShapePtr()->getShape(); - PyObject* proxy = 0; + PyObject* proxy = nullptr; proxy = Base::Interpreter().createSWIGPointerObj("OCC.TopoDS", "TopoDS_Shape *", (void*)shape, 1); return Py::asObject(proxy); } @@ -2173,15 +2173,15 @@ private: Py::Object getShape(const Py::Tuple& args, const Py::Dict &kwds) { PyObject *pObj; - const char *subname = 0; - PyObject *pyMat = 0; + const char *subname = nullptr; + PyObject *pyMat = nullptr; PyObject *needSubElement = Py_False; PyObject *transform = Py_True; PyObject *noElementMap = Py_False; PyObject *refine = Py_False; short retType = 0; static char* kwd_list[] = {"obj", "subname", "mat", - "needSubElement","transform","retType","noElementMap","refine",0}; + "needSubElement","transform","retType","noElementMap","refine",nullptr}; if(!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!|sO!OOhOO", kwd_list, &App::DocumentObjectPy::Type, &pObj, &subname, &Base::MatrixPy::Type, &pyMat, &needSubElement,&transform,&retType,&noElementMap,&refine)) @@ -2189,7 +2189,7 @@ private: App::DocumentObject *obj = static_cast(pObj)->getDocumentObjectPtr(); - App::DocumentObject *subObj = 0; + App::DocumentObject *subObj = nullptr; Base::Matrix4D mat; if(pyMat) mat = *static_cast(pyMat)->getMatrixPtr(); diff --git a/src/Mod/Part/App/ArcOfCirclePyImp.cpp b/src/Mod/Part/App/ArcOfCirclePyImp.cpp index 29cd018f5e..6d3887435e 100644 --- a/src/Mod/Part/App/ArcOfCirclePyImp.cpp +++ b/src/Mod/Part/App/ArcOfCirclePyImp.cpp @@ -150,7 +150,7 @@ Py::Object ArcOfCirclePy::getCircle(void) const PyObject *ArcOfCirclePy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int ArcOfCirclePy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/ArcOfConicPyImp.cpp b/src/Mod/Part/App/ArcOfConicPyImp.cpp index 5c532949c4..03c6fef48a 100644 --- a/src/Mod/Part/App/ArcOfConicPyImp.cpp +++ b/src/Mod/Part/App/ArcOfConicPyImp.cpp @@ -47,7 +47,7 @@ PyObject *ArcOfConicPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // // never create such objects with the constructor PyErr_SetString(PyExc_RuntimeError, "You cannot create an instance of the abstract class 'ArcOfConic'."); - return 0; + return nullptr; } // constructor method @@ -234,7 +234,7 @@ void ArcOfConicPy::setYAxis(Py::Object arg) PyObject *ArcOfConicPy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int ArcOfConicPy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/ArcOfEllipsePyImp.cpp b/src/Mod/Part/App/ArcOfEllipsePyImp.cpp index f2c35bcdc7..86bd26a347 100644 --- a/src/Mod/Part/App/ArcOfEllipsePyImp.cpp +++ b/src/Mod/Part/App/ArcOfEllipsePyImp.cpp @@ -150,7 +150,7 @@ Py::Object ArcOfEllipsePy::getEllipse(void) const PyObject *ArcOfEllipsePy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int ArcOfEllipsePy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/ArcOfHyperbolaPyImp.cpp b/src/Mod/Part/App/ArcOfHyperbolaPyImp.cpp index 51cdaf1d1f..e44daab59c 100644 --- a/src/Mod/Part/App/ArcOfHyperbolaPyImp.cpp +++ b/src/Mod/Part/App/ArcOfHyperbolaPyImp.cpp @@ -150,7 +150,7 @@ Py::Object ArcOfHyperbolaPy::getHyperbola(void) const PyObject *ArcOfHyperbolaPy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int ArcOfHyperbolaPy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/ArcOfParabolaPyImp.cpp b/src/Mod/Part/App/ArcOfParabolaPyImp.cpp index 9d9e9c99aa..37c4f2cdcf 100644 --- a/src/Mod/Part/App/ArcOfParabolaPyImp.cpp +++ b/src/Mod/Part/App/ArcOfParabolaPyImp.cpp @@ -138,7 +138,7 @@ Py::Object ArcOfParabolaPy::getParabola(void) const PyObject *ArcOfParabolaPy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int ArcOfParabolaPy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/ArcPyImp.cpp b/src/Mod/Part/App/ArcPyImp.cpp index 0e627b6f65..35a6086343 100644 --- a/src/Mod/Part/App/ArcPyImp.cpp +++ b/src/Mod/Part/App/ArcPyImp.cpp @@ -198,7 +198,7 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/) PyObject *ArcPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int ArcPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/AttachEnginePyImp.cpp b/src/Mod/Part/App/AttachEnginePyImp.cpp index d7e1424918..8784430eba 100644 --- a/src/Mod/Part/App/AttachEnginePyImp.cpp +++ b/src/Mod/Part/App/AttachEnginePyImp.cpp @@ -261,7 +261,7 @@ PyObject* AttachEnginePy::getModeInfo(PyObject* args) { char* modeName; if (!PyArg_ParseTuple(args, "s", &modeName)) - return 0; + return nullptr; try { AttachEngine &attacher = *(this->getAttachEnginePtr()); @@ -317,7 +317,7 @@ PyObject* AttachEnginePy::getRefTypeOfShape(PyObject* args) { PyObject *pcObj; if (!PyArg_ParseTuple(args, "O!", &(Part::TopoShapePy::Type), &pcObj)) - return NULL; + return nullptr; try{ TopoDS_Shape shape = static_cast(pcObj)->getTopoShapePtr()->getShape(); @@ -331,7 +331,7 @@ PyObject* AttachEnginePy::isFittingRefType(PyObject* args) char* type_shape_str; char* type_need_str; if (!PyArg_ParseTuple(args, "ss", &type_shape_str, &type_need_str)) - return 0; + return nullptr; try { eRefType type_shape = AttachEngine::getRefTypeByName(std::string(type_shape_str)); eRefType type_need = AttachEngine::getRefTypeByName(std::string(type_need_str)); @@ -344,7 +344,7 @@ PyObject* AttachEnginePy::downgradeRefType(PyObject* args) { char* type_shape_str; if (!PyArg_ParseTuple(args, "s", &type_shape_str)) - return 0; + return nullptr; try { eRefType type_shape = AttachEngine::getRefTypeByName(std::string(type_shape_str)); eRefType result = AttachEngine::downgradeType(type_shape); @@ -356,7 +356,7 @@ PyObject* AttachEnginePy::getRefTypeInfo(PyObject* args) { char* typeName; if (!PyArg_ParseTuple(args, "s", &typeName)) - return 0; + return nullptr; try { AttachEngine &attacher = *(this->getAttachEnginePtr()); @@ -399,7 +399,7 @@ PyObject* AttachEnginePy::getRefTypeInfo(PyObject* args) PyObject* AttachEnginePy::copy(PyObject* args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; return new AttachEnginePy(this->getAttachEnginePtr()->copy()); } @@ -408,7 +408,7 @@ PyObject* AttachEnginePy::calculateAttachedPlacement(PyObject* args) { PyObject *pcObj; if (!PyArg_ParseTuple(args, "O!", &(Base::PlacementPy::Type), &pcObj)) - return NULL; + return nullptr; try{ const Base::Placement& plm = *(static_cast(pcObj)->getPlacementPtr()); Base::Placement result; @@ -421,13 +421,13 @@ PyObject* AttachEnginePy::calculateAttachedPlacement(PyObject* args) return new Base::PlacementPy(new Base::Placement(result)); } ATTACHERPY_STDCATCH_METH; - return NULL; + return nullptr; } PyObject* AttachEnginePy::suggestModes(PyObject* args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { AttachEngine &attacher = *(this->getAttachEnginePtr()); @@ -556,7 +556,7 @@ PyObject* AttachEnginePy::writeParametersToFeature(PyObject* args) PyObject* AttachEnginePy::getCustomAttributes(const char*) const { - return 0; + return nullptr; } int AttachEnginePy::setCustomAttributes(const char*,PyObject*) diff --git a/src/Mod/Part/App/AttachExtension.cpp b/src/Mod/Part/App/AttachExtension.cpp index 9a2be718f3..13c9b126d5 100644 --- a/src/Mod/Part/App/AttachExtension.cpp +++ b/src/Mod/Part/App/AttachExtension.cpp @@ -39,12 +39,12 @@ using namespace Attacher; EXTENSION_PROPERTY_SOURCE(Part::AttachExtension, App::DocumentObjectExtension) AttachExtension::AttachExtension() - : _attacher(0) + : _attacher(nullptr) { EXTENSION_ADD_PROPERTY_TYPE(AttacherType, ("Attacher::AttachEngine3D"), "Attachment",(App::PropertyType)(App::Prop_None),"Class name of attach engine object driving the attachment."); this->AttacherType.setStatus(App::Property::Status::Hidden, true); - EXTENSION_ADD_PROPERTY_TYPE(Support, (0,0), "Attachment",(App::PropertyType)(App::Prop_None),"Support of the 2D geometry"); + EXTENSION_ADD_PROPERTY_TYPE(Support, (nullptr,nullptr), "Attachment",(App::PropertyType)(App::Prop_None),"Support of the 2D geometry"); EXTENSION_ADD_PROPERTY_TYPE(MapMode, (mmDeactivated), "Attachment", App::Prop_None, "Mode of attachment to other object"); MapMode.setEditorName("PartGui::PropertyEnumAttacherItem"); diff --git a/src/Mod/Part/App/AttachExtensionPyImp.cpp b/src/Mod/Part/App/AttachExtensionPyImp.cpp index e52c770268..0bff72da7e 100644 --- a/src/Mod/Part/App/AttachExtensionPyImp.cpp +++ b/src/Mod/Part/App/AttachExtensionPyImp.cpp @@ -21,16 +21,16 @@ std::string AttachExtensionPy::representation(void) const PyObject* AttachExtensionPy::positionBySupport(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; bool bAttached = false; try{ bAttached = this->getAttachExtensionPtr()->positionBySupport(); } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (Base::Exception &e) { e.setPyException(); - return NULL; + return nullptr; } return Py::new_reference_to(Py::Boolean(bAttached)); } @@ -39,16 +39,16 @@ PyObject* AttachExtensionPy::changeAttacherType(PyObject *args) { const char* typeName; if (!PyArg_ParseTuple(args, "s", &typeName)) - return 0; + return nullptr; bool ret; try{ ret = this->getAttachExtensionPtr()->changeAttacherType(typeName); } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (Base::Exception &e) { e.setPyException(); - return NULL; + return nullptr; } return Py::new_reference_to(Py::Boolean(ret)); } @@ -74,7 +74,7 @@ Py::Object AttachExtensionPy::getAttacher(void) const PyObject *AttachExtensionPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int AttachExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/Attacher.cpp b/src/Mod/Part/App/Attacher.cpp index eeb2901706..34a7e09f50 100644 --- a/src/Mod/Part/App/Attacher.cpp +++ b/src/Mod/Part/App/Attacher.cpp @@ -133,7 +133,7 @@ const char* AttachEngine::eMapModeStrings[]= { "OYZ", "OYX", - NULL}; + nullptr}; //this list must be in sync with eRefType enum. //These strings are used only by Py interface of Attacher. Strings for use in Gui are in Mod/Part/Gui/AttacherTexts.cpp @@ -161,7 +161,7 @@ const char* AttachEngine::eRefTypeStrings[]= { "Object", "Solid", "Wire", - NULL + nullptr }; diff --git a/src/Mod/Part/App/Attacher.h b/src/Mod/Part/App/Attacher.h index be49ef5258..aabd76a1cc 100644 --- a/src/Mod/Part/App/Attacher.h +++ b/src/Mod/Part/App/Attacher.h @@ -269,7 +269,7 @@ public: //methods bool useRefOrg_Plane = false, bool makeYVertical = false, bool makeLegacyFlatFaceOrientation = false, - Base::Placement* placeOfRef = 0) const; + Base::Placement* placeOfRef = nullptr) const; /** * @brief suggestMapModes is the procedure that knows everything about diff --git a/src/Mod/Part/App/BRepFeat/MakePrismPyImp.cpp b/src/Mod/Part/App/BRepFeat/MakePrismPyImp.cpp index 4a9e830726..a2b1536aa3 100644 --- a/src/Mod/Part/App/BRepFeat/MakePrismPyImp.cpp +++ b/src/Mod/Part/App/BRepFeat/MakePrismPyImp.cpp @@ -330,7 +330,7 @@ PyObject* MakePrismPy::shape(PyObject *args) PyObject *MakePrismPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int MakePrismPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/BRepOffsetAPI_MakeFillingPyImp.cpp b/src/Mod/Part/App/BRepOffsetAPI_MakeFillingPyImp.cpp index adfb7c8045..ffae40d9fb 100644 --- a/src/Mod/Part/App/BRepOffsetAPI_MakeFillingPyImp.cpp +++ b/src/Mod/Part/App/BRepOffsetAPI_MakeFillingPyImp.cpp @@ -429,7 +429,7 @@ PyObject* BRepOffsetAPI_MakeFillingPy::G2Error(PyObject *args) PyObject* BRepOffsetAPI_MakeFillingPy::shape(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { const TopoDS_Shape& shape = this->getBRepOffsetAPI_MakeFillingPtr()->Shape(); @@ -437,7 +437,7 @@ PyObject* BRepOffsetAPI_MakeFillingPy::shape(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); - return 0; + return nullptr; } } diff --git a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp index c42ffa6b76..616adc3946 100644 --- a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp +++ b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp @@ -49,14 +49,14 @@ PyObject *BRepOffsetAPI_MakePipeShellPy::PyMake(struct _typeobject *, PyObject * // create a new instance of BRepOffsetAPI_MakePipeShellPy and the Twin object PyObject* obj; if (!PyArg_ParseTuple(args, "O!",&(TopoShapePy::Type),&obj)) - return 0; + return nullptr; const TopoDS_Shape& wire = static_cast(obj)->getTopoShapePtr()->getShape(); if (!wire.IsNull() && wire.ShapeType() == TopAbs_WIRE) { return new BRepOffsetAPI_MakePipeShellPy(new BRepOffsetAPI_MakePipeShell(TopoDS::Wire(wire))); } PyErr_SetString(PartExceptionOCCError, "A valid wire is needed as argument"); - return 0; + return nullptr; } // constructor method @@ -75,7 +75,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setFrenetMode(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!",&PyBool_Type,&obj)) - return 0; + return nullptr; try { this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(PyObject_IsTrue(obj) ? Standard_True : Standard_False); @@ -83,7 +83,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setFrenetMode(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -92,7 +92,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setTrihedronMode(PyObject *args) PyObject *pnt, *dir; if (!PyArg_ParseTuple(args, "O!O!",&Base::VectorPy::Type,&pnt ,&Base::VectorPy::Type,&dir)) - return 0; + return nullptr; try { gp_Pnt p = Base::convertTo(Py::Vector(pnt,false).toVector()); @@ -102,7 +102,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setTrihedronMode(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -110,7 +110,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setBiNormalMode(PyObject *args) { PyObject *dir; if (!PyArg_ParseTuple(args, "O!",&Base::VectorPy::Type,&dir)) - return 0; + return nullptr; try { gp_Dir d = Base::convertTo(Py::Vector(dir,false).toVector()); @@ -119,7 +119,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setBiNormalMode(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -127,7 +127,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setSpineSupport(PyObject *args) { PyObject *shape; if (!PyArg_ParseTuple(args, "O!",&Part::TopoShapePy::Type,&shape)) - return 0; + return nullptr; try { const TopoDS_Shape& s = static_cast(shape)->getTopoShapePtr()->getShape(); @@ -136,7 +136,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setSpineSupport(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -147,13 +147,13 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args) if (!PyArg_ParseTuple(args, "O!O!O!",&Part::TopoShapePy::Type,&spine ,&PyBool_Type,&curv ,&PyLong_Type,&keep)) - return 0; + return nullptr; try { const TopoDS_Shape& s = static_cast(spine)->getTopoShapePtr()->getShape(); if (s.IsNull() || s.ShapeType() != TopAbs_WIRE) { PyErr_SetString(PyExc_TypeError, "spine is not a wire"); - return 0; + return nullptr; } BRepFill_TypeOfContact typeOfCantact; @@ -176,7 +176,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } #else PyObject *spine, *curv, *keep; @@ -208,7 +208,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args) PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds) { PyObject *prof, *curv=Py_False, *keep=Py_False; - static char* keywords_pro[] = {"Profile","WithContact","WithCorrection",NULL}; + static char* keywords_pro[] = {"Profile","WithContact","WithCorrection",nullptr}; if (PyArg_ParseTupleAndKeywords(args,kwds, "O!|O!O!", keywords_pro ,&Part::TopoShapePy::Type,&prof ,&PyBool_Type,&curv @@ -222,13 +222,13 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyErr_Clear(); PyObject *loc; - static char* keywords_loc[] = {"Profile","Location","WithContact","WithCorrection",NULL}; + static char* keywords_loc[] = {"Profile","Location","WithContact","WithCorrection",nullptr}; if (PyArg_ParseTupleAndKeywords(args,kwds, "O!O!|O!O!", keywords_loc ,&Part::TopoShapePy::Type,&prof ,&Part::TopoShapeVertexPy::Type,&loc @@ -244,7 +244,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -252,14 +252,14 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds) "add(Profile, WithContact=False, WithCorrection=False)\n" "add(Profile, Location, WithContact=False, WithCorrection=False)" ); - return 0; + return nullptr; } PyObject* BRepOffsetAPI_MakePipeShellPy::remove(PyObject *args) { PyObject *prof; if (!PyArg_ParseTuple(args, "O!",&Part::TopoShapePy::Type,&prof)) - return 0; + return nullptr; try { const TopoDS_Shape& s = static_cast(prof)->getTopoShapePtr()->getShape(); @@ -268,14 +268,14 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::remove(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BRepOffsetAPI_MakePipeShellPy::isReady(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Standard_Boolean ok = this->getBRepOffsetAPI_MakePipeShellPtr()->IsReady(); @@ -283,14 +283,14 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::isReady(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BRepOffsetAPI_MakePipeShellPy::getStatus(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Standard_Integer val = this->getBRepOffsetAPI_MakePipeShellPtr()->GetStatus(); @@ -298,14 +298,14 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::getStatus(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BRepOffsetAPI_MakePipeShellPy::makeSolid(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Standard_Boolean ok = this->getBRepOffsetAPI_MakePipeShellPtr()->MakeSolid(); @@ -313,14 +313,14 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::makeSolid(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BRepOffsetAPI_MakePipeShellPy::build(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { this->getBRepOffsetAPI_MakePipeShellPtr()->Build(); @@ -328,14 +328,14 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::build(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BRepOffsetAPI_MakePipeShellPy::shape(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { const TopoDS_Shape& shape = this->getBRepOffsetAPI_MakePipeShellPtr()->Shape(); @@ -343,14 +343,14 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::shape(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BRepOffsetAPI_MakePipeShellPy::firstShape(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { TopoDS_Shape shape = this->getBRepOffsetAPI_MakePipeShellPtr()->FirstShape(); @@ -358,14 +358,14 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::firstShape(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BRepOffsetAPI_MakePipeShellPy::lastShape(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { TopoDS_Shape shape = this->getBRepOffsetAPI_MakePipeShellPtr()->LastShape(); @@ -373,7 +373,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::lastShape(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -381,7 +381,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::generated(PyObject *args) { PyObject *shape; if (!PyArg_ParseTuple(args, "O!",&Part::TopoShapePy::Type,&shape)) - return 0; + return nullptr; try { const TopoDS_Shape& s = static_cast(shape)->getTopoShapePtr()->getShape(); @@ -397,7 +397,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::generated(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -405,7 +405,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setTolerance(PyObject *args) { double tol3d, boundTol, tolAngular; if (!PyArg_ParseTuple(args, "ddd",&tol3d,&boundTol,&tolAngular)) - return 0; + return nullptr; try { this->getBRepOffsetAPI_MakePipeShellPtr()->SetTolerance(tol3d, boundTol, tolAngular); @@ -413,7 +413,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setTolerance(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -421,7 +421,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setTransitionMode(PyObject *args) { int mode; if (!PyArg_ParseTuple(args, "i",&mode)) - return 0; + return nullptr; try { this->getBRepOffsetAPI_MakePipeShellPtr()->SetTransitionMode(BRepBuilderAPI_TransitionMode(mode)); @@ -429,7 +429,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setTransitionMode(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -437,7 +437,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxDegree(PyObject *args) { int degree; if (!PyArg_ParseTuple(args, "i",°ree)) - return 0; + return nullptr; try { #if OCC_VERSION_HEX >= 0x060800 @@ -451,7 +451,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxDegree(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -459,7 +459,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxSegments(PyObject *args) { int nbseg; if (!PyArg_ParseTuple(args, "i",&nbseg)) - return 0; + return nullptr; try { #if OCC_VERSION_HEX >= 0x060800 @@ -473,7 +473,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxSegments(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -481,7 +481,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setForceApproxC1(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!",&PyBool_Type,&obj)) - return 0; + return nullptr; try { #if OCC_VERSION_HEX >= 0x060700 @@ -494,7 +494,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setForceApproxC1(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -503,7 +503,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::simulate(PyObject *args) { int nbsec; if (!PyArg_ParseTuple(args, "i",&nbsec)) - return 0; + return nullptr; try { TopTools_ListOfShape list; @@ -519,14 +519,14 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::simulate(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject *BRepOffsetAPI_MakePipeShellPy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int BRepOffsetAPI_MakePipeShellPy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/BSplineCurveBiArcs.cpp b/src/Mod/Part/App/BSplineCurveBiArcs.cpp index fce7c78cc3..c8e1b73884 100644 --- a/src/Mod/Part/App/BSplineCurveBiArcs.cpp +++ b/src/Mod/Part/App/BSplineCurveBiArcs.cpp @@ -125,8 +125,8 @@ void GeomBSplineCurve::createArcs(double tolerance, std::list& new_sp bool can_do_spline_whole = calculateBiArcPoints(p_start, v_start, p_end, v_end, p1, p2, p3); - Geometry* arc_object1 = NULL; - Geometry* arc_object2 = NULL; + Geometry* arc_object1 = nullptr; + Geometry* arc_object2 = nullptr; if (can_do_spline_whole) { Part::TangentialArc arc1(p_start, v_start, p2); diff --git a/src/Mod/Part/App/BSplineCurvePyImp.cpp b/src/Mod/Part/App/BSplineCurvePyImp.cpp index b6084fe76c..9e4a7f3386 100644 --- a/src/Mod/Part/App/BSplineCurvePyImp.cpp +++ b/src/Mod/Part/App/BSplineCurvePyImp.cpp @@ -94,7 +94,7 @@ int BSplineCurvePy::PyInit(PyObject* args, PyObject* kwd) PyObject* BSplineCurvePy::__reduce__(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Py::Tuple tuple(2); @@ -121,7 +121,7 @@ PyObject* BSplineCurvePy::__reduce__(PyObject *args) PyObject* BSplineCurvePy::isRational(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); Standard_Boolean val = curve->IsRational(); @@ -131,7 +131,7 @@ PyObject* BSplineCurvePy::isRational(PyObject *args) PyObject* BSplineCurvePy::isPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); Standard_Boolean val = curve->IsPeriodic(); @@ -141,7 +141,7 @@ PyObject* BSplineCurvePy::isPeriodic(PyObject *args) PyObject* BSplineCurvePy::isClosed(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); Standard_Boolean val = curve->IsClosed(); @@ -152,7 +152,7 @@ PyObject* BSplineCurvePy::increaseDegree(PyObject * args) { int degree; if (!PyArg_ParseTuple(args, "i", °ree)) - return 0; + return nullptr; PY_TRY { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -166,7 +166,7 @@ PyObject* BSplineCurvePy::increaseMultiplicity(PyObject * args) int mult=-1; int start, end; if (!PyArg_ParseTuple(args, "ii|i", &start, &end, &mult)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast @@ -183,7 +183,7 @@ PyObject* BSplineCurvePy::increaseMultiplicity(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -191,7 +191,7 @@ PyObject* BSplineCurvePy::incrementMultiplicity(PyObject * args) { int start, end, mult; if (!PyArg_ParseTuple(args, "iii", &start, &end, &mult)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast @@ -200,7 +200,7 @@ PyObject* BSplineCurvePy::incrementMultiplicity(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -212,7 +212,7 @@ PyObject* BSplineCurvePy::insertKnot(PyObject * args) int M=1; PyObject* add = Py_True; if (!PyArg_ParseTuple(args, "d|idO!", &U, &M, &tol, &PyBool_Type, &add)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast @@ -221,7 +221,7 @@ PyObject* BSplineCurvePy::insertKnot(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -236,7 +236,7 @@ PyObject* BSplineCurvePy::insertKnots(PyObject * args) if (!PyArg_ParseTuple(args, "OO|dO!", &obj1, &obj2, &tol, &PyBool_Type, &add)) - return 0; + return nullptr; try { Py::Sequence knots(obj1); @@ -261,7 +261,7 @@ PyObject* BSplineCurvePy::insertKnots(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -272,7 +272,7 @@ PyObject* BSplineCurvePy::removeKnot(PyObject * args) double tol; int Index,M; if (!PyArg_ParseTuple(args, "iid", &Index, &M, &tol)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast @@ -282,7 +282,7 @@ PyObject* BSplineCurvePy::removeKnot(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -290,7 +290,7 @@ PyObject* BSplineCurvePy::segment(PyObject * args) { double u1,u2; if (!PyArg_ParseTuple(args, "dd", &u1,&u2)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -300,7 +300,7 @@ PyObject* BSplineCurvePy::segment(PyObject * args) if (std::abs(tempCurve->FirstParameter()-u1) > Precision::Approximation() || std::abs(tempCurve->LastParameter()-u2) > Precision::Approximation()) { Standard_Failure::Raise("Failed to segment BSpline curve"); - return 0; + return nullptr; } else { curve->Segment(u1,u2); @@ -309,7 +309,7 @@ PyObject* BSplineCurvePy::segment(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -318,7 +318,7 @@ PyObject* BSplineCurvePy::setKnot(PyObject * args) int Index, M=-1; double K; if (!PyArg_ParseTuple(args, "id|i", &Index, &K, &M)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast @@ -334,7 +334,7 @@ PyObject* BSplineCurvePy::setKnot(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -342,7 +342,7 @@ PyObject* BSplineCurvePy::getKnot(PyObject * args) { int Index; if (!PyArg_ParseTuple(args, "i", &Index)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast @@ -353,7 +353,7 @@ PyObject* BSplineCurvePy::getKnot(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -361,7 +361,7 @@ PyObject* BSplineCurvePy::setKnots(PyObject * args) { PyObject* obj; if (!PyArg_ParseTuple(args, "O", &obj)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColStd_Array1OfReal k(1,list.size()); @@ -378,14 +378,14 @@ PyObject* BSplineCurvePy::setKnots(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurvePy::getKnots(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -399,7 +399,7 @@ PyObject* BSplineCurvePy::getKnots(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -409,7 +409,7 @@ PyObject* BSplineCurvePy::setPole(PyObject * args) double weight=-1.0; PyObject* p; if (!PyArg_ParseTuple(args, "iO!|d", &index, &(Base::VectorPy::Type), &p, &weight)) - return 0; + return nullptr; Base::Vector3d vec = static_cast(p)->value(); gp_Pnt pnt(vec.x, vec.y, vec.z); try { @@ -423,7 +423,7 @@ PyObject* BSplineCurvePy::setPole(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -431,7 +431,7 @@ PyObject* BSplineCurvePy::getPole(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -444,14 +444,14 @@ PyObject* BSplineCurvePy::getPole(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurvePy::getPoles(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -468,14 +468,14 @@ PyObject* BSplineCurvePy::getPoles(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurvePy::getPolesAndWeights(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -499,7 +499,7 @@ PyObject* BSplineCurvePy::getPolesAndWeights(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -508,7 +508,7 @@ PyObject* BSplineCurvePy::setWeight(PyObject * args) int index; double weight; if (!PyArg_ParseTuple(args, "id", &index,&weight)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -517,7 +517,7 @@ PyObject* BSplineCurvePy::setWeight(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -525,7 +525,7 @@ PyObject* BSplineCurvePy::getWeight(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -536,14 +536,14 @@ PyObject* BSplineCurvePy::getWeight(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurvePy::getWeights(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -557,7 +557,7 @@ PyObject* BSplineCurvePy::getWeights(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -565,7 +565,7 @@ PyObject* BSplineCurvePy::getResolution(PyObject * args) { double tol; if (!PyArg_ParseTuple(args, "d", &tol)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -575,7 +575,7 @@ PyObject* BSplineCurvePy::getResolution(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -585,7 +585,7 @@ PyObject* BSplineCurvePy::movePoint(PyObject * args) int index1, index2; PyObject* pnt; if (!PyArg_ParseTuple(args, "dO!ii", &U, &(Base::VectorPy::Type),&pnt, &index1, &index2)) - return 0; + return nullptr; try { Base::Vector3d p = static_cast(pnt)->value(); Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast @@ -596,14 +596,14 @@ PyObject* BSplineCurvePy::movePoint(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurvePy::setNotPeriodic(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -612,14 +612,14 @@ PyObject* BSplineCurvePy::setNotPeriodic(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurvePy::setPeriodic(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -628,7 +628,7 @@ PyObject* BSplineCurvePy::setPeriodic(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -636,7 +636,7 @@ PyObject* BSplineCurvePy::setOrigin(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -645,7 +645,7 @@ PyObject* BSplineCurvePy::setOrigin(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -653,7 +653,7 @@ PyObject* BSplineCurvePy::getMultiplicity(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -662,14 +662,14 @@ PyObject* BSplineCurvePy::getMultiplicity(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurvePy::getMultiplicities(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); @@ -683,7 +683,7 @@ PyObject* BSplineCurvePy::getMultiplicities(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } Py::Long BSplineCurvePy::getDegree(void) const @@ -772,7 +772,7 @@ PyObject* BSplineCurvePy::toBiArcs(PyObject * args) { double tolerance = 0.001; if (!PyArg_ParseTuple(args, "d", &tolerance)) - return 0; + return nullptr; try { GeomBSplineCurve* curve = getGeomBSplineCurvePtr(); std::list arcs; @@ -788,7 +788,7 @@ PyObject* BSplineCurvePy::toBiArcs(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -801,7 +801,7 @@ PyObject* BSplineCurvePy::approximate(PyObject *args, PyObject *kwds) char* continuity = "C2"; double tol3d = 1e-3; char* parType = "ChordLength"; - PyObject* par = 0; + PyObject* par = nullptr; double weight1 = 0; double weight2 = 0; double weight3 = 0; @@ -889,7 +889,7 @@ PyObject* BSplineCurvePy::approximate(PyObject *args, PyObject *kwds) } else { Standard_Failure::Raise("Smoothing approximation failed"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } @@ -910,7 +910,7 @@ PyObject* BSplineCurvePy::approximate(PyObject *args, PyObject *kwds) } else { Standard_Failure::Raise("Approximation with parameters failed"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } @@ -931,12 +931,12 @@ PyObject* BSplineCurvePy::approximate(PyObject *args, PyObject *kwds) } else { Standard_Failure::Raise("failed to approximate points"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -946,7 +946,7 @@ PyObject* BSplineCurvePy::getCardinalSplineTangents(PyObject *args, PyObject *kw PyObject* tgs; double parameter; - static char* kwds_interp1[] = {"Points", "Parameter", NULL}; + static char* kwds_interp1[] = {"Points", "Parameter", nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "Od",kwds_interp1, &pts, ¶meter)) { Py::Sequence list(pts); std::vector interpPoints; @@ -968,7 +968,7 @@ PyObject* BSplineCurvePy::getCardinalSplineTangents(PyObject *args, PyObject *kw } PyErr_Clear(); - static char* kwds_interp2[] = {"Points", "Parameters", NULL}; + static char* kwds_interp2[] = {"Points", "Parameters", nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "OO",kwds_interp2, &pts, &tgs)) { Py::Sequence list(pts); std::vector interpPoints; @@ -997,28 +997,28 @@ PyObject* BSplineCurvePy::getCardinalSplineTangents(PyObject *args, PyObject *kw return Py::new_reference_to(vec); } - return 0; + return nullptr; } PyObject* BSplineCurvePy::interpolate(PyObject *args, PyObject *kwds) { PyObject* obj; - PyObject* par = 0; + PyObject* par = nullptr; double tol3d = Precision::Approximation(); PyObject* periodic = Py_False; - PyObject* t1 = 0; PyObject* t2 = 0; - PyObject* ts = 0; PyObject* fl = 0; + PyObject* t1 = nullptr; PyObject* t2 = nullptr; + PyObject* ts = nullptr; PyObject* fl = nullptr; PyObject* scale = Py_True; static char* kwds_interp[] = {"Points", "PeriodicFlag", "Tolerance", "InitialTangent", "FinalTangent", - "Tangents", "TangentFlags", "Parameters", "Scale", NULL}; + "Tangents", "TangentFlags", "Parameters", "Scale", nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O!dO!O!OOOO!",kwds_interp, &obj, &PyBool_Type, &periodic, &tol3d, &Base::VectorPy::Type, &t1, &Base::VectorPy::Type, &t2, &ts, &fl, &par, &PyBool_Type, &scale)) - return 0; + return nullptr; try { Py::Sequence list(obj); @@ -1092,14 +1092,14 @@ PyObject* BSplineCurvePy::interpolate(PyObject *args, PyObject *kwds) } else { Standard_Failure::Raise("failed to interpolate points"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } catch (Standard_Failure& e) { std::string err = e.GetMessageString(); if (err.empty()) err = e.DynamicType()->Name(); PyErr_SetString(PartExceptionOCCError, err.c_str()); - return 0; + return nullptr; } } @@ -1110,7 +1110,7 @@ PyObject* BSplineCurvePy::buildFromPoles(PyObject *args) PyObject* periodic = Py_False; PyObject* interpolate = Py_False; if (!PyArg_ParseTuple(args, "O|O!iO!",&obj, &PyBool_Type, &periodic, °ree, &PyBool_Type, interpolate)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); @@ -1151,7 +1151,7 @@ PyObject* BSplineCurvePy::buildFromPoles(PyObject *args) } else { Standard_Failure::Raise("failed to create spline"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } else { @@ -1171,19 +1171,19 @@ PyObject* BSplineCurvePy::buildFromPoles(PyObject *args) } else { Standard_Failure::Raise("failed to create spline"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *keywds) { - static char *kwlist[] = {"poles", "mults", "knots", "periodic", "degree", "weights", "CheckRational", NULL}; + static char *kwlist[] = {"poles", "mults", "knots", "periodic", "degree", "weights", "CheckRational", nullptr}; PyObject* periodic = Py_False; PyObject* CheckRational = Py_True; PyObject* poles = Py_None; @@ -1199,7 +1199,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key &PyBool_Type, &periodic, °ree, &weights, &PyBool_Type, &CheckRational)) - return 0; + return nullptr; try { // poles have to be present Py::Sequence list(poles); @@ -1207,7 +1207,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key number_of_poles = list.size(); if ((number_of_poles) < 2) { Standard_Failure::Raise("need two or more poles"); - return 0; + return nullptr; } TColgp_Array1OfPnt occpoles(1, number_of_poles); Standard_Integer index = 1; @@ -1221,7 +1221,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key number_of_knots = PyObject_Length(mults); if (PyObject_Length(knots) != number_of_knots) { Standard_Failure::Raise("number of knots and mults mismatch"); - return 0; + return nullptr; } } else { @@ -1291,7 +1291,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key if (weights != Py_None) { //weights are given if (PyObject_Length(weights) != number_of_poles) { Standard_Failure::Raise("number of poles and weights mismatch"); - return 0; + return nullptr; } //complain about mismatch Py::Sequence weightssq(weights); Standard_Integer index = 1; @@ -1309,7 +1309,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key if ((PyObject_IsTrue(periodic) && sum_of_mults != number_of_poles) || (PyObject_Not(periodic) && sum_of_mults - degree -1 != number_of_poles)) { Standard_Failure::Raise("number of poles and sum of mults mismatch"); - return(0); + return(nullptr); } Handle(Geom_BSplineCurve) spline = new Geom_BSplineCurve(occpoles,occweights,occknots,occmults,degree, @@ -1321,13 +1321,13 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key } else { Standard_Failure::Raise("failed to create spline"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } catch (const Standard_Failure& e) { Standard_CString msg = e.GetMessageString(); PyErr_SetString(PartExceptionOCCError, msg ? msg : ""); - return 0; + return nullptr; } } @@ -1335,7 +1335,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key PyObject* BSplineCurvePy::toBezier(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineCurve) spline = Handle(Geom_BSplineCurve)::DownCast @@ -1353,7 +1353,7 @@ PyObject* BSplineCurvePy::toBezier(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -1361,7 +1361,7 @@ PyObject* BSplineCurvePy::join(PyObject *args) { PyObject* c; if (!PyArg_ParseTuple(args, "O!", &BSplineCurvePy::Type, &c)) - return 0; + return nullptr; try { GeomBSplineCurve* curve1 = this->getGeomBSplineCurvePtr(); @@ -1375,7 +1375,7 @@ PyObject* BSplineCurvePy::join(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -1384,7 +1384,7 @@ PyObject* BSplineCurvePy::makeC1Continuous(PyObject *args) double tol = Precision::Approximation(); double ang_tol = 1.0e-7; if (!PyArg_ParseTuple(args, "|dd", &tol, &ang_tol)) - return 0; + return nullptr; try { GeomBSplineCurve* spline = this->getGeomBSplineCurvePtr(); @@ -1395,13 +1395,13 @@ PyObject* BSplineCurvePy::makeC1Continuous(PyObject *args) std::string err = e.GetMessageString(); if (err.empty()) err = e.DynamicType()->Name(); PyErr_SetString(PartExceptionOCCError, err.c_str()); - return 0; + return nullptr; } } PyObject* BSplineCurvePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int BSplineCurvePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/BSplineSurfacePyImp.cpp b/src/Mod/Part/App/BSplineSurfacePyImp.cpp index 6c0bc66281..9fb49dbeb8 100644 --- a/src/Mod/Part/App/BSplineSurfacePyImp.cpp +++ b/src/Mod/Part/App/BSplineSurfacePyImp.cpp @@ -70,7 +70,7 @@ int BSplineSurfacePy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/) PyObject* BSplineSurfacePy::bounds(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -87,7 +87,7 @@ PyObject* BSplineSurfacePy::bounds(PyObject *args) PyObject* BSplineSurfacePy::isURational(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -98,7 +98,7 @@ PyObject* BSplineSurfacePy::isURational(PyObject *args) PyObject* BSplineSurfacePy::isVRational(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -109,7 +109,7 @@ PyObject* BSplineSurfacePy::isVRational(PyObject *args) PyObject* BSplineSurfacePy::isUPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -120,7 +120,7 @@ PyObject* BSplineSurfacePy::isUPeriodic(PyObject *args) PyObject* BSplineSurfacePy::isVPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -131,7 +131,7 @@ PyObject* BSplineSurfacePy::isVPeriodic(PyObject *args) PyObject* BSplineSurfacePy::isUClosed(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -142,7 +142,7 @@ PyObject* BSplineSurfacePy::isUClosed(PyObject *args) PyObject* BSplineSurfacePy::isVClosed(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -154,7 +154,7 @@ PyObject* BSplineSurfacePy::increaseDegree(PyObject *args) { int udegree, vdegree; if (!PyArg_ParseTuple(args, "ii",&udegree,&vdegree)) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -167,7 +167,7 @@ PyObject* BSplineSurfacePy::increaseUMultiplicity(PyObject *args) int mult=-1; int start, end; if (!PyArg_ParseTuple(args, "ii|i", &start, &end, &mult)) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -187,7 +187,7 @@ PyObject* BSplineSurfacePy::increaseVMultiplicity(PyObject *args) int mult=-1; int start, end; if (!PyArg_ParseTuple(args, "ii|i", &start, &end, &mult)) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -206,7 +206,7 @@ PyObject* BSplineSurfacePy::incrementUMultiplicity(PyObject *args) { int start, end, mult; if (!PyArg_ParseTuple(args, "iii", &start, &end, &mult)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast @@ -215,7 +215,7 @@ PyObject* BSplineSurfacePy::incrementUMultiplicity(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -225,7 +225,7 @@ PyObject* BSplineSurfacePy::incrementVMultiplicity(PyObject *args) { int start, end, mult; if (!PyArg_ParseTuple(args, "iii", &start, &end, &mult)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast @@ -234,7 +234,7 @@ PyObject* BSplineSurfacePy::incrementVMultiplicity(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -246,7 +246,7 @@ PyObject* BSplineSurfacePy::insertUKnot(PyObject *args) int M=1; PyObject* add = Py_True; if (!PyArg_ParseTuple(args, "did|O!", &U, &M, &tol, &PyBool_Type, &add)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast @@ -255,7 +255,7 @@ PyObject* BSplineSurfacePy::insertUKnot(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -270,7 +270,7 @@ PyObject* BSplineSurfacePy::insertUKnots(PyObject *args) if (!PyArg_ParseTuple(args, "OO|dO!", &obj1, &obj2, &tol, &PyBool_Type, &add)) - return 0; + return nullptr; try { Py::Sequence knots(obj1); @@ -295,7 +295,7 @@ PyObject* BSplineSurfacePy::insertUKnots(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -307,7 +307,7 @@ PyObject* BSplineSurfacePy::insertVKnot(PyObject *args) int M=1; PyObject* add = Py_True; if (!PyArg_ParseTuple(args, "did|O!", &V, &M, &tol, &PyBool_Type, &add)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast @@ -316,7 +316,7 @@ PyObject* BSplineSurfacePy::insertVKnot(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -331,7 +331,7 @@ PyObject* BSplineSurfacePy::insertVKnots(PyObject *args) if (!PyArg_ParseTuple(args, "OO|dO!", &obj1, &obj2, &tol, &PyBool_Type, &add)) - return 0; + return nullptr; try { Py::Sequence knots(obj1); @@ -356,7 +356,7 @@ PyObject* BSplineSurfacePy::insertVKnots(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -367,7 +367,7 @@ PyObject* BSplineSurfacePy::removeUKnot(PyObject *args) double tol; int Index,M; if (!PyArg_ParseTuple(args, "iid", &Index, &M, &tol)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast @@ -377,7 +377,7 @@ PyObject* BSplineSurfacePy::removeUKnot(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -386,7 +386,7 @@ PyObject* BSplineSurfacePy::removeVKnot(PyObject *args) double tol; int Index,M; if (!PyArg_ParseTuple(args, "iid", &Index, &M, &tol)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast @@ -396,7 +396,7 @@ PyObject* BSplineSurfacePy::removeVKnot(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -404,7 +404,7 @@ PyObject* BSplineSurfacePy::segment(PyObject *args) { double u1,u2,v1,v2; if (!PyArg_ParseTuple(args, "dddd", &u1,&u2,&v1,&v2)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -414,7 +414,7 @@ PyObject* BSplineSurfacePy::segment(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -423,7 +423,7 @@ PyObject* BSplineSurfacePy::setUKnot(PyObject *args) int Index, M=-1; double K; if (!PyArg_ParseTuple(args, "id|i", &Index, &K, &M)) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -442,7 +442,7 @@ PyObject* BSplineSurfacePy::setVKnot(PyObject *args) int Index, M=-1; double K; if (!PyArg_ParseTuple(args, "id|i", &Index, &K, &M)) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -460,7 +460,7 @@ PyObject* BSplineSurfacePy::getUKnot(PyObject *args) { int Index; if (!PyArg_ParseTuple(args, "i", &Index)) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -473,7 +473,7 @@ PyObject* BSplineSurfacePy::getVKnot(PyObject *args) { int Index; if (!PyArg_ParseTuple(args, "i", &Index)) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -486,7 +486,7 @@ PyObject* BSplineSurfacePy::setUKnots(PyObject *args) { PyObject* obj; if (!PyArg_ParseTuple(args, "O", &obj)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColStd_Array1OfReal k(1,list.size()); @@ -503,7 +503,7 @@ PyObject* BSplineSurfacePy::setUKnots(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -511,7 +511,7 @@ PyObject* BSplineSurfacePy::setVKnots(PyObject *args) { PyObject* obj; if (!PyArg_ParseTuple(args, "O", &obj)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColStd_Array1OfReal k(1,list.size()); @@ -528,14 +528,14 @@ PyObject* BSplineSurfacePy::setVKnots(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::getUKnots(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -549,14 +549,14 @@ PyObject* BSplineSurfacePy::getUKnots(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::getVKnots(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -570,7 +570,7 @@ PyObject* BSplineSurfacePy::getVKnots(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -580,7 +580,7 @@ PyObject* BSplineSurfacePy::setPole(PyObject *args) double weight=-1.0; PyObject* p; if (!PyArg_ParseTuple(args, "iiO!|d", &uindex,&vindex,&(Base::VectorPy::Type),&p,&weight)) - return 0; + return nullptr; Base::Vector3d vec = static_cast(p)->value(); gp_Pnt pnt(vec.x, vec.y, vec.z); try { @@ -594,7 +594,7 @@ PyObject* BSplineSurfacePy::setPole(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -602,9 +602,9 @@ PyObject* BSplineSurfacePy::setPoleCol(PyObject *args) { int vindex; PyObject* obj; - PyObject* obj2=0; + PyObject* obj2=nullptr; if (!PyArg_ParseTuple(args, "iO|O",&vindex,&obj,&obj2)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); @@ -617,7 +617,7 @@ PyObject* BSplineSurfacePy::setPoleCol(PyObject *args) Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); - if (obj2 == 0) { + if (obj2 == nullptr) { surf->SetPoleCol(vindex, poles); } else { @@ -634,7 +634,7 @@ PyObject* BSplineSurfacePy::setPoleCol(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -642,9 +642,9 @@ PyObject* BSplineSurfacePy::setPoleRow(PyObject *args) { int uindex; PyObject* obj; - PyObject* obj2=0; + PyObject* obj2=nullptr; if (!PyArg_ParseTuple(args, "iO|O",&uindex,&obj,&obj2)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); @@ -657,7 +657,7 @@ PyObject* BSplineSurfacePy::setPoleRow(PyObject *args) Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); - if (obj2 == 0) { + if (obj2 == nullptr) { surf->SetPoleRow(uindex, poles); } else { @@ -674,7 +674,7 @@ PyObject* BSplineSurfacePy::setPoleRow(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -682,7 +682,7 @@ PyObject* BSplineSurfacePy::getPole(PyObject *args) { int uindex,vindex; if (!PyArg_ParseTuple(args, "ii", &uindex,&vindex)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -696,14 +696,14 @@ PyObject* BSplineSurfacePy::getPole(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::getPoles(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -723,7 +723,7 @@ PyObject* BSplineSurfacePy::getPoles(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -732,7 +732,7 @@ PyObject* BSplineSurfacePy::setWeight(PyObject *args) int uindex,vindex; double weight; if (!PyArg_ParseTuple(args, "iid",&uindex,&vindex,&weight)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -741,7 +741,7 @@ PyObject* BSplineSurfacePy::setWeight(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -750,7 +750,7 @@ PyObject* BSplineSurfacePy::setWeightCol(PyObject *args) int vindex; PyObject* obj; if (!PyArg_ParseTuple(args, "iO",&vindex,&obj)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColStd_Array1OfReal weights(1, list.size()); @@ -766,7 +766,7 @@ PyObject* BSplineSurfacePy::setWeightCol(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -775,7 +775,7 @@ PyObject* BSplineSurfacePy::setWeightRow(PyObject *args) int uindex; PyObject* obj; if (!PyArg_ParseTuple(args, "iO",&uindex,&obj)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColStd_Array1OfReal weights(1, list.size()); @@ -791,7 +791,7 @@ PyObject* BSplineSurfacePy::setWeightRow(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -799,7 +799,7 @@ PyObject* BSplineSurfacePy::getWeight(PyObject *args) { int uindex,vindex; if (!PyArg_ParseTuple(args, "ii",&uindex,&vindex)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -811,14 +811,14 @@ PyObject* BSplineSurfacePy::getWeight(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::getWeights(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -836,14 +836,14 @@ PyObject* BSplineSurfacePy::getWeights(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::getPolesAndWeights(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -871,7 +871,7 @@ PyObject* BSplineSurfacePy::getPolesAndWeights(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -879,7 +879,7 @@ PyObject* BSplineSurfacePy::getResolution(PyObject *args) { double tol; if (!PyArg_ParseTuple(args, "d", &tol)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -889,7 +889,7 @@ PyObject* BSplineSurfacePy::getResolution(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -901,7 +901,7 @@ PyObject* BSplineSurfacePy::movePoint(PyObject *args) PyObject* pnt; if (!PyArg_ParseTuple(args, "ddO!iiii", &U, &V, &(Base::VectorPy::Type),&pnt, &uindex1, &uindex2,&vindex1, &vindex2)) - return 0; + return nullptr; try { Base::Vector3d p = static_cast(pnt)->value(); Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast @@ -913,14 +913,14 @@ PyObject* BSplineSurfacePy::movePoint(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::setUNotPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -929,14 +929,14 @@ PyObject* BSplineSurfacePy::setUNotPeriodic(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::setVNotPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -945,14 +945,14 @@ PyObject* BSplineSurfacePy::setVNotPeriodic(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::setUPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -961,14 +961,14 @@ PyObject* BSplineSurfacePy::setUPeriodic(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::setVPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -977,7 +977,7 @@ PyObject* BSplineSurfacePy::setVPeriodic(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -985,7 +985,7 @@ PyObject* BSplineSurfacePy::setUOrigin(PyObject *args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -994,7 +994,7 @@ PyObject* BSplineSurfacePy::setUOrigin(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -1002,7 +1002,7 @@ PyObject* BSplineSurfacePy::setVOrigin(PyObject *args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -1011,7 +1011,7 @@ PyObject* BSplineSurfacePy::setVOrigin(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -1019,7 +1019,7 @@ PyObject* BSplineSurfacePy::getUMultiplicity(PyObject *args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -1028,7 +1028,7 @@ PyObject* BSplineSurfacePy::getUMultiplicity(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -1036,7 +1036,7 @@ PyObject* BSplineSurfacePy::getVMultiplicity(PyObject *args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -1045,14 +1045,14 @@ PyObject* BSplineSurfacePy::getVMultiplicity(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::getUMultiplicities(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -1066,14 +1066,14 @@ PyObject* BSplineSurfacePy::getUMultiplicities(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::getVMultiplicities(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -1087,14 +1087,14 @@ PyObject* BSplineSurfacePy::getVMultiplicities(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::exchangeUV(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); @@ -1107,7 +1107,7 @@ PyObject* BSplineSurfacePy::reparametrize(PyObject * args) int u,v; double tol = 0.000001; if (!PyArg_ParseTuple(args, "ii|d", &u, &v, &tol)) - return 0; + return nullptr; // u,v must be at least 2 u = std::max(u, 2); @@ -1150,7 +1150,7 @@ PyObject* BSplineSurfacePy::reparametrize(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -1170,10 +1170,10 @@ PyObject* BSplineSurfacePy::approximate(PyObject *args, PyObject *kwds) Standard_Real Y0=0; Standard_Real dY=0; - static char* kwds_interp[] = {"Points", "DegMin", "DegMax", "Continuity", "Tolerance", "X0", "dX", "Y0", "dY", "ParamType", "LengthWeight", "CurvatureWeight", "TorsionWeight", NULL}; + static char* kwds_interp[] = {"Points", "DegMin", "DegMax", "Continuity", "Tolerance", "X0", "dX", "Y0", "dY", "ParamType", "LengthWeight", "CurvatureWeight", "TorsionWeight", nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|iiidddddsddd", kwds_interp, &obj, °Min, °Max, &continuity, &tol3d, &X0, &dX, &Y0, &dY, &parType, &weight1, &weight2, &weight3)) - return 0; + return nullptr; try { Py::Sequence list(obj); Standard_Integer lu = list.size(); @@ -1262,7 +1262,7 @@ PyObject* BSplineSurfacePy::approximate(PyObject *args, PyObject *kwds) std::string err = e.GetMessageString(); if (err.empty()) err = e.DynamicType()->Name(); PyErr_SetString(PartExceptionOCCError, err.c_str()); - return 0; + return nullptr; } } @@ -1277,7 +1277,7 @@ PyObject* BSplineSurfacePy::interpolate(PyObject *args) int len = PyTuple_GET_SIZE(args); if (!PyArg_ParseTuple(args, "O|dddd", &obj, &X0, &dX, &Y0, &dY)) - return 0; + return nullptr; try { Py::Sequence list(obj); Standard_Integer lu = list.size(); @@ -1326,14 +1326,14 @@ PyObject* BSplineSurfacePy::interpolate(PyObject *args) std::string err = e.GetMessageString(); if (err.empty()) err = e.DynamicType()->Name(); PyErr_SetString(PartExceptionOCCError, err.c_str()); - return 0; + return nullptr; } } PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *keywds) { static char *kwlist[] = {"poles", "umults", "vmults", - "uknots", "vknots", "uperiodic", "vperiodic", "udegree", "vdegree", "weights", NULL}; + "uknots", "vknots", "uperiodic", "vperiodic", "udegree", "vdegree", "weights", nullptr}; PyObject* uperiodic = Py_False; PyObject* vperiodic = Py_False; PyObject* poles = Py_None; @@ -1354,7 +1354,7 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k &uknots, &vknots, //optional &PyBool_Type, &uperiodic, &PyBool_Type, &vperiodic, //optinoal &udegree, &vdegree, &weights)) //optional - return 0; + return nullptr; try { Py::Sequence list(poles); Standard_Integer lu = list.size(); @@ -1405,7 +1405,7 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k if (((uknots != Py_None) && PyObject_Length(uknots) != number_of_uknots) || ((vknots != Py_None) && PyObject_Length(vknots) != number_of_vknots)){ Standard_Failure::Raise("number of knots and mults mismatch"); - return 0; + return nullptr; } //copy mults TColStd_Array1OfInteger occumults(1,number_of_uknots); @@ -1485,14 +1485,14 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k } else { Standard_Failure::Raise("failed to create spline"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } catch (const Standard_Failure& e) { Standard_CString msg = e.GetMessageString(); PyErr_SetString(PartExceptionOCCError, msg ? msg : ""); - return 0; + return nullptr; } } @@ -1674,7 +1674,7 @@ Py::List BSplineSurfacePy::getVKnotSequence(void) const PyObject *BSplineSurfacePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int BSplineSurfacePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/BezierCurvePyImp.cpp b/src/Mod/Part/App/BezierCurvePyImp.cpp index 95c902ddfe..8228189366 100644 --- a/src/Mod/Part/App/BezierCurvePyImp.cpp +++ b/src/Mod/Part/App/BezierCurvePyImp.cpp @@ -63,7 +63,7 @@ int BezierCurvePy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/) PyObject* BezierCurvePy::isRational(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); Standard_Boolean val = curve->IsRational(); @@ -73,7 +73,7 @@ PyObject* BezierCurvePy::isRational(PyObject *args) PyObject* BezierCurvePy::isPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); Standard_Boolean val = curve->IsPeriodic(); @@ -83,7 +83,7 @@ PyObject* BezierCurvePy::isPeriodic(PyObject *args) PyObject* BezierCurvePy::isClosed(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); Standard_Boolean val = curve->IsClosed(); @@ -94,7 +94,7 @@ PyObject* BezierCurvePy::increase(PyObject * args) { int degree; if (!PyArg_ParseTuple(args, "i", °ree)) - return 0; + return nullptr; Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); curve->Increase(degree); @@ -107,7 +107,7 @@ PyObject* BezierCurvePy::insertPoleAfter(PyObject * args) double weight=1.0; PyObject* p; if (!PyArg_ParseTuple(args, "iO!|d", &index, &(Base::VectorPy::Type), &p, &weight)) - return 0; + return nullptr; Base::Vector3d vec = static_cast(p)->value(); gp_Pnt pnt(vec.x, vec.y, vec.z); try { @@ -118,7 +118,7 @@ PyObject* BezierCurvePy::insertPoleAfter(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -128,7 +128,7 @@ PyObject* BezierCurvePy::insertPoleBefore(PyObject * args) double weight=1.0; PyObject* p; if (!PyArg_ParseTuple(args, "iO!|d", &index, &(Base::VectorPy::Type), &p, &weight)) - return 0; + return nullptr; Base::Vector3d vec = static_cast(p)->value(); gp_Pnt pnt(vec.x, vec.y, vec.z); try { @@ -139,7 +139,7 @@ PyObject* BezierCurvePy::insertPoleBefore(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -147,7 +147,7 @@ PyObject* BezierCurvePy::removePole(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); @@ -156,7 +156,7 @@ PyObject* BezierCurvePy::removePole(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -164,7 +164,7 @@ PyObject* BezierCurvePy::segment(PyObject * args) { double u1,u2; if (!PyArg_ParseTuple(args, "dd", &u1,&u2)) - return 0; + return nullptr; try { Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); @@ -173,7 +173,7 @@ PyObject* BezierCurvePy::segment(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -183,7 +183,7 @@ PyObject* BezierCurvePy::setPole(PyObject * args) double weight=-1.0; PyObject* p; if (!PyArg_ParseTuple(args, "iO!|d", &index, &(Base::VectorPy::Type), &p, &weight)) - return 0; + return nullptr; Base::Vector3d vec = static_cast(p)->value(); gp_Pnt pnt(vec.x, vec.y, vec.z); try { @@ -197,7 +197,7 @@ PyObject* BezierCurvePy::setPole(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -205,7 +205,7 @@ PyObject* BezierCurvePy::getPole(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); @@ -218,14 +218,14 @@ PyObject* BezierCurvePy::getPole(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BezierCurvePy::getPoles(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); @@ -242,7 +242,7 @@ PyObject* BezierCurvePy::getPoles(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -250,7 +250,7 @@ PyObject* BezierCurvePy::setPoles(PyObject * args) { PyObject* plist; if (!PyArg_ParseTuple(args, "O", &plist)) - return 0; + return nullptr; try { Py::Sequence list(plist); TColgp_Array1OfPnt poles(1,list.size()); @@ -267,7 +267,7 @@ PyObject* BezierCurvePy::setPoles(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -276,7 +276,7 @@ PyObject* BezierCurvePy::setWeight(PyObject * args) int index; double weight; if (!PyArg_ParseTuple(args, "id", &index,&weight)) - return 0; + return nullptr; try { Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); @@ -285,7 +285,7 @@ PyObject* BezierCurvePy::setWeight(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -293,7 +293,7 @@ PyObject* BezierCurvePy::getWeight(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); @@ -304,14 +304,14 @@ PyObject* BezierCurvePy::getWeight(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BezierCurvePy::getWeights(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); @@ -325,7 +325,7 @@ PyObject* BezierCurvePy::getWeights(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -333,7 +333,7 @@ PyObject* BezierCurvePy::getResolution(PyObject* args) { double tol; if (!PyArg_ParseTuple(args, "d", &tol)) - return 0; + return nullptr; try { Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); @@ -343,7 +343,7 @@ PyObject* BezierCurvePy::getResolution(PyObject* args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } Py::Long BezierCurvePy::getDegree(void) const @@ -386,9 +386,9 @@ Py::Object BezierCurvePy::getEndPoint(void) const PyObject* BezierCurvePy::interpolate(PyObject * args) { PyObject* obj; - PyObject* par=0; + PyObject* par=nullptr; if (!PyArg_ParseTuple(args, "O|O", &obj, &par)) - return 0; + return nullptr; try { Handle(Geom_BezierCurve) curve = Handle(Geom_BezierCurve)::DownCast (getGeometryPtr()->handle()); @@ -474,13 +474,13 @@ PyObject* BezierCurvePy::interpolate(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject *BezierCurvePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int BezierCurvePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/BezierSurfacePyImp.cpp b/src/Mod/Part/App/BezierSurfacePyImp.cpp index b052894b77..7a28255547 100644 --- a/src/Mod/Part/App/BezierSurfacePyImp.cpp +++ b/src/Mod/Part/App/BezierSurfacePyImp.cpp @@ -64,7 +64,7 @@ int BezierSurfacePy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/) PyObject* BezierSurfacePy::bounds(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -81,7 +81,7 @@ PyObject* BezierSurfacePy::bounds(PyObject *args) PyObject* BezierSurfacePy::isURational(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -92,7 +92,7 @@ PyObject* BezierSurfacePy::isURational(PyObject *args) PyObject* BezierSurfacePy::isVRational(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -103,7 +103,7 @@ PyObject* BezierSurfacePy::isVRational(PyObject *args) PyObject* BezierSurfacePy::isUPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -114,7 +114,7 @@ PyObject* BezierSurfacePy::isUPeriodic(PyObject *args) PyObject* BezierSurfacePy::isVPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -125,7 +125,7 @@ PyObject* BezierSurfacePy::isVPeriodic(PyObject *args) PyObject* BezierSurfacePy::isUClosed(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -136,7 +136,7 @@ PyObject* BezierSurfacePy::isUClosed(PyObject *args) PyObject* BezierSurfacePy::isVClosed(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -148,7 +148,7 @@ PyObject* BezierSurfacePy::increase(PyObject *args) { int udegree,vdegree; if (!PyArg_ParseTuple(args, "ii", &udegree, &vdegree)) - return 0; + return nullptr; try { Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -158,7 +158,7 @@ PyObject* BezierSurfacePy::increase(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -166,9 +166,9 @@ PyObject* BezierSurfacePy::insertPoleColAfter(PyObject *args) { int vindex; PyObject* obj; - PyObject* obj2=0; + PyObject* obj2=nullptr; if (!PyArg_ParseTuple(args, "iO|O",&vindex,&obj,&obj2)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); @@ -181,7 +181,7 @@ PyObject* BezierSurfacePy::insertPoleColAfter(PyObject *args) Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); - if (obj2 == 0) { + if (obj2 == nullptr) { surf->InsertPoleColAfter(vindex, poles); } else { @@ -198,7 +198,7 @@ PyObject* BezierSurfacePy::insertPoleColAfter(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -206,9 +206,9 @@ PyObject* BezierSurfacePy::insertPoleRowAfter(PyObject *args) { int uindex; PyObject* obj; - PyObject* obj2=0; + PyObject* obj2=nullptr; if (!PyArg_ParseTuple(args, "iO|O",&uindex,&obj,&obj2)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); @@ -221,7 +221,7 @@ PyObject* BezierSurfacePy::insertPoleRowAfter(PyObject *args) Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); - if (obj2 == 0) { + if (obj2 == nullptr) { surf->InsertPoleRowAfter(uindex, poles); } else { @@ -238,7 +238,7 @@ PyObject* BezierSurfacePy::insertPoleRowAfter(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -246,9 +246,9 @@ PyObject* BezierSurfacePy::insertPoleColBefore(PyObject *args) { int vindex; PyObject* obj; - PyObject* obj2=0; + PyObject* obj2=nullptr; if (!PyArg_ParseTuple(args, "iO|O",&vindex,&obj,&obj2)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); @@ -261,7 +261,7 @@ PyObject* BezierSurfacePy::insertPoleColBefore(PyObject *args) Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); - if (obj2 == 0) { + if (obj2 == nullptr) { surf->InsertPoleColBefore(vindex, poles); } else { @@ -278,7 +278,7 @@ PyObject* BezierSurfacePy::insertPoleColBefore(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -286,9 +286,9 @@ PyObject* BezierSurfacePy::insertPoleRowBefore(PyObject *args) { int uindex; PyObject* obj; - PyObject* obj2=0; + PyObject* obj2=nullptr; if (!PyArg_ParseTuple(args, "iO|O",&uindex,&obj,&obj2)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); @@ -301,7 +301,7 @@ PyObject* BezierSurfacePy::insertPoleRowBefore(PyObject *args) Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); - if (obj2 == 0) { + if (obj2 == nullptr) { surf->InsertPoleRowBefore(uindex, poles); } else { @@ -318,7 +318,7 @@ PyObject* BezierSurfacePy::insertPoleRowBefore(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -326,7 +326,7 @@ PyObject* BezierSurfacePy::removePoleCol(PyObject *args) { int vindex; if (!PyArg_ParseTuple(args, "i",&vindex)) - return 0; + return nullptr; try { Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -335,7 +335,7 @@ PyObject* BezierSurfacePy::removePoleCol(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -343,7 +343,7 @@ PyObject* BezierSurfacePy::removePoleRow(PyObject *args) { int uindex; if (!PyArg_ParseTuple(args, "i",&uindex)) - return 0; + return nullptr; try { Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -352,7 +352,7 @@ PyObject* BezierSurfacePy::removePoleRow(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -360,7 +360,7 @@ PyObject* BezierSurfacePy::segment(PyObject *args) { Standard_Real u1,u2,v1,v2; if (!PyArg_ParseTuple(args, "dddd",&u1,&u2,&v1,&v2)) - return 0; + return nullptr; try { Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -369,7 +369,7 @@ PyObject* BezierSurfacePy::segment(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -379,7 +379,7 @@ PyObject* BezierSurfacePy::setPole(PyObject *args) PyObject* obj; double weight=0.0; if (!PyArg_ParseTuple(args, "iiO!|d",&uindex,&vindex,&(Base::VectorPy::Type),&obj,&weight)) - return 0; + return nullptr; try { Base::Vector3d pole = static_cast(obj)->value(); Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast @@ -392,7 +392,7 @@ PyObject* BezierSurfacePy::setPole(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -400,9 +400,9 @@ PyObject* BezierSurfacePy::setPoleCol(PyObject *args) { int vindex; PyObject* obj; - PyObject* obj2=0; + PyObject* obj2=nullptr; if (!PyArg_ParseTuple(args, "iO|O",&vindex,&obj,&obj2)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); @@ -415,7 +415,7 @@ PyObject* BezierSurfacePy::setPoleCol(PyObject *args) Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); - if (obj2 == 0) { + if (obj2 == nullptr) { surf->SetPoleCol(vindex, poles); } else { @@ -432,7 +432,7 @@ PyObject* BezierSurfacePy::setPoleCol(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -440,9 +440,9 @@ PyObject* BezierSurfacePy::setPoleRow(PyObject *args) { int uindex; PyObject* obj; - PyObject* obj2=0; + PyObject* obj2=nullptr; if (!PyArg_ParseTuple(args, "iO|O",&uindex,&obj,&obj2)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColgp_Array1OfPnt poles(1, list.size()); @@ -455,7 +455,7 @@ PyObject* BezierSurfacePy::setPoleRow(PyObject *args) Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); - if (obj2 == 0) { + if (obj2 == nullptr) { surf->SetPoleRow(uindex, poles); } else { @@ -472,7 +472,7 @@ PyObject* BezierSurfacePy::setPoleRow(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -480,7 +480,7 @@ PyObject* BezierSurfacePy::getPole(PyObject *args) { int uindex,vindex; if (!PyArg_ParseTuple(args, "ii",&uindex,&vindex)) - return 0; + return nullptr; try { Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -492,14 +492,14 @@ PyObject* BezierSurfacePy::getPole(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BezierSurfacePy::getPoles(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -519,7 +519,7 @@ PyObject* BezierSurfacePy::getPoles(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -528,7 +528,7 @@ PyObject* BezierSurfacePy::setWeight(PyObject *args) int uindex,vindex; double weight; if (!PyArg_ParseTuple(args, "iid",&uindex,&vindex,&weight)) - return 0; + return nullptr; try { Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -537,7 +537,7 @@ PyObject* BezierSurfacePy::setWeight(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -546,7 +546,7 @@ PyObject* BezierSurfacePy::setWeightCol(PyObject *args) int vindex; PyObject* obj; if (!PyArg_ParseTuple(args, "iO",&vindex,&obj)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColStd_Array1OfReal weights(1, list.size()); @@ -562,7 +562,7 @@ PyObject* BezierSurfacePy::setWeightCol(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -571,7 +571,7 @@ PyObject* BezierSurfacePy::setWeightRow(PyObject *args) int uindex; PyObject* obj; if (!PyArg_ParseTuple(args, "iO",&uindex,&obj)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColStd_Array1OfReal weights(1, list.size()); @@ -587,7 +587,7 @@ PyObject* BezierSurfacePy::setWeightRow(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -595,7 +595,7 @@ PyObject* BezierSurfacePy::getWeight(PyObject *args) { int uindex,vindex; if (!PyArg_ParseTuple(args, "ii",&uindex,&vindex)) - return 0; + return nullptr; try { Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -607,14 +607,14 @@ PyObject* BezierSurfacePy::getWeight(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BezierSurfacePy::getWeights(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -632,7 +632,7 @@ PyObject* BezierSurfacePy::getWeights(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -640,7 +640,7 @@ PyObject* BezierSurfacePy::getResolution(PyObject *args) { double tol; if (!PyArg_ParseTuple(args, "d", &tol)) - return 0; + return nullptr; try { Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast (getGeometryPtr()->handle()); @@ -650,14 +650,14 @@ PyObject* BezierSurfacePy::getResolution(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BezierSurfacePy::exchangeUV(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_BezierSurface) surf = Handle(Geom_BezierSurface)::DownCast @@ -668,7 +668,7 @@ PyObject* BezierSurfacePy::exchangeUV(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -709,7 +709,7 @@ Py::Long BezierSurfacePy::getNbVPoles(void) const PyObject *BezierSurfacePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int BezierSurfacePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/BodyBase.cpp b/src/Mod/Part/App/BodyBase.cpp index 04267f4b5f..fd18c9bb8e 100644 --- a/src/Mod/Part/App/BodyBase.cpp +++ b/src/Mod/Part/App/BodyBase.cpp @@ -40,10 +40,10 @@ PROPERTY_SOURCE_WITH_EXTENSIONS(Part::BodyBase, Part::Feature) BodyBase::BodyBase() { - ADD_PROPERTY(Tip , (0) ); + ADD_PROPERTY(Tip , (nullptr) ); Tip.setScope(App::LinkScope::Child); - ADD_PROPERTY(BaseFeature , (0) ); + ADD_PROPERTY(BaseFeature , (nullptr) ); App::OriginGroupExtension::initExtension(this); } @@ -51,7 +51,7 @@ BodyBase::BodyBase() BodyBase* BodyBase::findBodyOf(const App::DocumentObject* f) { App::Document* doc = f->getDocument(); - if (doc != NULL) { + if (doc != nullptr) { std::vector bodies = doc->getObjectsOfType(BodyBase::getClassTypeId()); for (std::vector::const_iterator b = bodies.begin(); b != bodies.end(); b++) { BodyBase* body = static_cast(*b); @@ -60,7 +60,7 @@ BodyBase* BodyBase::findBodyOf(const App::DocumentObject* f) } } - return NULL; + return nullptr; } bool BodyBase::isAfter(const App::DocumentObject *feature, const App::DocumentObject* target) const { diff --git a/src/Mod/Part/App/BodyBasePyImp.cpp b/src/Mod/Part/App/BodyBasePyImp.cpp index 2f9286732f..88091eaa97 100644 --- a/src/Mod/Part/App/BodyBasePyImp.cpp +++ b/src/Mod/Part/App/BodyBasePyImp.cpp @@ -40,7 +40,7 @@ std::string BodyBasePy::representation(void) const PyObject *BodyBasePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int BodyBasePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/BoundedCurvePyImp.cpp b/src/Mod/Part/App/BoundedCurvePyImp.cpp index b5d0131435..d9c7c6a92c 100644 --- a/src/Mod/Part/App/BoundedCurvePyImp.cpp +++ b/src/Mod/Part/App/BoundedCurvePyImp.cpp @@ -47,7 +47,7 @@ PyObject *BoundedCurvePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // never create such objects with the constructor PyErr_SetString(PyExc_RuntimeError, "You cannot create an instance of the abstract class 'BoundedCurve'."); - return 0; + return nullptr; } // constructor method @@ -68,7 +68,7 @@ Py::Object BoundedCurvePy::getEndPoint(void) const PyObject *BoundedCurvePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int BoundedCurvePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/CirclePyImp.cpp b/src/Mod/Part/App/CirclePyImp.cpp index da7480d932..16aa8df0d1 100644 --- a/src/Mod/Part/App/CirclePyImp.cpp +++ b/src/Mod/Part/App/CirclePyImp.cpp @@ -71,7 +71,7 @@ int CirclePy::PyInit(PyObject* args, PyObject* kwds) // circle and distance for offset PyObject *pCirc; double dist; - static char* keywords_cd[] = {"Circle","Distance",NULL}; + static char* keywords_cd[] = {"Circle","Distance",nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!d", keywords_cd, &(CirclePy::Type), &pCirc, &dist)) { CirclePy* pcCircle = static_cast(pCirc); Handle(Geom_Circle) circle = Handle(Geom_Circle)::DownCast @@ -89,7 +89,7 @@ int CirclePy::PyInit(PyObject* args, PyObject* kwds) // center, normal and radius PyObject *pV1, *pV2, *pV3; - static char* keywords_cnr[] = {"Center","Normal","Radius",NULL}; + static char* keywords_cnr[] = {"Center","Normal","Radius",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!d", keywords_cnr, &(Base::VectorPy::Type), &pV1, @@ -110,7 +110,7 @@ int CirclePy::PyInit(PyObject* args, PyObject* kwds) return 0; } - static char* keywords_c[] = {"Circle",NULL}; + static char* keywords_c[] = {"Circle",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", keywords_c, &(CirclePy::Type), &pCirc)) { CirclePy* pcCircle = static_cast(pCirc); @@ -122,7 +122,7 @@ int CirclePy::PyInit(PyObject* args, PyObject* kwds) return 0; } - static char* keywords_ppp[] = {"Point1","Point2","Point3",NULL}; + static char* keywords_ppp[] = {"Point1","Point2","Point3",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!", keywords_ppp, &(Base::VectorPy::Type), &pV1, @@ -145,7 +145,7 @@ int CirclePy::PyInit(PyObject* args, PyObject* kwds) } // default circle - static char* keywords_n[] = {NULL}; + static char* keywords_n[] = {nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "", keywords_n)) { Handle(Geom_Circle) circle = Handle(Geom_Circle)::DownCast(getGeomCirclePtr()->handle()); @@ -176,7 +176,7 @@ void CirclePy::setRadius(Py::Float arg) PyObject *CirclePy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int CirclePy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/ConePyImp.cpp b/src/Mod/Part/App/ConePyImp.cpp index 0dde93d207..6bb4af6ea3 100644 --- a/src/Mod/Part/App/ConePyImp.cpp +++ b/src/Mod/Part/App/ConePyImp.cpp @@ -63,7 +63,7 @@ PyObject *ConePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Pytho // constructor method int ConePy::PyInit(PyObject* args, PyObject* kwds) { - char* keywords_n[] = {NULL}; + char* keywords_n[] = {nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "", keywords_n)) { Handle(Geom_ConicalSurface) s = Handle(Geom_ConicalSurface)::DownCast (getGeometryPtr()->handle()); @@ -73,7 +73,7 @@ int ConePy::PyInit(PyObject* args, PyObject* kwds) PyObject *pV1, *pV2; double radius1, radius2; - static char* keywords_pprr[] = {"Point1","Point2","Radius1","Radius2",NULL}; + static char* keywords_pprr[] = {"Point1","Point2","Radius1","Radius2",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!dd", keywords_pprr, &(Base::VectorPy::Type), &pV1, @@ -96,7 +96,7 @@ int ConePy::PyInit(PyObject* args, PyObject* kwds) } PyObject *pV3, *pV4; - static char* keywords_pppp[] = {"Point1","Point2","Point3","Point4",NULL}; + static char* keywords_pppp[] = {"Point1","Point2","Point3","Point4",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!O!", keywords_pppp, &(Base::VectorPy::Type), &pV1, @@ -123,7 +123,7 @@ int ConePy::PyInit(PyObject* args, PyObject* kwds) } PyObject *pCone; - static char* keywords_c[] = {"Cone",NULL}; + static char* keywords_c[] = {"Cone",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!d", keywords_c, &(ConePy::Type), &pCone)) { @@ -262,7 +262,7 @@ void ConePy::setAxis(Py::Object arg) PyObject *ConePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int ConePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/ConicPyImp.cpp b/src/Mod/Part/App/ConicPyImp.cpp index b2ec77485d..d6c0ca000e 100644 --- a/src/Mod/Part/App/ConicPyImp.cpp +++ b/src/Mod/Part/App/ConicPyImp.cpp @@ -46,7 +46,7 @@ PyObject *ConicPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Pyth // never create such objects with the constructor PyErr_SetString(PyExc_RuntimeError, "You cannot create an instance of the abstract class 'Conic'."); - return 0; + return nullptr; } // constructor method @@ -229,7 +229,7 @@ void ConicPy::setYAxis(Py::Object arg) PyObject *ConicPy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int ConicPy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/CylinderPyImp.cpp b/src/Mod/Part/App/CylinderPyImp.cpp index c39d80ede2..b6301f31f5 100644 --- a/src/Mod/Part/App/CylinderPyImp.cpp +++ b/src/Mod/Part/App/CylinderPyImp.cpp @@ -66,7 +66,7 @@ int CylinderPy::PyInit(PyObject* args, PyObject* kwds) // cylinder and distance for offset PyObject *pCyl; double dist; - static char* keywords_cd[] = {"Cylinder","Distance",NULL}; + static char* keywords_cd[] = {"Cylinder","Distance",nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!d", keywords_cd, &(CylinderPy::Type), &pCyl, &dist)) { CylinderPy* pcCylinder = static_cast(pCyl); Handle(Geom_CylindricalSurface) cylinder = Handle(Geom_CylindricalSurface)::DownCast @@ -83,7 +83,7 @@ int CylinderPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - static char* keywords_c[] = {"Cylinder",NULL}; + static char* keywords_c[] = {"Cylinder",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", keywords_c, &(CylinderPy::Type), &pCyl)) { CylinderPy* pcCylinder = static_cast(pCyl); @@ -96,7 +96,7 @@ int CylinderPy::PyInit(PyObject* args, PyObject* kwds) } PyObject *pV1, *pV2, *pV3; - static char* keywords_ppp[] = {"Point1","Point2","Point3",NULL}; + static char* keywords_ppp[] = {"Point1","Point2","Point3",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!", keywords_ppp, &(Base::VectorPy::Type), &pV1, @@ -119,7 +119,7 @@ int CylinderPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - static char* keywords_cc[] = {"Circle",NULL}; + static char* keywords_cc[] = {"Circle",nullptr}; PyErr_Clear(); PyObject *pCirc; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", keywords_cc, &(CirclePy::Type), &pCirc)) { @@ -138,7 +138,7 @@ int CylinderPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - static char* keywords_n[] = {NULL}; + static char* keywords_n[] = {nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "", keywords_n)) { Handle(Geom_CylindricalSurface) cyl = Handle(Geom_CylindricalSurface)::DownCast @@ -246,7 +246,7 @@ void CylinderPy::setAxis(Py::Object arg) PyObject *CylinderPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int CylinderPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/EllipsePyImp.cpp b/src/Mod/Part/App/EllipsePyImp.cpp index 1941954599..df01abf9ff 100644 --- a/src/Mod/Part/App/EllipsePyImp.cpp +++ b/src/Mod/Part/App/EllipsePyImp.cpp @@ -55,7 +55,7 @@ PyObject *EllipsePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Py // constructor method int EllipsePy::PyInit(PyObject* args, PyObject* kwds) { - char* keywords_n[] = {NULL}; + char* keywords_n[] = {nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "", keywords_n)) { Handle(Geom_Ellipse) ellipse = Handle(Geom_Ellipse)::DownCast(getGeomEllipsePtr()->handle()); ellipse->SetMajorRadius(2.0); @@ -63,7 +63,7 @@ int EllipsePy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_e[] = {"Ellipse",NULL}; + char* keywords_e[] = {"Ellipse",nullptr}; PyErr_Clear(); PyObject *pElips; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!",keywords_e, &(EllipsePy::Type), &pElips)) { @@ -76,7 +76,7 @@ int EllipsePy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_ssc[] = {"S1","S2","Center",NULL}; + char* keywords_ssc[] = {"S1","S2","Center",nullptr}; PyErr_Clear(); PyObject *pV1, *pV2, *pV3; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!", keywords_ssc, @@ -99,7 +99,7 @@ int EllipsePy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_cmm[] = {"Center","MajorRadius","MinorRadius",NULL}; + char* keywords_cmm[] = {"Center","MajorRadius","MinorRadius",nullptr}; PyErr_Clear(); PyObject *pV; double major, minor; @@ -173,7 +173,7 @@ Py::Object EllipsePy::getFocus2(void) const PyObject *EllipsePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int EllipsePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/FeatureCompound.cpp b/src/Mod/Part/App/FeatureCompound.cpp index c66ba91e86..553cc6306b 100644 --- a/src/Mod/Part/App/FeatureCompound.cpp +++ b/src/Mod/Part/App/FeatureCompound.cpp @@ -41,7 +41,7 @@ PROPERTY_SOURCE(Part::Compound, Part::Feature) Compound::Compound() { - ADD_PROPERTY(Links,(0)); + ADD_PROPERTY(Links,(nullptr)); Links.setSize(0); } diff --git a/src/Mod/Part/App/FeatureExtrusion.cpp b/src/Mod/Part/App/FeatureExtrusion.cpp index b0dbf8b218..04613bbf86 100644 --- a/src/Mod/Part/App/FeatureExtrusion.cpp +++ b/src/Mod/Part/App/FeatureExtrusion.cpp @@ -54,11 +54,11 @@ const char* Extrusion::eDirModeStrings[] = { "Custom", "Edge", "Normal", - NULL }; + nullptr }; Extrusion::Extrusion() { - ADD_PROPERTY_TYPE(Base, (0), "Extrude", App::Prop_None, "Shape to extrude"); + ADD_PROPERTY_TYPE(Base, (nullptr), "Extrude", App::Prop_None, "Shape to extrude"); ADD_PROPERTY_TYPE(Dir, (Base::Vector3d(0.0, 0.0, 1.0)), "Extrude", App::Prop_None, "Direction of extrusion (also magnitude, if both lengths are zero)."); ADD_PROPERTY_TYPE(DirMode, (dmCustom), "Extrude", App::Prop_None, "Sets, how Dir is updated."); DirMode.setEnums(eDirModeStrings); @@ -189,9 +189,9 @@ Extrusion::ExtrusionParameters Extrusion::computeFinalParameters() Base::Vector3d Extrusion::calculateShapeNormal(const App::PropertyLink& shapeLink) { - App::DocumentObject* docobj = 0; + App::DocumentObject* docobj = nullptr; Base::Matrix4D mat; - TopoDS_Shape sh = Feature::getShape(shapeLink.getValue(), 0, false, &mat, &docobj); + TopoDS_Shape sh = Feature::getShape(shapeLink.getValue(), nullptr, false, &mat, &docobj); if (!docobj) throw Base::ValueError("calculateShapeNormal: link is empty"); diff --git a/src/Mod/Part/App/FeatureFace.cpp b/src/Mod/Part/App/FeatureFace.cpp index 68874db00f..382c2a3305 100644 --- a/src/Mod/Part/App/FeatureFace.cpp +++ b/src/Mod/Part/App/FeatureFace.cpp @@ -55,7 +55,7 @@ PROPERTY_SOURCE(Part::Face, Part::Feature) Face::Face() { - ADD_PROPERTY(Sources,(0)); + ADD_PROPERTY(Sources,(nullptr)); ADD_PROPERTY(FaceMakerClass,("Part::FaceMakerCheese"));//default value here is for legacy documents. Default for new objects is set in setupObject. Sources.setSize(0); } diff --git a/src/Mod/Part/App/FeatureGeometrySet.cpp b/src/Mod/Part/App/FeatureGeometrySet.cpp index 2134d186c6..fda86d417e 100644 --- a/src/Mod/Part/App/FeatureGeometrySet.cpp +++ b/src/Mod/Part/App/FeatureGeometrySet.cpp @@ -38,7 +38,7 @@ PROPERTY_SOURCE(Part::FeatureGeometrySet, Part::Feature) FeatureGeometrySet::FeatureGeometrySet() { - ADD_PROPERTY(GeometrySet,(0)); + ADD_PROPERTY(GeometrySet,(nullptr)); } diff --git a/src/Mod/Part/App/FeatureMirroring.cpp b/src/Mod/Part/App/FeatureMirroring.cpp index b67d585bc3..ff10f43bbe 100644 --- a/src/Mod/Part/App/FeatureMirroring.cpp +++ b/src/Mod/Part/App/FeatureMirroring.cpp @@ -41,7 +41,7 @@ PROPERTY_SOURCE(Part::Mirroring, Part::Feature) Mirroring::Mirroring() { - ADD_PROPERTY(Source,(0)); + ADD_PROPERTY(Source,(nullptr)); ADD_PROPERTY_TYPE(Base,(Base::Vector3d()),"Plane",App::Prop_None,"The base point of the plane"); ADD_PROPERTY_TYPE(Normal,(Base::Vector3d(0,0,1)),"Plane",App::Prop_None,"The normal of the plane"); } diff --git a/src/Mod/Part/App/FeatureOffset.cpp b/src/Mod/Part/App/FeatureOffset.cpp index 5fc375b547..dedc2aa486 100644 --- a/src/Mod/Part/App/FeatureOffset.cpp +++ b/src/Mod/Part/App/FeatureOffset.cpp @@ -30,14 +30,14 @@ using namespace Part; -const char* Part::Offset::ModeEnums[]= {"Skin","Pipe", "RectoVerso",NULL}; -const char* Part::Offset::JoinEnums[]= {"Arc","Tangent", "Intersection",NULL}; +const char* Part::Offset::ModeEnums[]= {"Skin","Pipe", "RectoVerso",nullptr}; +const char* Part::Offset::JoinEnums[]= {"Arc","Tangent", "Intersection",nullptr}; PROPERTY_SOURCE(Part::Offset, Part::Feature) Offset::Offset() { - ADD_PROPERTY_TYPE(Source,(0),"Offset",App::Prop_None,"Source shape"); + ADD_PROPERTY_TYPE(Source,(nullptr),"Offset",App::Prop_None,"Source shape"); ADD_PROPERTY_TYPE(Value,(1.0),"Offset",App::Prop_None,"Offset value"); ADD_PROPERTY_TYPE(Mode,(long(0)),"Offset",App::Prop_None,"Mode"); Mode.setEnums(ModeEnums); diff --git a/src/Mod/Part/App/FeaturePartBoolean.cpp b/src/Mod/Part/App/FeaturePartBoolean.cpp index eb6ec94715..e225dd51da 100644 --- a/src/Mod/Part/App/FeaturePartBoolean.cpp +++ b/src/Mod/Part/App/FeaturePartBoolean.cpp @@ -42,8 +42,8 @@ PROPERTY_SOURCE_ABSTRACT(Part::Boolean, Part::Feature) Boolean::Boolean(void) { - ADD_PROPERTY(Base,(0)); - ADD_PROPERTY(Tool,(0)); + ADD_PROPERTY(Base,(nullptr)); + ADD_PROPERTY(Tool,(nullptr)); ADD_PROPERTY_TYPE(History,(ShapeHistory()), "Boolean", (App::PropertyType) (App::Prop_Output|App::Prop_Transient|App::Prop_Hidden), "Shape history"); History.setSize(0); diff --git a/src/Mod/Part/App/FeaturePartCommon.cpp b/src/Mod/Part/App/FeaturePartCommon.cpp index e5f8388a53..155b94a420 100644 --- a/src/Mod/Part/App/FeaturePartCommon.cpp +++ b/src/Mod/Part/App/FeaturePartCommon.cpp @@ -61,7 +61,7 @@ PROPERTY_SOURCE(Part::MultiCommon, Part::Feature) MultiCommon::MultiCommon(void) { - ADD_PROPERTY(Shapes,(0)); + ADD_PROPERTY(Shapes,(nullptr)); Shapes.setSize(0); ADD_PROPERTY_TYPE(History,(ShapeHistory()), "Boolean", (App::PropertyType) (App::Prop_Output|App::Prop_Transient|App::Prop_Hidden), "Shape history"); diff --git a/src/Mod/Part/App/FeaturePartFuse.cpp b/src/Mod/Part/App/FeaturePartFuse.cpp index bd3296549e..d98ecb760f 100644 --- a/src/Mod/Part/App/FeaturePartFuse.cpp +++ b/src/Mod/Part/App/FeaturePartFuse.cpp @@ -60,7 +60,7 @@ PROPERTY_SOURCE(Part::MultiFuse, Part::Feature) MultiFuse::MultiFuse(void) { - ADD_PROPERTY(Shapes,(0)); + ADD_PROPERTY(Shapes,(nullptr)); Shapes.setSize(0); ADD_PROPERTY_TYPE(History,(ShapeHistory()), "Boolean", (App::PropertyType) (App::Prop_Output|App::Prop_Transient|App::Prop_Hidden), "Shape history"); diff --git a/src/Mod/Part/App/FeatureRevolution.cpp b/src/Mod/Part/App/FeatureRevolution.cpp index 0b53c14a83..fd7848ad81 100644 --- a/src/Mod/Part/App/FeatureRevolution.cpp +++ b/src/Mod/Part/App/FeatureRevolution.cpp @@ -46,10 +46,10 @@ PROPERTY_SOURCE(Part::Revolution, Part::Feature) Revolution::Revolution() { - ADD_PROPERTY_TYPE(Source,(0), "Revolve", App::Prop_None, "Shape to revolve"); + ADD_PROPERTY_TYPE(Source,(nullptr), "Revolve", App::Prop_None, "Shape to revolve"); ADD_PROPERTY_TYPE(Base,(Base::Vector3d(0.0,0.0,0.0)), "Revolve", App::Prop_None, "Base point of revolution axis"); ADD_PROPERTY_TYPE(Axis,(Base::Vector3d(0.0,0.0,1.0)), "Revolve", App::Prop_None, "Direction of revolution axis"); - ADD_PROPERTY_TYPE(AxisLink,(0),"Revolve",App::Prop_None,"Link to edge to use as revolution axis."); + ADD_PROPERTY_TYPE(AxisLink,(nullptr),"Revolve",App::Prop_None,"Link to edge to use as revolution axis."); ADD_PROPERTY_TYPE(Angle,(360.0), "Revolve", App::Prop_None, "Angle span of revolution. If angle is zero, and an arc is used for axis link, angle span of arc will be used."); Angle.setConstraints(&angleRangeU); ADD_PROPERTY_TYPE(Symmetric,(false),"Revolve",App::Prop_None,"Extend revolution symmetrically from the profile."); diff --git a/src/Mod/Part/App/Geom2d/ArcOfCircle2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfCircle2dPyImp.cpp index ffbe8b29fd..e9b4f41b81 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfCircle2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfCircle2dPyImp.cpp @@ -129,7 +129,7 @@ Py::Object ArcOfCircle2dPy::getCircle(void) const PyObject *ArcOfCircle2dPy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int ArcOfCircle2dPy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/Geom2d/ArcOfConic2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfConic2dPyImp.cpp index cd4f261ce4..05369bd790 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfConic2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfConic2dPyImp.cpp @@ -47,7 +47,7 @@ PyObject *ArcOfConic2dPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // never create such objects with the constructor PyErr_SetString(PyExc_RuntimeError, "You cannot create an instance of the abstract class 'ArcOfConic2d'."); - return 0; + return nullptr; } // constructor method @@ -113,7 +113,7 @@ void ArcOfConic2dPy::setYAxis(Py::Object arg) PyObject *ArcOfConic2dPy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int ArcOfConic2dPy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPyImp.cpp index 0e0d544b98..410e061cb8 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPyImp.cpp @@ -119,7 +119,7 @@ Py::Object ArcOfEllipse2dPy::getEllipse(void) const PyObject *ArcOfEllipse2dPy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int ArcOfEllipse2dPy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPyImp.cpp index 36bb0489ad..d0a7359e21 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPyImp.cpp @@ -120,7 +120,7 @@ Py::Object ArcOfHyperbola2dPy::getHyperbola(void) const PyObject *ArcOfHyperbola2dPy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int ArcOfHyperbola2dPy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/Geom2d/ArcOfParabola2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfParabola2dPyImp.cpp index 85cac69faa..03358862b2 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfParabola2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfParabola2dPyImp.cpp @@ -109,7 +109,7 @@ Py::Object ArcOfParabola2dPy::getParabola(void) const PyObject *ArcOfParabola2dPy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int ArcOfParabola2dPy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp b/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp index ad4e9dc098..48a3b60174 100644 --- a/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp @@ -78,7 +78,7 @@ int BSplineCurve2dPy::PyInit(PyObject* args, PyObject* /*kwd*/) PyObject* BSplineCurve2dPy::isRational(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); Standard_Boolean val = curve->IsRational(); @@ -88,7 +88,7 @@ PyObject* BSplineCurve2dPy::isRational(PyObject *args) PyObject* BSplineCurve2dPy::isPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); Standard_Boolean val = curve->IsPeriodic(); @@ -98,7 +98,7 @@ PyObject* BSplineCurve2dPy::isPeriodic(PyObject *args) PyObject* BSplineCurve2dPy::isClosed(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); Standard_Boolean val = curve->IsClosed(); @@ -109,7 +109,7 @@ PyObject* BSplineCurve2dPy::increaseDegree(PyObject * args) { int degree; if (!PyArg_ParseTuple(args, "i", °ree)) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -118,7 +118,7 @@ PyObject* BSplineCurve2dPy::increaseDegree(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -127,7 +127,7 @@ PyObject* BSplineCurve2dPy::increaseMultiplicity(PyObject * args) int mult=-1; int start, end; if (!PyArg_ParseTuple(args, "ii|i", &start, &end, &mult)) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast @@ -144,7 +144,7 @@ PyObject* BSplineCurve2dPy::increaseMultiplicity(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -152,7 +152,7 @@ PyObject* BSplineCurve2dPy::incrementMultiplicity(PyObject * args) { int start, end, mult; if (!PyArg_ParseTuple(args, "iii", &start, &end, &mult)) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast @@ -161,7 +161,7 @@ PyObject* BSplineCurve2dPy::incrementMultiplicity(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -172,7 +172,7 @@ PyObject* BSplineCurve2dPy::insertKnot(PyObject * args) double U, tol = 0.0; int M=1; if (!PyArg_ParseTuple(args, "d|idO!", &U, &M, &tol)) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast @@ -181,7 +181,7 @@ PyObject* BSplineCurve2dPy::insertKnot(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -196,7 +196,7 @@ PyObject* BSplineCurve2dPy::insertKnots(PyObject * args) if (!PyArg_ParseTuple(args, "OO|dO!", &obj1, &obj2, &tol, &PyBool_Type, &add)) - return 0; + return nullptr; try { Py::Sequence knots(obj1); @@ -221,7 +221,7 @@ PyObject* BSplineCurve2dPy::insertKnots(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -232,7 +232,7 @@ PyObject* BSplineCurve2dPy::removeKnot(PyObject * args) double tol; int Index,M; if (!PyArg_ParseTuple(args, "iid", &Index, &M, &tol)) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast @@ -242,7 +242,7 @@ PyObject* BSplineCurve2dPy::removeKnot(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -250,7 +250,7 @@ PyObject* BSplineCurve2dPy::segment(PyObject * args) { double u1,u2; if (!PyArg_ParseTuple(args, "dd", &u1,&u2)) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -259,7 +259,7 @@ PyObject* BSplineCurve2dPy::segment(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -268,7 +268,7 @@ PyObject* BSplineCurve2dPy::setKnot(PyObject * args) int Index, M=-1; double K; if (!PyArg_ParseTuple(args, "id|i", &Index, &K, &M)) - return 0; + return nullptr; Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -286,7 +286,7 @@ PyObject* BSplineCurve2dPy::getKnot(PyObject * args) { int Index; if (!PyArg_ParseTuple(args, "i", &Index)) - return 0; + return nullptr; Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -299,7 +299,7 @@ PyObject* BSplineCurve2dPy::setKnots(PyObject * args) { PyObject* obj; if (!PyArg_ParseTuple(args, "O", &obj)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColStd_Array1OfReal k(1,list.size()); @@ -316,14 +316,14 @@ PyObject* BSplineCurve2dPy::setKnots(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurve2dPy::getKnots(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -337,7 +337,7 @@ PyObject* BSplineCurve2dPy::getKnots(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -347,7 +347,7 @@ PyObject* BSplineCurve2dPy::setPole(PyObject * args) double weight=-1.0; PyObject* p; if (!PyArg_ParseTuple(args, "iO!|d", &index, Base::Vector2dPy::type_object(), &p, &weight)) - return 0; + return nullptr; Base::Vector2d vec = Py::toVector2d(p); gp_Pnt2d pnt(vec.x, vec.y); try { @@ -361,7 +361,7 @@ PyObject* BSplineCurve2dPy::setPole(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -369,7 +369,7 @@ PyObject* BSplineCurve2dPy::getPole(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -380,14 +380,14 @@ PyObject* BSplineCurve2dPy::getPole(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurve2dPy::getPoles(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -403,14 +403,14 @@ PyObject* BSplineCurve2dPy::getPoles(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurve2dPy::getPolesAndWeights(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -433,7 +433,7 @@ PyObject* BSplineCurve2dPy::getPolesAndWeights(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -442,7 +442,7 @@ PyObject* BSplineCurve2dPy::setWeight(PyObject * args) int index; double weight; if (!PyArg_ParseTuple(args, "id", &index,&weight)) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -451,7 +451,7 @@ PyObject* BSplineCurve2dPy::setWeight(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -459,7 +459,7 @@ PyObject* BSplineCurve2dPy::getWeight(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -470,14 +470,14 @@ PyObject* BSplineCurve2dPy::getWeight(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurve2dPy::getWeights(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -491,7 +491,7 @@ PyObject* BSplineCurve2dPy::getWeights(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -499,7 +499,7 @@ PyObject* BSplineCurve2dPy::getResolution(PyObject * args) { double tol; if (!PyArg_ParseTuple(args, "d", &tol)) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -509,7 +509,7 @@ PyObject* BSplineCurve2dPy::getResolution(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -519,7 +519,7 @@ PyObject* BSplineCurve2dPy::movePoint(PyObject * args) int index1, index2; PyObject* pnt; if (!PyArg_ParseTuple(args, "dO!ii", &U, Base::Vector2dPy::type_object(),&pnt, &index1, &index2)) - return 0; + return nullptr; try { Base::Vector2d p = Py::toVector2d(pnt); Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast @@ -530,14 +530,14 @@ PyObject* BSplineCurve2dPy::movePoint(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurve2dPy::setNotPeriodic(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -546,14 +546,14 @@ PyObject* BSplineCurve2dPy::setNotPeriodic(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurve2dPy::setPeriodic(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -562,7 +562,7 @@ PyObject* BSplineCurve2dPy::setPeriodic(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -570,7 +570,7 @@ PyObject* BSplineCurve2dPy::setOrigin(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -579,7 +579,7 @@ PyObject* BSplineCurve2dPy::setOrigin(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -587,7 +587,7 @@ PyObject* BSplineCurve2dPy::getMultiplicity(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -597,14 +597,14 @@ PyObject* BSplineCurve2dPy::getMultiplicity(PyObject * args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurve2dPy::getMultiplicities(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -618,7 +618,7 @@ PyObject* BSplineCurve2dPy::getMultiplicities(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -708,7 +708,7 @@ PyObject* BSplineCurve2dPy::toBiArcs(PyObject * args) { double tolerance = 0.001; if (!PyArg_ParseTuple(args, "d", &tolerance)) - return 0; + return nullptr; try { Geom2dBSplineCurve* curve = getGeom2dBSplineCurvePtr(); std::list arcs; @@ -724,7 +724,7 @@ PyObject* BSplineCurve2dPy::toBiArcs(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -736,20 +736,20 @@ PyObject* BSplineCurve2dPy::approximate(PyObject *args, PyObject *kwds) char* continuity = "C2"; double tol3d = 1e-3; char* parType = "ChordLength"; - PyObject* par = 0; + PyObject* par = nullptr; double weight1 = 0; double weight2 = 0; double weight3 = 0; static char* kwds_interp[] = {"Points", "DegMax", "Continuity", "Tolerance", "DegMin", "ParamType", "Parameters", - "LengthWeight", "CurvatureWeight", "TorsionWeight", NULL}; + "LengthWeight", "CurvatureWeight", "TorsionWeight", nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|isdisOddd",kwds_interp, &obj, °Max, &continuity, &tol3d, °Min, &parType, &par, &weight1, &weight2, &weight3)) - return 0; + return nullptr; try { Py::Sequence list(obj); @@ -797,7 +797,7 @@ PyObject* BSplineCurve2dPy::approximate(PyObject *args, PyObject *kwds) } else { Standard_Failure::Raise("Smoothing approximation failed"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } @@ -818,7 +818,7 @@ PyObject* BSplineCurve2dPy::approximate(PyObject *args, PyObject *kwds) } else { Standard_Failure::Raise("Approximation with parameters failed"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } @@ -839,12 +839,12 @@ PyObject* BSplineCurve2dPy::approximate(PyObject *args, PyObject *kwds) } else { Standard_Failure::Raise("failed to approximate points"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -854,7 +854,7 @@ PyObject* BSplineCurve2dPy::getCardinalSplineTangents(PyObject *args, PyObject * PyObject* tgs; double parameter; - static char* kwds_interp1[] = {"Points", "Parameter", NULL}; + static char* kwds_interp1[] = {"Points", "Parameter", nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "Od",kwds_interp1, &pts, ¶meter)) { Py::Sequence list(pts); std::vector interpPoints; @@ -876,7 +876,7 @@ PyObject* BSplineCurve2dPy::getCardinalSplineTangents(PyObject *args, PyObject * } PyErr_Clear(); - static char* kwds_interp2[] = {"Points", "Parameters", NULL}; + static char* kwds_interp2[] = {"Points", "Parameters", nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "OO",kwds_interp2, &pts, &tgs)) { Py::Sequence list(pts); std::vector interpPoints; @@ -911,21 +911,21 @@ PyObject* BSplineCurve2dPy::getCardinalSplineTangents(PyObject *args, PyObject * PyObject* BSplineCurve2dPy::interpolate(PyObject *args, PyObject *kwds) { PyObject* obj; - PyObject* par = 0; + PyObject* par = nullptr; double tol3d = Precision::Approximation(); PyObject* periodic = Py_False; - PyObject* t1 = 0; PyObject* t2 = 0; - PyObject* ts = 0; PyObject* fl = 0; + PyObject* t1 = nullptr; PyObject* t2 = nullptr; + PyObject* ts = nullptr; PyObject* fl = nullptr; static char* kwds_interp[] = {"Points", "PeriodicFlag", "Tolerance", "InitialTangent", "FinalTangent", - "Tangents", "TangentFlags", "Parameters", NULL}; + "Tangents", "TangentFlags", "Parameters", nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O!dO!O!OOO",kwds_interp, &obj, &PyBool_Type, &periodic, &tol3d, Base::Vector2dPy::type_object(), &t1, Base::Vector2dPy::type_object(), &t2, &ts, &fl, &par)) - return 0; + return nullptr; try { Py::Sequence list(obj); @@ -995,14 +995,14 @@ PyObject* BSplineCurve2dPy::interpolate(PyObject *args, PyObject *kwds) } else { Standard_Failure::Raise("failed to interpolate points"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } catch (Standard_Failure& e) { std::string err = e.GetMessageString(); if (err.empty()) err = e.DynamicType()->Name(); PyErr_SetString(PartExceptionOCCError, err.c_str()); - return 0; + return nullptr; } } @@ -1013,7 +1013,7 @@ PyObject* BSplineCurve2dPy::buildFromPoles(PyObject *args) PyObject* periodic = Py_False; PyObject* interpolate = Py_False; if (!PyArg_ParseTuple(args, "O|O!iO!",&obj, &PyBool_Type, &periodic, °ree, &PyBool_Type, interpolate)) - return 0; + return nullptr; try { Py::Sequence list(obj); TColgp_Array1OfPnt2d poles(1, list.size()); @@ -1053,7 +1053,7 @@ PyObject* BSplineCurve2dPy::buildFromPoles(PyObject *args) } else { Standard_Failure::Raise("failed to create spline"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } else { @@ -1073,19 +1073,19 @@ PyObject* BSplineCurve2dPy::buildFromPoles(PyObject *args) } else { Standard_Failure::Raise("failed to create spline"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BSplineCurve2dPy::buildFromPolesMultsKnots(PyObject *args, PyObject *keywds) { - static char *kwlist[] = {"poles", "mults", "knots", "periodic", "degree", "weights", NULL}; + static char *kwlist[] = {"poles", "mults", "knots", "periodic", "degree", "weights", nullptr}; PyObject* periodic = Py_False; PyObject* poles = Py_None; PyObject* mults = Py_None; @@ -1099,7 +1099,7 @@ PyObject* BSplineCurve2dPy::buildFromPolesMultsKnots(PyObject *args, PyObject *k &poles, &mults, &knots, &PyBool_Type, &periodic, °ree, &weights)) - return 0; + return nullptr; try { // poles have to be present Py::Sequence list(poles); @@ -1107,7 +1107,7 @@ PyObject* BSplineCurve2dPy::buildFromPolesMultsKnots(PyObject *args, PyObject *k number_of_poles = list.size(); if ((number_of_poles) < 2) { Standard_Failure::Raise("need two or more poles"); - return 0; + return nullptr; } TColgp_Array1OfPnt2d occpoles(1, number_of_poles); Standard_Integer index = 1; @@ -1120,7 +1120,7 @@ PyObject* BSplineCurve2dPy::buildFromPolesMultsKnots(PyObject *args, PyObject *k number_of_knots = PyObject_Length(mults); if (PyObject_Length(knots) != number_of_knots) { Standard_Failure::Raise("number of knots and mults mismatch"); - return 0; + return nullptr; } } else { @@ -1182,7 +1182,7 @@ PyObject* BSplineCurve2dPy::buildFromPolesMultsKnots(PyObject *args, PyObject *k if (weights != Py_None) { //weights are given if (PyObject_Length(weights) != number_of_poles) { Standard_Failure::Raise("number of poles and weights mismatch"); - return 0; + return nullptr; } //complain about mismatch Py::Sequence weightssq(weights); Standard_Integer index = 1; @@ -1200,7 +1200,7 @@ PyObject* BSplineCurve2dPy::buildFromPolesMultsKnots(PyObject *args, PyObject *k if ((PyObject_IsTrue(periodic) && sum_of_mults != number_of_poles) || (PyObject_Not(periodic) && sum_of_mults - degree -1 != number_of_poles)) { Standard_Failure::Raise("number of poles and sum of mults mismatch"); - return(0); + return(nullptr); } Handle(Geom2d_BSplineCurve) spline = new Geom2d_BSplineCurve(occpoles,occweights,occknots,occmults,degree, @@ -1211,20 +1211,20 @@ PyObject* BSplineCurve2dPy::buildFromPolesMultsKnots(PyObject *args, PyObject *k } else { Standard_Failure::Raise("failed to create spline"); - return 0; // goes to the catch block + return nullptr; // goes to the catch block } } catch (const Standard_Failure& e) { Standard_CString msg = e.GetMessageString(); PyErr_SetString(PartExceptionOCCError, msg ? msg : ""); - return 0; + return nullptr; } } PyObject* BSplineCurve2dPy::toBezier(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom2d_BSplineCurve) spline = Handle(Geom2d_BSplineCurve)::DownCast (this->getGeom2dBSplineCurvePtr()->handle()); @@ -1244,7 +1244,7 @@ PyObject* BSplineCurve2dPy::join(PyObject *args) { PyObject* c; if (!PyArg_ParseTuple(args, "O!", &BSplineCurve2dPy::Type, &c)) - return 0; + return nullptr; Geom2dBSplineCurve* curve1 = this->getGeom2dBSplineCurvePtr(); BSplineCurve2dPy* curve2 = static_cast(c); @@ -1260,7 +1260,7 @@ PyObject* BSplineCurve2dPy::makeC1Continuous(PyObject *args) { double tol = Precision::Approximation(); if (!PyArg_ParseTuple(args, "|d", &tol)) - return 0; + return nullptr; try { Geom2dBSplineCurve* spline = this->getGeom2dBSplineCurvePtr(); @@ -1271,13 +1271,13 @@ PyObject* BSplineCurve2dPy::makeC1Continuous(PyObject *args) std::string err = e.GetMessageString(); if (err.empty()) err = e.DynamicType()->Name(); PyErr_SetString(PartExceptionOCCError, err.c_str()); - return 0; + return nullptr; } } PyObject* BSplineCurve2dPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int BSplineCurve2dPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/Geom2d/BezierCurve2dPyImp.cpp b/src/Mod/Part/App/Geom2d/BezierCurve2dPyImp.cpp index a1a22a9867..a9b410c597 100644 --- a/src/Mod/Part/App/Geom2d/BezierCurve2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/BezierCurve2dPyImp.cpp @@ -59,7 +59,7 @@ int BezierCurve2dPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/) PyObject* BezierCurve2dPy::isRational(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast (getGeometry2dPtr()->handle()); Standard_Boolean val = curve->IsRational(); @@ -69,7 +69,7 @@ PyObject* BezierCurve2dPy::isRational(PyObject *args) PyObject* BezierCurve2dPy::isPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast (getGeometry2dPtr()->handle()); Standard_Boolean val = curve->IsPeriodic(); @@ -79,7 +79,7 @@ PyObject* BezierCurve2dPy::isPeriodic(PyObject *args) PyObject* BezierCurve2dPy::isClosed(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast (getGeometry2dPtr()->handle()); Standard_Boolean val = curve->IsClosed(); @@ -90,7 +90,7 @@ PyObject* BezierCurve2dPy::increase(PyObject * args) { int degree; if (!PyArg_ParseTuple(args, "i", °ree)) - return 0; + return nullptr; Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast (getGeometry2dPtr()->handle()); curve->Increase(degree); @@ -103,7 +103,7 @@ PyObject* BezierCurve2dPy::insertPoleAfter(PyObject * args) double weight=1.0; PyObject* p; if (!PyArg_ParseTuple(args, "iO!|d", &index, Base::Vector2dPy::type_object(), &p, &weight)) - return 0; + return nullptr; Base::Vector2d vec = Py::toVector2d(p); gp_Pnt2d pnt(vec.x, vec.y); try { @@ -114,7 +114,7 @@ PyObject* BezierCurve2dPy::insertPoleAfter(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -124,7 +124,7 @@ PyObject* BezierCurve2dPy::insertPoleBefore(PyObject * args) double weight=1.0; PyObject* p; if (!PyArg_ParseTuple(args, "iO!|d", &index, Base::Vector2dPy::type_object(), &p, &weight)) - return 0; + return nullptr; Base::Vector2d vec = Py::toVector2d(p); gp_Pnt2d pnt(vec.x, vec.y); try { @@ -135,7 +135,7 @@ PyObject* BezierCurve2dPy::insertPoleBefore(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -143,7 +143,7 @@ PyObject* BezierCurve2dPy::removePole(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -152,7 +152,7 @@ PyObject* BezierCurve2dPy::removePole(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -160,7 +160,7 @@ PyObject* BezierCurve2dPy::segment(PyObject * args) { double u1,u2; if (!PyArg_ParseTuple(args, "dd", &u1,&u2)) - return 0; + return nullptr; try { Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -169,7 +169,7 @@ PyObject* BezierCurve2dPy::segment(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -179,7 +179,7 @@ PyObject* BezierCurve2dPy::setPole(PyObject * args) double weight=-1.0; PyObject* p; if (!PyArg_ParseTuple(args, "iO!|d", &index, Base::Vector2dPy::type_object(), &p, &weight)) - return 0; + return nullptr; Base::Vector2d vec = Py::toVector2d(p); gp_Pnt2d pnt(vec.x, vec.y); try { @@ -193,7 +193,7 @@ PyObject* BezierCurve2dPy::setPole(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -201,7 +201,7 @@ PyObject* BezierCurve2dPy::getPole(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -212,14 +212,14 @@ PyObject* BezierCurve2dPy::getPole(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BezierCurve2dPy::getPoles(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -235,7 +235,7 @@ PyObject* BezierCurve2dPy::getPoles(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -243,7 +243,7 @@ PyObject* BezierCurve2dPy::setPoles(PyObject * args) { PyObject* plist; if (!PyArg_ParseTuple(args, "O", &plist)) - return 0; + return nullptr; try { Py::Sequence list(plist); TColgp_Array1OfPnt2d poles(1,list.size()); @@ -259,7 +259,7 @@ PyObject* BezierCurve2dPy::setPoles(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -268,7 +268,7 @@ PyObject* BezierCurve2dPy::setWeight(PyObject * args) int index; double weight; if (!PyArg_ParseTuple(args, "id", &index,&weight)) - return 0; + return nullptr; try { Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -277,7 +277,7 @@ PyObject* BezierCurve2dPy::setWeight(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -285,7 +285,7 @@ PyObject* BezierCurve2dPy::getWeight(PyObject * args) { int index; if (!PyArg_ParseTuple(args, "i", &index)) - return 0; + return nullptr; try { Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -296,14 +296,14 @@ PyObject* BezierCurve2dPy::getWeight(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* BezierCurve2dPy::getWeights(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -317,7 +317,7 @@ PyObject* BezierCurve2dPy::getWeights(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -325,7 +325,7 @@ PyObject* BezierCurve2dPy::getResolution(PyObject* args) { double tol; if (!PyArg_ParseTuple(args, "d", &tol)) - return 0; + return nullptr; try { Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast (getGeometry2dPtr()->handle()); @@ -335,7 +335,7 @@ PyObject* BezierCurve2dPy::getResolution(PyObject* args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } Py::Long BezierCurve2dPy::getDegree(void) const @@ -377,7 +377,7 @@ Py::Object BezierCurve2dPy::getEndPoint(void) const PyObject *BezierCurve2dPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int BezierCurve2dPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/Geom2d/Circle2dPyImp.cpp b/src/Mod/Part/App/Geom2d/Circle2dPyImp.cpp index 7cfe844075..75b9a6268d 100644 --- a/src/Mod/Part/App/Geom2d/Circle2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Circle2dPyImp.cpp @@ -56,7 +56,7 @@ int Circle2dPy::PyInit(PyObject* args, PyObject* kwds) // circle and distance for offset PyObject *pCirc; double dist; - static char* keywords_cd[] = {"Circle","Distance",NULL}; + static char* keywords_cd[] = {"Circle","Distance",nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!d", keywords_cd, &(Circle2dPy::Type), &pCirc, &dist)) { Circle2dPy* pcCircle = static_cast(pCirc); Handle(Geom2d_Circle) circle = Handle(Geom2d_Circle)::DownCast @@ -74,7 +74,7 @@ int Circle2dPy::PyInit(PyObject* args, PyObject* kwds) // center and radius PyObject *pV1, *pV2, *pV3; - static char* keywords_cnr[] = {"Center","Radius",NULL}; + static char* keywords_cnr[] = {"Center","Radius",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!d", keywords_cnr, Base::Vector2dPy::type_object(), &pV1, @@ -91,7 +91,7 @@ int Circle2dPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - static char* keywords_c[] = {"Circle",NULL}; + static char* keywords_c[] = {"Circle",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", keywords_c, &(Circle2dPy::Type), &pCirc)) { Circle2dPy* pcCircle = static_cast(pCirc); @@ -103,7 +103,7 @@ int Circle2dPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - static char* keywords_ppp[] = {"Point1","Point2","Point3",NULL}; + static char* keywords_ppp[] = {"Point1","Point2","Point3",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!", keywords_ppp, Base::Vector2dPy::type_object(), &pV1, @@ -126,7 +126,7 @@ int Circle2dPy::PyInit(PyObject* args, PyObject* kwds) } // default circle - static char* keywords_n[] = {NULL}; + static char* keywords_n[] = {nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "", keywords_n)) { Handle(Geom2d_Circle) circle = Handle(Geom2d_Circle)::DownCast(getGeom2dCirclePtr()->handle()); @@ -175,7 +175,7 @@ void Circle2dPy::setRadius(Py::Float arg) PyObject *Circle2dPy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int Circle2dPy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/Geom2d/Conic2dPyImp.cpp b/src/Mod/Part/App/Geom2d/Conic2dPyImp.cpp index 3615865b05..74b51def6b 100644 --- a/src/Mod/Part/App/Geom2d/Conic2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Conic2dPyImp.cpp @@ -45,7 +45,7 @@ PyObject *Conic2dPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Py // never create such objects with the constructor PyErr_SetString(PyExc_RuntimeError, "You cannot create an instance of the abstract class 'Conic2d'."); - return 0; + return nullptr; } // constructor method @@ -106,7 +106,7 @@ void Conic2dPy::setYAxis(Py::Object arg) PyObject *Conic2dPy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int Conic2dPy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/Geom2d/Curve2dPyImp.cpp b/src/Mod/Part/App/Geom2d/Curve2dPyImp.cpp index c64aa88ec2..5e20dd77b5 100644 --- a/src/Mod/Part/App/Geom2d/Curve2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Curve2dPyImp.cpp @@ -89,7 +89,7 @@ PyObject *Curve2dPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Py // never create such objects with the constructor PyErr_SetString(PyExc_RuntimeError, "You cannot create an instance of the abstract class 'Curve2d'."); - return 0; + return nullptr; } // constructor method @@ -108,11 +108,11 @@ PyObject* Curve2dPy::reverse(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } - return 0; + return nullptr; } namespace Part { @@ -187,7 +187,7 @@ PyObject* Curve2dPy::toShape(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -203,7 +203,7 @@ PyObject* Curve2dPy::toShape(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -223,7 +223,7 @@ PyObject* Curve2dPy::toShape(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -243,7 +243,7 @@ PyObject* Curve2dPy::toShape(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -262,7 +262,7 @@ PyObject* Curve2dPy::toShape(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -281,12 +281,12 @@ PyObject* Curve2dPy::toShape(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyErr_SetString(PyExc_TypeError, "empty parameter list, parameter range or surface expected"); - return 0; + return nullptr; } PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds) @@ -296,7 +296,7 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds) Handle(Geom2d_Curve) c = Handle(Geom2d_Curve)::DownCast(g); if (c.IsNull()) { PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } Geom2dAdaptor_Curve adapt(c); @@ -304,7 +304,7 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds) double last = adapt.LastParameter(); // use Number kwds - static char* kwds_numPoints[] = {"Number","First","Last",NULL}; + static char* kwds_numPoints[] = {"Number","First","Last",nullptr}; PyErr_Clear(); int numPoints = -1; if (PyArg_ParseTupleAndKeywords(args, kwds, "i|dd", kwds_numPoints, &numPoints, &first, &last)) { @@ -324,12 +324,12 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed"); - return 0; + return nullptr; } } // use Distance kwds - static char* kwds_Distance[] = {"Distance","First","Last",NULL}; + static char* kwds_Distance[] = {"Distance","First","Last",nullptr}; PyErr_Clear(); double distance = -1; if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_Distance, &distance, &first, &last)) { @@ -349,12 +349,12 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed"); - return 0; + return nullptr; } } // use Deflection kwds - static char* kwds_Deflection[] = {"Deflection","First","Last",NULL}; + static char* kwds_Deflection[] = {"Deflection","First","Last",nullptr}; PyErr_Clear(); double deflection; if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_Deflection, &deflection, &first, &last)) { @@ -372,12 +372,12 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed"); - return 0; + return nullptr; } } // use TangentialDeflection kwds - static char* kwds_TangentialDeflection[] = {"Angular","Curvature","First","Last","Minimum",NULL}; + static char* kwds_TangentialDeflection[] = {"Angular","Curvature","First","Last","Minimum",nullptr}; PyErr_Clear(); double angular; double curvature; @@ -397,12 +397,12 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed"); - return 0; + return nullptr; } } // use QuasiNumber kwds - static char* kwds_QuasiNumPoints[] = {"QuasiNumber","First","Last",NULL}; + static char* kwds_QuasiNumPoints[] = {"QuasiNumber","First","Last",nullptr}; PyErr_Clear(); int quasiNumPoints; if (PyArg_ParseTupleAndKeywords(args, kwds, "i|dd", kwds_QuasiNumPoints, &quasiNumPoints, &first, &last)) { @@ -420,12 +420,12 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed"); - return 0; + return nullptr; } } // use QuasiDeflection kwds - static char* kwds_QuasiDeflection[] = {"QuasiDeflection","First","Last",NULL}; + static char* kwds_QuasiDeflection[] = {"QuasiDeflection","First","Last",nullptr}; PyErr_Clear(); double quasiDeflection; if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_QuasiDeflection, &quasiDeflection, &first, &last)) { @@ -442,17 +442,17 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed"); - return 0; + return nullptr; } } } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError,"Wrong arguments"); - return 0; + return nullptr; } PyObject* Curve2dPy::length(PyObject *args) @@ -465,7 +465,7 @@ PyObject* Curve2dPy::length(PyObject *args) double v=c->LastParameter(); double t=Precision::Confusion(); if (!PyArg_ParseTuple(args, "|ddd", &u,&v,&t)) - return 0; + return nullptr; Geom2dAdaptor_Curve adapt(c); double len = GCPnts_AbscissaPoint::Length(adapt,u,v,t); return PyFloat_FromDouble(len); @@ -473,11 +473,11 @@ PyObject* Curve2dPy::length(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* Curve2dPy::parameterAtDistance(PyObject *args) @@ -489,7 +489,7 @@ PyObject* Curve2dPy::parameterAtDistance(PyObject *args) double abscissa; double u = 0; if (!PyArg_ParseTuple(args, "d|d", &abscissa,&u)) - return 0; + return nullptr; Geom2dAdaptor_Curve adapt(c); GCPnts_AbscissaPoint abscissaPoint(adapt,abscissa,u); double parm = abscissaPoint.Parameter(); @@ -498,11 +498,11 @@ PyObject* Curve2dPy::parameterAtDistance(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* Curve2dPy::value(PyObject *args) @@ -513,18 +513,18 @@ PyObject* Curve2dPy::value(PyObject *args) if (!c.IsNull()) { double u; if (!PyArg_ParseTuple(args, "d", &u)) - return 0; + return nullptr; gp_Pnt2d p = c->Value(u); return Py::new_reference_to(Base::Vector2dPy::create(p.X(), p.Y())); } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* Curve2dPy::tangent(PyObject *args) @@ -535,7 +535,7 @@ PyObject* Curve2dPy::tangent(PyObject *args) if (!c.IsNull()) { double u; if (!PyArg_ParseTuple(args, "d", &u)) - return 0; + return nullptr; gp_Dir2d dir; Geom2dLProp_CLProps2d prop(c,u,2,Precision::Confusion()); if (prop.IsTangentDefined()) { @@ -547,11 +547,11 @@ PyObject* Curve2dPy::tangent(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* Curve2dPy::normal(PyObject *args) @@ -562,7 +562,7 @@ PyObject* Curve2dPy::normal(PyObject *args) if (!c.IsNull()) { double u; if (!PyArg_ParseTuple(args, "d", &u)) - return 0; + return nullptr; gp_Dir2d dir; Geom2dLProp_CLProps2d prop(c,u,2,Precision::Confusion()); prop.Normal(dir); @@ -572,11 +572,11 @@ PyObject* Curve2dPy::normal(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* Curve2dPy::curvature(PyObject *args) @@ -587,7 +587,7 @@ PyObject* Curve2dPy::curvature(PyObject *args) if (!c.IsNull()) { double u; if (!PyArg_ParseTuple(args, "d", &u)) - return 0; + return nullptr; Geom2dLProp_CLProps2d prop(c,u,2,Precision::Confusion()); double C = prop.Curvature(); return Py::new_reference_to(Py::Float(C)); @@ -595,11 +595,11 @@ PyObject* Curve2dPy::curvature(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* Curve2dPy::centerOfCurvature(PyObject *args) @@ -610,7 +610,7 @@ PyObject* Curve2dPy::centerOfCurvature(PyObject *args) if (!c.IsNull()) { double u; if (!PyArg_ParseTuple(args, "d", &u)) - return 0; + return nullptr; Geom2dLProp_CLProps2d prop(c,u,2,Precision::Confusion()); gp_Pnt2d pnt ; prop.CentreOfCurvature(pnt); @@ -620,11 +620,11 @@ PyObject* Curve2dPy::centerOfCurvature(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* Curve2dPy::parameter(PyObject *args) @@ -635,7 +635,7 @@ PyObject* Curve2dPy::parameter(PyObject *args) if (!c.IsNull()) { PyObject *p; if (!PyArg_ParseTuple(args, "O!", Base::Vector2dPy::type_object(), &p)) - return 0; + return nullptr; Base::Vector2d v = Py::toVector2d(p); gp_Pnt2d pnt(v.x,v.y); Geom2dAPI_ProjectPointOnCurve ppc(pnt, c); @@ -646,11 +646,11 @@ PyObject* Curve2dPy::parameter(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* Curve2dPy::toBSpline(PyObject * args) @@ -663,7 +663,7 @@ PyObject* Curve2dPy::toBSpline(PyObject * args) u=c->FirstParameter(); v=c->LastParameter(); if (!PyArg_ParseTuple(args, "|dd", &u,&v)) - return 0; + return nullptr; ShapeConstruct_Curve scc; Handle(Geom2d_BSplineCurve) spline = scc.ConvertToBSpline(c, u, v, Precision::Confusion()); if (spline.IsNull()) @@ -673,11 +673,11 @@ PyObject* Curve2dPy::toBSpline(PyObject * args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* Curve2dPy::approximateBSpline(PyObject *args) @@ -686,7 +686,7 @@ PyObject* Curve2dPy::approximateBSpline(PyObject *args) int maxSegment, maxDegree; char* order = "C2"; if (!PyArg_ParseTuple(args, "dii|s", &tolerance, &maxSegment, &maxDegree, &order)) - return 0; + return nullptr; GeomAbs_Shape absShape; std::string str = order; @@ -717,16 +717,16 @@ PyObject* Curve2dPy::approximateBSpline(PyObject *args) std::stringstream str; str << "Maximum error (" << approx.MaxError() << ") is outside tolerance"; PyErr_SetString(PyExc_RuntimeError, str.str().c_str()); - return 0; + return nullptr; } else { PyErr_SetString(PyExc_RuntimeError, "Approximation of curve failed"); - return 0; + return nullptr; } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -790,7 +790,7 @@ Py::Float Curve2dPy::getLastParameter(void) const PyObject *Curve2dPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int Curve2dPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) @@ -806,7 +806,7 @@ PyObject* Curve2dPy::intersectCC(PyObject *args) PyObject *p; double prec = Precision::Confusion(); if (!PyArg_ParseTuple(args, "O!|d", &(Part::Curve2dPy::Type), &p, &prec)) - return 0; + return nullptr; Handle(Geom2d_Curve) curve2 = Handle(Geom2d_Curve)::DownCast(static_cast(p)->getGeometry2dPtr()->handle()); Py::List points; @@ -842,9 +842,9 @@ PyObject* Curve2dPy::intersectCC(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PyExc_TypeError, "Geometry is not a curve"); - return 0; + return nullptr; } diff --git a/src/Mod/Part/App/Geom2d/Ellipse2dPyImp.cpp b/src/Mod/Part/App/Geom2d/Ellipse2dPyImp.cpp index 9dd7033d63..8871a05c37 100644 --- a/src/Mod/Part/App/Geom2d/Ellipse2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Ellipse2dPyImp.cpp @@ -54,7 +54,7 @@ PyObject *Ellipse2dPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // // constructor method int Ellipse2dPy::PyInit(PyObject* args, PyObject* kwds) { - char* keywords_n[] = {NULL}; + char* keywords_n[] = {nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "", keywords_n)) { Handle(Geom2d_Ellipse) ellipse = Handle(Geom2d_Ellipse)::DownCast(getGeom2dEllipsePtr()->handle()); ellipse->SetMajorRadius(2.0); @@ -62,7 +62,7 @@ int Ellipse2dPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_e[] = {"Ellipse",NULL}; + char* keywords_e[] = {"Ellipse",nullptr}; PyErr_Clear(); PyObject *pElips; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!",keywords_e, &(Ellipse2dPy::Type), &pElips)) { @@ -75,7 +75,7 @@ int Ellipse2dPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_ssc[] = {"S1","S2","Center",NULL}; + char* keywords_ssc[] = {"S1","S2","Center",nullptr}; PyErr_Clear(); PyObject *pV1, *pV2, *pV3; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!", keywords_ssc, @@ -98,7 +98,7 @@ int Ellipse2dPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_cmm[] = {"Center","MajorRadius","MinorRadius",NULL}; + char* keywords_cmm[] = {"Center","MajorRadius","MinorRadius",nullptr}; PyErr_Clear(); PyObject *pV; double major, minor; @@ -172,7 +172,7 @@ Py::Object Ellipse2dPy::getFocus2(void) const PyObject *Ellipse2dPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int Ellipse2dPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/Geom2d/Geometry2dPyImp.cpp b/src/Mod/Part/App/Geom2d/Geometry2dPyImp.cpp index 5b65c03573..5b7c9523d1 100644 --- a/src/Mod/Part/App/Geom2d/Geometry2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Geometry2dPyImp.cpp @@ -63,7 +63,7 @@ PyObject *Geometry2dPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // // never create such objects with the constructor PyErr_SetString(PyExc_RuntimeError, "You cannot create an instance of the abstract class 'Geometry'."); - return 0; + return nullptr; } // constructor method @@ -94,7 +94,7 @@ PyObject* Geometry2dPy::mirror(PyObject *args) } PyErr_SetString(PartExceptionOCCError, "either a point (vector) or axis (vector, vector) must be given"); - return 0; + return nullptr; } PyObject* Geometry2dPy::rotate(PyObject *args) @@ -110,7 +110,7 @@ PyObject* Geometry2dPy::rotate(PyObject *args) } PyErr_SetString(PartExceptionOCCError, "Vector2d and float expected"); - return 0; + return nullptr; } PyObject* Geometry2dPy::scale(PyObject *args) @@ -126,14 +126,14 @@ PyObject* Geometry2dPy::scale(PyObject *args) } PyErr_SetString(PartExceptionOCCError, "Vector2d and float expected"); - return 0; + return nullptr; } PyObject* Geometry2dPy::transform(PyObject *args) { PyObject* o; if (!PyArg_ParseTuple(args, "O", &o)) - return 0; + return nullptr; Py::Sequence list(o); double a11 = static_cast(Py::Float(list.getItem(0))); double a12 = static_cast(Py::Float(list.getItem(1))); @@ -168,23 +168,23 @@ PyObject* Geometry2dPy::translate(PyObject *args) } PyErr_SetString(PartExceptionOCCError, "Vector2d expected"); - return 0; + return nullptr; } PyObject* Geometry2dPy::copy(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; Part::Geometry2d* geom = this->getGeometry2dPtr(); PyTypeObject* type = this->GetType(); - PyObject* cpy = 0; + PyObject* cpy = nullptr; // let the type object decide if (type->tp_new) - cpy = type->tp_new(type, this, 0); + cpy = type->tp_new(type, this, nullptr); if (!cpy) { PyErr_SetString(PyExc_TypeError, "failed to create copy of geometry"); - return 0; + return nullptr; } Part::Geometry2dPy* geompy = static_cast(cpy); @@ -200,7 +200,7 @@ PyObject* Geometry2dPy::copy(PyObject *args) PyObject *Geometry2dPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int Geometry2dPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/Geom2d/Hyperbola2dPyImp.cpp b/src/Mod/Part/App/Geom2d/Hyperbola2dPyImp.cpp index 067d682736..8781728da7 100644 --- a/src/Mod/Part/App/Geom2d/Hyperbola2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Hyperbola2dPyImp.cpp @@ -54,7 +54,7 @@ PyObject *Hyperbola2dPy::PyMake(struct _typeobject *, PyObject *, PyObject *) / // constructor method int Hyperbola2dPy::PyInit(PyObject* args, PyObject* kwds) { - char* keywords_n[] = {NULL}; + char* keywords_n[] = {nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "", keywords_n)) { Handle(Geom2d_Hyperbola) hyperbola = Handle(Geom2d_Hyperbola)::DownCast(getGeom2dHyperbolaPtr()->handle()); hyperbola->SetMajorRadius(2.0); @@ -62,7 +62,7 @@ int Hyperbola2dPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_e[] = {"Hyperbola",NULL}; + char* keywords_e[] = {"Hyperbola",nullptr}; PyErr_Clear(); PyObject *pHypr; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!",keywords_e, &(Hyperbola2dPy::Type), &pHypr)) { @@ -75,7 +75,7 @@ int Hyperbola2dPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_ssc[] = {"S1","S2","Center",NULL}; + char* keywords_ssc[] = {"S1","S2","Center",nullptr}; PyErr_Clear(); PyObject *pV1, *pV2, *pV3; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!", keywords_ssc, @@ -98,7 +98,7 @@ int Hyperbola2dPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_cmm[] = {"Center","MajorRadius","MinorRadius",NULL}; + char* keywords_cmm[] = {"Center","MajorRadius","MinorRadius",nullptr}; PyErr_Clear(); PyObject *pV; double major, minor; @@ -172,7 +172,7 @@ Py::Object Hyperbola2dPy::getFocus2(void) const PyObject *Hyperbola2dPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int Hyperbola2dPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/Geom2d/Line2dPyImp.cpp b/src/Mod/Part/App/Geom2d/Line2dPyImp.cpp index 47fc874f9e..974958785b 100644 --- a/src/Mod/Part/App/Geom2d/Line2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Line2dPyImp.cpp @@ -219,7 +219,7 @@ void Line2dPy::setDirection(Py::Object arg) PyObject *Line2dPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int Line2dPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp b/src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp index 11334584dd..3bf91f8ac9 100644 --- a/src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp @@ -180,7 +180,7 @@ PyObject* Line2dSegmentPy::setParameterRange(PyObject *args) { double first, last; if (!PyArg_ParseTuple(args, "dd", &first, &last)) - return NULL; + return nullptr; try { Handle(Geom2d_TrimmedCurve) this_curve = Handle(Geom2d_TrimmedCurve)::DownCast @@ -190,7 +190,7 @@ PyObject* Line2dSegmentPy::setParameterRange(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } Py_Return; @@ -306,7 +306,7 @@ void Line2dSegmentPy::setEndPoint(Py::Object arg) PyObject *Line2dSegmentPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int Line2dSegmentPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp b/src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp index 4f62ed64e5..75b0f3e514 100644 --- a/src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp @@ -129,7 +129,7 @@ void OffsetCurve2dPy::setBasisCurve(Py::Object arg) PyObject *OffsetCurve2dPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int OffsetCurve2dPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/Geom2d/Parabola2dPyImp.cpp b/src/Mod/Part/App/Geom2d/Parabola2dPyImp.cpp index e41443318c..98bd3e95df 100644 --- a/src/Mod/Part/App/Geom2d/Parabola2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Parabola2dPyImp.cpp @@ -87,7 +87,7 @@ Py::Float Parabola2dPy::getParameter(void) const PyObject *Parabola2dPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int Parabola2dPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp b/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp index d67e156aa2..0db2fab9b3 100644 --- a/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp +++ b/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp @@ -496,7 +496,7 @@ PyObject* BuildPlateSurfacePy::G2Error(PyObject *args) PyObject *BuildPlateSurfacePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int BuildPlateSurfacePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp b/src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp index b63227d537..3011e27405 100644 --- a/src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp +++ b/src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp @@ -411,7 +411,7 @@ Py::Float CurveConstraintPy::getLength(void) const PyObject *CurveConstraintPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int CurveConstraintPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp b/src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp index 66cdfb8753..0bc54b5467 100644 --- a/src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp +++ b/src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp @@ -249,7 +249,7 @@ PyObject* PointConstraintPy::pnt2dOnSurf(PyObject *args) PyObject *PointConstraintPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int PointConstraintPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index cab33def09..377c4afeaf 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -391,7 +391,7 @@ void Geometry::createNewTag() static bool seeded = false; if (!seeded) { - ran.seed(static_cast(std::time(0))); + ran.seed(static_cast(std::time(nullptr))); seeded = true; } static boost::uuids::basic_random_generator gen(&ran); @@ -5084,7 +5084,7 @@ GeomArcOfCircle *createFilletGeometry(const GeomLineSegment *lineSeg1, const Geo Base::Vector3d corner; if (!Part::find2DLinesIntersection(lineSeg1, lineSeg2, corner)) // Parallel Lines so return null pointer - return 0; + return nullptr; Base::Vector3d dir1 = lineSeg1->getEndPoint() - lineSeg1->getStartPoint(); Base::Vector3d dir2 = lineSeg2->getEndPoint() - lineSeg2->getStartPoint(); diff --git a/src/Mod/Part/App/Geometry2d.cpp b/src/Mod/Part/App/Geometry2d.cpp index 44cd52841f..f2985e23da 100644 --- a/src/Mod/Part/App/Geometry2d.cpp +++ b/src/Mod/Part/App/Geometry2d.cpp @@ -2296,7 +2296,7 @@ PyObject *Geom2dTrimmedCurve::getPyObject(void) } PyErr_SetString(PyExc_RuntimeError, "Unknown curve type"); - return 0; + return nullptr; } // ------------------------------------------------------------------ diff --git a/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp b/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp index 7d46390eac..5baba19195 100644 --- a/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp @@ -95,7 +95,7 @@ void GeometryBoolExtensionPy::setValue(Py::Boolean value) PyObject *GeometryBoolExtensionPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int GeometryBoolExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/GeometryCurvePyImp.cpp b/src/Mod/Part/App/GeometryCurvePyImp.cpp index 6cc12f6760..b9a581e269 100644 --- a/src/Mod/Part/App/GeometryCurvePyImp.cpp +++ b/src/Mod/Part/App/GeometryCurvePyImp.cpp @@ -94,7 +94,7 @@ PyObject *GeometryCurvePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // never create such objects with the constructor PyErr_SetString(PyExc_RuntimeError, "You cannot create an instance of the abstract class 'GeometryCurve'."); - return 0; + return nullptr; } // constructor method @@ -113,7 +113,7 @@ PyObject* GeometryCurvePy::toShape(PyObject *args) u=c->FirstParameter(); v=c->LastParameter(); if (!PyArg_ParseTuple(args, "|dd", &u,&v)) - return 0; + return nullptr; BRepBuilderAPI_MakeEdge mkBuilder(c, u, v); TopoDS_Shape sh = mkBuilder.Shape(); return new TopoShapeEdgePy(new TopoShape(sh)); @@ -121,11 +121,11 @@ PyObject* GeometryCurvePy::toShape(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds) @@ -135,7 +135,7 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds) Handle(Geom_Curve) c = Handle(Geom_Curve)::DownCast(g); if (c.IsNull()) { PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } GeomAdaptor_Curve adapt(c); @@ -159,19 +159,19 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PyExc_TypeError, "Either int or float expected"); - return 0; + return nullptr; } } else { // use Number kwds - static char* kwds_numPoints[] = {"Number","First","Last",NULL}; + static char* kwds_numPoints[] = {"Number","First","Last",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "i|dd", kwds_numPoints, &numPoints, &first, &last)) { uniformAbscissaPoints = true; } else { // use Abscissa kwds - static char* kwds_Distance[] = {"Distance","First","Last",NULL}; + static char* kwds_Distance[] = {"Distance","First","Last",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_Distance, &distance, &first, &last)) { uniformAbscissaDistance = true; @@ -198,12 +198,12 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed"); - return 0; + return nullptr; } } // use Deflection kwds - static char* kwds_Deflection[] = {"Deflection","First","Last",NULL}; + static char* kwds_Deflection[] = {"Deflection","First","Last",nullptr}; PyErr_Clear(); double deflection; if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_Deflection, &deflection, &first, &last)) { @@ -220,12 +220,12 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed"); - return 0; + return nullptr; } } // use TangentialDeflection kwds - static char* kwds_TangentialDeflection[] = {"Angular","Curvature","First","Last","Minimum",NULL}; + static char* kwds_TangentialDeflection[] = {"Angular","Curvature","First","Last","Minimum",nullptr}; PyErr_Clear(); double angular; double curvature; @@ -244,12 +244,12 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed"); - return 0; + return nullptr; } } // use QuasiNumber kwds - static char* kwds_QuasiNumPoints[] = {"QuasiNumber","First","Last",NULL}; + static char* kwds_QuasiNumPoints[] = {"QuasiNumber","First","Last",nullptr}; PyErr_Clear(); int quasiNumPoints; if (PyArg_ParseTupleAndKeywords(args, kwds, "i|dd", kwds_QuasiNumPoints, &quasiNumPoints, &first, &last)) { @@ -266,12 +266,12 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed"); - return 0; + return nullptr; } } // use QuasiDeflection kwds - static char* kwds_QuasiDeflection[] = {"QuasiDeflection","First","Last",NULL}; + static char* kwds_QuasiDeflection[] = {"QuasiDeflection","First","Last",nullptr}; PyErr_Clear(); double quasiDeflection; if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_QuasiDeflection, &quasiDeflection, &first, &last)) { @@ -288,17 +288,17 @@ PyObject* GeometryCurvePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed"); - return 0; + return nullptr; } } } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError,"Wrong arguments"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::length(PyObject *args) @@ -311,7 +311,7 @@ PyObject* GeometryCurvePy::length(PyObject *args) double v=c->LastParameter(); double t=Precision::Confusion(); if (!PyArg_ParseTuple(args, "|ddd", &u,&v,&t)) - return 0; + return nullptr; GeomAdaptor_Curve adapt(c); double len = GCPnts_AbscissaPoint::Length(adapt,u,v,t); return PyFloat_FromDouble(len); @@ -319,11 +319,11 @@ PyObject* GeometryCurvePy::length(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::parameterAtDistance(PyObject *args) @@ -335,7 +335,7 @@ PyObject* GeometryCurvePy::parameterAtDistance(PyObject *args) double abscissa; double u = 0; if (!PyArg_ParseTuple(args, "d|d", &abscissa,&u)) - return 0; + return nullptr; GeomAdaptor_Curve adapt(c); GCPnts_AbscissaPoint abscissaPoint(adapt,abscissa,u); double parm = abscissaPoint.Parameter(); @@ -344,11 +344,11 @@ PyObject* GeometryCurvePy::parameterAtDistance(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::getD0(PyObject *args) @@ -489,18 +489,18 @@ PyObject* GeometryCurvePy::value(PyObject *args) if (!c.IsNull()) { double u; if (!PyArg_ParseTuple(args, "d", &u)) - return 0; + return nullptr; gp_Pnt p = c->Value(u); return new Base::VectorPy(Base::Vector3d(p.X(),p.Y(),p.Z())); } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::tangent(PyObject *args) @@ -511,7 +511,7 @@ PyObject* GeometryCurvePy::tangent(PyObject *args) if (!c.IsNull()) { double u; if (!PyArg_ParseTuple(args, "d", &u)) - return 0; + return nullptr; gp_Dir dir; Py::Tuple tuple(1); GeomLProp_CLProps prop(c,u,2,Precision::Confusion()); @@ -525,11 +525,11 @@ PyObject* GeometryCurvePy::tangent(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::normal(PyObject *args) @@ -540,7 +540,7 @@ PyObject* GeometryCurvePy::normal(PyObject *args) if (!c.IsNull()) { double u; if (!PyArg_ParseTuple(args, "d", &u)) - return 0; + return nullptr; gp_Dir dir; GeomLProp_CLProps prop(c,u,2,Precision::Confusion()); prop.Normal(dir); @@ -549,11 +549,11 @@ PyObject* GeometryCurvePy::normal(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::curvature(PyObject *args) @@ -564,7 +564,7 @@ PyObject* GeometryCurvePy::curvature(PyObject *args) if (!c.IsNull()) { double u; if (!PyArg_ParseTuple(args, "d", &u)) - return 0; + return nullptr; GeomLProp_CLProps prop(c,u,2,Precision::Confusion()); double C = prop.Curvature(); return Py::new_reference_to(Py::Float(C)); @@ -572,11 +572,11 @@ PyObject* GeometryCurvePy::curvature(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::centerOfCurvature(PyObject *args) @@ -587,7 +587,7 @@ PyObject* GeometryCurvePy::centerOfCurvature(PyObject *args) if (!c.IsNull()) { double u; if (!PyArg_ParseTuple(args, "d", &u)) - return 0; + return nullptr; GeomLProp_CLProps prop(c,u,2,Precision::Confusion()); gp_Pnt V ; prop.CentreOfCurvature(V); @@ -596,11 +596,11 @@ PyObject* GeometryCurvePy::centerOfCurvature(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::parameter(PyObject *args) @@ -608,7 +608,7 @@ PyObject* GeometryCurvePy::parameter(PyObject *args) try { PyObject *p; if (!PyArg_ParseTuple(args, "O!", &(Base::VectorPy::Type), &p)) - return 0; + return nullptr; Base::Vector3d v = Py::Vector(p, false).toVector(); double u; @@ -618,18 +618,18 @@ PyObject* GeometryCurvePy::parameter(PyObject *args) } catch (Base::CADKernelError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::makeRuledSurface(PyObject *args) { PyObject* curve; if (!PyArg_ParseTuple(args, "O!", &(Part::GeometryCurvePy::Type), &curve)) - return 0; + return nullptr; try { Handle(Geom_Curve) aCrv1 = Handle(Geom_Curve)::DownCast(getGeometryPtr()->handle()); @@ -638,7 +638,7 @@ PyObject* GeometryCurvePy::makeRuledSurface(PyObject *args) Handle(Geom_Surface) aSurf = GeomFill::Surface (aCrv1, aCrv2); if (aSurf.IsNull()) { PyErr_SetString(PartExceptionOCCError, "Failed to create ruled surface"); - return 0; + return nullptr; } // check the result surface type if (aSurf->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { @@ -654,12 +654,12 @@ PyObject* GeometryCurvePy::makeRuledSurface(PyObject *args) else { PyErr_Format(PyExc_NotImplementedError, "Ruled surface is of type '%s'", aSurf->DynamicType()->Name()); - return 0; + return nullptr; } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -668,7 +668,7 @@ PyObject* GeometryCurvePy::intersect2d(PyObject *args) PyObject *c,*p; if (!PyArg_ParseTuple(args, "O!O!", &(Part::GeometryCurvePy::Type), &c, &(Part::PlanePy::Type), &p)) - return 0; + return nullptr; try { Handle(Geom_Curve) self = Handle(Geom_Curve)::DownCast(getGeometryPtr()->handle()); @@ -708,7 +708,7 @@ PyObject* GeometryCurvePy::intersect2d(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -722,18 +722,18 @@ PyObject* GeometryCurvePy::toBSpline(PyObject * args) u=c->FirstParameter(); v=c->LastParameter(); if (!PyArg_ParseTuple(args, "|dd", &u,&v)) - return 0; + return nullptr; GeomBSplineCurve* spline = getGeomCurvePtr()->toBSpline(u, v); return new BSplineCurvePy(spline); } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::toNurbs(PyObject * args) @@ -746,18 +746,18 @@ PyObject* GeometryCurvePy::toNurbs(PyObject * args) u=c->FirstParameter(); v=c->LastParameter(); if (!PyArg_ParseTuple(args, "|dd", &u,&v)) - return 0; + return nullptr; GeomBSplineCurve* spline = getGeomCurvePtr()->toNurbs(u, v); return new BSplineCurvePy(spline); } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::trim(PyObject * args) @@ -770,17 +770,17 @@ PyObject* GeometryCurvePy::trim(PyObject * args) u=c->FirstParameter(); v=c->LastParameter(); if (!PyArg_ParseTuple(args, "|dd", &u,&v)) - return 0; + return nullptr; return Py::new_reference_to(makeTrimmedCurvePy(c,u,v)); } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::approximateBSpline(PyObject *args) @@ -789,7 +789,7 @@ PyObject* GeometryCurvePy::approximateBSpline(PyObject *args) int maxSegment, maxDegree; char* order = "C2"; if (!PyArg_ParseTuple(args, "dii|s", &tolerance, &maxSegment, &maxDegree, &order)) - return 0; + return nullptr; GeomAbs_Shape absShape; std::string str = order; @@ -820,16 +820,16 @@ PyObject* GeometryCurvePy::approximateBSpline(PyObject *args) std::stringstream str; str << "Maximum error (" << approx.MaxError() << ") is outside tolerance"; PyErr_SetString(PyExc_RuntimeError, str.str().c_str()); - return 0; + return nullptr; } else { PyErr_SetString(PyExc_RuntimeError, "Approximation of curve failed"); - return 0; + return nullptr; } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -904,11 +904,11 @@ PyObject* GeometryCurvePy::continuityWith(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve"); - return 0; + return nullptr; } Py::String GeometryCurvePy::getContinuity(void) const @@ -959,7 +959,7 @@ Py::Float GeometryCurvePy::getLastParameter(void) const PyObject *GeometryCurvePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int GeometryCurvePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) @@ -977,12 +977,12 @@ PyObject* GeometryCurvePy::intersectCS(PyObject *args) PyObject *p; double prec = Precision::Confusion(); if (!PyArg_ParseTuple(args, "O!|d", &(Part::GeometrySurfacePy::Type), &p, &prec)) - return 0; + return nullptr; Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast(static_cast(p)->getGeometryPtr()->handle()); GeomAPI_IntCS intersector(curve, surf); if (!intersector.IsDone()) { PyErr_SetString(PyExc_RuntimeError, "Intersection of curve and surface failed"); - return 0; + return nullptr; } Py::List points; @@ -1004,11 +1004,11 @@ PyObject* GeometryCurvePy::intersectCS(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PyExc_TypeError, "Geometry is not a curve"); - return 0; + return nullptr; } PyObject* GeometryCurvePy::intersectCC(PyObject *args) @@ -1016,7 +1016,7 @@ PyObject* GeometryCurvePy::intersectCC(PyObject *args) PyObject *p; double prec = Precision::Confusion(); if (!PyArg_ParseTuple(args, "O!|d", &(Part::GeometryCurvePy::Type), &p, &prec)) - return 0; + return nullptr; GeomCurve* curve1 = getGeomCurvePtr(); GeomCurve* curve2 = static_cast(p)->getGeomCurvePtr(); @@ -1037,7 +1037,7 @@ PyObject* GeometryCurvePy::intersectCC(PyObject *args) } catch (Base::Exception& e) { PyErr_SetString(PyExc_RuntimeError, e.what()); - return 0; + return nullptr; } } @@ -1059,16 +1059,16 @@ PyObject* GeometryCurvePy::intersect(PyObject *args) if (PyArg_ParseTuple(args, "O!|d", &(Part::GeometrySurfacePy::Type), &p, &prec)) return intersectCS(args); else - return 0; + return nullptr; } } catch (Standard_Failure& e) { PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PyExc_TypeError, "Geometry is not a curve"); - return 0; + return nullptr; } Py::Object GeometryCurvePy::getRotation(void) const @@ -1085,7 +1085,7 @@ Py::Object GeometryCurvePy::getRotation(void) const PyObject* GeometryCurvePy::reverse(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_Geometry) g = getGeometryPtr()->handle(); Handle(Geom_Curve) c = Handle(Geom_Curve)::DownCast(g); @@ -1093,7 +1093,7 @@ PyObject* GeometryCurvePy::reverse(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; } @@ -1102,7 +1102,7 @@ PyObject* GeometryCurvePy::reversedParameter(PyObject *args) { double p; if (!PyArg_ParseTuple(args, "d", &p)) - return 0; + return nullptr; try { Handle(Geom_Geometry) g = getGeometryPtr()->handle(); Handle(Geom_Curve) c = Handle(Geom_Curve)::DownCast(g); @@ -1111,14 +1111,14 @@ PyObject* GeometryCurvePy::reversedParameter(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* GeometryCurvePy::isPeriodic(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_Geometry) g = getGeometryPtr()->handle(); Handle(Geom_Curve) c = Handle(Geom_Curve)::DownCast(g); @@ -1127,14 +1127,14 @@ PyObject* GeometryCurvePy::isPeriodic(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* GeometryCurvePy::period(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_Geometry) g = getGeometryPtr()->handle(); Handle(Geom_Curve) c = Handle(Geom_Curve)::DownCast(g); @@ -1143,14 +1143,14 @@ PyObject* GeometryCurvePy::period(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* GeometryCurvePy::isClosed(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_Geometry) g = getGeometryPtr()->handle(); Handle(Geom_Curve) c = Handle(Geom_Curve)::DownCast(g); @@ -1159,6 +1159,6 @@ PyObject* GeometryCurvePy::isClosed(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); - return 0; + return nullptr; } } diff --git a/src/Mod/Part/App/GeometryDoubleExtensionPyImp.cpp b/src/Mod/Part/App/GeometryDoubleExtensionPyImp.cpp index f24e6e9d01..0d1a0e23e4 100644 --- a/src/Mod/Part/App/GeometryDoubleExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryDoubleExtensionPyImp.cpp @@ -97,7 +97,7 @@ void GeometryDoubleExtensionPy::setValue(Py::Float value) PyObject *GeometryDoubleExtensionPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int GeometryDoubleExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/GeometryExtensionPyImp.cpp b/src/Mod/Part/App/GeometryExtensionPyImp.cpp index 69c58f8562..ebeaeb84bf 100644 --- a/src/Mod/Part/App/GeometryExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryExtensionPyImp.cpp @@ -40,7 +40,7 @@ PyObject *GeometryExtensionPy::PyMake(struct _typeobject *, PyObject *, PyObject // never create such objects with the constructor PyErr_SetString(PyExc_RuntimeError, "You cannot create an instance of the abstract class 'GeometryExtension'."); - return 0; + return nullptr; } // constructor method @@ -52,17 +52,17 @@ int GeometryExtensionPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/) PyObject* GeometryExtensionPy::copy(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; Part::GeometryExtension* ext = this->getGeometryExtensionPtr(); PyTypeObject* type = this->GetType(); - PyObject* cpy = 0; + PyObject* cpy = nullptr; // let the type object decide if (type->tp_new) - cpy = type->tp_new(type, this, 0); + cpy = type->tp_new(type, this, nullptr); if (!cpy) { PyErr_SetString(PyExc_TypeError, "failed to create copy of the geometry extension"); - return 0; + return nullptr; } Part::GeometryExtensionPy* extpy = static_cast(cpy); @@ -92,7 +92,7 @@ void GeometryExtensionPy::setName(Py::String arg) PyObject *GeometryExtensionPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int GeometryExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/GeometryIntExtensionPyImp.cpp b/src/Mod/Part/App/GeometryIntExtensionPyImp.cpp index 7e3e1afe2f..d50f67f8b3 100644 --- a/src/Mod/Part/App/GeometryIntExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryIntExtensionPyImp.cpp @@ -97,7 +97,7 @@ void GeometryIntExtensionPy::setValue(Py::Long value) PyObject *GeometryIntExtensionPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int GeometryIntExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/GeometryPyImp.cpp b/src/Mod/Part/App/GeometryPyImp.cpp index 9e288adf8e..8e4ff5cedd 100644 --- a/src/Mod/Part/App/GeometryPyImp.cpp +++ b/src/Mod/Part/App/GeometryPyImp.cpp @@ -68,7 +68,7 @@ PyObject *GeometryPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // P // never create such objects with the constructor PyErr_SetString(PyExc_RuntimeError, "You cannot create an instance of the abstract class 'Geometry'."); - return 0; + return nullptr; } // constructor method @@ -97,14 +97,14 @@ PyObject* GeometryPy::mirror(PyObject *args) } PyErr_SetString(PartExceptionOCCError, "either a point (vector) or axis (vector, vector) must be given"); - return 0; + return nullptr; } PyObject* GeometryPy::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(); getGeometryPtr()->rotate(*plm); @@ -130,14 +130,14 @@ PyObject* GeometryPy::scale(PyObject *args) } PyErr_SetString(PartExceptionOCCError, "either vector or tuple and float expected"); - return 0; + return nullptr; } PyObject* GeometryPy::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(); getGeometryPtr()->transform(mat); Py_Return; @@ -161,23 +161,23 @@ PyObject* GeometryPy::translate(PyObject *args) } PyErr_SetString(PartExceptionOCCError, "either vector or tuple expected"); - return 0; + return nullptr; } PyObject* GeometryPy::copy(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; Part::Geometry* geom = this->getGeometryPtr(); PyTypeObject* type = this->GetType(); - PyObject* cpy = 0; + PyObject* cpy = nullptr; // let the type object decide if (type->tp_new) - cpy = type->tp_new(type, this, 0); + cpy = type->tp_new(type, this, nullptr); if (!cpy) { PyErr_SetString(PyExc_TypeError, "failed to create copy of geometry"); - return 0; + return nullptr; } Part::GeometryPy* geompy = static_cast(cpy); @@ -194,17 +194,17 @@ PyObject* GeometryPy::copy(PyObject *args) PyObject* GeometryPy::clone(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; Part::Geometry* geom = this->getGeometryPtr(); PyTypeObject* type = this->GetType(); - PyObject* cpy = 0; + PyObject* cpy = nullptr; // let the type object decide if (type->tp_new) - cpy = type->tp_new(type, this, 0); + cpy = type->tp_new(type, this, nullptr); if (!cpy) { PyErr_SetString(PyExc_TypeError, "failed to create clone of geometry"); - return 0; + return nullptr; } Part::GeometryPy* geompy = static_cast(cpy); @@ -233,7 +233,7 @@ PyObject* GeometryPy::setExtension(PyObject *args) } PyErr_SetString(PartExceptionOCCError, "A geometry extension object was expected"); - return 0; + return nullptr; } PyObject* GeometryPy::getExtensionOfType(PyObject *args) @@ -253,27 +253,27 @@ PyObject* GeometryPy::getExtensionOfType(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } catch(const std::bad_weak_ptr&) { PyErr_SetString(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(PartExceptionOCCError, "Exception type does not exist"); - return 0; + return nullptr; } } PyErr_SetString(PartExceptionOCCError, "A string with the name of the geometry extension type was expected"); - return 0; + return nullptr; } PyObject* GeometryPy::getExtensionOfName(PyObject *args) @@ -290,21 +290,21 @@ PyObject* GeometryPy::getExtensionOfName(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } catch(const std::bad_weak_ptr&) { PyErr_SetString(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(PartExceptionOCCError, "A string with the name of the geometry extension was expected"); - return 0; + return nullptr; } PyObject* GeometryPy::hasExtensionOfType(PyObject *args) @@ -320,19 +320,19 @@ PyObject* GeometryPy::hasExtensionOfType(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } else { PyErr_SetString(PartExceptionOCCError, "Exception type does not exist"); - return 0; + return nullptr; } } PyErr_SetString(PartExceptionOCCError, "A string with the type of the geometry extension was expected"); - return 0; + return nullptr; } PyObject* GeometryPy::hasExtensionOfName(PyObject *args) @@ -345,13 +345,13 @@ PyObject* GeometryPy::hasExtensionOfName(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } PyErr_SetString(PartExceptionOCCError, "A string with the type of the geometry extension was expected"); - return 0; + return nullptr; } PyObject* GeometryPy::deleteExtensionOfType(PyObject *args) @@ -368,19 +368,19 @@ PyObject* GeometryPy::deleteExtensionOfType(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } else { PyErr_SetString(PartExceptionOCCError, "Type does not exist"); - return 0; + return nullptr; } } PyErr_SetString(PartExceptionOCCError, "A string with a type object was expected"); - return 0; + return nullptr; } PyObject* GeometryPy::deleteExtensionOfName(PyObject *args) @@ -394,19 +394,19 @@ PyObject* GeometryPy::deleteExtensionOfName(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } PyErr_SetString(PartExceptionOCCError, "A string with the name of the extension was expected"); - return 0; + return nullptr; } PyObject* GeometryPy::getExtensions(PyObject *args) { if (!PyArg_ParseTuple(args, "")){ PyErr_SetString(PartExceptionOCCError, "No arguments were expected"); - return NULL; + return nullptr; } try { @@ -435,7 +435,7 @@ PyObject* GeometryPy::getExtensions(PyObject *args) } catch(const Base::ValueError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } } @@ -448,7 +448,7 @@ Py::String GeometryPy::getTag(void) const PyObject *GeometryPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int GeometryPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/GeometryStringExtensionPyImp.cpp b/src/Mod/Part/App/GeometryStringExtensionPyImp.cpp index 9cbd54df29..77e59fe188 100644 --- a/src/Mod/Part/App/GeometryStringExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryStringExtensionPyImp.cpp @@ -98,7 +98,7 @@ void GeometryStringExtensionPy::setValue(Py::String value) PyObject *GeometryStringExtensionPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int GeometryStringExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/GeometrySurfacePyImp.cpp b/src/Mod/Part/App/GeometrySurfacePyImp.cpp index a9ea99ea3f..8b4ffcf53b 100644 --- a/src/Mod/Part/App/GeometrySurfacePyImp.cpp +++ b/src/Mod/Part/App/GeometrySurfacePyImp.cpp @@ -117,7 +117,7 @@ PyObject *GeometrySurfacePy::PyMake(struct _typeobject *, PyObject *, PyObject * // never create such objects with the constructor PyErr_SetString(PyExc_RuntimeError, "You cannot create an instance of the abstract class 'GeometrySurface'."); - return 0; + return nullptr; } // constructor method @@ -135,7 +135,7 @@ PyObject* GeometrySurfacePy::toShape(PyObject *args) double u1,u2,v1,v2; s->Bounds(u1,u2,v1,v2); if (!PyArg_ParseTuple(args, "|dddd", &u1,&u2,&v1,&v2)) - return 0; + return nullptr; BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2 #if OCC_VERSION_HEX >= 0x060502 , Precision::Confusion() @@ -148,11 +148,11 @@ PyObject* GeometrySurfacePy::toShape(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface"); - return 0; + return nullptr; } PyObject* GeometrySurfacePy::toShell(PyObject *args, PyObject* kwds) @@ -248,7 +248,7 @@ PyObject* GeometrySurfacePy::value(PyObject *args) if (!s.IsNull()) { double u,v; if (!PyArg_ParseTuple(args, "dd", &u,&v)) - return 0; + return nullptr; gp_Pnt p = s->Value(u,v); return new Base::VectorPy(Base::Vector3d(p.X(),p.Y(),p.Z())); } @@ -256,11 +256,11 @@ PyObject* GeometrySurfacePy::value(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface"); - return 0; + return nullptr; } PyObject* GeometrySurfacePy::tangent(PyObject *args) @@ -271,7 +271,7 @@ PyObject* GeometrySurfacePy::tangent(PyObject *args) if (!s.IsNull()) { double u,v; if (!PyArg_ParseTuple(args, "dd", &u,&v)) - return 0; + return nullptr; gp_Dir dir; Py::Tuple tuple(2); GeomLProp_SLProps prop(s,u,v,2,Precision::Confusion()); @@ -290,11 +290,11 @@ PyObject* GeometrySurfacePy::tangent(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface"); - return 0; + return nullptr; } PyObject* GeometrySurfacePy::normal(PyObject *args) @@ -304,31 +304,31 @@ PyObject* GeometrySurfacePy::normal(PyObject *args) if (s) { double u,v; if (!PyArg_ParseTuple(args, "dd", &u,&v)) - return 0; + return nullptr; gp_Dir d; if (s->normal(u,v,d)) { return new Base::VectorPy(Base::Vector3d(d.X(),d.Y(),d.Z())); } else { PyErr_SetString(PyExc_RuntimeError, "normal at this point is not defined"); - return 0; + return nullptr; } } } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface"); - return 0; + return nullptr; } PyObject* GeometrySurfacePy::projectPoint(PyObject *args, PyObject* kwds) { PyObject* v; const char* meth = "NearestPoint"; - static char *kwlist[] = {"Point", "Method", NULL}; + static char *kwlist[] = {"Point", "Method", nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|s", kwlist, &Base::VectorPy::Type, &v, &meth)) return nullptr; @@ -408,7 +408,7 @@ PyObject* GeometrySurfacePy::isUmbillic(PyObject *args) if (s) { double u,v; if (!PyArg_ParseTuple(args, "dd", &u,&v)) - return 0; + return nullptr; bool val = s->isUmbillic(u,v); return PyBool_FromLong(val ? 1 : 0); @@ -417,11 +417,11 @@ PyObject* GeometrySurfacePy::isUmbillic(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface"); - return 0; + return nullptr; } PyObject* GeometrySurfacePy::curvatureDirections(PyObject *args) @@ -431,7 +431,7 @@ PyObject* GeometrySurfacePy::curvatureDirections(PyObject *args) if (s) { double u,v; if (!PyArg_ParseTuple(args, "dd", &u,&v)) - return 0; + return nullptr; gp_Dir maxd, mind; s->curvatureDirections(u,v,maxd,mind); @@ -445,11 +445,11 @@ PyObject* GeometrySurfacePy::curvatureDirections(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface"); - return 0; + return nullptr; } PyObject* GeometrySurfacePy::curvature(PyObject *args) @@ -460,7 +460,7 @@ PyObject* GeometrySurfacePy::curvature(PyObject *args) double u,v; char* type; if (!PyArg_ParseTuple(args, "dds", &u,&v,&type)) - return 0; + return nullptr; GeomSurface::Curvature t; if (strcmp(type,"Max") == 0) { @@ -477,7 +477,7 @@ PyObject* GeometrySurfacePy::curvature(PyObject *args) } else { PyErr_SetString(PyExc_ValueError, "unknown curvature type"); - return 0; + return nullptr; } double c = s->curvature(u,v,t); @@ -487,11 +487,11 @@ PyObject* GeometrySurfacePy::curvature(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface"); - return 0; + return nullptr; } PyObject* GeometrySurfacePy::isPlanar(PyObject *args) @@ -502,7 +502,7 @@ PyObject* GeometrySurfacePy::isPlanar(PyObject *args) if (!surf.IsNull()) { double tol = Precision::Confusion(); if (!PyArg_ParseTuple(args, "|d", &tol)) - return 0; + return nullptr; GeomLib_IsPlanarSurface check(surf, tol); Standard_Boolean val = check.IsPlanar(); @@ -511,11 +511,11 @@ PyObject* GeometrySurfacePy::isPlanar(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface"); - return 0; + return nullptr; } PyObject* GeometrySurfacePy::parameter(PyObject *args) @@ -527,7 +527,7 @@ PyObject* GeometrySurfacePy::parameter(PyObject *args) PyObject *p; double prec = Precision::Confusion(); if (!PyArg_ParseTuple(args, "O!|d", &(Base::VectorPy::Type), &p, &prec)) - return 0; + return nullptr; Base::Vector3d v = Py::Vector(p, false).toVector(); gp_Pnt pnt(v.x,v.y,v.z); ShapeAnalysis_Surface as(surf); @@ -541,17 +541,17 @@ PyObject* GeometrySurfacePy::parameter(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface"); - return 0; + return nullptr; } PyObject* GeometrySurfacePy::bounds(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_Surface) surf = Handle(Geom_Surface) ::DownCast(getGeometryPtr()->handle()); @@ -569,7 +569,7 @@ PyObject* GeometrySurfacePy::uIso(PyObject * args) { double v; if (!PyArg_ParseTuple(args, "d", &v)) - return 0; + return nullptr; try { Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast @@ -577,7 +577,7 @@ PyObject* GeometrySurfacePy::uIso(PyObject * args) Handle(Geom_Curve) c = surf->UIso(v); if (c.IsNull()) { PyErr_SetString(PyExc_RuntimeError, "failed to create u iso curve"); - return 0; + return nullptr; } if (c->IsKind(STANDARD_TYPE(Geom_Line))) { @@ -595,7 +595,7 @@ PyObject* GeometrySurfacePy::uIso(PyObject * args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -603,7 +603,7 @@ PyObject* GeometrySurfacePy::vIso(PyObject * args) { double v; if (!PyArg_ParseTuple(args, "d", &v)) - return 0; + return nullptr; try { Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast @@ -611,7 +611,7 @@ PyObject* GeometrySurfacePy::vIso(PyObject * args) Handle(Geom_Curve) c = surf->VIso(v); if (c.IsNull()) { PyErr_SetString(PyExc_RuntimeError, "failed to create v iso curve"); - return 0; + return nullptr; } if (c->IsKind(STANDARD_TYPE(Geom_Line))) { @@ -629,14 +629,14 @@ PyObject* GeometrySurfacePy::vIso(PyObject * args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* GeometrySurfacePy::isUPeriodic(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast (getGeometryPtr()->handle()); @@ -647,7 +647,7 @@ PyObject* GeometrySurfacePy::isUPeriodic(PyObject * args) PyObject* GeometrySurfacePy::isVPeriodic(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast (getGeometryPtr()->handle()); @@ -658,7 +658,7 @@ PyObject* GeometrySurfacePy::isVPeriodic(PyObject * args) PyObject* GeometrySurfacePy::isUClosed(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast (getGeometryPtr()->handle()); @@ -669,7 +669,7 @@ PyObject* GeometrySurfacePy::isUClosed(PyObject * args) PyObject* GeometrySurfacePy::isVClosed(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast (getGeometryPtr()->handle()); @@ -680,7 +680,7 @@ PyObject* GeometrySurfacePy::isVClosed(PyObject * args) PyObject* GeometrySurfacePy::UPeriod(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast @@ -691,14 +691,14 @@ PyObject* GeometrySurfacePy::UPeriod(PyObject * args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* GeometrySurfacePy::VPeriod(PyObject * args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast @@ -709,7 +709,7 @@ PyObject* GeometrySurfacePy::VPeriod(PyObject * args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -814,12 +814,12 @@ PyObject* GeometrySurfacePy::toBSpline(PyObject * args, PyObject * kwds) PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); } - return 0; + return nullptr; } PyObject *GeometrySurfacePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int GeometrySurfacePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) @@ -837,12 +837,12 @@ PyObject* GeometrySurfacePy::intersectSS(PyObject *args) PyObject *p; double prec = Precision::Confusion(); if (!PyArg_ParseTuple(args, "O!|d", &(Part::GeometrySurfacePy::Type), &p, &prec)) - return 0; + return nullptr; Handle(Geom_Surface) surf2 = Handle(Geom_Surface)::DownCast(static_cast(p)->getGeometryPtr()->handle()); GeomAPI_IntSS intersector(surf1, surf2, prec); if (!intersector.IsDone()) { PyErr_SetString(PyExc_RuntimeError, "Intersection of surfaces failed"); - return 0; + return nullptr; } Py::List result; @@ -857,11 +857,11 @@ PyObject* GeometrySurfacePy::intersectSS(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PyExc_TypeError, "intersectSS(): Geometry is not a surface"); - return 0; + return nullptr; } // General intersection function @@ -888,18 +888,18 @@ PyObject* GeometrySurfacePy::intersect(PyObject *args) PyTuple_SetItem(t, 1, PyFloat_FromDouble(prec)); return curve->intersectCS(t); } else { - return 0; + return nullptr; } } } catch (Standard_Failure& e) { PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PyExc_TypeError, "intersect(): Geometry is not a surface"); - return 0; + return nullptr; } Py::Object GeometrySurfacePy::getRotation(void) const diff --git a/src/Mod/Part/App/HyperbolaPyImp.cpp b/src/Mod/Part/App/HyperbolaPyImp.cpp index 5a6b503529..b2079f94a0 100644 --- a/src/Mod/Part/App/HyperbolaPyImp.cpp +++ b/src/Mod/Part/App/HyperbolaPyImp.cpp @@ -55,7 +55,7 @@ PyObject *HyperbolaPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // // constructor method int HyperbolaPy::PyInit(PyObject* args, PyObject* kwds) { - char* keywords_n[] = {NULL}; + char* keywords_n[] = {nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "", keywords_n)) { Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast(getGeomHyperbolaPtr()->handle()); hyperbola->SetMajorRadius(2.0); @@ -63,7 +63,7 @@ int HyperbolaPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_e[] = {"Hyperbola",NULL}; + char* keywords_e[] = {"Hyperbola",nullptr}; PyErr_Clear(); PyObject *pHypr; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!",keywords_e, &(HyperbolaPy::Type), &pHypr)) { @@ -76,7 +76,7 @@ int HyperbolaPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_ssc[] = {"S1","S2","Center",NULL}; + char* keywords_ssc[] = {"S1","S2","Center",nullptr}; PyErr_Clear(); PyObject *pV1, *pV2, *pV3; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!", keywords_ssc, @@ -99,7 +99,7 @@ int HyperbolaPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_cmm[] = {"Center","MajorRadius","MinorRadius",NULL}; + char* keywords_cmm[] = {"Center","MajorRadius","MinorRadius",nullptr}; PyErr_Clear(); PyObject *pV; double major, minor; @@ -173,7 +173,7 @@ Py::Object HyperbolaPy::getFocus2(void) const PyObject *HyperbolaPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int HyperbolaPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/LinePyImp.cpp b/src/Mod/Part/App/LinePyImp.cpp index fe3f4c4ac6..ab466a3def 100644 --- a/src/Mod/Part/App/LinePyImp.cpp +++ b/src/Mod/Part/App/LinePyImp.cpp @@ -224,7 +224,7 @@ void LinePy::setDirection(Py::Object arg) PyObject *LinePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int LinePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/LineSegmentPyImp.cpp b/src/Mod/Part/App/LineSegmentPyImp.cpp index 0ad0854171..494dd239f7 100644 --- a/src/Mod/Part/App/LineSegmentPyImp.cpp +++ b/src/Mod/Part/App/LineSegmentPyImp.cpp @@ -188,7 +188,7 @@ PyObject* LineSegmentPy::setParameterRange(PyObject *args) { double first, last; if (!PyArg_ParseTuple(args, "dd", &first, &last)) - return NULL; + return nullptr; try { Handle(Geom_TrimmedCurve) this_curve = Handle(Geom_TrimmedCurve)::DownCast @@ -197,7 +197,7 @@ PyObject* LineSegmentPy::setParameterRange(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } Py_Return; @@ -317,7 +317,7 @@ void LineSegmentPy::setEndPoint(Py::Object arg) PyObject *LineSegmentPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int LineSegmentPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/OffsetCurvePyImp.cpp b/src/Mod/Part/App/OffsetCurvePyImp.cpp index 4d260cfa41..295d9efeb8 100644 --- a/src/Mod/Part/App/OffsetCurvePyImp.cpp +++ b/src/Mod/Part/App/OffsetCurvePyImp.cpp @@ -153,7 +153,7 @@ void OffsetCurvePy::setBasisCurve(Py::Object arg) PyObject *OffsetCurvePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int OffsetCurvePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/OffsetSurfacePyImp.cpp b/src/Mod/Part/App/OffsetSurfacePyImp.cpp index 32d44cd446..6aa820aa35 100644 --- a/src/Mod/Part/App/OffsetSurfacePyImp.cpp +++ b/src/Mod/Part/App/OffsetSurfacePyImp.cpp @@ -127,7 +127,7 @@ void OffsetSurfacePy::setBasisSurface(Py::Object arg) PyObject *OffsetSurfacePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int OffsetSurfacePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/ParabolaPyImp.cpp b/src/Mod/Part/App/ParabolaPyImp.cpp index 1b0edf63b6..82eac5a661 100644 --- a/src/Mod/Part/App/ParabolaPyImp.cpp +++ b/src/Mod/Part/App/ParabolaPyImp.cpp @@ -55,14 +55,14 @@ PyObject *ParabolaPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // P // constructor method int ParabolaPy::PyInit(PyObject* args, PyObject* kwds) { - char* keywords_n[] = {NULL}; + char* keywords_n[] = {nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "", keywords_n)) { Handle(Geom_Parabola) parabola = Handle(Geom_Parabola)::DownCast(getGeomParabolaPtr()->handle()); parabola->SetFocal(1.0); return 0; } - char* keywords_e[] = {"Parabola",NULL}; + char* keywords_e[] = {"Parabola",nullptr}; PyErr_Clear(); PyObject *pParab; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!",keywords_e, &(ParabolaPy::Type), &pParab)) { @@ -75,7 +75,7 @@ int ParabolaPy::PyInit(PyObject* args, PyObject* kwds) return 0; } - char* keywords_ssc[] = {"Focus","Center","Normal",NULL}; + char* keywords_ssc[] = {"Focus","Center","Normal",nullptr}; PyErr_Clear(); PyObject *pV1, *pV2, *pV3; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!", keywords_ssc, @@ -121,7 +121,7 @@ PyObject* ParabolaPy::compute(PyObject *args) &Base::VectorPy::Type,&p1, &Base::VectorPy::Type,&p2, &Base::VectorPy::Type,&p3)) - return 0; + return nullptr; Base::Vector3d v1 = Py::Vector(p1,false).toVector(); Base::Vector3d v2 = Py::Vector(p2,false).toVector(); Base::Vector3d v3 = Py::Vector(p3,false).toVector(); @@ -129,7 +129,7 @@ PyObject* ParabolaPy::compute(PyObject *args) double zValue = v1.z; if (fabs(c.Length()) < 0.0001) { PyErr_SetString(PartExceptionOCCError, "Points are collinear"); - return 0; + return nullptr; } Base::Matrix4D m; @@ -187,7 +187,7 @@ Py::Float ParabolaPy::getParameter(void) const PyObject *ParabolaPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int ParabolaPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/Part2DObjectPyImp.cpp b/src/Mod/Part/App/Part2DObjectPyImp.cpp index c72110cba3..f3c43d70e4 100644 --- a/src/Mod/Part/App/Part2DObjectPyImp.cpp +++ b/src/Mod/Part/App/Part2DObjectPyImp.cpp @@ -41,7 +41,7 @@ std::string Part2DObjectPy::representation(void) const PyObject *Part2DObjectPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int Part2DObjectPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/PartFeature.cpp b/src/Mod/Part/App/PartFeature.cpp index e132fe5543..87405b6c74 100644 --- a/src/Mod/Part/App/PartFeature.cpp +++ b/src/Mod/Part/App/PartFeature.cpp @@ -201,7 +201,7 @@ App::DocumentObject *Feature::getSubObject(const char *subname, if (subname) str << '.' << subname; FC_LOG(str.str()); - return 0; + return nullptr; } } @@ -240,7 +240,7 @@ struct ShapeCache { return; if(strcmp(propName,"Shape")==0 || strcmp(propName,"Group")==0 - || strstr(propName,"Touched")!=0) + || strstr(propName,"Touched")!=nullptr) slotClear(obj); } @@ -256,7 +256,7 @@ struct ShapeCache { } } - bool getShape(const App::DocumentObject *obj, TopoShape &shape, const char *subname=0) { + bool getShape(const App::DocumentObject *obj, TopoShape &shape, const char *subname=nullptr) { init(); auto &entry = cache[obj->getDocument()]; if(!subname) subname = ""; @@ -268,7 +268,7 @@ struct ShapeCache { return false; } - void setShape(const App::DocumentObject *obj, const TopoShape &shape, const char *subname=0) { + void setShape(const App::DocumentObject *obj, const TopoShape &shape, const char *subname=nullptr) { init(); if(!subname) subname = ""; cache[obj->getDocument()][std::make_pair(obj,std::string(subname))] = shape; @@ -289,9 +289,9 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna if(!obj) return shape; - PyObject *pyobj = 0; + PyObject *pyobj = nullptr; Base::Matrix4D mat; - if(powner) *powner = 0; + if(powner) *powner = nullptr; std::string _subname; auto subelement = Data::ComplexGeoData::findElementName(subname); @@ -311,14 +311,14 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna } } - App::DocumentObject *linked = 0; - App::DocumentObject *owner = 0; + App::DocumentObject *linked = nullptr; + App::DocumentObject *owner = nullptr; Base::Matrix4D linkMat; // App::StringHasherRef hasher; // long tag; { Base::PyGILStateLocker lock; - owner = obj->getSubObject(subname,shape.isNull()?&pyobj:0,&mat,false); + owner = obj->getSubObject(subname,shape.isNull()?&pyobj:nullptr,&mat,false); if(!owner) return shape; // tag = owner->getID(); @@ -387,7 +387,7 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna { // if there is a linked object, and there is no child cache (which is used // for special handling of plain group), obtain shape from the linked object - shape = Feature::getTopoShape(linked,0,false,0,0,false,false); + shape = Feature::getTopoShape(linked,nullptr,false,nullptr,nullptr,false,false); if(shape.isNull()) return shape; if(owner==obj) @@ -413,7 +413,7 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna if(link && link->getElementCountValue()) { linked = link->getTrueLinkedObject(false,&baseMat); if(linked && linked!=owner) { - baseShape = Feature::getTopoShape(linked,0,false,0,0,false,false); + baseShape = Feature::getTopoShape(linked,nullptr,false,nullptr,nullptr,false,false); // if(!link->getShowElementValue()) // baseShape.reTagElementMap(owner->getID(),owner->getDocument()->getStringHasher()); } @@ -422,13 +422,13 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna if(sub.empty()) continue; int visible; std::string childName; - App::DocumentObject *parent=0; + App::DocumentObject *parent=nullptr; Base::Matrix4D mat = baseMat; - App::DocumentObject *subObj=0; + App::DocumentObject *subObj=nullptr; if(sub.find('.')==std::string::npos) visible = 1; else { - subObj = owner->resolve(sub.c_str(), &parent, &childName,0,0,&mat,false); + subObj = owner->resolve(sub.c_str(), &parent, &childName,nullptr,nullptr,&mat,false); if(!parent || !subObj) continue; if(linkStack.size() @@ -442,7 +442,7 @@ static TopoShape _getTopoShape(const App::DocumentObject *obj, const char *subna continue; TopoShape shape; if(!subObj || baseShape.isNull()) { - shape = _getTopoShape(owner,sub.c_str(),true,0,&subObj,false,false,linkStack); + shape = _getTopoShape(owner,sub.c_str(),true,nullptr,&subObj,false,false,linkStack); if(shape.isNull()) continue; if(visible<0 && subObj && !subObj->Visibility.getValue()) @@ -510,7 +510,7 @@ TopoShape Feature::getTopoShape(const App::DocumentObject *obj, const char *subn if(pmat) topMat = *pmat; if(transform) - obj->getSubObject(0,0,&topMat); + obj->getSubObject(nullptr,nullptr,&topMat); // Apply the top level transformation if(!shape.isNull()) @@ -526,7 +526,7 @@ TopoShape Feature::getTopoShape(const App::DocumentObject *obj, const char *subn App::DocumentObject *Feature::getShapeOwner(const App::DocumentObject *obj, const char *subname) { - if(!obj) return 0; + if(!obj) return nullptr; auto owner = obj->getSubObject(subname); if(owner) { auto linked = owner->getLinkedObject(true); @@ -669,7 +669,7 @@ PROPERTY_SOURCE(Part::FilletBase, Part::Feature) FilletBase::FilletBase() { - ADD_PROPERTY(Base,(0)); + ADD_PROPERTY(Base,(nullptr)); ADD_PROPERTY(Edges,(0,0,0)); Edges.setSize(0); } diff --git a/src/Mod/Part/App/PartFeature.h b/src/Mod/Part/App/PartFeature.h index 870d466089..b06d3f1139 100644 --- a/src/Mod/Part/App/PartFeature.h +++ b/src/Mod/Part/App/PartFeature.h @@ -93,19 +93,19 @@ public: * if pmat already include obj's transformation matrix. */ static TopoDS_Shape getShape(const App::DocumentObject *obj, - const char *subname=0, bool needSubElement=false, Base::Matrix4D *pmat=0, - App::DocumentObject **owner=0, bool resolveLink=true, bool transform=true); + const char *subname=nullptr, bool needSubElement=false, Base::Matrix4D *pmat=nullptr, + App::DocumentObject **owner=nullptr, bool resolveLink=true, bool transform=true); static TopoShape getTopoShape(const App::DocumentObject *obj, - const char *subname=0, bool needSubElement=false, Base::Matrix4D *pmat=0, - App::DocumentObject **owner=0, bool resolveLink=true, bool transform=true, + const char *subname=nullptr, bool needSubElement=false, Base::Matrix4D *pmat=nullptr, + App::DocumentObject **owner=nullptr, bool resolveLink=true, bool transform=true, bool noElementMap=false); static void clearShapeCache(); - static App::DocumentObject *getShapeOwner(const App::DocumentObject *obj, const char *subname=0); + static App::DocumentObject *getShapeOwner(const App::DocumentObject *obj, const char *subname=nullptr); - static bool hasShapeOwner(const App::DocumentObject *obj, const char *subname=0) { + static bool hasShapeOwner(const App::DocumentObject *obj, const char *subname=nullptr) { auto owner = getShapeOwner(obj,subname); return owner && owner->isDerivedFrom(getClassTypeId()); } diff --git a/src/Mod/Part/App/PartFeaturePyImp.cpp b/src/Mod/Part/App/PartFeaturePyImp.cpp index 64dd2a8c6e..e6f8fc5472 100644 --- a/src/Mod/Part/App/PartFeaturePyImp.cpp +++ b/src/Mod/Part/App/PartFeaturePyImp.cpp @@ -39,7 +39,7 @@ std::string PartFeaturePy::representation(void) const PyObject *PartFeaturePy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int PartFeaturePy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/PartFeatureReference.cpp b/src/Mod/Part/App/PartFeatureReference.cpp index 9f43ee9c84..c8f053f776 100644 --- a/src/Mod/Part/App/PartFeatureReference.cpp +++ b/src/Mod/Part/App/PartFeatureReference.cpp @@ -49,7 +49,7 @@ PROPERTY_SOURCE(Part::FeatureReference, App::GeoFeature) FeatureReference::FeatureReference(void) { - ADD_PROPERTY(Reference, (0)); + ADD_PROPERTY(Reference, (nullptr)); } FeatureReference::~FeatureReference() diff --git a/src/Mod/Part/App/PartFeatures.cpp b/src/Mod/Part/App/PartFeatures.cpp index 469dc4a22e..a25d607cc6 100644 --- a/src/Mod/Part/App/PartFeatures.cpp +++ b/src/Mod/Part/App/PartFeatures.cpp @@ -52,12 +52,12 @@ using namespace Part; PROPERTY_SOURCE(Part::RuledSurface, Part::Feature) -const char* RuledSurface::OrientationEnums[] = {"Automatic","Forward","Reversed",NULL}; +const char* RuledSurface::OrientationEnums[] = {"Automatic","Forward","Reversed",nullptr}; RuledSurface::RuledSurface() { - ADD_PROPERTY_TYPE(Curve1,(0),"Ruled Surface",App::Prop_None,"Curve of ruled surface"); - ADD_PROPERTY_TYPE(Curve2,(0),"Ruled Surface",App::Prop_None,"Curve of ruled surface"); + ADD_PROPERTY_TYPE(Curve1,(nullptr),"Ruled Surface",App::Prop_None,"Curve of ruled surface"); + ADD_PROPERTY_TYPE(Curve2,(nullptr),"Ruled Surface",App::Prop_None,"Curve of ruled surface"); ADD_PROPERTY_TYPE(Orientation,((long)0),"Ruled Surface",App::Prop_None,"Orientation of ruled surface"); Orientation.setEnums(OrientationEnums); } @@ -266,7 +266,7 @@ PROPERTY_SOURCE(Part::Loft, Part::Feature) Loft::Loft() { - ADD_PROPERTY_TYPE(Sections,(0),"Loft",App::Prop_None,"List of sections"); + ADD_PROPERTY_TYPE(Sections,(nullptr),"Loft",App::Prop_None,"List of sections"); Sections.setSize(0); ADD_PROPERTY_TYPE(Solid,(false),"Loft",App::Prop_None,"Create solid"); ADD_PROPERTY_TYPE(Ruled,(false),"Loft",App::Prop_None,"Ruled surface"); @@ -376,15 +376,15 @@ App::DocumentObjectExecReturn *Loft::execute(void) // ---------------------------------------------------------------------------- -const char* Part::Sweep::TransitionEnums[]= {"Transformed","Right corner", "Round corner",NULL}; +const char* Part::Sweep::TransitionEnums[]= {"Transformed","Right corner", "Round corner",nullptr}; PROPERTY_SOURCE(Part::Sweep, Part::Feature) Sweep::Sweep() { - ADD_PROPERTY_TYPE(Sections,(0),"Sweep",App::Prop_None,"List of sections"); + ADD_PROPERTY_TYPE(Sections,(nullptr),"Sweep",App::Prop_None,"List of sections"); Sections.setSize(0); - ADD_PROPERTY_TYPE(Spine,(0),"Sweep",App::Prop_None,"Path to sweep along"); + ADD_PROPERTY_TYPE(Spine,(nullptr),"Sweep",App::Prop_None,"Path to sweep along"); ADD_PROPERTY_TYPE(Solid,(false),"Sweep",App::Prop_None,"Create solid"); ADD_PROPERTY_TYPE(Frenet,(false),"Sweep",App::Prop_None,"Frenet"); ADD_PROPERTY_TYPE(Transition,(long(1)),"Sweep",App::Prop_None,"Transition mode"); @@ -581,14 +581,14 @@ App::DocumentObjectExecReturn *Sweep::execute(void) // ---------------------------------------------------------------------------- -const char* Part::Thickness::ModeEnums[]= {"Skin","Pipe", "RectoVerso",NULL}; -const char* Part::Thickness::JoinEnums[]= {"Arc","Tangent", "Intersection",NULL}; +const char* Part::Thickness::ModeEnums[]= {"Skin","Pipe", "RectoVerso",nullptr}; +const char* Part::Thickness::JoinEnums[]= {"Arc","Tangent", "Intersection",nullptr}; PROPERTY_SOURCE(Part::Thickness, Part::Feature) Thickness::Thickness() { - ADD_PROPERTY_TYPE(Faces,(0),"Thickness",App::Prop_None,"Faces to be removed"); + ADD_PROPERTY_TYPE(Faces,(nullptr),"Thickness",App::Prop_None,"Faces to be removed"); ADD_PROPERTY_TYPE(Value,(1.0),"Thickness",App::Prop_None,"Thickness value"); ADD_PROPERTY_TYPE(Mode,(long(0)),"Thickness",App::Prop_None,"Mode"); Mode.setEnums(ModeEnums); @@ -677,7 +677,7 @@ PROPERTY_SOURCE(Part::Refine, Part::Feature) Refine::Refine() { - ADD_PROPERTY_TYPE(Source,(0),"Refine",App::Prop_None,"Source shape"); + ADD_PROPERTY_TYPE(Source,(nullptr),"Refine",App::Prop_None,"Source shape"); } App::DocumentObjectExecReturn *Refine::execute(void) @@ -702,7 +702,7 @@ PROPERTY_SOURCE(Part::Reverse, Part::Feature) Reverse::Reverse() { - ADD_PROPERTY_TYPE(Source, (0), "Reverse", App::Prop_None, "Source shape"); + ADD_PROPERTY_TYPE(Source, (nullptr), "Reverse", App::Prop_None, "Source shape"); } App::DocumentObjectExecReturn* Reverse::execute(void) diff --git a/src/Mod/Part/App/PlanePyImp.cpp b/src/Mod/Part/App/PlanePyImp.cpp index f93dc98356..e97759f538 100644 --- a/src/Mod/Part/App/PlanePyImp.cpp +++ b/src/Mod/Part/App/PlanePyImp.cpp @@ -66,7 +66,7 @@ int PlanePy::PyInit(PyObject* args, PyObject* kwds) // plane and distance for offset PyObject *pPlane; double dist; - static char* keywords_pd[] = {"Plane","Distance",NULL}; + static char* keywords_pd[] = {"Plane","Distance",nullptr}; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!d", keywords_pd, &(PlanePy::Type), &pPlane, &dist)) { PlanePy* pcPlane = static_cast(pPlane); Handle(Geom_Plane) plane = Handle(Geom_Plane)::DownCast @@ -84,7 +84,7 @@ int PlanePy::PyInit(PyObject* args, PyObject* kwds) // plane from equation double a,b,c,d; - static char* keywords_abcd[] = {"A","B","C","D",NULL}; + static char* keywords_abcd[] = {"A","B","C","D",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "dddd", keywords_abcd, &a,&b,&c,&d)) { @@ -100,7 +100,7 @@ int PlanePy::PyInit(PyObject* args, PyObject* kwds) } PyObject *pV1, *pV2, *pV3; - static char* keywords_ppp[] = {"Point1","Point2","Point3",NULL}; + static char* keywords_ppp[] = {"Point1","Point2","Point3",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!", keywords_ppp, &(Base::VectorPy::Type), &pV1, @@ -123,7 +123,7 @@ int PlanePy::PyInit(PyObject* args, PyObject* kwds) } // location and normal - static char* keywords_cnr[] = {"Location","Normal",NULL}; + static char* keywords_cnr[] = {"Location","Normal",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", keywords_cnr, &(Base::VectorPy::Type), &pV1, @@ -142,7 +142,7 @@ int PlanePy::PyInit(PyObject* args, PyObject* kwds) return 0; } - static char* keywords_p[] = {"Plane",NULL}; + static char* keywords_p[] = {"Plane",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", keywords_p, &(PlanePy::Type), &pPlane)) { PlanePy* pcPlane = static_cast(pPlane); @@ -154,7 +154,7 @@ int PlanePy::PyInit(PyObject* args, PyObject* kwds) return 0; } - static char* keywords_n[] = {NULL}; + static char* keywords_n[] = {nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "", keywords_n)) { // do nothing @@ -257,7 +257,7 @@ void PlanePy::setAxis(Py::Object arg) PyObject *PlanePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int PlanePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/PlateSurfacePyImp.cpp b/src/Mod/Part/App/PlateSurfacePyImp.cpp index 88c8e81e7c..321ed4790c 100644 --- a/src/Mod/Part/App/PlateSurfacePyImp.cpp +++ b/src/Mod/Part/App/PlateSurfacePyImp.cpp @@ -58,11 +58,11 @@ PyObject *PlateSurfacePy::PyMake(struct _typeobject *, PyObject *, PyObject *) int PlateSurfacePy::PyInit(PyObject* args, PyObject* kwds) { static char* kwds_Parameter[] = {"Surface","Points","Curves","Degree", - "NbPtsOnCur","NbIter","Tol2d","Tol3d","TolAng","TolCurv","Anisotropie",NULL}; + "NbPtsOnCur","NbIter","Tol2d","Tol3d","TolAng","TolCurv","Anisotropie",nullptr}; - PyObject* surface = 0; - PyObject* points = 0; - PyObject* curves = 0; + PyObject* surface = nullptr; + PyObject* points = nullptr; + PyObject* curves = nullptr; int Degree = 3; int NbPtsOnCur = 10; int NbIter = 3; @@ -140,7 +140,7 @@ int PlateSurfacePy::PyInit(PyObject* args, PyObject* kwds) PyObject* PlateSurfacePy::makeApprox(PyObject *args, PyObject* kwds) { static char* kwds_Parameter[] = {"Tol3d","MaxSegments","MaxDegree","MaxDistance", - "CritOrder","Continuity","EnlargeCoeff",NULL}; + "CritOrder","Continuity","EnlargeCoeff",nullptr}; double tol3d=0.01; int maxSeg=9; @@ -152,7 +152,7 @@ PyObject* PlateSurfacePy::makeApprox(PyObject *args, PyObject* kwds) if (!PyArg_ParseTupleAndKeywords(args, kwds, "|diidisd", kwds_Parameter, &tol3d, &maxSeg, &maxDegree, &dmax, &critOrder, &cont, &enlargeCoeff)) - return 0; + return nullptr; GeomAbs_Shape continuity; std::string uc = cont; @@ -181,13 +181,13 @@ PyObject* PlateSurfacePy::makeApprox(PyObject *args, PyObject* kwds) } PyErr_SetString(PyExc_RuntimeError, "Approximation of B-spline surface failed"); - return 0; + return nullptr; } PY_CATCH_OCC; } PyObject *PlateSurfacePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int PlateSurfacePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/PointPyImp.cpp b/src/Mod/Part/App/PointPyImp.cpp index 3502ea85b6..8e2e267cf9 100644 --- a/src/Mod/Part/App/PointPyImp.cpp +++ b/src/Mod/Part/App/PointPyImp.cpp @@ -111,7 +111,7 @@ PyObject* PointPy::toShape(PyObject *args) try { if (!this_point.IsNull()) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; BRepBuilderAPI_MakeVertex mkBuilder(this_point->Pnt()); const TopoDS_Vertex& sh = mkBuilder.Vertex(); @@ -121,11 +121,11 @@ PyObject* PointPy::toShape(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a point"); - return 0; + return nullptr; } Py::Float PointPy::getX(void) const @@ -191,7 +191,7 @@ void PointPy::setZ(Py::Float Z) PyObject *PointPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int PointPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/PrimitiveFeature.cpp b/src/Mod/Part/App/PrimitiveFeature.cpp index 572d893a69..31d4d64010 100644 --- a/src/Mod/Part/App/PrimitiveFeature.cpp +++ b/src/Mod/Part/App/PrimitiveFeature.cpp @@ -330,7 +330,7 @@ App::DocumentObjectExecReturn *Plane::execute(void) #endif ); - const char *error=0; + const char *error=nullptr; switch (mkFace.Error()) { case BRepBuilderAPI_FaceDone: @@ -760,8 +760,8 @@ App::DocumentObjectExecReturn *Torus::execute(void) PROPERTY_SOURCE(Part::Helix, Part::Primitive) -const char* Part::Helix::LocalCSEnums[]= {"Right-handed","Left-handed",NULL}; -const char* Part::Helix::StyleEnums []= {"Old style","New style",NULL}; +const char* Part::Helix::LocalCSEnums[]= {"Right-handed","Left-handed",nullptr}; +const char* Part::Helix::StyleEnums []= {"Old style","New style",nullptr}; Helix::Helix(void) { diff --git a/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp b/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp index fba1d6a7ec..1b734dce56 100644 --- a/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp +++ b/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp @@ -123,7 +123,7 @@ Py::Object RectangularTrimmedSurfacePy::getBasisSurface() const PyObject *RectangularTrimmedSurfacePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int RectangularTrimmedSurfacePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp b/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp index 9056bcd0eb..ebc453e113 100644 --- a/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp +++ b/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp @@ -247,7 +247,7 @@ PyObject* UnifySameDomainPy::shape(PyObject *args) PyObject *UnifySameDomainPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int UnifySameDomainPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/SpherePyImp.cpp b/src/Mod/Part/App/SpherePyImp.cpp index f55e763a8e..832c59d3f7 100644 --- a/src/Mod/Part/App/SpherePyImp.cpp +++ b/src/Mod/Part/App/SpherePyImp.cpp @@ -183,7 +183,7 @@ void SpherePy::setAxis(Py::Object arg) PyObject *SpherePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int SpherePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp b/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp index f6c317d861..37c6777102 100644 --- a/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp +++ b/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp @@ -153,7 +153,7 @@ void SurfaceOfExtrusionPy::setBasisCurve(Py::Object arg) PyObject *SurfaceOfExtrusionPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int SurfaceOfExtrusionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp b/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp index 996ec57e18..646c720e12 100644 --- a/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp +++ b/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp @@ -180,7 +180,7 @@ void SurfaceOfRevolutionPy::setBasisCurve(Py::Object arg) PyObject *SurfaceOfRevolutionPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int SurfaceOfRevolutionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index 914b35845d..cfc3833c9f 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -3198,7 +3198,7 @@ bool TopoShape::transformShape(const Base::Matrix4D& rclTrf, bool copy, bool che if (this->_Shape.IsNull()) Standard_Failure::Raise("Cannot transform null shape"); - return _makeTransform(TopoShape(*this),rclTrf,0,checkScale,copy); + return _makeTransform(TopoShape(*this),rclTrf,nullptr,checkScale,copy); } TopoDS_Shape TopoShape::mirror(const gp_Ax2& ax2) const @@ -4128,7 +4128,7 @@ TopoShape &TopoShape::makeWires(const TopoShape &shape, const char *op, bool fix // Now retrieve the shape and set it without touching element map wires.back().setShape(aFix.Wire()); } - return makeCompound(wires,0,false); + return makeCompound(wires,nullptr,false); } TopoShape &TopoShape::makeCompound(const std::vector &shapes, const char *op, bool force) diff --git a/src/Mod/Part/App/TopoShape.h b/src/Mod/Part/App/TopoShape.h index e23c0baa0d..fa155a71d2 100644 --- a/src/Mod/Part/App/TopoShape.h +++ b/src/Mod/Part/App/TopoShape.h @@ -313,33 +313,33 @@ public: * To be complete in next batch of patches */ //@{ - TopoShape &makeCompound(const std::vector &shapes, const char *op=0, bool force=true); + TopoShape &makeCompound(const std::vector &shapes, const char *op=nullptr, bool force=true); - TopoShape &makeWires(const TopoShape &shape, const char *op=0, bool fix=false, double tol=0.0); - TopoShape makeWires(const char *op=0, bool fix=false, double tol=0.0) const { + TopoShape &makeWires(const TopoShape &shape, const char *op=nullptr, bool fix=false, double tol=0.0); + TopoShape makeWires(const char *op=nullptr, bool fix=false, double tol=0.0) const { return TopoShape().makeWires(*this,op,fix,tol); } - TopoShape &makeFace(const std::vector &shapes, const char *op=0, const char *maker=0); - TopoShape &makeFace(const TopoShape &shape, const char *op=0, const char *maker=0); - TopoShape makeFace(const char *op=0, const char *maker=0) const { + TopoShape &makeFace(const std::vector &shapes, const char *op=nullptr, const char *maker=nullptr); + TopoShape &makeFace(const TopoShape &shape, const char *op=nullptr, const char *maker=nullptr); + TopoShape makeFace(const char *op=nullptr, const char *maker=nullptr) const { return TopoShape().makeFace(*this,op,maker); } bool _makeTransform(const TopoShape &shape, const Base::Matrix4D &mat, - const char *op=0, bool checkScale=false, bool copy=false); + const char *op=nullptr, bool checkScale=false, bool copy=false); TopoShape &makeTransform(const TopoShape &shape, const Base::Matrix4D &mat, - const char *op=0, bool checkScale=false, bool copy=false) { + const char *op=nullptr, bool checkScale=false, bool copy=false) { _makeTransform(shape,mat,op,checkScale,copy); return *this; } - TopoShape makeTransform(const Base::Matrix4D &mat, const char *op=0, + TopoShape makeTransform(const Base::Matrix4D &mat, const char *op=nullptr, bool checkScale=false, bool copy=false) const { return TopoShape().makeTransform(*this,mat,op,checkScale,copy); } TopoShape &makeTransform(const TopoShape &shape, const gp_Trsf &trsf, - const char *op=0, bool copy=false); - TopoShape makeTransform(const gp_Trsf &trsf, const char *op=0, bool copy=false) const { + const char *op=nullptr, bool copy=false); + TopoShape makeTransform(const gp_Trsf &trsf, const char *op=nullptr, bool copy=false) const { return TopoShape().makeTransform(*this,trsf,op,copy); } @@ -353,13 +353,13 @@ public: } TopoShape &makeGTransform(const TopoShape &shape, const Base::Matrix4D &mat, - const char *op=0, bool copy=false); - TopoShape makeGTransform(const Base::Matrix4D &mat, const char *op=0, bool copy=false) const { + const char *op=nullptr, bool copy=false); + TopoShape makeGTransform(const Base::Matrix4D &mat, const char *op=nullptr, bool copy=false) const { return TopoShape().makeGTransform(*this,mat,op,copy); } - TopoShape &makeRefine(const TopoShape &shape, const char *op=0, bool no_fail=true); - TopoShape makeRefine(const char *op=0, bool no_fail=true) const { + TopoShape &makeRefine(const TopoShape &shape, const char *op=nullptr, bool no_fail=true); + TopoShape makeRefine(const char *op=nullptr, bool no_fail=true) const { return TopoShape().makeRefine(*this,op,no_fail); } //@} diff --git a/src/Mod/Part/App/TopoShapeCompSolidPyImp.cpp b/src/Mod/Part/App/TopoShapeCompSolidPyImp.cpp index f64467b0a0..306ab4e416 100644 --- a/src/Mod/Part/App/TopoShapeCompSolidPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeCompSolidPyImp.cpp @@ -95,7 +95,7 @@ PyObject* TopoShapeCompSolidPy::add(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!", &(Part::TopoShapeSolidPy::Type), &obj)) - return NULL; + return nullptr; BRep_Builder builder; TopoDS_Shape comp = getTopoShapePtr()->getShape(); @@ -111,7 +111,7 @@ PyObject* TopoShapeCompSolidPy::add(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } getTopoShapePtr()->setShape(comp); @@ -121,7 +121,7 @@ PyObject* TopoShapeCompSolidPy::add(PyObject *args) PyObject *TopoShapeCompSolidPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int TopoShapeCompSolidPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp b/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp index 174f7b9550..46b7bf2162 100644 --- a/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp @@ -98,7 +98,7 @@ PyObject* TopoShapeCompoundPy::add(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!", &(Part::TopoShapePy::Type), &obj)) - return NULL; + return nullptr; BRep_Builder builder; TopoDS_Shape comp = getTopoShapePtr()->getShape(); @@ -112,7 +112,7 @@ PyObject* TopoShapeCompoundPy::add(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } getTopoShapePtr()->setShape(comp); @@ -125,7 +125,7 @@ PyObject* TopoShapeCompoundPy::connectEdgesToWires(PyObject *args) PyObject *shared=Py_True; double tol = Precision::Confusion(); if (!PyArg_ParseTuple(args, "|O!d",&PyBool_Type,&shared,&tol)) - return 0; + return nullptr; try { const TopoDS_Shape& s = getTopoShapePtr()->getShape(); @@ -152,13 +152,13 @@ PyObject* TopoShapeCompoundPy::connectEdgesToWires(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject *TopoShapeCompoundPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int TopoShapeCompoundPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp index dd124fef39..981dd503b7 100644 --- a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp @@ -199,7 +199,7 @@ PyObject* TopoShapeEdgePy::getParameterByLength(PyObject *args) double u; double t=Precision::Confusion(); if (!PyArg_ParseTuple(args, "d|d",&u,&t)) - return 0; + return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); BRepAdaptor_Curve adapt(e); @@ -212,7 +212,7 @@ PyObject* TopoShapeEdgePy::getParameterByLength(PyObject *args) if (u < -length || u > length) { PyErr_SetString(PyExc_ValueError, "value out of range"); - return 0; + return nullptr; } if (u < 0) u = length+u; @@ -228,7 +228,7 @@ PyObject* TopoShapeEdgePy::valueAt(PyObject *args) { double u; if (!PyArg_ParseTuple(args, "d",&u)) - return 0; + return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); BRepAdaptor_Curve adapt(e); @@ -242,9 +242,9 @@ PyObject* TopoShapeEdgePy::valueAt(PyObject *args) PyObject* TopoShapeEdgePy::parameters(PyObject *args) { - PyObject* pyface = 0; + PyObject* pyface = nullptr; if (!PyArg_ParseTuple(args, "|O!", &(TopoShapeFacePy::Type), &pyface)) - return 0; + return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); TopLoc_Location aLoc; @@ -291,21 +291,21 @@ PyObject* TopoShapeEdgePy::parameters(PyObject *args) } else { PyErr_SetString(PyExc_ValueError, "Edge is not part of the face"); - return 0; + return nullptr; } } PyErr_SetString(PyExc_RuntimeError, "Edge has no polygon"); - return 0; + return nullptr; } PyObject* TopoShapeEdgePy::parameterAt(PyObject *args) { PyObject* pnt; - PyObject* face=0; + PyObject* face=nullptr; if (!PyArg_ParseTuple(args, "O!|O!",&TopoShapeVertexPy::Type,&pnt, &TopoShapeFacePy::Type,&face)) - return 0; + return nullptr; try { const TopoDS_Shape& v = static_cast(pnt)->getTopoShapePtr()->getShape(); @@ -324,7 +324,7 @@ PyObject* TopoShapeEdgePy::parameterAt(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -332,7 +332,7 @@ PyObject* TopoShapeEdgePy::tangentAt(PyObject *args) { double u; if (!PyArg_ParseTuple(args, "d",&u)) - return 0; + return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); BRepAdaptor_Curve adapt(e); @@ -345,7 +345,7 @@ PyObject* TopoShapeEdgePy::tangentAt(PyObject *args) } else { PyErr_SetString(PyExc_NotImplementedError, "Tangent not defined at this position!"); - return 0; + return nullptr; } } @@ -353,7 +353,7 @@ PyObject* TopoShapeEdgePy::normalAt(PyObject *args) { double u; if (!PyArg_ParseTuple(args, "d",&u)) - return 0; + return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); BRepAdaptor_Curve adapt(e); @@ -367,7 +367,7 @@ PyObject* TopoShapeEdgePy::normalAt(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -375,7 +375,7 @@ PyObject* TopoShapeEdgePy::curvatureAt(PyObject *args) { double u; if (!PyArg_ParseTuple(args, "d",&u)) - return 0; + return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); BRepAdaptor_Curve adapt(e); @@ -388,7 +388,7 @@ PyObject* TopoShapeEdgePy::curvatureAt(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -396,7 +396,7 @@ PyObject* TopoShapeEdgePy::centerOfCurvatureAt(PyObject *args) { double u; if (!PyArg_ParseTuple(args, "d",&u)) - return 0; + return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); BRepAdaptor_Curve adapt(e); @@ -410,7 +410,7 @@ PyObject* TopoShapeEdgePy::centerOfCurvatureAt(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -418,7 +418,7 @@ PyObject* TopoShapeEdgePy::derivative1At(PyObject *args) { double u; if (!PyArg_ParseTuple(args, "d",&u)) - return 0; + return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); BRepAdaptor_Curve adapt(e); @@ -431,7 +431,7 @@ PyObject* TopoShapeEdgePy::derivative1At(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -439,7 +439,7 @@ PyObject* TopoShapeEdgePy::derivative2At(PyObject *args) { double u; if (!PyArg_ParseTuple(args, "d",&u)) - return 0; + return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); BRepAdaptor_Curve adapt(e); @@ -452,7 +452,7 @@ PyObject* TopoShapeEdgePy::derivative2At(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -460,7 +460,7 @@ PyObject* TopoShapeEdgePy::derivative3At(PyObject *args) { double u; if (!PyArg_ParseTuple(args, "d",&u)) - return 0; + return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); BRepAdaptor_Curve adapt(e); @@ -473,7 +473,7 @@ PyObject* TopoShapeEdgePy::derivative3At(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -501,19 +501,19 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PyExc_TypeError, "Either int or float expected"); - return 0; + return nullptr; } } else { // use Number kwds - static char* kwds_numPoints[] = {"Number","First","Last",NULL}; + static char* kwds_numPoints[] = {"Number","First","Last",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "i|dd", kwds_numPoints, &numPoints, &first, &last)) { uniformAbscissaPoints = true; } else { // use Abscissa kwds - static char* kwds_Distance[] = {"Distance","First","Last",NULL}; + static char* kwds_Distance[] = {"Distance","First","Last",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_Distance, &distance, &first, &last)) { uniformAbscissaDistance = true; @@ -540,12 +540,12 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of edge failed"); - return 0; + return nullptr; } } // use Deflection kwds - static char* kwds_Deflection[] = {"Deflection","First","Last",NULL}; + static char* kwds_Deflection[] = {"Deflection","First","Last",nullptr}; PyErr_Clear(); double deflection; if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_Deflection, &deflection, &first, &last)) { @@ -562,12 +562,12 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of edge failed"); - return 0; + return nullptr; } } // use TangentialDeflection kwds - static char* kwds_TangentialDeflection[] = {"Angular","Curvature","First","Last","Minimum",NULL}; + static char* kwds_TangentialDeflection[] = {"Angular","Curvature","First","Last","Minimum",nullptr}; PyErr_Clear(); double angular; double curvature; @@ -586,12 +586,12 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of edge failed"); - return 0; + return nullptr; } } // use QuasiNumber kwds - static char* kwds_QuasiNumPoints[] = {"QuasiNumber","First","Last",NULL}; + static char* kwds_QuasiNumPoints[] = {"QuasiNumber","First","Last",nullptr}; PyErr_Clear(); int quasiNumPoints; if (PyArg_ParseTupleAndKeywords(args, kwds, "i|dd", kwds_QuasiNumPoints, &quasiNumPoints, &first, &last)) { @@ -608,12 +608,12 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of edge failed"); - return 0; + return nullptr; } } // use QuasiDeflection kwds - static char* kwds_QuasiDeflection[] = {"QuasiDeflection","First","Last",NULL}; + static char* kwds_QuasiDeflection[] = {"QuasiDeflection","First","Last",nullptr}; PyErr_Clear(); double quasiDeflection; if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_QuasiDeflection, &quasiDeflection, &first, &last)) { @@ -630,24 +630,24 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of edge failed"); - return 0; + return nullptr; } } } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError,"Wrong arguments"); - return 0; + return nullptr; } PyObject* TopoShapeEdgePy::split(PyObject *args) { PyObject* float_or_list; if (!PyArg_ParseTuple(args, "O", &float_or_list)) - return 0; + return nullptr; try { BRepAdaptor_Curve adapt(TopoDS::Edge(getTopoShapePtr()->getShape())); @@ -660,11 +660,11 @@ PyObject* TopoShapeEdgePy::split(PyObject *args) double val = PyFloat_AsDouble(float_or_list); if (val == f || val == l) { PyErr_SetString(PyExc_ValueError, "Cannot split edge at start or end point"); - return 0; + return nullptr; } else if (val < f || val > l) { PyErr_SetString(PyExc_ValueError, "Value out of parameter range"); - return 0; + return nullptr; } par.push_back(val); } @@ -674,18 +674,18 @@ PyObject* TopoShapeEdgePy::split(PyObject *args) double val = (double)Py::Float(*it); if (val == f || val == l) { PyErr_SetString(PyExc_ValueError, "Cannot split edge at start or end point"); - return 0; + return nullptr; } else if (val < f || val > l) { PyErr_SetString(PyExc_ValueError, "Value out of parameter range"); - return 0; + return nullptr; } par.push_back(val); } } else { PyErr_SetString(PyExc_TypeError, "Either float or list of floats expected"); - return 0; + return nullptr; } par.push_back(l); @@ -704,7 +704,7 @@ PyObject* TopoShapeEdgePy::split(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -712,7 +712,7 @@ PyObject* TopoShapeEdgePy::isSeam(PyObject *args) { PyObject* face; if (!PyArg_ParseTuple(args, "O!", &TopoShapeFacePy::Type, &face)) - return 0; + return nullptr; try { const TopoDS_Edge& e = TopoDS::Edge(this->getTopoShapePtr()->getShape()); @@ -725,7 +725,7 @@ PyObject* TopoShapeEdgePy::isSeam(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -733,7 +733,7 @@ PyObject* TopoShapeEdgePy::firstVertex(PyObject *args) { PyObject* orient = Py_False; if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &orient)) - return 0; + return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); TopoDS_Vertex v = TopExp::FirstVertex(e, PyObject_IsTrue(orient) ? Standard_True : Standard_False); return new TopoShapeVertexPy(new TopoShape(v)); @@ -743,7 +743,7 @@ PyObject* TopoShapeEdgePy::lastVertex(PyObject *args) { PyObject* orient = Py_False; if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &orient)) - return 0; + return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); TopoDS_Vertex v = TopExp::LastVertex(e, PyObject_IsTrue(orient) ? Standard_True : Standard_False); return new TopoShapeVertexPy(new TopoShape(v)); @@ -1022,7 +1022,7 @@ PyObject* TopoShapeEdgePy::curveOnSurface(PyObject *args) { int idx; if (!PyArg_ParseTuple(args, "i", &idx)) - return 0; + return nullptr; try { TopoDS_Edge edge = TopoDS::Edge(getTopoShapePtr()->getShape()); @@ -1059,13 +1059,13 @@ PyObject* TopoShapeEdgePy::curveOnSurface(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject *TopoShapeEdgePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int TopoShapeEdgePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/TopoShapeFacePyImp.cpp b/src/Mod/Part/App/TopoShapeFacePyImp.cpp index bb31201373..b3ce2ede69 100644 --- a/src/Mod/Part/App/TopoShapeFacePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeFacePyImp.cpp @@ -223,7 +223,7 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/) } PyErr_Clear(); - PyObject *bound=0; + PyObject *bound=nullptr; if (PyArg_ParseTuple(args, "O!|O!", &(GeometryPy::Type), &surf, &(PyList_Type), &bound)) { try { Handle(Geom_Surface) S = Handle(Geom_Surface)::DownCast @@ -326,7 +326,7 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/) } } - char* className = 0; + char* className = nullptr; PyObject* pcPyShapeOrList = nullptr; PyErr_Clear(); if (PyArg_ParseTuple(args, "Os", &pcPyShapeOrList, &className)) { @@ -429,12 +429,12 @@ PyObject* TopoShapeFacePy::makeOffset(PyObject *args) { double dist; if (!PyArg_ParseTuple(args, "d",&dist)) - return 0; + return nullptr; const TopoDS_Face& f = TopoDS::Face(getTopoShapePtr()->getShape()); BRepBuilderAPI_FindPlane findPlane(f); if (!findPlane.Found()) { PyErr_SetString(PartExceptionOCCError, "No planar face"); - return 0; + return nullptr; } BRepOffsetAPI_MakeOffset mkOffset(f); @@ -507,7 +507,7 @@ PyObject* TopoShapeFacePy::valueAt(PyObject *args) { double u,v; if (!PyArg_ParseTuple(args, "dd",&u,&v)) - return 0; + return nullptr; const TopoDS_Face& f = TopoDS::Face(getTopoShapePtr()->getShape()); @@ -540,14 +540,14 @@ PyObject* TopoShapeFacePy::normalAt(PyObject *args) PyObject* TopoShapeFacePy::getUVNodes(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; const TopoDS_Face& f = TopoDS::Face(getTopoShapePtr()->getShape()); TopLoc_Location aLoc; Handle (Poly_Triangulation) mesh = BRep_Tool::Triangulation(f,aLoc); if (mesh.IsNull()) { PyErr_SetString(PyExc_RuntimeError, "Face has no triangulation"); - return 0; + return nullptr; } Py::List list; @@ -581,7 +581,7 @@ PyObject* TopoShapeFacePy::tangentAt(PyObject *args) { double u,v; if (!PyArg_ParseTuple(args, "dd",&u,&v)) - return 0; + return nullptr; gp_Dir dir; Py::Tuple tuple(2); @@ -595,7 +595,7 @@ PyObject* TopoShapeFacePy::tangentAt(PyObject *args) } else { PyErr_SetString(PartExceptionOCCError, "tangent in u not defined"); - return 0; + return nullptr; } if (prop.IsTangentVDefined()) { prop.TangentV(dir); @@ -603,7 +603,7 @@ PyObject* TopoShapeFacePy::tangentAt(PyObject *args) } else { PyErr_SetString(PartExceptionOCCError, "tangent in v not defined"); - return 0; + return nullptr; } return Py::new_reference_to(tuple); @@ -613,7 +613,7 @@ PyObject* TopoShapeFacePy::curvatureAt(PyObject *args) { double u,v; if (!PyArg_ParseTuple(args, "dd",&u,&v)) - return 0; + return nullptr; Py::Tuple tuple(2); const TopoDS_Face& f = TopoDS::Face(getTopoShapePtr()->getShape()); @@ -626,7 +626,7 @@ PyObject* TopoShapeFacePy::curvatureAt(PyObject *args) } else { PyErr_SetString(PartExceptionOCCError, "curvature not defined"); - return 0; + return nullptr; } return Py::new_reference_to(tuple); @@ -636,7 +636,7 @@ PyObject* TopoShapeFacePy::derivative1At(PyObject *args) { double u,v; if (!PyArg_ParseTuple(args, "dd",&u,&v)) - return 0; + return nullptr; Py::Tuple tuple(2); const TopoDS_Face& f = TopoDS::Face(getTopoShapePtr()->getShape()); @@ -652,7 +652,7 @@ PyObject* TopoShapeFacePy::derivative1At(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -660,7 +660,7 @@ PyObject* TopoShapeFacePy::derivative2At(PyObject *args) { double u,v; if (!PyArg_ParseTuple(args, "dd",&u,&v)) - return 0; + return nullptr; Py::Tuple tuple(2); const TopoDS_Face& f = TopoDS::Face(getTopoShapePtr()->getShape()); @@ -676,7 +676,7 @@ PyObject* TopoShapeFacePy::derivative2At(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -684,7 +684,7 @@ PyObject* TopoShapeFacePy::isPartOfDomain(PyObject *args) { double u,v; if (!PyArg_ParseTuple(args, "dd",&u,&v)) - return 0; + return nullptr; const TopoDS_Face& face = TopoDS::Face(getTopoShapePtr()->getShape()); @@ -702,7 +702,7 @@ PyObject* TopoShapeFacePy::isPartOfDomain(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -710,7 +710,7 @@ PyObject* TopoShapeFacePy::makeHalfSpace(PyObject *args) { PyObject* pPnt; if (!PyArg_ParseTuple(args, "O!",&(Base::VectorPy::Type),&pPnt)) - return 0; + return nullptr; try { Base::Vector3d pt = Py::Vector(pPnt,false).toVector(); @@ -719,14 +719,14 @@ PyObject* TopoShapeFacePy::makeHalfSpace(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* TopoShapeFacePy::validate(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return 0; + return nullptr; try { const TopoDS_Face& face = TopoDS::Face(getTopoShapePtr()->getShape()); @@ -770,7 +770,7 @@ PyObject* TopoShapeFacePy::validate(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -778,13 +778,13 @@ PyObject* TopoShapeFacePy::curveOnSurface(PyObject *args) { PyObject* e; if (!PyArg_ParseTuple(args, "O!", &(TopoShapeEdgePy::Type), &e)) - return 0; + return nullptr; try { TopoDS_Shape shape = static_cast(e)->getTopoShapePtr()->getShape(); if (shape.IsNull()) { PyErr_SetString(PyExc_RuntimeError, "invalid shape"); - return 0; + return nullptr; } TopoDS_Edge edge = TopoDS::Edge(shape); @@ -804,13 +804,13 @@ PyObject* TopoShapeFacePy::curveOnSurface(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* TopoShapeFacePy::cutHoles(PyObject *args) { - PyObject *holes=0; + PyObject *holes=nullptr; if (PyArg_ParseTuple(args, "O!", &(PyList_Type), &holes)) { try { std::vector wires; @@ -867,11 +867,11 @@ PyObject* TopoShapeFacePy::cutHoles(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyErr_SetString(PyExc_RuntimeError, "invalid list of wires"); - return 0; + return nullptr; } @@ -879,7 +879,7 @@ Py::Object TopoShapeFacePy::getSurface() const { const TopoDS_Face& f = TopoDS::Face(getTopoShapePtr()->getShape()); BRepAdaptor_Surface adapt(f); - Base::PyObjectBase* surface = 0; + Base::PyObjectBase* surface = nullptr; switch(adapt.GetType()) { case GeomAbs_Plane: @@ -1141,7 +1141,7 @@ Py::Dict TopoShapeFacePy::getPrincipalProperties(void) const PyObject *TopoShapeFacePy::getCustomAttributes(const char* ) const { - return 0; + return nullptr; } int TopoShapeFacePy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp index 6ac6efce3b..e4b8a7d95a 100644 --- a/src/Mod/Part/App/TopoShapePyImp.cpp +++ b/src/Mod/Part/App/TopoShapePyImp.cpp @@ -124,7 +124,7 @@ PyObject *TopoShapePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // int TopoShapePy::PyInit(PyObject* args, PyObject*) { - PyObject *pcObj=0; + PyObject *pcObj=nullptr; if (!PyArg_ParseTuple(args, "|O", &pcObj)) return -1; @@ -165,17 +165,17 @@ PyObject* TopoShapePy::copy(PyObject *args) PyObject* copyGeom = Py_True; PyObject* copyMesh = Py_False; if (!PyArg_ParseTuple(args, "|O!O!", &PyBool_Type, ©Geom, &PyBool_Type, ©Mesh)) - return NULL; + return nullptr; const TopoDS_Shape& shape = this->getTopoShapePtr()->getShape(); PyTypeObject* type = this->GetType(); - PyObject* cpy = 0; + PyObject* cpy = nullptr; // let the type object decide if (type->tp_new) - cpy = type->tp_new(type, this, 0); + cpy = type->tp_new(type, this, nullptr); if (!cpy) { PyErr_SetString(PyExc_TypeError, "failed to create copy of shape"); - return 0; + return nullptr; } if (!shape.IsNull()) { @@ -195,17 +195,17 @@ PyObject* TopoShapePy::copy(PyObject *args) PyObject* TopoShapePy::cleaned(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; const TopoDS_Shape& shape = this->getTopoShapePtr()->getShape(); PyTypeObject* type = this->GetType(); - PyObject* cpy = 0; + PyObject* cpy = nullptr; // let the type object decide if (type->tp_new) - cpy = type->tp_new(type, this, 0); + cpy = type->tp_new(type, this, nullptr); if (!cpy) { PyErr_SetString(PyExc_TypeError, "failed to create copy of shape"); - return 0; + return nullptr; } if (!shape.IsNull()) { @@ -221,7 +221,7 @@ PyObject* TopoShapePy::replaceShape(PyObject *args) { PyObject *l; if (!PyArg_ParseTuple(args, "O",&l)) - return NULL; + return nullptr; try { Py::Sequence list(l); @@ -236,17 +236,17 @@ PyObject* TopoShapePy::replaceShape(PyObject *args) ); } PyTypeObject* type = this->GetType(); - PyObject* inst = type->tp_new(type, this, 0); + PyObject* inst = type->tp_new(type, this, nullptr); static_cast(inst)->getTopoShapePtr()->setShape (this->getTopoShapePtr()->replaceShape(shapes)); return inst; } catch (const Py::Exception&) { - return 0; + return nullptr; } catch (...) { PyErr_SetString(PartExceptionOCCError, "failed to replace shape"); - return 0; + return nullptr; } } @@ -254,7 +254,7 @@ PyObject* TopoShapePy::removeShape(PyObject *args) { PyObject *l; if (!PyArg_ParseTuple(args, "O",&l)) - return NULL; + return nullptr; try { Py::Sequence list(l); @@ -266,14 +266,14 @@ PyObject* TopoShapePy::removeShape(PyObject *args) ); } PyTypeObject* type = this->GetType(); - PyObject* inst = type->tp_new(type, this, 0); + PyObject* inst = type->tp_new(type, this, nullptr); static_cast(inst)->getTopoShapePtr()->setShape (this->getTopoShapePtr()->removeShape(shapes)); return inst; } catch (...) { PyErr_SetString(PartExceptionOCCError, "failed to remove shape"); - return 0; + return nullptr; } } @@ -281,7 +281,7 @@ PyObject* TopoShapePy::read(PyObject *args) { char* Name; if (!PyArg_ParseTuple(args, "et","utf-8",&Name)) - return NULL; + return nullptr; std::string EncodedName = std::string(Name); PyMem_Free(Name); @@ -291,14 +291,14 @@ PyObject* TopoShapePy::read(PyObject *args) PyObject* TopoShapePy::writeInventor(PyObject * args, PyObject * keywds) { - static char *kwlist[] = {"Mode", "Deviation", "Angle", "FaceColors", NULL}; + static char *kwlist[] = {"Mode", "Deviation", "Angle", "FaceColors", nullptr}; double dev=0.3, angle=0.4; int mode=2; PyObject* pylist=nullptr; if (!PyArg_ParseTupleAndKeywords(args, keywds, "|iddO", kwlist, &mode,&dev,&angle,&pylist)) - return NULL; + return nullptr; std::vector faceColors; if (pylist) { @@ -326,7 +326,7 @@ PyObject* TopoShapePy::exportIges(PyObject *args) { char* Name; if (!PyArg_ParseTuple(args, "et","utf-8",&Name)) - return NULL; + return nullptr; std::string EncodedName = std::string(Name); PyMem_Free(Name); @@ -336,7 +336,7 @@ PyObject* TopoShapePy::exportIges(PyObject *args) } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } Py_Return; @@ -346,7 +346,7 @@ PyObject* TopoShapePy::exportStep(PyObject *args) { char* Name; if (!PyArg_ParseTuple(args, "et","utf-8",&Name)) - return NULL; + return nullptr; std::string EncodedName = std::string(Name); PyMem_Free(Name); @@ -356,7 +356,7 @@ PyObject* TopoShapePy::exportStep(PyObject *args) } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } Py_Return; @@ -375,7 +375,7 @@ PyObject* TopoShapePy::exportBrep(PyObject *args) } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } Py_Return; @@ -388,27 +388,27 @@ PyObject* TopoShapePy::exportBrep(PyObject *args) try { // write brep Base::PyStreambuf buf(input); - std::ostream str(0); + std::ostream str(nullptr); str.rdbuf(&buf); getTopoShapePtr()->exportBrep(str); } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } Py_Return; } PyErr_SetString(PyExc_TypeError, "expect string or file object"); - return NULL; + return nullptr; } PyObject* TopoShapePy::exportBinary(PyObject *args) { char* input; if (!PyArg_ParseTuple(args, "s", &input)) - return NULL; + return nullptr; try { // read binary brep @@ -418,7 +418,7 @@ PyObject* TopoShapePy::exportBinary(PyObject *args) } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } Py_Return; @@ -427,7 +427,7 @@ PyObject* TopoShapePy::exportBinary(PyObject *args) PyObject* TopoShapePy::dumpToString(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; try { std::stringstream str; @@ -436,23 +436,23 @@ PyObject* TopoShapePy::dumpToString(PyObject *args) } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* TopoShapePy::exportBrepToString(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; try { // write brep file @@ -462,16 +462,16 @@ PyObject* TopoShapePy::exportBrepToString(PyObject *args) } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -488,7 +488,7 @@ PyObject* TopoShapePy::importBrep(PyObject *args) } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } Py_Return; @@ -500,27 +500,27 @@ PyObject* TopoShapePy::importBrep(PyObject *args) try { // read brep Base::PyStreambuf buf(input); - std::istream str(0); + std::istream str(nullptr); str.rdbuf(&buf); getTopoShapePtr()->importBrep(str); } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } Py_Return; } PyErr_SetString(PyExc_TypeError, "expect string or file object"); - return NULL; + return nullptr; } PyObject* TopoShapePy::importBinary(PyObject *args) { char* input; if (!PyArg_ParseTuple(args, "s", &input)) - return NULL; + return nullptr; try { // read binary brep @@ -530,7 +530,7 @@ PyObject* TopoShapePy::importBinary(PyObject *args) } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } Py_Return; @@ -541,7 +541,7 @@ PyObject* TopoShapePy::importBrepFromString(PyObject *args) char* input; int indicator=1; if (!PyArg_ParseTuple(args, "s|i", &input, &indicator)) - return NULL; + return nullptr; try { // read brep @@ -550,16 +550,16 @@ PyObject* TopoShapePy::importBrepFromString(PyObject *args) } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return NULL; + return nullptr; } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -573,7 +573,7 @@ PyObject* TopoShapePy::__getstate__(PyObject *args) { PyObject* TopoShapePy::__setstate__(PyObject *args) { if (! getTopoShapePtr()) { PyErr_SetString(Base::PyExc_FC_GeneralError,"no c++ object"); - return 0; + return nullptr; } else { return importBrepFromString(args); @@ -585,7 +585,7 @@ PyObject* TopoShapePy::exportStl(PyObject *args) double deflection = 0.01; char* Name; if (!PyArg_ParseTuple(args, "et|d","utf-8",&Name,&deflection)) - return NULL; + return nullptr; std::string EncodedName = std::string(Name); PyMem_Free(Name); @@ -595,12 +595,12 @@ PyObject* TopoShapePy::exportStl(PyObject *args) } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError,e.what()); - return 0; + return nullptr; } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } Py_Return; @@ -639,16 +639,16 @@ PyObject* TopoShapePy::extrude(PyObject *args) } PyErr_SetString(PartExceptionOCCError, "extrusion for this shape type not supported"); - return 0; + return nullptr; } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } - return 0; + return nullptr; } PyObject* TopoShapePy::revolve(PyObject *args) @@ -660,19 +660,19 @@ PyObject* TopoShapePy::revolve(PyObject *args) const TopoDS_Shape& input = this->getTopoShapePtr()->getShape(); if (input.IsNull()) { PyErr_SetString(PartExceptionOCCError, "empty shape cannot be revolved"); - return 0; + return nullptr; } TopExp_Explorer xp; xp.Init(input,TopAbs_SOLID); if (xp.More()) { PyErr_SetString(PartExceptionOCCError, "shape must not contain solids"); - return 0; + return nullptr; } xp.Init(input,TopAbs_COMPSOLID); if (xp.More()) { PyErr_SetString(PartExceptionOCCError, "shape must not contain compound solids"); - return 0; + return nullptr; } Base::Vector3d pos = static_cast(pPos)->value(); @@ -705,28 +705,28 @@ PyObject* TopoShapePy::revolve(PyObject *args) } PyErr_SetString(PartExceptionOCCError, "revolution for this shape type not supported"); - return 0; + return nullptr; } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } - return 0; + return nullptr; } PyObject* TopoShapePy::check(PyObject *args) { PyObject* runBopCheck = Py_False; if (!PyArg_ParseTuple(args, "|O!", &(PyBool_Type), &runBopCheck)) - return NULL; + return nullptr; if (!getTopoShapePtr()->getShape().IsNull()) { std::stringstream str; if (!getTopoShapePtr()->analyze(PyObject_IsTrue(runBopCheck) ? true : false, str)) { PyErr_SetString(PyExc_ValueError, str.str().c_str()); - return NULL; + return nullptr; } } @@ -746,11 +746,11 @@ PyObject* TopoShapePy::fuse(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -766,11 +766,11 @@ PyObject* TopoShapePy::fuse(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -785,7 +785,7 @@ PyObject* TopoShapePy::fuse(PyObject *args) } else { PyErr_SetString(PyExc_TypeError, "non-shape object in sequence"); - return 0; + return nullptr; } } try { @@ -794,16 +794,16 @@ PyObject* TopoShapePy::fuse(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } PyErr_SetString(PyExc_TypeError, "shape or sequence of shape expected"); - return 0; + return nullptr; } PyObject* TopoShapePy::multiFuse(PyObject *args) @@ -811,7 +811,7 @@ PyObject* TopoShapePy::multiFuse(PyObject *args) double tolerance = 0.0; PyObject *pcObj; if (!PyArg_ParseTuple(args, "O|d", &pcObj, &tolerance)) - return NULL; + return nullptr; std::vector shapeVec; Py::Sequence shapeSeq(pcObj); for (Py::Sequence::iterator it = shapeSeq.begin(); it != shapeSeq.end(); ++it) { @@ -821,7 +821,7 @@ PyObject* TopoShapePy::multiFuse(PyObject *args) } else { PyErr_SetString(PyExc_TypeError, "non-shape object in sequence"); - return 0; + return nullptr; } } try { @@ -831,11 +831,11 @@ PyObject* TopoShapePy::multiFuse(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -843,7 +843,7 @@ PyObject* TopoShapePy::oldFuse(PyObject *args) { PyObject *pcObj; if (!PyArg_ParseTuple(args, "O!", &(TopoShapePy::Type), &pcObj)) - return NULL; + return nullptr; TopoDS_Shape shape = static_cast(pcObj)->getTopoShapePtr()->getShape(); try { @@ -854,11 +854,11 @@ PyObject* TopoShapePy::oldFuse(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -875,11 +875,11 @@ PyObject* TopoShapePy::common(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -894,11 +894,11 @@ PyObject* TopoShapePy::common(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -913,7 +913,7 @@ PyObject* TopoShapePy::common(PyObject *args) } else { PyErr_SetString(PyExc_TypeError, "non-shape object in sequence"); - return 0; + return nullptr; } } try { @@ -923,16 +923,16 @@ PyObject* TopoShapePy::common(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } PyErr_SetString(PyExc_TypeError, "shape or sequence of shape expected"); - return 0; + return nullptr; } PyObject* TopoShapePy::section(PyObject *args) @@ -949,11 +949,11 @@ PyObject* TopoShapePy::section(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -968,11 +968,11 @@ PyObject* TopoShapePy::section(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -987,7 +987,7 @@ PyObject* TopoShapePy::section(PyObject *args) } else { PyErr_SetString(PyExc_TypeError, "non-shape object in sequence"); - return 0; + return nullptr; } } try { @@ -997,16 +997,16 @@ PyObject* TopoShapePy::section(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } PyErr_SetString(PyExc_TypeError, "shape or sequence of shape expected"); - return 0; + return nullptr; } PyObject* TopoShapePy::slice(PyObject *args) @@ -1014,7 +1014,7 @@ PyObject* TopoShapePy::slice(PyObject *args) PyObject *dir; double d; if (!PyArg_ParseTuple(args, "O!d", &(Base::VectorPy::Type), &dir, &d)) - return NULL; + return nullptr; try { Base::Vector3d vec = Py::Vector(dir, false).toVector(); @@ -1029,11 +1029,11 @@ PyObject* TopoShapePy::slice(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -1041,7 +1041,7 @@ PyObject* TopoShapePy::slices(PyObject *args) { PyObject *dir, *dist; if (!PyArg_ParseTuple(args, "O!O", &(Base::VectorPy::Type), &dir, &dist)) - return NULL; + return nullptr; try { Base::Vector3d vec = Py::Vector(dir, false).toVector(); @@ -1056,11 +1056,11 @@ PyObject* TopoShapePy::slices(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -1077,11 +1077,11 @@ PyObject* TopoShapePy::cut(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -1096,11 +1096,11 @@ PyObject* TopoShapePy::cut(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -1115,7 +1115,7 @@ PyObject* TopoShapePy::cut(PyObject *args) } else { PyErr_SetString(PyExc_TypeError, "non-shape object in sequence"); - return 0; + return nullptr; } } try { @@ -1125,16 +1125,16 @@ PyObject* TopoShapePy::cut(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } PyErr_SetString(PyExc_TypeError, "shape or sequence of shape expected"); - return 0; + return nullptr; } PyObject* TopoShapePy::generalFuse(PyObject *args) @@ -1142,7 +1142,7 @@ PyObject* TopoShapePy::generalFuse(PyObject *args) double tolerance = 0.0; PyObject *pcObj; if (!PyArg_ParseTuple(args, "O|d", &pcObj, &tolerance)) - return NULL; + return nullptr; std::vector shapeVec; Py::Sequence shapeSeq(pcObj); for (Py::Sequence::iterator it = shapeSeq.begin(); it != shapeSeq.end(); ++it) { @@ -1152,7 +1152,7 @@ PyObject* TopoShapePy::generalFuse(PyObject *args) } else { PyErr_SetString(PyExc_TypeError, "non-shape object in sequence"); - return 0; + return nullptr; } } try { @@ -1177,11 +1177,11 @@ PyObject* TopoShapePy::generalFuse(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } catch (const std::exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return NULL; + return nullptr; } } @@ -1198,7 +1198,7 @@ PyObject* TopoShapePy::sewShape(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -1208,13 +1208,13 @@ PyObject* TopoShapePy::childShapes(PyObject *args) PyObject* cumLoc = Py_True; if (!PyArg_ParseTuple(args, "|O!O!", &(PyBool_Type), &cumOri, &(PyBool_Type), &cumLoc)) - return NULL; + return nullptr; try { const TopoDS_Shape& shape = getTopoShapePtr()->getShape(); if (shape.IsNull()) { PyErr_SetString(PyExc_ValueError, "Shape is null"); - return NULL; + return nullptr; } TopoDS_Iterator it(shape, PyObject_IsTrue(cumOri) ? Standard_True : Standard_False, @@ -1224,7 +1224,7 @@ PyObject* TopoShapePy::childShapes(PyObject *args) const TopoDS_Shape& aChild = it.Value(); if (!aChild.IsNull()) { TopAbs_ShapeEnum type = aChild.ShapeType(); - PyObject* pyChild = 0; + PyObject* pyChild = nullptr; switch (type) { case TopAbs_COMPOUND: @@ -1267,7 +1267,7 @@ PyObject* TopoShapePy::childShapes(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -1293,7 +1293,7 @@ PyObject* TopoShapePy::ancestorsOfType(PyObject *args) PyObject *pcObj; PyObject *type; if (!PyArg_ParseTuple(args, "O!O!", &(TopoShapePy::Type), &pcObj, &PyType_Type, &type)) - return NULL; + return nullptr; try { const TopoDS_Shape& model = getTopoShapePtr()->getShape(); @@ -1301,7 +1301,7 @@ PyObject* TopoShapePy::ancestorsOfType(PyObject *args) getTopoShapePtr()->getShape(); if (model.IsNull() || shape.IsNull()) { PyErr_SetString(PyExc_ValueError, "Shape is null"); - return NULL; + return nullptr; } static std::vector typeMap = buildShapeEnumTypeMap(); @@ -1336,7 +1336,7 @@ PyObject* TopoShapePy::ancestorsOfType(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -1344,7 +1344,7 @@ PyObject* TopoShapePy::removeInternalWires(PyObject *args) { double minArea; if (!PyArg_ParseTuple(args, "d",&minArea)) - return NULL; + return nullptr; try { bool ok = getTopoShapePtr()->removeInternalWires(minArea); @@ -1355,7 +1355,7 @@ PyObject* TopoShapePy::removeInternalWires(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -1364,7 +1364,7 @@ PyObject* TopoShapePy::mirror(PyObject *args) PyObject *v1, *v2; if (!PyArg_ParseTuple(args, "O!O!", &(Base::VectorPy::Type),&v1, &(Base::VectorPy::Type),&v2)) - return NULL; + return nullptr; Base::Vector3d base = Py::Vector(v1,false).toVector(); Base::Vector3d norm = Py::Vector(v2,false).toVector(); @@ -1377,7 +1377,7 @@ PyObject* TopoShapePy::mirror(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -1385,7 +1385,7 @@ PyObject* TopoShapePy::transformGeometry(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!", &(Base::MatrixPy::Type),&obj)) - return NULL; + return nullptr; Base::Matrix4D mat = static_cast(obj)->value(); try { @@ -1395,7 +1395,7 @@ PyObject* TopoShapePy::transformGeometry(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -1405,7 +1405,7 @@ PyObject* TopoShapePy::transformShape(PyObject *args) PyObject *copy = Py_False; PyObject *checkScale = Py_False; if (!PyArg_ParseTuple(args, "O!|O!O", &(Base::MatrixPy::Type),&obj,&(PyBool_Type), ©,&checkScale)) - return NULL; + return nullptr; Base::Matrix4D mat = static_cast(obj)->value(); PY_TRY { @@ -1417,14 +1417,14 @@ PyObject* TopoShapePy::transformShape(PyObject *args) PyObject* TopoShapePy::transformed(PyObject *args, PyObject *keywds) { - static char *kwlist[] = {"matrix", "copy", "checkScale", "op", NULL}; + static char *kwlist[] = {"matrix", "copy", "checkScale", "op", nullptr}; PyObject* pymat; PyObject* copy = Py_False; PyObject* checkScale = Py_False; - const char *op = 0; + const char *op = nullptr; if (!PyArg_ParseTupleAndKeywords(args, keywds, "O!|OOs", kwlist, &Base::MatrixPy::Type, &pymat,©,&checkScale,&op)) - return 0; + return nullptr; Base::Matrix4D mat = static_cast(pymat)->value(); (void)op; PY_TRY { @@ -1438,7 +1438,7 @@ PyObject* TopoShapePy::translate(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O", &obj)) - return 0; + return nullptr; Base::Vector3d vec; if (PyObject_TypeCheck(obj, &(Base::VectorPy::Type))) { @@ -1449,7 +1449,7 @@ PyObject* TopoShapePy::translate(PyObject *args) } else { PyErr_SetString(PyExc_TypeError, "either vector or tuple expected"); - return 0; + return nullptr; } gp_Trsf mov; @@ -1466,7 +1466,7 @@ PyObject* TopoShapePy::rotate(PyObject *args) PyObject *obj1, *obj2; double angle; if (!PyArg_ParseTuple(args, "OOd", &obj1, &obj2, &angle)) - return NULL; + return nullptr; PY_TRY { // Vector also supports sequence @@ -1493,7 +1493,7 @@ PyObject* TopoShapePy::rotate(PyObject *args) PyObject* TopoShapePy::scale(PyObject *args) { double factor; - PyObject* p=0; + PyObject* p=nullptr; if (!PyArg_ParseTuple(args, "d|O!", &factor, &(Base::VectorPy::Type), &p)) return nullptr; @@ -1562,7 +1562,7 @@ PyObject* TopoShapePy::makeFillet(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -1588,14 +1588,14 @@ PyObject* TopoShapePy::makeFillet(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } PyErr_SetString(PyExc_TypeError, "This method accepts:\n" "-- one radius and a list of edges\n" "-- two radii and a list of edges"); - return NULL; + return nullptr; } PyObject* TopoShapePy::makeChamfer(PyObject *args) @@ -1627,7 +1627,7 @@ PyObject* TopoShapePy::makeChamfer(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -1662,14 +1662,14 @@ PyObject* TopoShapePy::makeChamfer(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } PyErr_SetString(PyExc_TypeError, "This method accepts:\n" "-- one radius and a list of edges\n" "-- two radii and a list of edges"); - return NULL; + return nullptr; } PyObject* TopoShapePy::makeThickness(PyObject *args) @@ -1685,7 +1685,7 @@ PyObject* TopoShapePy::makeThickness(PyObject *args) &(PyBool_Type), &inter, &(PyBool_Type), &self_inter, &offsetMode, &join)) - return 0; + return nullptr; try { TopTools_ListOfShape facesToRemove; @@ -1704,13 +1704,13 @@ PyObject* TopoShapePy::makeThickness(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } PyObject* TopoShapePy::makeOffsetShape(PyObject *args, PyObject *keywds) { - static char *kwlist[] = {"offset", "tolerance", "inter", "self_inter", "offsetMode", "join", "fill", NULL}; + static char *kwlist[] = {"offset", "tolerance", "inter", "self_inter", "offsetMode", "join", "fill", nullptr}; double offset, tolerance; PyObject* inter = Py_False; PyObject* self_inter = Py_False; @@ -1722,7 +1722,7 @@ PyObject* TopoShapePy::makeOffsetShape(PyObject *args, PyObject *keywds) &(PyBool_Type), &self_inter, &offsetMode, &join, &(PyBool_Type), &fill)) - return 0; + return nullptr; try { TopoDS_Shape shape = this->getTopoShapePtr()->makeOffsetShape(offset, tolerance, @@ -1734,13 +1734,13 @@ PyObject* TopoShapePy::makeOffsetShape(PyObject *args, PyObject *keywds) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } PyObject* TopoShapePy::makeOffset2D(PyObject *args, PyObject *keywds) { - static char *kwlist[] = {"offset", "join", "fill", "openResult", "intersection", NULL}; + static char *kwlist[] = {"offset", "join", "fill", "openResult", "intersection", nullptr}; double offset; PyObject* fill = Py_False; PyObject* openResult = Py_False; @@ -1752,7 +1752,7 @@ PyObject* TopoShapePy::makeOffset2D(PyObject *args, PyObject *keywds) &(PyBool_Type), &fill, &(PyBool_Type), &openResult, &(PyBool_Type), &inter)) - return 0; + return nullptr; try { TopoDS_Shape resultShape = this->getTopoShapePtr()->makeOffset2D(offset, join, @@ -1767,7 +1767,7 @@ PyObject* TopoShapePy::makeOffset2D(PyObject *args, PyObject *keywds) PyObject* TopoShapePy::reverse(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; TopoDS_Shape shape = getTopoShapePtr()->getShape(); shape.Reverse(); @@ -1778,7 +1778,7 @@ PyObject* TopoShapePy::reverse(PyObject *args) PyObject* TopoShapePy::reversed(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; TopoDS_Shape shape = getTopoShapePtr()->getShape(); shape = shape.Reversed(); @@ -1788,7 +1788,7 @@ PyObject* TopoShapePy::reversed(PyObject *args) // let the type object decide if (type->tp_new) - cpy = type->tp_new(type, this, 0); + cpy = type->tp_new(type, this, nullptr); if (!cpy) { PyErr_SetString(PyExc_TypeError, "failed to create copy of shape"); return nullptr; @@ -1803,7 +1803,7 @@ PyObject* TopoShapePy::reversed(PyObject *args) PyObject* TopoShapePy::complement(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; TopoDS_Shape shape = getTopoShapePtr()->getShape(); shape.Complement(); @@ -1814,7 +1814,7 @@ PyObject* TopoShapePy::complement(PyObject *args) PyObject* TopoShapePy::nullify(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; TopoDS_Shape shape = getTopoShapePtr()->getShape(); shape.Nullify(); @@ -1825,7 +1825,7 @@ PyObject* TopoShapePy::nullify(PyObject *args) PyObject* TopoShapePy::isNull(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; bool null = getTopoShapePtr()->isNull(); return Py_BuildValue("O", (null ? Py_True : Py_False)); } @@ -1833,7 +1833,7 @@ PyObject* TopoShapePy::isNull(PyObject *args) PyObject* TopoShapePy::isClosed(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; try { if (getTopoShapePtr()->getShape().IsNull()) Standard_Failure::Raise("Cannot determine the 'Closed'' flag of an empty shape"); @@ -1841,7 +1841,7 @@ PyObject* TopoShapePy::isClosed(PyObject *args) } catch (...) { PyErr_SetString(PyExc_RuntimeError, "check failed, shape may be empty"); - return NULL; + return nullptr; } } @@ -1849,7 +1849,7 @@ PyObject* TopoShapePy::isEqual(PyObject *args) { PyObject *pcObj; if (!PyArg_ParseTuple(args, "O!", &(TopoShapePy::Type), &pcObj)) - return NULL; + return nullptr; TopoDS_Shape shape = static_cast(pcObj)->getTopoShapePtr()->getShape(); Standard_Boolean test = (getTopoShapePtr()->getShape().IsEqual(shape)); @@ -1860,7 +1860,7 @@ PyObject* TopoShapePy::isSame(PyObject *args) { PyObject *pcObj; if (!PyArg_ParseTuple(args, "O!", &(TopoShapePy::Type), &pcObj)) - return NULL; + return nullptr; TopoDS_Shape shape = static_cast(pcObj)->getTopoShapePtr()->getShape(); Standard_Boolean test = getTopoShapePtr()->getShape().IsSame(shape); @@ -1871,7 +1871,7 @@ PyObject* TopoShapePy::isPartner(PyObject *args) { PyObject *pcObj; if (!PyArg_ParseTuple(args, "O!", &(TopoShapePy::Type), &pcObj)) - return NULL; + return nullptr; TopoDS_Shape shape = static_cast(pcObj)->getTopoShapePtr()->getShape(); Standard_Boolean test = getTopoShapePtr()->getShape().IsPartner(shape); @@ -1881,7 +1881,7 @@ PyObject* TopoShapePy::isPartner(PyObject *args) PyObject* TopoShapePy::isValid(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; PY_TRY { return Py_BuildValue("O", (getTopoShapePtr()->isValid() ? Py_True : Py_False)); } PY_CATCH_OCC @@ -1892,7 +1892,7 @@ PyObject* TopoShapePy::isCoplanar(PyObject *args) PyObject *pyObj; double tol = -1; if (!PyArg_ParseTuple(args, "O!|d", &TopoShapePy::Type, &pyObj, &tol)) - return NULL; + return nullptr; PY_TRY { return Py::new_reference_to(Py::Boolean(getTopoShapePtr()->isCoplanar( *static_cast(pyObj)->getTopoShapePtr(),tol))); @@ -1914,7 +1914,7 @@ PyObject* TopoShapePy::findPlane(PyObject *args) { double tol = -1; if (!PyArg_ParseTuple(args, "|d", &tol)) - return NULL; + return nullptr; PY_TRY { gp_Pln pln; if(getTopoShapePtr()->findPlane(pln,tol)) @@ -1927,13 +1927,13 @@ PyObject* TopoShapePy::fix(PyObject *args) { double prec, mintol, maxtol; if (!PyArg_ParseTuple(args, "ddd", &prec, &mintol, &maxtol)) - return NULL; + return nullptr; try { return Py_BuildValue("O", (getTopoShapePtr()->fix(prec, mintol, maxtol) ? Py_True : Py_False)); } catch (...) { PyErr_SetString(PyExc_RuntimeError, "check failed, shape may be empty"); - return NULL; + return nullptr; } } @@ -1941,7 +1941,7 @@ PyObject* TopoShapePy::hashCode(PyObject *args) { int upper = IntegerLast(); if (!PyArg_ParseTuple(args, "|i",&upper)) - return 0; + return nullptr; int hc = getTopoShapePtr()->getShape().HashCode(upper); return Py_BuildValue("i", hc); } @@ -1952,7 +1952,7 @@ PyObject* TopoShapePy::tessellate(PyObject *args) float tolerance; PyObject* ok = Py_False; if (!PyArg_ParseTuple(args, "f|O!",&tolerance,&PyBool_Type,&ok)) - return 0; + return nullptr; std::vector Points; std::vector Facets; if (PyObject_IsTrue(ok)) @@ -1979,7 +1979,7 @@ PyObject* TopoShapePy::tessellate(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -2008,11 +2008,11 @@ PyObject* TopoShapePy::project(PyObject *args) } catch (Standard_Failure&) { PyErr_SetString(PartExceptionOCCError, "Failed to project shape"); - return NULL; + return nullptr; } } - return 0; + return nullptr; } PyObject* TopoShapePy::makeParallelProjection(PyObject *args) @@ -2030,11 +2030,11 @@ PyObject* TopoShapePy::makeParallelProjection(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } - return 0; + return nullptr; } PyObject* TopoShapePy::makePerspectiveProjection(PyObject *args) @@ -2052,11 +2052,11 @@ PyObject* TopoShapePy::makePerspectiveProjection(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } - return 0; + return nullptr; } /*! @@ -2168,9 +2168,9 @@ PyObject* TopoShapePy::makeShapeFromMesh(PyObject *args) } PyObject* TopoShapePy::makeWires(PyObject *args) { - const char *op = 0; + const char *op = nullptr; if (!PyArg_ParseTuple(args, "s", &op)) - return NULL; + return nullptr; PY_TRY { return Py::new_reference_to(shape2pyshape(getTopoShapePtr()->makeWires(op))); }PY_CATCH_OCC @@ -2179,7 +2179,7 @@ PyObject* TopoShapePy::makeWires(PyObject *args) { PyObject* TopoShapePy::toNurbs(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; try { // Convert into nurbs @@ -2189,7 +2189,7 @@ PyObject* TopoShapePy::toNurbs(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -2249,7 +2249,7 @@ PyObject* TopoShapePy::isInside(PyObject *args) PyObject* TopoShapePy::removeSplitter(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; try { // Remove redundant splitter @@ -2259,7 +2259,7 @@ PyObject* TopoShapePy::removeSplitter(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -2267,7 +2267,7 @@ PyObject* TopoShapePy::getElement(PyObject *args) { char* input; if (!PyArg_ParseTuple(args, "s", &input)) - return NULL; + return nullptr; std::string name(input); try { @@ -2293,16 +2293,16 @@ PyObject* TopoShapePy::getElement(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } - return 0; + return nullptr; } PyObject* TopoShapePy::countElement(PyObject *args) { char* input; if (!PyArg_ParseTuple(args, "s", &input)) - return NULL; + return nullptr; PY_TRY { return Py::new_reference_to(Py::Int((long)getTopoShapePtr()->countSubShapes(input))); } PY_CATCH_OCC @@ -2311,16 +2311,16 @@ PyObject* TopoShapePy::countElement(PyObject *args) PyObject* TopoShapePy::getTolerance(PyObject *args) { int mode; - PyObject* type=0; + PyObject* type=nullptr; if (!PyArg_ParseTuple(args, "i|O!", &mode, &PyType_Type, &type)) - return NULL; + return nullptr; try { TopoDS_Shape shape = this->getTopoShapePtr()->getShape(); TopAbs_ShapeEnum shapetype = TopAbs_SHAPE; PyTypeObject* pyType = reinterpret_cast(type); - if (pyType == 0) + if (pyType == nullptr) shapetype = TopAbs_SHAPE; else if (PyType_IsSubtype(pyType, &TopoShapeShellPy::Type)) shapetype = TopAbs_SHELL; @@ -2333,11 +2333,11 @@ PyObject* TopoShapePy::getTolerance(PyObject *args) else if (pyType != &TopoShapePy::Type) { if (PyType_IsSubtype(pyType, &TopoShapePy::Type)) { PyErr_SetString(PyExc_TypeError, "shape type must be Vertex, Edge, Face or Shell"); - return 0; + return nullptr; } else { PyErr_SetString(PyExc_TypeError, "type must be a shape type"); - return 0; + return nullptr; } } @@ -2348,23 +2348,23 @@ PyObject* TopoShapePy::getTolerance(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } PyObject* TopoShapePy::overTolerance(PyObject *args) { double value; - PyObject* type=0; + PyObject* type=nullptr; if (!PyArg_ParseTuple(args, "d|O!", &value, &PyType_Type, &type)) - return NULL; + return nullptr; try { TopoDS_Shape shape = this->getTopoShapePtr()->getShape(); TopAbs_ShapeEnum shapetype = TopAbs_SHAPE; PyTypeObject* pyType = reinterpret_cast(type); - if (pyType == 0) + if (pyType == nullptr) shapetype = TopAbs_SHAPE; else if (PyType_IsSubtype(pyType, &TopoShapeShellPy::Type)) shapetype = TopAbs_SHELL; @@ -2377,11 +2377,11 @@ PyObject* TopoShapePy::overTolerance(PyObject *args) else if (pyType != &TopoShapePy::Type) { if (PyType_IsSubtype(pyType, &TopoShapePy::Type)) { PyErr_SetString(PyExc_TypeError, "shape type must be Vertex, Edge, Face or Shell"); - return 0; + return nullptr; } else { PyErr_SetString(PyExc_TypeError, "type must be a shape type"); - return 0; + return nullptr; } } @@ -2398,7 +2398,7 @@ PyObject* TopoShapePy::overTolerance(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -2406,16 +2406,16 @@ PyObject* TopoShapePy::inTolerance(PyObject *args) { double valmin; double valmax; - PyObject* type=0; + PyObject* type=nullptr; if (!PyArg_ParseTuple(args, "dd|O!", &valmin, &valmax, &PyType_Type, &type)) - return NULL; + return nullptr; try { TopoDS_Shape shape = this->getTopoShapePtr()->getShape(); TopAbs_ShapeEnum shapetype = TopAbs_SHAPE; PyTypeObject* pyType = reinterpret_cast(type); - if (pyType == 0) + if (pyType == nullptr) shapetype = TopAbs_SHAPE; else if (PyType_IsSubtype(pyType, &TopoShapeShellPy::Type)) shapetype = TopAbs_SHELL; @@ -2428,11 +2428,11 @@ PyObject* TopoShapePy::inTolerance(PyObject *args) else if (pyType != &TopoShapePy::Type) { if (PyType_IsSubtype(pyType, &TopoShapePy::Type)) { PyErr_SetString(PyExc_TypeError, "shape type must be Vertex, Edge, Face or Shell"); - return 0; + return nullptr; } else { PyErr_SetString(PyExc_TypeError, "type must be a shape type"); - return 0; + return nullptr; } } @@ -2449,7 +2449,7 @@ PyObject* TopoShapePy::inTolerance(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -2457,7 +2457,7 @@ PyObject* TopoShapePy::globalTolerance(PyObject *args) { int mode; if (!PyArg_ParseTuple(args, "i", &mode)) - return NULL; + return nullptr; try { TopoDS_Shape shape = this->getTopoShapePtr()->getShape(); @@ -2470,23 +2470,23 @@ PyObject* TopoShapePy::globalTolerance(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } PyObject* TopoShapePy::fixTolerance(PyObject *args) { double value; - PyObject* type=0; + PyObject* type=nullptr; if (!PyArg_ParseTuple(args, "d|O!", &value, &PyType_Type, &type)) - return NULL; + return nullptr; try { TopoDS_Shape shape = this->getTopoShapePtr()->getShape(); TopAbs_ShapeEnum shapetype = TopAbs_SHAPE; PyTypeObject* pyType = reinterpret_cast(type); - if (pyType == 0) + if (pyType == nullptr) shapetype = TopAbs_SHAPE; else if (PyType_IsSubtype(pyType, &TopoShapeWirePy::Type)) shapetype = TopAbs_WIRE; @@ -2500,7 +2500,7 @@ PyObject* TopoShapePy::fixTolerance(PyObject *args) shapetype = TopAbs_SHAPE; else if (pyType != &TopoShapePy::Type) { PyErr_SetString(PyExc_TypeError, "type must be a shape type"); - return 0; + return nullptr; } ShapeFix_ShapeTolerance fix; @@ -2510,7 +2510,7 @@ PyObject* TopoShapePy::fixTolerance(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -2518,16 +2518,16 @@ PyObject* TopoShapePy::limitTolerance(PyObject *args) { double tmin; double tmax=0; - PyObject* type=0; + PyObject* type=nullptr; if (!PyArg_ParseTuple(args, "d|dO!", &tmin, &tmax, &PyType_Type, &type)) - return NULL; + return nullptr; try { TopoDS_Shape shape = this->getTopoShapePtr()->getShape(); TopAbs_ShapeEnum shapetype = TopAbs_SHAPE; PyTypeObject* pyType = reinterpret_cast(type); - if (pyType == 0) + if (pyType == nullptr) shapetype = TopAbs_SHAPE; else if (PyType_IsSubtype(pyType, &TopoShapeWirePy::Type)) shapetype = TopAbs_WIRE; @@ -2541,7 +2541,7 @@ PyObject* TopoShapePy::limitTolerance(PyObject *args) shapetype = TopAbs_SHAPE; else if (pyType != &TopoShapePy::Type) { PyErr_SetString(PyExc_TypeError, "type must be a shape type"); - return 0; + return nullptr; } ShapeFix_ShapeTolerance fix; @@ -2551,7 +2551,7 @@ PyObject* TopoShapePy::limitTolerance(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -2679,7 +2679,7 @@ PyObject* TopoShapePy::distToShape(PyObject *args) Standard_Real minDist = -1, t1,t2,u1,v1,u2,v2; if (!PyArg_ParseTuple(args, "O!",&(TopoShapePy::Type), &ps2)) - return 0; + return nullptr; const TopoDS_Shape& s1 = getTopoShapePtr()->getShape(); TopoShape* ts1 = getTopoShapePtr(); @@ -2688,7 +2688,7 @@ PyObject* TopoShapePy::distToShape(PyObject *args) if (s2.IsNull()) { PyErr_SetString(PyExc_TypeError, "distToShape: Shape parameter is invalid"); - return 0; + return nullptr; } BRepExtrema_DistShapeShape extss; extss.LoadS1(s1); @@ -2698,11 +2698,11 @@ PyObject* TopoShapePy::distToShape(PyObject *args) } catch (const Standard_Failure& e) { PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); - return 0; + return nullptr; } if (!extss.IsDone()) { PyErr_SetString(PyExc_RuntimeError, "BRepExtrema_DistShapeShape failed"); - return 0; + return nullptr; } Py::List solnPts; Py::List solnGeom; @@ -2801,7 +2801,7 @@ PyObject* TopoShapePy::distToShape(PyObject *args) } else { PyErr_SetString(PyExc_TypeError, "distToShape: No Solutions Found."); - return 0; + return nullptr; } Py::Tuple ret(3); ret[0] = Py::Float(minDist); @@ -2815,7 +2815,7 @@ PyObject* TopoShapePy::optimalBoundingBox(PyObject *args) PyObject* useT = Py_True; PyObject* useS = Py_False; if (!PyArg_ParseTuple(args, "|O!O!", &PyBool_Type, &PyBool_Type, &useT, &useS)) - return 0; + return nullptr; try { #if OCC_VERSION_HEX >= 0x070200 @@ -2851,7 +2851,7 @@ PyObject* TopoShapePy::defeaturing(PyObject *args) { PyObject *l; if (!PyArg_ParseTuple(args, "O",&l)) - return NULL; + return nullptr; try { Py::Sequence list(l); @@ -2863,14 +2863,14 @@ PyObject* TopoShapePy::defeaturing(PyObject *args) ); } PyTypeObject* type = this->GetType(); - PyObject* inst = type->tp_new(type, this, 0); + PyObject* inst = type->tp_new(type, this, nullptr); static_cast(inst)->getTopoShapePtr()->setShape (this->getTopoShapePtr()->defeaturing(shapes)); return inst; } catch (const Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } @@ -3245,13 +3245,13 @@ Py::Float TopoShapePy::getVolume(void) const PyObject *TopoShapePy::getCustomAttributes(const char* attr) const { - if (!attr) return 0; + if (!attr) return nullptr; PY_TRY { TopoDS_Shape res = getTopoShapePtr()->getSubShape(attr,true); if(!res.IsNull()) return Py::new_reference_to(shape2pyshape(res)); }PY_CATCH_OCC - return 0; + return nullptr; } int TopoShapePy::setCustomAttributes(const char* , PyObject *) diff --git a/src/Mod/Part/App/TopoShapeShellPyImp.cpp b/src/Mod/Part/App/TopoShapeShellPyImp.cpp index 1d8fbf90a9..1229a6f375 100644 --- a/src/Mod/Part/App/TopoShapeShellPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeShellPyImp.cpp @@ -131,7 +131,7 @@ PyObject* TopoShapeShellPy::add(PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args, "O!", &(Part::TopoShapeFacePy::Type), &obj)) - return NULL; + return nullptr; BRep_Builder builder; TopoDS_Shape shell = getTopoShapePtr()->getShape(); @@ -153,7 +153,7 @@ PyObject* TopoShapeShellPy::add(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } getTopoShapePtr()->setShape(shell); @@ -164,7 +164,7 @@ PyObject* TopoShapeShellPy::add(PyObject *args) PyObject* TopoShapeShellPy::getFreeEdges(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; ShapeAnalysis_Shell as; as.LoadShells(getTopoShapePtr()->getShape()); #if OCC_VERSION_HEX < 0x060500 @@ -179,7 +179,7 @@ PyObject* TopoShapeShellPy::getFreeEdges(PyObject *args) PyObject* TopoShapeShellPy::getBadEdges(PyObject *args) { if (!PyArg_ParseTuple(args, "")) - return NULL; + return nullptr; ShapeAnalysis_Shell as; as.LoadShells(getTopoShapePtr()->getShape()); #if OCC_VERSION_HEX < 0x060500 @@ -195,7 +195,7 @@ PyObject* TopoShapeShellPy::makeHalfSpace(PyObject *args) { PyObject* pPnt; if (!PyArg_ParseTuple(args, "O!",&(Base::VectorPy::Type),&pPnt)) - return 0; + return nullptr; try { Base::Vector3d pt = Py::Vector(pPnt,false).toVector(); @@ -204,7 +204,7 @@ PyObject* TopoShapeShellPy::makeHalfSpace(PyObject *args) } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -286,7 +286,7 @@ Py::Dict TopoShapeShellPy::getPrincipalProperties(void) const PyObject *TopoShapeShellPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int TopoShapeShellPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/TopoShapeSolidPyImp.cpp b/src/Mod/Part/App/TopoShapeSolidPyImp.cpp index f9f3868b50..0df6437b10 100644 --- a/src/Mod/Part/App/TopoShapeSolidPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeSolidPyImp.cpp @@ -232,7 +232,7 @@ PyObject* TopoShapeSolidPy::getMomentOfInertia(PyObject *args) PyObject *p,*d; if (!PyArg_ParseTuple(args, "O!O!",&Base::VectorPy::Type,&p ,&Base::VectorPy::Type,&d)) - return 0; + return nullptr; Base::Vector3d pnt = Py::Vector(p,false).toVector(); Base::Vector3d dir = Py::Vector(d,false).toVector(); @@ -246,7 +246,7 @@ PyObject* TopoShapeSolidPy::getMomentOfInertia(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -255,7 +255,7 @@ PyObject* TopoShapeSolidPy::getRadiusOfGyration(PyObject *args) PyObject *p,*d; if (!PyArg_ParseTuple(args, "O!O!",&Base::VectorPy::Type,&p ,&Base::VectorPy::Type,&d)) - return 0; + return nullptr; Base::Vector3d pnt = Py::Vector(p,false).toVector(); Base::Vector3d dir = Py::Vector(d,false).toVector(); @@ -269,7 +269,7 @@ PyObject* TopoShapeSolidPy::getRadiusOfGyration(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -318,7 +318,7 @@ PyObject* TopoShapeSolidPy::offsetFaces(PyObject *args) if (!paramOK) { PyErr_SetString(PyExc_TypeError, "Wrong parameter"); - return 0; + return nullptr; } try { @@ -329,13 +329,13 @@ PyObject* TopoShapeSolidPy::offsetFaces(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject *TopoShapeSolidPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int TopoShapeSolidPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/TopoShapeVertexPyImp.cpp b/src/Mod/Part/App/TopoShapeVertexPyImp.cpp index 35ba09393e..70f24a773b 100644 --- a/src/Mod/Part/App/TopoShapeVertexPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeVertexPyImp.cpp @@ -206,7 +206,7 @@ Py::Object TopoShapeVertexPy::getPoint(void) const PyObject *TopoShapeVertexPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int TopoShapeVertexPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/TopoShapeWirePyImp.cpp b/src/Mod/Part/App/TopoShapeWirePyImp.cpp index c48b6046b0..0704431973 100644 --- a/src/Mod/Part/App/TopoShapeWirePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeWirePyImp.cpp @@ -172,14 +172,14 @@ PyObject* TopoShapeWirePy::add(PyObject *args) { PyObject* edge; if (!PyArg_ParseTuple(args, "O!",&(TopoShapePy::Type), &edge)) - return 0; + return nullptr; const TopoDS_Wire& w = TopoDS::Wire(getTopoShapePtr()->getShape()); BRepBuilderAPI_MakeWire mkWire(w); const TopoDS_Shape& sh = static_cast(edge)->getTopoShapePtr()->getShape(); if (sh.IsNull()) { PyErr_SetString(PyExc_TypeError, "given shape is invalid"); - return 0; + return nullptr; } if (sh.ShapeType() == TopAbs_EDGE) mkWire.Add(TopoDS::Edge(sh)); @@ -187,7 +187,7 @@ PyObject* TopoShapeWirePy::add(PyObject *args) mkWire.Add(TopoDS::Wire(sh)); else { PyErr_SetString(PyExc_TypeError, "shape is neither edge nor wire"); - return 0; + return nullptr; } try { @@ -197,16 +197,16 @@ PyObject* TopoShapeWirePy::add(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } PyObject* TopoShapeWirePy::fixWire(PyObject *args) { - PyObject* face=0; + PyObject* face=nullptr; double tol = Precision::Confusion(); if (!PyArg_ParseTuple(args, "|O!d",&(TopoShapeFacePy::Type), &face, &tol)) - return 0; + return nullptr; try { ShapeFix_Wire aFix; @@ -231,7 +231,7 @@ PyObject* TopoShapeWirePy::fixWire(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -239,12 +239,12 @@ PyObject* TopoShapeWirePy::makeOffset(PyObject *args) { double dist; if (!PyArg_ParseTuple(args, "d",&dist)) - return 0; + return nullptr; const TopoDS_Wire& w = TopoDS::Wire(getTopoShapePtr()->getShape()); BRepBuilderAPI_FindPlane findPlane(w); if (!findPlane.Found()) { PyErr_SetString(PartExceptionOCCError, "No planar wire"); - return 0; + return nullptr; } BRepOffsetAPI_MakeOffset mkOffset(w); @@ -265,11 +265,11 @@ PyObject* TopoShapeWirePy::makePipe(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } - return 0; + return nullptr; } PyObject* TopoShapeWirePy::makePipeShell(PyObject *args) @@ -301,11 +301,11 @@ PyObject* TopoShapeWirePy::makePipeShell(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return NULL; + return nullptr; } } - return 0; + return nullptr; } /* @@ -372,7 +372,7 @@ PyObject* TopoShapeWirePy::makeHomogenousWires(PyObject *args) { PyObject* wire; if (!PyArg_ParseTuple(args, "O!",&(Part::TopoShapeWirePy::Type),&wire)) - return 0; + return nullptr; try { TopoDS_Wire o1, o2; const TopoDS_Wire& w1 = TopoDS::Wire(getTopoShapePtr()->getShape()); @@ -390,7 +390,7 @@ PyObject* TopoShapeWirePy::makeHomogenousWires(PyObject *args) catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); - return 0; + return nullptr; } } @@ -400,9 +400,9 @@ PyObject* TopoShapeWirePy::approximate(PyObject *args, PyObject *kwds) double tol3d = 0.0001; int maxseg=10, maxdeg=3; - static char* kwds_approx[] = {"Tol2d","Tol3d","MaxSegments","MaxDegree",NULL}; + static char* kwds_approx[] = {"Tol2d","Tol3d","MaxSegments","MaxDegree",nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|ddii", kwds_approx, &tol2d, &tol3d, &maxseg, &maxdeg)) - return 0; + return nullptr; try { BRepAdaptor_CompCurve adapt(TopoDS::Wire(getTopoShapePtr()->getShape())); auto hcurve = adapt.Trim(adapt.FirstParameter(), @@ -414,12 +414,12 @@ PyObject* TopoShapeWirePy::approximate(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "failed to approximate wire"); - return 0; + return nullptr; } } catch (Standard_Failure&) { PyErr_SetString(PartExceptionOCCError, "failed to approximate wire"); - return 0; + return nullptr; } } @@ -447,19 +447,19 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PyExc_TypeError, "Either int or float expected"); - return 0; + return nullptr; } } else { // use Number kwds - static char* kwds_numPoints[] = {"Number","First","Last",NULL}; + static char* kwds_numPoints[] = {"Number","First","Last",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "i|dd", kwds_numPoints, &numPoints, &first, &last)) { uniformAbscissaPoints = true; } else { // use Abscissa kwds - static char* kwds_Distance[] = {"Distance","First","Last",NULL}; + static char* kwds_Distance[] = {"Distance","First","Last",nullptr}; PyErr_Clear(); if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_Distance, &distance, &first, &last)) { uniformAbscissaDistance = true; @@ -486,12 +486,12 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of wire failed"); - return 0; + return nullptr; } } // use Deflection kwds - static char* kwds_Deflection[] = {"Deflection","First","Last",NULL}; + static char* kwds_Deflection[] = {"Deflection","First","Last",nullptr}; PyErr_Clear(); double deflection; if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_Deflection, &deflection, &first, &last)) { @@ -508,12 +508,12 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of wire failed"); - return 0; + return nullptr; } } // use TangentialDeflection kwds - static char* kwds_TangentialDeflection[] = {"Angular","Curvature","First","Last","Minimum",NULL}; + static char* kwds_TangentialDeflection[] = {"Angular","Curvature","First","Last","Minimum",nullptr}; PyErr_Clear(); double angular; double curvature; @@ -532,12 +532,12 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of wire failed"); - return 0; + return nullptr; } } // use QuasiNumber kwds - static char* kwds_QuasiNumPoints[] = {"QuasiNumber","First","Last",NULL}; + static char* kwds_QuasiNumPoints[] = {"QuasiNumber","First","Last",nullptr}; PyErr_Clear(); int quasiNumPoints; if (PyArg_ParseTupleAndKeywords(args, kwds, "i|dd", kwds_QuasiNumPoints, &quasiNumPoints, &first, &last)) { @@ -554,12 +554,12 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of wire failed"); - return 0; + return nullptr; } } // use QuasiDeflection kwds - static char* kwds_QuasiDeflection[] = {"QuasiDeflection","First","Last",NULL}; + static char* kwds_QuasiDeflection[] = {"QuasiDeflection","First","Last",nullptr}; PyErr_Clear(); double quasiDeflection; if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_QuasiDeflection, &quasiDeflection, &first, &last)) { @@ -576,17 +576,17 @@ PyObject* TopoShapeWirePy::discretize(PyObject *args, PyObject *kwds) } else { PyErr_SetString(PartExceptionOCCError, "Discretization of wire failed"); - return 0; + return nullptr; } } } catch (const Base::Exception& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError,"Wrong arguments"); - return 0; + return nullptr; } Py::String TopoShapeWirePy::getContinuity() const @@ -734,7 +734,7 @@ Py::List TopoShapeWirePy::getOrderedVertexes(void) const PyObject *TopoShapeWirePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int TopoShapeWirePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/ToroidPyImp.cpp b/src/Mod/Part/App/ToroidPyImp.cpp index 4c83fcc07c..c80361480f 100644 --- a/src/Mod/Part/App/ToroidPyImp.cpp +++ b/src/Mod/Part/App/ToroidPyImp.cpp @@ -187,7 +187,7 @@ Py::Float ToroidPy::getVolume(void) const PyObject *ToroidPy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int ToroidPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/App/TrimmedCurvePyImp.cpp b/src/Mod/Part/App/TrimmedCurvePyImp.cpp index b937bbc95f..94965dbb07 100644 --- a/src/Mod/Part/App/TrimmedCurvePyImp.cpp +++ b/src/Mod/Part/App/TrimmedCurvePyImp.cpp @@ -49,7 +49,7 @@ PyObject *TrimmedCurvePy::PyMake(struct _typeobject *, PyObject *, PyObject *) // never create such objects with the constructor PyErr_SetString(PyExc_RuntimeError, "You cannot create an instance of the abstract class 'TrimmedCurve'."); - return 0; + return nullptr; } // constructor method @@ -68,23 +68,23 @@ PyObject* TrimmedCurvePy::setParameterRange(PyObject * args) u=c->FirstParameter(); v=c->LastParameter(); if (!PyArg_ParseTuple(args, "|dd", &u,&v)) - return 0; + return nullptr; getGeomTrimmedCurvePtr()->setRange(u,v); Py_Return; } } catch (Base::CADKernelError& e) { PyErr_SetString(PartExceptionOCCError, e.what()); - return 0; + return nullptr; } PyErr_SetString(PartExceptionOCCError, "Geometry is not a trimmed curve"); - return 0; + return nullptr; } PyObject *TrimmedCurvePy::getCustomAttributes(const char* /*attr*/) const { - return 0; + return nullptr; } int TrimmedCurvePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Mod/Part/Gui/AppPartGui.cpp b/src/Mod/Part/Gui/AppPartGui.cpp index ee1d3c2ee3..b2708e34b4 100644 --- a/src/Mod/Part/Gui/AppPartGui.cpp +++ b/src/Mod/Part/Gui/AppPartGui.cpp @@ -100,7 +100,7 @@ PyMOD_INIT_FUNC(PartGui) { if (!Gui::Application::Instance) { PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application."); - PyMOD_Return(0); + PyMOD_Return(nullptr); } // load needed modules @@ -109,7 +109,7 @@ PyMOD_INIT_FUNC(PartGui) } catch(const Base::Exception& e) { PyErr_SetString(PyExc_ImportError, e.what()); - PyMOD_Return(0); + PyMOD_Return(nullptr); } PyObject* partGuiModule = PartGui::initModule(); @@ -127,7 +127,7 @@ PyMOD_INIT_FUNC(PartGui) "AttachEngineResources", "AttachEngineResources", -1, AttacherGui::AttacherGuiPy::Methods, - NULL, NULL, NULL, NULL + nullptr, nullptr, nullptr, nullptr }; PyObject* pAttachEngineTextsModule = PyModule_Create(&pAttachEngineTextsModuleDef); diff --git a/src/Mod/Part/Gui/AttacherTexts.cpp b/src/Mod/Part/Gui/AttacherTexts.cpp index cf8e0f5194..8f4963e514 100644 --- a/src/Mod/Part/Gui/AttacherTexts.cpp +++ b/src/Mod/Part/Gui/AttacherTexts.cpp @@ -373,7 +373,7 @@ PyObject* AttacherGuiPy::sGetModeStrings(PyObject * /*self*/, PyObject *args) int modeIndex = 0; char* attacherType; if (!PyArg_ParseTuple(args, "si", &attacherType, &modeIndex)) - return NULL; + return nullptr; try { Base::Type t = Base::Type::fromName(attacherType); @@ -392,10 +392,10 @@ PyObject* AttacherGuiPy::sGetModeStrings(PyObject * /*self*/, PyObject *args) return Py::new_reference_to(result); } catch (const Py::Exception&) { - return 0; + return nullptr; } catch (const Base::Exception& e) { e.setPyException(); - return 0; + return nullptr; } } @@ -403,16 +403,16 @@ PyObject* AttacherGuiPy::sGetRefTypeUserFriendlyName(PyObject * /*self*/, PyObje { int refTypeIndex = 0; if (!PyArg_ParseTuple(args, "i", &refTypeIndex)) - return NULL; + return nullptr; try { QByteArray ba_utf8 = getShapeTypeText(eRefType(refTypeIndex)).toUtf8(); return Py::new_reference_to(Py::String(ba_utf8.data(), "utf-8")); } catch (const Py::Exception&) { - return 0; + return nullptr; } catch (const Base::Exception& e) { e.setPyException(); - return 0; + return nullptr; } } @@ -422,7 +422,7 @@ PyMethodDef AttacherGuiPy::Methods[] = { "getModeStrings(attacher_type, mode_index) - gets mode user-friendly name and brief description."}, {"getRefTypeUserFriendlyName", (PyCFunction) AttacherGuiPy::sGetRefTypeUserFriendlyName, METH_VARARGS, "getRefTypeUserFriendlyName(type_index) - gets user-friendly name of AttachEngine's shape type."}, - {NULL, NULL, 0, NULL} /* Sentinel */ + {nullptr, nullptr, 0, nullptr} /* Sentinel */ }; diff --git a/src/Mod/Part/Gui/Command.cpp b/src/Mod/Part/Gui/Command.cpp index de583c61af..e98a4d845d 100644 --- a/src/Mod/Part/Gui/Command.cpp +++ b/src/Mod/Part/Gui/Command.cpp @@ -274,7 +274,7 @@ void CmdPartCut::activated(int iMsg) { Q_UNUSED(iMsg); std::vector Sel = - getSelection().getSelectionEx(0, App::DocumentObject::getClassTypeId(),3); + getSelection().getSelectionEx(nullptr, App::DocumentObject::getClassTypeId(),3); if (Sel.size() != 2) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select two shapes please.")); @@ -303,7 +303,7 @@ void CmdPartCut::activated(int iMsg) doCommand(Doc,"App.activeDocument().%s.Tool = App.activeDocument().%s",FeatName.c_str(),Sel[1].getFeatName()); // hide the input objects and remove them from the parent group - App::DocumentObjectGroup* targetGroup = 0; + App::DocumentObjectGroup* targetGroup = nullptr; for (std::vector::iterator it = Sel.begin(); it != Sel.end(); ++it) { doCommand(Gui,"Gui.activeDocument().%s.Visibility=False",it->getFeatName()); App::DocumentObjectGroup* group = it->getObject()->getGroup(); @@ -328,7 +328,7 @@ void CmdPartCut::activated(int iMsg) bool CmdPartCut::isActive(void) { return getSelection().countObjectsOfType( - App::DocumentObject::getClassTypeId(),0,3)==2; + App::DocumentObject::getClassTypeId(),nullptr,3)==2; } //=========================================================================== @@ -352,7 +352,7 @@ void CmdPartCommon::activated(int iMsg) { Q_UNUSED(iMsg); std::vector Sel = - getSelection().getSelectionEx(0, App::DocumentObject::getClassTypeId(), 3); + getSelection().getSelectionEx(nullptr, App::DocumentObject::getClassTypeId(), 3); //test if selected object is a compound, and if it is, look how many children it has... std::size_t numShapes = 0; @@ -403,7 +403,7 @@ void CmdPartCommon::activated(int iMsg) runCommand(Doc,str.str().c_str()); // hide the input objects and remove them from the parent group - App::DocumentObjectGroup* targetGroup = 0; + App::DocumentObjectGroup* targetGroup = nullptr; for (std::vector::iterator it = partObjects.begin(); it != partObjects.end(); ++it) { doCommand(Gui,"Gui.activeDocument().%s.Visibility=False",it->getFeatName()); App::DocumentObjectGroup* group = it->getObject()->getGroup(); @@ -428,7 +428,7 @@ void CmdPartCommon::activated(int iMsg) bool CmdPartCommon::isActive(void) { return getSelection().countObjectsOfType( - App::DocumentObject::getClassTypeId(),0,3)>=1; + App::DocumentObject::getClassTypeId(),nullptr,3)>=1; } //=========================================================================== @@ -452,7 +452,7 @@ void CmdPartFuse::activated(int iMsg) { Q_UNUSED(iMsg); std::vector Sel = - getSelection().getSelectionEx(0, App::DocumentObject::getClassTypeId(),3); + getSelection().getSelectionEx(nullptr, App::DocumentObject::getClassTypeId(),3); //test if selected object is a compound, and if it is, look how many children it has... std::size_t numShapes = 0; @@ -503,7 +503,7 @@ void CmdPartFuse::activated(int iMsg) runCommand(Doc,str.str().c_str()); // hide the input objects and remove them from the parent group - App::DocumentObjectGroup* targetGroup = 0; + App::DocumentObjectGroup* targetGroup = nullptr; for (std::vector::iterator it = partObjects.begin(); it != partObjects.end(); ++it) { doCommand(Gui,"Gui.activeDocument().%s.Visibility=False",it->getFeatName()); App::DocumentObjectGroup* group = it->getObject()->getGroup(); @@ -528,7 +528,7 @@ void CmdPartFuse::activated(int iMsg) bool CmdPartFuse::isActive(void) { return getSelection().countObjectsOfType( - App::DocumentObject::getClassTypeId(),0,3)>=1; + App::DocumentObject::getClassTypeId(),nullptr,3)>=1; } //=========================================================================== @@ -888,7 +888,7 @@ void CmdPartCompound::activated(int iMsg) { Q_UNUSED(iMsg); unsigned int n = getSelection().countObjectsOfType( - App::DocumentObject::getClassTypeId(),0,3); + App::DocumentObject::getClassTypeId(),nullptr,3); if (n < 1) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select one shape or more, please.")); @@ -921,7 +921,7 @@ void CmdPartCompound::activated(int iMsg) bool CmdPartCompound::isActive(void) { return getSelection().countObjectsOfType( - App::DocumentObject::getClassTypeId(),0,3)>=1; + App::DocumentObject::getClassTypeId(),nullptr,3)>=1; } //=========================================================================== @@ -945,7 +945,7 @@ void CmdPartSection::activated(int iMsg) { Q_UNUSED(iMsg); std::vector Sel = - getSelection().getSelectionEx(0, App::DocumentObject::getClassTypeId(),3); + getSelection().getSelectionEx(nullptr, App::DocumentObject::getClassTypeId(),3); if (Sel.size() != 2) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("Select two shapes please.")); @@ -969,7 +969,7 @@ void CmdPartSection::activated(int iMsg) bool CmdPartSection::isActive(void) { - return getSelection().countObjectsOfType(App::DocumentObject::getClassTypeId(),0,3)==2; + return getSelection().countObjectsOfType(App::DocumentObject::getClassTypeId(),nullptr,3)==2; } //=========================================================================== @@ -1078,7 +1078,7 @@ void CmdPartExport::activated(int iMsg) bool CmdPartExport::isActive(void) { - return Gui::Selection().countObjectsOfType(App::DocumentObject::getClassTypeId(),0,3) > 0; + return Gui::Selection().countObjectsOfType(App::DocumentObject::getClassTypeId(),nullptr,3) > 0; } //=========================================================================== @@ -1150,7 +1150,7 @@ void CmdPartMakeSolid::activated(int iMsg) { Q_UNUSED(iMsg); std::vector objs = Gui::Selection().getObjectsOfType - (App::DocumentObject::getClassTypeId(),0,3); + (App::DocumentObject::getClassTypeId(),nullptr,3); runCommand(Doc, "import Part"); for (std::vector::iterator it = objs.begin(); it != objs.end(); ++it) { const TopoDS_Shape& shape = Part::Feature::getShape(*it); @@ -1205,7 +1205,7 @@ void CmdPartMakeSolid::activated(int iMsg) bool CmdPartMakeSolid::isActive(void) { return Gui::Selection().countObjectsOfType - (App::DocumentObject::getClassTypeId(),0,3) > 0; + (App::DocumentObject::getClassTypeId(),nullptr,3) > 0; } //=========================================================================== @@ -1350,7 +1350,7 @@ CmdPartMakeFace::CmdPartMakeFace() void CmdPartMakeFace::activated(int iMsg) { Q_UNUSED(iMsg); - auto sketches = Gui::Selection().getObjectsOfType(App::DocumentObject::getClassTypeId(),0,3); + auto sketches = Gui::Selection().getObjectsOfType(App::DocumentObject::getClassTypeId(),nullptr,3); if(sketches.empty()) return; openCommand(QT_TRANSLATE_NOOP("Command", "Make face")); @@ -1378,7 +1378,7 @@ void CmdPartMakeFace::activated(int iMsg) bool CmdPartMakeFace::isActive(void) { - return (Gui::Selection().countObjectsOfType(App::DocumentObject::getClassTypeId(),0,3) > 0 && + return (Gui::Selection().countObjectsOfType(App::DocumentObject::getClassTypeId(),nullptr,3) > 0 && !Gui::Control().activeDialog()); } @@ -1430,7 +1430,7 @@ CmdPartFillet::CmdPartFillet() void CmdPartFillet::activated(int iMsg) { Q_UNUSED(iMsg); - Gui::Control().showDialog(new PartGui::TaskFilletEdges(0)); + Gui::Control().showDialog(new PartGui::TaskFilletEdges(nullptr)); } bool CmdPartFillet::isActive(void) @@ -1458,7 +1458,7 @@ CmdPartChamfer::CmdPartChamfer() void CmdPartChamfer::activated(int iMsg) { Q_UNUSED(iMsg); - Gui::Control().showDialog(new PartGui::TaskChamferEdges(0)); + Gui::Control().showDialog(new PartGui::TaskChamferEdges(nullptr)); } bool CmdPartChamfer::isActive(void) @@ -1641,7 +1641,7 @@ CmdPartOffset::CmdPartOffset() void CmdPartOffset::activated(int iMsg) { Q_UNUSED(iMsg); - auto shapes = getSelection().getObjectsOfType(Part::Feature::getClassTypeId(),0,3); + auto shapes = getSelection().getObjectsOfType(Part::Feature::getClassTypeId(),nullptr,3); if(shapes.empty()) return; App::DocumentObject* shape = shapes.front(); @@ -1667,7 +1667,7 @@ void CmdPartOffset::activated(int iMsg) bool CmdPartOffset::isActive(void) { Base::Type partid = Base::Type::fromName("Part::Feature"); - bool objectsSelected = Gui::Selection().countObjectsOfType(partid,0,3) == 1; + bool objectsSelected = Gui::Selection().countObjectsOfType(partid,nullptr,3) == 1; return (objectsSelected && !Gui::Control().activeDialog()); } @@ -1693,7 +1693,7 @@ CmdPartOffset2D::CmdPartOffset2D() void CmdPartOffset2D::activated(int iMsg) { Q_UNUSED(iMsg); - auto shapes = getSelection().getObjectsOfType(Part::Feature::getClassTypeId(),0,3); + auto shapes = getSelection().getObjectsOfType(Part::Feature::getClassTypeId(),nullptr,3); if(shapes.empty()) return; App::DocumentObject* shape = shapes.front(); @@ -1719,7 +1719,7 @@ void CmdPartOffset2D::activated(int iMsg) bool CmdPartOffset2D::isActive(void) { Base::Type partid = Base::Type::fromName("Part::Feature"); - bool objectsSelected = Gui::Selection().countObjectsOfType(partid,0,3) == 1; + bool objectsSelected = Gui::Selection().countObjectsOfType(partid,nullptr,3) == 1; return (objectsSelected && !Gui::Control().activeDialog()); } @@ -1812,7 +1812,7 @@ void CmdPartCompOffset::languageChange() bool CmdPartCompOffset::isActive(void) { Base::Type partid = Base::Type::fromName("Part::Feature"); - bool objectsSelected = Gui::Selection().countObjectsOfType(partid,0,3) == 1; + bool objectsSelected = Gui::Selection().countObjectsOfType(partid,nullptr,3) == 1; return (objectsSelected && !Gui::Control().activeDialog()); } diff --git a/src/Mod/Part/Gui/CommandSimple.cpp b/src/Mod/Part/Gui/CommandSimple.cpp index 85d9d26c17..ed73a27f9b 100644 --- a/src/Mod/Part/Gui/CommandSimple.cpp +++ b/src/Mod/Part/Gui/CommandSimple.cpp @@ -197,8 +197,8 @@ static void _copyShape(const char *cmdName, bool resolve,bool needElement=false, subMap.emplace("",obj); else { for(const auto &sub : sel.getSubNames()) { - const char *element = 0; - auto sobj = obj->resolve(sub.c_str(),0,0,&element); + const char *element = nullptr; + auto sobj = obj->resolve(sub.c_str(),nullptr,nullptr,&element); if(!sobj) continue; if(!needElement && element) subMap.emplace(sub.substr(0,element-sub.c_str()),sobj); @@ -378,7 +378,7 @@ void CmdPartDefeaturing::activated(int iMsg) Q_UNUSED(iMsg); Gui::WaitCursor wc; Base::Type partid = Base::Type::fromName("Part::Feature"); - std::vector objs = Gui::Selection().getSelectionEx(0, partid); + std::vector objs = Gui::Selection().getSelectionEx(nullptr, partid); openCommand(QT_TRANSLATE_NOOP("Command", "Defeaturing")); for (std::vector::iterator it = objs.begin(); it != objs.end(); ++it) { try { @@ -420,7 +420,7 @@ void CmdPartDefeaturing::activated(int iMsg) bool CmdPartDefeaturing::isActive(void) { Base::Type partid = Base::Type::fromName("Part::Feature"); - std::vector objs = Gui::Selection().getSelectionEx(0, partid); + std::vector objs = Gui::Selection().getSelectionEx(nullptr, partid); for (std::vector::iterator it = objs.begin(); it != objs.end(); ++it) { std::vector subnames = it->getSubNames(); for (std::vector::iterator sub = subnames.begin(); sub != subnames.end(); ++sub) { diff --git a/src/Mod/Part/Gui/CrossSections.cpp b/src/Mod/Part/Gui/CrossSections.cpp index ead0e06a61..59708502b7 100644 --- a/src/Mod/Part/Gui/CrossSections.cpp +++ b/src/Mod/Part/Gui/CrossSections.cpp @@ -518,7 +518,7 @@ TaskCrossSections::TaskCrossSections(const Base::BoundBox3d& bb) widget = new CrossSections(bb); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_CrossSections"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/CrossSections.h b/src/Mod/Part/Gui/CrossSections.h index 089b0bd012..e5e003e3af 100644 --- a/src/Mod/Part/Gui/CrossSections.h +++ b/src/Mod/Part/Gui/CrossSections.h @@ -44,7 +44,7 @@ class CrossSections : public QDialog enum Plane { XY, XZ, YZ }; public: - CrossSections(const Base::BoundBox3d& bb, QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + CrossSections(const Base::BoundBox3d& bb, QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~CrossSections(); void accept(); void apply(); diff --git a/src/Mod/Part/Gui/DlgBooleanOperation.cpp b/src/Mod/Part/Gui/DlgBooleanOperation.cpp index 027a822bb1..7c927ad693 100644 --- a/src/Mod/Part/Gui/DlgBooleanOperation.cpp +++ b/src/Mod/Part/Gui/DlgBooleanOperation.cpp @@ -179,8 +179,8 @@ void DlgBooleanOperation::slotChangedObject(const App::DocumentObject& obj, ui->secondShape->topLevelItem(3)->setExpanded(true); } else { // belongs to none of these groups - delete child; child = 0; - delete copy; copy = 0; + delete child; child = nullptr; + delete copy; copy = nullptr; } // remove the watched object because now it is added to the tree @@ -212,7 +212,7 @@ void DlgBooleanOperation::findShapes() std::vector objs = activeDoc->getObjectsOfType (Part::Feature::getClassTypeId()); - QTreeWidgetItem *item_left=0, *item_right=0; + QTreeWidgetItem *item_left=nullptr, *item_right=nullptr; for (std::vector::iterator it = objs.begin(); it!=objs.end(); ++it) { const TopoDS_Shape& shape = static_cast(*it)->Shape.getValue(); if (!shape.IsNull()) { @@ -254,8 +254,8 @@ void DlgBooleanOperation::findShapes() ui->secondShape->topLevelItem(3)->addChild(copy); } else { // belongs to none of these groups - delete child; child = 0; - delete copy; copy = 0; + delete child; child = nullptr; + delete copy; copy = nullptr; } if (!item_left || !item_right) { @@ -341,7 +341,7 @@ void DlgBooleanOperation::accept() { int ltop, lchild, rtop, rchild; - QTreeWidgetItem* litem = 0; + QTreeWidgetItem* litem = nullptr; int numLChild = ui->firstShape->topLevelItemCount(); for (int i=0; ifirstShape->topLevelItem(i); @@ -357,7 +357,7 @@ void DlgBooleanOperation::accept() break; } - QTreeWidgetItem* ritem = 0; + QTreeWidgetItem* ritem = nullptr; int numRChild = ui->secondShape->topLevelItemCount(); for (int i=0; isecondShape->topLevelItem(i); @@ -459,7 +459,7 @@ void DlgBooleanOperation::accept() "Gui.activeDocument().hide(\"%s\")",shapeTwo.c_str()); // add/remove fromgroup if needed - App::DocumentObjectGroup* targetGroup = 0; + App::DocumentObjectGroup* targetGroup = nullptr; App::DocumentObjectGroup* group1 = obj1->getGroup(); if (group1) { @@ -497,7 +497,7 @@ TaskBooleanOperation::TaskBooleanOperation() widget = new DlgBooleanOperation(); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_Booleans"), - widget->windowTitle(), false, 0); + widget->windowTitle(), false, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/DlgBooleanOperation.h b/src/Mod/Part/Gui/DlgBooleanOperation.h index 53c915cce4..1f08df86f1 100644 --- a/src/Mod/Part/Gui/DlgBooleanOperation.h +++ b/src/Mod/Part/Gui/DlgBooleanOperation.h @@ -42,7 +42,7 @@ class DlgBooleanOperation : public QWidget Q_OBJECT public: - DlgBooleanOperation(QWidget* parent = 0); + DlgBooleanOperation(QWidget* parent = nullptr); ~DlgBooleanOperation(); void accept(); diff --git a/src/Mod/Part/Gui/DlgExtrusion.cpp b/src/Mod/Part/Gui/DlgExtrusion.cpp index 156e14eec5..00e0b2fadb 100644 --- a/src/Mod/Part/Gui/DlgExtrusion.cpp +++ b/src/Mod/Part/Gui/DlgExtrusion.cpp @@ -62,7 +62,7 @@ public: bool canSelect; EdgeSelection() - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr) { canSelect = false; } @@ -720,7 +720,7 @@ TaskExtrusion::TaskExtrusion() widget = new DlgExtrusion(); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_Extrude"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/DlgExtrusion.h b/src/Mod/Part/Gui/DlgExtrusion.h index a4baae7238..86426a67f0 100644 --- a/src/Mod/Part/Gui/DlgExtrusion.h +++ b/src/Mod/Part/Gui/DlgExtrusion.h @@ -39,7 +39,7 @@ class DlgExtrusion : public QDialog, public Gui::SelectionObserver Q_OBJECT public: - DlgExtrusion(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgExtrusion(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgExtrusion(); void accept(); void apply(); diff --git a/src/Mod/Part/Gui/DlgFilletEdges.cpp b/src/Mod/Part/Gui/DlgFilletEdges.cpp index 8c272045ac..c5deed8d9a 100644 --- a/src/Mod/Part/Gui/DlgFilletEdges.cpp +++ b/src/Mod/Part/Gui/DlgFilletEdges.cpp @@ -85,7 +85,7 @@ QWidget *FilletRadiusDelegate::createEditor(QWidget *parent, const QStyleOptionV const QModelIndex & index) const { if (index.column() < 1) - return 0; + return nullptr; Gui::QuantitySpinBox *editor = new Gui::QuantitySpinBox(parent); editor->setUnit(Base::Unit::Length); @@ -172,7 +172,7 @@ namespace PartGui { App::DocumentObject*& object; public: EdgeFaceSelection(App::DocumentObject*& obj) - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0), allowEdge(true), object(obj) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), allowEdge(true), object(obj) { } void selectEdges() @@ -240,7 +240,7 @@ DlgFilletEdges::DlgFilletEdges(FilletType type, Part::FilletBase* fillet, QWidge ui->filletEndRadius->setMinimum(0); ui->filletEndRadius->setUnit(Base::Unit::Length); - d->object = 0; + d->object = nullptr; d->selection = new EdgeFaceSelection(d->object); Gui::Selection().addSelectionGate(d->selection); @@ -455,16 +455,16 @@ void DlgFilletEdges::onSelectEdgesOfFace(const QString& subelement, int type) void DlgFilletEdges::onDeleteObject(const App::DocumentObject& obj) { if (d->fillet == &obj) { - d->fillet = 0; + d->fillet = nullptr; } else if (d->fillet && d->fillet->Base.getValue() == &obj) { - d->fillet = 0; - d->object = 0; + d->fillet = nullptr; + d->object = nullptr; ui->shapeObject->setCurrentIndex(0); on_shapeObject_activated(0); } else if (d->object == &obj) { - d->object = 0; + d->object = nullptr; ui->shapeObject->removeItem(ui->shapeObject->currentIndex()); ui->shapeObject->setCurrentIndex(0); on_shapeObject_activated(0); @@ -694,7 +694,7 @@ void DlgFilletEdges::changeEvent(QEvent *e) void DlgFilletEdges::on_shapeObject_activated(int itemPos) { - d->object = 0; + d->object = nullptr; QStandardItemModel *model = qobject_cast(ui->treeView->model()); model->removeRows(0, model->rowCount()); @@ -999,7 +999,7 @@ TaskFilletEdges::TaskFilletEdges(Part::Fillet* fillet) widget = new DlgFilletEdges(DlgFilletEdges::FILLET, fillet); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_Fillet"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } @@ -1058,7 +1058,7 @@ TaskChamferEdges::TaskChamferEdges(Part::Chamfer* chamfer) widget = new DlgChamferEdges(chamfer); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_Chamfer"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/DlgFilletEdges.h b/src/Mod/Part/Gui/DlgFilletEdges.h index e4146987a6..ed54db0bb1 100644 --- a/src/Mod/Part/Gui/DlgFilletEdges.h +++ b/src/Mod/Part/Gui/DlgFilletEdges.h @@ -47,7 +47,7 @@ class FilletRadiusDelegate : public QItemDelegate Q_OBJECT public: - FilletRadiusDelegate(QObject *parent = 0); + FilletRadiusDelegate(QObject *parent = nullptr); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; @@ -65,7 +65,7 @@ class FilletRadiusModel : public QStandardItemModel Q_OBJECT public: - FilletRadiusModel(QObject * parent = 0); + FilletRadiusModel(QObject * parent = nullptr); Qt::ItemFlags flags (const QModelIndex & index) const; bool setData (const QModelIndex & index, const QVariant & value, @@ -84,7 +84,7 @@ class DlgFilletEdges : public QWidget, public Gui::SelectionObserver public: enum FilletType { FILLET, CHAMFER }; - DlgFilletEdges(FilletType type, Part::FilletBase*, QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgFilletEdges(FilletType type, Part::FilletBase*, QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgFilletEdges(); bool accept(); @@ -124,7 +124,7 @@ class FilletEdgesDialog : public QDialog Q_OBJECT public: - FilletEdgesDialog(DlgFilletEdges::FilletType type, Part::FilletBase* fillet, QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + FilletEdgesDialog(DlgFilletEdges::FilletType type, Part::FilletBase* fillet, QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~FilletEdgesDialog(); void accept(); @@ -137,7 +137,7 @@ class DlgChamferEdges : public DlgFilletEdges Q_OBJECT public: - DlgChamferEdges(Part::FilletBase*, QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgChamferEdges(Part::FilletBase*, QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgChamferEdges(); protected: diff --git a/src/Mod/Part/Gui/DlgPartBoxImp.h b/src/Mod/Part/Gui/DlgPartBoxImp.h index 15f3092cdc..5180e3867b 100644 --- a/src/Mod/Part/Gui/DlgPartBoxImp.h +++ b/src/Mod/Part/Gui/DlgPartBoxImp.h @@ -34,7 +34,7 @@ class DlgPartBoxImp : public Gui::LocationDialogUiImp Q_OBJECT public: - DlgPartBoxImp(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgPartBoxImp(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgPartBoxImp(); }; diff --git a/src/Mod/Part/Gui/DlgPartCylinderImp.h b/src/Mod/Part/Gui/DlgPartCylinderImp.h index f4691cf37e..09ebbe6ec8 100644 --- a/src/Mod/Part/Gui/DlgPartCylinderImp.h +++ b/src/Mod/Part/Gui/DlgPartCylinderImp.h @@ -34,7 +34,7 @@ class DlgPartCylinderImp : public Gui::LocationDialogUiImp Q_OBJECT public: - DlgPartCylinderImp(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgPartCylinderImp(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgPartCylinderImp(); double getRadius() const; diff --git a/src/Mod/Part/Gui/DlgPartImportIgesImp.h b/src/Mod/Part/Gui/DlgPartImportIgesImp.h index 0314c6225e..f514abe35f 100644 --- a/src/Mod/Part/Gui/DlgPartImportIgesImp.h +++ b/src/Mod/Part/Gui/DlgPartImportIgesImp.h @@ -33,7 +33,7 @@ class DlgPartImportIgesImp : public QDialog Q_OBJECT public: - DlgPartImportIgesImp( QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() ); + DlgPartImportIgesImp( QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ); ~DlgPartImportIgesImp(); public Q_SLOTS: diff --git a/src/Mod/Part/Gui/DlgPartImportStepImp.h b/src/Mod/Part/Gui/DlgPartImportStepImp.h index 39d917640a..86539f6066 100644 --- a/src/Mod/Part/Gui/DlgPartImportStepImp.h +++ b/src/Mod/Part/Gui/DlgPartImportStepImp.h @@ -34,7 +34,7 @@ class DlgPartImportStepImp : public QDialog Q_OBJECT public: - DlgPartImportStepImp( QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() ); + DlgPartImportStepImp( QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() ); ~DlgPartImportStepImp(); public Q_SLOTS: diff --git a/src/Mod/Part/Gui/DlgPrimitives.cpp b/src/Mod/Part/Gui/DlgPrimitives.cpp index 4117884060..0fead13ba2 100644 --- a/src/Mod/Part/Gui/DlgPrimitives.cpp +++ b/src/Mod/Part/Gui/DlgPrimitives.cpp @@ -1980,7 +1980,7 @@ void Location::pickCallback(void * ud, SoEventCallback * n) view->setEditing(false); view->setRedirectToSceneGraph(false); Location* dlg = reinterpret_cast(ud); - dlg->activeView = 0; + dlg->activeView = nullptr; view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), pickCallback,ud); SoNode* root = view->getSceneGraph(); if (root && root->getTypeId().isDerivedFrom(Gui::SoFCUnifiedSelection::getClassTypeId())) @@ -2023,12 +2023,12 @@ TaskPrimitives::TaskPrimitives() { Gui::TaskView::TaskBox* taskbox; widget = new DlgPrimitives(); - taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(), true, 0); + taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); location = new Location(); - taskbox = new Gui::TaskView::TaskBox(QPixmap(), location->windowTitle() ,true, 0); + taskbox = new Gui::TaskView::TaskBox(QPixmap(), location->windowTitle() ,true, nullptr); taskbox->groupLayout()->addWidget(location); Content.push_back(taskbox); } @@ -2070,13 +2070,13 @@ TaskPrimitivesEdit::TaskPrimitivesEdit(Part::Primitive* feature) // create and show dialog for the primitives Gui::TaskView::TaskBox* taskbox; widget = new DlgPrimitives(nullptr, feature); - taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(), true, 0); + taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); // create and show dialog for the location location = new Location(nullptr, feature); - taskbox = new Gui::TaskView::TaskBox(QPixmap(), location->windowTitle(), true, 0); + taskbox = new Gui::TaskView::TaskBox(QPixmap(), location->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(location); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp b/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp index e892cb2392..4934565cec 100644 --- a/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp +++ b/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp @@ -77,7 +77,7 @@ public: bool canSelect; EdgeSelection() - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr) { canSelect = false; } @@ -106,7 +106,7 @@ public: bool canSelect; FaceSelection() - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr) { canSelect = false; } @@ -1050,7 +1050,7 @@ TaskProjectionOnSurface::TaskProjectionOnSurface() widget = new DlgProjectionOnSurface(); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_ProjectionOnSurface"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/DlgProjectionOnSurface.h b/src/Mod/Part/Gui/DlgProjectionOnSurface.h index 373311217d..5130fe9850 100644 --- a/src/Mod/Part/Gui/DlgProjectionOnSurface.h +++ b/src/Mod/Part/Gui/DlgProjectionOnSurface.h @@ -52,7 +52,7 @@ class DlgProjectionOnSurface : public QWidget, Q_OBJECT public: - explicit DlgProjectionOnSurface(QWidget *parent = 0); + explicit DlgProjectionOnSurface(QWidget *parent = nullptr); ~DlgProjectionOnSurface(); void apply(void); diff --git a/src/Mod/Part/Gui/DlgRevolution.cpp b/src/Mod/Part/Gui/DlgRevolution.cpp index a2566a8ac2..1f27449f57 100644 --- a/src/Mod/Part/Gui/DlgRevolution.cpp +++ b/src/Mod/Part/Gui/DlgRevolution.cpp @@ -66,7 +66,7 @@ public: bool canSelect; EdgeSelection() - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr) { canSelect = false; } @@ -102,7 +102,7 @@ public: DlgRevolution::DlgRevolution(QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl) , ui(new Ui_DlgRevolution) - , filter(0) + , filter(nullptr) { ui->setupUi(this); @@ -553,7 +553,7 @@ TaskRevolution::TaskRevolution() widget = new DlgRevolution(); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_Revolve"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/DlgRevolution.h b/src/Mod/Part/Gui/DlgRevolution.h index 9151088aef..52e6d19ba5 100644 --- a/src/Mod/Part/Gui/DlgRevolution.h +++ b/src/Mod/Part/Gui/DlgRevolution.h @@ -36,7 +36,7 @@ class DlgRevolution : public QDialog, public Gui::SelectionObserver Q_OBJECT public: - DlgRevolution(QWidget* parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); + DlgRevolution(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()); ~DlgRevolution(); void accept(); diff --git a/src/Mod/Part/Gui/DlgSettings3DViewPartImp.h b/src/Mod/Part/Gui/DlgSettings3DViewPartImp.h index 09b9896de1..6cc1237b7d 100644 --- a/src/Mod/Part/Gui/DlgSettings3DViewPartImp.h +++ b/src/Mod/Part/Gui/DlgSettings3DViewPartImp.h @@ -39,7 +39,7 @@ class DlgSettings3DViewPart : public Gui::Dialog::PreferencePage Q_OBJECT public: - DlgSettings3DViewPart(QWidget* parent = 0); + DlgSettings3DViewPart(QWidget* parent = nullptr); ~DlgSettings3DViewPart(); protected: diff --git a/src/Mod/Part/Gui/DlgSettingsGeneral.h b/src/Mod/Part/Gui/DlgSettingsGeneral.h index 0054d24f16..c04efccb5c 100644 --- a/src/Mod/Part/Gui/DlgSettingsGeneral.h +++ b/src/Mod/Part/Gui/DlgSettingsGeneral.h @@ -36,7 +36,7 @@ class DlgSettingsGeneral : public Gui::Dialog::PreferencePage Q_OBJECT public: - DlgSettingsGeneral(QWidget* parent = 0); + DlgSettingsGeneral(QWidget* parent = nullptr); ~DlgSettingsGeneral(); protected: @@ -54,7 +54,7 @@ class DlgImportExportIges : public Gui::Dialog::PreferencePage Q_OBJECT public: - DlgImportExportIges(QWidget* parent = 0); + DlgImportExportIges(QWidget* parent = nullptr); ~DlgImportExportIges(); protected: @@ -73,7 +73,7 @@ class DlgImportExportStep : public Gui::Dialog::PreferencePage Q_OBJECT public: - DlgImportExportStep(QWidget* parent = 0); + DlgImportExportStep(QWidget* parent = nullptr); ~DlgImportExportStep(); protected: diff --git a/src/Mod/Part/Gui/DlgSettingsObjectColor.h b/src/Mod/Part/Gui/DlgSettingsObjectColor.h index c753f1bfd8..2b2c2a5868 100644 --- a/src/Mod/Part/Gui/DlgSettingsObjectColor.h +++ b/src/Mod/Part/Gui/DlgSettingsObjectColor.h @@ -40,7 +40,7 @@ class DlgSettingsObjectColor : public Gui::Dialog::PreferencePage Q_OBJECT public: - DlgSettingsObjectColor(QWidget* parent = 0); + DlgSettingsObjectColor(QWidget* parent = nullptr); ~DlgSettingsObjectColor(); void saveSettings(); diff --git a/src/Mod/Part/Gui/Mirroring.cpp b/src/Mod/Part/Gui/Mirroring.cpp index 8e44359961..babb050620 100644 --- a/src/Mod/Part/Gui/Mirroring.cpp +++ b/src/Mod/Part/Gui/Mirroring.cpp @@ -188,7 +188,7 @@ TaskMirroring::TaskMirroring() widget = new Mirroring(); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_Mirror.svg"), - widget->windowTitle(), false, 0); + widget->windowTitle(), false, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/Mirroring.h b/src/Mod/Part/Gui/Mirroring.h index 768704b450..a133fce923 100644 --- a/src/Mod/Part/Gui/Mirroring.h +++ b/src/Mod/Part/Gui/Mirroring.h @@ -40,7 +40,7 @@ class Mirroring : public QWidget Q_OBJECT public: - Mirroring(QWidget* parent = 0); + Mirroring(QWidget* parent = nullptr); ~Mirroring(); bool accept(); diff --git a/src/Mod/Part/Gui/SoBrepFaceSet.cpp b/src/Mod/Part/Gui/SoBrepFaceSet.cpp index e84271f448..069846fdf6 100644 --- a/src/Mod/Part/Gui/SoBrepFaceSet.cpp +++ b/src/Mod/Part/Gui/SoBrepFaceSet.cpp @@ -1035,25 +1035,25 @@ void SoBrepFaceSet::generatePrimitives(SoAction * action) if (doTextures) { if (tb.isFunction() && !tb.needIndices()) { tbind = NONE; - tindices = NULL; + tindices = nullptr; } // FIXME: just call inherited::areTexCoordsIndexed() instead of // the if-check? 20020110 mortene. else if (SoTextureCoordinateBindingElement::get(state) == SoTextureCoordinateBindingElement::PER_VERTEX) { tbind = PER_VERTEX; - tindices = NULL; + tindices = nullptr; } else { tbind = PER_VERTEX_INDEXED; - if (tindices == NULL) tindices = cindices; + if (tindices == nullptr) tindices = cindices; } } - if (nbind == PER_VERTEX_INDEXED && nindices == NULL) { + if (nbind == PER_VERTEX_INDEXED && nindices == nullptr) { nindices = cindices; } - if (mbind == PER_VERTEX_INDEXED && mindices == NULL) { + if (mbind == PER_VERTEX_INDEXED && mindices == nullptr) { mindices = cindices; } @@ -1410,8 +1410,8 @@ void SoBrepFaceSet::VBO::render(SoGLRenderAction * action, SbBool texture) { (void)texcoords; (void)texindices; (void)texture; - const SbVec3f * coords3d = NULL; - SbVec3f * cur_coords3d = NULL; + const SbVec3f * coords3d = nullptr; + SbVec3f * cur_coords3d = nullptr; coords3d = vertexlist->getArrayPtr3(); cur_coords3d = ( SbVec3f *)coords3d; @@ -1429,8 +1429,8 @@ void SoBrepFaceSet::VBO::render(SoGLRenderAction * action, int matnr = 0; int trinr = 0; - float * vertex_array = NULL; - GLuint * index_array = NULL; + float * vertex_array = nullptr; + GLuint * index_array = nullptr; SbColor mycolor1,mycolor2,mycolor3; SbVec3f *mynormal1 = (SbVec3f *)currnormal; SbVec3f *mynormal2 = (SbVec3f *)currnormal; @@ -1706,11 +1706,11 @@ void SoBrepFaceSet::VBO::render(SoGLRenderAction * action, glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_COLOR_ARRAY); - glVertexPointer(3,GL_FLOAT,10*sizeof(GLfloat),0); + glVertexPointer(3,GL_FLOAT,10*sizeof(GLfloat),nullptr); glNormalPointer(GL_FLOAT,10*sizeof(GLfloat),(GLvoid *)(3*sizeof(GLfloat))); glColorPointer(4,GL_FLOAT,10*sizeof(GLfloat),(GLvoid *)(6*sizeof(GLfloat))); - glDrawElements(GL_TRIANGLES, this->indice_array, GL_UNSIGNED_INT, (void *)0); + glDrawElements(GL_TRIANGLES, this->indice_array, GL_UNSIGNED_INT, (void *)nullptr); glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); @@ -1753,7 +1753,7 @@ void SoBrepFaceSet::renderShape(SoGLRenderAction * action, int texidx = 0; - const SbVec3f * coords3d = NULL; + const SbVec3f * coords3d = nullptr; coords3d = vertexlist->getArrayPtr3(); const int32_t *viptr = vertexindices; diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index 32951d4525..7a62eaa9dc 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -69,7 +69,7 @@ namespace bp = boost::placeholders; // Create reference name from PropertyLinkSub values in a translatable fashion const QString makeRefString(const App::DocumentObject* obj, const std::string& sub) { - if (obj == NULL) + if (obj == nullptr) return QObject::tr("No reference selected"); if (obj->getTypeId().isDerivedFrom(App::OriginFeature::getClassTypeId()) || @@ -100,7 +100,7 @@ void TaskAttacher::makeRefStrings(std::vector& refstrings, std::vector< refnames = pcAttach->Support.getSubValues(); for (size_t r = 0; r < 4; r++) { - if ((r < refs.size()) && (refs[r] != NULL)) { + if ((r < refs.size()) && (refs[r] != nullptr)) { refstrings.push_back(makeRefString(refs[r], refnames[r])); // for Origin or Datum features refnames is empty but we need a non-empty return value if (refnames[r].empty()) @@ -347,7 +347,7 @@ QLineEdit* TaskAttacher::getLine(unsigned idx) case 1: return ui->lineRef2; case 2: return ui->lineRef3; case 3: return ui->lineRef4; - default: return NULL; + default: return nullptr; } } @@ -419,7 +419,7 @@ void TaskAttacher::onSelectionChanged(const Gui::SelectionChanges& msg) } QLineEdit* line = getLine(iActiveRef); - if (line != NULL) { + if (line != nullptr) { line->blockSignals(true); line->setText(makeRefString(selObj, subname)); line->setProperty("RefName", QByteArray(subname.c_str())); @@ -563,7 +563,7 @@ void TaskAttacher::onRefName(const QString& text, unsigned idx) return; QLineEdit* line = getLine(idx); - if (line == NULL) return; + if (line == nullptr) return; if (text.length() == 0) { // Reference was removed @@ -606,7 +606,7 @@ void TaskAttacher::onRefName(const QString& text, unsigned idx) parts.push_back(QString::fromLatin1("")); // Check whether this is the name of an App::Plane or Part::Datum feature App::DocumentObject* obj = ViewProvider->getObject()->getDocument()->getObject(parts[0].toLatin1()); - if (obj == NULL) return; + if (obj == nullptr) return; std::string subElement; @@ -803,7 +803,7 @@ void TaskAttacher::updateListOfModes() //populate list ui->listOfModes->blockSignals(true); ui->listOfModes->clear(); - QListWidgetItem* iSelect = 0; + QListWidgetItem* iSelect = nullptr; if (modesInList.size()>0) { for (size_t i = 0 ; i < modesInList.size() ; ++i){ eMapMode mmode = modesInList[i]; @@ -995,14 +995,14 @@ void TaskAttacher::visibilityAutomation(bool opening_not_closing) auto editDoc = Gui::Application::Instance->editDocument(); App::DocumentObject *editObj = ViewProvider->getObject(); std::string editSubName; - auto sels = Gui::Selection().getSelection(0,0,true); + auto sels = Gui::Selection().getSelection(nullptr,0,true); if(sels.size() && sels[0].pResolvedObject && sels[0].pResolvedObject->getLinkedObject()==editObj) { editObj = sels[0].pObject; editSubName = sels[0].SubName; } else { - ViewProviderDocumentObject *editVp = 0; + ViewProviderDocumentObject *editVp = nullptr; if (editDoc) { editDoc->getInEdit(&editVp,&editSubName); if (editVp) diff --git a/src/Mod/Part/Gui/TaskAttacher.h b/src/Mod/Part/Gui/TaskAttacher.h index bdbaa9ad90..0f439b1a30 100644 --- a/src/Mod/Part/Gui/TaskAttacher.h +++ b/src/Mod/Part/Gui/TaskAttacher.h @@ -56,7 +56,7 @@ public: typedef boost::function VisibilityFunction; - TaskAttacher(Gui::ViewProviderDocumentObject *ViewProvider, QWidget *parent = 0, + TaskAttacher(Gui::ViewProviderDocumentObject *ViewProvider, QWidget *parent = nullptr, QString picture = QString(), QString text = QString::fromLatin1("Attachment"), VisibilityFunction func = 0); ~TaskAttacher(); diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp index 789192bc45..e032570616 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp +++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp @@ -190,10 +190,10 @@ QString getBOPCheckString(const BOPAlgo_CheckStatus &status) ResultEntry::ResultEntry() { - viewProviderRoot = 0; - boxSep = 0; - boxSwitch = 0; - parent = 0; + viewProviderRoot = nullptr; + boxSep = nullptr; + boxSwitch = nullptr; + parent = nullptr; children.clear(); selectionStrings.clear(); } @@ -210,10 +210,10 @@ ResultEntry::~ResultEntry() void ResultEntry::buildEntryName() { ResultEntry *parentEntry = this; - while(parentEntry->parent != 0) + while(parentEntry->parent != nullptr) { ResultEntry *temp = parentEntry->parent; - if (temp->parent == 0) + if (temp->parent == nullptr) break; parentEntry = parentEntry->parent; } @@ -271,7 +271,7 @@ void ResultEntry::buildEntryName() ResultModel::ResultModel(QObject *parent) : QAbstractItemModel(parent) { - root = 0; + root = nullptr; } ResultModel::~ResultModel() @@ -858,10 +858,10 @@ bool TaskCheckGeometryResults::split(QString &input, QString &doc, QString &obje QString PartGui::buildSelectionName(const ResultEntry *entry, const TopoDS_Shape &shape) { const ResultEntry *parentEntry = entry; - while(parentEntry->parent != 0) + while(parentEntry->parent != nullptr) { ResultEntry *temp = parentEntry->parent; - if (temp->parent == 0) + if (temp->parent == nullptr) break; parentEntry = parentEntry->parent; } @@ -1002,7 +1002,7 @@ void PartGui::goSetupResultUnorientableShapeFace(ResultEntry *entry) //////////////////////////////////////////////////////////////////////////////////////////////// TaskCheckGeometryDialog::TaskCheckGeometryDialog() - : widget(0), contentLabel(0), okBtn(0), settingsBtn(0), resultsBtn(0) + : widget(nullptr), contentLabel(nullptr), okBtn(nullptr), settingsBtn(nullptr), resultsBtn(nullptr) { ParameterGrp::handle group = App::GetApplication().GetUserParameter(). GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod")->GetGroup("Part")->GetGroup("CheckGeometry"); @@ -1013,14 +1013,14 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_CheckGeometry"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); contentLabel = new QTextEdit(); contentLabel->setText(widget->getShapeContentString()); shapeContentBox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("Part_CheckGeometry"), - tr("Shape Content"), true, 0); + tr("Shape Content"), true, nullptr); shapeContentBox->groupLayout()->addWidget(contentLabel); if (!expandShapeContent){ shapeContentBox->hideGroupBox(); @@ -1028,7 +1028,7 @@ TaskCheckGeometryDialog::TaskCheckGeometryDialog() Content.push_back(shapeContentBox); settingsBox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("Part_CheckGeometry"), - tr("Settings"), true, 0); + tr("Settings"), true, nullptr); Content.push_back(settingsBox); autoRunCheckBox = new QCheckBox(); @@ -1342,12 +1342,12 @@ TaskCheckGeometryDialog::~TaskCheckGeometryDialog() if (widget) { delete widget; - widget = 0; + widget = nullptr; } if (contentLabel) { delete contentLabel; - contentLabel = 0; + contentLabel = nullptr; } } diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.h b/src/Mod/Part/Gui/TaskCheckGeometry.h index 8bcddf3e89..8df262de4f 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.h +++ b/src/Mod/Part/Gui/TaskCheckGeometry.h @@ -80,7 +80,7 @@ class ResultModel : public QAbstractItemModel { Q_OBJECT public: - ResultModel(QObject *parent = 0); + ResultModel(QObject *parent = nullptr); ~ResultModel(); QModelIndex index(int row, int column, const QModelIndex &parent) const; QModelIndex parent(const QModelIndex &child) const; @@ -101,7 +101,7 @@ class TaskCheckGeometryResults : public QWidget { Q_OBJECT public: - TaskCheckGeometryResults(QWidget *parent = 0); + TaskCheckGeometryResults(QWidget *parent = nullptr); ~TaskCheckGeometryResults(); QString getShapeContentString(); void goCheck(); diff --git a/src/Mod/Part/Gui/TaskDimension.cpp b/src/Mod/Part/Gui/TaskDimension.cpp index 72d6d8854d..fd56514718 100644 --- a/src/Mod/Part/Gui/TaskDimension.cpp +++ b/src/Mod/Part/Gui/TaskDimension.cpp @@ -121,7 +121,7 @@ bool PartGui::getShapeFromStrings(TopoDS_Shape &shapeOut, const std::string &doc bool PartGui::evaluateLinearPreSelection(TopoDS_Shape &shape1, TopoDS_Shape &shape2) { - std::vector selections = Gui::Selection().getSelection(0,false); + std::vector selections = Gui::Selection().getSelection(nullptr,false); if (selections.size() != 2) return false; std::vector::iterator it; @@ -229,13 +229,13 @@ Gui::View3DInventorViewer * PartGui::getViewer() { Gui::Document *doc = Gui::Application::Instance->activeDocument(); if (!doc) - return 0; + return nullptr; Gui::View3DInventor *view = dynamic_cast(doc->getActiveView()); if (!view) - return 0; + return nullptr; Gui::View3DInventorViewer *viewer = view->getViewer(); if (!viewer) - return 0; + return nullptr; return viewer; } @@ -629,14 +629,14 @@ void PartGui::TaskMeasureLinear::setUpGui() QPixmap mainIcon = Gui::BitmapFactory().pixmap("Part_Measure_Linear"); Gui::TaskView::TaskBox* selectionTaskBox = new Gui::TaskView::TaskBox - (mainIcon, QObject::tr("Selections"), false, 0); + (mainIcon, QObject::tr("Selections"), false, nullptr); QVBoxLayout *selectionLayout = new QVBoxLayout(); stepped = new SteppedSelection(2, selectionTaskBox); selectionLayout->addWidget(stepped); selectionTaskBox->groupLayout()->addLayout(selectionLayout); Gui::TaskView::TaskBox* controlTaskBox = new Gui::TaskView::TaskBox - (mainIcon, QObject::tr("Control"), false, 0); + (mainIcon, QObject::tr("Control"), false, nullptr); QVBoxLayout *controlLayout = new QVBoxLayout(); DimensionControl *control = new DimensionControl(controlTaskBox); @@ -832,7 +832,7 @@ void PartGui::goDimensionAngularRoot() bool PartGui::evaluateAngularPreSelection(VectorAdapter &vector1Out, VectorAdapter &vector2Out) { - std::vector selections = Gui::Selection().getSelection(0,false); + std::vector selections = Gui::Selection().getSelection(nullptr,false); if (selections.size() > 4 || selections.size() < 2) return false; std::vector::iterator it; @@ -1380,8 +1380,8 @@ void PartGui::ArcEngine::defaultValues() PartGui::SteppedSelection::SteppedSelection(const uint& buttonCountIn, QWidget* parent) : QWidget(parent) - , stepActive(0) - , stepDone(0) + , stepActive(nullptr) + , stepDone(nullptr) { if (buttonCountIn < 1) return; @@ -1428,12 +1428,12 @@ PartGui::SteppedSelection::~SteppedSelection() if(stepActive) { delete stepActive; - stepActive = 0; + stepActive = nullptr; } if (stepDone) { delete stepDone; - stepDone = 0; + stepDone = nullptr; } } @@ -1450,7 +1450,7 @@ void PartGui::SteppedSelection::buildPixmaps() void PartGui::SteppedSelection::selectionSlot(bool checked) { QPushButton *sender = qobject_cast(QObject::sender()); - assert(sender != 0); + assert(sender != nullptr); std::vector::iterator it; for (it = buttons.begin(); it != buttons.end(); ++it) if (it->first == sender) @@ -1767,14 +1767,14 @@ void PartGui::TaskMeasureAngular::setUpGui() QPixmap mainIcon = Gui::BitmapFactory().pixmap("Part_Measure_Angular"); Gui::TaskView::TaskBox* selectionTaskBox = new Gui::TaskView::TaskBox - (mainIcon, QObject::tr("Selections"), false, 0); + (mainIcon, QObject::tr("Selections"), false, nullptr); QVBoxLayout *selectionLayout = new QVBoxLayout(); stepped = new SteppedSelection(2, selectionTaskBox); selectionLayout->addWidget(stepped); selectionTaskBox->groupLayout()->addLayout(selectionLayout); Gui::TaskView::TaskBox* controlTaskBox = new Gui::TaskView::TaskBox - (mainIcon, QObject::tr("Control"), false, 0); + (mainIcon, QObject::tr("Control"), false, nullptr); QVBoxLayout *controlLayout = new QVBoxLayout(); DimensionControl *control = new DimensionControl(controlTaskBox); diff --git a/src/Mod/Part/Gui/TaskDimension.h b/src/Mod/Part/Gui/TaskDimension.h index 1c3ef840cc..b1a9729831 100644 --- a/src/Mod/Part/Gui/TaskDimension.h +++ b/src/Mod/Part/Gui/TaskDimension.h @@ -62,7 +62,7 @@ namespace PartGui * @param sub sub-object name to search. * @return signal if the search was successful. */ - bool getShapeFromStrings(TopoDS_Shape &shapeOut, const std::string &doc, const std::string &object, const std::string &sub, Base::Matrix4D *mat=0); + bool getShapeFromStrings(TopoDS_Shape &shapeOut, const std::string &doc, const std::string &object, const std::string &sub, Base::Matrix4D *mat=nullptr); /*!examine pre selection * @param shape1 first shape in current selection * @param shape2 second shape in current selection @@ -190,7 +190,7 @@ class SteppedSelection : public QWidget { Q_OBJECT public: - SteppedSelection(const uint &buttonCountIn, QWidget *parent = 0); + SteppedSelection(const uint &buttonCountIn, QWidget *parent = nullptr); ~SteppedSelection(); QPushButton* getButton(const uint &index); void setIconDone(const uint &index); diff --git a/src/Mod/Part/Gui/TaskFaceColors.cpp b/src/Mod/Part/Gui/TaskFaceColors.cpp index 04552116c9..7ee4543ebd 100644 --- a/src/Mod/Part/Gui/TaskFaceColors.cpp +++ b/src/Mod/Part/Gui/TaskFaceColors.cpp @@ -103,7 +103,7 @@ public: Connection connectDelObj; Connection connectUndoDoc; - Private(ViewProviderPartExt* vp) : ui(new Ui_TaskFaceColors()), view(0), vp(vp) + Private(ViewProviderPartExt* vp) : ui(new Ui_TaskFaceColors()), view(nullptr), vp(vp) { obj = vp->getObject(); doc = Gui::Application::Instance->getDocument(obj->getDocument()); @@ -244,7 +244,7 @@ public: } FaceColors* self = reinterpret_cast(ud); - self->d->view = 0; + self->d->view = nullptr; if (self->d->obj && self->d->obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { cb->setHandled(); const TopoDS_Shape& shape = static_cast(self->d->obj)->Shape.getValue(); @@ -463,7 +463,7 @@ TaskFaceColors::TaskFaceColors(ViewProviderPartExt* vp) { widget = new FaceColors(vp); 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/Part/Gui/TaskFaceColors.h b/src/Mod/Part/Gui/TaskFaceColors.h index ebf7645e58..6afd8f751c 100644 --- a/src/Mod/Part/Gui/TaskFaceColors.h +++ b/src/Mod/Part/Gui/TaskFaceColors.h @@ -40,7 +40,7 @@ class FaceColors : public QWidget, public Gui::SelectionObserver Q_OBJECT public: - FaceColors(ViewProviderPartExt* vp, QWidget* parent = 0); + FaceColors(ViewProviderPartExt* vp, QWidget* parent = nullptr); ~FaceColors(); void open(); diff --git a/src/Mod/Part/Gui/TaskLoft.cpp b/src/Mod/Part/Gui/TaskLoft.cpp index 3f8ddcb0ac..181ee8baa7 100644 --- a/src/Mod/Part/Gui/TaskLoft.cpp +++ b/src/Mod/Part/Gui/TaskLoft.cpp @@ -254,7 +254,7 @@ TaskLoft::TaskLoft() widget = new LoftWidget(); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_Loft"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/TaskLoft.h b/src/Mod/Part/Gui/TaskLoft.h index 50d30771d1..8f117f6689 100644 --- a/src/Mod/Part/Gui/TaskLoft.h +++ b/src/Mod/Part/Gui/TaskLoft.h @@ -36,7 +36,7 @@ class LoftWidget : public QWidget Q_OBJECT public: - LoftWidget(QWidget* parent = 0); + LoftWidget(QWidget* parent = nullptr); ~LoftWidget(); bool accept(); diff --git a/src/Mod/Part/Gui/TaskOffset.cpp b/src/Mod/Part/Gui/TaskOffset.cpp index e1d39778c6..2cfdf4f74d 100644 --- a/src/Mod/Part/Gui/TaskOffset.cpp +++ b/src/Mod/Part/Gui/TaskOffset.cpp @@ -234,7 +234,7 @@ TaskOffset::TaskOffset(Part::Offset* offset) widget = new OffsetWidget(offset); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_Offset"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/TaskOffset.h b/src/Mod/Part/Gui/TaskOffset.h index 019530438e..8833e36e53 100644 --- a/src/Mod/Part/Gui/TaskOffset.h +++ b/src/Mod/Part/Gui/TaskOffset.h @@ -35,7 +35,7 @@ class OffsetWidget : public QWidget Q_OBJECT public: - OffsetWidget(Part::Offset*, QWidget* parent = 0); + OffsetWidget(Part::Offset*, QWidget* parent = nullptr); ~OffsetWidget(); bool accept(); diff --git a/src/Mod/Part/Gui/TaskShapeBuilder.cpp b/src/Mod/Part/Gui/TaskShapeBuilder.cpp index 0fb1b5a3e0..765f6d0ed5 100644 --- a/src/Mod/Part/Gui/TaskShapeBuilder.cpp +++ b/src/Mod/Part/Gui/TaskShapeBuilder.cpp @@ -62,7 +62,7 @@ namespace PartGui { enum Type {VERTEX, EDGE, FACE, ALL}; Type mode; ShapeSelection() - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0), mode(ALL) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), mode(ALL) { } void setMode(Type mode) @@ -581,7 +581,7 @@ TaskShapeBuilder::TaskShapeBuilder() widget = new ShapeBuilderWidget(); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_Shapebuilder"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/TaskShapeBuilder.h b/src/Mod/Part/Gui/TaskShapeBuilder.h index b428d8cbe2..718e86d271 100644 --- a/src/Mod/Part/Gui/TaskShapeBuilder.h +++ b/src/Mod/Part/Gui/TaskShapeBuilder.h @@ -36,7 +36,7 @@ class ShapeBuilderWidget : public QWidget, Q_OBJECT public: - ShapeBuilderWidget(QWidget* parent = 0); + ShapeBuilderWidget(QWidget* parent = nullptr); ~ShapeBuilderWidget(); bool accept(); diff --git a/src/Mod/Part/Gui/TaskSweep.cpp b/src/Mod/Part/Gui/TaskSweep.cpp index 9c7920c2f5..31552a94bd 100644 --- a/src/Mod/Part/Gui/TaskSweep.cpp +++ b/src/Mod/Part/Gui/TaskSweep.cpp @@ -78,7 +78,7 @@ public: { public: EdgeSelection() - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr) { } bool allow(App::Document* /*pDoc*/, App::DocumentObject*pObj, const char*sSubName) @@ -438,12 +438,12 @@ void SweepWidget::changeEvent(QEvent *e) /* TRANSLATOR PartGui::TaskSweep */ -TaskSweep::TaskSweep() : label(0) +TaskSweep::TaskSweep() : label(nullptr) { widget = new SweepWidget(); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_Sweep"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/TaskSweep.h b/src/Mod/Part/Gui/TaskSweep.h index d8c71f355d..323003c8b9 100644 --- a/src/Mod/Part/Gui/TaskSweep.h +++ b/src/Mod/Part/Gui/TaskSweep.h @@ -40,7 +40,7 @@ class SweepWidget : public QWidget Q_OBJECT public: - SweepWidget(QWidget* parent = 0); + SweepWidget(QWidget* parent = nullptr); ~SweepWidget(); bool accept(); diff --git a/src/Mod/Part/Gui/TaskThickness.cpp b/src/Mod/Part/Gui/TaskThickness.cpp index dac2c1511b..d6f7ff3c59 100644 --- a/src/Mod/Part/Gui/TaskThickness.cpp +++ b/src/Mod/Part/Gui/TaskThickness.cpp @@ -71,7 +71,7 @@ public: const App::DocumentObject* object; public: FaceSelection(const 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) @@ -290,7 +290,7 @@ TaskThickness::TaskThickness(Part::Thickness* offset) widget->setWindowTitle(ThicknessWidget::tr("Thickness")); taskbox = new Gui::TaskView::TaskBox( Gui::BitmapFactory().pixmap("Part_Thickness"), - widget->windowTitle(), true, 0); + widget->windowTitle(), true, nullptr); taskbox->groupLayout()->addWidget(widget); Content.push_back(taskbox); } diff --git a/src/Mod/Part/Gui/TaskThickness.h b/src/Mod/Part/Gui/TaskThickness.h index 0a0c57c90c..8d27492ba2 100644 --- a/src/Mod/Part/Gui/TaskThickness.h +++ b/src/Mod/Part/Gui/TaskThickness.h @@ -35,7 +35,7 @@ class ThicknessWidget : public QWidget Q_OBJECT public: - ThicknessWidget(Part::Thickness*, QWidget* parent = 0); + ThicknessWidget(Part::Thickness*, QWidget* parent = nullptr); ~ThicknessWidget(); bool accept(); diff --git a/src/Mod/Part/Gui/ViewProvider2DObject.cpp b/src/Mod/Part/Gui/ViewProvider2DObject.cpp index 8455e1128a..c5ad6b8484 100644 --- a/src/Mod/Part/Gui/ViewProvider2DObject.cpp +++ b/src/Mod/Part/Gui/ViewProvider2DObject.cpp @@ -55,7 +55,7 @@ using namespace std; //************************************************************************** // Construction/Destruction -const char* ViewProvider2DObjectGrid::GridStyleEnums[]= {"Dashed","Light",NULL}; +const char* ViewProvider2DObjectGrid::GridStyleEnums[]= {"Dashed","Light",nullptr}; App::PropertyQuantityConstraint::Constraints ViewProvider2DObjectGrid::GridSizeRange = {0.001,DBL_MAX,1.0}; PROPERTY_SOURCE(PartGui::ViewProvider2DObjectGrid, PartGui::ViewProvider2DObject) diff --git a/src/Mod/Part/Gui/ViewProviderCurveNet.cpp b/src/Mod/Part/Gui/ViewProviderCurveNet.cpp index 01dd42ac97..2ee423b1d8 100644 --- a/src/Mod/Part/Gui/ViewProviderCurveNet.cpp +++ b/src/Mod/Part/Gui/ViewProviderCurveNet.cpp @@ -67,7 +67,7 @@ PROPERTY_SOURCE(PartGui::ViewProviderCurveNet,PartGui::ViewProviderPart) ViewProviderCurveNet::ViewProviderCurveNet() - : bInEdit(false),bMovePointMode(false),EdgeRoot(0),VertexRoot(0) + : bInEdit(false),bMovePointMode(false),EdgeRoot(nullptr),VertexRoot(nullptr) { LineWidth.setValue(4.0f); PointSize.setValue(0.05f); diff --git a/src/Mod/Part/Gui/ViewProviderCurveNet.h b/src/Mod/Part/Gui/ViewProviderCurveNet.h index 87a6449387..2d75003f44 100644 --- a/src/Mod/Part/Gui/ViewProviderCurveNet.h +++ b/src/Mod/Part/Gui/ViewProviderCurveNet.h @@ -69,8 +69,8 @@ protected: Gui::SoFCSelection *pcHighlight; SoTransform *pcTransform; Node() { - pcHighlight = 0; - pcTransform = 0; + pcHighlight = nullptr; + pcTransform = nullptr; } }; diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp index 3cda4c59c5..68c022c7e5 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.cpp +++ b/src/Mod/Part/Gui/ViewProviderExt.cpp @@ -103,8 +103,8 @@ PROPERTY_SOURCE(PartGui::ViewProviderPartExt, Gui::ViewProviderGeometryObject) App::PropertyFloatConstraint::Constraints ViewProviderPartExt::sizeRange = {1.0,64.0,1.0}; App::PropertyFloatConstraint::Constraints ViewProviderPartExt::tessRange = {0.01,100.0,0.01}; App::PropertyQuantityConstraint::Constraints ViewProviderPartExt::angDeflectionRange = {1.0,180.0,0.05}; -const char* ViewProviderPartExt::LightingEnums[]= {"One side","Two side",NULL}; -const char* ViewProviderPartExt::DrawStyleEnums[]= {"Solid","Dashed","Dotted","Dashdot",NULL}; +const char* ViewProviderPartExt::LightingEnums[]= {"One side","Two side",nullptr}; +const char* ViewProviderPartExt::DrawStyleEnums[]= {"Solid","Dashed","Dotted","Dashdot",nullptr}; ViewProviderPartExt::ViewProviderPartExt() { @@ -334,7 +334,7 @@ void ViewProviderPartExt::onChanged(const App::Property* prop) DiffuseColor.setValues(colors); App::PropertyContainer* parent = ShapeMaterial.getContainer(); - ShapeMaterial.setContainer(0); + ShapeMaterial.setContainer(nullptr); ShapeMaterial.setTransparency(trans); ShapeMaterial.setContainer(parent); } @@ -515,7 +515,7 @@ SoDetail* ViewProviderPartExt::getDetail(const char* subelement) const element = element.substr(0,pos); } - SoDetail* detail = 0; + SoDetail* detail = nullptr; if (index < 0) return detail; if (element == "Face") { diff --git a/src/Mod/Part/Gui/ViewProviderExt.h b/src/Mod/Part/Gui/ViewProviderExt.h index 4dcbd6ac5c..8be7f52c0a 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.h +++ b/src/Mod/Part/Gui/ViewProviderExt.h @@ -135,7 +135,7 @@ public: /** @name Color management methods */ //@{ - virtual std::map getElementColors(const char *element=0) const override; + virtual std::map getElementColors(const char *element=nullptr) const override; //@} virtual bool isUpdateForced() const override { diff --git a/src/Mod/Part/Gui/ViewProviderMirror.cpp b/src/Mod/Part/Gui/ViewProviderMirror.cpp index 3e5466c99e..314f5598d0 100644 --- a/src/Mod/Part/Gui/ViewProviderMirror.cpp +++ b/src/Mod/Part/Gui/ViewProviderMirror.cpp @@ -533,7 +533,7 @@ bool ViewProviderOffset::setEdit(int ModNum) Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog(); TaskOffset* offsetDlg = qobject_cast(dlg); if (offsetDlg && offsetDlg->getObject() != this->getObject()) - offsetDlg = 0; // another pad left open its task panel + offsetDlg = nullptr; // another pad left open its task panel if (dlg && !offsetDlg) { if (dlg->canClose()) Gui::Control().closeDialog(); @@ -617,7 +617,7 @@ bool ViewProviderThickness::setEdit(int ModNum) Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog(); TaskThickness* thicknessDlg = qobject_cast(dlg); if (thicknessDlg && thicknessDlg->getObject() != this->getObject()) - thicknessDlg = 0; // another pad left open its task panel + thicknessDlg = nullptr; // another pad left open its task panel if (dlg && !thicknessDlg) { if (dlg->canClose()) Gui::Control().closeDialog(); diff --git a/src/Mod/Part/Gui/ViewProviderReference.cpp b/src/Mod/Part/Gui/ViewProviderReference.cpp index 14ea39d379..513138ff07 100644 --- a/src/Mod/Part/Gui/ViewProviderReference.cpp +++ b/src/Mod/Part/Gui/ViewProviderReference.cpp @@ -99,15 +99,15 @@ PROPERTY_SOURCE(PartGui::ViewProviderPartReference, Gui::ViewProviderGeometryObj // Construction/Destruction ViewProviderPartReference::ViewProviderPartReference() - : EdgeRoot(0) - , FaceRoot(0) - , VertexRoot(0) - , pcLineMaterial(0) - , pcPointMaterial(0) - , pcLineStyle(0) - , pcPointStyle(0) - , pcControlPoints(0) - , pShapeHints(0) + : EdgeRoot(nullptr) + , FaceRoot(nullptr) + , VertexRoot(nullptr) + , pcLineMaterial(nullptr) + , pcPointMaterial(nullptr) + , pcLineStyle(nullptr) + , pcPointStyle(nullptr) + , pcControlPoints(nullptr) + , pShapeHints(nullptr) , meshDeviation(0.01f) , noPerVertexNormals(true) , qualityNormals(false)