File indexing completed on 2024-06-16 05:25:08

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_BYTEARRAYRAWFILERELOADTHREAD_HPP
0010 #define KASTEN_BYTEARRAYRAWFILERELOADTHREAD_HPP
0011 
0012 // Qt
0013 #include <QByteArray>
0014 #include <QThread>
0015 
0016 class QFile;
0017 
0018 namespace Kasten {
0019 
0020 class ByteArrayRawFileReloadThread : public QThread
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     ByteArrayRawFileReloadThread(QObject* parent, QFile* file);
0026 
0027     ~ByteArrayRawFileReloadThread() override;
0028 
0029 public: // QThread API
0030     void run() override;
0031 
0032 public:
0033     bool success() const;
0034     const QString& errorString() const;
0035 
0036     const QByteArray& data() const;
0037 
0038 Q_SIGNALS:
0039     void documentReloaded(bool success);
0040 
0041 private:
0042     QFile* mFile;
0043 
0044     bool mSuccess = false;
0045     QString mErrorString;
0046 
0047     QByteArray mData;
0048 };
0049 
0050 inline bool ByteArrayRawFileReloadThread::success()                const { return mSuccess; }
0051 inline const QString& ByteArrayRawFileReloadThread::errorString()  const { return mErrorString; }
0052 inline const QByteArray& ByteArrayRawFileReloadThread::data()      const { return mData; }
0053 
0054 }
0055 
0056 #endif