Warning, /maui/mauikit-documents/src/code/epub/quazip/doc/usage.dox is written in an unsupported language. File is not indexed.

0001 /** \page usage Usage
0002  * 
0003  * This page provides general information on QuaZIP usage. See classes
0004  * QuaZip and QuaZipFile for the detailed documentation on what can
0005  * QuaZIP do and what it can not. Also, reading comments in the zip.h and
0006  * unzip.h files (taken from the original ZIP/UNZIP package) is always a
0007  * good idea too. After all, QuaZIP is just a wrapper with a few
0008  * convenience extensions and reimplementations.
0009  *
0010  * QuaZip is a class representing ZIP archive, QuaZipFile represents a
0011  * file inside archive and subclasses QIODevice as well. One limitation
0012  * is that there can be only one instance of QuaZipFile per QuaZip
0013  * instance, which kind of makes it confusing why there are two classes
0014  * instead of one. This is actually no more than an API design mistake.
0015  *
0016  * \section terminology Terminology
0017  *
0018  * "QuaZIP" means whole this library, while "QuaZip" (note the
0019  * lower case) is just one class in it.
0020  *
0021  * "ZIP/UNZIP API" or "minizip" means the original API of the Gilles
0022  * Vollant's ZIP/UNZIP package. It was slightly modified to better
0023  * integrate with Qt. These modifications are not source or binary
0024  * compatible with the official minizip release, which means you can't
0025  * just drop the newer minizip version into QuaZIP sources and make it
0026  * work.
0027  *
0028  * "ZIP", "ZIP archive" or "ZIP file" means any ZIP archive. Typically
0029  * this is a plain file with ".zip" (or ".ZIP") file name suffix, but it
0030  * can also be any seekable QIODevice (say, QBuffer, but not
0031  * QTcpSocket).
0032  *
0033  * "A file inside archive", "a file inside ZIP" or something like that
0034  * means file either being read or written from/to some ZIP archive.
0035  *
0036  * \section error-handling Error handling
0037  *
0038  * Almost any call to ZIP/UNZIP API return some error code. Most of the
0039  * original API's error checking could be done in this wrapper as well,
0040  * but it would cause unnecessary code bloating without any benefit. So,
0041  * QuaZIP only checks for situations that ZIP/UNZIP API can not check
0042  * for. For example, ZIP/UNZIP API has no "ZIP open mode" concept
0043  * because read and write modes are completely separated. On the other
0044  * hand, to avoid creating classes like "QuaZipReader", "QuaZipWriter"
0045  * or something like that, QuaZIP introduces "ZIP open mode" concept
0046  * instead, thus making it possible to use one class (QuaZip) for both
0047  * reading and writing. But this leads to additional open mode checks
0048  * which are not done in ZIP/UNZIP package.
0049  *
0050  * Therefore, error checking is two-level (QuaZIP's level and ZIP/UNZIP
0051  * API level), which sometimes can be confusing, so here are some
0052  * advices on how the error checking should be properly done:
0053  *
0054  * - Both QuaZip and QuaZipFile have getZipError() function, which return
0055  *   error code of the last ZIP/UNZIP API call. Most function calls
0056  *   reset error code to UNZ_OK on success and set error code on
0057  *   failure. Some functions do not reset error code. Most of them are
0058  *   \c const and do not access ZIP archive in any way. Some, on the
0059  *   other hand, \em do access ZIP archive, but do not reset or set
0060  *   error code. For example, QuaZipFile::pos() function. Such functions
0061  *   are explicitly marked in the documentation.
0062  * - Most functions have their own way to report errors, by returning a
0063  *   null string, negative value or \c false. If such a function returns
0064  *   error value, call getZipError() to get more information about
0065  *   error. See "zip.h" and "unzip.h" of the ZIP/UNZIP package for error
0066  *   codes.
0067  * - If the function returns error-stating value (like \c false), but
0068  *   getZipError() returns UNZ_OK, it means that you did something
0069  *   obviously wrong. For example, tried to write in the archive open
0070  *   for reading or not open at all. You better just not do that!
0071  *   Most functions also issue a warning using qWarning() function in
0072  *   such cases. See documentation for a specific function for details
0073  *   on when it should not be called.
0074  *
0075  * I know that this is somewhat messy, but I could not find a better way
0076  * to do all the error handling.
0077  **/