Visualization Library v1.0.3A 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. | |
bool | addFile (MemoryFile *file) |
The string file->path() must contain the full path including the MemoryDirectory's path() | |
bool | removeFile (MemoryFile *file) |
The string file->path() must contain the full path including the MemoryDirectory's path() | |
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. | |
ref< MemoryFile > | memoryFile (const String &name) const |
void | listFilesRecursive (std::vector< String > &file_list) const |
Returns the list of files contained in the VirtualDirectory. | |
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). | |
Protected Attributes | |
std::map< String, ref < MemoryFile > > | mFiles |
A VirtualDirectory to manipulate directories stored in memory.
Definition at line 56 of file MemoryDirectory.hpp.
vl::MemoryDirectory::MemoryDirectory | ( | const String & | path = "." ) |
[inline] |
Definition at line 61 of file MemoryDirectory.hpp.
Referenced by memorySubDir().
bool MemoryDirectory::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 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().
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::VirtualFile::path(), vl::VirtualDirectory::path(), vl::VirtualFile::setPath(), and vl::String::startsWith().
Referenced by clone().
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.
void vl::MemoryDirectory::eraseAllFiles | ( | ) | [inline] |
Definition at line 73 of file MemoryDirectory.hpp.
Referenced by clone().
virtual ref<VirtualFile> vl::MemoryDirectory::file | ( | const String & | name ) | const [inline, virtual] |
Returns the VirtualFile with the given name if any, NULL otherwise.
Implements vl::VirtualDirectory.
Definition at line 75 of file MemoryDirectory.hpp.
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().
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().
void MemoryDirectory::listSubDirs | ( | std::vector< String > & | dirs, |
bool | append = false |
||
) | const [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< 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::VirtualDirectory::translatePath(), and VL_CHECK.
ref<VirtualDirectory> vl::MemoryDirectory::subDir | ( | const String & | subdir_name ) | const [inline, virtual] |
Implements vl::VirtualDirectory.
Definition at line 85 of file MemoryDirectory.hpp.
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().
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(), eraseAllFiles(), vl::VirtualDirectory::file(), file(), vl::ref< T >::get(), vl::VirtualDirectory::listFilesRecursive(), vl::VirtualDirectory::path(), and setPath().
std::map< String, ref<MemoryFile> > vl::MemoryDirectory::mFiles [protected] |
Definition at line 93 of file MemoryDirectory.hpp.
Referenced by addFile(), listFiles(), listFilesRecursive(), listSubDirs(), memoryFile(), memorySubDir(), removeFile(), and setPath().