Visualization Library 2.1.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
A VirtualDirectory to manipulate directories stored in memory. More...
#include <MemoryDirectory.hpp>
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< VirtualFile > | file (const String &name) const |
Returns the VirtualFile with the given name if any, NULL otherwise. More... | |
ref< MemoryFile > | memoryFile (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< MemoryDirectory > | memorySubDir (const String &subdir_name) const |
ref< VirtualDirectory > | subDir (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 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 Attributes | |
std::map< String, ref< MemoryFile > > | mFiles |
Protected Attributes inherited from vl::VirtualDirectory | |
String | mPath |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
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 () |
A VirtualDirectory to manipulate directories stored in memory.
Definition at line 56 of file MemoryDirectory.hpp.
|
inline |
Definition at line 61 of file MemoryDirectory.hpp.
Referenced by memorySubDir().
bool MemoryDirectory::addFile | ( | MemoryFile * | file | ) |
The string file->path() must contain the full path including the MemoryDirectory's path()
Definition at line 71 of file MemoryDirectory.cpp.
References vl::Log::error(), file(), mFiles, vl::String::normalizeSlashes(), vl::VirtualDirectory::path(), vl::VirtualFile::path(), vl::VirtualFile::setPath(), and vl::String::startsWith().
Referenced by clone().
void MemoryDirectory::clone | ( | VirtualDirectory * | directory, |
const String & | match = "*" |
||
) |
Clones the content of another directory (empty directories are never cloned).
Definition at line 211 of file MemoryDirectory.cpp.
References addFile(), vl::MemoryFile::copy(), eraseAllFiles(), file(), vl::VirtualDirectory::file(), vl::ref< T >::get(), vl::VirtualDirectory::listFilesRecursive(), vl::VirtualDirectory::path(), vl::VirtualFile::path(), setPath(), and vl::VirtualFile::setPath().
|
inline |
Definition at line 73 of file MemoryDirectory.hpp.
Referenced by clone().
|
inlinevirtual |
Returns the VirtualFile with the given name if any, NULL otherwise.
Implements vl::VirtualDirectory.
Definition at line 75 of file MemoryDirectory.hpp.
|
virtual |
Implements vl::VirtualDirectory.
Definition at line 195 of file MemoryDirectory.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 119 of file MemoryDirectory.cpp.
References vl::Log::error(), mFiles, vl::VirtualDirectory::path(), and vl::Log::warning().
|
virtual |
Implements vl::VirtualDirectory.
Definition at line 135 of file MemoryDirectory.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< MemoryFile > MemoryDirectory::memoryFile | ( | const String & | name | ) | const |
Definition at line 105 of file MemoryDirectory.cpp.
References vl::ref< T >::get(), mFiles, NULL, and vl::VirtualDirectory::translatePath().
ref< MemoryDirectory > MemoryDirectory::memorySubDir | ( | const String & | subdir_name | ) | const |
Definition at line 170 of file MemoryDirectory.cpp.
References vl::Log::error(), MemoryDirectory(), mFiles, NULL, vl::VirtualDirectory::path(), vl::VirtualFile::path(), vl::VirtualDirectory::translatePath(), and VL_CHECK.
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().
bool MemoryDirectory::removeFile | ( | const String & | name | ) |
Definition at line 98 of file MemoryDirectory.cpp.
References mFiles.
|
virtual |
Changes the path
name
of a VirtualDirectory. Must not be an empty string.
Reimplemented from vl::VirtualDirectory.
Definition at line 37 of file MemoryDirectory.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().
Referenced by clone().
|
inlinevirtual |
Implements vl::VirtualDirectory.
Definition at line 85 of file MemoryDirectory.hpp.
|
protected |
Definition at line 93 of file MemoryDirectory.hpp.
Referenced by addFile(), listFiles(), listFilesRecursive(), listSubDirs(), memoryFile(), memorySubDir(), removeFile(), and setPath().
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:52.
© Copyright Michele Bosi. All rights reserved.