#ifndef TARIFF_INTERPOLATION_H_INCLUDED #define TARIFF_INTERPOLATION_H_INCLUDED #include #include struct ATBInterpolation { enum Type { NO_INTERPOLATION = 1, STATIC_WALLCLOCK_TIME_VALUES = 2, STATIC_TIMEPOINT_AND_DURATION = 3, DYNAMIC_TIMEPOINT_AND_STATIC_DURATION = 4, DYNAMIC_ABSTRACT_TIMEPOINT_AND_STATIC_DURATION = 5, DYNAMIC_ABSTRACT_TIMEPOINT_AND_STATIC_PRICE = 6, DYNAMIC_ABSTRACT_TIMEPOINT_AND_STATIC_END_TIME = 7 }; static QString name(int i) { switch(i) { case (int)(NO_INTERPOLATION): return QString("%1: NO_INTERPOLATION").arg(i); case (int)(STATIC_WALLCLOCK_TIME_VALUES): return QString("%1: STATIC_WALLCLOCK_TIME_VALUES").arg(i); case (int)(STATIC_TIMEPOINT_AND_DURATION): return QString("%1: STATIC_TIMEPOINT_AND_DURATION").arg(i); case (int)(DYNAMIC_TIMEPOINT_AND_STATIC_DURATION): return QString("%1: DYNAMIC_TIMEPOINT_AND_STATIC_DURATION").arg(i); case (int)(DYNAMIC_ABSTRACT_TIMEPOINT_AND_STATIC_DURATION): return QString("%1: DYNAMIC_ABSTRACT_TIMEPOINT_AND_STATIC_DURATION").arg(i); case (int)(DYNAMIC_ABSTRACT_TIMEPOINT_AND_STATIC_PRICE): return QString("%1: DYNAMIC_ABSTRACT_TIMEPOINT_AND_STATIC_PRICE").arg(i); case (int)(DYNAMIC_ABSTRACT_TIMEPOINT_AND_STATIC_END_TIME): return QString("%1: DYNAMIC_ABSTRACT_TIMEPOINT_AND_STATIC_END_TIME").arg(i); default:; } return "ERROR"; } explicit ATBInterpolation() : id(0) , static_start(QTime()) , static_end(QTime()) , static_start_str(QString()) , static_end_str(QString()) , static_duration(0) , dynamic_start(QTime()) , dynamic_end(QTime()) , dynamic_start_str(QString()) , dynamic_end_str(QString()) , dynamic_duration(0) , dynamic_until_price(0) , seemless(false) , never(false) { } int id; QTime static_start; QTime static_end; QString static_start_str; QString static_end_str; int static_duration; QTime dynamic_start; QTime dynamic_end; QString dynamic_start_str; QString dynamic_end_str; int dynamic_duration; int dynamic_until_price; bool seemless; bool never; friend QDebug operator<<(QDebug debug, ATBInterpolation const &i) { QDebugStateSaver saver(debug); debug.nospace() << " id: " << name(i.id) << "\n" << " static_start: " << i.static_start.toString(Qt::ISODate) << "\n" << " static_end: " << i.static_end.toString(Qt::ISODate) << "\n" << " static_start_str: " << i.static_start_str << "\n" << " static_end_str: " << i.static_end_str << "\n" << " static_duration: " << i.static_duration << "\n" << " dynamic_start: " << i.dynamic_start.toString(Qt::ISODate) << "\n" << " dynamic_end: " << i.dynamic_end.toString(Qt::ISODate) << "\n" << " dynamic_start_str: " << i.dynamic_start_str << "\n" << " dynamic_end_str: " << i.dynamic_end_str << "\n" << " dynamic_duration: " << i.dynamic_duration << "\n" << "dynamic_until_price: " << i.dynamic_until_price << "\n" << " seemless: " << i.seemless << "\n" << " never: " << i.never << "\n"; return debug; } }; #endif // TARIFF_INTERPOLATION_H_INCLUDED