akonadi
itemserializer_p.h
00001 /* 00002 Copyright (c) 2007 Till Adam <adam@kde.org> 00003 Copyright (c) 2007 Volker Krause <vkrause@kde.org> 00004 00005 This library is free software; you can redistribute it and/or modify it 00006 under the terms of the GNU Library General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or (at your 00008 option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, but WITHOUT 00011 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to the 00017 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 02110-1301, USA. 00019 */ 00020 00021 #ifndef AKONADI_ITEM_SERIALIZER_P_H 00022 #define AKONADI_ITEM_SERIALIZER_P_H 00023 00024 #include <QtCore/QByteArray> 00025 #include <QtCore/QSet> 00026 00027 #include "akonadiprivate_export.h" 00028 00029 #include "itemserializerplugin.h" 00030 00031 #include <memory> 00032 00033 class QIODevice; 00034 00035 namespace Akonadi { 00036 00037 class Item; 00038 00043 class AKONADI_TESTS_EXPORT ItemSerializer 00044 { 00045 public: 00047 static void deserialize( Item& item, const QByteArray& label, const QByteArray& data, int version, bool external ); 00049 static void deserialize( Item& item, const QByteArray& label, QIODevice& data, int version ); 00051 static void serialize( const Item& item, const QByteArray& label, QByteArray& data, int &version ); 00053 static void serialize( const Item& item, const QByteArray& label, QIODevice& data, int &version ); 00054 00060 static void apply( Item& item, const Item &other ); 00061 00065 static QSet<QByteArray> parts( const Item &item ); 00066 00072 static QSet<QByteArray> availableParts( const Item &item ); 00073 00082 static Item convert( const Item & item, int metaTypeId ); 00083 }; 00084 00089 class DefaultItemSerializerPlugin : public QObject, public ItemSerializerPlugin 00090 { 00091 Q_OBJECT 00092 Q_INTERFACES( Akonadi::ItemSerializerPlugin ) 00093 public: 00094 DefaultItemSerializerPlugin(); 00095 00096 bool deserialize( Item&, const QByteArray&, QIODevice&, int ); 00097 void serialize( const Item&, const QByteArray&, QIODevice&, int& ); 00098 }; 00099 00104 class StdStringItemSerializerPlugin : public QObject, public ItemSerializerPlugin 00105 { 00106 Q_OBJECT 00107 Q_INTERFACES( Akonadi::ItemSerializerPlugin ) 00108 public: 00109 StdStringItemSerializerPlugin(); 00110 00111 bool deserialize( Item&, const QByteArray&, QIODevice&, int ); 00112 void serialize( const Item&, const QByteArray&, QIODevice&, int& ); 00113 }; 00114 00115 } 00116 00117 #endif