aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-09-03 20:54:10 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2014-09-03 21:01:39 +0200
commit961c4a04c25237285fb9a694f8918556c690bcd6 (patch)
tree26ea6b464e942876cc509f77c3b03d79cb59f1a6 /src/qt
parent52c1deb74549be201b63264d1a653e08c9a1cc75 (diff)
parent3f6540ad8f9c7b45a0dd2b260a282d3adad2406f (diff)
Merge pull request #4808
3f6540a Rename IMPLEMENT_SERIALIZE to ADD_SERIALIZE_METHODS (Pieter Wuille) 47eb765 Serializer simplifications after IMPLEMENT_SERIALIZE overhaul (Pieter Wuille)
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/recentrequeststablemodel.h12
-rw-r--r--src/qt/walletmodel.h34
2 files changed, 19 insertions, 27 deletions
diff --git a/src/qt/recentrequeststablemodel.h b/src/qt/recentrequeststablemodel.h
index a558aa4942..3df5971823 100644
--- a/src/qt/recentrequeststablemodel.h
+++ b/src/qt/recentrequeststablemodel.h
@@ -24,23 +24,19 @@ public:
QDateTime date;
SendCoinsRecipient recipient;
- IMPLEMENT_SERIALIZE;
+ ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- bool fRead = ser_action.ForRead();
-
- RecentRequestEntry* pthis = const_cast<RecentRequestEntry*>(this);
-
unsigned int nDate = date.toTime_t();
- READWRITE(pthis->nVersion);
- nVersion = pthis->nVersion;
+ READWRITE(this->nVersion);
+ nVersion = this->nVersion;
READWRITE(id);
READWRITE(nDate);
READWRITE(recipient);
- if (fRead)
+ if (ser_action.ForRead())
date = QDateTime::fromTime_t(nDate);
}
};
diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h
index 2a9ac4650f..52d02038cd 100644
--- a/src/qt/walletmodel.h
+++ b/src/qt/walletmodel.h
@@ -59,24 +59,20 @@ public:
static const int CURRENT_VERSION = 1;
int nVersion;
- IMPLEMENT_SERIALIZE;
+ ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- bool fRead = ser_action.ForRead();
-
- SendCoinsRecipient* pthis = const_cast<SendCoinsRecipient*>(this);
-
- std::string sAddress = pthis->address.toStdString();
- std::string sLabel = pthis->label.toStdString();
- std::string sMessage = pthis->message.toStdString();
+ std::string sAddress = address.toStdString();
+ std::string sLabel = label.toStdString();
+ std::string sMessage = message.toStdString();
std::string sPaymentRequest;
- if (!fRead && pthis->paymentRequest.IsInitialized())
- pthis->paymentRequest.SerializeToString(&sPaymentRequest);
- std::string sAuthenticatedMerchant = pthis->authenticatedMerchant.toStdString();
+ if (!ser_action.ForRead() && paymentRequest.IsInitialized())
+ paymentRequest.SerializeToString(&sPaymentRequest);
+ std::string sAuthenticatedMerchant = authenticatedMerchant.toStdString();
- READWRITE(pthis->nVersion);
- nVersion = pthis->nVersion;
+ READWRITE(this->nVersion);
+ nVersion = this->nVersion;
READWRITE(sAddress);
READWRITE(sLabel);
READWRITE(amount);
@@ -84,14 +80,14 @@ public:
READWRITE(sPaymentRequest);
READWRITE(sAuthenticatedMerchant);
- if (fRead)
+ if (ser_action.ForRead())
{
- pthis->address = QString::fromStdString(sAddress);
- pthis->label = QString::fromStdString(sLabel);
- pthis->message = QString::fromStdString(sMessage);
+ address = QString::fromStdString(sAddress);
+ label = QString::fromStdString(sLabel);
+ message = QString::fromStdString(sMessage);
if (!sPaymentRequest.empty())
- pthis->paymentRequest.parse(QByteArray::fromRawData(sPaymentRequest.data(), sPaymentRequest.size()));
- pthis->authenticatedMerchant = QString::fromStdString(sAuthenticatedMerchant);
+ paymentRequest.parse(QByteArray::fromRawData(sPaymentRequest.data(), sPaymentRequest.size()));
+ authenticatedMerchant = QString::fromStdString(sAuthenticatedMerchant);
}
}
};