#include <ZipFile.h>
Inheritance diagram for ZipFile:
Public Member Functions | |
ENABLE_RUNTIME_CLASSTYPE () | |
ZipFile (IDataSource *ds) | |
virtual | ~ZipFile () |
virtual bool | exists (const std::string &name) |
virtual uint8 * | getObject (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 | |
IDataSource * | ds |
uint32 | count |
std::map< std::string, uint32 > | sizes |
std::string | globalComment |
void * | unzipfile |
Definition at line 27 of file ZipFile.h.
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.
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
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.
Get named object from file; returns NULL if name is invalid. Must delete the returned buffer afterwards. See also exists(std::string name)
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)
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().
uint32 ZipFile::count [protected] |
IDataSource* ZipFile::ds [protected] |
std::string ZipFile::globalComment [protected] |
std::map<std::string, uint32> ZipFile::sizes [protected] |
void* ZipFile::unzipfile [protected] |
Definition at line 59 of file ZipFile.h.
Referenced by getObject(), readMetadata(), ZipFile(), and ~ZipFile().