quagzipfile.h   quagzipfile.h 
#ifndef QUAZIP_QUAGZIPFILE_H #ifndef QUAZIP_QUAGZIPFILE_H
#define QUAZIP_QUAGZIPFILE_H #define QUAZIP_QUAGZIPFILE_H
#include <QIODevice> #include <QIODevice>
#include "quazip_global.h" #include "quazip_global.h"
#include <zlib.h> #include <zlib.h>
class QuaGzipFilePrivate; class QuaGzipFilePrivate;
/// GZIP file
/**
This class is a wrapper around GZIP file access functions in zlib. Unlike
QuaZip classes, it doesn't allow reading from a GZIP file opened as QIODev
ice, for example, if your GZIP file is in QBuffer. It only provides QIODevi
ce access to a GZIP file contents, but the GZIP file itself must be identif
ied by its name on disk or by descriptor id.
*/
class QUAZIP_EXPORT QuaGzipFile: public QIODevice { class QUAZIP_EXPORT QuaGzipFile: public QIODevice {
Q_OBJECT Q_OBJECT
public: public:
/// Empty constructor.
/**
Must call setFileName() before trying to open.
*/
QuaGzipFile(); QuaGzipFile();
/// Empty constructor with a parent.
/**
Must call setFileName() before trying to open.
\param parent The parent object, as per QObject logic.
*/
QuaGzipFile(QObject *parent); QuaGzipFile(QObject *parent);
/// Constructor.
/**
\param fileName The name of the GZIP file.
\param parent The parent object, as per QObject logic.
*/
QuaGzipFile(const QString &fileName, QObject *parent = NULL); QuaGzipFile(const QString &fileName, QObject *parent = NULL);
/// Destructor.
virtual ~QuaGzipFile(); virtual ~QuaGzipFile();
/// Sets the name of the GZIP file to be opened.
void setFileName(const QString& fileName); void setFileName(const QString& fileName);
/// Returns the name of the GZIP file.
QString getFileName() const; QString getFileName() const;
/// Returns true.
/**
Strictly speaking, zlib supports seeking for GZIP files, but it is
poorly implemented, because there is no way to implement it
properly. For reading, seeking backwards is very slow, and for
writing, it is downright impossible. Therefore, QuaGzipFile does not
support seeking at all.
*/
virtual bool isSequential() const; virtual bool isSequential() const;
/// Opens the file.
/**
\param mode Can be either QIODevice::Write or QIODevice::Read.
ReadWrite and Append aren't supported.
*/
virtual bool open(QIODevice::OpenMode mode); virtual bool open(QIODevice::OpenMode mode);
/// Opens the file.
/**
\overload
\param fd The file descriptor to read/write the GZIP file from/to.
\param mode Can be either QIODevice::Write or QIODevice::Read.
ReadWrite and Append aren't supported.
*/
virtual bool open(int fd, QIODevice::OpenMode mode); virtual bool open(int fd, QIODevice::OpenMode mode);
/// Flushes data to file.
/**
The data is written using Z_SYNC_FLUSH mode. Doesn't make any sense
when reading.
*/
virtual bool flush(); virtual bool flush();
/// Closes the file.
virtual void close(); virtual void close();
protected: protected:
/// Implementation of QIODevice::readData().
virtual qint64 readData(char *data, qint64 maxSize); virtual qint64 readData(char *data, qint64 maxSize);
/// Implementation of QIODevice::writeData().
virtual qint64 writeData(const char *data, qint64 maxSize); virtual qint64 writeData(const char *data, qint64 maxSize);
private: private:
// not implemented by design to disable copy // not implemented by design to disable copy
QuaGzipFile(const QuaGzipFile &that); QuaGzipFile(const QuaGzipFile &that);
QuaGzipFile& operator=(const QuaGzipFile &that); QuaGzipFile& operator=(const QuaGzipFile &that);
QuaGzipFilePrivate *d; QuaGzipFilePrivate *d;
}; };
#endif // QUAZIP_QUAGZIPFILE_H #endif // QUAZIP_QUAGZIPFILE_H
 End of changes. 14 change blocks. 
