libquentier  0.8.0
The library for rich desktop clients of Evernote service
FileIOProcessorAsync.h
1 /*
2  * Copyright 2016-2025 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 #pragma once
20 
21 #include <quentier/types/ErrorString.h>
22 #include <quentier/utility/Linkage.h>
23 
24 #include <QByteArray>
25 #include <QIODevice>
26 #include <QObject>
27 #include <QString>
28 #include <QUuid>
29 
30 namespace quentier::utility {
31 
32 class FileIOProcessorAsyncPrivate;
33 
38 class QUENTIER_EXPORT FileIOProcessorAsync : public QObject
39 {
40  Q_OBJECT
41 public:
42  explicit FileIOProcessorAsync(QObject * parent = nullptr);
43 
53  void setIdleTimePeriod(qint32 seconds);
54 
55 Q_SIGNALS:
62  void readyForIO();
63 
74  void writeFileRequestProcessed(
75  bool success, ErrorString errorDescription, QUuid requestId);
76 
88  void readFileRequestProcessed(
89  bool success, ErrorString errorDescription, QByteArray data,
90  QUuid requestId);
91 
92 public Q_SLOTS:
104  void onWriteFileRequest(
105  QString absoluteFilePath, QByteArray data, QUuid requestId,
106  bool append);
107 
115  void onReadFileRequest(QString absoluteFilePath, QUuid requestId);
116 
117 private:
118  FileIOProcessorAsyncPrivate * const d_ptr;
119  Q_DECLARE_PRIVATE(FileIOProcessorAsync)
120 };
121 
122 } // namespace quentier::utility
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:42
Definition: ApplicationSettings.h:27
The FileIOProcessorAsync class is a wrapper under simple file IO operations, it is meant to be used f...
Definition: FileIOProcessorAsync.h:38