Visualization Library 2.0.0-b3

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

VL     Star     Watch     Fork     Issue

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

A VirtualDirectory to manipulate directories stored in memory. More...

#include <MemoryDirectory.hpp>

+ Inheritance diagram for vl::MemoryDirectory:

Public Member Functions

 MemoryDirectory (const String &path=".")
 
virtual bool setPath (const String &name)
 Changes the path name of a VirtualDirectory. Must not be an empty string. More...
 
bool addFile (MemoryFile *file)
 The string file->path() must contain the full path including the MemoryDirectory's path() More...
 
bool removeFile (MemoryFile *file)
 The string file->path() must contain the full path including the MemoryDirectory's path() More...
 
bool removeFile (const String &name)
 
void eraseAllFiles ()
 
virtual ref< VirtualFilefile (const String &name) const
 Returns the VirtualFile with the given name if any, NULL otherwise. More...
 
ref< MemoryFilememoryFile (const String &name) const
 
void listFilesRecursive (std::vector< String > &file_list) const
 Returns the list of files contained in the VirtualDirectory. More...
 
void listSubDirs (std::vector< String > &dirs, bool append=false) const
 
ref< MemoryDirectorymemorySubDir (const String &subdir_name) const
 
ref< VirtualDirectorysubDir (const String &subdir_name) const
 
void listFiles (std::vector< String > &file_list, bool append=false) const
 
void clone (VirtualDirectory *directory, const String &match="*")
 Clones the content of another directory (empty directories are never cloned). More...
 
- 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 Attributes

std::map< String, ref< MemoryFile > > mFiles
 
- Protected Attributes inherited from vl::VirtualDirectory
String mPath
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::VirtualDirectory
String translatePath (const String &p) const
 
- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

A VirtualDirectory to manipulate directories stored in memory.

See also

Definition at line 56 of file MemoryDirectory.hpp.

Constructor & Destructor Documentation

◆ MemoryDirectory()

vl::MemoryDirectory::MemoryDirectory ( const String path = ".")
inline

Definition at line 61 of file MemoryDirectory.hpp.

Referenced by memorySubDir().

Member Function Documentation

◆ addFile()

bool MemoryDirectory::addFile ( MemoryFile file)

◆ clone()

void MemoryDirectory::clone ( VirtualDirectory directory,
const String match = "*" 
)

◆ eraseAllFiles()

void vl::MemoryDirectory::eraseAllFiles ( )
inline

Definition at line 73 of file MemoryDirectory.hpp.

Referenced by clone().

◆ file()

virtual ref<VirtualFile> vl::MemoryDirectory::file ( const String name) const
inlinevirtual

Returns the VirtualFile with the given name if any, NULL otherwise.

Implements vl::VirtualDirectory.

Definition at line 75 of file MemoryDirectory.hpp.

Referenced by addFile(), and clone().

◆ listFiles()

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

Implements vl::VirtualDirectory.

Definition at line 195 of file MemoryDirectory.cpp.

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

◆ listFilesRecursive()

void MemoryDirectory::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 119 of file MemoryDirectory.cpp.

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

◆ listSubDirs()

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

◆ memoryFile()

ref< MemoryFile > MemoryDirectory::memoryFile ( const String name) const

◆ memorySubDir()

ref< MemoryDirectory > MemoryDirectory::memorySubDir ( const String subdir_name) const

◆ removeFile() [1/2]

bool MemoryDirectory::removeFile ( MemoryFile file)

The string file->path() must contain the full path including the MemoryDirectory's path()

Definition at line 93 of file MemoryDirectory.cpp.

References vl::VirtualFile::path().

◆ removeFile() [2/2]

bool MemoryDirectory::removeFile ( const String name)

Definition at line 98 of file MemoryDirectory.cpp.

References mFiles.

◆ setPath()

bool MemoryDirectory::setPath ( const String path)
virtual

◆ subDir()

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

Implements vl::VirtualDirectory.

Definition at line 85 of file MemoryDirectory.hpp.

Member Data Documentation

◆ mFiles

std::map< String, ref<MemoryFile> > vl::MemoryDirectory::mFiles
protected

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