ff7tk  1.2.0.13
Work with Final Fantasy 7 game data
Public Types | Public Member Functions | Protected Member Functions | List of all members
Archive Class Referenceabstract

The Archive class is a device list in a file system or an archive file. More...

#include <Archive.h>

Inheritance diagram for Archive:
Inheritance graph
[legend]

Public Types

enum  ArchiveError {
  NoError, ReadError, WriteError, OpenError,
  AbortError, RemoveError, RenameError, PositionError,
  ResizeError, PermissionsError, CopyError, InvalidError,
  FileNotFoundError
}
 

Public Member Functions

 Archive ()
 
 Archive (const QString &filename)
 
 Archive (QFile *device)
 
virtual ~Archive ()
 
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)
 
virtual QIODevice * modifiedFile (const QString &filePath)=0
 
QByteArray modifiedFileData (const QString &filePath)
 
virtual bool setFile (const QString &filePath, QIODevice *data)=0
 
bool setFileData (const QString &filePath, const QByteArray &data)
 
virtual bool addFile (const QString &filePath, QIODevice *data)=0
 
bool addFileData (const QString &filePath, const QByteArray &data)
 
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 ()
 
virtual bool isOpen () const
 
virtual void close ()
 
QString fileName () const
 
void setFileName (const QString &fileName)
 
virtual bool pack (const QString &destination=QString(), ArchiveObserver *observer=nullptr)=0
 
ArchiveError error () const
 
QString errorString () const
 

Protected Member Functions

virtual bool openHeader ()=0
 
void setErrorString (const QString &errorString)
 
void setError (ArchiveError error, const QString &errorString=QString())
 
QFile * archiveIO () const
 

Detailed Description

The Archive class is a device list in a file system or an archive file.

See also
QIODevice

Member Enumeration Documentation

◆ ArchiveError

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

Constructor & Destructor Documentation

◆ Archive() [1/3]

Archive::Archive ( )

Constructs a new empty archive.

◆ Archive() [2/3]

Archive::Archive ( const QString &  filename)
explicit

Constructs a new archive object to represent the archive with the given filename.

◆ Archive() [3/3]

Archive::Archive ( QFile *  device)
explicit

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

◆ ~Archive()

Archive::~Archive ( )
virtual

Destroys the archive object, closing it if necessary.

Member Function Documentation

◆ addFile()

virtual bool Archive::addFile ( const QString &  filePath,
QIODevice *  data 
)
pure virtual

Implemented in Lgp.

◆ 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.

See also
addFile()

◆ archiveIO()

QFile* Archive::archiveIO ( ) const
inlineprotected

◆ clear()

virtual void Archive::clear ( )
inlinevirtual

Reimplemented in Lgp.

◆ close()

void Archive::close ( )
virtual

Closes the file.

See also
open(), isOpen()

◆ error()

Archive::ArchiveError Archive::error ( ) const

Returns the last error status.

See also
unsetError(), errorString()

◆ errorString()

QString Archive::errorString ( ) const

Returns the last error message.

See also
unsetError(), error()

◆ file()

virtual QIODevice* Archive::file ( const QString &  filePath)
pure virtual

Implemented in Lgp.

◆ fileCount()

virtual int Archive::fileCount ( ) const
pure virtual

Implemented in Lgp.

◆ fileData()

QByteArray Archive::fileData ( const QString &  filePath)

Returns the data for the file named filePath.

See also
file(), modifiedFile(), modifiedFileData()

◆ fileExists()

virtual bool Archive::fileExists ( const QString &  filePath) const
pure virtual

Implemented in Lgp.

◆ fileList()

virtual QStringList Archive::fileList ( ) const
pure virtual

Implemented in Lgp.

◆ fileName()

QString Archive::fileName ( ) const

Returns the name set by setFileName() or to the constructors.

See also
setFileName(), QFile::fileName()

◆ isNameValid()

virtual bool Archive::isNameValid ( const QString &  filePath) const
pure virtual

Implemented in Lgp.

◆ isOpen()

bool Archive::isOpen ( ) const
virtual

Returns true if the archive is open; returns false otherwise.

See also
open(), close()

◆ modifiedFile()

virtual QIODevice* Archive::modifiedFile ( const QString &  filePath)
pure virtual

Implemented in Lgp.

◆ modifiedFileData()

QByteArray Archive::modifiedFileData ( const QString &  filePath)

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

See also
file(), fileData(), modifiedFile()

◆ open()

bool Archive::open ( )
virtual

Opens the archive, returning true if successful; otherwise false.

See also
isOpen(), close()

◆ openHeader()

virtual bool Archive::openHeader ( )
protectedpure virtual

◆ pack()

virtual bool Archive::pack ( const QString &  destination = QString(),
ArchiveObserver observer = nullptr 
)
pure virtual

Implemented in Lgp.

◆ removeFile()

virtual bool Archive::removeFile ( const QString &  filePath)
pure virtual

Implemented in Lgp.

◆ renameFile()

virtual bool Archive::renameFile ( const QString &  filePath,
const QString &  newFilePath 
)
pure virtual

Implemented in Lgp.

◆ setError()

void Archive::setError ( ArchiveError  error,
const QString &  errorString = QString() 
)
protected

Sets the file's error type and text.

See also
error(), errorString()

◆ setErrorString()

void Archive::setErrorString ( const QString &  errorString)
inlineprotected

◆ setFile()

virtual bool Archive::setFile ( const QString &  filePath,
QIODevice *  data 
)
pure virtual

Implemented in Lgp.

◆ 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.

See also
setFile()

◆ setFileName()

void Archive::setFileName ( const QString &  fileName)

Sets the name of the file. Do not call this function if the file has already been opened.

See also
fileName(), QFile::setFileName()

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