Visualization LibraryA lightweight C++ OpenGL middleware for 2D/3D graphics |
[Home] [Tutorials] [All Classes] [Grouped Classes] |
A VirtualDirectory capable of reading files from a .zip file. More...
#include <ZippedDirectory.hpp>
Public Member Functions | |
| virtual const char * | className () |
| Returns the name of the class. | |
| 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. | |
| VirtualFile * | sourceZipFile () const |
| void | setSourceZipFile (VirtualFile *file) |
| void | reset () |
| Sets the source zip file to NULL and disposes all the files contained in this directory. | |
| ref< VirtualFile > | file (const String &name) const |
| Returns the VirtualFile with the given name if any, NULL otherwise. | |
| ref< ZippedFile > | zippedFile (const String &name) const |
| Accepts absolute and relative paths. | |
| void | listFilesRecursive (std::vector< String > &file_list) const |
| Returns the list of files contained in the VirtualDirectory. | |
| int | zippedFileCount () const |
| ZippedFile * | zippedFile (int index) const |
| 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 () |
Protected Member Functions | |
| bool | init () |
Protected Attributes | |
| std::map< String, ref < ZippedFile > > | mFiles |
| ref< VirtualFile > | mSourceZipFile |
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 const char* vl::ZippedDirectory::className | ( | ) | [inline, virtual] |
Returns the name of the class.
Reimplemented from vl::VirtualDirectory.
Definition at line 61 of file ZippedDirectory.hpp.
| bool ZippedDirectory::setPath | ( | const String & | path ) | [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::String::left(), vl::length(), vl::String::length(), mFiles, vl::VirtualDirectory::mPath, vl::String::normalizeSlashes(), vl::VirtualDirectory::path(), vl::String::right(), vl::String::startsWith(), and vl::String::trim().
| VirtualFile * ZippedDirectory::sourceZipFile | ( | ) | const |
Definition at line 85 of file ZippedDirectory.cpp.
References vl::ref< T >::get(), and mSourceZipFile.
Referenced by init().
| void ZippedDirectory::setSourceZipFile | ( | VirtualFile * | file ) |
Definition at line 90 of file ZippedDirectory.cpp.
References file(), init(), mSourceZipFile, and reset().
Referenced by ZippedDirectory().
| void ZippedDirectory::reset | ( | ) |
Sets the source zip file to NULL and disposes all the files contained in this directory.
Definition at line 98 of file ZippedDirectory.cpp.
References mFiles, and mSourceZipFile.
Referenced by setSourceZipFile().
| ref< VirtualFile > ZippedDirectory::file | ( | const String & | name ) | const [virtual] |
Returns the VirtualFile with the given name if any, NULL otherwise.
Implements vl::VirtualDirectory.
Definition at line 238 of file ZippedDirectory.cpp.
References zippedFile().
Referenced by setSourceZipFile().
| ref< ZippedFile > ZippedDirectory::zippedFile | ( | const String & | name ) | const |
Accepts absolute and relative paths.
Definition at line 256 of file ZippedDirectory.cpp.
References vl::ref< T >::get(), mFiles, and vl::VirtualDirectory::translatePath().
Referenced by file(), and isCorrupted().
| void ZippedDirectory::listFilesRecursive | ( | std::vector< String > & | file_list ) | const [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 270 of file ZippedDirectory.cpp.
References vl::Log::error(), mFiles, vl::VirtualDirectory::path(), and vl::Log::warning().
| int ZippedDirectory::zippedFileCount | ( | ) | const |
| ZippedFile * ZippedDirectory::zippedFile | ( | int | index ) | const |
Definition at line 248 of file ZippedDirectory.cpp.
References mFiles.
| void ZippedDirectory::listSubDirs | ( | std::vector< String > & | dirs, |
| bool | append = false |
||
| ) | const [virtual] |
Implements vl::VirtualDirectory.
Definition at line 286 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.
| ref< ZippedDirectory > ZippedDirectory::zippedSubDir | ( | const String & | subdir_name ) | const |
Definition at line 321 of file ZippedDirectory.cpp.
References vl::Log::error(), mFiles, vl::VirtualDirectory::path(), vl::VirtualDirectory::translatePath(), VL_CHECK, and ZippedDirectory().
| ref<VirtualDirectory> vl::ZippedDirectory::subDir | ( | const String & | subdir_name ) | const [inline, virtual] |
Implements vl::VirtualDirectory.
Definition at line 91 of file ZippedDirectory.hpp.
| void ZippedDirectory::listFiles | ( | std::vector< String > & | file_list, |
| bool | append = false |
||
| ) | const [virtual] |
Implements vl::VirtualDirectory.
Definition at line 346 of file ZippedDirectory.cpp.
References vl::Log::error(), mFiles, and vl::VirtualDirectory::path().
| bool ZippedDirectory::isCorrupted | ( | ) |
Definition at line 362 of file ZippedDirectory.cpp.
References init(), zippedFile(), and zippedFileCount().
| bool ZippedDirectory::init | ( | ) | [protected] |
Definition at line 104 of file ZippedDirectory.cpp.
References vl::String::endsWith(), vl::Log::error(), vl::String::fromUTF8(), vl::ref< T >::get(), mFiles, vl::String::normalizeSlashes(), vl::OM_ReadOnly, vl::VirtualDirectory::path(), vl::String::resize(), sourceZipFile(), and vl::String::toStdString().
Referenced by isCorrupted(), and setSourceZipFile().
std::map< String, ref<ZippedFile> > vl::ZippedDirectory::mFiles [protected] |
Definition at line 101 of file ZippedDirectory.hpp.
Referenced by init(), listFiles(), listFilesRecursive(), listSubDirs(), reset(), setPath(), zippedFile(), zippedFileCount(), and zippedSubDir().
ref<VirtualFile> vl::ZippedDirectory::mSourceZipFile [protected] |
Definition at line 102 of file ZippedDirectory.hpp.
Referenced by reset(), setSourceZipFile(), and sourceZipFile().