ff7tk  1.2.0.13
Work with Final Fantasy 7 game data
Public Types | Public Member Functions | Friends | List of all members
Lgp Class Reference

#include <Lgp.h>

Inheritance diagram for Lgp:
Inheritance graph
[legend]
Collaboration diagram for Lgp:
Collaboration graph
[legend]

Public Types

enum  LgpError {
  NoError, ReadError, WriteError, OpenError,
  OpenTempError, AbortError, RemoveError, RenameError,
  PositionError, ResizeError, PermissionsError, CopyError,
  InvalidError, FileNotFoundError
}
 
- Public Types inherited from Archive
enum  ArchiveError {
  NoError, ReadError, WriteError, OpenError,
  AbortError, RemoveError, RenameError, PositionError,
  ResizeError, PermissionsError, CopyError, InvalidError,
  FileNotFoundError
}
 

Public Member Functions

 Lgp ()
 
 Lgp (const QString &name)
 
 Lgp (QFile *device)
 
virtual ~Lgp () override
 
void clear () override
 
QStringList fileList () const override
 
int fileCount () const override
 
LgpIterator iterator ()
 
bool fileExists (const QString &filePath) const override
 
QIODevice * file (const QString &filePath) override
 
QIODevice * modifiedFile (const QString &filePath) override
 
bool setFile (const QString &filePath, QIODevice *data) override
 
bool addFile (const QString &filePath, QIODevice *data) override
 
bool removeFile (const QString &filePath) override
 
bool isNameValid (const QString &filePath) const override
 
bool renameFile (const QString &filePath, const QString &newFilePath) override
 
const QString & companyName ()
 
void setCompanyName (const QString &companyName)
 
const QString & productName ()
 
void setProductName (const QString &productName)
 
bool pack (const QString &destination=QString(), ArchiveObserver *observer=nullptr) override
 
LgpError error () const
 
void unsetError ()
 
- Public Member Functions inherited from Archive
 Archive ()
 
 Archive (const QString &filename)
 
 Archive (QFile *device)
 
virtual ~Archive ()
 
QByteArray fileData (const QString &filePath)
 
QByteArray modifiedFileData (const QString &filePath)
 
bool setFileData (const QString &filePath, const QByteArray &data)
 
bool addFileData (const QString &filePath, const QByteArray &data)
 
virtual bool open ()
 
virtual bool isOpen () const
 
virtual void close ()
 
QString fileName () const
 
void setFileName (const QString &fileName)
 
ArchiveError error () const
 
QString errorString () const
 

Friends

class LgpIterator
 

Additional Inherited Members

- Protected Member Functions inherited from Archive
void setErrorString (const QString &errorString)
 
void setError (ArchiveError error, const QString &errorString=QString())
 
QFile * archiveIO () const
 

Member Enumeration Documentation

◆ LgpError

Enumerator
NoError 
ReadError 
WriteError 
OpenError 
OpenTempError 
AbortError 
RemoveError 
RenameError 
PositionError 
ResizeError 
PermissionsError 
CopyError 
InvalidError 
FileNotFoundError 

Constructor & Destructor Documentation

◆ Lgp() [1/3]

Lgp::Lgp ( )

Constructs a new empty lgp archive.

◆ Lgp() [2/3]

Lgp::Lgp ( const QString &  name)
explicit

Constructs a new lgp archive object to represent the lgp archive with the given name.

◆ Lgp() [3/3]

Lgp::Lgp ( QFile *  device)
explicit

Constructs a new lgp archive object to represent the lgp archive with the given device.

◆ ~Lgp()

Lgp::~Lgp ( )
overridevirtual

Destroys the lgp archive object, closing it if necessary.

Member Function Documentation

◆ addFile()

bool Lgp::addFile ( const QString &  filePath,
QIODevice *  data 
)
overridevirtual

Add a new file named filePath with data. Returns false if the file exists; otherwise returns true.

See also
addFileData()

Implements Archive.

◆ clear()

void Lgp::clear ( )
overridevirtual

Clears the contents of the lgp.

Reimplemented from Archive.

◆ companyName()

const QString & Lgp::companyName ( )

Returns the company name (like "SQUARESOFT") or a null string if there is an error.

See also
setCompanyName()

◆ error()

Lgp::LgpError Lgp::error ( ) const

Returns the last error status.

See also
unsetError(), errorString()

◆ file()

QIODevice * Lgp::file ( const QString &  filePath)
overridevirtual

Returns the data for the file named filePath.

See also
fileData(), modifiedFile(), modifiedFileData()

Implements Archive.

◆ fileCount()

int Lgp::fileCount ( ) const
overridevirtual

Returns the number of files in the archive, or -1 if there is an error.

Implements Archive.

◆ fileExists()

bool Lgp::fileExists ( const QString &  filePath) const
overridevirtual

Returns true if the file named filePath exists; otherwise false.

Implements Archive.

◆ fileList()

QStringList Lgp::fileList ( ) const
overridevirtual

Returns a list of file paths sorted by file position.

Implements Archive.

◆ isNameValid()

bool Lgp::isNameValid ( const QString &  filePath) const
overridevirtual

Check if the filePath is a valid name. Returns true if filePath is a valid name, false otherwise.

Implements Archive.

◆ iterator()

LgpIterator Lgp::iterator ( )

Returns an iterator to iterate over the files. You can not know if there is an error or not.

◆ modifiedFile()

QIODevice * Lgp::modifiedFile ( const QString &  filePath)
overridevirtual

Returns the data, modified by setData if modified, for the file named filePath.

See also
file(), fileData(), modifiedFileData()

Implements Archive.

◆ pack()

bool Lgp::pack ( const QString &  destination = QString(),
ArchiveObserver observer = nullptr 
)
overridevirtual

Save the lgp into destination (or overwrite the current archive if destination is empty). The archive is closed after this operation. observer is used to notify the progression of the save. It can be nullptr.

Implements Archive.

◆ productName()

const QString & Lgp::productName ( )

Returns the product name (like "FINAL FANTASY7") or a null string if there is an error.

See also
setProductName()

◆ removeFile()

bool Lgp::removeFile ( const QString &  filePath)
overridevirtual

Remove the file named filePath. Returns true if the file is successfully removed.

Implements Archive.

◆ renameFile()

bool Lgp::renameFile ( const QString &  filePath,
const QString &  newFilePath 
)
overridevirtual

Rename the file named filePath by newFilePath. Returns true if the file is successfully renamed.

Implements Archive.

◆ setCompanyName()

void Lgp::setCompanyName ( const QString &  companyName)

Change the company name.

See also
companyName()

◆ setFile()

bool Lgp::setFile ( const QString &  filePath,
QIODevice *  data 
)
overridevirtual

Change the data for the file named filePath. Returns false if the file doesn't exists; otherwise returns true.

See also
setFileData()

Implements Archive.

◆ setProductName()

void Lgp::setProductName ( const QString &  productName)

Change the product name.

See also
productName()

◆ unsetError()

void Lgp::unsetError ( )

Sets the file's error to Lgp::NoError.

See also
error(), errorString()

Friends And Related Function Documentation

◆ LgpIterator

friend class LgpIterator
friend

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