StorageItem.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 STORAGEITEM_H
#define STORAGEITEM_H
#include <QtGlobal>
#include <QString>
#include <QByteArray>
namespace Buteo {
class StorageItem
{
public:
StorageItem();
virtual ~StorageItem();
void setId(const QString &aId);
const QString &getId() const;
void setParentId(const QString &aParentId);
const QString &getParentId() const;
void setType(const QString &aType);
const QString &getType() const;
void setVersion(const QString &aVersion);
const QString &getVersion() const;
virtual bool write(qint64 aOffset, const QByteArray &aData) = 0;
virtual bool read(qint64 aOffset, qint64 aLength, QByteArray &aData) const = 0;
virtual bool resize(qint64 aLen) = 0;
virtual qint64 getSize() const = 0;
private:
QString iId;
QString iParentId;
QString iType;
QString iVersion;
};
}
#endif
Buteo::StorageItem::setVersion
void setVersion(const QString &aVersion)
Sets the version of this item.
Definition StorageItem.cpp:66
Buteo::StorageItem::resize
virtual bool resize(qint64 aLen)=0
Sets the length of the item data.
Buteo::StorageItem::getParentId
const QString & getParentId() const
Returns the id of the parent of this item.
Definition StorageItem.cpp:51
Buteo::StorageItem::getType
const QString & getType() const
Gets the type of this item.
Definition StorageItem.cpp:61
Buteo::StorageItem::getId
const QString & getId() const
Returns the id of the item.
Definition StorageItem.cpp:41
Buteo::StorageItem::setId
void setId(const QString &aId)
Sets the id of the item.
Definition StorageItem.cpp:36
Buteo::StorageItem::read
virtual bool read(qint64 aOffset, qint64 aLength, QByteArray &aData) const =0
Read (part of) the item data.
Buteo::StorageItem::StorageItem
StorageItem()
Constructor.
Definition StorageItem.cpp:28
Buteo::StorageItem::getSize
virtual qint64 getSize() const =0
Get the size of the item data.
Buteo::StorageItem::write
virtual bool write(qint64 aOffset, const QByteArray &aData)=0
Write (part of) the item data.
Buteo::StorageItem::setParentId
void setParentId(const QString &aParentId)
Sets the id of the parent of this item.
Definition StorageItem.cpp:46
Buteo::StorageItem::getVersion
const QString & getVersion() const
Gets the version of this item.
Definition StorageItem.cpp:71
Buteo::StorageItem::setType
void setType(const QString &aType)
Sets the type of this item.
Definition StorageItem.cpp:56
Buteo::StorageItem::~StorageItem
virtual ~StorageItem()
Destructor.
Definition StorageItem.cpp:32