Package version checks

This commit is contained in:
Albert Vaca 2013-07-04 14:31:47 +02:00
parent 17d0fd4902
commit fa3e0145ad

View file

@ -29,11 +29,13 @@
#include <ctime>
#include <qjson/qobjecthelper.h>
const static int CURRENT_PACKAGE_VERSION = 1;
NetworkPackage::NetworkPackage(QString type)
{
mId = time(NULL);
mType = type;
mVersion = 1;
mVersion = CURRENT_PACKAGE_VERSION;
}
QByteArray NetworkPackage::serialize() const
@ -65,6 +67,11 @@ void NetworkPackage::unserialize(QByteArray a, NetworkPackage* np)
np->setVersion(-1);
}
if (np->version() > CURRENT_PACKAGE_VERSION) {
qDebug() << "Warning: package version " << np->version() << " greater than supported version " << CURRENT_PACKAGE_VERSION;
}
//QVariant -> Object
//NetworkPackage np;
//QJSon json(a);