V-Gears 0
Free Final Fantasy VII engine.
BinGZipFile Class Reference

Handles GZip-compressed BIn files. More...

#include <BinGZipFile.h>

Inheritance diagram for BinGZipFile:
Collaboration diagram for BinGZipFile:

Public Member Functions

 BinGZipFile (const Ogre::String &file)
 Constructor. More...
 
 BinGZipFile (File *file)
 Constructor. More...
 
 BinGZipFile (File *file, u32 offset, u32 length)
 Constructor. More...
 
 BinGZipFile (u8 *buffer, u32 offset, u32 length)
 Constructor. More...
 
virtual ~BinGZipFile ()
 Destructor. More...
 
FileExtractGZip (u32 file_index)
 Extracts a file from the compressed BIN file. More...
 
u32 GetNumberOfFiles ()
 Counts the number of files packed in the compressed BIN file. More...
 
- Public Member Functions inherited from File
 File (const Ogre::String &file)
 Opens a file. More...
 
 File (const File *file)
 Opens a file. More...
 
 File (const File *file, u32 offset, u32 length)
 Loads a file fragment. More...
 
 File (const u8 *buffer, u32 offset, u32 length)
 Loads a file fragment from a buffer. More...
 
virtual ~File ()
 Destructor. More...
 
void WriteFile (const Ogre::String &file) const
 Writes the contents of the buffer to a file. More...
 
const Ogre::String & GetFileName () const
 Retrieves the file name. More...
 
u32 GetFileSize () const
 Retrieves the file size. More...
 
void GetFileBuffer (u8 *buffer, const u32 &start, const u32 &length) const
 Loads a buffer with the file data. More...
 
u8 GetU8 (u32 offset) const
 Retrieves a pointer to a byte address in the file. More...
 
u16 GetU16LE (u32 offset) const
 Retrieves a pointer to a two-byte address in the file. More...
 
u32 GetU32LE (u32 offset) const
 Retrieves a pointer to a four-byte address in the file. More...
 
u8 readU8 ()
 Reads a byte from the file. More...
 
u16 readU16LE ()
 Reads two bytes from the file (little endian). More...
 
u32 readU32LE ()
 Reads four bytes from the file (little endian). More...
 
u32 GetCurrentOffset ()
 Checks the current offset of the file. More...
 
void SetOffset (u32 offset)
 Sets the file offset for reading. More...
 

Private Member Functions

void InnerGetNumberOfFiles ()
 Counts the number of packed files and sets {. More...
 
u32 InnerGetFileOffset (u32 file_index)
 Retrieves a file offset. More...
 

Private Attributes

u32 file_count_
 The number of files in the archive. More...
 

Additional Inherited Members

- Protected Attributes inherited from File
Ogre::String file_name_
 The file name. More...
 
u32 offset_ = 0
 Current offset of the file. More...
 
u8buffer_
 The file buffer. More...
 
u32 buffer_size_
 The allocated size of {. More...
 

Detailed Description

Handles GZip-compressed BIn files.

Constructor & Destructor Documentation

◆ BinGZipFile() [1/4]

BinGZipFile::BinGZipFile ( const Ogre::String &  file)

Constructor.

Parameters
[in]filePath to the BIN file.

◆ BinGZipFile() [2/4]

BinGZipFile::BinGZipFile ( File file)

Constructor.

Parameters
[in]fileThe BIN file.

◆ BinGZipFile() [3/4]

BinGZipFile::BinGZipFile ( File file,
u32  offset,
u32  length 
)

Constructor.

Parameters
[in]fileThe BIN file.
[in]offsetThe offset at which to start reading the file.
[in]lengthLength of the data to read.

◆ BinGZipFile() [4/4]

BinGZipFile::BinGZipFile ( u8 buffer,
u32  offset,
u32  length 
)

Constructor.

Parameters
[in]bufferBuffer with the contents of the BIN file.
[in]offsetThe offset at which to start reading the file.
[in]lengthLength of the data to read.

◆ ~BinGZipFile()

BinGZipFile::~BinGZipFile ( )
virtual

Destructor.

Member Function Documentation

◆ ExtractGZip()

File * BinGZipFile::ExtractGZip ( u32  file_index)

Extracts a file from the compressed BIN file.

Parameters
[in]file_indexThe index of the file to extract.
Returns
The extracted file, or NULL if there is no file at the specified index.

◆ GetNumberOfFiles()

u32 BinGZipFile::GetNumberOfFiles ( )

Counts the number of files packed in the compressed BIN file.

Returns
The number of files.

◆ InnerGetFileOffset()

u32 BinGZipFile::InnerGetFileOffset ( u32  file_index)
private

Retrieves a file offset.

Parameters
[in]file_indexThe file which offset to calculate.
Returns
The offset to the specified file, or 0 if there is no such file.

◆ InnerGetNumberOfFiles()

void BinGZipFile::InnerGetNumberOfFiles ( )
private

Counts the number of packed files and sets {.

See also
file_count_}.

Member Data Documentation

◆ file_count_

u32 BinGZipFile::file_count_
private

The number of files in the archive.


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