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 #include <QString>
00028 #include <QStringList>
00029 #include <QTextCodec>
00030
00031 #include "zip.h"
00032 #include "unzip.h"
00033
00034 #include "quazip_global.h"
00035 #include "quazipfileinfo.h"
00036
00037
00038 #ifndef UNZ_OPENERROR
00039
00040 #define UNZ_OPENERROR -1000
00041 #endif
00042
00043 class QuaZipPrivate;
00044
00046
00083 class QUAZIP_EXPORT QuaZip {
00084 friend class QuaZipPrivate;
00085 public:
00087 enum Constants {
00088 MAX_FILE_NAME_LENGTH=256
00091 };
00093 enum Mode {
00094 mdNotOpen,
00095 mdUnzip,
00096 mdCreate,
00097 mdAppend,
00105 mdAdd
00106 };
00108
00113 enum CaseSensitivity {
00114 csDefault=0,
00115 csSensitive=1,
00116 csInsensitive=2
00117 };
00118 private:
00119 QuaZipPrivate *p;
00120
00121 QuaZip(const QuaZip& that);
00122
00123 QuaZip& operator=(const QuaZip& that);
00124 public:
00126
00127 QuaZip();
00129 QuaZip(const QString& zipName);
00131
00132 QuaZip(QIODevice *ioDevice);
00134
00135 ~QuaZip();
00137
00173 bool open(Mode mode, zlib_filefunc_def *ioApi =NULL);
00175
00178 void close();
00180
00185 void setFileNameCodec(QTextCodec *fileNameCodec);
00187
00190 void setFileNameCodec(const char *fileNameCodecName);
00192 QTextCodec* getFileNameCodec() const;
00194
00196 void setCommentCodec(QTextCodec *commentCodec);
00198
00201 void setCommentCodec(const char *commentCodecName);
00203 QTextCodec* getCommentCodec() const;
00205
00210 QString getZipName() const;
00212
00217 void setZipName(const QString& zipName);
00219
00223 QIODevice *getIoDevice() const;
00225
00230 void setIoDevice(QIODevice *ioDevice);
00232 Mode getMode() const;
00234 bool isOpen() const;
00236
00244 int getZipError() const;
00246
00249 int getEntriesCount() const;
00251 QString getComment() const;
00253
00257 void setComment(const QString& comment);
00259
00262 bool goToFirstFile();
00264
00281 bool goToNextFile();
00283
00307 bool setCurrentFile(const QString& fileName, CaseSensitivity cs =csDefault);
00309 bool hasCurrentFile() const;
00311
00326 bool getCurrentFileInfo(QuaZipFileInfo* info)const;
00328
00334 QString getCurrentFileName()const;
00336
00351 unzFile getUnzFile();
00353
00357 zipFile getZipFile();
00359
00382 void setDataDescriptorWritingEnabled(bool enabled);
00384
00387 bool isDataDescriptorWritingEnabled() const;
00389
00395 QStringList getFileNameList() const;
00397
00403 QList<QuaZipFileInfo> getFileInfoList() const;
00404 };
00405
00406 #endif