Part: modernize C++: return braced init list
This commit is contained in:
@@ -170,7 +170,7 @@ PartExport std::list<TopoDS_Edge> sort_Edges(double tol3d, std::list<TopoDS_Edge
|
||||
}
|
||||
|
||||
if (edge_points.empty())
|
||||
return std::list<TopoDS_Edge>();
|
||||
return {};
|
||||
|
||||
std::list<TopoDS_Edge> sorted;
|
||||
gp_Pnt first, last;
|
||||
|
||||
@@ -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("<Attacher::AttachEngine>");
|
||||
return {"<Attacher::AttachEngine>"};
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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("<Part::AttachableObject>");
|
||||
return {"<Part::AttachableObject>"};
|
||||
}
|
||||
|
||||
PyObject* AttachExtensionPy::positionBySupport(PyObject *args)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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("<BRepFeat_MakePrism object>");
|
||||
return {"<BRepFeat_MakePrism object>"};
|
||||
}
|
||||
|
||||
PyObject* MakePrismPy::init(PyObject *args, PyObject* kwds)
|
||||
|
||||
@@ -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("<BRepOffsetAPI_MakeFilling object>");
|
||||
return {"<BRepOffsetAPI_MakeFilling object>"};
|
||||
}
|
||||
|
||||
PyObject* BRepOffsetAPI_MakeFillingPy::setConstrParam(PyObject *args, PyObject *kwds)
|
||||
|
||||
@@ -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("<BRepOffsetAPI_MakePipeShell object>");
|
||||
return {"<BRepOffsetAPI_MakePipeShell object>"};
|
||||
}
|
||||
|
||||
PyObject* BRepOffsetAPI_MakePipeShellPy::setFrenetMode(PyObject *args)
|
||||
|
||||
@@ -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("<body object>");
|
||||
return {"<body object>"};
|
||||
}
|
||||
|
||||
|
||||
PyObject *BodyBasePy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return nullptr;
|
||||
|
||||
@@ -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("<AnaFilletAlgo object>");
|
||||
return {"<AnaFilletAlgo object>"};
|
||||
}
|
||||
|
||||
PyObject* ChFi2d_AnaFilletAlgoPy::init(PyObject *args)
|
||||
|
||||
@@ -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("<ChamferAPI object>");
|
||||
return {"<ChamferAPI object>"};
|
||||
}
|
||||
|
||||
PyObject* ChFi2d_ChamferAPIPy::init(PyObject *args)
|
||||
|
||||
@@ -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("<FilletAPI object>");
|
||||
return {"<FilletAPI object>"};
|
||||
}
|
||||
|
||||
PyObject* ChFi2d_FilletAPIPy::init(PyObject *args)
|
||||
|
||||
@@ -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("<FilletAlgo object>");
|
||||
return {"<FilletAlgo object>"};
|
||||
}
|
||||
|
||||
PyObject* ChFi2d_FilletAlgoPy::init(PyObject *args)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -189,7 +189,7 @@ TopoDS_Shape FaceMakerCheese::makeFace(std::list<TopoDS_Wire>& wires)
|
||||
TopoDS_Shape FaceMakerCheese::makeFace(const std::vector<TopoDS_Wire>& 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<TopoDS_Wire>& 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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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("<GeomPlate_BuildPlateSurface object>");
|
||||
return {"<GeomPlate_BuildPlateSurface object>"};
|
||||
}
|
||||
|
||||
PyObject* BuildPlateSurfacePy::init(PyObject *args)
|
||||
|
||||
@@ -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("<GeomPlate_CurveConstraint object>");
|
||||
return {"<GeomPlate_CurveConstraint object>"};
|
||||
}
|
||||
|
||||
PyObject* CurveConstraintPy::setOrder(PyObject *args)
|
||||
|
||||
@@ -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("<GeomPlate_PointConstraint object>");
|
||||
return {"<GeomPlate_PointConstraint object>"};
|
||||
}
|
||||
|
||||
PyObject* PointConstraintPy::setOrder(PyObject *args)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<Geometry2d*> Geom2dBSplineCurve::toBiArcs(double /*tolerance*/) const
|
||||
{
|
||||
Standard_Failure::Raise("Not yet implemented");
|
||||
return std::list<Geometry2d*>();
|
||||
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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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("<HLRBRep_Algo object>");
|
||||
return {"<HLRBRep_Algo object>"};
|
||||
}
|
||||
|
||||
PyObject* HLRBRep_AlgoPy::add(PyObject *args)
|
||||
|
||||
@@ -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("<HLRBRep_PolyAlgo object>");
|
||||
return {"<HLRBRep_PolyAlgo object>"};
|
||||
}
|
||||
|
||||
PyObject* HLRBRep_PolyAlgoPy::setProjector(PyObject *args, PyObject *kwds)
|
||||
|
||||
@@ -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("<HLRBRep_HLRToShape object>");
|
||||
return {"<HLRBRep_HLRToShape object>"};
|
||||
}
|
||||
|
||||
PyObject* HLRToShapePy::vCompound(PyObject *args)
|
||||
|
||||
@@ -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("<HLRBRep_PolyHLRToShape object>");
|
||||
return {"<HLRBRep_PolyHLRToShape object>"};
|
||||
}
|
||||
|
||||
PyObject* PolyHLRToShapePy::update(PyObject *args)
|
||||
|
||||
@@ -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<Geometry *> &geomlist,
|
||||
|
||||
@@ -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("<Part::Part2DObject>");
|
||||
return {"<Part::Part2DObject>"};
|
||||
}
|
||||
|
||||
|
||||
|
||||
PyObject *Part2DObjectPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return nullptr;
|
||||
|
||||
@@ -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<App::DocumentObject*> linkStack;
|
||||
|
||||
|
||||
@@ -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("<Part::PartFeature>");
|
||||
return {"<Part::PartFeature>"};
|
||||
}
|
||||
|
||||
PyObject *PartFeaturePy::getCustomAttributes(const char* ) const
|
||||
|
||||
@@ -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("<RectangularTrimmedSurface object>");
|
||||
return {"<RectangularTrimmedSurface object>"};
|
||||
}
|
||||
|
||||
PyObject *RectangularTrimmedSurfacePy::PyMake(struct _typeobject *, PyObject *, PyObject *)
|
||||
|
||||
@@ -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("<ShapeUpgrade_UnifySameDomain object>");
|
||||
return {"<ShapeUpgrade_UnifySameDomain object>"};
|
||||
}
|
||||
|
||||
PyObject* UnifySameDomainPy::allowInternalEdges(PyObject *args)
|
||||
|
||||
@@ -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("<SurfaceOfExtrusion object>");
|
||||
return {"<SurfaceOfExtrusion object>"};
|
||||
}
|
||||
|
||||
PyObject *SurfaceOfExtrusionPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
|
||||
|
||||
@@ -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("<SurfaceOfRevolution object>");
|
||||
return {"<SurfaceOfRevolution object>"};
|
||||
}
|
||||
|
||||
PyObject *SurfaceOfRevolutionPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -393,7 +393,7 @@ TopoDS_Face FaceTypedPlane::buildFace(const FaceVectorType &faces) const
|
||||
std::vector<EdgeVectorType> splitEdges;
|
||||
this->boundarySplit(faces, splitEdges);
|
||||
if (splitEdges.empty())
|
||||
return TopoDS_Face();
|
||||
return {};
|
||||
std::vector<EdgeVectorType>::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<EdgeVectorType> splitEdges;
|
||||
this->boundarySplit(faces, splitEdges);
|
||||
if (splitEdges.empty())
|
||||
return TopoDS_Face();
|
||||
return {};
|
||||
std::vector<EdgeVectorType>::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<TopoDS_Wire>::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();
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
}
|
||||
std::vector<std::string> getDisplayModes() const override
|
||||
{
|
||||
return std::vector<std::string>();
|
||||
return {};
|
||||
}
|
||||
void setCoords(const std::vector<Base::Vector3f>& v)
|
||||
{
|
||||
|
||||
@@ -549,7 +549,7 @@ void PartGui::DlgProjectionOnSurface::create_projection_wire(std::vector<SShapeS
|
||||
TopoDS_Shape PartGui::DlgProjectionOnSurface::create_compound(const std::vector<SShapeStore>& 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<SShapeStore>& iCurrentShape)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -171,7 +171,7 @@ ViewProviderMultiFuse::~ViewProviderMultiFuse()
|
||||
|
||||
std::vector<App::DocumentObject*> ViewProviderMultiFuse::claimChildren()const
|
||||
{
|
||||
return std::vector<App::DocumentObject*>(static_cast<Part::MultiFuse*>(getObject())->Shapes.getValues());
|
||||
return static_cast<Part::MultiFuse*>(getObject())->Shapes.getValues();
|
||||
}
|
||||
|
||||
QIcon ViewProviderMultiFuse::getIcon() const
|
||||
@@ -310,7 +310,7 @@ ViewProviderMultiCommon::~ViewProviderMultiCommon()
|
||||
|
||||
std::vector<App::DocumentObject*> ViewProviderMultiCommon::claimChildren()const
|
||||
{
|
||||
return std::vector<App::DocumentObject*>(static_cast<Part::MultiCommon*>(getObject())->Shapes.getValues());
|
||||
return static_cast<Part::MultiCommon*>(getObject())->Shapes.getValues();
|
||||
}
|
||||
|
||||
QIcon ViewProviderMultiCommon::getIcon() const
|
||||
|
||||
@@ -578,12 +578,12 @@ std::vector<Base::Vector3d> ViewProviderPartExt::getModelPoints(const SoPickedPo
|
||||
}
|
||||
|
||||
// if something went wrong returns an empty array
|
||||
return std::vector<Base::Vector3d>();
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<Base::Vector3d> ViewProviderPartExt::getSelectionShape(const char* /*Element*/) const
|
||||
{
|
||||
return std::vector<Base::Vector3d>();
|
||||
return {};
|
||||
}
|
||||
|
||||
void ViewProviderPartExt::setHighlightedFaces(const std::vector<App::Color>& colors)
|
||||
|
||||
@@ -74,7 +74,7 @@ ViewProviderFace::~ViewProviderFace()
|
||||
|
||||
std::vector<App::DocumentObject*> ViewProviderFace::claimChildren() const
|
||||
{
|
||||
return std::vector<App::DocumentObject*>(static_cast<Part::Face*>(getObject())->Sources.getValues());
|
||||
return static_cast<Part::Face*>(getObject())->Sources.getValues();
|
||||
}
|
||||
|
||||
bool ViewProviderFace::canDragObjects() const
|
||||
|
||||
@@ -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("<body object>");
|
||||
return {"<body object>"};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -340,16 +340,19 @@ bool getReferencedSelection(const App::DocumentObject* thisObj, const Gui::Selec
|
||||
|
||||
QString getRefStr(const App::DocumentObject* obj, const std::vector<std::string>& 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<std::string>& subs)
|
||||
|
||||
@@ -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]));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -248,7 +248,7 @@ std::string ViewProviderDatumCoordinateSystem::getElement(const SoDetail* detail
|
||||
}
|
||||
}
|
||||
|
||||
return std::string();
|
||||
return {};
|
||||
}
|
||||
|
||||
SoDetail* ViewProviderDatumCoordinateSystem::getDetail(const char* subelement) const
|
||||
|
||||
@@ -53,7 +53,7 @@ std::vector<App::DocumentObject*> ViewProviderMultiTransform::claimChildren() co
|
||||
{
|
||||
PartDesign::MultiTransform* pcMultiTransform = static_cast<PartDesign::MultiTransform*>(getObject());
|
||||
if (!pcMultiTransform)
|
||||
return std::vector<App::DocumentObject*>(); // TODO: Show error?
|
||||
return {}; // TODO: Show error?
|
||||
|
||||
std::vector<App::DocumentObject*> transformFeatures = pcMultiTransform->Transformations.getValues();
|
||||
return transformFeatures;
|
||||
|
||||
@@ -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("<PartDesign::ViewProvider>");
|
||||
return {"<PartDesign::ViewProvider>"};
|
||||
}
|
||||
|
||||
PyObject *ViewProviderPy::getCustomAttributes(const char* ) const
|
||||
|
||||
@@ -272,7 +272,7 @@ std::string ViewProviderSubShapeBinder::dropObjectEx(App::DocumentObject* obj, A
|
||||
{
|
||||
auto self = dynamic_cast<PartDesign::SubShapeBinder*>(getObject());
|
||||
if (!self)
|
||||
return std::string();
|
||||
return {};
|
||||
std::map<App::DocumentObject*, std::vector<std::string> > 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 {};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user