OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Bsa::BSAFile Class Reference

#include <bsa_file.hpp>

Collaboration diagram for Bsa::BSAFile:

Classes

struct  FileStruct
 Represents one file entry in the archive. More...
 
struct  iltstr
 Case insensitive string comparison. More...
 

Public Types

typedef std::vector< FileStructFileList
 

Public Member Functions

 BSAFile ()
 
void open (const std::string &file)
 Open an archive file. More...
 
bool exists (const char *file) const
 Check if a file exists. More...
 
Files::IStreamPtr getFile (const char *file)
 
Files::IStreamPtr getFile (const FileStruct *file)
 
const FileListgetList () const
 

Private Types

typedef std::map< const char
*, int, iltstr
Lookup
 

Private Member Functions

void fail (const std::string &msg)
 Error handling. More...
 
void readHeader ()
 Read header information from the input source. More...
 
int getIndex (const char *str) const
 Get the index of a given file name, or -1 if not found. More...
 

Private Attributes

FileList files
 Table of files in this archive. More...
 
std::vector< char > stringBuf
 Filename string buffer. More...
 
bool isLoaded
 True when an archive has been loaded. More...
 
std::string filename
 Used for error messages. More...
 
Lookup lookup
 

Detailed Description

This class is used to read "Bethesda Archive Files", or BSAs.

Member Typedef Documentation

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.

Constructor & Destructor Documentation

Bsa::BSAFile::BSAFile ( )
inline

Member Function Documentation

bool Bsa::BSAFile::exists ( const char *  file) const
inline

Check if a file exists.

Here is the call graph for this function:

Here is the caller graph for this function:

void BSAFile::fail ( const std::string &  msg)
private

Error handling.

Files::IStreamPtr BSAFile::getFile ( const char *  file)

Open a file contained in the archive. Throws an exception if the file doesn't exist.

Note
Thread safe.

Here is the call graph for this function:

Here is the caller graph for this function:

Files::IStreamPtr BSAFile::getFile ( const FileStruct file)

Open a file contained in the archive.

Note
Thread safe.

Here is the call graph for this function:

int BSAFile::getIndex ( const char *  str) const
private

Get the index of a given file name, or -1 if not found.

Get the index of a given file name, or -1 if not found

Note
Thread safe.

Here is the caller graph for this function:

const FileList& Bsa::BSAFile::getList ( ) const
inline

Get a list of all files

Note
Thread safe.

Here is the caller graph for this function:

void BSAFile::open ( const std::string &  file)

Open an archive file.

Here is the caller graph for this function:

void BSAFile::readHeader ( )
private

Read header information from the input source.

Here is the call graph for this function:

Member Data Documentation

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.


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