FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::VFSDirectory Class Reference

The most basic VFSSource for "normal" filesystems. More...

#include <vfsdirectory.h>

+ Inheritance diagram for FIFE::VFSDirectory:
+ Collaboration diagram for FIFE::VFSDirectory:

Public Member Functions

 VFSDirectory (VFS *vfs, const std::string &root="./")
 Constructor Creates the given file system's VFS Source, Uses boost_filesystem to achieve Plattform independancy. More...
 
virtual ~VFSDirectory ()
 Destructor. More...
 
virtual bool fileExists (const std::string &filename) const
 Tests whether a file can be opened. More...
 
virtual RawDataopen (const std::string &filename) const
 Opens a file. More...
 
std::set< std::string > listFiles (const std::string &path) const
 List files in a directory. More...
 
std::set< std::string > listDirectories (const std::string &path) const
 List directories in a directory. More...
 
- Public Member Functions inherited from FIFE::VFSSource
 VFSSource (VFS *vfs)
 
virtual ~VFSSource ()
 
VFSgetVFS () const
 get the VFS this source is associated with. More...
 

Private Member Functions

std::set< std::string > list (const std::string &path, bool directorys) const
 

Private Attributes

std::string m_root
 

Additional Inherited Members

- Protected Member Functions inherited from FIFE::VFSSource
std::string fixPath (std::string path) const
 

Detailed Description

The most basic VFSSource for "normal" filesystems.

For example, '/' or './tests/data'.

Uses boost_filesystem to achieve Plattform independancy. This also means you have to use slashes as directory separators.

Definition at line 44 of file vfsdirectory.h.

Constructor & Destructor Documentation

◆ VFSDirectory()

FIFE::VFSDirectory::VFSDirectory ( VFS vfs,
const std::string &  root = "./" 
)

Constructor Creates the given file system's VFS Source, Uses boost_filesystem to achieve Plattform independancy.

Definition at line 44 of file vfsdirectory.cpp.

References FIFE::_log, FL_DBG, and m_root.

◆ ~VFSDirectory()

FIFE::VFSDirectory::~VFSDirectory ( )
virtual

Destructor.

Definition at line 51 of file vfsdirectory.cpp.

Member Function Documentation

◆ fileExists()

bool FIFE::VFSDirectory::fileExists ( const std::string &  filename) const
virtual

Tests whether a file can be opened.

Parameters
filenameThe file to test.
Returns
True, if the file filename can be opened.

Implements FIFE::VFSSource.

Definition at line 55 of file vfsdirectory.cpp.

References m_root.

◆ list()

std::set< std::string > FIFE::VFSDirectory::list ( const std::string &  path,
bool  directorys 
) const
private

Definition at line 79 of file vfsdirectory.cpp.

References FIFE::GetFilenameFromDirectoryIterator(), and m_root.

Referenced by listDirectories(), and listFiles().

+ Here is the caller graph for this function:

◆ listDirectories()

std::set< std::string > FIFE::VFSDirectory::listDirectories ( const std::string &  path) const
virtual

List directories in a directory.

Parameters
pathThe directory to list the directories in
Returns
A string list of directories Will return an empty list on any error

Implements FIFE::VFSSource.

Definition at line 75 of file vfsdirectory.cpp.

References list().

◆ listFiles()

std::set< std::string > FIFE::VFSDirectory::listFiles ( const std::string &  path) const
virtual

List files in a directory.

Parameters
pathThe directory to list the files in
Returns
A string list of filenames Will return an empty list on any error

Implements FIFE::VFSSource.

Definition at line 71 of file vfsdirectory.cpp.

References list().

◆ open()

RawData * FIFE::VFSDirectory::open ( const std::string &  filename) const
virtual

Opens a file.

Parameters
filenameThe file to open.

Implements FIFE::VFSSource.

Definition at line 67 of file vfsdirectory.cpp.

References m_root.

Member Data Documentation

◆ m_root

std::string FIFE::VFSDirectory::m_root
private

Definition at line 80 of file vfsdirectory.h.

Referenced by fileExists(), list(), open(), and VFSDirectory().


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