2012-06-01 15:23:19 +00:00
|
|
|
#ifndef VFSFILE_ZIP_H
|
|
|
|
#define VFSFILE_ZIP_H
|
|
|
|
|
|
|
|
#include "VFSFile.h"
|
2014-04-06 17:19:33 +00:00
|
|
|
#include "VFSZipArchiveRef.h"
|
2012-06-01 15:23:19 +00:00
|
|
|
|
|
|
|
VFS_NAMESPACE_START
|
|
|
|
|
2014-04-06 17:19:33 +00:00
|
|
|
class ZipFile : public File
|
2012-06-01 15:23:19 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-04-23 03:26:03 +00:00
|
|
|
ZipFile(const char *name, ZipArchiveRef *zref, unsigned int fileIdx);
|
2014-04-06 17:19:33 +00:00
|
|
|
virtual ~ZipFile();
|
2012-06-01 15:23:19 +00:00
|
|
|
virtual bool open(const char *mode = NULL);
|
2014-04-06 17:19:33 +00:00
|
|
|
virtual bool isopen() const;
|
|
|
|
virtual bool iseof() const;
|
|
|
|
virtual void close();
|
|
|
|
virtual bool seek(vfspos pos, int whence);
|
|
|
|
virtual bool flush();
|
|
|
|
virtual vfspos getpos() const;
|
2014-04-07 02:16:15 +00:00
|
|
|
virtual size_t read(void *dst, size_t bytes);
|
|
|
|
virtual size_t write(const void *src, size_t bytes);
|
2014-04-06 17:19:33 +00:00
|
|
|
virtual vfspos size();
|
|
|
|
virtual const char *getType() const { return "ZipFile"; }
|
2012-06-01 15:23:19 +00:00
|
|
|
|
|
|
|
protected:
|
2014-04-06 17:19:33 +00:00
|
|
|
bool unpack();
|
|
|
|
|
|
|
|
char *_buf;
|
|
|
|
vfspos _pos;
|
|
|
|
CountedPtr<ZipArchiveRef> _archiveHandle;
|
2014-04-23 03:26:03 +00:00
|
|
|
vfspos _bufSize;
|
2014-04-06 17:19:33 +00:00
|
|
|
unsigned int _fileIdx;
|
2012-06-01 15:23:19 +00:00
|
|
|
std::string _mode;
|
|
|
|
};
|
|
|
|
|
|
|
|
VFS_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif
|