From 078ca3a9837f969f8990fae05294a29b04425ee0 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Thu, 19 Jun 2025 10:24:45 +0200 Subject: [PATCH] Add getters --- path.cpp | 42 +++++++++++++++++++++++++++++++++++++++++- path.h | 8 ++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/path.cpp b/path.cpp index 4f4fd97..807f60c 100644 --- a/path.cpp +++ b/path.cpp @@ -10,6 +10,46 @@ +QString Path::getCity() const +{ + return city; +} + +int Path::getDepartement() const +{ + return departement; +} + +QString Path::getName() const +{ + return name; +} + +unsigned int Path::getDifficulty() const +{ + return difficulty; +} + +float Path::getDuration() const +{ + return duration; +} + +float Path::getLength() const +{ + return length; +} + +QString Path::getImage() const +{ + return image; +} + +QList Path::getStep() const +{ + return step; +} + Path::Path(QFile *file){ if (!file->open(QIODevice::ReadOnly)) { qWarning() << "Could not open file:" << file->errorString(); @@ -35,7 +75,7 @@ Path::Path(QFile *file){ QJsonArray stepsArray = json["steps"].toArray(); for (const QJsonValue &stepValue : stepsArray) { QJsonObject stepObj = stepValue.toObject(); - step.append(Step(stepObj)); + //step.append(Step(stepObj)); } } diff --git a/path.h b/path.h index 025aafa..8d96a2a 100644 --- a/path.h +++ b/path.h @@ -21,6 +21,14 @@ public: Path(); Path(QFile *file); void addStep(int indice); + QString getCity() const; + int getDepartement() const; + QString getName() const; + unsigned int getDifficulty() const; + float getDuration() const; + float getLength() const; + QString getImage() const; + QList getStep() const; }; #endif // PATH_H