/***************************************************************************
 *   Copyright (C) 2005 by xavier helluy   *
 *   xavier.helluy@web.de   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.             *
 ***************************************************************************/
#include "marshallinghelper.h"
#include <qiodevice.h>
#include <qdatastream.h>

MarshallingHelper::MarshallingHelper()
{
}


MarshallingHelper::~MarshallingHelper()
{
}

void MarshallingHelper::undoIt(const QByteArray & array , QString & result)
{
	QDataStream out(array, IO_ReadOnly);
	out >>  result;
}

void MarshallingHelper::undoIt (const QByteArray & array , int & result)
{
	QDataStream out(array, IO_ReadOnly);
	out >>  result;
}

void MarshallingHelper::doIt ( QByteArray & array , const  QString & data)
{
	QDataStream in(array, IO_WriteOnly);
	in << (QString) data;
}

void MarshallingHelper::doIt (  QByteArray & array , const  int & data)
{
	QDataStream in(array, IO_WriteOnly);
	in << (int) data;
}

  void MarshallingHelper::doIt (  QByteArray & array , const  QStringList & data)
{
	QDataStream in(array, IO_WriteOnly);
	in << (QStringList) data;
}

  void MarshallingHelper::undoIt (const QByteArray & array , QStringList & result)
{
	QDataStream out(array, IO_ReadOnly);
	out >>  result;

}

