76 void setZipError(
int zipError)
const;
79 q(q), zip(NULL), internal(true), zipError(
UNZ_OK) {}
82 q(q), internal(true), zipError(
UNZ_OK)
89 q(q), internal(true), zipError(
UNZ_OK)
92 this->fileName=fileName;
93 if (this->fileName.startsWith(
'/'))
94 this->fileName = this->fileName.mid(1);
95 this->caseSensitivity=cs;
99 q(q), zip(zip), internal(false), zipError(
UNZ_OK) {}
158 if (
p->
zip == NULL || (openMode() & WriteOnly))
169 qWarning(
"QuaZipFile::setZipName(): file is already open - can not set ZIP name");
181 qWarning(
"QuaZipFile::setZip(): file is already open - can not set ZIP");
194 qWarning(
"QuaZipFile::setFileName(): call setZipName() first");
198 qWarning(
"QuaZipFile::setFileName(): should not be used when not using internal QuaZip");
202 qWarning(
"QuaZipFile::setFileName(): can not set file name for already opened file");
216 q->setErrorString(QString());
218 q->setErrorString(QuaZipFile::tr(
"ZIP/UNZIP API error %1").arg(zipError));
223 return open(mode, NULL);
226 bool QuaZipFile::open(OpenMode mode,
int *method,
int *level,
bool raw,
const char *password)
230 qWarning(
"QuaZipFile::open(): already opened");
233 if(mode&Unbuffered) {
234 qWarning(
"QuaZipFile::open(): Unbuffered mode is not supported");
237 if((mode&ReadOnly)&&!(mode&WriteOnly)) {
250 qWarning(
"QuaZipFile::open(): zip is NULL");
254 qWarning(
"QuaZipFile::open(): file open mode %d incompatible with ZIP open mode %d",
259 qWarning(
"QuaZipFile::open(): zip does not have current file");
271 qWarning(
"QuaZipFile::open(): open mode %d not supported by this function", (
int)mode);
276 const char *password, quint32 crc,
277 int method,
int level,
bool raw,
278 int windowBits,
int memLevel,
int strategy)
283 qWarning(
"QuaZipFile::open(): already opened");
286 if((mode&WriteOnly)&&!(mode&ReadOnly)) {
288 qWarning(
"QuaZipFile::open(): write mode is incompatible with internal QuaZip approach");
292 qWarning(
"QuaZipFile::open(): zip is NULL");
296 qWarning(
"QuaZipFile::open(): file open mode %d incompatible with ZIP open mode %d",
318 method, level, (int)raw,
319 windowBits, memLevel, strategy,
333 qWarning(
"QuaZipFile::open(): open mode %d not supported by this function", (
int)mode);
345 qWarning(
"QuaZipFile::pos(): call setZipName() or setZip() first");
349 qWarning(
"QuaZipFile::pos(): file is not open");
352 if(openMode()&ReadOnly)
364 qWarning(
"QuaZipFile::atEnd(): call setZipName() or setZip() first");
368 qWarning(
"QuaZipFile::atEnd(): file is not open");
371 if(openMode()&ReadOnly)
373 return QIODevice::bytesAvailable() == 0
382 qWarning(
"QuaZipFile::atEnd(): file is not open");
385 if(openMode()&ReadOnly)
437 qWarning(
"QuaZipFile::close(): file isn't open");
440 if(openMode()&ReadOnly)
442 else if(openMode()&WriteOnly)
446 qWarning(
"Wrong open mode: %d", (
int)openMode());
quint32 crc
CRC to write along with a raw file.
virtual qint64 pos() const
Returns current position in the file.
qint64 readData(char *data, qint64 maxSize)
Implementation of the QIODevice::readData().
bool isOpen() const
Returns true if ZIP file is open, false otherwise.
#define ZIP_WRITE_DATA_DESCRIPTOR
virtual bool isSequential() const
Returns true, but beware!
QuaZipFilePrivate(QuaZipFile *q, const QString &zipName, const QString &fileName, QuaZip::CaseSensitivity cs)
The constructor for the corresponding QuaZipFile constructor.
int zipError
The last error.
qint64 writeData(const char *data, qint64 maxSize)
Implementation of the QIODevice::writeData().
QString getActualFileName() const
Returns the actual file name in the archive.
int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32)
qint64 csize() const
Returns compressed file size.
QuaZipFile * q
The pointer to the associated QuaZipFile instance.
QString getCurrentFileName() const
Returns the current file name.
QTextCodec * getCommentCodec() const
Returns the codec used to encode/decode comments inside archive.
Information about a file to be created.
quint16 internalAttr
File internal attributes.
QByteArray extraLocal
File local extra field.
ulong uncompressedSize
Uncompressed file size.
QString comment
File comment.
virtual qint64 bytesAvailable() const
Returns the number of bytes available for reading.
ZIP file was opened for adding files in the archive.
Mode getMode() const
Returns the mode in which ZIP file was opened.
int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, int raw, const char *password)
void setZipName(const QString &zipName)
Sets the ZIP archive file name.
ZIP file was created with open() call.
virtual void close()
Closes the file.
~QuaZipFilePrivate()
The destructor.
int getZipError() const
Returns the error code of the last operation.
qint64 writePos
Write position to keep track of.
int ZEXPORT unzeof(unzFile file)
bool toQuaZipFileInfo(QuaZipFileInfo &info) const
Converts to QuaZipFileInfo.
Information about a file inside archive.
void setZip(QuaZip *zip)
Binds to the existing QuaZip instance.
QuaZip::CaseSensitivity getCaseSensitivity() const
Returns case sensitivity of the file name.
void setZipError(int zipError) const
Sets the zip error.
int ZEXPORT zipWriteInFileInZip(zipFile file, const void *buf, unsigned int len)
qint64 usize() const
Returns uncompressed file size.
int ZEXPORT zipSetFlags(zipFile file, unsigned flags)
ZPOS64_T uncompressed_size
int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len)
Addition for GDAL : END.
QString fileName
The file name.
zipFile getZipFile()
Returns zipFile handle.
QuaZipFilePrivate(QuaZipFile *q, const QString &zipName)
The constructor for the corresponding QuaZipFile constructor.
bool internal
Whether zip points to an internal QuaZip instance.
QuaZipFilePrivate(QuaZipFile *q, QuaZip *zip)
The constructor for the QuaZipFile constructor accepting a file name.
int getZipError() const
Returns the error code returned by the last ZIP/UNZIP API call.
QString getZipName() const
Returns the name of the ZIP file.
bool isZip64Enabled() const
Returns whether the zip64 mode is enabled.
int ZEXPORT unzCloseCurrentFile(unzFile file)
QDateTime dateTime
File timestamp.
void setFileName(const QString &fileName, QuaZip::CaseSensitivity cs=QuaZip::csDefault)
Sets the file name.
QByteArray extraGlobal
File global extra field.
Information about a file inside archive (with zip64 support).
QTextCodec * getFileNameCodec() const
Returns the codec used to encode/decode comments inside archive.
QuaZipFile()
Constructs a QuaZipFile instance.
bool setCurrentFile(const QString &fileName, CaseSensitivity cs=csDefault)
Sets current file by its name.
ZIP file is open for reading files inside it.
void close()
Closes ZIP file.
quint32 externalAttr
File external attributes.
QuaZip::CaseSensitivity caseSensitivity
Case sensitivity mode.
virtual qint64 size() const
Returns file size.
QString getZipName() const
Returns the ZIP archive file name.
int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting, int zip64)
A file inside ZIP archive.
unzFile getUnzFile()
Returns unzFile handle.
CaseSensitivity
Case sensitivity for the file names.
virtual bool open(OpenMode mode)
Opens a file for reading.
bool isDataDescriptorWritingEnabled() const
Returns the data descriptor default writing mode.
z_off_t ZEXPORT unztell(unzFile file)
ZIP file was opened in append mode.
bool open(Mode mode, zlib_filefunc_def *ioApi=NULL)
Opens ZIP file.
bool hasCurrentFile() const
Returns true if the current file has been set.
The implementation class for QuaZip.
QuaZipFilePrivate(QuaZipFile *q)
The constructor for the corresponding QuaZipFile constructor.
QuaZip * zip
The QuaZip object to work with.
int ZEXPORT zipCloseFileInZip(zipFile file)
virtual ~QuaZipFile()
Destroys a QuaZipFile instance.
bool raw
Whether this file is opened in the raw mode.
bool getFileInfo(QuaZipFileInfo *info)
Gets information about current file.
QuaZip * getZip() const
Returns a pointer to the associated QuaZip object.
quint64 uncompressedSize
Uncompressed size to write along with a raw file.
QString getFileName() const
Returns file name.
int ZEXPORT zipClearFlags(zipFile file, unsigned flags)
bool getCurrentFileInfo(QuaZipFileInfo *info) const
Retrieves information about the current file.
bool isRaw() const
Returns true if the file was opened in raw mode.
virtual bool atEnd() const
Returns true if the end of file was reached.
void resetZipError() const
Resets zipError.