FIFE
2008.0
|
#include <vfs.h>
Public Member Functions | |
VFS () | |
virtual | ~VFS () |
void | addProvider (VFSSourceProvider *provider) |
VFSSource * | createSource (const std::string &path) const |
void | addNewSource (const std::string &path) |
void | addSource (VFSSource *source) |
void | removeSource (VFSSource *source) |
bool | exists (const std::string &file) const |
bool | isDirectory (const std::string &path) const |
RawData * | open (const std::string &path) |
std::set< std::string > | listFiles (const std::string &path) const |
std::set< std::string > | listFiles (const std::string &path, const std::string &filterregex) const |
std::set< std::string > | listDirectories (const std::string &path) const |
std::set< std::string > | listDirectories (const std::string &path, const std::string &filterregex) const |
the main VFS (virtual file system) class
The VFS is intended to provide transparent and portable access to files.
FIFE::VFS::VFS | ( | ) |
void FIFE::VFS::addNewSource | ( | const std::string & | path | ) |
create a new Source and add it to VFS
Definition at line 99 of file vfs.cpp.
References addSource(), and createSource().
void FIFE::VFS::addProvider | ( | VFSSourceProvider * | provider | ) |
add new VFSSourceProvider
VFS assumes ownership over the given provider - so don't do anything with it after you call this function, especialy don't delete it!
provider | the new provider |
Definition at line 64 of file vfs.cpp.
References FIFE::VFSSourceProvider::getName(), and FIFE::VFSSourceProvider::setVFS().
Referenced by FIFE::Engine::init().
void FIFE::VFS::addSource | ( | VFSSource * | source | ) |
Add a new VFSSource
Definition at line 108 of file vfs.cpp.
Referenced by addNewSource(), and FIFE::Engine::init().
VFSSource * FIFE::VFS::createSource | ( | const std::string & | path | ) | const |
tries to create a new VFSSource for the given file
all currently known VFSSourceProviders are tried until one succeeds - if no provider succeeds 0 is returned
file | the archive-file |
Definition at line 70 of file vfs.cpp.
References FIFE::VFSSourceProvider::createSource(), FIFE::VFSSourceProvider::getName(), FIFE::VFSSourceProvider::isReadable(), and FIFE::Exception::what().
Referenced by addNewSource().
bool FIFE::VFS::exists | ( | const std::string & | file | ) | const |
Check if the given file exists
file | the filename |
Definition at line 129 of file vfs.cpp.
Referenced by FIFE::ZipProvider::isReadable().
bool FIFE::VFS::isDirectory | ( | const std::string & | path | ) | const |
Check if the given path is a directory
path | to check |
Definition at line 133 of file vfs.cpp.
References listDirectories().
std::set< std::string > FIFE::VFS::listDirectories | ( | const std::string & | path | ) | const |
Get a directorylist of the given directory
path | the directory |
Definition at line 181 of file vfs.cpp.
Referenced by isDirectory(), and listDirectories().
std::set< std::string > FIFE::VFS::listDirectories | ( | const std::string & | path, |
const std::string & | filterregex | ||
) | const |
List the subdirectorys of a given directory matching a regex
path | the directory |
filterregex | the regex the files have to match |
Definition at line 192 of file vfs.cpp.
References listDirectories().
std::set< std::string > FIFE::VFS::listFiles | ( | const std::string & | path | ) | const |
Get a filelist of the given directory
path | the directory |
Definition at line 165 of file vfs.cpp.
Referenced by listFiles().
std::set< std::string > FIFE::VFS::listFiles | ( | const std::string & | path, |
const std::string & | filterregex | ||
) | const |
List the files of a given directory matching a regex
The whole string has to match the regex, this means if you want all files that end with .map don't search for ".map" but ".*.map" (and escape the )
path | the directory |
filterregex | the regex the files have to match |
Definition at line 176 of file vfs.cpp.
References listFiles().
RawData * FIFE::VFS::open | ( | const std::string & | path | ) |
Open a file
path | the file to open |
NotFound | if the file cannot be found |
Definition at line 155 of file vfs.cpp.
References FIFE::VFSSource::open().
Referenced by FIFE::RawDataDAT1::RawDataDAT1(), and FIFE::RawDataDAT2::RawDataDAT2().
void FIFE::VFS::removeSource | ( | VFSSource * | source | ) |