# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Member Functions | Protected Attributes

# vl::ZippedFile Class Reference

A VirtualFile used to read a file contained in a .zip archive. More...

`#include <ZippedFile.hpp>`

Inheritance diagram for vl::ZippedFile:

List of all members.

## Public Member Functions

virtual const char * | className ()
| Returns the name of the class.
| ZippedFile ()
| ~ZippedFile ()
ZippedFileInfo * | zippedFileInfo () const
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

## Detailed Description

A VirtualFile used to read a file contained in a .zip archive.

See also:
  - VirtualDirectory
  - DiskDirectory
  - MemoryDirectory
  - ZippedDirectory
  - FileSystem
  - VirtualFile
  - DiskFile
  - MemoryFile

Definition at line 132 of file ZippedFile.hpp.

## Constructor & Destructor Documentation

ZippedFile::ZippedFile | ( | ) |

Definition at line 225 of file ZippedFile.cpp.

References mReadBytes, and mZStream.

Referenced by clone().

ZippedFile::~ZippedFile | ( | ) |

Definition at line 232 of file ZippedFile.cpp.

References close(), mReadBytes, and mZStream.

## Member Function Documentation

virtual const char* vl::ZippedFile::className | ( | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented from vl::VirtualFile.

Definition at line 139 of file ZippedFile.hpp.

ZippedFileInfo * ZippedFile::zippedFileInfo | ( | ) | const

Definition at line 239 of file ZippedFile.cpp.

References vl::ref< T >::get(), and mZippedFileInfo.

Referenced by close(), exists(), extract(), fillUncompressedBuffer(), open(), and read_Implementation().

void ZippedFile::setZippedFileInfo | ( | ZippedFileInfo * | info ) |

Definition at line 241 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 243 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 248 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 324 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 326 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 338 of file ZippedFile.cpp.

References mZippedFileInfo.

bool ZippedFile::extract | ( | char * | destination,
|  | bool | check_sum = `true`
| ) |  |

Definition at line 422 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 162 of file ZippedFile.hpp.

References vl::ref< T >::get(), mZippedFileInfo, and vl::VirtualFile::operator=().

ref< VirtualFile > ZippedFile::clone | ( | ) | const`[virtual]`

Creates a clone of this class instance.

Implements vl::VirtualFile.

Definition at line 564 of file ZippedFile.cpp.

References ZippedFile().

void ZippedFile::resetStream | ( | ) |

Definition at line 346 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 366 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 182 of file ZippedFile.hpp.

bool ZippedFile::fillUncompressedBuffer | ( | ) | `[protected, virtual]`

Definition at line 507 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 186 of file ZippedFile.hpp.

bool ZippedFile::seekSet_Implementation | ( | long long | pos ) | `[protected, virtual]`

Implements vl::VirtualFile.

Definition at line 352 of file ZippedFile.cpp.

References vl::VirtualFile::position(), vl::VirtualFile::read(), and resetStream().

## Member Data Documentation

ref<ZippedFileInfo> vl::ZippedFile::mZippedFileInfo`[protected]`

Definition at line 191 of file ZippedFile.hpp.

Referenced by operator=(), setZippedFileInfo(), size(), and zippedFileInfo().

long long vl::ZippedFile::mReadBytes`[protected]`

Definition at line 192 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 194 of file ZippedFile.hpp.

Referenced by close(), fillUncompressedBuffer(), open(), ZippedFile(), and ~ZippedFile().

unsigned char vl::ZippedFile::mZipBufferIn[CHUNK_SIZE]`[protected]`

Definition at line 195 of file ZippedFile.hpp.

Referenced by fillUncompressedBuffer().

unsigned char vl::ZippedFile::mZipBufferOut[CHUNK_SIZE]`[protected]`

Definition at line 196 of file ZippedFile.hpp.

Referenced by fillUncompressedBuffer().

std::vector<char> vl::ZippedFile::mUncompressedBuffer`[protected]`

Definition at line 197 of file ZippedFile.hpp.

Referenced by close(), fillUncompressedBuffer(), open(), and read_Implementation().

int vl::ZippedFile::mUncompressedBufferPtr`[protected]`

Definition at line 198 of file ZippedFile.hpp.

Referenced by close(), fillUncompressedBuffer(), open(), and read_Implementation().

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/ZippedFile.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/ZippedFile.cpp

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:36.
Permission is granted to use this page to write and publish articles regarding Visualization Library.