Buteo Synchronization Framework: StorageItem.h Source File

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
31 namespace Buteo {
32
36 class StorageItem
37 {
38 public:
39
43 StorageItem();
44
48 virtual ~StorageItem();
49
54 void setId(const QString &aId);
55
60 const QString &getId() const;
61
66 void setParentId(const QString &aParentId);
67
72 const QString &getParentId() const;
73
78 void setType(const QString &aType);
79
84 const QString &getType() const;
85
90 void setVersion(const QString &aVersion);
91
96 const QString &getVersion() const;
97
104 virtual bool write(qint64 aOffset, const QByteArray &aData) = 0;
105
113 virtual bool read(qint64 aOffset, qint64 aLength, QByteArray &aData) const = 0;
114
120 virtual bool resize(qint64 aLen) = 0;
121
126 virtual qint64 getSize() const = 0;
127
128 private:
129 QString iId;
130 QString iParentId;
131 QString iType;
132 QString iVersion;
133
134 };
135
136 }
137
138 #endif
Buteo::StorageItem
Class to describe a storable item.
Definition: StorageItem.h:37
Buteo::StorageItem::setVersion
void setVersion(const QString &aVersion)
Sets the version of this item.
Definition: StorageItem.cpp:65
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:50
Buteo::StorageItem::getType
const QString & getType() const
Gets the type of this item.
Definition: StorageItem.cpp:60
Buteo::StorageItem::getId
const QString & getId() const
Returns the id of the item.
Definition: StorageItem.cpp:40
Buteo::StorageItem::setId
void setId(const QString &aId)
Sets the id of the item.
Definition: StorageItem.cpp:35
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:27
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:45
Buteo::StorageItem::getVersion
const QString & getVersion() const
Gets the version of this item.
Definition: StorageItem.cpp:70
Buteo::StorageItem::setType
void setType(const QString &aType)
Sets the type of this item.
Definition: StorageItem.cpp:55
Buteo::StorageItem::~StorageItem
virtual ~StorageItem()
Destructor.
Definition: StorageItem.cpp:31