#include "Serialization.hpp"
#include <QMetaProperty>
QDataStream &operator<<(QDataStream &ds,const QObject &obj)
{
	for (int i=0;i<obj.metaObject()->propertyCount();++i)
	{
		if((obj.metaObject()->property(i)).isUser(&obj))
		{
			ds << obj.metaObject()->property(i).read(&obj);
		}
	}

	return ds;
}
QDataStream &operator>>(QDataStream &ds,QObject &obj)
{	QVariant var;
	for (int i=0;i<obj.metaObject()->propertyCount();++i)
	{
		if((obj.metaObject()->property(i)).isUser(&obj))
		{
			ds>>var;
			obj.metaObject()->property(i).write(&obj,var);
		}
	}
	return ds;
}

