Qt: Add creating a VFileDevice from a QByteArray

This commit is contained in:
Vicki Pfau 2021-02-01 01:55:06 -08:00
parent df082b46d9
commit 517aa353ca
2 changed files with 8 additions and 0 deletions

View File

@ -91,6 +91,13 @@ VFileDevice::VFileDevice(const QString& filename, QIODevice::OpenMode mode, QObj
}
}
VFileDevice::VFileDevice(const QByteArray& mem, QObject* parent)
: QIODevice(parent)
, m_vf(VFileMemChunk(mem.constData(), mem.size()))
{
setOpenMode(QIODevice::ReadWrite);
}
VFileDevice::~VFileDevice() {
close();
}

View File

@ -19,6 +19,7 @@ Q_OBJECT
public:
VFileDevice(VFile* vf = nullptr, QObject* parent = nullptr);
VFileDevice(const QByteArray& mem, QObject* parent = nullptr);
VFileDevice(const QString&, QIODevice::OpenMode, QObject* parent = nullptr);
virtual ~VFileDevice();