forked from GerhardHoffmann/DCLibraries
92 lines
2.6 KiB
C++
92 lines
2.6 KiB
C++
#include "dc_result.h"
|
|
#include <QMetaType>
|
|
|
|
struct DCResultInit {
|
|
DCResultInit() {
|
|
qRegisterMetaType<DCResult>();
|
|
}
|
|
};
|
|
|
|
static DCResultInit initMetaTypeDCResult;
|
|
|
|
DCResult::DCResult()
|
|
: m_pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
|
, m_errorCode("NOT-INITIALIZED")
|
|
, m_errorDescription("NOT-INITIALIZED") {
|
|
}
|
|
|
|
DCResult::DCResult(PLUGIN_STATE pState, RESULT_STATE rState,
|
|
QString errorCode, QString errorDescription,
|
|
QString cashValue)
|
|
: m_pluginState(pState)
|
|
, m_resultState(rState)
|
|
, m_errorCode(errorCode)
|
|
, m_errorDescription(errorDescription)
|
|
, m_newCashValue(cashValue) {
|
|
}
|
|
|
|
DCResult::DCResult(PLUGIN_STATE pState, RESULT_STATE rState,
|
|
CASH_STATE cState, QString errorCode,
|
|
QString errorDescription, QString cashValue)
|
|
: m_pluginState(pState)
|
|
, m_resultState(rState)
|
|
, m_cashState(cState)
|
|
, m_errorCode(errorCode)
|
|
, m_errorDescription(errorDescription)
|
|
, m_newCashValue(cashValue) {
|
|
}
|
|
|
|
QDebug operator<<(QDebug d, DCResult const &result) {
|
|
|
|
d << "\n";
|
|
|
|
switch(result.m_pluginState) {
|
|
case DCResult::PLUGIN_STATE::INITIALIZED:
|
|
d << "DC-PLUGIN-STATE ... INITIALIZED\n";
|
|
break;
|
|
case DCResult::PLUGIN_STATE::NOT_INITIALIZED:
|
|
d << "DC-PLUGIN-STATE ... NOT-INITIALIZED\n";
|
|
break;
|
|
}
|
|
|
|
switch(result.m_resultState) {
|
|
case DCResult::RESULT_STATE::SUCCESS:
|
|
d << "DC-RESULT-STATE ... SUCCESS\n";
|
|
break;
|
|
case DCResult::RESULT_STATE::ERROR_BACKEND:
|
|
d << "DC-RESULT-STATE ... ERROR_BACKEND\n";
|
|
break;
|
|
case DCResult::RESULT_STATE::ERROR_TIMEOUT:
|
|
d << "DC-RESULT-STATE ... ERROR_TIMEOUT\n";
|
|
break;
|
|
case DCResult::RESULT_STATE::ERROR_PROCESS:
|
|
d << "DC-RESULT-STATE ... ERROR_PROCESS\n";
|
|
break;
|
|
case DCResult::RESULT_STATE::ERROR_RETRY:
|
|
d << "DC-RESULT-STATE ... ERROR_RETRY\n";
|
|
break;
|
|
case DCResult::RESULT_STATE::INFO:
|
|
d << "DC-RESULT-STATE ... INFO\n";
|
|
break;
|
|
}
|
|
|
|
switch(result.m_cashState) {
|
|
case DCResult::CASH_STATE::CACHE_EMPTY:
|
|
d << "DC-CASH-STATE ... CASH-EMPTY\n";
|
|
break;
|
|
case DCResult::CASH_STATE::CACHE_INPUT:
|
|
d << "DC-CASH-STATE ... CASH-INPUT\n";
|
|
break;
|
|
case DCResult::CASH_STATE::OVERPAYED:
|
|
d << "DC-CASH-STATE ... OVERPAYED\n";
|
|
break;
|
|
case DCResult::CASH_STATE::NOT_AVAILABLE:
|
|
break;
|
|
}
|
|
|
|
d << "DC-ERROR-CODE ..." << result.m_errorCode << "\n";
|
|
d << "DC-ERROR-DESC ..." << result.m_errorDescription << "\n";
|
|
|
|
return d;
|
|
}
|