xoreos  0.0.5
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Common::ZipFile Class Reference

A class encapsulating ZIP file access. More...

#include <zipfile.h>

Inheritance diagram for Common::ZipFile:
Inheritance graph
[legend]
Collaboration diagram for Common::ZipFile:
Collaboration graph
[legend]

Classes

struct  File
 A file. More...
 
struct  IFile
 Internal file information. More...
 

Public Types

typedef std::list< FileFileList
 

Public Member Functions

 ZipFile (SeekableReadStream *zip)
 
 ~ZipFile ()
 
const FileListgetFiles () const
 Return the list of files. More...
 
size_t getFileSize (uint32 index) const
 Return the size of a file. More...
 
SeekableReadStreamgetFile (uint32 index, bool tryNoCopy=false) const
 Return a stream of the file's contents. More...
 

Private Types

typedef std::vector< IFileIFileList
 

Private Member Functions

void load (SeekableReadStream &zip)
 
const IFilegetIFile (uint32 index) const
 
void getFileProperties (SeekableReadStream &zip, const IFile &file, uint16 &compMethod, uint32 &compSize, uint32 &realSize) const
 

Static Private Member Functions

static SeekableReadStreamdecompressFile (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...
 

Detailed Description

A class encapsulating ZIP file access.

Definition at line 42 of file zipfile.h.

Member Typedef Documentation

◆ FileList

typedef std::list<File> Common::ZipFile::FileList

Definition at line 50 of file zipfile.h.

◆ IFileList

typedef std::vector<IFile> Common::ZipFile::IFileList
private

Definition at line 71 of file zipfile.h.

Constructor & Destructor Documentation

◆ ZipFile()

Common::ZipFile::ZipFile ( SeekableReadStream zip)

Definition at line 37 of file zipfile.cpp.

References _zip, and load().

Here is the call graph for this function:

◆ ~ZipFile()

Common::ZipFile::~ZipFile ( )

Definition at line 43 of file zipfile.cpp.

Member Function Documentation

◆ decompressFile()

SeekableReadStream * Common::ZipFile::decompressFile ( SeekableReadStream zip,
uint32  method,
uint32  compSize,
uint32  realSize 
)
staticprivate

Definition at line 176 of file zipfile.cpp.

References Common::decompressDeflate(), Common::kWindowBitsMaxRaw, and Common::ReadStream::readStream().

Referenced by getFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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().

Here is the call graph for this function:

◆ getFileProperties()

void Common::ZipFile::getFileProperties ( SeekableReadStream zip,
const IFile file,
uint16 compMethod,
uint32 compSize,
uint32 realSize 
) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFiles()

const ZipFile::FileList & Common::ZipFile::getFiles ( ) const

Return the list of files.

Definition at line 121 of file zipfile.cpp.

References _files.

◆ getFileSize()

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.

Here is the call graph for this function:

◆ getIFile()

const ZipFile::IFile & Common::ZipFile::getIFile ( uint32  index) const
private

Definition at line 125 of file zipfile.cpp.

References _iFiles.

Referenced by getFile(), and getFileSize().

Here is the caller graph for this function:

◆ load()

void Common::ZipFile::load ( SeekableReadStream zip)
private

Member Data Documentation

◆ _files

FileList Common::ZipFile::_files
private

External list of file names and types.

Definition at line 76 of file zipfile.h.

Referenced by getFiles(), and load().

◆ _iFiles

IFileList Common::ZipFile::_iFiles
private

Internal list of file offsets and sizes.

Definition at line 79 of file zipfile.h.

Referenced by getIFile(), and load().

◆ _zip

ScopedPtr<SeekableReadStream> Common::ZipFile::_zip
private

Definition at line 73 of file zipfile.h.

Referenced by getFile(), and ZipFile().


The documentation for this class was generated from the following files: