File indexing completed on 2025-01-05 05:23:24
0001 /* 0002 This file is part of the Okteta Kasten module, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2010 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_BYTEARRAYMODELIODEVICE_HPP 0010 #define KASTEN_BYTEARRAYMODELIODEVICE_HPP 0011 0012 // Okteta core 0013 #include <Okteta/Address> 0014 // Qt 0015 #include <QIODevice> 0016 0017 namespace Okteta { 0018 0019 class AbstractByteArrayModel; 0020 0021 class ByteArrayModelIoDevice : public QIODevice 0022 { 0023 Q_OBJECT 0024 0025 public: 0026 explicit ByteArrayModelIoDevice(AbstractByteArrayModel* byteArrayModel, QObject* parent = nullptr); 0027 0028 ~ByteArrayModelIoDevice() override; 0029 0030 public: // QIODevice API 0031 qint64 size() const override; 0032 bool canReadLine() const override; 0033 0034 bool open(OpenMode openMode) override; 0035 bool seek(qint64 pos) override; 0036 0037 protected: 0038 qint64 readData(char* data, qint64 maxlength) override; 0039 qint64 writeData(const char* data, qint64 length) override; 0040 0041 private: 0042 AbstractByteArrayModel* mByteArrayModel; 0043 Address mReadOffset = 0; 0044 }; 0045 0046 } 0047 0048 #endif