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