V-Gears 0
Free Final Fantasy VII engine.
VGears::LGPArchive Class Reference

Handles LZS compressed archives. More...

#include <VGearsLGPArchive.h>

Inheritance diagram for VGears::LGPArchive:
Collaboration diagram for VGears::LGPArchive:

Classes

struct  FileEntry
 A file in a LGP archive. More...
 

Public Types

typedef std::vector< FileEntryFileList
 

Public Member Functions

 LGPArchive (const String &name, const String &arch_type)
 Constructor. More...
 
virtual ~LGPArchive ()
 Destructor. More...
 
bool isCaseSensitive () const
 Checks whether this archive is case sensitive. More...
 
void load ()
 Loads the archive. More...
 
void unload ()
 Unloads the archive. More...
 
Ogre::DataStreamPtr open (const String &filename, bool readOnly=true) const
 Opens a stream on a LGP compressed file. More...
 
Ogre::DataStreamPtr create (const String &filename) const
 Creates a new file (or overwrite one already there). More...
 
void remove (const String &filename) const
 Deletes a named file. More...
 
Ogre::StringVectorPtr list (bool recursive=true, bool dirs=false) const
 Lists all file names in the archive. More...
 
Ogre::FileInfoListPtr listFileInfo (bool recursive=true, bool dirs=false) const
 Lists all files in the archive with accompanying information. More...
 
Ogre::StringVectorPtr find (const String &pattern, bool recursive=true, bool dirs=false) const
 Finds all file or directory names matching a given pattern in the archive. More...
 
Ogre::FileInfoListPtr findFileInfo (const String &pattern, bool recursive=true, bool dirs=false) const
 Finds all files or directories matching a given pattern in this archive and get some detailed information about them. More...
 
bool exists (const String &filename) const
 Checks if the named file exists. More...
 
time_t getModifiedTime (const String &filename) const
 Retrieve the modification time of a given file. More...
 
virtual FileListGetFiles ()
 Retrieves the files in the archive. More...
 

Protected Member Functions

void Load (Ogre::DataStream *lgp)
 Loads a LGP archive. More...
 

Private Attributes

FileList files_
 List of file sin the archive. More...
 
Ogre::DataStreamPtr lgp_file_
 The LGP archive file. More...
 
Ogre::FileInfoList file_infos_
 List of information blocks about about the files in the LGP. More...
 

Detailed Description

Handles LZS compressed archives.

Member Typedef Documentation

◆ FileList

Constructor & Destructor Documentation

◆ LGPArchive()

VGears::LGPArchive::LGPArchive ( const String name,
const String arch_type 
)

Constructor.

Parameters
[in]nameName for the archive.
[in]arch_typeArchive type code.

◆ ~LGPArchive()

VGears::LGPArchive::~LGPArchive ( )
virtual

Destructor.

Member Function Documentation

◆ create()

Ogre::DataStreamPtr VGears::LGPArchive::create ( const String filename) const

Creates a new file (or overwrite one already there).

If the archive is read-only then this method will fail.

Parameters
[in]filenamePath to the file.

◆ exists()

bool VGears::LGPArchive::exists ( const String filename) const

Checks if the named file exists.

Parameters
[in]filenameFully qualified filename.
Returns
True if FILENAME exists in the archive, false otherwise.

◆ find()

Ogre::StringVectorPtr VGears::LGPArchive::find ( const String pattern,
bool  recursive = true,
bool  dirs = false 
) const

Finds all file or directory names matching a given pattern in the archive.

Parameters
[in]patternThe pattern to search for, wildcards (*) are allowed.
[in]recursiveWhether all paths of the archive are searched (if the archive has a concept of that).
[in]dirsTrue to list only directories, false to list only files.
Returns
A list of filenames matching the criteria, all fully qualified.

◆ findFileInfo()

Ogre::FileInfoListPtr VGears::LGPArchive::findFileInfo ( const String pattern,
bool  recursive = true,
bool  dirs = false 
) const

Finds all files or directories matching a given pattern in this archive and get some detailed information about them.

Parameters
[in]patternThe pattern to search for, wildcards (*) are allowed.
[in]recursiveWhether all paths of the archive are searched (if the archive has a concept of that).
[in]dirsTrue to list only directories, false to list only files.
Returns
A list of file information structures for all files matching the criteria.

◆ GetFiles()

LGPArchive::FileList & VGears::LGPArchive::GetFiles ( void  )
virtual

Retrieves the files in the archive.

Returns
The list of files.

◆ getModifiedTime()

time_t VGears::LGPArchive::getModifiedTime ( const String filename) const

Retrieve the modification time of a given file.

Parameters
[in]filenameFully qualified filename.
Returns
Last-modified timestamp.

◆ isCaseSensitive()

bool VGears::LGPArchive::isCaseSensitive ( ) const
inline

Checks whether this archive is case sensitive.

Returns
Always true.

◆ list()

Ogre::StringVectorPtr VGears::LGPArchive::list ( bool  recursive = true,
bool  dirs = false 
) const

Lists all file names in the archive.

Parameters
[in]recursiveWhether all paths of the archive are to be searched (if the archive has a concept of that).
[in]dirsTrue to list only directories, false to list only files.
Returns
A list of filenames matching the criteria, all fully qualified.

◆ listFileInfo()

Ogre::FileInfoListPtr VGears::LGPArchive::listFileInfo ( bool  recursive = true,
bool  dirs = false 
) const

Lists all files in the archive with accompanying information.

Parameters
[in]recursiveWhether all paths of the archive are to be searched (if the archive has a concept of that).
[in]dirsTrue to list only directories, false to list only files.
Returns
A list of structures detailing quite a lot of information about all the files in the archive.

◆ load()

void VGears::LGPArchive::load ( )

Loads the archive.

◆ Load()

void VGears::LGPArchive::Load ( Ogre::DataStream *  lgp)
protected

Loads a LGP archive.

Parameters
[in]lgpThe contents of the archive.

◆ open()

Ogre::DataStreamPtr VGears::LGPArchive::open ( const String filename,
bool  readOnly = true 
) const

Opens a stream on a LGP compressed file.

Parameters
[in]filenamePath to open the stream on.
[in]readOnlyTRue to open the stream in read-only mode, false to allow writting.

◆ remove()

void VGears::LGPArchive::remove ( const String filename) const

Deletes a named file.

Not possible on read-only archives

Parameters
[in]filenamePath to the file.

◆ unload()

void VGears::LGPArchive::unload ( )

Unloads the archive.

Member Data Documentation

◆ file_infos_

Ogre::FileInfoList VGears::LGPArchive::file_infos_
private

List of information blocks about about the files in the LGP.

◆ files_

FileList VGears::LGPArchive::files_
private

List of file sin the archive.

◆ lgp_file_

Ogre::DataStreamPtr VGears::LGPArchive::lgp_file_
private

The LGP archive file.


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