Add getters

This commit is contained in:
T'JAMPENS QUENTIN p2406187 2025-06-19 10:24:45 +02:00
parent 37000d8281
commit 078ca3a983
2 changed files with 49 additions and 1 deletions

View File

@ -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<Step> 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));
}
}

8
path.h
View File

@ -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<Step> getStep() const;
};
#endif // PATH_H