|
Visualization Library 2.1.0
A 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>
Inheritance diagram for vl::ZippedFile: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. More... | |
| virtual bool | open (EOpenMode mode) |
| Opens the file in the specified mode. More... | |
| virtual bool | isOpen () const |
Returns true if the file has been opened. More... | |
| virtual void | close () |
| Closes the file. More... | |
| virtual long long | size () const |
| Returns the size of the file in bytes. More... | |
| 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. More... | |
| void | resetStream () |
Public Member Functions inherited from vl::VirtualFile | |
| VirtualFile () | |
| Constructor. More... | |
| unsigned int | crc32 () |
| Computes the crc32 of the entire file. More... | |
| MD5CheckSum | md5 () |
| Computes the md5 of the entire file. More... | |
| VirtualFile & | operator= (const VirtualFile &other) |
| const String & | path () const |
Returns the path of the file. More... | |
| void | setPath (const String &name) |
| Changes the path bound to a VirtualFile. Use carefully this function, you shouldn't rename a VirtualFile managed by a VirtualDirectory. More... | |
| long long | peek (void *buffer, long long byte_count) |
| Reads byte_count bytes and returns to the original position. More... | |
| long long | read (void *buffer, long long byte_count) |
Reads byte_count bytes from a file. Returns the number of bytes actually read. More... | |
| long long | write (const void *buffer, long long byte_count) |
Writes byte_count bytes to a file. Returns the number of bytes actually written. More... | |
| long long | position () const |
| Returns the current position in the file. More... | |
| bool | seekSet (long long offset) |
| Changes the current read/write position of a file. More... | |
| bool | seekCur (long long offset) |
| Changes the current read/write position of a file. More... | |
| bool | seekEnd (long long offset) |
| Changes the current read/write position of a file. More... | |
| bool | endOfFile () const |
Returns true if position() >= size() More... | |
| long long | load (std::vector< char > &data) |
| Loads the entire file in the specified vector. More... | |
| long long | load (void *buffer, long long max=-1) |
| Loads the entire file in the specified buffer. More... | |
| double | readDouble (bool little_endian_data=true) |
| Reads single entry. More... | |
| float | readFloat (bool little_endian_data=true) |
| Reads single entry. More... | |
| unsigned long long | readUInt64 (bool little_endian_data=true) |
| Reads single entry. More... | |
| long long | readSInt64 (bool little_endian_data=true) |
| Reads single entry. More... | |
| unsigned int | readUInt32 (bool little_endian_data=true) |
| Reads single entry. More... | |
| int | readSInt32 (bool little_endian_data=true) |
| Reads single entry. More... | |
| unsigned short | readUInt16 (bool little_endian_data=true) |
| Reads single entry. More... | |
| short | readSInt16 (bool little_endian_data=true) |
| Reads single entry. More... | |
| unsigned char | readUInt8 () |
| Reads single entry. More... | |
| char | readSInt8 () |
| Reads single entry. More... | |
| long long | readDouble (double *buffer, long long count, bool little_endian_data=true) |
| Reads multiple entries. Returns the number of bytes read. More... | |
| long long | readFloat (float *buffer, long long count, bool little_endian_data=true) |
| Reads multiple entries. Returns the number of bytes read. More... | |
| long long | readUInt64 (unsigned long long *buffer, long long count, bool little_endian_data=true) |
| Reads multiple entries. Returns the number of bytes read. More... | |
| long long | readSInt64 (long long *buffer, long long count, bool little_endian_data=true) |
| Reads multiple entries. Returns the number of bytes read. More... | |
| long long | readUInt32 (unsigned int *buffer, long long count, bool little_endian_data=true) |
| Reads multiple entries. Returns the number of bytes read. More... | |
| long long | readSInt32 (int *buffer, long long count, bool little_endian_data=true) |
| Reads multiple entries. Returns the number of bytes read. More... | |
| long long | readUInt16 (unsigned short *buffer, long long count, bool little_endian_data=true) |
| Reads multiple entries. Returns the number of bytes read. More... | |
| long long | readSInt16 (short *buffer, long long count, bool little_endian_data=true) |
| Reads multiple entries. Returns the number of bytes read. More... | |
| long long | readUInt8 (unsigned char *buffer, long long count) |
| Reads multiple entries. Returns the number of bytes read. More... | |
| long long | readSInt8 (char *buffer, long long count) |
| Reads multiple entries. Returns the number of bytes read. More... | |
| long long | writeDouble (double data, bool little_endian_data=true) |
| Writes a single entry. Returns the number of bytes written. More... | |
| long long | writeFloat (float data, bool little_endian_data=true) |
| Writes a single entry. Returns the number of bytes written. More... | |
| long long | writeUInt64 (unsigned long long data, bool little_endian_data=true) |
| Writes a single entry. Returns the number of bytes written. More... | |
| long long | writeSInt64 (long long data, bool little_endian_data=true) |
| Writes a single entry. Returns the number of bytes written. More... | |
| long long | writeUInt32 (unsigned int data, bool little_endian_data=true) |
| Writes a single entry. Returns the number of bytes written. More... | |
| long long | writeSInt32 (int data, bool little_endian_data=true) |
| Writes a single entry. Returns the number of bytes written. More... | |
| long long | writeUInt16 (unsigned short data, bool little_endian_data=true) |
| Writes a single entry. Returns the number of bytes written. More... | |
| long long | writeSInt16 (short data, bool little_endian_data=true) |
| Writes a single entry. Returns the number of bytes written. More... | |
| long long | writeUInt8 (unsigned char data) |
| Writes a single entry. Returns the number of bytes written. More... | |
| long long | writeSInt8 (char data) |
| Writes a single entry. Returns the number of bytes written. More... | |
| long long | writeDouble (const double *buffer, long long count, bool little_endian_data=true) |
| Writes multiple entries. Returns the number of bytes written. More... | |
| long long | writeFloat (const float *buffer, long long count, bool little_endian_data=true) |
| Writes multiple entries. Returns the number of bytes written. More... | |
| long long | writeUInt64 (const unsigned long long *buffer, long long count, bool little_endian_data=true) |
| Writes multiple entries. Returns the number of bytes written. More... | |
| long long | writeSInt64 (const long long *buffer, long long count, bool little_endian_data=true) |
| Writes multiple entries. Returns the number of bytes written. More... | |
| long long | writeUInt32 (const unsigned int *buffer, long long count, bool little_endian_data=true) |
| Writes multiple entries. Returns the number of bytes written. More... | |
| long long | writeSInt32 (const int *buffer, long long count, bool little_endian_data=true) |
| Writes multiple entries. Returns the number of bytes written. More... | |
| long long | writeUInt16 (const unsigned short *buffer, long long count, bool little_endian_data=true) |
| Writes multiple entries. Returns the number of bytes written. More... | |
| long long | writeSInt16 (const short *buffer, long long count, bool little_endian_data=true) |
| Writes multiple entries. Returns the number of bytes written. More... | |
| long long | writeUInt8 (const unsigned char *buffer, long long count) |
| Writes multiple entries. Returns the number of bytes written. More... | |
| long long | writeSInt8 (const char *buffer, long long count) |
| Writes multiple entries. Returns the number of bytes written. More... | |
Public Member Functions inherited from vl::Object | |
| Object () | |
| Constructor. More... | |
| Object (const Object &other) | |
| Copy constructor: copies the name, ref count mutex and user data. More... | |
| Object & | operator= (const Object &other) |
| Copy operator: copies the object's name, ref count mutex and user data. More... | |
| const std::string & | objectName () const |
| The name of the object, by default set to the object's class name. More... | |
| void | setObjectName (const char *name) |
| The name of the object, by default set to the object's class name in debug builds. More... | |
| void | setObjectName (const std::string &name) |
| The name of the object, by default set to the object's class name in debug builds. More... | |
| void | setRefCountMutex (IMutex *mutex) |
| The mutex used to protect the reference counting of an Object across multiple threads. More... | |
| IMutex * | refCountMutex () |
| The mutex used to protect the reference counting of an Object across multiple threads. More... | |
| const IMutex * | refCountMutex () const |
| The mutex used to protect the reference counting of an Object across multiple threads. More... | |
| int | referenceCount () const |
| Returns the number of references of an object. More... | |
| void | incReference () const |
| Increments the reference count of an object. More... | |
| void | decReference () |
Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More... | |
| void | setAutomaticDelete (bool autodel_on) |
| If set to true the Object is deleted when its reference count reaches 0. More... | |
| bool | automaticDelete () const |
| If set to true the Object is deleted when its reference count reaches 0. More... | |
| template<class T > | |
| T * | as () |
| Casts an Object to the specified class. More... | |
| template<class T > | |
| const T * | as () const |
| Casts an Object to the specified class. More... | |
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 Member Functions inherited from vl::VirtualFile | |
| VirtualFile (const VirtualFile &other) | |
| long long | write64 (const void *buffer, long long count, bool little_endian_data=true) |
| long long | write32 (const void *buffer, long long count, bool little_endian_data=true) |
| long long | write16 (const void *buffer, long long count, bool little_endian_data=true) |
| long long | read64 (void *buffer, long long count, bool little_endian_data=true) |
| long long | read32 (void *buffer, long long count, bool little_endian_data=true) |
| long long | read16 (void *buffer, long long count, bool little_endian_data=true) |
| long long | write64 (const void *buffer, bool little_endian_data=true) |
| long long | write32 (const void *buffer, bool little_endian_data=true) |
| long long | write16 (const void *buffer, bool little_endian_data=true) |
| long long | read64 (void *buffer, bool little_endian_data=true) |
| long long | read32 (void *buffer, bool little_endian_data=true) |
| long long | read16 (void *buffer, bool little_endian_data=true) |
Protected Member Functions inherited from vl::Object | |
| virtual | ~Object () |
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 |
Protected Attributes inherited from vl::VirtualFile | |
| String | mPath |
Protected Attributes inherited from vl::Object | |
| std::string | mObjectName |
| IMutex * | mRefCountMutex |
| int | mReferenceCount |
| bool | mAutomaticDelete |
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.
|
virtual |
Creates a clone of this class instance.
Implements vl::VirtualFile.
Definition at line 682 of file ZippedFile.cpp.
References ZippedFile().
|
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().
|
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::extract | ( | char * | destination, |
| bool | check_sum = true |
||
| ) |
Definition at line 540 of file ZippedFile.cpp.
References vl::VirtualFile::close(), vl::CRC32CheckSum::compute(), vl::Log::error(), vl::ZippedFileInfo::generalPurposeFlag(), vl::ref< T >::get(), vl::VirtualFile::isOpen(), isOpen(), vl::ZippedFileInfo::mCompressedSize, vl::ZippedFileInfo::mCompressionMethod, vl::ZippedFileInfo::mCRC32, vl::ZippedFileInfo::mUncompressedSize, vl::OM_ReadOnly, vl::VirtualFile::open(), vl::VirtualFile::read(), vl::VirtualFile::seekSet(), vl::ZippedFileInfo::sourceZipFile(), vl::ZippedFileInfo::versionNeeded(), VL_CHECK, zippedFileInfo(), and vl::ZippedFileInfo::zippedFileOffset().
|
protectedvirtual |
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 |
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().
|
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().
|
inline |
Definition at line 165 of file ZippedFile.hpp.
References vl::ref< T >::get(), mZippedFileInfo, and vl::ZippedFileInfo::ZippedFileInfo().
|
inlineprotectedvirtual |
Implements vl::VirtualFile.
Definition at line 189 of file ZippedFile.hpp.
|
protectedvirtual |
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().
| void ZippedFile::resetStream | ( | ) |
Definition at line 464 of file ZippedFile.cpp.
References close(), vl::OM_ReadOnly, and open().
Referenced by seekSet_Implementation().
|
protectedvirtual |
Implements vl::VirtualFile.
Definition at line 470 of file ZippedFile.cpp.
References vl::VirtualFile::position(), vl::VirtualFile::read(), and resetStream().
| void ZippedFile::setZippedFileInfo | ( | ZippedFileInfo * | info | ) |
Definition at line 359 of file ZippedFile.cpp.
References mZippedFileInfo.
Referenced by vl::ZippedDirectory::init().
|
virtual |
Returns the size of the file in bytes.
Implements vl::VirtualFile.
Definition at line 456 of file ZippedFile.cpp.
References mZippedFileInfo.
|
inlineprotectedvirtual |
Implements vl::VirtualFile.
Definition at line 185 of file ZippedFile.hpp.
| const ZippedFileInfo * ZippedFile::zippedFileInfo | ( | ) | const |
Definition at line 355 of file ZippedFile.cpp.
References mZippedFileInfo.
Referenced by close(), exists(), extract(), fillUncompressedBuffer(), open(), and read_Implementation().
| ZippedFileInfo * ZippedFile::zippedFileInfo | ( | ) |
Definition at line 357 of file ZippedFile.cpp.
References mZippedFileInfo.
|
protected |
Definition at line 195 of file ZippedFile.hpp.
Referenced by close(), fillUncompressedBuffer(), isOpen(), open(), read_Implementation(), ZippedFile(), and ~ZippedFile().
|
protected |
Definition at line 200 of file ZippedFile.hpp.
Referenced by close(), fillUncompressedBuffer(), open(), and read_Implementation().
|
protected |
Definition at line 201 of file ZippedFile.hpp.
Referenced by close(), fillUncompressedBuffer(), open(), and read_Implementation().
|
protected |
Definition at line 198 of file ZippedFile.hpp.
Referenced by fillUncompressedBuffer().
|
protected |
Definition at line 199 of file ZippedFile.hpp.
Referenced by fillUncompressedBuffer().
|
protected |
Definition at line 194 of file ZippedFile.hpp.
Referenced by operator=(), setZippedFileInfo(), size(), and zippedFileInfo().
|
protected |
Definition at line 197 of file ZippedFile.hpp.
Referenced by close(), fillUncompressedBuffer(), open(), ZippedFile(), and ~ZippedFile().
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:56.
© Copyright Michele Bosi. All rights reserved.