# Visualization Library

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

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Attributes

# vl::MemoryDirectory Class Reference

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

`#include <MemoryDirectory.hpp>`

Inheritance diagram for vl::MemoryDirectory:

List of all members.

## Public Member Functions

| MemoryDirectory (const String &path=".")
virtual const char * | className ()
| Returns the name of the class.
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

## Detailed Description

A VirtualDirectory to manipulate directories stored in memory.

See also:
  - VirtualDirectory
  - DiskDirectory
  - MemoryDirectory
  - ZippedDirectory
  - FileSystem
  - VirtualFile
  - DiskFile
  - ZippedFile

Definition at line 56 of file MemoryDirectory.hpp.

## Constructor & Destructor Documentation

vl::MemoryDirectory::MemoryDirectory | ( | const String & | path = `"."` ) | `[inline]`

Definition at line 59 of file MemoryDirectory.hpp.

Referenced by memorySubDir().

## Member Function Documentation

virtual const char* vl::MemoryDirectory::className | ( | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented from vl::VirtualDirectory.

Definition at line 61 of file MemoryDirectory.hpp.

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

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 66 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 88 of file MemoryDirectory.cpp.

References vl::VirtualFile::path().

bool MemoryDirectory::removeFile | ( | const String & | name ) |

Definition at line 93 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.

Referenced by addFile(), and clone().

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

Definition at line 100 of file MemoryDirectory.cpp.

References vl::ref< T >::get(), mFiles, 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 114 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 130 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 165 of file MemoryDirectory.cpp.

References vl::Log::error(), MemoryDirectory(), mFiles, 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 190 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 206 of file MemoryDirectory.cpp.

References addFile(), eraseAllFiles(), vl::VirtualDirectory::file(), file(), vl::ref< T >::get(), vl::VirtualDirectory::listFilesRecursive(), vl::VirtualDirectory::path(), and setPath().

## Member Data Documentation

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

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/MemoryDirectory.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/MemoryDirectory.cpp

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:33.
Permission is granted to use this page to write and publish articles regarding Visualization Library.