QuaZIP  quazip-0-9
JlCompress.h
1 #ifndef JLCOMPRESSFOLDER_H_
2 #define JLCOMPRESSFOLDER_H_
3 
4 /*
5 Copyright (C) 2010 Roberto Pompermaier
6 Copyright (C) 2005-2016 Sergey A. Tachenov
7 
8 This file is part of QuaZIP.
9 
10 QuaZIP is free software: you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation, either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 QuaZIP is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with QuaZIP. If not, see <http://www.gnu.org/licenses/>.
22 
23 See COPYING file for the full LGPL text.
24 
25 Original ZIP package is copyrighted by Gilles Vollant and contributors,
26 see quazip/(un)zip.h files for details. Basically it's the zlib license.
27 */
28 
29 #include "quazip.h"
30 #include "quazipfile.h"
31 #include "quazipfileinfo.h"
32 #include <QtCore/QString>
33 #include <QtCore/QDir>
34 #include <QtCore/QFileInfo>
35 #include <QtCore/QFile>
36 #include <QtCore/QTextCodec>
37 
39 
43 class QUAZIP_EXPORT JlCompress {
44 private:
45  static QStringList extractDir(QuaZip &zip, const QString &dir);
46  static QStringList getFileList(QuaZip *zip);
47  static QString extractFile(QuaZip &zip, QString fileName, QString fileDest);
48  static QStringList extractFiles(QuaZip &zip, const QStringList &files, const QString &dir);
50 
56  static bool compressFile(QuaZip* zip, QString fileName, QString fileDest);
58 
67  static bool compressSubDir(QuaZip* parentZip, QString dir, QString parentDir, bool recursive,
68  QDir::Filters filters);
70 
76  static bool extractFile(QuaZip* zip, QString fileName, QString fileDest);
78 
82  static bool removeFile(QStringList listFile);
83 
84 public:
86 
91  static bool compressFile(QString fileCompressed, QString file);
93 
98  static bool compressFiles(QString fileCompressed, QStringList files);
100 
109  static bool compressDir(QString fileCompressed, QString dir = QString(), bool recursive = true);
126  static bool compressDir(QString fileCompressed, QString dir,
127  bool recursive, QDir::Filters filters);
128 
129 public:
131 
138  static QString extractFile(QString fileCompressed, QString fileName, QString fileDest = QString());
140 
147  static QStringList extractFiles(QString fileCompressed, QStringList files, QString dir = QString());
149 
155  static QStringList extractDir(QString fileCompressed, QString dir = QString());
157 
164  static QStringList extractDir(QString fileCompressed, QTextCodec* fileNameCodec, QString dir = QString());
166 
171  static QStringList getFileList(QString fileCompressed);
173 
180  static QString extractFile(QIODevice *ioDevice, QString fileName, QString fileDest = QString());
182 
189  static QStringList extractFiles(QIODevice *ioDevice, QStringList files, QString dir = QString());
191 
197  static QStringList extractDir(QIODevice *ioDevice, QString dir = QString());
199 
206  static QStringList extractDir(QIODevice* ioDevice, QTextCodec* fileNameCodec, QString dir = QString());
208 
213  static QStringList getFileList(QIODevice *ioDevice);
214 };
215 
216 #endif /* JLCOMPRESSFOLDER_H_ */
QuaZip::mdAppend
@ mdAppend
Definition: quazip.h:98
QuaZip::getMode
Mode getMode() const
Returns the mode in which ZIP file was opened.
Definition: quazip.cpp:652
QuaZip::mdCreate
@ mdCreate
ZIP file was created with open() call.
Definition: quazip.h:97
JlCompress
Utility class for typical operations.
Definition: JlCompress.h:43
QuaZip::mdUnzip
@ mdUnzip
ZIP file is open for reading files inside it.
Definition: quazip.h:96
JlCompress::compressDir
static bool compressDir(QString fileCompressed, QString dir=QString(), bool recursive=true)
Compress a whole directory.
Definition: JlCompress.cpp:263
QuaZip::goToNextFile
bool goToNextFile()
Sets the current file to the next file in the archive.
Definition: quazip.cpp:503
QuaZip::getCurrentFileInfo
bool getCurrentFileInfo(QuaZipFileInfo *info) const
Retrieves information about the current file.
Definition: quazip.cpp:517
QuaZip::getZipError
int getZipError() const
Returns the error code of the last operation.
Definition: quazip.cpp:662
QuaZip::setCurrentFile
bool setCurrentFile(const QString &fileName, CaseSensitivity cs=csDefault)
Sets current file by its name.
Definition: quazip.cpp:433
QuaZipFileInfo64::getPermissions
QFile::Permissions getPermissions() const
Get the file permissions.
Definition: quazipfileinfo.cpp:59
QuaZip::getZipName
QString getZipName() const
Returns the name of the ZIP file.
Definition: quazip.cpp:640
QuaZipFile
A file inside ZIP archive.
Definition: quazipfile.h:74
QuaZip
ZIP archive.
Definition: quazip.h:84
QuaZip::setFileNameCodec
void setFileNameCodec(QTextCodec *fileNameCodec)
Sets the codec used to encode/decode file names inside archive.
Definition: quazip.cpp:600
QuaZip::getCurrentFileName
QString getCurrentFileName() const
Returns the current file name.
Definition: quazip.cpp:576
JlCompress::compressFiles
static bool compressFiles(QString fileCompressed, QStringList files)
Compress a list of files.
Definition: JlCompress.cpp:233
QuaZipFileInfo64
Information about a file inside archive (with zip64 support).
Definition: quazipfileinfo.h:85
QuaZip::close
void close()
Closes ZIP file.
Definition: quazip.cpp:347
QuaZipNewInfo
Information about a file to be created.
Definition: quazipnewinfo.h:50
QuaZipFileInfo64::name
QString name
File name.
Definition: quazipfileinfo.h:87
QuaZip::goToFirstFile
bool goToFirstFile()
Sets the current file to the first file in the archive.
Definition: quazip.cpp:491
QuaZip::open
bool open(Mode mode, zlib_filefunc_def *ioApi=NULL)
Opens ZIP file.
Definition: quazip.cpp:236
QuaZip::mdAdd
@ mdAdd
ZIP file was opened for adding files in the archive.
Definition: quazip.h:106