FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
VFSource for the Fallout2 DAT file format. More...
#include <dat2.h>
Public Member Functions | |
DAT2 (VFS *vfs, const std::string &path) | |
Constructor Create a VFSSource for a Fallout2 DAT file. More... | |
bool | fileExists (const std::string &name) const |
check if the given file exists More... | |
RawData * | open (const std::string &file) const |
open a file inside this source More... | |
const RawDataDAT2::s_info & | getInfo (const std::string &name) const |
Get Information needed to unpack and extract data. More... | |
std::set< std::string > | listFiles (const std::string &pathstr) const |
list all files in a directory of this source More... | |
std::set< std::string > | listDirectories (const std::string &pathstr) const |
list all directories in a directory of this source More... | |
Public Member Functions inherited from FIFE::VFSSource | |
VFSSource (VFS *vfs) | |
virtual | ~VFSSource () |
VFS * | getVFS () const |
get the VFS this source is associated with. More... | |
Private Types | |
typedef std::map< std::string, RawDataDAT2::s_info > | type_filelist |
Private Member Functions | |
void | readFileEntry () const |
read a bunch of file entries More... | |
type_filelist::const_iterator | findFileEntry (const std::string &name) const |
find a file entry More... | |
std::set< std::string > | list (const std::string &pathstr, bool dirs) const |
DAT2 (const DAT2 &) | |
DAT2 & | operator= (const DAT2 &) |
Private Attributes | |
std::string | m_datpath |
std::unique_ptr< RawData > | m_data |
type_filelist | m_filelist |
uint32_t | m_filecount |
number of file entries to read More... | |
uint32_t | m_currentIndex |
current index in file More... | |
Timer | m_timer |
lazy loading timer More... | |
Additional Inherited Members | |
Protected Member Functions inherited from FIFE::VFSSource | |
std::string | fixPath (std::string path) const |
VFSource for the Fallout2 DAT file format.
Implements a kind of lazy initializing, by reading the file list in chunks. Behaviour is the same as if it wouldn't do this, but startup is very fast. But a open/fileExists call with a filename that doesn't exist, does trigger completely loading the file entries.
|
private |
FIFE::DAT2::DAT2 | ( | VFS * | vfs, |
const std::string & | path | ||
) |
Constructor Create a VFSSource for a Fallout2 DAT file.
vfs | A pointer to the VFS. |
path | A Fallout2 DAT file - e.g. master.DAT |
Definition at line 42 of file dat2.cpp.
References FIFE::_log, FL_LOG, m_currentIndex, m_data, m_filecount, m_timer, readFileEntry(), FIFE::Timer::setCallback(), FIFE::Timer::setInterval(), and FIFE::Timer::start().
|
private |
|
virtual |
check if the given file exists
file | filename to check |
Implements FIFE::VFSSource.
Definition at line 114 of file dat2.cpp.
References findFileEntry(), and m_filelist.
|
private |
find a file entry
Definition at line 126 of file dat2.cpp.
References FIFE::_log, FL_LOG, m_datpath, m_filecount, m_filelist, and readFileEntry().
Referenced by fileExists(), and getInfo().
const RawDataDAT2::s_info & FIFE::DAT2::getInfo | ( | const std::string & | name | ) | const |
Get Information needed to unpack and extract data.
Definition at line 118 of file dat2.cpp.
References findFileEntry(), and m_filelist.
Referenced by open().
|
private |
Definition at line 164 of file dat2.cpp.
References m_filecount, m_filelist, and readFileEntry().
Referenced by listDirectories(), and listFiles().
|
virtual |
list all directories in a directory of this source
path | path to list directories in Will return an empty list on any error |
Implements FIFE::VFSSource.
Definition at line 160 of file dat2.cpp.
References list().
|
virtual |
list all files in a directory of this source
path | path to list files in Will return an empty list on any error |
Implements FIFE::VFSSource.
Definition at line 156 of file dat2.cpp.
References list().
|
virtual |
open a file inside this source
file | the file to open |
CannotOpenFile | if the file can't be found |
Implements FIFE::VFSSource.
Definition at line 109 of file dat2.cpp.
References getInfo(), FIFE::VFSSource::getVFS(), and m_datpath.
|
private |
read a bunch of file entries
Definition at line 73 of file dat2.cpp.
References FIFE::_log, FIFE::VFSSource::fixPath(), FL_LOG, m_currentIndex, m_data, m_datpath, m_filecount, m_filelist, m_timer, FIFE::RawDataDAT2::s_info::name, FIFE::RawDataDAT2::s_info::offset, FIFE::RawDataDAT2::s_info::packedLength, FIFE::Timer::stop(), FIFE::RawDataDAT2::s_info::type, and FIFE::RawDataDAT2::s_info::unpackedLength.
Referenced by DAT2(), findFileEntry(), and list().
|
mutableprivate |
current index in file
Definition at line 90 of file dat2.h.
Referenced by DAT2(), and readFileEntry().
|
mutableprivate |
Definition at line 83 of file dat2.h.
Referenced by DAT2(), and readFileEntry().
|
private |
Definition at line 82 of file dat2.h.
Referenced by findFileEntry(), open(), and readFileEntry().
|
mutableprivate |
number of file entries to read
Definition at line 88 of file dat2.h.
Referenced by DAT2(), findFileEntry(), list(), and readFileEntry().
|
mutableprivate |
Definition at line 85 of file dat2.h.
Referenced by fileExists(), findFileEntry(), getInfo(), list(), and readFileEntry().
|
mutableprivate |