Buteo Synchronization Framework: TargetResults.h Source File

Buteo Synchronization Framework

TargetResults.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 TARGETRESULTS_H
24 #define TARGETRESULTS_H
25
26 #include <QString>
27 #include <QList>
28
29 class QDomDocument;
30 class QDomElement;
31
32 namespace Buteo {
33
34 class TargetResultsPrivate;
35
37 struct ItemCounts {
39 unsigned added;
40
42 unsigned deleted;
43
45 unsigned modified;
46
48 ItemCounts() : added(0), deleted(0), modified(0) { };
49
51 ItemCounts(unsigned aAdded, unsigned aDeleted, unsigned aModified)
52 : added(aAdded), deleted(aDeleted), modified(aModified) {}
53 };
54
60 class TargetResults
61 {
62 public:
63 enum ItemOperation {
64 ITEM_ADDED,
65 ITEM_DELETED,
66 ITEM_MODIFIED
67 };
68
69 enum ItemOperationStatus {
70 ITEM_OPERATION_SUCCEEDED,
71 ITEM_OPERATION_FAILED
72 };
73
78 TargetResults(const TargetResults &aSource);
79
86 TargetResults(const QString &aTargetName, ItemCounts aLocalItems = ItemCounts(),
87 ItemCounts aRemoteItems = ItemCounts());
88
93 explicit TargetResults(const QDomElement &aRoot);
94
97 ~TargetResults();
98
103 TargetResults &operator=(const TargetResults &aRhs);
104
112 QDomElement toXml(QDomDocument &aDoc) const;
113
118 QString targetName() const;
119
124 ItemCounts localItems() const;
125
130 ItemCounts remoteItems() const;
131
144 void addLocalDetails(const QString &aUid,
145 ItemOperation aOperation,
146 ItemOperationStatus aStatus = ITEM_OPERATION_SUCCEEDED,
147 const QString &aMessage = QString());
148
161 void addRemoteDetails(const QString &aUid,
162 ItemOperation aOperation,
163 ItemOperationStatus aStatus = ITEM_OPERATION_SUCCEEDED,
164 const QString &aMessage = QString());
165
175 QList<QString> localDetails(ItemOperation aOperation,
176 ItemOperationStatus aStatus) const;
177
183 QString localMessage(const QString &aUid) const;
184
194 QList<QString> remoteDetails(ItemOperation aOperation,
195 ItemOperationStatus aStatus) const;
196
202 QString remoteMessage(const QString &aUid) const;
203
204 private:
205
206 TargetResultsPrivate *d_ptr;
207 };
208
209 }
210
211 #endif // TARGETRESULTS_H
Buteo::TargetResults
Sync results for one target.
Definition: TargetResults.h:61
Buteo::TargetResults::TargetResults
TargetResults(const TargetResults &aSource)
Copy constructor.
Definition: TargetResults.cpp:142
Buteo::TargetResults::operator=
TargetResults & operator=(const TargetResults &aRhs)
Assignment operator.
Definition: TargetResults.cpp:188
Buteo::TargetResults::remoteItems
ItemCounts remoteItems() const
Gets the counts of items added, deleted and modified at remote.
Definition: TargetResults.cpp:246
Buteo::TargetResults::addRemoteDetails
void addRemoteDetails(const QString &aUid, ItemOperation aOperation, ItemOperationStatus aStatus=ITEM_OPERATION_SUCCEEDED, const QString &aMessage=QString())
Add some details on the remote changes done during the sync process.
Definition: TargetResults.cpp:279
Buteo::TargetResults::~TargetResults
~TargetResults()
Destructor.
Definition: TargetResults.cpp:182
Buteo::TargetResults::localDetails
QList< QString > localDetails(ItemOperation aOperation, ItemOperationStatus aStatus) const
Gets the details, if any for changes done local during a sync process.
Definition: TargetResults.cpp:307
Buteo::TargetResults::toXml
QDomElement toXml(QDomDocument &aDoc) const
Exports the target results to XML.
Definition: TargetResults.cpp:198
Buteo::TargetResults::addLocalDetails
void addLocalDetails(const QString &aUid, ItemOperation aOperation, ItemOperationStatus aStatus=ITEM_OPERATION_SUCCEEDED, const QString &aMessage=QString())
Add some details on the local changes done during the sync process.
Definition: TargetResults.cpp:251
Buteo::TargetResults::localMessage
QString localMessage(const QString &aUid) const
Gets a possible message related to the a given item.
Definition: TargetResults.cpp:322
Buteo::TargetResults::targetName
QString targetName() const
Gets the target name.
Definition: TargetResults.cpp:236
Buteo::TargetResults::remoteDetails
QList< QString > remoteDetails(ItemOperation aOperation, ItemOperationStatus aStatus) const
Gets the details, if any for changes done remote during a sync process.
Definition: TargetResults.cpp:335
Buteo::TargetResults::remoteMessage
QString remoteMessage(const QString &aUid) const
Gets a possible message related to the a given item.
Definition: TargetResults.cpp:349
Buteo::TargetResults::localItems
ItemCounts localItems() const
Gets the counts of items added, deleted and modified locally.
Definition: TargetResults.cpp:241
QList< QString >
Buteo::ItemCounts
Container for number of items added, deleted and modified.
Definition: TargetResults.h:37
Buteo::ItemCounts::modified
unsigned modified
No. of Items modified.
Definition: TargetResults.h:45
Buteo::ItemCounts::ItemCounts
ItemCounts()
Default Constructor.
Definition: TargetResults.h:48
Buteo::ItemCounts::ItemCounts
ItemCounts(unsigned aAdded, unsigned aDeleted, unsigned aModified)
Constructor with 3 parameters.
Definition: TargetResults.h:51
Buteo::ItemCounts::added
unsigned added
No. of Items added.
Definition: TargetResults.h:39
Buteo::ItemCounts::deleted
unsigned deleted
No. of Items deleted.
Definition: TargetResults.h:42