Visualization Library 2.0.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
A VirtualDirectory capable of reading files from a .zip file. More...
#include <ZippedDirectory.hpp>
Public Member Functions | |
ZippedDirectory () | |
ZippedDirectory (const String &zip_file) | |
ZippedDirectory (VirtualFile *zip_file) | |
bool | setPath (const String &name) |
Changes the path name of a VirtualDirectory. Must not be an empty string. More... | |
const VirtualFile * | sourceZipFile () const |
VirtualFile * | sourceZipFile () |
void | setSourceZipFile (VirtualFile *file) |
void | reset () |
Sets the source zip file to NULL and disposes all the files contained in this directory. More... | |
ref< VirtualFile > | file (const String &name) const |
Returns the VirtualFile with the given name if any, NULL otherwise. More... | |
ref< ZippedFile > | zippedFile (const String &name) const |
Accepts absolute and relative paths. More... | |
void | listFilesRecursive (std::vector< String > &file_list) const |
Returns the list of files contained in the VirtualDirectory. More... | |
int | zippedFileCount () const |
const ZippedFile * | zippedFile (int index) const |
ZippedFile * | zippedFile (int index) |
void | listSubDirs (std::vector< String > &dirs, bool append=false) const |
ref< ZippedDirectory > | zippedSubDir (const String &subdir_name) const |
ref< VirtualDirectory > | subDir (const String &subdir_name) const |
void | listFiles (std::vector< String > &file_list, bool append=false) const |
bool | isCorrupted () |
Public Member Functions inherited from vl::VirtualDirectory | |
VirtualDirectory () | |
Constructor. More... | |
VirtualDirectory (const String &path) | |
Constructor. More... | |
virtual const String & | path () const |
bool | fileExists (const String &name) const |
Checks the existence of a file in the directory. More... | |
virtual void | listFilesRecursive (std::vector< String > &file_list, const String &match) const |
Returns the list of files contained in the VirtualDirectory that match the expression 'match'. 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 | |
bool | init () |
Protected Member Functions inherited from vl::VirtualDirectory | |
String | translatePath (const String &p) const |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
Protected Attributes | |
std::map< String, ref< ZippedFile > > | mFiles |
ref< VirtualFile > | mSourceZipFile |
Protected Attributes inherited from vl::VirtualDirectory | |
String | mPath |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
A VirtualDirectory capable of reading files from a .zip file.
Definition at line 58 of file ZippedDirectory.hpp.
ZippedDirectory::ZippedDirectory | ( | ) |
Definition at line 39 of file ZippedDirectory.cpp.
Referenced by zippedSubDir().
ZippedDirectory::ZippedDirectory | ( | const String & | zip_file | ) |
Definition at line 41 of file ZippedDirectory.cpp.
References vl::defFileSystem(), vl::Log::error(), vl::ref< T >::get(), vl::FileSystem::locateFile(), and setSourceZipFile().
ZippedDirectory::ZippedDirectory | ( | VirtualFile * | zip_file | ) |
Definition at line 50 of file ZippedDirectory.cpp.
References setSourceZipFile().
|
virtual |
Returns the VirtualFile with the given name if any, NULL otherwise.
Implements vl::VirtualDirectory.
Definition at line 248 of file ZippedDirectory.cpp.
References zippedFile().
Referenced by setSourceZipFile().
|
protected |
Definition at line 114 of file ZippedDirectory.cpp.
References vl::VirtualFile::close(), vl::String::endsWith(), vl::Log::error(), vl::String::fromUTF8(), vl::ref< T >::get(), vl::ZippedFileInfo::mCompressedSize, vl::ZippedFileInfo::mCompressionMethod, vl::ZippedFileInfo::mCRC32, vl::ZippedFileInfo::mDay, vl::ZippedFileInfo::mExtraFieldLength, vl::ZippedFileInfo::mFileName, vl::ZippedFileInfo::mFileNameLength, mFiles, vl::ZippedFileInfo::mGeneralPurposeFlag, vl::ZippedFileInfo::mHour, vl::ZippedFileInfo::mMinute, vl::ZippedFileInfo::mMonth, vl::ZippedFileInfo::mSecond, vl::ZippedFileInfo::mUncompressedSize, vl::ZippedFileInfo::mVersionNeeded, vl::ZippedFileInfo::mYear, vl::ZippedFileInfo::mZippedFileOffset, vl::String::normalizeSlashes(), vl::OM_ReadOnly, vl::VirtualFile::open(), vl::VirtualDirectory::path(), vl::VirtualFile::path(), vl::VirtualFile::position(), vl::VirtualFile::read(), vl::VirtualFile::readUInt16(), vl::VirtualFile::readUInt32(), vl::String::resize(), vl::VirtualFile::seekCur(), vl::VirtualFile::setPath(), vl::ZippedFileInfo::setSourceZipFile(), vl::ZippedFile::setZippedFileInfo(), sourceZipFile(), and vl::String::toStdString().
Referenced by isCorrupted(), and setSourceZipFile().
bool ZippedDirectory::isCorrupted | ( | ) |
Definition at line 386 of file ZippedDirectory.cpp.
References init(), zippedFile(), and zippedFileCount().
|
virtual |
Implements vl::VirtualDirectory.
Definition at line 370 of file ZippedDirectory.cpp.
References vl::Log::error(), mFiles, and vl::VirtualDirectory::path().
|
virtual |
Returns the list of files contained in the VirtualDirectory.
If there are subdirectories the files will be searched recursively.
Implements vl::VirtualDirectory.
Definition at line 294 of file ZippedDirectory.cpp.
References vl::Log::error(), mFiles, vl::VirtualDirectory::path(), and vl::Log::warning().
|
virtual |
Implements vl::VirtualDirectory.
Definition at line 310 of file ZippedDirectory.cpp.
References vl::Log::error(), vl::String::extractPath(), vl::String::left(), vl::length(), mFiles, vl::VirtualDirectory::path(), vl::String::right(), vl::String::split(), and VL_CHECK.
void ZippedDirectory::reset | ( | ) |
Sets the source zip file to NULL and disposes all the files contained in this directory.
Definition at line 108 of file ZippedDirectory.cpp.
References mFiles, mSourceZipFile, and NULL.
Referenced by setSourceZipFile().
|
virtual |
Changes the path
name
of a VirtualDirectory. Must not be an empty string.
Reimplemented from vl::VirtualDirectory.
Definition at line 56 of file ZippedDirectory.cpp.
References vl::String::empty(), vl::String::endsWith(), vl::Log::error(), vl::length(), mFiles, vl::VirtualDirectory::mPath, vl::String::normalizeSlashes(), vl::VirtualDirectory::path(), vl::String::right(), vl::String::startsWith(), vl::String::trim(), and vl::Log::warning().
void ZippedDirectory::setSourceZipFile | ( | VirtualFile * | file | ) |
Definition at line 100 of file ZippedDirectory.cpp.
References file(), init(), mSourceZipFile, and reset().
Referenced by ZippedDirectory().
const VirtualFile * ZippedDirectory::sourceZipFile | ( | ) | const |
VirtualFile * ZippedDirectory::sourceZipFile | ( | ) |
Definition at line 95 of file ZippedDirectory.cpp.
References mSourceZipFile.
|
inlinevirtual |
Implements vl::VirtualDirectory.
Definition at line 95 of file ZippedDirectory.hpp.
ref< ZippedFile > ZippedDirectory::zippedFile | ( | const String & | name | ) | const |
Accepts absolute and relative paths.
Definition at line 280 of file ZippedDirectory.cpp.
References vl::ref< T >::get(), mFiles, NULL, and vl::VirtualDirectory::translatePath().
Referenced by file(), and isCorrupted().
const ZippedFile * ZippedDirectory::zippedFile | ( | int | index | ) | const |
Definition at line 258 of file ZippedDirectory.cpp.
ZippedFile * ZippedDirectory::zippedFile | ( | int | index | ) |
Definition at line 269 of file ZippedDirectory.cpp.
int ZippedDirectory::zippedFileCount | ( | ) | const |
ref< ZippedDirectory > ZippedDirectory::zippedSubDir | ( | const String & | subdir_name | ) | const |
Definition at line 345 of file ZippedDirectory.cpp.
References vl::Log::error(), mFiles, NULL, vl::VirtualDirectory::path(), vl::VirtualFile::path(), vl::VirtualDirectory::translatePath(), VL_CHECK, and ZippedDirectory().
|
protected |
Definition at line 105 of file ZippedDirectory.hpp.
Referenced by init(), listFiles(), listFilesRecursive(), listSubDirs(), reset(), setPath(), zippedFile(), zippedFileCount(), and zippedSubDir().
|
protected |
Definition at line 106 of file ZippedDirectory.hpp.
Referenced by reset(), setSourceZipFile(), and sourceZipFile().
Visualization Library 2.0.0 Reference Documentation
Updated on Wed Dec 23 2020 12:44:12.
© Copyright Michele Bosi. All rights reserved.