Add operator << for printing
This commit is contained in:
parent
3d3794ea4e
commit
96587229e2
@ -2,6 +2,8 @@
|
|||||||
#define TARIFF_CUSTOMER_H_INCLUDED
|
#define TARIFF_CUSTOMER_H_INCLUDED
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDebugStateSaver>
|
||||||
|
|
||||||
struct ATBCustomer {
|
struct ATBCustomer {
|
||||||
enum class CustomerType {ADULT=1000, CHILD, TEEN};
|
enum class CustomerType {ADULT=1000, CHILD, TEEN};
|
||||||
@ -10,6 +12,30 @@ struct ATBCustomer {
|
|||||||
|
|
||||||
CustomerType cust_type;
|
CustomerType cust_type;
|
||||||
QString cust_label;
|
QString cust_label;
|
||||||
|
|
||||||
|
friend QDebug operator<<(QDebug debug, ATBCustomer const &customer) {
|
||||||
|
QDebugStateSaver saver(debug);
|
||||||
|
|
||||||
|
switch(customer.cust_type) {
|
||||||
|
case ATBCustomer::CustomerType::ADULT:
|
||||||
|
debug.nospace()
|
||||||
|
<< " cust_type: " << "CustomerType::ADULT" << "\n"
|
||||||
|
<< "cust_label: " << customer.cust_label << "\n";
|
||||||
|
break;
|
||||||
|
case ATBCustomer::CustomerType::CHILD:
|
||||||
|
debug.nospace()
|
||||||
|
<< " cust_type: " << "CustomerType::CHILD" << "\n"
|
||||||
|
<< "cust_label: " << customer.cust_label << "\n";
|
||||||
|
break;
|
||||||
|
case ATBCustomer::CustomerType::TEEN:
|
||||||
|
debug.nospace()
|
||||||
|
<< " cust_type: " << "CustomerType::TEEN" << "\n"
|
||||||
|
<< "cust_label: " << customer.cust_label << "\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TARIFF_CUSTOMER_H_INCLUDED
|
#endif // TARIFF_CUSTOMER_H_INCLUDED
|
||||||
|
Loading…
Reference in New Issue
Block a user