OpenMW
|
#include <bsa_file.hpp>
Classes | |
struct | FileStruct |
Represents one file entry in the archive. More... | |
struct | iltstr |
Case insensitive string comparison. More... | |
Public Types | |
typedef std::vector< FileStruct > | FileList |
Public Member Functions | |
BSAFile () | |
void | open (const std::string &file) |
Open an archive file. | |
bool | exists (const char *file) const |
Check if a file exists. | |
Ogre::DataStreamPtr | getFile (const char *file) |
const FileList & | getList () const |
Get a list of all files. | |
Private Types | |
typedef std::map< const char *, int, iltstr > | Lookup |
Private Member Functions | |
void | fail (const std::string &msg) |
Error handling. | |
void | readHeader () |
Read header information from the input source. | |
int | getIndex (const char *str) const |
Get the index of a given file name, or -1 if not found. | |
Private Attributes | |
FileList | files |
Table of files in this archive. | |
std::vector< char > | stringBuf |
Filename string buffer. | |
bool | isLoaded |
True when an archive has been loaded. | |
std::string | filename |
Used for error messages. | |
Lookup | lookup |
This class is used to read "Bethesda Archive Files", or BSAs.
typedef std::vector<FileStruct> Bsa::BSAFile::FileList |
typedef std::map<const char*, int, iltstr> Bsa::BSAFile::Lookup [private] |
A map used for fast file name lookup. The value is the index into the files[] vector above. The iltstr ensures that file name checks are case insensitive.
Bsa::BSAFile::BSAFile | ( | ) | [inline] |
bool Bsa::BSAFile::exists | ( | const char * | file | ) | const [inline] |
Check if a file exists.
void BSAFile::fail | ( | const std::string & | msg | ) | [private] |
Error handling.
Ogre::DataStreamPtr BSAFile::getFile | ( | const char * | file | ) |
Open a file contained in the archive. Throws an exception if the file doesn't exist.
int BSAFile::getIndex | ( | const char * | str | ) | const [private] |
Get the index of a given file name, or -1 if not found.
const FileList& Bsa::BSAFile::getList | ( | ) | const [inline] |
Get a list of all files.
void BSAFile::open | ( | const std::string & | file | ) |
Open an archive file.
void BSAFile::readHeader | ( | ) | [private] |
Read header information from the input source.
std::string Bsa::BSAFile::filename [private] |
Used for error messages.
FileList Bsa::BSAFile::files [private] |
Table of files in this archive.
bool Bsa::BSAFile::isLoaded [private] |
True when an archive has been loaded.
Lookup Bsa::BSAFile::lookup [private] |
std::vector<char> Bsa::BSAFile::stringBuf [private] |
Filename string buffer.