quazip.h
00001 #ifndef QUA_ZIP_H
00002 #define QUA_ZIP_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <QString>
00029 #include <QStringList>
00030 #include <QTextCodec>
00031
00032 #include "zip.h"
00033 #include "unzip.h"
00034
00035 #include "quazip_global.h"
00036 #include "quazipfileinfo.h"
00037
00038
00039 #ifndef UNZ_OPENERROR
00040
00041 #define UNZ_OPENERROR -1000
00042 #endif
00043
00044 class QuaZipPrivate;
00045
00047
00084 class QUAZIP_EXPORT QuaZip {
00085 friend class QuaZipPrivate;
00086 public:
00088 enum Constants {
00089 MAX_FILE_NAME_LENGTH=256
00092 };
00094 enum Mode {
00095 mdNotOpen,
00096 mdUnzip,
00097 mdCreate,
00098 mdAppend,
00106 mdAdd
00107 };
00109
00114 enum CaseSensitivity {
00115 csDefault=0,
00116 csSensitive=1,
00117 csInsensitive=2
00118 };
00120
00126 static Qt::CaseSensitivity convertCaseSensitivity(
00127 CaseSensitivity cs);
00128 private:
00129 QuaZipPrivate *p;
00130
00131 QuaZip(const QuaZip& that);
00132
00133 QuaZip& operator=(const QuaZip& that);
00134 public:
00136
00137 QuaZip();
00139 QuaZip(const QString& zipName);
00141
00142 QuaZip(QIODevice *ioDevice);
00144
00145 ~QuaZip();
00147
00193 bool open(Mode mode, zlib_filefunc_def *ioApi =NULL);
00195
00217 void close();
00219
00224 void setFileNameCodec(QTextCodec *fileNameCodec);
00226
00229 void setFileNameCodec(const char *fileNameCodecName);
00231 QTextCodec* getFileNameCodec() const;
00233
00235 void setCommentCodec(QTextCodec *commentCodec);
00237
00240 void setCommentCodec(const char *commentCodecName);
00242 QTextCodec* getCommentCodec() const;
00244
00249 QString getZipName() const;
00251
00256 void setZipName(const QString& zipName);
00258
00262 QIODevice *getIoDevice() const;
00264
00269 void setIoDevice(QIODevice *ioDevice);
00271 Mode getMode() const;
00273 bool isOpen() const;
00275
00283 int getZipError() const;
00285
00288 int getEntriesCount() const;
00290 QString getComment() const;
00292
00300 void setComment(const QString& comment);
00302
00305 bool goToFirstFile();
00307
00324 bool goToNextFile();
00326
00350 bool setCurrentFile(const QString& fileName, CaseSensitivity cs =csDefault);
00352 bool hasCurrentFile() const;
00354
00375 bool getCurrentFileInfo(QuaZipFileInfo* info)const;
00377
00385 bool getCurrentFileInfo(QuaZipFileInfo64* info)const;
00387
00393 QString getCurrentFileName()const;
00395
00410 unzFile getUnzFile();
00412
00416 zipFile getZipFile();
00418
00445 void setDataDescriptorWritingEnabled(bool enabled);
00447
00450 bool isDataDescriptorWritingEnabled() const;
00452
00458 QStringList getFileNameList() const;
00460
00472 QList<QuaZipFileInfo> getFileInfoList() const;
00474
00482 QList<QuaZipFileInfo64> getFileInfoList64() const;
00484
00497 void setZip64Enabled(bool zip64);
00499
00504 bool isZip64Enabled() const;
00506
00509 bool isAutoClose() const;
00511
00531 void setAutoClose(bool autoClose) const;
00533
00562 static void setDefaultFileNameCodec(QTextCodec *codec);
00568 static void setDefaultFileNameCodec(const char *codecName);
00569 };
00570
00571 #endif