From 7422a64c84373082314de54fbd6f47be2302f960 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Sat, 6 Mar 2021 01:05:58 +0100 Subject: [PATCH] [Sketcher] Use std::shared_ptr instead of boost::shared_ptr There's no need to use boost version when stl has support for shared_ptr --- src/Mod/Sketcher/App/PreCompiled.h | 2 +- src/Mod/Sketcher/App/SketchObject.cpp | 16 ++++++++-------- src/Mod/Sketcher/App/SketchObject.h | 4 ++-- src/Mod/Sketcher/App/SketchObjectPyImp.cpp | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Mod/Sketcher/App/PreCompiled.h b/src/Mod/Sketcher/App/PreCompiled.h index 61d28cac82..79665e82a5 100644 --- a/src/Mod/Sketcher/App/PreCompiled.h +++ b/src/Mod/Sketcher/App/PreCompiled.h @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -60,7 +61,6 @@ // Boost #include -#include // Opencascade #include diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 393af9c703..0c15240bd6 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -393,7 +393,7 @@ int SketchObject::setDriving(int ConstrId, bool isdriving) this->Constraints.setValues(std::move(newVals)); if (!isdriving) - setExpression(Constraints.createPath(ConstrId), boost::shared_ptr()); + setExpression(Constraints.createPath(ConstrId), std::shared_ptr()); if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver solve(); @@ -451,7 +451,7 @@ int SketchObject::toggleDriving(int ConstrId) newVals[ConstrId] = constNew; this->Constraints.setValues(std::move(newVals)); if (!constNew->isDriving) - setExpression(Constraints.createPath(ConstrId), boost::shared_ptr()); + setExpression(Constraints.createPath(ConstrId), std::shared_ptr()); if(noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver @@ -556,7 +556,7 @@ int SketchObject::setDatumsDriving(bool isdriving) for (size_t i = 0; i < uvals.size(); i++) { if (!isdriving && uvals[i]->isDimensional()) - setExpression(Constraints.createPath(i), boost::shared_ptr()); + setExpression(Constraints.createPath(i), std::shared_ptr()); } if (noRecomputes) // if we do not have a recompute, the sketch must be solved to update the DoF of the solver @@ -1265,7 +1265,7 @@ int SketchObject::addCopyOfConstraints(const SketchObject &orig) if (expr_info.expression) { // if there is an expression on the source dimensional App::ObjectIdentifier dpath = this->Constraints.createPath(i); - setExpression(dpath, boost::shared_ptr(expr_info.expression->copy())); + setExpression(dpath, std::shared_ptr(expr_info.expression->copy())); } } } @@ -5915,7 +5915,7 @@ int SketchObject::carbonCopy(App::DocumentObject * pObj, bool construction) * if (expr_info.expression)*/ //App::Expression * expr = parse(this, const std::string& buffer); - boost::shared_ptr expr(App::Expression::parse(this, spath.getDocumentObjectName().getString() +std::string(1,'.') + spath.toString())); + std::shared_ptr expr(App::Expression::parse(this, spath.getDocumentObjectName().getString() +std::string(1,'.') + spath.toString())); setExpression(Constraints.createPath(nextcid), expr); } } @@ -7330,7 +7330,7 @@ void SketchObject::validateConstraints() } } -std::string SketchObject::validateExpression(const App::ObjectIdentifier &path, boost::shared_ptr expr) +std::string SketchObject::validateExpression(const App::ObjectIdentifier &path, std::shared_ptr expr) { const App::Property * prop = path.getProperty(); @@ -7422,7 +7422,7 @@ void SketchObject::constraintsRemoved(const std::set &rem std::set::const_iterator i = removed.begin(); while (i != removed.end()) { - ExpressionEngine.setValue(*i, boost::shared_ptr()); + ExpressionEngine.setValue(*i, std::shared_ptr()); ++i; } } @@ -8010,7 +8010,7 @@ bool SketchObject::AutoLockTangencyAndPerpty(Constraint *cstr, bool bForce, bool return true; } -void SketchObject::setExpression(const App::ObjectIdentifier &path, boost::shared_ptr expr) +void SketchObject::setExpression(const App::ObjectIdentifier &path, std::shared_ptr expr) { DocumentObject::setExpression(path, expr); diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index 2964af0d2f..90759eaf48 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -500,9 +500,9 @@ protected: virtual void onDocumentRestored() override; virtual void restoreFinished() override; - virtual void setExpression(const App::ObjectIdentifier &path, boost::shared_ptr expr) override; + virtual void setExpression(const App::ObjectIdentifier &path, std::shared_ptr expr) override; - std::string validateExpression(const App::ObjectIdentifier &path, boost::shared_ptr expr); + std::string validateExpression(const App::ObjectIdentifier &path, std::shared_ptr expr); void constraintsRenamed(const std::map &renamed); void constraintsRemoved(const std::set &removed); diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp index 315af5a79c..45a074abc4 100644 --- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp @@ -24,7 +24,7 @@ #ifndef _PreComp_ # include # include -# include +# include #endif #include @@ -132,7 +132,7 @@ PyObject* SketchObjectPy::addGeometry(PyObject *args) else if (PyObject_TypeCheck(pcObj, &(PyList_Type)) || PyObject_TypeCheck(pcObj, &(PyTuple_Type))) { std::vector geoList; - std::vector > tmpList; + std::vector > tmpList; Py::Sequence list(pcObj); for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { if (PyObject_TypeCheck((*it).ptr(), &(Part::GeometryPy::Type))) { @@ -145,14 +145,14 @@ PyObject* SketchObjectPy::addGeometry(PyObject *args) Handle(Geom_Ellipse) ellipse = Handle(Geom_Ellipse)::DownCast(trim->BasisCurve()); if (!circle.IsNull()) { // create the definition struct for that geom - boost::shared_ptr aoc(new Part::GeomArcOfCircle()); + std::shared_ptr aoc(new Part::GeomArcOfCircle()); aoc->setHandle(trim); geoList.push_back(aoc.get()); tmpList.push_back(aoc); } else if (!ellipse.IsNull()) { // create the definition struct for that geom - boost::shared_ptr aoe(new Part::GeomArcOfEllipse()); + std::shared_ptr aoe(new Part::GeomArcOfEllipse()); aoe->setHandle(trim); geoList.push_back(aoe.get()); tmpList.push_back(aoe);