File indexing completed on 2025-01-05 05:23:50

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_BYTEARRAYRAWFILELOADTHREAD_HPP
0010 #define KASTEN_BYTEARRAYRAWFILELOADTHREAD_HPP
0011 
0012 // Qt
0013 #include <QThread>
0014 
0015 class QFile;
0016 
0017 namespace Kasten {
0018 
0019 class ByteArrayDocument;
0020 
0021 class ByteArrayRawFileLoadThread : public QThread
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     ByteArrayRawFileLoadThread(QObject* parent,
0027                                QFile* file);
0028     ~ByteArrayRawFileLoadThread() override;
0029 
0030 public: // QThread API
0031     void run() override;
0032 
0033 public:
0034     ByteArrayDocument* document() const;
0035 
0036     const QString& errorString() const;
0037 
0038 Q_SIGNALS:
0039     void documentRead(Kasten::ByteArrayDocument* document);
0040 
0041 private:
0042     QFile* mFile;
0043 
0044     ByteArrayDocument* mDocument = nullptr;
0045     QString mErrorString;
0046 };
0047 
0048 inline ByteArrayRawFileLoadThread::ByteArrayRawFileLoadThread(QObject* parent, QFile* file)
0049     : QThread(parent)
0050     , mFile(file)
0051 {}
0052 
0053 inline ByteArrayDocument* ByteArrayRawFileLoadThread::document() const { return mDocument; }
0054 inline const QString& ByteArrayRawFileLoadThread::errorString()  const { return mErrorString; }
0055 
0056 }
0057 
0058 #endif