Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

vl::FileSystem Class Reference

Manages multiple VirtualDirectory objects. More...

#include <FileSystem.hpp>

Inheritance diagram for vl::FileSystem:

vl::Object

List of all members.

Public Member Functions

virtual const char * className ()
 Returns the name of the class.
 FileSystem ()
virtual ref< VirtualFilelocateFile (const String &full_path, const String &alternate_path=String()) const
 Looks for a VirtualFile on the disk and in the currently active FileSystem.
virtual ref< VirtualDirectorylocateDirectory (const String &name) const
virtual void listFilesRecursive (std::vector< String > &file_list) const
 Returns the names of all the files contained in the previously added Directories.
virtual void listFilesRecursive (std::vector< String > &file_list, const String &match) const
 Returns the names of all the files matching the given filter.
Collection< VirtualDirectory > * directories ()
 Returns the list of VirtualDirectory objects added to a FileSystem.
const Collection
< VirtualDirectory > * 
directories () const
 Returns the list of VirtualDirectory objects added to a FileSystem.

Protected Attributes

Collection< VirtualDirectorymDirectories


Detailed Description

Manages multiple VirtualDirectory objects.

Useful when you want to query more than one VirtualDirectory from a single point.

See also:

Constructor & Destructor Documentation

vl::FileSystem::FileSystem (  )  [inline]


Member Function Documentation

virtual const char* vl::FileSystem::className (  )  [inline, virtual]

Returns the name of the class.

Reimplemented from vl::Object.

ref< VirtualFile > FileSystem::locateFile ( const String full_path,
const String alternate_path = String() 
) const [virtual]

Looks for a VirtualFile on the disk and in the currently active FileSystem.

If more than a file exists with the same name the VirtualFile returned is the one found in the VirtualDirectory added the latest.

This means that a VirtualDirectory overrides the ones added before if duplicate file name exists. If a file with the given name exists in the "." directory it will be located and returned immediately.

Visualization Library locates a file scanning the following paths (in the specified order):

  • first split full_path into file_path and file_name

  • look for the following file paths:
    1. ./file_path/file_name
    2. /fs/file_path/file_name
    3. ./alternate_path/file_path/file_name
    4. /fs/alternate_path/file_path/file_name
    5. ./file_name
    6. /fs/file_name
    7. ./alternate_path/file_name
    8. /fs/alternate_path/file_name

"/fs" stays for Visualization Library currently mounted FileSystems.

ref< VirtualDirectory > FileSystem::locateDirectory ( const String name  )  const [virtual]

void FileSystem::listFilesRecursive ( std::vector< String > &  file_list  )  const [virtual]

Returns the names of all the files contained in the previously added Directories.

Files from different Directories but with the same name appear more than once in 'file_list'. Use carefully this function as it enumerates recursively all the files in the directory trees.

void FileSystem::listFilesRecursive ( std::vector< String > &  file_list,
const String match 
) const [virtual]

Returns the names of all the files matching the given filter.

Use carefully this function since it enumerates recursively all the files in the directory trees. The match parameter must be of the type "*abc" or "*abc*" or "abc*".

Collection<VirtualDirectory>* vl::FileSystem::directories (  )  [inline]

Returns the list of VirtualDirectory objects added to a FileSystem.

const Collection<VirtualDirectory>* vl::FileSystem::directories (  )  const [inline]

Returns the list of VirtualDirectory objects added to a FileSystem.


Member Data Documentation


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

Visualization Library v2009.08 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Tue Dec 29 13:56:55 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.