clangtidy corrections part 2
This commit is contained in:
+40
-28
@@ -4,29 +4,29 @@
|
||||
* @brief Implements the class Route and Point
|
||||
* @version 0.1
|
||||
* @date 2022-01-31
|
||||
*
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "route.h"
|
||||
|
||||
Route::Route() {
|
||||
|
||||
}
|
||||
|
||||
void Route::addPointToRoute(Point point) {
|
||||
void Route::addPointToRoute(Point point)
|
||||
{
|
||||
this->points.push_back(point);
|
||||
}
|
||||
|
||||
void Route::clear() {
|
||||
void Route::clear()
|
||||
{
|
||||
this->points.clear();
|
||||
this->currentPoint = 0;
|
||||
this->started = false;
|
||||
}
|
||||
|
||||
Point Route::startRoute() {
|
||||
if (this->points.size() < 1) {
|
||||
Point Route::startRoute()
|
||||
{
|
||||
if (this->points.empty())
|
||||
{
|
||||
this->started = false;
|
||||
return Point();
|
||||
}
|
||||
@@ -37,8 +37,10 @@ Point Route::startRoute() {
|
||||
return *this->it;
|
||||
}
|
||||
|
||||
Point Route::endRoute() {
|
||||
if (this->points.size() < 1) {
|
||||
Point Route::endRoute()
|
||||
{
|
||||
if (this->points.empty())
|
||||
{
|
||||
this->started = false;
|
||||
return Point();
|
||||
}
|
||||
@@ -51,37 +53,47 @@ Point Route::endRoute() {
|
||||
return *this->it;
|
||||
}
|
||||
|
||||
Point Route::getNextPoint() {
|
||||
Point Route::getNextPoint()
|
||||
{
|
||||
Point point;
|
||||
if (!this->started)
|
||||
return Point();
|
||||
{
|
||||
return point;
|
||||
}
|
||||
|
||||
if (this->it != --this->points.end()) {
|
||||
if (this->it != --this->points.end())
|
||||
{
|
||||
this->it++;
|
||||
this->currentPoint++;
|
||||
return *this->it;
|
||||
// } else if (this->it == this->points.end() && this->currentPoint != this->points.size()) {
|
||||
// this->currentPoint++;
|
||||
// return *this->it;
|
||||
// } else if (this->it == this->points.end() && this->currentPoint != this->points.size()) {
|
||||
// this->currentPoint++;
|
||||
// return *this->it;
|
||||
}
|
||||
|
||||
return Point();
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
Point Route::getPreviousPoint() {
|
||||
Point Route::getPreviousPoint()
|
||||
{
|
||||
Point point;
|
||||
if (!this->started)
|
||||
return Point();
|
||||
|
||||
if (this->it != this->points.begin()) {
|
||||
{
|
||||
return point;
|
||||
}
|
||||
|
||||
if (this->it != this->points.begin())
|
||||
{
|
||||
this->it--;
|
||||
this->currentPoint--;
|
||||
return *this->it;
|
||||
} else {
|
||||
return Point();
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
RouteInfo Route::getRouteInfo() {
|
||||
RouteInfo info;
|
||||
RouteInfo Route::getRouteInfo()
|
||||
{
|
||||
RouteInfo info{0, 0};
|
||||
info.totalPoints = this->points.size();
|
||||
info.currentPoint = this->currentPoint;
|
||||
return info;
|
||||
|
||||
@@ -40,11 +40,6 @@ struct RouteInfo{
|
||||
*/
|
||||
class Route {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Route object.
|
||||
*/
|
||||
Route();
|
||||
|
||||
/**
|
||||
* @brief Adds a point to the list.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user