0 lines changed or deleted 53 lines changed or added


 quaziodevice.h   quaziodevice.h 
#ifndef QUAZIP_QUAZIODEVICE_H #ifndef QUAZIP_QUAZIODEVICE_H
#define QUAZIP_QUAZIODEVICE_H #define QUAZIP_QUAZIODEVICE_H
#include <QIODevice> #include <QIODevice>
#include "quazip_global.h" #include "quazip_global.h"
#include <zlib.h> #include <zlib.h>
class QuaZIODevicePrivate; class QuaZIODevicePrivate;
/// A class to compress/decompress QIODevice.
/**
This class can be used to compress any data written to QIODevice or
decompress it back. Compressing data sent over a QTcpSocket is a good
example.
*/
class QUAZIP_EXPORT QuaZIODevice: public QIODevice { class QUAZIP_EXPORT QuaZIODevice: public QIODevice {
Q_OBJECT Q_OBJECT
public: public:
/// Constructor.
/**
\param io The QIODevice to read/write.
\param parent The parent object, as per QObject logic.
*/
QuaZIODevice(QIODevice *io, QObject *parent = NULL); QuaZIODevice(QIODevice *io, QObject *parent = NULL);
/// Destructor.
~QuaZIODevice(); ~QuaZIODevice();
/// Flushes data waiting to be written.
/**
Unfortunately, as QIODevice doesn't support flush() by itself, the
only thing this method does is write the compressed data into the
device using Z_SYNC_FLUSH mode. If you need the compressed data to
actually be flushed from the buffer of the underlying QIODevice, you
need to call its flush() method as well, providing it supports it
(like QTcpSocket does). Example:
\code
QuaZIODevice dev(&sock);
dev.open(QIODevice::Write);
dev.write(yourDataGoesHere);
dev.flush();
sock->flush(); // this actually sends data to network
\endcode
This may change in the future versions of QuaZIP by implementing an
ugly hack: trying to cast the QIODevice using qobject_cast to known
flush()-supporting subclasses, and calling flush if the resulting
pointer is not zero.
*/
virtual bool flush(); virtual bool flush();
virtual bool open(QIODevice::OpenMode); /// Opens the device.
/**
\param mode Neither QIODevice::ReadWrite nor QIODevice::Append are
not supported.
*/
virtual bool open(QIODevice::OpenMode mode);
/// Closes this device, but not the underlying one.
/**
The underlying QIODevice is not closed in case you want to write
something else to it.
*/
virtual void close(); virtual void close();
/// Returns the underlying device.
QIODevice *getIoDevice() const; QIODevice *getIoDevice() const;
/// Returns true.
virtual bool isSequential() const; virtual bool isSequential() const;
protected: protected:
/// Implementation of QIODevice::readData().
virtual qint64 readData(char *data, qint64 maxSize); virtual qint64 readData(char *data, qint64 maxSize);
/// Implementation of QIODevice::writeData().
virtual qint64 writeData(const char *data, qint64 maxSize); virtual qint64 writeData(const char *data, qint64 maxSize);
private: private:
QuaZIODevicePrivate *d; QuaZIODevicePrivate *d;
}; };
#endif // QUAZIP_QUAZIODEVICE_H #endif // QUAZIP_QUAZIODEVICE_H
 End of changes. 9 change blocks. 
1 lines changed or deleted 48 lines changed or added


 quazip.h   quazip.h 
