Add TWENTY_FOUR_HOURS_TICKET. Add toString() and implement conversion

operators in therm of toString().
This commit is contained in:
Gerhard Hoffmann 2024-04-30 13:51:31 +02:00
parent 4ec5589f30
commit 9d0ac4f8ce

View File

@ -4,15 +4,16 @@
#include <QString>
enum class PERMIT_TYPE : quint8 {
SHORT_TERM_PARKING,
DAY_TICKET,
SZEGED_START,
SZEGED_STOP,
DAY_TICKET_ADULT,
DAY_TICKET_TEEN,
DAY_TICKET_CHILD,
FOOD_STAMP,
INVALID
SHORT_TERM_PARKING=0,
DAY_TICKET=1,
SZEGED_START=2,
SZEGED_STOP=3,
DAY_TICKET_ADULT=4,
DAY_TICKET_TEEN=5,
DAY_TICKET_CHILD=6,
INVALID=7,
FOOD_STAMP=8,
TWENTY_FOUR_HOURS_TICKET=9
};
struct PermitType {
@ -45,6 +46,9 @@ struct PermitType {
case 7:
m_permitType = PERMIT_TYPE::FOOD_STAMP;
break;
case 8:
m_permitType = PERMIT_TYPE::TWENTY_FOUR_HOURS_TICKET;
break;
default:
m_permitType = PERMIT_TYPE::INVALID;
}
@ -74,6 +78,8 @@ struct PermitType {
return 6;
case PERMIT_TYPE::FOOD_STAMP:
return 7;
case PERMIT_TYPE::TWENTY_FOUR_HOURS_TICKET:
return 8;
default:
break;
}
@ -81,7 +87,7 @@ struct PermitType {
}
operator QString () {
QString toString() {
switch(m_permitType) {
case PERMIT_TYPE::DAY_TICKET:
return QString("DAY_TICKET");
@ -99,13 +105,15 @@ struct PermitType {
return QString("SZEGED_STOP");
case PERMIT_TYPE::FOOD_STAMP:
return QString("FOOD_STAMP");
case PERMIT_TYPE::TWENTY_FOUR_HOURS_TICKET:
return QString("TWENTY_FOUR_HOURS_TICKET");
default:
break;
}
return QString("INVALID");
}
operator QString () const {
QString toString() const {
switch(m_permitType) {
case PERMIT_TYPE::DAY_TICKET:
return QString("DAY_TICKET");
@ -123,11 +131,21 @@ struct PermitType {
return QString("SZEGED_STOP");
case PERMIT_TYPE::FOOD_STAMP:
return QString("FOOD_STAMP");
case PERMIT_TYPE::TWENTY_FOUR_HOURS_TICKET:
return QString("TWENTY_FOUR_HOURS_TICKET");
default:
break;
}
return QString("INVALID");
}
operator QString () {
return toString();
}
operator QString () const {
return toString();
}
};
#endif // TARIFF_PERMIT_TYPE_H_INCLUDED