Visualization Library 2.1.0

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

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vl::ZippedDirectory Class Reference

A VirtualDirectory capable of reading files from a .zip file. More...

#include <ZippedDirectory.hpp>

+ Inheritance diagram for vl::ZippedDirectory:

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 VirtualFilesourceZipFile () const
 
VirtualFilesourceZipFile ()
 
void setSourceZipFile (VirtualFile *file)
 
void reset ()
 Sets the source zip file to NULL and disposes all the files contained in this directory. More...
 
ref< VirtualFilefile (const String &name) const
 Returns the VirtualFile with the given name if any, NULL otherwise. More...
 
ref< ZippedFilezippedFile (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 ZippedFilezippedFile (int index) const
 
ZippedFilezippedFile (int index)
 
void listSubDirs (std::vector< String > &dirs, bool append=false) const
 
ref< ZippedDirectoryzippedSubDir (const String &subdir_name) const
 
ref< VirtualDirectorysubDir (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 Stringpath () 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...
 
Objectoperator= (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...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () 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< VirtualFilemSourceZipFile
 
- Protected Attributes inherited from vl::VirtualDirectory
String mPath
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Detailed Description

A VirtualDirectory capable of reading files from a .zip file.

See also

Definition at line 58 of file ZippedDirectory.hpp.

Constructor & Destructor Documentation

◆ ZippedDirectory() [1/3]

ZippedDirectory::ZippedDirectory ( )

Definition at line 39 of file ZippedDirectory.cpp.

Referenced by zippedSubDir().

◆ ZippedDirectory() [2/3]

ZippedDirectory::ZippedDirectory ( const String zip_file)

◆ ZippedDirectory() [3/3]

ZippedDirectory::ZippedDirectory ( VirtualFile zip_file)

Definition at line 50 of file ZippedDirectory.cpp.

References setSourceZipFile().

Member Function Documentation

◆ file()

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 248 of file ZippedDirectory.cpp.

References zippedFile().

Referenced by setSourceZipFile().

◆ init()

bool ZippedDirectory::init ( )
protected

◆ isCorrupted()

bool ZippedDirectory::isCorrupted ( )

Definition at line 386 of file ZippedDirectory.cpp.

References init(), zippedFile(), and zippedFileCount().

◆ listFiles()

void ZippedDirectory::listFiles ( std::vector< String > &  file_list,
bool  append = false 
) const
virtual

Implements vl::VirtualDirectory.

Definition at line 370 of file ZippedDirectory.cpp.

References vl::Log::error(), mFiles, and vl::VirtualDirectory::path().

◆ listFilesRecursive()

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 294 of file ZippedDirectory.cpp.

References vl::Log::error(), mFiles, vl::VirtualDirectory::path(), and vl::Log::warning().

◆ listSubDirs()

void ZippedDirectory::listSubDirs ( std::vector< String > &  dirs,
bool  append = false 
) const
virtual

◆ reset()

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().

◆ setPath()

bool ZippedDirectory::setPath ( const String path)
virtual

◆ setSourceZipFile()

void ZippedDirectory::setSourceZipFile ( VirtualFile file)

Definition at line 100 of file ZippedDirectory.cpp.

References file(), init(), mSourceZipFile, and reset().

Referenced by ZippedDirectory().

◆ sourceZipFile() [1/2]

const VirtualFile * ZippedDirectory::sourceZipFile ( ) const

Definition at line 90 of file ZippedDirectory.cpp.

References mSourceZipFile.

Referenced by init().

◆ sourceZipFile() [2/2]

VirtualFile * ZippedDirectory::sourceZipFile ( )

Definition at line 95 of file ZippedDirectory.cpp.

References mSourceZipFile.

◆ subDir()

ref<VirtualDirectory> vl::ZippedDirectory::subDir ( const String subdir_name) const
inlinevirtual

Implements vl::VirtualDirectory.

Definition at line 95 of file ZippedDirectory.hpp.

◆ zippedFile() [1/3]

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().

◆ zippedFile() [2/3]

const ZippedFile * ZippedDirectory::zippedFile ( int  index) const

Definition at line 258 of file ZippedDirectory.cpp.

References mFiles, and NULL.

◆ zippedFile() [3/3]

ZippedFile * ZippedDirectory::zippedFile ( int  index)

Definition at line 269 of file ZippedDirectory.cpp.

References mFiles, and NULL.

◆ zippedFileCount()

int ZippedDirectory::zippedFileCount ( ) const

Definition at line 253 of file ZippedDirectory.cpp.

References mFiles.

Referenced by isCorrupted().

◆ zippedSubDir()

ref< ZippedDirectory > ZippedDirectory::zippedSubDir ( const String subdir_name) const

Member Data Documentation

◆ mFiles

std::map< String, ref<ZippedFile> > vl::ZippedDirectory::mFiles
protected

◆ mSourceZipFile

ref<VirtualFile> vl::ZippedDirectory::mSourceZipFile
protected

Definition at line 106 of file ZippedDirectory.hpp.

Referenced by reset(), setSourceZipFile(), and sourceZipFile().


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