FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::VFSSourceProvider Class Referenceabstract

VFSSourceProvider abstract baseclass. More...

#include <vfssourceprovider.h>

+ Inheritance diagram for FIFE::VFSSourceProvider:
+ Collaboration diagram for FIFE::VFSSourceProvider:

Public Member Functions

 VFSSourceProvider (const std::string &name)
 
virtual ~VFSSourceProvider ()
 
const std::string & getName () const
 Returns the name of this VFSSourceProvider. More...
 
void setVFS (VFS *vfs)
 Get the VFS this provider is using. More...
 
VFSgetVFS () const
 
virtual bool isReadable (const std::string &file) const =0
 Check if a given file is readable for this VFSSource. More...
 
virtual VFSSourcecreateSource (const std::string &file)=0
 Create a new instance of a VFSSource initialized with the given file. More...
 
virtual VFSSourcegetSource (const std::string &path) const =0
 Get the source instance of the path. More...
 
virtual bool hasSource (const std::string &path) const =0
 Check whether the provider already has created a source with that path. More...
 

Private Attributes

VFSm_vfs
 
std::string m_name
 

Detailed Description

VFSSourceProvider abstract baseclass.

If you add support for a new archive-type (like the fallout1&dat files) you should also create a new VFSSourceProvider for your VFSSource - once this is done its very easy to load new archives even without knowing their real type.

See also
VFS
VFSSource
VFSSourceFactory

Definition at line 49 of file vfssourceprovider.h.

Constructor & Destructor Documentation

◆ VFSSourceProvider()

FIFE::VFSSourceProvider::VFSSourceProvider ( const std::string &  name)

Definition at line 41 of file vfssourceprovider.cpp.

◆ ~VFSSourceProvider()

FIFE::VFSSourceProvider::~VFSSourceProvider ( )
virtual

Definition at line 44 of file vfssourceprovider.cpp.

Member Function Documentation

◆ createSource()

virtual VFSSource* FIFE::VFSSourceProvider::createSource ( const std::string &  file)
pure virtual

Create a new instance of a VFSSource initialized with the given file.

Parameters
filethe filename to open (the archive-file)
Returns
the new VFSSource

Implemented in FIFE::DirectoryProvider, and FIFE::ZipProvider.

Referenced by FIFE::VFS::createSource(), and getVFS().

+ Here is the caller graph for this function:

◆ getName()

const std::string & FIFE::VFSSourceProvider::getName ( ) const

Returns the name of this VFSSourceProvider.

Returns
name

Definition at line 55 of file vfssourceprovider.cpp.

References m_name.

Referenced by FIFE::VFS::addProvider(), and FIFE::VFS::createSource().

+ Here is the caller graph for this function:

◆ getSource()

virtual VFSSource* FIFE::VFSSourceProvider::getSource ( const std::string &  path) const
pure virtual

Get the source instance of the path.

Parameters
pathThe source path
Returns
A VFSSource or NULL of none is present

Implemented in FIFE::DirectoryProvider, and FIFE::ZipProvider.

Referenced by getVFS(), FIFE::VFS::hasSource(), and FIFE::VFS::removeSource().

+ Here is the caller graph for this function:

◆ getVFS()

VFS* FIFE::VFSSourceProvider::getVFS ( ) const
inline

Definition at line 65 of file vfssourceprovider.h.

References createSource(), getSource(), hasSource(), isReadable(), and m_vfs.

Referenced by FIFE::ZipProvider::createSource(), FIFE::DirectoryProvider::createSource(), and FIFE::ZipProvider::isReadable().

+ Here is the caller graph for this function:

◆ hasSource()

virtual bool FIFE::VFSSourceProvider::hasSource ( const std::string &  path) const
pure virtual

Check whether the provider already has created a source with that path.

Parameters
pathThe path to the source
Returns
true if the provider has already created a source with that path, false if not

Implemented in FIFE::DirectoryProvider, and FIFE::ZipProvider.

Referenced by getVFS(), FIFE::VFS::hasSource(), and FIFE::VFS::removeSource().

+ Here is the caller graph for this function:

◆ isReadable()

virtual bool FIFE::VFSSourceProvider::isReadable ( const std::string &  file) const
pure virtual

Check if a given file is readable for this VFSSource.

Parameters
filethe filename to check
Returns
true if readable, false otherwise

Implemented in FIFE::DirectoryProvider, and FIFE::ZipProvider.

Referenced by FIFE::VFS::createSource(), and getVFS().

+ Here is the caller graph for this function:

◆ setVFS()

void FIFE::VFSSourceProvider::setVFS ( VFS vfs)

Get the VFS this provider is using.

Providers will not be able to locate sources before a VFS is set. VFS::addProvider sets this automatically.

Definition at line 47 of file vfssourceprovider.cpp.

References FIFE::_log, FL_WARN, and m_vfs.

Referenced by FIFE::VFS::addProvider().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_name

std::string FIFE::VFSSourceProvider::m_name
private

Definition at line 102 of file vfssourceprovider.h.

Referenced by getName().

◆ m_vfs

VFS* FIFE::VFSSourceProvider::m_vfs
private

Definition at line 101 of file vfssourceprovider.h.

Referenced by getVFS(), and setVFS().


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