FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
FIFE::ZipSource Class Reference

Implements a Zip archive file source. More...

#include <zipsource.h>

+ Inheritance diagram for FIFE::ZipSource:
+ Collaboration diagram for FIFE::ZipSource:

Public Member Functions

 ZipSource (VFS *vfs, const std::string &zip_file)
 
 ~ZipSource ()
 
bool fileExists (const std::string &file) const
 WARNING: fileExists, listFiles and listDirectories are not. More...
 
std::set< std::string > listFiles (const std::string &path) const
 list all files in a directory of this source More...
 
std::set< std::string > listDirectories (const std::string &path) const
 list all directories in a directory of this source More...
 
virtual RawDataopen (const std::string &path) const
 open a file inside this source More...
 
- Public Member Functions inherited from FIFE::VFSSource
 VFSSource (VFS *vfs)
 
virtual ~VFSSource ()
 
VFSgetVFS () const
 get the VFS this source is associated with. More...
 

Private Member Functions

void readIndex ()
 
bool readFileToIndex ()
 

Private Attributes

ZipTree m_zipTree
 
RawDatam_zipfile
 

Additional Inherited Members

- Protected Member Functions inherited from FIFE::VFSSource
std::string fixPath (std::string path) const
 

Detailed Description

Implements a Zip archive file source.

See also
FIFE::VFSSource

Definition at line 46 of file zipsource.h.

Constructor & Destructor Documentation

FIFE::ZipSource::ZipSource ( VFS vfs,
const std::string &  zip_file 
)

Definition at line 51 of file zipsource.cpp.

References readIndex().

FIFE::ZipSource::~ZipSource ( )

Definition at line 55 of file zipsource.cpp.

References m_zipfile.

Member Function Documentation

bool FIFE::ZipSource::fileExists ( const std::string &  file) const
virtual

WARNING: fileExists, listFiles and listDirectories are not.

Implements FIFE::VFSSource.

Definition at line 59 of file zipsource.cpp.

References FIFE::ZipTree::getNode(), and m_zipTree.

std::set< std::string > FIFE::ZipSource::listDirectories ( const std::string &  path) const
virtual

list all directories in a directory of this source

Parameters
pathpath to list directories in Will return an empty list on any error

Implements FIFE::VFSSource.

Definition at line 209 of file zipsource.cpp.

References FIFE::ZipContentType::Directory, FIFE::ZipNode::getChildren(), FIFE::ZipTree::getNode(), and m_zipTree.

std::set< std::string > FIFE::ZipSource::listFiles ( const std::string &  path) const
virtual

list all files in a directory of this source

Parameters
pathpath to list files in Will return an empty list on any error

Implements FIFE::VFSSource.

Definition at line 190 of file zipsource.cpp.

References FIFE::ZipContentType::File, FIFE::ZipNode::getChildren(), FIFE::ZipTree::getNode(), and m_zipTree.

RawData * FIFE::ZipSource::open ( const std::string &  file) const
virtual

open a file inside this source

Parameters
filethe file to open
Returns
a new RawData*
Exceptions
CannotOpenFileif the file can't be found

Implements FIFE::VFSSource.

Definition at line 64 of file zipsource.cpp.

References FIFE::_log, FIFE::ZipEntryData::comp, FL_DBG, FL_ERR, FIFE::ZipTree::getNode(), FIFE::ZipNode::getZipEntryData(), m_zipfile, m_zipTree, FIFE::ZipEntryData::offset, FIFE::RawData::readInto(), FIFE::RawData::setIndex(), FIFE::ZipEntryData::size_comp, and FIFE::ZipEntryData::size_real.

void FIFE::ZipSource::readIndex ( )
private

Definition at line 123 of file zipsource.cpp.

References m_zipfile, readFileToIndex(), and FIFE::RawData::setIndex().

Referenced by ZipSource().

+ Here is the caller graph for this function:

Member Data Documentation

RawData* FIFE::ZipSource::m_zipfile
private

Definition at line 66 of file zipsource.h.

Referenced by open(), readFileToIndex(), readIndex(), and ~ZipSource().

ZipTree FIFE::ZipSource::m_zipTree
private

Definition at line 65 of file zipsource.h.

Referenced by fileExists(), listDirectories(), listFiles(), open(), and readFileToIndex().


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