75 return QTextCodec::codecForLocale();
130 template<
typename TFileInfo>
164 QString lower = fileName.toLower();
176 qWarning(
"QuaZipPrivate::goToNextUnmappedFile(): ZIP is not open in mdUnzip mode");
219 qWarning(
"QuaZip::open(): ZIP already opened");
223 if (ioDevice == NULL) {
225 qWarning(
"QuaZip::open(): set either ZIP file name or IO device first");
241 if (
p->unzFile_f != NULL) {
249 if(
p->unzFile_f!=NULL) {
250 if (ioDevice->isSequential()) {
254 qWarning(
"QuaZip::open(): "
255 "only mdCreate can be used with "
256 "sequential devices");
289 if (
p->zipFile_f != NULL) {
293 if(
p->zipFile_f!=NULL) {
294 if (ioDevice->isSequential()) {
297 qWarning(
"QuaZip::open(): "
298 "only mdCreate can be used with "
299 "sequential devices");
316 qWarning(
"QuaZip::open(): unknown mode: %d", (
int)mode);
329 qWarning(
"QuaZip::close(): ZIP is not open");
342 qWarning(
"QuaZip::close(): unknown mode: %d", (
int)
p->
mode);
358 qWarning(
"QuaZip::setZipName(): ZIP is already open!");
368 qWarning(
"QuaZip::setIoDevice(): ZIP is already open!");
380 qWarning(
"QuaZip::getEntriesCount(): ZIP is not open in mdUnzip mode");
394 qWarning(
"QuaZip::getComment(): ZIP is not open in mdUnzip mode");
412 qWarning(
"QuaZip::setCurrentFile(): ZIP is not open in mdUnzip mode");
415 if(fileName.isEmpty()) {
420 if(
p->unzFile_f==NULL) {
431 if(!sens) lower=fileName.toLower();
456 if(current.isEmpty())
return false;
458 if(current==fileName)
break;
460 if(current.toLower()==lower)
break;
470 qWarning(
"QuaZip::goToFirstFile(): ZIP is not open in mdUnzip mode");
482 qWarning(
"QuaZip::goToFirstFile(): ZIP is not open in mdUnzip mode");
511 qWarning(
"QuaZip::getCurrentFileInfo(): ZIP is not open in mdUnzip mode");
518 if(info==NULL)
return false;
526 fileName.data(), fileName.size(),
527 extra.data(), extra.size(),
528 comment.data(), comment.size()))!=
UNZ_OK)
556 qWarning(
"QuaZip::getCurrentFileName(): ZIP is not open in mdUnzip mode");
562 NULL, 0, NULL, 0))!=
UNZ_OK)
564 QString result =
p->
fileNameCodec->toUnicode(fileName.constData());
565 if (result.isEmpty())
659 template<
typename TFileInfo>
682 *ok = !name.isEmpty();
686 template<
typename TFileInfo>
692 qWarning(
"QuaZip::getFileNameList/getFileInfoList(): "
693 "ZIP is not open in mdUnzip mode");
703 result->append(QuaZip_getFileInfo<TFileInfo>(
q, &ok));
710 if (currentFile.isEmpty()) {
726 return QStringList();
731 QList<QuaZipFileInfo> list;
735 return QList<QuaZipFileInfo>();
740 QList<QuaZipFileInfo64> list;
744 return QList<QuaZipFileInfo64>();
751 return Qt::CaseInsensitive;
753 return Qt::CaseSensitive;
756 return cs ==
csSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
static Qt::CaseSensitivity convertCaseSensitivity(CaseSensitivity cs)
Returns the actual case sensitivity for the specified QuaZIP one.
quint16 diskNumberStart
Disk number start.
QIODevice * ioDevice
The device to access the archive.
QStringList getFileNameList() const
Returns a list of files inside the archive.
bool isOpen() const
Returns true if ZIP file is open, false otherwise.
QByteArray extra
Extra field.
#define ZIP_WRITE_DATA_DESCRIPTOR
bool goToFirstFile()
Sets the current file to the first file in the archive.
int ZEXPORT unzGoToFirstFile(unzFile file)
quint16 versionCreated
Version created by.
QHash< QString, unz64_file_pos > directoryCaseInsensitive
unzFile unzOpenInternal(voidpf file, zlib_filefunc64_32_def *pzlib_filefunc64_32_def, int is64bitOpenFunction, unsigned flags)
int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos *file_pos)
QString getCurrentFileName() const
Returns the current file name.
QuaZipPrivate(QuaZip *q)
The constructor for the corresponding QuaZip constructor.
quint32 externalAttr
External file attributes.
ZPOS64_T pos_in_zip_directory
quint16 versionNeeded
Version needed to extract.
QTextCodec * getCommentCodec() const
Returns the codec used to encode/decode comments inside archive.
int getEntriesCount() const
Returns number of the entries in the ZIP central directory.
int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos *file_pos)
int ZEXPORT unzGoToNextFile(unzFile file)
void setDataDescriptorWritingEnabled(bool enabled)
Changes the data descriptor writing mode.
#define APPEND_STATUS_CREATEAFTER
ZIP file was opened for adding files in the archive.
Mode getMode() const
Returns the mode in which ZIP file was opened.
ZIP file is not open. This is the initial mode.
static void setDefaultFileNameCodec(QTextCodec *codec)
Sets the default file name codec to use.
int ZEXPORT unzSetFlags(unzFile file, unsigned flags)
int ZEXPORT unzClose(unzFile file)
QString comment
The global comment.
ZIP file was created with open() call.
QTextCodec * commentCodec
The codec for comments.
void addCurrentFileToDirectoryMap(const QString &fileName)
unz64_file_pos lastMappedDirectoryEntry
int getZipError() const
Returns the error code of the last operation.
bool toQuaZipFileInfo(QuaZipFileInfo &info) const
Converts to QuaZipFileInfo.
QIODevice * getIoDevice() const
Returns the device representing this ZIP file.
Information about a file inside archive.
int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64 *pglobal_info)
QTextCodec * getDefaultFileNameCodec()
bool dataDescriptorWritingEnabled
Whether the data descriptor writing mode is enabled.
void setCommentCodec(QTextCodec *commentCodec)
Sets the codec used to encode/decode comments inside archive.
zipFile ZEXPORT zipOpen3(voidpf file, int append, zipcharpc *globalcomment, zlib_filefunc64_32_def *pzlib_filefunc64_32_def, unsigned flags)
QuaZip()
Constructs QuaZip object.
int ZEXPORT zipSetFlags(zipFile file, unsigned flags)
ZPOS64_T uncompressed_size
quint64 compressedSize
Compressed file size.
zipFile getZipFile()
Returns zipFile handle.
int ZEXPORT unzClearFlags(unzFile file, unsigned flags)
void clearDirectoryMap()
Stores map of filenames and file locations for unzipping.
Mode
Open mode of the ZIP file.
QHash< QString, unz64_file_pos > directoryCaseSensitive
QuaZipPrivate(QuaZip *q, QIODevice *ioDevice)
The constructor for the corresponding QuaZip constructor.
QString getZipName() const
Returns the name of the ZIP file.
QString zipName
The archive file name.
int zipError
The last error.
bool isZip64Enabled() const
Returns whether the zip64 mode is enabled.
bool zip64
The zip64 mode.
bool getFileInfoList(QList< TFileInfo > *result) const
Returns either a list of file names or a list of QuaZipFileInfo.
bool goToNextFile()
Sets the current file to the next file in the archive.
Information about a file inside archive (with zip64 support).
static QTextCodec * defaultFileNameCodec
QTextCodec * getFileNameCodec() const
Returns the codec used to encode/decode comments inside archive.
bool autoClose
The auto-close flag.
bool setCurrentFile(const QString &fileName, CaseSensitivity cs=csDefault)
Sets current file by its name.
ZIP file is open for reading files inside it.
quint16 method
Compression method.
void close()
Closes ZIP file.
void setZipName(const QString &zipName)
Sets the name of the ZIP file.
bool isAutoClose() const
Returns the auto-close flag.
QuaZip * q
The pointer to the corresponding QuaZip instance.
int ZEXPORT unzGetGlobalComment(unzFile file, char *szComment, uLong uSizeBuf)
QuaZipPrivate(QuaZip *q, const QString &zipName)
The constructor for the corresponding QuaZip constructor.
quint64 uncompressedSize
Uncompressed file size.
int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
QList< QuaZipFileInfo > getFileInfoList() const
Returns information list about all files inside the archive.
unzFile getUnzFile()
Returns unzFile handle.
CaseSensitivity
Case sensitivity for the file names.
All the internal stuff for the QuaZip class.
bool isDataDescriptorWritingEnabled() const
Returns the data descriptor default writing mode.
void setAutoClose(bool autoClose) const
Sets or unsets the auto-close flag.
QDateTime dateTime
Last modification date and time.
ZIP file was opened in append mode.
quint16 flags
General purpose flags.
bool open(Mode mode, zlib_filefunc_def *ioApi=NULL)
Opens ZIP file.
void setComment(const QString &comment)
Sets the global comment in the ZIP file.
zipFile ZEXPORT zipOpen2(voidpf file, int append, zipcharpc *globalcomment, zlib_filefunc_def *pzlib_filefunc32_def)
bool hasCurrentFile() const
Returns true if the current file has been set.
Maximum file name length.
bool hasCurrentFile_f
Whether a current file is set.
~QuaZip()
Destroys QuaZip object.
QString getComment() const
Returns global comment in the ZIP file.
QuaZip::Mode mode
The open mode.
unzFile ZEXPORT unzOpen2(voidpf file, zlib_filefunc_def *pzlib_filefunc32_def)
Default for platform. Case sensitive for UNIX, not for Windows.
#define APPEND_STATUS_ADDINZIP
QTextCodec * fileNameCodec
The codec for file names.
void setZip64Enabled(bool zip64)
Enables the zip64 mode.
quint16 internalAttr
Internal file attributes.
#define APPEND_STATUS_CREATE
#define UNZ_END_OF_LIST_OF_FILE
bool getCurrentFileInfo(QuaZipFileInfo *info) const
Retrieves information about the current file.
int ZEXPORT zipClose(zipFile file, const char *global_comment)
TFileInfo QuaZip_getFileInfo(QuaZip *zip, bool *ok)
QList< QuaZipFileInfo64 > getFileInfoList64() const
Returns information list about all files inside the archive.
void setIoDevice(QIODevice *ioDevice)
Sets the device representing the ZIP file.
void setFileNameCodec(QTextCodec *fileNameCodec)
Sets the codec used to encode/decode file names inside archive.
bool goToFirstUnmappedFile()