Eneboo - Documentación para desarrolladores
|
#include <AQZipWriter.h>
Tipos públicos | |
enum | Status { NoError, FileWriteError, FileOpenError, FilePermissionsError, FileError } |
enum | CompressionPolicy { AlwaysCompress, NeverCompress, AutoCompress } |
Métodos públicos | |
AQZipWriter (const QString &fileName, uint mode=(IO_WriteOnly|IO_Truncate)) | |
AQZipWriter (QIODevice *device) | |
~AQZipWriter () | |
QIODevice * | device () const |
bool | isWritable () const |
bool | exists () const |
Status | status () const |
void | setCompressionPolicy (CompressionPolicy policy) |
CompressionPolicy | compressionPolicy () const |
void | setCreationPermissions (QFileInfo::PermissionSpec permissions) |
QFileInfo::PermissionSpec | creationPermissions () const |
void | addFile (const QString &fileName, const QByteArray &data) |
void | addFile (const QString &fileName, QIODevice *device) |
void | addDirectory (const QString &dirName) |
void | addSymLink (const QString &fileName, const QString &destination) |
void | close () |
enum AQZipWriter::Status |
The following status values are possible:
NoError No error occurred. FileWriteError An error occurred when writing to the device. FileOpenError The file could not be opened. FilePermissionsError The file could not be accessed. FileError Another file error occurred.
Create a new zip archive that operates on the archive filename. The file will be opened with the mode.
AQZipWriter::AQZipWriter | ( | QIODevice * | device | ) | [explicit] |
Create a new zip archive that operates on the archive found in device. You have to open the device previous to calling the constructor and only a device that is readable will be scanned for zip filecontent.
AQZipWriter::~AQZipWriter | ( | ) |
void AQZipWriter::addDirectory | ( | const QString & | dirName | ) |
Create a new directory in the archive with the specified dirName and the permissions;
void AQZipWriter::addFile | ( | const QString & | fileName, |
const QByteArray & | data | ||
) |
Add a file to the archive with data as the file contents. The file will be stored in the archive using the fileName which includes the full path in the archive.
The new file will get the file permissions based on the current creationPermissions and it will be compressed using the zip compression based on the current compression policy.
Add a file to the archive with device as the source of the contents. The contents returned from QIODevice::readAll() will be used as the filedata. The file will be stored in the archive using the fileName which includes the full path in the archive.
Create a new symbolic link in the archive with the specified dirName and the permissions; A symbolic link contains the destination (relative) path and name.
void AQZipWriter::close | ( | void | ) |
Closes the zip file.
AQZipWriter::CompressionPolicy AQZipWriter::compressionPolicy | ( | ) | const |
Returns the currently set compression policy.
QFileInfo::PermissionSpec AQZipWriter::creationPermissions | ( | ) | const |
Returns the currently set creation permissions.
QIODevice * AQZipWriter::device | ( | ) | const |
Returns device used for writing zip archive.
bool AQZipWriter::exists | ( | ) | const |
Returns true if the file exists; otherwise returns false.
bool AQZipWriter::isWritable | ( | ) | const |
Returns true if the user can write to the archive; otherwise returns false.
void AQZipWriter::setCompressionPolicy | ( | CompressionPolicy | policy | ) |
Sets the policy for compressing newly added files to the new policy.
void AQZipWriter::setCreationPermissions | ( | QFileInfo::PermissionSpec | permissions | ) |
Sets the permissions that will be used for newly added files.
AQZipWriter::Status AQZipWriter::status | ( | void | ) | const |
Returns a status code indicating the first error that was met by AQZipWriter, or AQZipWriter::NoError if no error occurred.