33 _error(NoError), _archiveIO(new QFile())
67 QIODevice *io =
file(filePath);
68 if(io == NULL || !io->open(QIODevice::ReadOnly)) {
69 qWarning() <<
"Archive::fileData error";
72 QByteArray data = io->readAll();
84 if(io == NULL || !io->open(QIODevice::ReadOnly)) {
85 qWarning() <<
"Archive::modifiedFileData error";
88 QByteArray data = io->readAll();
103 QBuffer *buf =
new QBuffer();
118 QBuffer *buf =
new QBuffer();
181 ? QLatin1String(QT_TRANSLATE_NOOP(
Archive, (
"Unknown error")))
virtual bool addFile(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 o...
virtual QIODevice * modifiedFile(const QString &filePath)=0
virtual QIODevice * file(const QString &filePath)=0
void setFileName(const QString &fileName)
Sets the name of the file.
virtual ~Archive()
Destroys the archive object, closing it if necessary.
QString errorString() const
Returns the last error message.
QByteArray modifiedFileData(const QString &filePath)
Returns the data, modified by setData if modified, for the file named filePath.
virtual bool openHeader()=0
ArchiveError error() const
Returns the last error status.
virtual bool setFile(const QString &filePath, QIODevice *data)=0
void setError(ArchiveError error, const QString &errorString=QString())
Sets the file's error type and text.
bool addFileData(const QString &filePath, const QByteArray &data)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The Archive class is a device list in a file system or an archive file.
QByteArray fileData(const QString &filePath)
Returns the data for the file named filePath.
virtual void close()
Closes the file.
QString fileName() const
Returns the name set by setFileName() or to the constructors.
Archive()
Constructs a new empty archive.
void setErrorString(const QString &errorString)
virtual bool open()
Opens the archive, returning true if successful; otherwise false.
virtual bool isOpen() const
Returns true if the archive is open; returns false otherwise.