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/Macros.h>
23 #include <quentier/utility/Linkage.h>
24 
25 #include <QObject>
26 
27 namespace quentier {
28 
29 QT_FORWARD_DECLARE_CLASS(ErrorString)
30 QT_FORWARD_DECLARE_CLASS(LocalStorageDatabaseUpgrader)
31 
32 
38 class QUENTIER_EXPORT ILocalStoragePatch: public QObject
39 {
40  Q_OBJECT
41 protected:
42  explicit ILocalStoragePatch(QObject * parent = nullptr);
43 
44 public:
45  virtual ~ILocalStoragePatch();
46 
51  virtual int fromVersion() const = 0;
52 
57  virtual int toVersion() const = 0;
58 
62  virtual QString patchShortDescription() const = 0;
63 
67  virtual QString patchLongDescription() const = 0;
68 
79  virtual bool backupLocalStorage(ErrorString & errorDescription) = 0;
80 
92  virtual bool restoreLocalStorageFromBackup(
93  ErrorString & errorDescription) = 0;
94 
107  virtual bool removeLocalStorageBackup(ErrorString & errorDescription) = 0;
108 
117  virtual bool apply(ErrorString & errorDescription) = 0;
118 
119  friend class LocalStorageDatabaseUpgrader;
120 
121 Q_SIGNALS:
127  void progress(double progress);
128 
134  void backupProgress(double progress);
135 
142  void restoreBackupProgress(double progress);
143 };
144 
145 } // namespace quentier
146 
147 #endif // LIB_QUENTIER_LOCAL_STORAGE_I_LOCAL_STORAGE_PATCH_H
quentier::ILocalStoragePatch
The ILocalStoragePatch class represents the interface for patches of local storage....
Definition: ILocalStoragePatch.h:38
quentier::ErrorString
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:43