2017-03-21 01:15:29 +01:00
|
|
|
#ifndef TAR_H
|
|
|
|
#define TAR_H
|
|
|
|
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QMap>
|
|
|
|
#include <QFile>
|
|
|
|
|
|
|
|
class Tar
|
|
|
|
{
|
|
|
|
public:
|
2018-03-08 02:24:10 +01:00
|
|
|
Tar(const QString &name) : _file(name) {}
|
|
|
|
|
|
|
|
bool open();
|
2023-05-04 09:38:35 +02:00
|
|
|
void close() {_file.close();}
|
2023-11-26 10:51:37 +01:00
|
|
|
const QString &errorString() const {return _error;}
|
2017-03-21 01:15:29 +01:00
|
|
|
|
|
|
|
QStringList files() const {return _index.keys();}
|
|
|
|
QByteArray file(const QString &name);
|
2018-01-14 23:03:27 +01:00
|
|
|
bool contains(const QString &name) const {return _index.contains(name);}
|
2017-03-21 01:15:29 +01:00
|
|
|
|
2017-03-21 09:01:30 +01:00
|
|
|
QString fileName() const {return _file.fileName();}
|
2017-03-21 01:15:29 +01:00
|
|
|
bool isOpen() const {return _file.isOpen();}
|
|
|
|
|
|
|
|
private:
|
2017-06-25 12:24:05 +02:00
|
|
|
bool loadTar();
|
|
|
|
bool loadTmi(const QString &path);
|
2017-03-21 01:15:29 +01:00
|
|
|
|
|
|
|
QFile _file;
|
2017-06-25 12:24:05 +02:00
|
|
|
QMap<QString, quint64> _index;
|
2023-11-26 10:51:37 +01:00
|
|
|
QString _error;
|
2017-03-21 01:15:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TAR_H
|