StoragePlugin.h
/*
* This file is part of buteo-syncfw package
*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef STORAGEPLUGIN_H_89943984899843
#define STORAGEPLUGIN_H_89943984899843
#include <QObject>
#include <QMap>
#include <QList>
#include <QDateTime>
namespace Buteo {
class StorageItem;
class StoragePlugin : public QObject
{
Q_OBJECT
public:
enum OperationStatus {
STATUS_INVALID_FORMAT = -6,
STATUS_STORAGE_FULL = -5,
STATUS_OBJECT_TOO_BIG = -4,
STATUS_ERROR = -3,
STATUS_DUPLICATE = -2,
STATUS_NOT_FOUND = -1,
STATUS_OK = 0
};
StoragePlugin(const QString &aPluginName);
virtual ~StoragePlugin();
const QString &getPluginName() const;
QString getProperty(const QString &aProperty) const;
void getProperties(QMap<QString, QString> &aProperties) const;
virtual bool init(const QMap<QString, QString> &aProperties) = 0;
virtual bool uninit() = 0;
virtual bool getAllItems(QList<StorageItem *> &aItems) = 0;
virtual bool getAllItemIds(QList<QString> &aItems) = 0;
virtual bool getNewItems(QList<StorageItem *> &aNewItems, const QDateTime &aTime) = 0;
virtual bool getNewItemIds(QList<QString> &aNewItemIds, const QDateTime &aTime) = 0;
virtual bool getModifiedItems(QList<StorageItem *> &aModifiedItems, const QDateTime &aTime) = 0;
virtual bool getModifiedItemIds(QList<QString> &aModifiedItemIds, const QDateTime &aTime) = 0;
virtual bool getDeletedItemIds(QList<QString> &aDeletedItemIds, const QDateTime &aTime) = 0;
virtual StorageItem *newItem() = 0;
virtual StorageItem *getItem(const QString &aItemId) = 0;
virtual QList<StorageItem *> getItems(const QStringList &aItemIdList) = 0;
virtual OperationStatus addItem(StorageItem &aItem) = 0;
virtual QList<OperationStatus> addItems(const QList<StorageItem *> &aItems) = 0;
virtual OperationStatus modifyItem(StorageItem &aItem) = 0;
virtual QList<OperationStatus> modifyItems(const QList<StorageItem *> &aItems) = 0;
virtual OperationStatus deleteItem(const QString &aItemId) = 0;
virtual QList<OperationStatus> deleteItems(const QList<QString> &aItemIds) = 0;
protected:
QString iPluginName;
QMap<QString, QString> iProperties;
};
}
#endif // STORAGEPLUGIN_H_89943984899843
Buteo::StorageItem
Class to describe a storable item.
Definition StorageItem.h:37
Buteo::StoragePlugin::getProperties
void getProperties(QMap< QString, QString > &aProperties) const
Returns the properties set for this plugin.
Definition StoragePlugin.cpp:52
Buteo::StoragePlugin::deleteItems
virtual QList< OperationStatus > deleteItems(const QList< QString > &aItemIds)=0
Deletes an item from the storage.
Buteo::StoragePlugin::deleteItem
virtual OperationStatus deleteItem(const QString &aItemId)=0
Deletes an item from the storage.
Buteo::StoragePlugin::getProperty
QString getProperty(const QString &aProperty) const
Returns the value of the given property.
Definition StoragePlugin.cpp:42
Buteo::StoragePlugin::getItems
virtual QList< StorageItem * > getItems(const QStringList &aItemIdList)=0
Returns items based on ids.
Buteo::StoragePlugin::getNewItemIds
virtual bool getNewItemIds(QList< QString > &aNewItemIds, const QDateTime &aTime)=0
Returns id's of all new items since aTime (creation time > aTime).
Buteo::StoragePlugin::getModifiedItems
virtual bool getModifiedItems(QList< StorageItem * > &aModifiedItems, const QDateTime &aTime)=0
Returns all modified items since aTime.
Buteo::StoragePlugin::uninit
virtual bool uninit()=0
Uninitializes the plugin.
Buteo::StoragePlugin::getItem
virtual StorageItem * getItem(const QString &aItemId)=0
Returns an item based on id.
Buteo::StoragePlugin::iProperties
QMap< QString, QString > iProperties
Properties of the plugin as read from profile xml.
Definition StoragePlugin.h:236
Buteo::StoragePlugin::StoragePlugin
StoragePlugin(const QString &aPluginName)
Constructor.
Definition StoragePlugin.cpp:28
Buteo::StoragePlugin::OperationStatus
OperationStatus
Status of operation performed by storage plugin.
Definition StoragePlugin.h:46
Buteo::StoragePlugin::STATUS_OBJECT_TOO_BIG
@ STATUS_OBJECT_TOO_BIG
Definition StoragePlugin.h:49
Buteo::StoragePlugin::STATUS_INVALID_FORMAT
@ STATUS_INVALID_FORMAT
Definition StoragePlugin.h:47
Buteo::StoragePlugin::STATUS_NOT_FOUND
@ STATUS_NOT_FOUND
Definition StoragePlugin.h:52
Buteo::StoragePlugin::STATUS_ERROR
@ STATUS_ERROR
Definition StoragePlugin.h:50
Buteo::StoragePlugin::STATUS_STORAGE_FULL
@ STATUS_STORAGE_FULL
Definition StoragePlugin.h:48
Buteo::StoragePlugin::STATUS_OK
@ STATUS_OK
Definition StoragePlugin.h:53
Buteo::StoragePlugin::STATUS_DUPLICATE
@ STATUS_DUPLICATE
Definition StoragePlugin.h:51
Buteo::StoragePlugin::newItem
virtual StorageItem * newItem()=0
Generates a new item.
Buteo::StoragePlugin::getModifiedItemIds
virtual bool getModifiedItemIds(QList< QString > &aModifiedItemIds, const QDateTime &aTime)=0
Returns id's of all modified items since aTime.
Buteo::StoragePlugin::getPluginName
const QString & getPluginName() const
Returns the name of this plugin.
Definition StoragePlugin.cpp:37
Buteo::StoragePlugin::iPluginName
QString iPluginName
Name of the plugin.
Definition StoragePlugin.h:233
Buteo::StoragePlugin::init
virtual bool init(const QMap< QString, QString > &aProperties)=0
Initializes the plugin.
Buteo::StoragePlugin::getAllItems
virtual bool getAllItems(QList< StorageItem * > &aItems)=0
Returns all known items.
Buteo::StoragePlugin::modifyItems
virtual QList< OperationStatus > modifyItems(const QList< StorageItem * > &aItems)=0
Modifies item in the storage.
Buteo::StoragePlugin::getNewItems
virtual bool getNewItems(QList< StorageItem * > &aNewItems, const QDateTime &aTime)=0
Returns all new items since aTime.
Buteo::StoragePlugin::addItem
virtual OperationStatus addItem(StorageItem &aItem)=0
Adds an item to the storage.
Buteo::StoragePlugin::addItems
virtual QList< OperationStatus > addItems(const QList< StorageItem * > &aItems)=0
Adds items to the storage.
Buteo::StoragePlugin::getDeletedItemIds
virtual bool getDeletedItemIds(QList< QString > &aDeletedItemIds, const QDateTime &aTime)=0
Returns id's of all deleted items since aTime.
Buteo::StoragePlugin::getAllItemIds
virtual bool getAllItemIds(QList< QString > &aItems)=0
Returns id's of all known items.
Buteo::StoragePlugin::~StoragePlugin
virtual ~StoragePlugin()
Destructor.
Definition StoragePlugin.cpp:33
Buteo::StoragePlugin::modifyItem
virtual OperationStatus modifyItem(StorageItem &aItem)=0
Modifies an item in the storage.
QList
Definition SyncBackupAdaptor.h:40
QMap
Definition SyncBackupAdaptor.h:41