2011-05-05 17:45:44 -04:00
|
|
|
#include "Response.h"
|
2013-02-02 17:32:54 -05:00
|
|
|
#include "ErrorMessage.h"
|
2011-05-05 17:45:44 -04:00
|
|
|
#include <iostream>
|
|
|
|
|
2012-12-12 01:47:54 -05:00
|
|
|
Response::Response(bool success, QString message, QObject *parent) : QObject(parent) {
|
2012-04-17 12:06:12 -04:00
|
|
|
m_success = success;
|
|
|
|
m_message = message.toUtf8();
|
|
|
|
}
|
|
|
|
|
2012-12-12 01:47:54 -05:00
|
|
|
Response::Response(bool success, QByteArray message, QObject *parent) : QObject(parent) {
|
2011-05-05 17:45:44 -04:00
|
|
|
m_success = success;
|
|
|
|
m_message = message;
|
|
|
|
}
|
|
|
|
|
2013-02-02 17:32:54 -05:00
|
|
|
Response::Response(bool success, ErrorMessage *message, QObject *parent) : QObject(parent) {
|
|
|
|
m_success = success;
|
|
|
|
m_message = message->toString();
|
|
|
|
message->deleteLater();
|
|
|
|
}
|
|
|
|
|
2012-12-12 01:47:54 -05:00
|
|
|
Response::Response(bool success, QObject *parent) : QObject(parent) {
|
2011-05-05 19:13:25 -04:00
|
|
|
m_success = success;
|
2011-05-05 17:45:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Response::isSuccess() const {
|
|
|
|
return m_success;
|
|
|
|
}
|
|
|
|
|
2012-04-17 12:06:12 -04:00
|
|
|
QByteArray Response::message() const {
|
2011-05-05 17:45:44 -04:00
|
|
|
return m_message;
|
|
|
|
}
|
2012-07-11 23:36:22 -04:00
|
|
|
|
|
|
|
QString Response::toString() const {
|
|
|
|
return QString(m_success ? "Success(" : "Failure(") + m_message + ")";
|
|
|
|
}
|