libquentier  0.5.0
The library for rich desktop clients of Evernote service
ILocalStoragePatch.h
1 /*
2  * Copyright 2018-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_LOCAL_STORAGE_I_LOCAL_STORAGE_PATCH_H
20 #define LIB_QUENTIER_LOCAL_STORAGE_I_LOCAL_STORAGE_PATCH_H
21 
22 #include <quentier/utility/Linkage.h>
23 
24 #include <QObject>
25 
26 namespace quentier {
27 
28 QT_FORWARD_DECLARE_CLASS(ErrorString)
29 QT_FORWARD_DECLARE_CLASS(LocalStorageDatabaseUpgrader)
30 
31 
37 class QUENTIER_EXPORT ILocalStoragePatch : public QObject
38 {
39  Q_OBJECT
40 protected:
41  explicit ILocalStoragePatch(QObject * parent = nullptr);
42 
43 public:
44  virtual ~ILocalStoragePatch();
45 
50  virtual int fromVersion() const = 0;
51 
56  virtual int toVersion() const = 0;
57 
61  virtual QString patchShortDescription() const = 0;
62 
66  virtual QString patchLongDescription() const = 0;
67 
78  virtual bool backupLocalStorage(ErrorString & errorDescription) = 0;
79 
92  ErrorString & errorDescription) = 0;
93 
106  virtual bool removeLocalStorageBackup(ErrorString & errorDescription) = 0;
107 
116  virtual bool apply(ErrorString & errorDescription) = 0;
117 
118  friend class LocalStorageDatabaseUpgrader;
119 
120 Q_SIGNALS:
126  void progress(double progress);
127 
133  void backupProgress(double progress);
134 
141  void restoreBackupProgress(double progress);
142 };
143 
144 } // namespace quentier
145 
146 #endif // LIB_QUENTIER_LOCAL_STORAGE_I_LOCAL_STORAGE_PATCH_H
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:44
The ILocalStoragePatch class represents the interface for patches of local storage....
Definition: ILocalStoragePatch.h:38
void backupProgress(double progress)
virtual int toVersion() const =0
void restoreBackupProgress(double progress)
virtual bool restoreLocalStorageFromBackup(ErrorString &errorDescription)=0
void progress(double progress)
virtual QString patchShortDescription() const =0
virtual bool removeLocalStorageBackup(ErrorString &errorDescription)=0
virtual bool apply(ErrorString &errorDescription)=0
virtual int fromVersion() const =0
virtual bool backupLocalStorage(ErrorString &errorDescription)=0
virtual QString patchLongDescription() const =0