Buteo Synchronization Framework: SyncQueue.h Source File

Buteo Synchronization Framework

SyncQueue.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 SYNCQUEUE_H
24 #define SYNCQUEUE_H
25
26 #include <QQueue>
27
28 namespace Buteo {
29
30 class SyncSession;
31
37 class SyncQueue
38 {
39 public:
44 void enqueue(SyncSession *aSession);
45
50 SyncSession *dequeue(const QString &aProfileName);
51
56 SyncSession *dequeue();
57
62 SyncSession *head();
63
68 bool isEmpty() const;
69
74 int size() const;
75
80 bool contains(const QString &aProfileName) const;
81
87 const QList<SyncSession *> &getQueuedSyncSessions() const;
88
89 private:
90
91 void sort();
92
93 QQueue<SyncSession *> iItems;
94 };
95
96 }
97
98 #endif // SYNCQUEUE_H
Buteo::SyncQueue
Class for queuing sync sessions.
Definition: SyncQueue.h:38
Buteo::SyncQueue::size
int size() const
Current size of the sync queue.
Definition: SyncQueue.cpp:85
Buteo::SyncQueue::dequeue
SyncSession * dequeue()
Removes the first item from the queue and returns it.
Definition: SyncQueue.cpp:38
Buteo::SyncQueue::head
SyncSession * head()
Returns the first item in the queue but does not remove it.
Definition: SyncQueue.cpp:66
Buteo::SyncQueue::isEmpty
bool isEmpty() const
Checks if the queue is empty.
Definition: SyncQueue.cpp:78
Buteo::SyncQueue::getQueuedSyncSessions
const QList< SyncSession * > & getQueuedSyncSessions() const
Returns as a const reference, the list of all SyncSessions currently queued.
Definition: SyncQueue.cpp:134
Buteo::SyncQueue::enqueue
void enqueue(SyncSession *aSession)
Adds a new profile to the queue. Queue is sorted automatically.
Definition: SyncQueue.cpp:30
Buteo::SyncQueue::contains
bool contains(const QString &aProfileName) const
Checks if a profile with the given name is in the queue.
Definition: SyncQueue.cpp:92
Buteo::SyncSession
Class representing a single sync session.
Definition: SyncSession.h:44
QList
Definition: SyncBackupAdaptor.h:40