Robot: modernize C++: return braced init list

This commit is contained in:
wmayer
2023-08-19 11:29:28 +02:00
parent db3a429100
commit 19faa4727d
5 changed files with 9 additions and 8 deletions

View File

@@ -25,6 +25,8 @@
#include <Base/Placement.h>
#include <Base/Vector3D.h>
#include <Mod/Robot/RobotGlobal.h>
#include "kdl_cp/frames_io.hpp"
namespace Robot

View File

@@ -32,7 +32,7 @@ using namespace Robot;
// returns a string which represents the object e.g. when printed in python
std::string RobotObjectPy::representation() const
{
return std::string("<RobotObject object>");
return {"<RobotObject object>"};
}

View File

@@ -119,10 +119,9 @@ double Trajectory::getDuration(int n) const
Placement Trajectory::getPosition(double time)const
{
if(pcTrajectory)
if (pcTrajectory)
return Placement(toPlacement(pcTrajectory->Pos(time)));
else
return Placement();
return {};
}
double Trajectory::getVelocity(double time)const
@@ -236,7 +235,7 @@ void Trajectory::generateTrajectory()
std::string Trajectory::getUniqueWaypointName(const char *Name) const
{
if (!Name || *Name == '\0')
return std::string();
return {};
// check for first character whether it's a digit
std::string CleanName = Name;

View File

@@ -148,7 +148,7 @@ void WaypointPy::setVelocity(Py::Float arg)
Py::String WaypointPy::getName() const
{
return Py::String(getWaypointPtr()->Name.c_str());
return {getWaypointPtr()->Name};
}
void WaypointPy::setName(Py::String arg)
@@ -202,7 +202,7 @@ void WaypointPy::setPos(Py::Object arg)
Py::Boolean WaypointPy::getCont() const
{
return Py::Boolean(getWaypointPtr()->Cont);
return {getWaypointPtr()->Cont};
}
void WaypointPy::setCont(Py::Boolean arg)

View File

@@ -60,5 +60,5 @@ void ViewProviderTrajectoryCompound::unsetEdit(int)
std::vector<App::DocumentObject*> ViewProviderTrajectoryCompound::claimChildren()const
{
return std::vector<App::DocumentObject*>(static_cast<Robot::TrajectoryCompound *>(getObject())->Source.getValues());
return static_cast<Robot::TrajectoryCompound *>(getObject())->Source.getValues();
}