libquentier  0.4.0
The library for rich desktop clients of Evernote service
FileIOProcessorAsync.h
1 /*
2  * Copyright 2016 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/utility/Linkage.h>
23 #include <quentier/utility/Macros.h>
24 #include <quentier/types/ErrorString.h>
25 #include <QObject>
26 #include <QString>
27 #include <QUuid>
28 #include <QByteArray>
29 #include <QIODevice>
30 
31 namespace quentier {
32 
33 QT_FORWARD_DECLARE_CLASS(FileIOProcessorAsyncPrivate)
34 
35 
39 class QUENTIER_EXPORT FileIOProcessorAsync: public QObject
40 {
41  Q_OBJECT
42 public:
43  explicit FileIOProcessorAsync(QObject * parent = Q_NULLPTR);
44 
52  void setIdleTimePeriod(qint32 seconds);
53 
54 Q_SIGNALS:
61  void readyForIO();
62 
69  void writeFileRequestProcessed(bool success, ErrorString errorDescription, QUuid requestId);
70 
78  void readFileRequestProcessed(bool success, ErrorString errorDescription, QByteArray data,
79  QUuid requestId);
80 
81 public Q_SLOTS:
90  void onWriteFileRequest(QString absoluteFilePath, QByteArray data,
91  QUuid requestId, bool append);
92 
98  void onReadFileRequest(QString absoluteFilePath,
99  QUuid requestId);
100 
101 private:
102  FileIOProcessorAsyncPrivate * const d_ptr;
103  Q_DECLARE_PRIVATE(FileIOProcessorAsync)
104 };
105 
106 } // namespace quentier
107 
108 #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:39
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:38