diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index 04a52db22b..174f8fa065 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -170,7 +170,7 @@ PartExport std::list sort_Edges(double tol3d, std::list(); + return {}; std::list sorted; gp_Pnt first, last; diff --git a/src/Mod/Part/App/AttachEnginePyImp.cpp b/src/Mod/Part/App/AttachEnginePyImp.cpp index 7b7ab19ebb..b4f08d3a95 100644 --- a/src/Mod/Part/App/AttachEnginePyImp.cpp +++ b/src/Mod/Part/App/AttachEnginePyImp.cpp @@ -40,7 +40,7 @@ using namespace Attacher; // returns a string which represents the object e.g. when printed in python std::string AttachEnginePy::representation() const { - return std::string(""); + return {""}; } PyObject* AttachEnginePy::PyMake(struct _typeobject *, PyObject *, PyObject *) @@ -94,7 +94,7 @@ int AttachEnginePy::PyInit(PyObject* args, PyObject* /*kwd*/) Py::String AttachEnginePy::getAttacherType() const { - return Py::String(std::string(this->getAttachEnginePtr()->getTypeId().getName())); + return {std::string(this->getAttachEnginePtr()->getTypeId().getName())}; } /** @@ -114,7 +114,7 @@ Py::String AttachEnginePy::getMode() const { try { AttachEngine &attacher = *(this->getAttachEnginePtr()); - return Py::String(attacher.getModeName(attacher.mapMode)); + return {attacher.getModeName(attacher.mapMode)}; } ATTACHERPY_STDCATCH_ATTR; } @@ -171,7 +171,7 @@ Py::Boolean AttachEnginePy::getReverse() const { try { AttachEngine &attacher = *(this->getAttachEnginePtr()); - return Py::Boolean(attacher.mapReverse); + return {attacher.mapReverse}; } ATTACHERPY_STDCATCH_ATTR; } diff --git a/src/Mod/Part/App/AttachExtensionPyImp.cpp b/src/Mod/Part/App/AttachExtensionPyImp.cpp index d9fd263565..de1c82b3dc 100644 --- a/src/Mod/Part/App/AttachExtensionPyImp.cpp +++ b/src/Mod/Part/App/AttachExtensionPyImp.cpp @@ -33,7 +33,7 @@ using namespace Part; // returns a string which represents the object e.g. when printed in python std::string AttachExtensionPy::representation() const { - return std::string(""); + return {""}; } PyObject* AttachExtensionPy::positionBySupport(PyObject *args) diff --git a/src/Mod/Part/App/Attacher.cpp b/src/Mod/Part/App/Attacher.cpp index 8cde7d81c4..d50f20c5a8 100644 --- a/src/Mod/Part/App/Attacher.cpp +++ b/src/Mod/Part/App/Attacher.cpp @@ -622,7 +622,7 @@ std::string AttachEngine::getModeName(eMapMode mmode) { if(mmode < 0 || mmode >= mmDummy_NumberOfModes) throw AttachEngineException("AttachEngine::getModeName: Attachment Mode index is out of range"); - return std::string(AttachEngine::eMapModeStrings[mmode]); + return {AttachEngine::eMapModeStrings[mmode]}; } eMapMode AttachEngine::getModeByName(const std::string &modeName) diff --git a/src/Mod/Part/App/BRepFeat/MakePrismPyImp.cpp b/src/Mod/Part/App/BRepFeat/MakePrismPyImp.cpp index e2cb79d59e..8e5611f6e4 100644 --- a/src/Mod/Part/App/BRepFeat/MakePrismPyImp.cpp +++ b/src/Mod/Part/App/BRepFeat/MakePrismPyImp.cpp @@ -99,7 +99,7 @@ int MakePrismPy::PyInit(PyObject* args, PyObject* kwds) // returns a string which represents the object e.g. when printed in python std::string MakePrismPy::representation() const { - return std::string(""); + return {""}; } PyObject* MakePrismPy::init(PyObject *args, PyObject* kwds) diff --git a/src/Mod/Part/App/BRepOffsetAPI_MakeFillingPyImp.cpp b/src/Mod/Part/App/BRepOffsetAPI_MakeFillingPyImp.cpp index 2693221009..a4f9c92684 100644 --- a/src/Mod/Part/App/BRepOffsetAPI_MakeFillingPyImp.cpp +++ b/src/Mod/Part/App/BRepOffsetAPI_MakeFillingPyImp.cpp @@ -116,7 +116,7 @@ int BRepOffsetAPI_MakeFillingPy::PyInit(PyObject* args, PyObject* kwds) // returns a string which represents the object e.g. when printed in python std::string BRepOffsetAPI_MakeFillingPy::representation() const { - return std::string(""); + return {""}; } PyObject* BRepOffsetAPI_MakeFillingPy::setConstrParam(PyObject *args, PyObject *kwds) diff --git a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp index 4dc18a81da..1078445e07 100644 --- a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp +++ b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp @@ -68,7 +68,7 @@ int BRepOffsetAPI_MakePipeShellPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/) // returns a string which represents the object e.g. when printed in python std::string BRepOffsetAPI_MakePipeShellPy::representation() const { - return std::string(""); + return {""}; } PyObject* BRepOffsetAPI_MakePipeShellPy::setFrenetMode(PyObject *args) diff --git a/src/Mod/Part/App/BodyBasePyImp.cpp b/src/Mod/Part/App/BodyBasePyImp.cpp index c2950d5d5a..67ba5bebf9 100644 --- a/src/Mod/Part/App/BodyBasePyImp.cpp +++ b/src/Mod/Part/App/BodyBasePyImp.cpp @@ -33,10 +33,9 @@ using namespace Part; // returns a string which represents the object e.g. when printed in python std::string BodyBasePy::representation() const { - return std::string(""); + return {""}; } - PyObject *BodyBasePy::getCustomAttributes(const char* /*attr*/) const { return nullptr; diff --git a/src/Mod/Part/App/ChFi2d/ChFi2d_AnaFilletAlgoPyImp.cpp b/src/Mod/Part/App/ChFi2d/ChFi2d_AnaFilletAlgoPyImp.cpp index be686c7495..29c90c7eac 100644 --- a/src/Mod/Part/App/ChFi2d/ChFi2d_AnaFilletAlgoPyImp.cpp +++ b/src/Mod/Part/App/ChFi2d/ChFi2d_AnaFilletAlgoPyImp.cpp @@ -81,7 +81,7 @@ int ChFi2d_AnaFilletAlgoPy::PyInit(PyObject* args, PyObject* /*kwd*/) // returns a string which represents the object e.g. when printed in python std::string ChFi2d_AnaFilletAlgoPy::representation() const { - return std::string(""); + return {""}; } PyObject* ChFi2d_AnaFilletAlgoPy::init(PyObject *args) diff --git a/src/Mod/Part/App/ChFi2d/ChFi2d_ChamferAPIPyImp.cpp b/src/Mod/Part/App/ChFi2d/ChFi2d_ChamferAPIPyImp.cpp index 24e2606a27..39e7f581e8 100644 --- a/src/Mod/Part/App/ChFi2d/ChFi2d_ChamferAPIPyImp.cpp +++ b/src/Mod/Part/App/ChFi2d/ChFi2d_ChamferAPIPyImp.cpp @@ -75,7 +75,7 @@ int ChFi2d_ChamferAPIPy::PyInit(PyObject* args, PyObject* /*kwd*/) // returns a string which represents the object e.g. when printed in python std::string ChFi2d_ChamferAPIPy::representation() const { - return std::string(""); + return {""}; } PyObject* ChFi2d_ChamferAPIPy::init(PyObject *args) diff --git a/src/Mod/Part/App/ChFi2d/ChFi2d_FilletAPIPyImp.cpp b/src/Mod/Part/App/ChFi2d/ChFi2d_FilletAPIPyImp.cpp index 485082e6aa..30980f2bbf 100644 --- a/src/Mod/Part/App/ChFi2d/ChFi2d_FilletAPIPyImp.cpp +++ b/src/Mod/Part/App/ChFi2d/ChFi2d_FilletAPIPyImp.cpp @@ -84,7 +84,7 @@ int ChFi2d_FilletAPIPy::PyInit(PyObject* args, PyObject* /*kwd*/) // returns a string which represents the object e.g. when printed in python std::string ChFi2d_FilletAPIPy::representation() const { - return std::string(""); + return {""}; } PyObject* ChFi2d_FilletAPIPy::init(PyObject *args) diff --git a/src/Mod/Part/App/ChFi2d/ChFi2d_FilletAlgoPyImp.cpp b/src/Mod/Part/App/ChFi2d/ChFi2d_FilletAlgoPyImp.cpp index 74a7fc56d6..1e6a480d9c 100644 --- a/src/Mod/Part/App/ChFi2d/ChFi2d_FilletAlgoPyImp.cpp +++ b/src/Mod/Part/App/ChFi2d/ChFi2d_FilletAlgoPyImp.cpp @@ -85,7 +85,7 @@ int ChFi2d_FilletAlgoPy::PyInit(PyObject* args, PyObject* /*kwd*/) // returns a string which represents the object e.g. when printed in python std::string ChFi2d_FilletAlgoPy::representation() const { - return std::string(""); + return {""}; } PyObject* ChFi2d_FilletAlgoPy::init(PyObject *args) diff --git a/src/Mod/Part/App/FaceMaker.cpp b/src/Mod/Part/App/FaceMaker.cpp index d4e39c6388..31c022ab6c 100644 --- a/src/Mod/Part/App/FaceMaker.cpp +++ b/src/Mod/Part/App/FaceMaker.cpp @@ -172,12 +172,12 @@ TYPESYSTEM_SOURCE(Part::FaceMakerSimple, Part::FaceMakerPublic) std::string Part::FaceMakerSimple::getUserFriendlyName() const { - return std::string(QT_TRANSLATE_NOOP("Part_FaceMaker","Simple")); + return {QT_TRANSLATE_NOOP("Part_FaceMaker","Simple")}; } std::string Part::FaceMakerSimple::getBriefExplanation() const { - return std::string(QT_TRANSLATE_NOOP("Part_FaceMaker","Makes separate plane face from every wire independently. No support for holes; wires can be on different planes.")); + return {QT_TRANSLATE_NOOP("Part_FaceMaker","Makes separate plane face from every wire independently. No support for holes; wires can be on different planes.")}; } void Part::FaceMakerSimple::Build_Essence() diff --git a/src/Mod/Part/App/FaceMakerBullseye.cpp b/src/Mod/Part/App/FaceMakerBullseye.cpp index 1708c0229d..12959bae39 100644 --- a/src/Mod/Part/App/FaceMakerBullseye.cpp +++ b/src/Mod/Part/App/FaceMakerBullseye.cpp @@ -55,12 +55,12 @@ void FaceMakerBullseye::setPlane(const gp_Pln &plane) std::string FaceMakerBullseye::getUserFriendlyName() const { - return std::string(QT_TRANSLATE_NOOP("Part_FaceMaker","Bull's-eye facemaker")); + return {QT_TRANSLATE_NOOP("Part_FaceMaker","Bull's-eye facemaker")}; } std::string FaceMakerBullseye::getBriefExplanation() const { - return std::string(QT_TRANSLATE_NOOP("Part_FaceMaker","Supports making planar faces with holes with islands.")); + return {QT_TRANSLATE_NOOP("Part_FaceMaker","Supports making planar faces with holes with islands.")}; } void FaceMakerBullseye::Build_Essence() diff --git a/src/Mod/Part/App/FaceMakerCheese.cpp b/src/Mod/Part/App/FaceMakerCheese.cpp index e6286c76fd..0209b75f1e 100644 --- a/src/Mod/Part/App/FaceMakerCheese.cpp +++ b/src/Mod/Part/App/FaceMakerCheese.cpp @@ -189,7 +189,7 @@ TopoDS_Shape FaceMakerCheese::makeFace(std::list& wires) TopoDS_Shape FaceMakerCheese::makeFace(const std::vector& w) { if (w.empty()) - return TopoDS_Shape(); + return {}; //FIXME: Need a safe method to sort wire that the outermost one comes last // Currently it's done with the diagonal lengths of the bounding boxes @@ -237,19 +237,19 @@ TopoDS_Shape FaceMakerCheese::makeFace(const std::vector& w) return TopoDS_Shape(std::move(comp)); } else { - return TopoDS_Shape(); // error + return {}; // error } } std::string FaceMakerCheese::getUserFriendlyName() const { - return std::string(QT_TRANSLATE_NOOP("Part_FaceMaker","Cheese facemaker")); + return {QT_TRANSLATE_NOOP("Part_FaceMaker","Cheese facemaker")}; } std::string FaceMakerCheese::getBriefExplanation() const { - return std::string(QT_TRANSLATE_NOOP("Part_FaceMaker","Supports making planar faces with holes, but no islands inside holes.")); + return {QT_TRANSLATE_NOOP("Part_FaceMaker","Supports making planar faces with holes, but no islands inside holes.")}; } void FaceMakerCheese::Build_Essence() diff --git a/src/Mod/Part/App/FeatureExtrusion.cpp b/src/Mod/Part/App/FeatureExtrusion.cpp index 6219d2a528..c3fb5ba21f 100644 --- a/src/Mod/Part/App/FeatureExtrusion.cpp +++ b/src/Mod/Part/App/FeatureExtrusion.cpp @@ -334,12 +334,12 @@ TYPESYSTEM_SOURCE(Part::FaceMakerExtrusion, Part::FaceMakerCheese) std::string FaceMakerExtrusion::getUserFriendlyName() const { - return std::string(QT_TRANSLATE_NOOP("Part_FaceMaker", "Part Extrude facemaker")); + return {QT_TRANSLATE_NOOP("Part_FaceMaker", "Part Extrude facemaker")}; } std::string FaceMakerExtrusion::getBriefExplanation() const { - return std::string(QT_TRANSLATE_NOOP("Part_FaceMaker", "Supports making faces with holes, does not support nesting.")); + return {QT_TRANSLATE_NOOP("Part_FaceMaker", "Supports making faces with holes, does not support nesting.")}; } #if OCC_VERSION_HEX >= 0x070600 diff --git a/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp b/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp index f44dcb5c23..687b9640b2 100644 --- a/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp +++ b/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp @@ -128,7 +128,7 @@ int BuildPlateSurfacePy::PyInit(PyObject* args, PyObject* kwds) // returns a string which represents the object e.g. when printed in python std::string BuildPlateSurfacePy::representation() const { - return std::string(""); + return {""}; } PyObject* BuildPlateSurfacePy::init(PyObject *args) diff --git a/src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp b/src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp index 5ab02e40e7..dbf68c53e5 100644 --- a/src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp +++ b/src/Mod/Part/App/GeomPlate/CurveConstraintPyImp.cpp @@ -118,7 +118,7 @@ int CurveConstraintPy::PyInit(PyObject* args, PyObject* kwds) // returns a string which represents the object e.g. when printed in python std::string CurveConstraintPy::representation() const { - return std::string(""); + return {""}; } PyObject* CurveConstraintPy::setOrder(PyObject *args) diff --git a/src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp b/src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp index 4c05b7222c..9d32e96258 100644 --- a/src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp +++ b/src/Mod/Part/App/GeomPlate/PointConstraintPyImp.cpp @@ -70,7 +70,7 @@ int PointConstraintPy::PyInit(PyObject* args, PyObject* kwds) // returns a string which represents the object e.g. when printed in python std::string PointConstraintPy::representation() const { - return std::string(""); + return {""}; } PyObject* PointConstraintPy::setOrder(PyObject *args) diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index 571d8157b1..0fc487df13 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -4705,7 +4705,7 @@ gp_Vec GeomCone::getDN(double u, double v, int Nu, int Nv) const Handle(Geom_ConicalSurface) s = Handle(Geom_ConicalSurface)::DownCast(handle()); Standard_RangeError_Raise_if (Nu + Nv < 1 || Nu < 0 || Nv < 0, " "); if (Nv > 1) { - return gp_Vec (0.0, 0.0, 0.0); + return {0.0, 0.0, 0.0}; } else { return ElSLib__ConeDN(u, v, s->Position(), s->RefRadius(), s->SemiAngle(), Nu, Nv); diff --git a/src/Mod/Part/App/Geometry2d.cpp b/src/Mod/Part/App/Geometry2d.cpp index d7d69c6419..8c1b934608 100644 --- a/src/Mod/Part/App/Geometry2d.cpp +++ b/src/Mod/Part/App/Geometry2d.cpp @@ -156,7 +156,7 @@ Geometry2d *Geom2dPoint::clone() const Base::Vector2d Geom2dPoint::getPoint()const { - return Base::Vector2d(myPoint->X(),myPoint->Y()); + return {myPoint->X(),myPoint->Y()}; } void Geom2dPoint::setPoint(const Base::Vector2d& p) @@ -247,7 +247,7 @@ Base::Vector2d Geom2dCurve::pointAtParameter(double u) const Geom2dLProp_CLProps2d prop(c,u,0,Precision::Confusion()); const gp_Pnt2d &point=prop.Value(); - return Base::Vector2d(point.X(),point.Y()); + return {point.X(),point.Y()}; } Base::Vector2d Geom2dCurve::firstDerivativeAtParameter(double u) const @@ -256,7 +256,7 @@ Base::Vector2d Geom2dCurve::firstDerivativeAtParameter(double u) const Geom2dLProp_CLProps2d prop(c,u,1,Precision::Confusion()); const gp_Vec2d &vec=prop.D1(); - return Base::Vector2d(vec.X(),vec.Y()); + return {vec.X(),vec.Y()}; } Base::Vector2d Geom2dCurve::secondDerivativeAtParameter(double u) const @@ -265,7 +265,7 @@ Base::Vector2d Geom2dCurve::secondDerivativeAtParameter(double u) const Geom2dLProp_CLProps2d prop(c,u,2,Precision::Confusion()); const gp_Vec2d &vec=prop.D2(); - return Base::Vector2d(vec.X(),vec.Y()); + return {vec.X(),vec.Y()}; } bool Geom2dCurve::normal(double u, gp_Dir2d& dir) const @@ -568,7 +568,7 @@ void Geom2dBSplineCurve::makeC1Continuous(double tol) std::list Geom2dBSplineCurve::toBiArcs(double /*tolerance*/) const { Standard_Failure::Raise("Not yet implemented"); - return std::list(); + return {}; } unsigned int Geom2dBSplineCurve::getMemSize() const @@ -607,7 +607,7 @@ Base::Vector2d Geom2dConic::getLocation() const { Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(handle()); const gp_Pnt2d& loc = conic->Location(); - return Base::Vector2d(loc.X(),loc.Y()); + return {loc.X(),loc.Y()}; } void Geom2dConic::setLocation(const Base::Vector2d& Center) @@ -685,7 +685,7 @@ Base::Vector2d Geom2dArcOfConic::getLocation() const Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(handle()); Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(curve->BasisCurve()); const gp_Pnt2d& loc = conic->Location(); - return Base::Vector2d(loc.X(),loc.Y()); + return {loc.X(),loc.Y()}; } void Geom2dArcOfConic::setLocation(const Base::Vector2d& Center) @@ -723,7 +723,7 @@ Base::Vector2d Geom2dArcOfConic::getStartPoint() const { Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(handle()); gp_Pnt2d pnt = curve->StartPoint(); - return Base::Vector2d(pnt.X(), pnt.Y()); + return {pnt.X(), pnt.Y()}; } /*! @@ -734,7 +734,7 @@ Base::Vector2d Geom2dArcOfConic::getEndPoint() const { Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(handle()); gp_Pnt2d pnt = curve->EndPoint(); - return Base::Vector2d(pnt.X(), pnt.Y()); + return {pnt.X(), pnt.Y()}; } /*! @@ -948,7 +948,7 @@ Base::Vector2d Geom2dCircle::getCircleCenter (const Base::Vector2d &p1, const Ba double x = (w0*p1.x + w1*p2.x + w2*p3.x)/wx; double y = (w0*p1.y + w1*p2.y + w2*p3.y)/wx; - return Base::Vector2d(x, y); + return {x, y}; } // ------------------------------------------------- @@ -1148,7 +1148,7 @@ void Geom2dEllipse::setMinorRadius(double Radius) Base::Vector2d Geom2dEllipse::getMajorAxisDir() const { gp_Dir2d xdir = myCurve->XAxis().Direction(); - return Base::Vector2d(xdir.X(), xdir.Y()); + return {xdir.X(), xdir.Y()}; } /*! @@ -1319,7 +1319,7 @@ Base::Vector2d Geom2dArcOfEllipse::getMajorAxisDir() const Handle(Geom2d_Ellipse) c = Handle(Geom2d_Ellipse)::DownCast(myCurve->BasisCurve()); assert(!c.IsNull()); gp_Dir2d xdir = c->XAxis().Direction(); - return Base::Vector2d(xdir.X(), xdir.Y()); + return {xdir.X(), xdir.Y()}; } /*! @@ -1933,13 +1933,13 @@ void Geom2dLine::setLine(const Base::Vector2d& Pos, const Base::Vector2d& Dir) Base::Vector2d Geom2dLine::getPos() const { gp_Pnt2d Pos = this->myCurve->Lin2d().Location(); - return Base::Vector2d(Pos.X(),Pos.Y()); + return {Pos.X(),Pos.Y()}; } Base::Vector2d Geom2dLine::getDir() const { gp_Dir2d Dir = this->myCurve->Lin2d().Direction(); - return Base::Vector2d(Dir.X(),Dir.Y()); + return {Dir.X(),Dir.Y()}; } const Handle(Geom2d_Geometry)& Geom2dLine::handle() const @@ -2050,14 +2050,14 @@ Base::Vector2d Geom2dLineSegment::getStartPoint() const { Handle(Geom2d_TrimmedCurve) this_curve = Handle(Geom2d_TrimmedCurve)::DownCast(handle()); gp_Pnt2d pnt = this_curve->StartPoint(); - return Base::Vector2d(pnt.X(), pnt.Y()); + return {pnt.X(), pnt.Y()}; } Base::Vector2d Geom2dLineSegment::getEndPoint() const { Handle(Geom2d_TrimmedCurve) this_curve = Handle(Geom2d_TrimmedCurve)::DownCast(handle()); gp_Pnt2d pnt = this_curve->EndPoint(); - return Base::Vector2d(pnt.X(), pnt.Y()); + return {pnt.X(), pnt.Y()}; } void Geom2dLineSegment::setPoints(const Base::Vector2d& Start, const Base::Vector2d& End) diff --git a/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp b/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp index 1d27427e24..94f93a9ad0 100644 --- a/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp @@ -83,7 +83,7 @@ int GeometryBoolExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/) Py::Boolean GeometryBoolExtensionPy::getValue() const { - return Py::Boolean(this->getGeometryBoolExtensionPtr()->getValue()); + return {this->getGeometryBoolExtensionPtr()->getValue()}; } void GeometryBoolExtensionPy::setValue(Py::Boolean value) diff --git a/src/Mod/Part/App/GeometryExtensionPyImp.cpp b/src/Mod/Part/App/GeometryExtensionPyImp.cpp index 2f434389e2..f98dc19044 100644 --- a/src/Mod/Part/App/GeometryExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryExtensionPyImp.cpp @@ -80,7 +80,7 @@ Py::String GeometryExtensionPy::getName() const { std::string name = this->getGeometryExtensionPtr()->getName(); - return Py::String(name); + return {name}; } void GeometryExtensionPy::setName(Py::String arg) diff --git a/src/Mod/Part/App/GeometryPyImp.cpp b/src/Mod/Part/App/GeometryPyImp.cpp index bd7fcb0ad9..095ef90d54 100644 --- a/src/Mod/Part/App/GeometryPyImp.cpp +++ b/src/Mod/Part/App/GeometryPyImp.cpp @@ -428,7 +428,7 @@ PyObject* GeometryPy::getExtensions(PyObject *args) Py::String GeometryPy::getTag() const { std::string tmp = boost::uuids::to_string(getGeometryPtr()->getTag()); - return Py::String(tmp); + return {tmp}; } PyObject *GeometryPy::getCustomAttributes(const char* /*attr*/) const diff --git a/src/Mod/Part/App/GeometryStringExtensionPyImp.cpp b/src/Mod/Part/App/GeometryStringExtensionPyImp.cpp index b5a03a6db5..01e3f1621a 100644 --- a/src/Mod/Part/App/GeometryStringExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryStringExtensionPyImp.cpp @@ -86,7 +86,7 @@ int GeometryStringExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/) Py::String GeometryStringExtensionPy::getValue() const { - return Py::String(this->getGeometryStringExtensionPtr()->getValue()); + return {this->getGeometryStringExtensionPtr()->getValue()}; } void GeometryStringExtensionPy::setValue(Py::String value) diff --git a/src/Mod/Part/App/HLRBRep/HLRBRep_AlgoPyImp.cpp b/src/Mod/Part/App/HLRBRep/HLRBRep_AlgoPyImp.cpp index 1a176548a9..2b59c9309b 100644 --- a/src/Mod/Part/App/HLRBRep/HLRBRep_AlgoPyImp.cpp +++ b/src/Mod/Part/App/HLRBRep/HLRBRep_AlgoPyImp.cpp @@ -61,7 +61,7 @@ int HLRBRep_AlgoPy::PyInit(PyObject* /*args*/, PyObject* /*kwds*/) // returns a string which represents the object e.g. when printed in python std::string HLRBRep_AlgoPy::representation() const { - return std::string(""); + return {""}; } PyObject* HLRBRep_AlgoPy::add(PyObject *args) diff --git a/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp b/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp index 99b780d9dd..5ba9e76997 100644 --- a/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp +++ b/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp @@ -75,7 +75,7 @@ int HLRBRep_PolyAlgoPy::PyInit(PyObject* args, PyObject* /*kwds*/) // returns a string which represents the object e.g. when printed in python std::string HLRBRep_PolyAlgoPy::representation() const { - return std::string(""); + return {""}; } PyObject* HLRBRep_PolyAlgoPy::setProjector(PyObject *args, PyObject *kwds) diff --git a/src/Mod/Part/App/HLRBRep/HLRToShapePyImp.cpp b/src/Mod/Part/App/HLRBRep/HLRToShapePyImp.cpp index 9cd935c9c0..049027242f 100644 --- a/src/Mod/Part/App/HLRBRep/HLRToShapePyImp.cpp +++ b/src/Mod/Part/App/HLRBRep/HLRToShapePyImp.cpp @@ -52,7 +52,7 @@ int HLRToShapePy::PyInit(PyObject* args, PyObject* /*kwds*/) // returns a string which represents the object e.g. when printed in python std::string HLRToShapePy::representation() const { - return std::string(""); + return {""}; } PyObject* HLRToShapePy::vCompound(PyObject *args) diff --git a/src/Mod/Part/App/HLRBRep/PolyHLRToShapePyImp.cpp b/src/Mod/Part/App/HLRBRep/PolyHLRToShapePyImp.cpp index 6d2978ec84..ba65c39537 100644 --- a/src/Mod/Part/App/HLRBRep/PolyHLRToShapePyImp.cpp +++ b/src/Mod/Part/App/HLRBRep/PolyHLRToShapePyImp.cpp @@ -54,7 +54,7 @@ int PolyHLRToShapePy::PyInit(PyObject* args, PyObject* /*kwds*/) // returns a string which represents the object e.g. when printed in python std::string PolyHLRToShapePy::representation() const { - return std::string(""); + return {""}; } PyObject* PolyHLRToShapePy::update(PyObject *args) diff --git a/src/Mod/Part/App/Part2DObject.cpp b/src/Mod/Part/App/Part2DObject.cpp index 97a60bee80..d98daa2126 100644 --- a/src/Mod/Part/App/Part2DObject.cpp +++ b/src/Mod/Part/App/Part2DObject.cpp @@ -99,7 +99,7 @@ Base::Axis Part2DObject::getAxis(int axId) const else if (axId == N_Axis) { return Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(0,0,1)); } - return Base::Axis(); + return {}; } bool Part2DObject::seekTrimPoints(const std::vector &geomlist, diff --git a/src/Mod/Part/App/Part2DObjectPyImp.cpp b/src/Mod/Part/App/Part2DObjectPyImp.cpp index cce74f31d6..8df1266629 100644 --- a/src/Mod/Part/App/Part2DObjectPyImp.cpp +++ b/src/Mod/Part/App/Part2DObjectPyImp.cpp @@ -35,11 +35,9 @@ using namespace Part; // returns a string which represents the object e.g. when printed in python std::string Part2DObjectPy::representation() const { - return std::string(""); + return {""}; } - - PyObject *Part2DObjectPy::getCustomAttributes(const char* /*attr*/) const { return nullptr; diff --git a/src/Mod/Part/App/PartFeature.cpp b/src/Mod/Part/App/PartFeature.cpp index cb5168581b..b714bac74e 100644 --- a/src/Mod/Part/App/PartFeature.cpp +++ b/src/Mod/Part/App/PartFeature.cpp @@ -451,7 +451,7 @@ TopoShape Feature::getTopoShape(const App::DocumentObject *obj, const char *subn bool resolveLink, bool transform, bool noElementMap) { if(!obj || !obj->getNameInDocument()) - return TopoShape(); + return {}; std::vector linkStack; diff --git a/src/Mod/Part/App/PartFeaturePyImp.cpp b/src/Mod/Part/App/PartFeaturePyImp.cpp index 09c8a361cb..7398ad44d8 100644 --- a/src/Mod/Part/App/PartFeaturePyImp.cpp +++ b/src/Mod/Part/App/PartFeaturePyImp.cpp @@ -34,7 +34,7 @@ using namespace Part; // returns a string which represent the object e.g. when printed in python std::string PartFeaturePy::representation() const { - return std::string(""); + return {""}; } PyObject *PartFeaturePy::getCustomAttributes(const char* ) const diff --git a/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp b/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp index cc6b2edcc9..0a6baedb05 100644 --- a/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp +++ b/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp @@ -38,7 +38,7 @@ using namespace Part; // returns a string which represents the object e.g. when printed in python std::string RectangularTrimmedSurfacePy::representation() const { - return std::string(""); + return {""}; } PyObject *RectangularTrimmedSurfacePy::PyMake(struct _typeobject *, PyObject *, PyObject *) diff --git a/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp b/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp index 849568b52c..2ccc6c41f0 100644 --- a/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp +++ b/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp @@ -108,7 +108,7 @@ PyObject* UnifySameDomainPy::initialize(PyObject *args, PyObject* kwds) // returns a string which represents the object e.g. when printed in python std::string UnifySameDomainPy::representation() const { - return std::string(""); + return {""}; } PyObject* UnifySameDomainPy::allowInternalEdges(PyObject *args) diff --git a/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp b/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp index 9d114cf49b..651bf96b00 100644 --- a/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp +++ b/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp @@ -40,7 +40,7 @@ using namespace Part; // returns a string which represents the object e.g. when printed in python std::string SurfaceOfExtrusionPy::representation() const { - return std::string(""); + return {""}; } PyObject *SurfaceOfExtrusionPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper diff --git a/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp b/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp index 5ec90835a1..f9eae0a862 100644 --- a/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp +++ b/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp @@ -38,7 +38,7 @@ using namespace Part; // returns a string which represents the object e.g. when printed in python std::string SurfaceOfRevolutionPy::representation() const { - return std::string(""); + return {""}; } PyObject *SurfaceOfRevolutionPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index 505bc0b33d..8c144af1ab 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -270,7 +270,7 @@ TYPESYSTEM_SOURCE(Part::ShapeSegment , Data::Segment) std::string ShapeSegment::getName() const { - return std::string(); + return {}; } // ------------------------------------------------ @@ -325,13 +325,13 @@ TopoDS_Shape TopoShape::getSubShape(TopAbs_ShapeEnum type, int index, bool silen { if(index <= 0) { if(silent) - return TopoDS_Shape(); + return {}; Standard_Failure::Raise("Unsupported sub-shape type"); } if (this->_Shape.IsNull()) { if(silent) - return TopoDS_Shape(); + return {}; Standard_Failure::Raise("Cannot get sub-shape from empty shape"); } @@ -350,12 +350,12 @@ TopoDS_Shape TopoShape::getSubShape(TopAbs_ShapeEnum type, int index, bool silen } } catch(Standard_Failure &) { if(silent) - return TopoDS_Shape(); + return {}; throw; } if(!silent) Standard_Failure::Raise("Index out of bound"); - return TopoDS_Shape(); + return {}; } unsigned long TopoShape::countSubShapes(const char* Type) const @@ -2122,7 +2122,7 @@ TopoDS_Shape TopoShape::makeTube(double radius, double tol, int cont, int maxdeg return mkBuilder.Shape(); } - return TopoDS_Shape(); + return {}; } @@ -3009,7 +3009,7 @@ TopoDS_Shape TopoShape::makeOffset2D(double offset, short joinType, bool fill, b //assemble output compound if (shapesToReturn.empty()) - return TopoDS_Shape(); //failure + return {}; //failure if (shapesToReturn.size() > 1 || forceOutputCompound){ TopoDS_Compound result; BRep_Builder builder; diff --git a/src/Mod/Part/App/modelRefine.cpp b/src/Mod/Part/App/modelRefine.cpp index 4b40a997f9..e755922daf 100644 --- a/src/Mod/Part/App/modelRefine.cpp +++ b/src/Mod/Part/App/modelRefine.cpp @@ -393,7 +393,7 @@ TopoDS_Face FaceTypedPlane::buildFace(const FaceVectorType &faces) const std::vector splitEdges; this->boundarySplit(faces, splitEdges); if (splitEdges.empty()) - return TopoDS_Face(); + return {}; std::vector::iterator splitIt; for (splitIt = splitEdges.begin(); splitIt != splitEdges.end(); ++splitIt) { @@ -409,7 +409,7 @@ TopoDS_Face FaceTypedPlane::buildFace(const FaceVectorType &faces) const BRepLib_MakeFace faceMaker(wires.at(0), Standard_True); if (faceMaker.Error() != BRepLib_FaceDone) - return TopoDS_Face(); + return {}; TopoDS_Face current = faceMaker.Face(); if (wires.size() > 1) { @@ -419,11 +419,11 @@ TopoDS_Face FaceTypedPlane::buildFace(const FaceVectorType &faces) const faceFix.Add(wires.at(index)); faceFix.Perform(); if (faceFix.Status(ShapeExtend_FAIL)) - return TopoDS_Face(); + return {}; faceFix.FixOrientation(); faceFix.Perform(); if(faceFix.Status(ShapeExtend_FAIL)) - return TopoDS_Face(); + return {}; current = faceFix.Face(); } @@ -967,7 +967,7 @@ TopoDS_Face FaceTypedBSpline::buildFace(const FaceVectorType &faces) const std::vector splitEdges; this->boundarySplit(faces, splitEdges); if (splitEdges.empty()) - return TopoDS_Face(); + return {}; std::vector::iterator splitIt; for (splitIt = splitEdges.begin(); splitIt != splitEdges.end(); ++splitIt) { @@ -984,19 +984,19 @@ TopoDS_Face FaceTypedBSpline::buildFace(const FaceVectorType &faces) const //make face from surface and outer wire. Handle(Geom_BSplineSurface) surface = Handle(Geom_BSplineSurface)::DownCast(BRep_Tool::Surface(faces.at(0))); if (!surface) - return TopoDS_Face(); + return {}; std::vector::iterator wireIt; wireIt = wires.begin(); BRepBuilderAPI_MakeFace faceMaker(surface, *wireIt); if (!faceMaker.IsDone()) - return TopoDS_Face(); + return {}; //add additional boundaries. for (wireIt++; wireIt != wires.end(); ++wireIt) { faceMaker.Add(*wireIt); if (!faceMaker.IsDone()) - return TopoDS_Face(); + return {}; } //fix newly constructed face. Orientation doesn't seem to get fixed the first call. @@ -1004,11 +1004,11 @@ TopoDS_Face FaceTypedBSpline::buildFace(const FaceVectorType &faces) const faceFixer.SetContext(new ShapeBuild_ReShape()); faceFixer.Perform(); if (faceFixer.Status(ShapeExtend_FAIL)) - return TopoDS_Face(); + return {}; faceFixer.FixOrientation(); faceFixer.Perform(); if (faceFixer.Status(ShapeExtend_FAIL)) - return TopoDS_Face(); + return {}; return faceFixer.Face(); } diff --git a/src/Mod/Part/Gui/CrossSections.cpp b/src/Mod/Part/Gui/CrossSections.cpp index 2604a9c638..95f4cea8f2 100644 --- a/src/Mod/Part/Gui/CrossSections.cpp +++ b/src/Mod/Part/Gui/CrossSections.cpp @@ -93,7 +93,7 @@ public: } std::vector getDisplayModes() const override { - return std::vector(); + return {}; } void setCoords(const std::vector& v) { diff --git a/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp b/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp index 7b45d6bb64..5db4489240 100644 --- a/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp +++ b/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp @@ -549,7 +549,7 @@ void PartGui::DlgProjectionOnSurface::create_projection_wire(std::vector& iShapeVec) { if (iShapeVec.empty()) - return TopoDS_Shape(); + return {}; TopoDS_Compound aCompound; TopoDS_Builder aBuilder; @@ -856,7 +856,7 @@ TopoDS_Wire PartGui::DlgProjectionOnSurface::sort_and_heal_wire(const std::vecto shapeAnalyzer.ConnectEdgesToWires(shapeList, 0.0001, false, aWireHandle); shapeAnalyzer.ConnectWiresToWires(aWireHandle, 0.0001, false, aWireWireHandle); if (!aWireWireHandle) - return TopoDS_Wire(); + return {}; for (auto it = 1; it <= aWireWireHandle->Length(); ++it) { auto aShape = TopoDS::Wire(aWireWireHandle->Value(it)); @@ -871,7 +871,7 @@ TopoDS_Wire PartGui::DlgProjectionOnSurface::sort_and_heal_wire(const std::vecto Q_UNUSED(retVal); return TopoDS::Wire(aWireFramFix.Shape()); } - return TopoDS_Wire(); + return {}; } void PartGui::DlgProjectionOnSurface::create_face_extrude(std::vector& iCurrentShape) diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp index d2c78e4bd7..4e842e49e7 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp +++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp @@ -275,10 +275,10 @@ ResultModel::~ResultModel() QModelIndex ResultModel::index(int row, int column, const QModelIndex &parent) const { if (!root) - return QModelIndex(); + return {}; ResultEntry *parentNode = nodeFromIndex(parent); if (!parentNode) - return QModelIndex(); + return {}; return createIndex(row, column, parentNode->children.at(row)); } @@ -286,13 +286,13 @@ QModelIndex ResultModel::parent(const QModelIndex &child) const { ResultEntry *childNode = nodeFromIndex(child); if (!childNode) - return QModelIndex(); + return {}; ResultEntry *parentNode = childNode->parent; if (!parentNode) - return QModelIndex(); + return {}; ResultEntry *grandParentNode = parentNode->parent; if (!grandParentNode) - return QModelIndex(); + return {}; int row = grandParentNode->children.indexOf(parentNode); return createIndex(row, 0, parentNode); } @@ -314,10 +314,10 @@ int ResultModel::columnCount(const QModelIndex &parent) const QVariant ResultModel::data(const QModelIndex &index, int role) const { if (role != Qt::DisplayRole) - return QVariant(); + return {}; ResultEntry *node = nodeFromIndex(index); if (!node) - return QVariant(); + return {}; switch (index.column()) { case 0: @@ -327,13 +327,13 @@ QVariant ResultModel::data(const QModelIndex &index, int role) const case 2: return QVariant(node->error); } - return QVariant(); + return {}; } QVariant ResultModel::headerData(int section, Qt::Orientation orientation, int role) const { if (orientation != Qt::Horizontal || role != Qt::DisplayRole) - return QVariant(); + return {}; switch (section) { case 0: @@ -343,7 +343,7 @@ QVariant ResultModel::headerData(int section, Qt::Orientation orientation, int r case 2: return QVariant(QString(tr("Error"))); } - return QVariant(); + return {}; } void ResultModel::setResults(ResultEntry *resultsIn) diff --git a/src/Mod/Part/Gui/TaskDimension.cpp b/src/Mod/Part/Gui/TaskDimension.cpp index 25ae208afb..dca5bfc95f 100644 --- a/src/Mod/Part/Gui/TaskDimension.cpp +++ b/src/Mod/Part/Gui/TaskDimension.cpp @@ -1711,13 +1711,13 @@ PartGui::VectorAdapter PartGui::TaskMeasureAngular::buildAdapter(const PartGui:: { TopoDS_Shape edgeShape; if (!getShapeFromStrings(edgeShape, current.documentName, current.objectName, current.subObjectName,&mat)) - return VectorAdapter(); + return {}; TopoDS_Edge edge = TopoDS::Edge(edgeShape); // make edge orientation so that end of edge closest to pick is head of vector. TopoDS_Vertex firstVertex = TopExp::FirstVertex(edge, Standard_True); TopoDS_Vertex lastVertex = TopExp::LastVertex(edge, Standard_True); if (firstVertex.IsNull() || lastVertex.IsNull()) - return VectorAdapter(); + return {}; gp_Vec firstPoint = PartGui::convert(firstVertex); gp_Vec lastPoint = PartGui::convert(lastVertex); Base::Vector3d v(current.x,current.y,current.z); @@ -1738,7 +1738,7 @@ PartGui::VectorAdapter PartGui::TaskMeasureAngular::buildAdapter(const PartGui:: { TopoDS_Shape faceShape; if (!getShapeFromStrings(faceShape, current.documentName, current.objectName, current.subObjectName,&mat)) - return VectorAdapter(); + return {}; TopoDS_Face face = TopoDS::Face(faceShape); Base::Vector3d v(current.x,current.y,current.z); @@ -1754,9 +1754,9 @@ PartGui::VectorAdapter PartGui::TaskMeasureAngular::buildAdapter(const PartGui:: assert(current2.shapeType == DimSelections::Vertex); TopoDS_Shape vertexShape1, vertexShape2; if(!getShapeFromStrings(vertexShape1, current1.documentName, current1.objectName, current1.subObjectName)) - return VectorAdapter(); + return {}; if(!getShapeFromStrings(vertexShape2, current2.documentName, current2.objectName, current2.subObjectName)) - return VectorAdapter(); + return {}; TopoDS_Vertex vertex1 = TopoDS::Vertex(vertexShape1); TopoDS_Vertex vertex2 = TopoDS::Vertex(vertexShape2); diff --git a/src/Mod/Part/Gui/ViewProviderBoolean.cpp b/src/Mod/Part/Gui/ViewProviderBoolean.cpp index ed4a59abf2..0be87f4e26 100644 --- a/src/Mod/Part/Gui/ViewProviderBoolean.cpp +++ b/src/Mod/Part/Gui/ViewProviderBoolean.cpp @@ -171,7 +171,7 @@ ViewProviderMultiFuse::~ViewProviderMultiFuse() std::vector ViewProviderMultiFuse::claimChildren()const { - return std::vector(static_cast(getObject())->Shapes.getValues()); + return static_cast(getObject())->Shapes.getValues(); } QIcon ViewProviderMultiFuse::getIcon() const @@ -310,7 +310,7 @@ ViewProviderMultiCommon::~ViewProviderMultiCommon() std::vector ViewProviderMultiCommon::claimChildren()const { - return std::vector(static_cast(getObject())->Shapes.getValues()); + return static_cast(getObject())->Shapes.getValues(); } QIcon ViewProviderMultiCommon::getIcon() const diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp index 13778d15b4..99adaa6019 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.cpp +++ b/src/Mod/Part/Gui/ViewProviderExt.cpp @@ -578,12 +578,12 @@ std::vector ViewProviderPartExt::getModelPoints(const SoPickedPo } // if something went wrong returns an empty array - return std::vector(); + return {}; } std::vector ViewProviderPartExt::getSelectionShape(const char* /*Element*/) const { - return std::vector(); + return {}; } void ViewProviderPartExt::setHighlightedFaces(const std::vector& colors) diff --git a/src/Mod/Part/Gui/ViewProviderPlaneParametric.cpp b/src/Mod/Part/Gui/ViewProviderPlaneParametric.cpp index d13e8505d9..22bff2ab56 100644 --- a/src/Mod/Part/Gui/ViewProviderPlaneParametric.cpp +++ b/src/Mod/Part/Gui/ViewProviderPlaneParametric.cpp @@ -74,7 +74,7 @@ ViewProviderFace::~ViewProviderFace() std::vector ViewProviderFace::claimChildren() const { - return std::vector(static_cast(getObject())->Sources.getValues()); + return static_cast(getObject())->Sources.getValues(); } bool ViewProviderFace::canDragObjects() const diff --git a/src/Mod/PartDesign/App/BodyPyImp.cpp b/src/Mod/PartDesign/App/BodyPyImp.cpp index 6f3bcf4e1e..63f4d5dcc9 100644 --- a/src/Mod/PartDesign/App/BodyPyImp.cpp +++ b/src/Mod/PartDesign/App/BodyPyImp.cpp @@ -35,7 +35,7 @@ using namespace PartDesign; // returns a string which represents the object e.g. when printed in python std::string BodyPy::representation() const { - return std::string(""); + return {""}; } diff --git a/src/Mod/PartDesign/App/Feature.cpp b/src/Mod/PartDesign/App/Feature.cpp index d147e0d507..2c52f40578 100644 --- a/src/Mod/PartDesign/App/Feature.cpp +++ b/src/Mod/PartDesign/App/Feature.cpp @@ -77,7 +77,7 @@ TopoDS_Shape Feature::getSolid(const TopoDS_Shape& shape) return xp.Current(); } - return TopoDS_Shape(); + return {}; } int Feature::countSolids(const TopoDS_Shape& shape, TopAbs_ShapeEnum type) diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp index 7759862b0f..1383f2b125 100644 --- a/src/Mod/PartDesign/App/FeatureHole.cpp +++ b/src/Mod/PartDesign/App/FeatureHole.cpp @@ -1647,7 +1647,7 @@ void Hole::updateProps() static gp_Pnt toPnt(gp_Vec dir) { - return gp_Pnt(dir.X(), dir.Y(), dir.Z()); + return {dir.X(), dir.Y(), dir.Z()}; } App::DocumentObjectExecReturn* Hole::execute() diff --git a/src/Mod/PartDesign/Gui/ReferenceSelection.cpp b/src/Mod/PartDesign/Gui/ReferenceSelection.cpp index 1b7ea37730..cc821b1ff3 100644 --- a/src/Mod/PartDesign/Gui/ReferenceSelection.cpp +++ b/src/Mod/PartDesign/Gui/ReferenceSelection.cpp @@ -340,16 +340,19 @@ bool getReferencedSelection(const App::DocumentObject* thisObj, const Gui::Selec QString getRefStr(const App::DocumentObject* obj, const std::vector& sub) { - if (!obj) - return QString::fromLatin1(""); + if (!obj) { + return {}; + } - if (PartDesign::Feature::isDatum(obj)) + if (PartDesign::Feature::isDatum(obj)) { return QString::fromLatin1(obj->getNameInDocument()); - else if (!sub.empty()) + } + else if (!sub.empty()) { return QString::fromLatin1(obj->getNameInDocument()) + QString::fromLatin1(":") + QString::fromLatin1(sub.front().c_str()); - else - return QString(); + } + + return {}; } std::string buildLinkSubPythonStr(const App::DocumentObject* obj, const std::vector& subs) diff --git a/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp b/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp index a15f146316..a9bec6398e 100644 --- a/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp @@ -135,7 +135,7 @@ void TaskSketchBasedParameters::exitSelectionMode() QVariant TaskSketchBasedParameters::setUpToFace(const QString& text) { if (text.isEmpty()) - return QVariant(); + return {}; QStringList parts = text.split(QChar::fromLatin1(':')); if (parts.length() < 2) @@ -144,15 +144,15 @@ QVariant TaskSketchBasedParameters::setUpToFace(const QString& text) // Check whether this is the name of an App::Plane or Part::Datum feature App::DocumentObject* obj = vp->getObject()->getDocument()->getObject(parts[0].toLatin1()); if (!obj) - return QVariant(); + return {}; if (obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) { // everything is OK (we assume a Part can only have exactly 3 App::Plane objects located at the base of the feature tree) - return QVariant(); + return {}; } else if (obj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId())) { // it's up to the document to check that the datum plane is in the same body - return QVariant(); + return {}; } else { // We must expect that "parts[1]" is the translation of "Face" followed by an ID. @@ -162,7 +162,7 @@ QVariant TaskSketchBasedParameters::setUpToFace(const QString& text) QRegularExpression rx(name); QRegularExpressionMatch match; if (parts[1].indexOf(rx, 0, &match) < 0) { - return QVariant(); + return {}; } int faceId = match.captured(1).toInt(); @@ -200,7 +200,7 @@ QVariant TaskSketchBasedParameters::objectNameByLabel(const QString& label, } } - return QVariant(); // no such feature found + return {}; // no such feature found } QString TaskSketchBasedParameters::getFaceReference(const QString& obj, const QString& sub) const @@ -209,7 +209,7 @@ QString TaskSketchBasedParameters::getFaceReference(const QString& obj, const QS QString o = obj.left(obj.indexOf(QString::fromLatin1(":"))); if (o.isEmpty()) - return QString(); + return {}; return QString::fromLatin1(R"((App.getDocument("%1").%2, ["%3"]))") .arg(QString::fromLatin1(doc->getName()), o, sub); @@ -223,7 +223,7 @@ QString TaskSketchBasedParameters::make2DLabel(const App::DocumentObject* sectio } else if (subValues.empty()) { Base::Console().Error("No valid subelement linked in %s\n", section->Label.getValue()); - return QString(); + return {}; } else { return QString::fromStdString((std::string(section->getNameInDocument()) + ":" + subValues[0])); diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp index 515c1825e4..7c84e38206 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp @@ -190,7 +190,7 @@ std::string ViewProviderDatum::getElement(const SoDetail* detail) const return datumType.toStdString(); } - return std::string(""); + return {}; } SoDetail* ViewProviderDatum::getDetail(const char* subelement) const diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatumCS.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatumCS.cpp index 3c0a1cbb8b..38dbc85b85 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatumCS.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatumCS.cpp @@ -248,7 +248,7 @@ std::string ViewProviderDatumCoordinateSystem::getElement(const SoDetail* detail } } - return std::string(); + return {}; } SoDetail* ViewProviderDatumCoordinateSystem::getDetail(const char* subelement) const diff --git a/src/Mod/PartDesign/Gui/ViewProviderMultiTransform.cpp b/src/Mod/PartDesign/Gui/ViewProviderMultiTransform.cpp index 13c89070a5..5b5476c90c 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderMultiTransform.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderMultiTransform.cpp @@ -53,7 +53,7 @@ std::vector ViewProviderMultiTransform::claimChildren() co { PartDesign::MultiTransform* pcMultiTransform = static_cast(getObject()); if (!pcMultiTransform) - return std::vector(); // TODO: Show error? + return {}; // TODO: Show error? std::vector transformFeatures = pcMultiTransform->Transformations.getValues(); return transformFeatures; diff --git a/src/Mod/PartDesign/Gui/ViewProviderPyImp.cpp b/src/Mod/PartDesign/Gui/ViewProviderPyImp.cpp index 5f3d0730ce..542fa72d0a 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderPyImp.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderPyImp.cpp @@ -34,7 +34,7 @@ using namespace PartDesignGui; // returns a string which represent the object e.g. when printed in python std::string ViewProviderPy::representation() const { - return std::string(""); + return {""}; } PyObject *ViewProviderPy::getCustomAttributes(const char* ) const diff --git a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp index 31a77cf361..caee9ee808 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp @@ -272,7 +272,7 @@ std::string ViewProviderSubShapeBinder::dropObjectEx(App::DocumentObject* obj, A { auto self = dynamic_cast(getObject()); if (!self) - return std::string(); + return {}; std::map > values; if (!subname) subname = ""; std::string sub(subname); @@ -293,7 +293,7 @@ std::string ViewProviderSubShapeBinder::dropObjectEx(App::DocumentObject* obj, A self->setLinks(std::move(values), QApplication::keyboardModifiers() == Qt::ControlModifier); if (self->Relative.getValue()) updatePlacement(false); - return std::string(); + return {}; }