Add getters
This commit is contained in:
parent
37000d8281
commit
078ca3a983
42
path.cpp
42
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<Step> Path::getStep() const
|
||||||
|
{
|
||||||
|
return step;
|
||||||
|
}
|
||||||
|
|
||||||
Path::Path(QFile *file){
|
Path::Path(QFile *file){
|
||||||
if (!file->open(QIODevice::ReadOnly)) {
|
if (!file->open(QIODevice::ReadOnly)) {
|
||||||
qWarning() << "Could not open file:" << file->errorString();
|
qWarning() << "Could not open file:" << file->errorString();
|
||||||
@ -35,7 +75,7 @@ Path::Path(QFile *file){
|
|||||||
QJsonArray stepsArray = json["steps"].toArray();
|
QJsonArray stepsArray = json["steps"].toArray();
|
||||||
for (const QJsonValue &stepValue : stepsArray) {
|
for (const QJsonValue &stepValue : stepsArray) {
|
||||||
QJsonObject stepObj = stepValue.toObject();
|
QJsonObject stepObj = stepValue.toObject();
|
||||||
step.append(Step(stepObj));
|
//step.append(Step(stepObj));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
8
path.h
8
path.h
@ -21,6 +21,14 @@ public:
|
|||||||
Path();
|
Path();
|
||||||
Path(QFile *file);
|
Path(QFile *file);
|
||||||
void addStep(int indice);
|
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
|
#endif // PATH_H
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user