libquentier  0.5.0
The library for rich desktop clients of Evernote service
FileIOProcessorAsync.h
1 /*
2  * Copyright 2016-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_UTILITY_FILE_IO_PROCESSOR_ASYNC_H
20 #define LIB_QUENTIER_UTILITY_FILE_IO_PROCESSOR_ASYNC_H
21 
22 #include <quentier/types/ErrorString.h>
23 #include <quentier/utility/Linkage.h>
24 #include <quentier/utility/Macros.h>
25 
26 #include <QByteArray>
27 #include <QIODevice>
28 #include <QObject>
29 #include <QString>
30 #include <QUuid>
31 
32 namespace quentier {
33 
34 QT_FORWARD_DECLARE_CLASS(FileIOProcessorAsyncPrivate)
35 
36 
40 class QUENTIER_EXPORT FileIOProcessorAsync: public QObject
41 {
42  Q_OBJECT
43 public:
44  explicit FileIOProcessorAsync(QObject * parent = nullptr);
45 
55  void setIdleTimePeriod(qint32 seconds);
56 
57 Q_SIGNALS:
64  void readyForIO();
65 
76  void writeFileRequestProcessed(
77  bool success, ErrorString errorDescription, QUuid requestId);
78 
90  void readFileRequestProcessed(
91  bool success, ErrorString errorDescription, QByteArray data,
92  QUuid requestId);
93 
94 public Q_SLOTS:
106  void onWriteFileRequest(
107  QString absoluteFilePath, QByteArray data, QUuid requestId,
108  bool append);
109 
117  void onReadFileRequest(QString absoluteFilePath, QUuid requestId);
118 
119 private:
120  FileIOProcessorAsyncPrivate * const d_ptr;
121  Q_DECLARE_PRIVATE(FileIOProcessorAsync)
122 };
123 
124 } // namespace quentier
125 
126 #endif // LIB_QUENTIER_UTILITY_FILE_IO_PROCESSOR_ASYNC_H
The FileIOProcessorAsync class is a wrapper under simple file IO operations, it is meant to be used f...
Definition: FileIOProcessorAsync.h:40
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:43
Definition: DecryptedTextManager.h:26