QuaZIP quazip-0-5-1

- Main Page
- Related Pages
- Classes
- Files
- Directories

- File List

quazip.h

    00001 #ifndef QUA_ZIP_H
    00002 #define QUA_ZIP_H
    00003
    00004 /*
    00005 Copyright (C) 2005-2011 Sergey A. Tachenov
    00006
    00007 This program is free software; you can redistribute it and/or modify it
    00008 under the terms of the GNU Lesser General Public License as published by
    00009 the Free Software Foundation; either version 2 of the License, or (at
    00010 your option) any later version.
    00011
    00012 This program is distributed in the hope that it will be useful, but
    00013 WITHOUT ANY WARRANTY; without even the implied warranty of
    00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
    00015 General Public License for more details.
    00016
    00017 You should have received a copy of the GNU Lesser General Public License
    00018 along with this program; if not, write to the Free Software Foundation,
    00019 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    00020
    00021 See COPYING file for the full LGPL text.
    00022
    00023 Original ZIP package is copyrighted by Gilles Vollant, see
    00024 quazip/(un)zip.h files for details, basically it's zlib license.
    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 // just in case it will be defined in the later versions of the ZIP/UNZIP
    00038 #ifndef UNZ_OPENERROR
    00039 // define additional error code
    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     };
    00119
    00125     static Qt::CaseSensitivity convertCaseSensitivity(
    00126             CaseSensitivity cs);
    00127   private:
    00128     QuaZipPrivate *p;
    00129     // not (and will not be) implemented
    00130     QuaZip(const QuaZip& that);
    00131     // not (and will not be) implemented
    00132     QuaZip& operator=(const QuaZip& that);
    00133   public:
    00135
    00136     QuaZip();
    00138     QuaZip(const QString& zipName);
    00140
    00141     QuaZip(QIODevice *ioDevice);
    00143
    00144     ~QuaZip();
    00146
    00182     bool open(Mode mode, zlib_filefunc_def *ioApi =NULL);
    00184
    00187     void close();
    00189
    00194     void setFileNameCodec(QTextCodec *fileNameCodec);
    00196
    00199     void setFileNameCodec(const char *fileNameCodecName);
    00201     QTextCodec* getFileNameCodec() const;
    00203
    00205     void setCommentCodec(QTextCodec *commentCodec);
    00207
    00210     void setCommentCodec(const char *commentCodecName);
    00212     QTextCodec* getCommentCodec() const;
    00214
    00219     QString getZipName() const;
    00221
    00226     void setZipName(const QString& zipName);
    00228
    00232     QIODevice *getIoDevice() const;
    00234
    00239     void setIoDevice(QIODevice *ioDevice);
    00241     Mode getMode() const;
    00243     bool isOpen() const;
    00245
    00253     int getZipError() const;
    00255
    00258     int getEntriesCount() const;
    00260     QString getComment() const;
    00262
    00270     void setComment(const QString& comment);
    00272
    00275     bool goToFirstFile();
    00277
    00294     bool goToNextFile();
    00296
    00320     bool setCurrentFile(const QString& fileName, CaseSensitivity cs =csDefault);
    00322     bool hasCurrentFile() const;
    00324
    00339     bool getCurrentFileInfo(QuaZipFileInfo* info)const;
    00341
    00347     QString getCurrentFileName()const;
    00349
    00364     unzFile getUnzFile();
    00366
    00370     zipFile getZipFile();
    00372
    00395     void setDataDescriptorWritingEnabled(bool enabled);
    00397
    00400     bool isDataDescriptorWritingEnabled() const;
    00402
    00408     QStringList getFileNameList() const;
    00410
    00416     QList<QuaZipFileInfo> getFileInfoList() const;
    00417 };
    00418
    00419 #endif