QJson project page QJson home page

/home/nick/rpmbuild/BUILD/qjson/src/serializerrunnable.cpp
00001 #include "serializerrunnable.h"
00002 
00003 /* This file is part of qjson
00004  *
00005  * Copyright (C) 2009 Flavio Castelli <flavio@castelli.name>
00006  *               2009 Frank Osterfeld <osterfeld@kde.org>
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Library General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2 of the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Library General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Library General Public License
00019  * along with this library; see the file COPYING.LIB.  If not, write to
00020  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021  * Boston, MA 02110-1301, USA.
00022  */
00023 
00024 #include "parserrunnable.h"
00025 #include "serializer.h"
00026 
00027 #include <QtCore/QDebug>
00028 #include <QtCore/QVariant>
00029 
00030 using namespace QJson;
00031 
00032 class SerializerRunnable::Private
00033 {
00034 public:
00035   QVariant json;
00036 };
00037 
00038 SerializerRunnable::SerializerRunnable(QObject* parent)
00039     : QObject(parent),
00040       QRunnable(),
00041       d(new Private)
00042 {
00043   qRegisterMetaType<QVariant>("QVariant");
00044 }
00045 
00046 SerializerRunnable::~SerializerRunnable()
00047 {
00048   delete d;
00049 }
00050 
00051 void SerializerRunnable::setJsonObject( const QVariant& json )
00052 {
00053   d->json = json;
00054 }
00055 
00056 void SerializerRunnable::run()
00057 {
00058   Serializer serializer;
00059   emit parsingFinished( Serializer().serialize( d->json ), true, QString() );
00060 }

SourceForge Logo hosts this site. Send comments to:
QJson Developers