SyncQueue.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 SYNCQUEUE_H
#define SYNCQUEUE_H
#include <QQueue>
namespace Buteo {
class SyncSession;
class SyncQueue
{
public:
void enqueue(SyncSession *aSession);
SyncSession *dequeue(const QString &aProfileName);
SyncSession *dequeue();
SyncSession *head();
bool isEmpty() const;
int size() const;
bool contains(const QString &aProfileName) const;
const QList<SyncSession *> &getQueuedSyncSessions() const;
private:
void sort();
QQueue<SyncSession *> iItems;
};
}
#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