Serializer simplifications after IMPLEMENT_SERIALIZE overhaul
This commit is contained in:
@@ -28,19 +28,15 @@ public:
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -63,20 +63,16 @@ public:
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user