ifndef FILESOURCE_H define FILESOURCE_H include QIODevice include QFil

 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
30
31
32
33
34
35
36
#ifndef FILESOURCE_H
#define FILESOURCE_H
#include <QIODevice>
#include <QFile>
#include <QByteArray>
#include <QVector>
#include <QPair>
#include <QSharedPointer>
#include "media.h"
class FileSource : public QIODevice
{
Q_OBJECT
public:
FileSource(QSharedPointer<Media> media,
QVector<QPair<QString,QString> > fields);
bool atEnd ();
//qint64 pos ();
qint64 size ();
//qint64 readLineData(char *data, qint64 maxlen);
qint64 readData(char*, qint64);
qint64 writeData ( const char * data, qint64 maxSize );
//qint64 bytesAvailable();
bool isSequential();
//bool seek(qint64);
//bool waitForReadyRead ( int msecs );
private:
QByteArray header, footer;
int curPos;
QFile *data;
};
#endif // FILESOURCE_H