skipping to change at line 118 skipping to change at line 118
/** This is what you specify when accessing files in the archive. /** This is what you specify when accessing files in the archive.
* Works perfectly fine with any characters thanks to Qt's great * Works perfectly fine with any characters thanks to Qt's great
* unicode support. This is different from ZIP/UNZIP API, where * unicode support. This is different from ZIP/UNZIP API, where
* only US-ASCII characters was supported. * only US-ASCII characters was supported.
**/ **/
enum CaseSensitivity { enum CaseSensitivity {
csDefault=0, ///< Default for platform. Case sensitive for UNIX, not for Windows. csDefault=0, ///< Default for platform. Case sensitive for UNIX, not for Windows.
csSensitive=1, ///< Case sensitive. csSensitive=1, ///< Case sensitive.
csInsensitive=2 ///< Case insensitive. csInsensitive=2 ///< Case insensitive.
}; };
static Qt::CaseSensitivity convertCaseSensitivity(CaseSensitivity); /// Returns the actual case sensitivity for the specified QuaZIP one.
/**
\param cs The value to convert.
\returns If CaseSensitivity::csDefault, then returns the default
file name case sensitivity for the platform. Otherwise, just
returns the appropriate value from the Qt::CaseSensitivity enum.
*/
static Qt::CaseSensitivity convertCaseSensitivity(
CaseSensitivity cs);
private: private:
QuaZipPrivate *p; QuaZipPrivate *p;
// not (and will not be) implemented // not (and will not be) implemented
QuaZip(const QuaZip& that); QuaZip(const QuaZip& that);
// not (and will not be) implemented // not (and will not be) implemented
QuaZip& operator=(const QuaZip& that); QuaZip& operator=(const QuaZip& that);
public: public:
/// Constructs QuaZip object. /// Constructs QuaZip object.
/** Call setName() before opening constructed object. */ /** Call setName() before opening constructed object. */
QuaZip(); QuaZip();
 End of changes. 1 change blocks. 
1 lines changed or deleted 9 lines changed or added


 quazipfileinfo.h   quazipfileinfo.h 
skipping to change at line 29 skipping to change at line 29
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
See COPYING file for the full LGPL text. See COPYING file for the full LGPL text.
Original ZIP package is copyrighted by Gilles Vollant, see Original ZIP package is copyrighted by Gilles Vollant, see
quazip/(un)zip.h files for details, basically it's zlib license. quazip/(un)zip.h files for details, basically it's zlib license.
**/ **/
#include <QByteArray> #include <QByteArray>
#include <QDateTime> #include <QDateTime>
#include <QFile>
#include "quazip_global.h" #include "quazip_global.h"
/// Information about a file inside archive. /// Information about a file inside archive.
/** Call QuaZip::getCurrentFileInfo() or QuaZipFile::getFileInfo() to /** Call QuaZip::getCurrentFileInfo() or QuaZipFile::getFileInfo() to
* fill this structure. */ * fill this structure. */
struct QUAZIP_EXPORT QuaZipFileInfo { struct QUAZIP_EXPORT QuaZipFileInfo {
/// File name. /// File name.
QString name; QString name;
/// Version created by. /// Version created by.
skipping to change at line 64 skipping to change at line 65
/// Disk number start. /// Disk number start.
quint16 diskNumberStart; quint16 diskNumberStart;
/// Internal file attributes. /// Internal file attributes.
quint16 internalAttr; quint16 internalAttr;
/// External file attributes. /// External file attributes.
quint32 externalAttr; quint32 externalAttr;
/// Comment. /// Comment.
QString comment; QString comment;
/// Extra field. /// Extra field.
QByteArray extra; QByteArray extra;
/// Get the file permissions.
/**
Returns the high 16 bits of external attributes converted to
QFile::Permissions.
*/
QFile::Permissions getPermissions() const;
}; };
#endif #endif
 End of changes. 2 change blocks. 
0 lines changed or deleted 7 lines changed or added


 quazipnewinfo.h   quazipnewinfo.h 
