libquentier 0.5.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
ISyncStateStorage.h
1/*
2 * Copyright 2020 Dmitry Ivanov
3 *
4 * This file is part of libquentier
5 *
6 * libquentier is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, version 3 of the License.
9 *
10 * libquentier is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef LIB_QUENTIER_SYNCHRONIZATION_I_SYNC_STATE_STORAGE_H
20#define LIB_QUENTIER_SYNCHRONIZATION_I_SYNC_STATE_STORAGE_H
21
22#include <quentier/synchronization/ForwardDeclarations.h>
23#include <quentier/types/Account.h>
24#include <quentier/utility/Linkage.h>
25
26#include <qt5qevercloud/QEverCloud.h>
27
28#include <QHash>
29#include <QObject>
30#include <QString>
31
32#include <memory>
33
34namespace quentier {
35
41class QUENTIER_EXPORT ISyncStateStorage : public QObject
42{
43 Q_OBJECT
44public:
49 class QUENTIER_EXPORT ISyncState : public Printable
50 {
51 public:
52 virtual qint32 userDataUpdateCount() const = 0;
53 virtual qevercloud::Timestamp userDataLastSyncTime() const = 0;
54 virtual QHash<QString, qint32> linkedNotebookUpdateCounts() const = 0;
55
56 virtual QHash<QString, qevercloud::Timestamp>
57 linkedNotebookLastSyncTimes() const = 0;
58
59 virtual QTextStream & print(QTextStream & strm) const override;
60 };
61
62 using ISyncStatePtr = std::shared_ptr<ISyncState>;
63
64public:
65 explicit ISyncStateStorage(QObject * parent = nullptr) : QObject(parent) {}
66
67 virtual ~ISyncStateStorage() = default;
68
69 virtual ISyncStatePtr getSyncState(const Account & account) = 0;
70
71 virtual void setSyncState(
72 const Account & account, ISyncStatePtr syncState) = 0;
73
74Q_SIGNALS:
80 void notifySyncStateUpdated(Account account, ISyncStatePtr syncState);
81};
82
83QUENTIER_EXPORT ISyncStateStoragePtr
84newSyncStateStorage(QObject * parent = nullptr);
85
86} // namespace quentier
87
88#endif // LIB_QUENTIER_SYNCHRONIZATION_I_SYNC_STATE_STORAGE_H
The Account class encapsulates some details about the account: its name, whether it is local or synch...
Definition Account.h:39
The ISyncState interface provides accessory methods to determine the sync state for the account.
Definition ISyncStateStorage.h:50
The ISyncStateStorage interface represents the interface of a class which stores sync state for given...
Definition ISyncStateStorage.h:42
void notifySyncStateUpdated(Account account, ISyncStatePtr syncState)
The Printable class is the interface for Quentier's internal classes which should be able to write th...
Definition Printable.h:38