ZipFile Class Reference

#include <ZipFile.h>

Inheritance diagram for ZipFile:

NamedArchiveFile ArchiveFile List of all members.

Public Member Functions

 ENABLE_RUNTIME_CLASSTYPE ()
 ZipFile (IDataSource *ds)
virtual ~ZipFile ()
virtual bool exists (const std::string &name)
virtual uint8getObject (const std::string &name, uint32 *size=0)
virtual uint32 getSize (const std::string &name)
virtual uint32 getCount ()
std::string getComment ()

Static Public Member Functions

static bool isZipFile (IDataSource *ds)

Protected Member Functions

bool readMetadata ()

Protected Attributes

IDataSourceds
uint32 count
std::map< std::string, uint32sizes
std::string globalComment
void * unzipfile

Detailed Description

Definition at line 27 of file ZipFile.h.


Constructor & Destructor Documentation

ZipFile::ZipFile ( IDataSource ds  )  [explicit]

create ZipFile from datasource; ZipFile takes ownership of ds and deletes it when destructed

Definition at line 50 of file ZipFile.cpp.

References ds, IDS_filefunc_templ, PentZip::zlib_filefunc_def_s::opaque, readMetadata(), PentZip::unzClose(), unzipfile, PentZip::unzOpen2(), and ArchiveFile::valid.

ZipFile::~ZipFile (  )  [virtual]

Definition at line 70 of file ZipFile.cpp.

References ds, PentZip::unzClose(), unzipfile, and ArchiveFile::valid.


Member Function Documentation

ZipFile::ENABLE_RUNTIME_CLASSTYPE (  ) 

Reimplemented from NamedArchiveFile.

bool ZipFile::exists ( const std::string &  name  )  [virtual]

Check if named object exists If the Flex is not named, name must be an integer with an optional extension

Parameters:
name name of object to check for

Implements NamedArchiveFile.

Definition at line 134 of file ZipFile.cpp.

References sizes.

std::string ZipFile::getComment (  )  [inline]

Definition at line 46 of file ZipFile.h.

References globalComment.

Referenced by Savegame::getDescription().

virtual uint32 ZipFile::getCount (  )  [inline, virtual]

Get upper bound for number of objects. In an indexed file this is (probably) the highest index plus one, while in a named file it's (probably) the actual count

Implements NamedArchiveFile.

Definition at line 42 of file ZipFile.h.

References count.

uint8 * ZipFile::getObject ( const std::string &  name,
uint32 size = 0 
) [virtual]

Get named object from file; returns NULL if name is invalid. Must delete the returned buffer afterwards. See also exists(std::string name)

Parameters:
name name of object to fetch
size if non-NULL, size of object is stored in *size

Implements NamedArchiveFile.

Definition at line 149 of file ZipFile.cpp.

References PentZip::unz_file_info_s::uncompressed_size, PentZip::unzCloseCurrentFile(), PentZip::unzGetCurrentFileInfo(), unzipfile, PentZip::unzLocateFile(), PentZip::unzOpenCurrentFile(), and PentZip::unzReadCurrentFile().

Referenced by Savegame::getDataSource().

uint32 ZipFile::getSize ( const std::string &  name  )  [virtual]

Get size of named object; returns zero if name is invalid See also exists(std::string name)

Parameters:
index index of object to get size of

Implements NamedArchiveFile.

Definition at line 141 of file ZipFile.cpp.

References sizes.

bool ZipFile::isZipFile ( IDataSource ds  )  [static]

Definition at line 80 of file ZipFile.cpp.

References IDS_filefunc_templ, PentZip::zlib_filefunc_def_s::opaque, PentZip::unzClose(), and PentZip::unzOpen2().

Referenced by Pentagram::Archive::addSource().

bool ZipFile::readMetadata (  )  [protected]

Definition at line 96 of file ZipFile.cpp.

References count, globalComment, sizes, NamedArchiveFile::storeIndexedName(), PentZip::unz_file_info_s::uncompressed_size, PentZip::unzGetCurrentFileInfo(), PentZip::unzGetGlobalComment(), PentZip::unzGetGlobalInfo(), PentZip::unzGoToFirstFile(), PentZip::unzGoToNextFile(), and unzipfile.

Referenced by ZipFile().


Member Data Documentation

uint32 ZipFile::count [protected]

Definition at line 53 of file ZipFile.h.

Referenced by getCount(), and readMetadata().

IDataSource* ZipFile::ds [protected]

Definition at line 52 of file ZipFile.h.

Referenced by ZipFile(), and ~ZipFile().

std::string ZipFile::globalComment [protected]

Definition at line 56 of file ZipFile.h.

Referenced by getComment(), and readMetadata().

std::map<std::string, uint32> ZipFile::sizes [protected]

Definition at line 54 of file ZipFile.h.

Referenced by exists(), getSize(), and readMetadata().

void* ZipFile::unzipfile [protected]

Definition at line 59 of file ZipFile.h.

Referenced by getObject(), readMetadata(), ZipFile(), and ~ZipFile().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:30:15 2007 for pentagram by  doxygen 1.4.7