skipping to change at line 54 skipping to change at line 54
/// File timestamp. /// File timestamp.
/** This is the last file modification date and time. Will be stored /** This is the last file modification date and time. Will be stored
* in the archive central directory. It is a good practice to set it * in the archive central directory. It is a good practice to set it
* to the source file timestamp instead of archive creating time. Use * to the source file timestamp instead of archive creating time. Use
* setFileDateTime() or QuaZipNewInfo(const QString&, const QString&). * setFileDateTime() or QuaZipNewInfo(const QString&, const QString&).
**/ **/
QDateTime dateTime; QDateTime dateTime;
/// File internal attributes. /// File internal attributes.
quint16 internalAttr; quint16 internalAttr;
/// File external attributes. /// File external attributes.
/**
The highest 16 bits contain Unix file permissions and type (dir or
file). The constructor QuaZipNewInfo(const QString&, const QString&)
takes permissions from the provided file.
*/
quint32 externalAttr; quint32 externalAttr;
/// File comment. /// File comment.
/** Will be encoded using QuaZip::getCommentCodec(). /** Will be encoded using QuaZip::getCommentCodec().
**/ **/
QString comment; QString comment;
/// File local extra field. /// File local extra field.
QByteArray extraLocal; QByteArray extraLocal;
/// File global extra field. /// File global extra field.
QByteArray extraGlobal; QByteArray extraGlobal;
/// Uncompressed file size. /// Uncompressed file size.
skipping to change at line 75 skipping to change at line 80
* adding precompressed file in the zip archive. * adding precompressed file in the zip archive.
**/ **/
ulong uncompressedSize; ulong uncompressedSize;
/// Constructs QuaZipNewInfo instance. /// Constructs QuaZipNewInfo instance.
/** Initializes name with \a name, dateTime with current date and /** Initializes name with \a name, dateTime with current date and
* time. Attributes are initialized with zeros, comment and extra * time. Attributes are initialized with zeros, comment and extra
* field with null values. * field with null values.
**/ **/
QuaZipNewInfo(const QString& name); QuaZipNewInfo(const QString& name);
/// Constructs QuaZipNewInfo instance. /// Constructs QuaZipNewInfo instance.
/** Initializes name with \a name and dateTime with timestamp of the /** Initializes name with \a name. Timestamp and permissions are taken
* file named \a file. If the \a file does not exists or its timestamp * from the specified file. If the \a file does not exists or its timesta
mp
* is inaccessible (e. g. you do not have read permission for the * is inaccessible (e. g. you do not have read permission for the
* directory file in), uses current date and time. Attributes are * directory file in), uses current time and zero permissions. Other attr ibutes are
* initialized with zeros, comment and extra field with null values. * initialized with zeros, comment and extra field with null values.
* *
* \sa setFileDateTime() * \sa setFileDateTime()
**/ **/
QuaZipNewInfo(const QString& name, const QString& file); QuaZipNewInfo(const QString& name, const QString& file);
/// Sets the file timestamp from the existing file. /// Sets the file timestamp from the existing file.
/** Use this function to set the file timestamp from the existing /** Use this function to set the file timestamp from the existing
* file. Use it like this: * file. Use it like this:
* \code * \code
* QuaZipFile zipFile(&zip); * QuaZipFile zipFile(&zip);
skipping to change at line 100 skipping to change at line 105
* file.open(QIODevice::ReadOnly); * file.open(QIODevice::ReadOnly);
* QuaZipNewInfo info("file-name-in-archive"); * QuaZipNewInfo info("file-name-in-archive");
* info.setFileDateTime("file-to-add"); // take the timestamp from file * info.setFileDateTime("file-to-add"); // take the timestamp from file
* zipFile.open(QIODevice::WriteOnly, info); * zipFile.open(QIODevice::WriteOnly, info);
* \endcode * \endcode
* *
* This function does not change dateTime if some error occured (e. g. * This function does not change dateTime if some error occured (e. g.
* file is inaccessible). * file is inaccessible).
**/ **/
void setFileDateTime(const QString& file); void setFileDateTime(const QString& file);
/// Sets the file permissions from the existing file.
/**
Takes permissions from the file and sets the high 16 bits of
external attributes. Uses QFileInfo to get permissions on all
platforms.
*/
void setFilePermissions(const QString &file);
/// Sets the file permissions.
/**
Modifies the highest 16 bits of external attributes. The type part
is set to dir if the name ends with a slash, and to regular file
otherwise.
*/
void setPermissions(QFile::Permissions permissions);
}; };
#endif #endif
 End of changes. 4 change blocks. 
3 lines changed or deleted 23 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/