OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
VFS::Manager Class Reference

The main class responsible for loading files from a virtual file system. More...

#include <manager.hpp>

Collaboration diagram for VFS::Manager:

Public Member Functions

 Manager (bool strict)
 
 ~Manager ()
 
void addArchive (Archive *archive)
 
void buildIndex ()
 Build the file index. Should be called when all archives have been registered. More...
 
bool exists (const std::string &name) const
 
const std::map< std::string,
File * > & 
getIndex () const
 
void normalizeFilename (std::string &name) const
 
Files::IStreamPtr get (const std::string &name) const
 
Files::IStreamPtr getNormalized (const std::string &normalizedName) const
 

Private Attributes

bool mStrict
 
std::vector< Archive * > mArchives
 
std::map< std::string, File * > mIndex
 

Detailed Description

The main class responsible for loading files from a virtual file system.

Various archive types (e.g. directories on the filesystem, or compressed archives)
can be registered, and will be merged into a single file tree. If the same filename is contained in multiple archives, the last added archive will have priority.
Most of the methods in this class are considered thread-safe, see each method documentation for details.

Constructor & Destructor Documentation

VFS::Manager::Manager ( bool  strict)
Parameters
strictUse strict path handling? If enabled, no case folding will be done, but slash/backslash conversions are always done.
VFS::Manager::~Manager ( )

Member Function Documentation

void VFS::Manager::addArchive ( Archive archive)

Register the given archive. All files contained in it will be added to the index on the next buildIndex() call.

Note
Takes ownership of the given pointer.

Here is the caller graph for this function:

void VFS::Manager::buildIndex ( )

Build the file index. Should be called when all archives have been registered.

Here is the call graph for this function:

Here is the caller graph for this function:

bool VFS::Manager::exists ( const std::string &  name) const

Does a file with this name exist?

Note
May be called from any thread once the index has been built.

Here is the call graph for this function:

Here is the caller graph for this function:

Files::IStreamPtr VFS::Manager::get ( const std::string &  name) const

Retrieve a file by name.

Note
Throws an exception if the file can not be found.
May be called from any thread once the index has been built.

Here is the call graph for this function:

Here is the caller graph for this function:

const std::map< std::string, File * > & VFS::Manager::getIndex ( ) const

Get a complete list of files from all archives

Note
May be called from any thread once the index has been built.

Here is the caller graph for this function:

Files::IStreamPtr VFS::Manager::getNormalized ( const std::string &  normalizedName) const

Retrieve a file by name (name is already normalized).

Note
Throws an exception if the file can not be found.
May be called from any thread once the index has been built.

Here is the caller graph for this function:

void VFS::Manager::normalizeFilename ( std::string &  name) const

Normalize the given filename, making slashes/backslashes consistent, and lower-casing if mStrict is false.

Note
May be called from any thread once the index has been built.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

std::vector<Archive*> VFS::Manager::mArchives
private
std::map<std::string, File*> VFS::Manager::mIndex
private
bool VFS::Manager::mStrict
private

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