aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/archive/archiveinputdevice.h
blob: 7e7dd56f733eafa0a9ab25e41b843b0ca6461431 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef ARCHIVEINPUTDEVICE_H
#define ARCHIVEINPUTDEVICE_H

#include <QIODevice>
#include <QBuffer>
#include <archive.h>
#include <archive_entry.h>

class ArchiveInputDevice : public QIODevice
{
    Q_OBJECT
public:
    ArchiveInputDevice(struct archive *a, struct archive_entry *e, QObject *parent);

    bool seek(qint64 pos);
    qint64 size() const;

protected:
    virtual qint64 readData(char *data, qint64 maxSize);
    virtual qint64 writeData(const char *, qint64);

private:
    struct archive *m_archive;
    struct archive_entry *m_entry;
    QBuffer m_buffer;

};

#endif // ARCHIVEINPUTDEVICE_H