Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
A VirtualFile used to read a file contained in a .zip archive. More...
#include <ZippedFile.hpp>
Public Member Functions | |
ZippedFile () | |
~ZippedFile () | |
const ZippedFileInfo * | zippedFileInfo () const |
ZippedFileInfo * | zippedFileInfo () |
void | setZippedFileInfo (ZippedFileInfo *info) |
virtual bool | exists () const |
This returns true if zippedFileInfo() has been properly set up but does not check the existence of this file in the source zip file. | |
virtual bool | open (EOpenMode mode) |
Opens the file in the specified mode. | |
virtual bool | isOpen () const |
Returns true if the file has been opened. | |
virtual void | close () |
Closes the file. | |
virtual long long | size () const |
Returns the size of the file in bytes. | |
bool | extract (char *destination, bool check_sum=true) |
ZippedFile & | operator= (const ZippedFile &other) |
virtual ref< VirtualFile > | clone () const |
Creates a clone of this class instance. | |
void | resetStream () |
Protected Member Functions | |
virtual long long | read_Implementation (void *buffer, long long bytes_to_read) |
virtual long long | write_Implementation (const void *, long long) |
virtual bool | fillUncompressedBuffer () |
virtual long long | position_Implementation () const |
virtual bool | seekSet_Implementation (long long) |
Protected Attributes | |
ref< ZippedFileInfo > | mZippedFileInfo |
long long | mReadBytes |
z_stream_s * | mZStream |
unsigned char | mZipBufferIn [CHUNK_SIZE] |
unsigned char | mZipBufferOut [CHUNK_SIZE] |
std::vector< char > | mUncompressedBuffer |
int | mUncompressedBufferPtr |
A VirtualFile used to read a file contained in a .zip archive.
Definition at line 133 of file ZippedFile.hpp.
ZippedFile::ZippedFile | ( | ) |
Definition at line 341 of file ZippedFile.cpp.
References mReadBytes, and mZStream.
Referenced by clone().
ZippedFile::~ZippedFile | ( | ) |
Definition at line 348 of file ZippedFile.cpp.
References close(), mReadBytes, mZStream, and NULL.
const ZippedFileInfo * ZippedFile::zippedFileInfo | ( | ) | const |
Definition at line 355 of file ZippedFile.cpp.
References vl::ref< T >::get(), and mZippedFileInfo.
Referenced by close(), exists(), extract(), fillUncompressedBuffer(), open(), and read_Implementation().
ZippedFileInfo * ZippedFile::zippedFileInfo | ( | ) |
Definition at line 357 of file ZippedFile.cpp.
References vl::ref< T >::get(), and mZippedFileInfo.
void ZippedFile::setZippedFileInfo | ( | ZippedFileInfo * | info ) |
Definition at line 359 of file ZippedFile.cpp.
References mZippedFileInfo.
bool ZippedFile::exists | ( | ) | const [virtual] |
This returns true if zippedFileInfo() has been properly set up but does not check the existence of this file in the source zip file.
To do so call ZippedDirectory::exists().
Implements vl::VirtualFile.
Definition at line 361 of file ZippedFile.cpp.
References vl::ZippedFileInfo::sourceZipFile(), zippedFileInfo(), and vl::ZippedFileInfo::zippedFileOffset().
bool ZippedFile::open | ( | EOpenMode | mode ) | [virtual] |
Opens the file in the specified mode.
Implements vl::VirtualFile.
Definition at line 366 of file ZippedFile.cpp.
References vl::VirtualFile::close(), vl::Log::error(), isOpen(), mReadBytes, mUncompressedBuffer, mUncompressedBufferPtr, mZStream, vl::OM_ReadOnly, vl::VirtualFile::seekSet(), vl::ZippedFileInfo::sourceZipFile(), and zippedFileInfo().
Referenced by resetStream().
bool ZippedFile::isOpen | ( | ) | const [virtual] |
Returns true
if the file has been opened.
Implements vl::VirtualFile.
Definition at line 442 of file ZippedFile.cpp.
References mReadBytes.
Referenced by extract(), fillUncompressedBuffer(), open(), and read_Implementation().
void ZippedFile::close | ( | ) | [virtual] |
Closes the file.
Implements vl::VirtualFile.
Definition at line 444 of file ZippedFile.cpp.
References vl::VirtualFile::close(), mReadBytes, mUncompressedBuffer, mUncompressedBufferPtr, mZStream, vl::ZippedFileInfo::sourceZipFile(), and zippedFileInfo().
Referenced by resetStream(), and ~ZippedFile().
long long ZippedFile::size | ( | ) | const [virtual] |
Returns the size of the file in bytes.
Implements vl::VirtualFile.
Definition at line 456 of file ZippedFile.cpp.
References mZippedFileInfo.
bool ZippedFile::extract | ( | char * | destination, |
bool | check_sum = true |
||
) |
Definition at line 540 of file ZippedFile.cpp.
References vl::CRC32CheckSum::compute(), vl::Log::error(), vl::ZippedFileInfo::generalPurposeFlag(), vl::ref< T >::get(), isOpen(), vl::ZippedFileInfo::mCompressedSize, vl::ZippedFileInfo::mCompressionMethod, vl::ZippedFileInfo::mCRC32, vl::ZippedFileInfo::mUncompressedSize, vl::OM_ReadOnly, vl::ZippedFileInfo::sourceZipFile(), vl::ZippedFileInfo::versionNeeded(), VL_CHECK, zippedFileInfo(), and vl::ZippedFileInfo::zippedFileOffset().
ZippedFile& vl::ZippedFile::operator= | ( | const ZippedFile & | other ) | [inline] |
Definition at line 165 of file ZippedFile.hpp.
References vl::ref< T >::get(), and mZippedFileInfo.
ref< VirtualFile > ZippedFile::clone | ( | ) | const [virtual] |
Creates a clone of this class instance.
Implements vl::VirtualFile.
Definition at line 682 of file ZippedFile.cpp.
References ZippedFile().
void ZippedFile::resetStream | ( | ) |
Definition at line 464 of file ZippedFile.cpp.
References close(), vl::OM_ReadOnly, and open().
Referenced by seekSet_Implementation().
long long ZippedFile::read_Implementation | ( | void * | buffer, |
long long | bytes_to_read | ||
) | [protected, virtual] |
Implements vl::VirtualFile.
Definition at line 484 of file ZippedFile.cpp.
References fillUncompressedBuffer(), isOpen(), mReadBytes, mUncompressedBuffer, mUncompressedBufferPtr, vl::VirtualFile::read(), vl::ZippedFileInfo::sourceZipFile(), vl::ZippedFileInfo::uncompressedSize(), VL_CHECK, and zippedFileInfo().
virtual long long vl::ZippedFile::write_Implementation | ( | const void * | , |
long long | |||
) | [inline, protected, virtual] |
Implements vl::VirtualFile.
Definition at line 185 of file ZippedFile.hpp.
bool ZippedFile::fillUncompressedBuffer | ( | ) | [protected, virtual] |
Definition at line 625 of file ZippedFile.cpp.
References vl::ZippedFileInfo::compressedSize(), vl::Log::error(), isOpen(), mReadBytes, mUncompressedBuffer, mUncompressedBufferPtr, mZipBufferIn, mZipBufferOut, mZStream, vl::VirtualFile::position(), vl::VirtualFile::read(), vl::ZippedFileInfo::sourceZipFile(), vl::ZippedFileInfo::uncompressedSize(), VL_CHECK, zippedFileInfo(), and vl::ZippedFileInfo::zippedFileOffset().
Referenced by read_Implementation().
virtual long long vl::ZippedFile::position_Implementation | ( | ) | const [inline, protected, virtual] |
Implements vl::VirtualFile.
Definition at line 189 of file ZippedFile.hpp.
bool ZippedFile::seekSet_Implementation | ( | long long | pos ) | [protected, virtual] |
Implements vl::VirtualFile.
Definition at line 470 of file ZippedFile.cpp.
References vl::VirtualFile::position(), vl::VirtualFile::read(), and resetStream().
ref<ZippedFileInfo> vl::ZippedFile::mZippedFileInfo [protected] |
Definition at line 194 of file ZippedFile.hpp.
Referenced by operator=(), setZippedFileInfo(), size(), and zippedFileInfo().
long long vl::ZippedFile::mReadBytes [protected] |
Definition at line 195 of file ZippedFile.hpp.
Referenced by close(), fillUncompressedBuffer(), isOpen(), open(), read_Implementation(), ZippedFile(), and ~ZippedFile().
z_stream_s* vl::ZippedFile::mZStream [protected] |
Definition at line 197 of file ZippedFile.hpp.
Referenced by close(), fillUncompressedBuffer(), open(), ZippedFile(), and ~ZippedFile().
unsigned char vl::ZippedFile::mZipBufferIn[CHUNK_SIZE] [protected] |
Definition at line 198 of file ZippedFile.hpp.
Referenced by fillUncompressedBuffer().
unsigned char vl::ZippedFile::mZipBufferOut[CHUNK_SIZE] [protected] |
Definition at line 199 of file ZippedFile.hpp.
Referenced by fillUncompressedBuffer().
std::vector<char> vl::ZippedFile::mUncompressedBuffer [protected] |
Definition at line 200 of file ZippedFile.hpp.
Referenced by close(), fillUncompressedBuffer(), open(), and read_Implementation().
int vl::ZippedFile::mUncompressedBufferPtr [protected] |
Definition at line 201 of file ZippedFile.hpp.
Referenced by close(), fillUncompressedBuffer(), open(), and read_Implementation().