OpenMW
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
Bsa::BSAFile Class Reference

#include <bsa_file.hpp>

List of all members.

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.
bool exists (const char *file) const
 Check if a file exists.
Ogre::DataStreamPtr getFile (const char *file)
const FileListgetList () 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

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.

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.


Member Data Documentation

std::string Bsa::BSAFile::filename [private]

Used for error messages.

Table of files in this archive.

bool Bsa::BSAFile::isLoaded [private]

True when an archive has been loaded.

std::vector<char> Bsa::BSAFile::stringBuf [private]

Filename string buffer.


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