Buteo Synchronization Framework
StorageItem.h
1/*
2 * This file is part of buteo-syncfw package
3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 *
6 * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23#ifndef STORAGEITEM_H
24#define STORAGEITEM_H
25
26#include <QtGlobal>
27#include <QString>
28#include <QByteArray>
29
30
31namespace Buteo {
32
37{
38public:
43
47 virtual ~StorageItem();
48
53 void setId(const QString &aId);
54
59 const QString &getId() const;
60
65 void setParentId(const QString &aParentId);
66
71 const QString &getParentId() const;
72
77 void setType(const QString &aType);
78
83 const QString &getType() const;
84
89 void setVersion(const QString &aVersion);
90
95 const QString &getVersion() const;
96
103 virtual bool write(qint64 aOffset, const QByteArray &aData) = 0;
104
112 virtual bool read(qint64 aOffset, qint64 aLength, QByteArray &aData) const = 0;
113
119 virtual bool resize(qint64 aLen) = 0;
120
125 virtual qint64 getSize() const = 0;
126
127private:
128 QString iId;
129 QString iParentId;
130 QString iType;
131 QString iVersion;
132};
133
134}
135
136#endif
Class to describe a storable item.
Definition StorageItem.h:37
void setVersion(const QString &aVersion)
Sets the version of this item.
Definition StorageItem.cpp:65
virtual bool resize(qint64 aLen)=0
Sets the length of the item data.
const QString & getParentId() const
Returns the id of the parent of this item.
Definition StorageItem.cpp:50
const QString & getType() const
Gets the type of this item.
Definition StorageItem.cpp:60
const QString & getId() const
Returns the id of the item.
Definition StorageItem.cpp:40
void setId(const QString &aId)
Sets the id of the item.
Definition StorageItem.cpp:35
virtual bool read(qint64 aOffset, qint64 aLength, QByteArray &aData) const =0
Read (part of) the item data.
StorageItem()
Constructor.
Definition StorageItem.cpp:27
virtual qint64 getSize() const =0
Get the size of the item data.
virtual bool write(qint64 aOffset, const QByteArray &aData)=0
Write (part of) the item data.
void setParentId(const QString &aParentId)
Sets the id of the parent of this item.
Definition StorageItem.cpp:45
const QString & getVersion() const
Gets the version of this item.
Definition StorageItem.cpp:70
void setType(const QString &aType)
Sets the type of this item.
Definition StorageItem.cpp:55
virtual ~StorageItem()
Destructor.
Definition StorageItem.cpp:31