ff7tk
0.02
Toolkit for making FF7 Tools
|
The Archive class is a device list in a file system or an archive file. More...
#include <Archive.h>
Public Types | |
enum | ArchiveError { NoError, ReadError, WriteError, OpenError, AbortError, RemoveError, RenameError, PositionError, ResizeError, PermissionsError, CopyError, InvalidError, FileNotFoundError } |
Public Member Functions | |
Archive () | |
Constructs a new empty archive. More... | |
Archive (const QString &filename) | |
Constructs a new archive object to represent the archive with the given filename. More... | |
Archive (QFile *device) | |
Constructs a new archive object to represent the archive with the given device. More... | |
virtual | ~Archive () |
Destroys the archive object, closing it if necessary. More... | |
virtual void | clear () |
virtual QStringList | fileList () const =0 |
virtual int | fileCount () const =0 |
virtual bool | fileExists (const QString &filePath) const =0 |
virtual QIODevice * | file (const QString &filePath)=0 |
QByteArray | fileData (const QString &filePath) |
Returns the data for the file named filePath. More... | |
virtual QIODevice * | modifiedFile (const QString &filePath)=0 |
QByteArray | modifiedFileData (const QString &filePath) |
Returns the data, modified by setData if modified, for the file named filePath. More... | |
virtual bool | setFile (const QString &filePath, QIODevice *data)=0 |
bool | setFileData (const QString &filePath, const QByteArray &data) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Change the data for the file named filePath. More... | |
virtual bool | addFile (const QString &filePath, QIODevice *data)=0 |
bool | addFileData (const QString &filePath, const QByteArray &data) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Add a new file named filePath with data. More... | |
virtual bool | removeFile (const QString &filePath)=0 |
virtual bool | isNameValid (const QString &filePath) const =0 |
virtual bool | renameFile (const QString &filePath, const QString &newFilePath)=0 |
virtual bool | open () |
Opens the archive, returning true if successful; otherwise false. More... | |
virtual bool | isOpen () const |
Returns true if the archive is open; returns false otherwise. More... | |
virtual void | close () |
Closes the file. More... | |
QString | fileName () const |
Returns the name set by setFileName() or to the constructors. More... | |
void | setFileName (const QString &fileName) |
Sets the name of the file. More... | |
virtual bool | pack (const QString &destination=QString(), ArchiveObserver *observer=NULL)=0 |
ArchiveError | error () const |
Returns the last error status. More... | |
QString | errorString () const |
Returns the last error message. More... | |
Protected Member Functions | |
virtual bool | openHeader ()=0 |
void | setErrorString (const QString &errorString) |
void | setError (ArchiveError error, const QString &errorString=QString()) |
Sets the file's error type and text. More... | |
QFile * | archiveIO () const |
Private Attributes | |
QString | _errorString |
ArchiveError | _error |
QFile * | _archiveIO |
The Archive class is a device list in a file system or an archive file.
Archive::Archive | ( | ) |
Constructs a new empty archive.
Definition at line 32 of file Archive.cpp.
|
explicit |
Constructs a new archive object to represent the archive with the given filename.
Definition at line 40 of file Archive.cpp.
|
explicit |
Constructs a new archive object to represent the archive with the given device.
Definition at line 48 of file Archive.cpp.
|
virtual |
Destroys the archive object, closing it if necessary.
Definition at line 56 of file Archive.cpp.
References _archiveIO.
|
pure virtual |
Implemented in Lgp.
Referenced by addFileData().
bool Archive::addFileData | ( | const QString & | filePath, |
const QByteArray & | data | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Add a new file named filePath with data.
Returns false if the file exists; otherwise returns true.
Definition at line 116 of file Archive.cpp.
References addFile().
|
inlineprotected |
Definition at line 83 of file Archive.h.
Referenced by Lgp::addFile(), Lgp::file(), Lgp::iterator(), Lgp::modifiedFile(), Lgp::openCompanyName(), Lgp::openHeader(), Lgp::openProductName(), and Lgp::pack().
|
inlinevirtual |
|
virtual |
Archive::ArchiveError Archive::error | ( | ) | const |
Returns the last error status.
Definition at line 189 of file Archive.cpp.
References _error.
Referenced by setError().
QString Archive::errorString | ( | ) | const |
Returns the last error message.
Definition at line 178 of file Archive.cpp.
References _errorString.
|
pure virtual |
Implemented in Lgp.
Referenced by fileData().
|
pure virtual |
Implemented in Lgp.
QByteArray Archive::fileData | ( | const QString & | filePath | ) |
Returns the data for the file named filePath.
Definition at line 65 of file Archive.cpp.
References file().
Referenced by MainWindow::on_btnExtractLgp_clicked().
|
pure virtual |
Implemented in Lgp.
|
pure virtual |
Implemented in Lgp.
QString Archive::fileName | ( | void | ) | const |
Returns the name set by setFileName() or to the constructors.
Definition at line 159 of file Archive.cpp.
References _archiveIO.
|
pure virtual |
Implemented in Lgp.
|
virtual |
Returns true if the archive is open; returns false otherwise.
Definition at line 140 of file Archive.cpp.
References _archiveIO.
Referenced by Lgp::openCompanyName(), Lgp::openHeader(), and Lgp::openProductName().
|
pure virtual |
Implemented in Lgp.
Referenced by modifiedFileData().
QByteArray Archive::modifiedFileData | ( | const QString & | filePath | ) |
Returns the data, modified by setData if modified, for the file named filePath.
Definition at line 81 of file Archive.cpp.
References modifiedFile().
|
virtual |
Opens the archive, returning true if successful; otherwise false.
Definition at line 128 of file Archive.cpp.
References _archiveIO, and openHeader().
Referenced by MainWindow::on_btn_lgpSelect_clicked().
|
protectedpure virtual |
|
pure virtual |
Implemented in Lgp.
|
pure virtual |
Implemented in Lgp.
|
pure virtual |
Implemented in Lgp.
|
protected |
Sets the file's error type and text.
Definition at line 198 of file Archive.cpp.
References _error, error(), and setErrorString().
|
inlineprotected |
Definition at line 79 of file Archive.h.
Referenced by setError(), and Lgp::setError().
|
pure virtual |
Implemented in Lgp.
Referenced by setFileData().
bool Archive::setFileData | ( | const QString & | filePath, |
const QByteArray & | data | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Change the data for the file named filePath.
Returns false if the file doesn't exists; otherwise returns true.
Definition at line 101 of file Archive.cpp.
References setFile().
void Archive::setFileName | ( | const QString & | fileName | ) |
Sets the name of the file.
Do not call this function if the file has already been opened.
Definition at line 169 of file Archive.cpp.
References _archiveIO.
Referenced by Lgp::pack().
|
private |
Definition at line 91 of file Archive.h.
Referenced by close(), fileName(), isOpen(), open(), setFileName(), and ~Archive().
|
private |
Definition at line 90 of file Archive.h.
Referenced by error(), and setError().
|
private |
Definition at line 89 of file Archive.h.
Referenced by errorString().