xoreos
0.0.5
|
A class encapsulating ZIP file access. More...
#include <zipfile.h>
Classes | |
struct | File |
A file. More... | |
struct | IFile |
Internal file information. More... | |
Public Types | |
typedef std::list< File > | FileList |
Public Member Functions | |
ZipFile (SeekableReadStream *zip) | |
~ZipFile () | |
const FileList & | getFiles () const |
Return the list of files. More... | |
size_t | getFileSize (uint32 index) const |
Return the size of a file. More... | |
SeekableReadStream * | getFile (uint32 index, bool tryNoCopy=false) const |
Return a stream of the file's contents. More... | |
Private Types | |
typedef std::vector< IFile > | IFileList |
Private Member Functions | |
void | load (SeekableReadStream &zip) |
const IFile & | getIFile (uint32 index) const |
void | getFileProperties (SeekableReadStream &zip, const IFile &file, uint16 &compMethod, uint32 &compSize, uint32 &realSize) const |
Static Private Member Functions | |
static SeekableReadStream * | decompressFile (SeekableReadStream &zip, uint32 method, uint32 compSize, uint32 realSize) |
Private Attributes | |
ScopedPtr< SeekableReadStream > | _zip |
FileList | _files |
External list of file names and types. More... | |
IFileList | _iFiles |
Internal list of file offsets and sizes. More... | |
typedef std::list<File> Common::ZipFile::FileList |
|
private |
Common::ZipFile::ZipFile | ( | SeekableReadStream * | zip | ) |
Common::ZipFile::~ZipFile | ( | ) |
Definition at line 43 of file zipfile.cpp.
|
staticprivate |
Definition at line 176 of file zipfile.cpp.
References Common::decompressDeflate(), Common::kWindowBitsMaxRaw, and Common::ReadStream::readStream().
Referenced by getFile().
SeekableReadStream * Common::ZipFile::getFile | ( | uint32 | index, |
bool | tryNoCopy = false |
||
) | const |
Return a stream of the file's contents.
Definition at line 161 of file zipfile.cpp.
References _zip, decompressFile(), getFileProperties(), and getIFile().
|
private |
Definition at line 132 of file zipfile.cpp.
References Common::ZipFile::IFile::offset, Common::ReadStream::readUint16LE(), Common::ReadStream::readUint32LE(), Common::SeekableReadStream::seek(), and Common::SeekableReadStream::skip().
Referenced by getFile().
const ZipFile::FileList & Common::ZipFile::getFiles | ( | ) | const |
size_t Common::ZipFile::getFileSize | ( | uint32 | index | ) | const |
Return the size of a file.
Definition at line 157 of file zipfile.cpp.
References getIFile(), and Common::ZipFile::IFile::size.
|
private |
Definition at line 125 of file zipfile.cpp.
References _iFiles.
Referenced by getFile(), and getFileSize().
|
private |
Definition at line 46 of file zipfile.cpp.
References _files, _iFiles, Common::UString::empty(), Common::UString::end(), Common::ZipFile::File::index, Common::kEncodingASCII, Common::ZipFile::File::name, Common::ZipFile::IFile::offset, Common::readStringFixed(), Common::ReadStream::readUint16LE(), Common::ReadStream::readUint32LE(), Common::searchBackwards(), Common::SeekableReadStream::seek(), Common::ZipFile::IFile::size, SIZE_MAX, Common::SeekableReadStream::skip(), and Common::UString::toLower().
Referenced by ZipFile().
|
private |
External list of file names and types.
Definition at line 76 of file zipfile.h.
Referenced by getFiles(), and load().
|
private |
Internal list of file offsets and sizes.
Definition at line 79 of file zipfile.h.
Referenced by getIFile(), and load().
|
private |