This page provides general information on Qua\-Z\-I\-P usage. See classes \doxyref{Qua\-Zip}{p.}{classQuaZip} and \doxyref{Qua\-Zip\-File}{p.}{classQuaZipFile} for the detailed documentation on what can Qua\-Z\-I\-P do and what it can not. Also, reading comments in the zip.\-h and unzip.\-h files (taken from the original Z\-I\-P/\-U\-N\-Z\-I\-P package) is always a good idea too. After all, Qua\-Z\-I\-P is just a wrapper with a few convenience extensions and reimplementations.

\doxyref{Qua\-Zip}{p.}{classQuaZip} is a class representing Z\-I\-P archive, \doxyref{Qua\-Zip\-File}{p.}{classQuaZipFile} represents a file inside archive and subclasses Q\-I\-O\-Device as well. One limitation is that there can be only one instance of \doxyref{Qua\-Zip\-File}{p.}{classQuaZipFile} per \doxyref{Qua\-Zip}{p.}{classQuaZip} instance, which kind of makes it confusing why there are two classes instead of one. This is actually no more than an A\-P\-I design mistake.\section{Terminology}\label{usage_terminology}
\char`\"{}\-Qua\-Z\-I\-P\char`\"{} means whole this library, while \char`\"{}\-Qua\-Zip\char`\"{} (note the lower case) is just one class in it.

\char`\"{}\-Z\-I\-P/\-U\-N\-Z\-I\-P A\-P\-I\char`\"{} or \char`\"{}minizip\char`\"{} means the original A\-P\-I of the Gilles Vollant's Z\-I\-P/\-U\-N\-Z\-I\-P package. It was slightly modified to better integrate with Qt. These modifications are not source or binary compatible with the official minizip release, which means you can't just drop the newer minizip version into Qua\-Z\-I\-P sources and make it work.

\char`\"{}\-Z\-I\-P\char`\"{}, \char`\"{}\-Z\-I\-P archive\char`\"{} or \char`\"{}\-Z\-I\-P file\char`\"{} means any Z\-I\-P archive. Typically this is a plain file with \char`\"{}.\-zip\char`\"{} (or \char`\"{}.\-Z\-I\-P\char`\"{}) file name suffix, but it can also be any seekable Q\-I\-O\-Device (say, Q\-Buffer, but not Q\-Tcp\-Socket).

\char`\"{}\-A file inside archive\char`\"{}, \char`\"{}a file inside Z\-I\-P\char`\"{} or something like that means file either being read or written from/to some Z\-I\-P archive.\section{Error handling}\label{usage_error-handling}
Almost any call to Z\-I\-P/\-U\-N\-Z\-I\-P A\-P\-I return some error code. Most of the original A\-P\-I's error checking could be done in this wrapper as well, but it would cause unnecessary code bloating without any benefit. So, Qua\-Z\-I\-P only checks for situations that Z\-I\-P/\-U\-N\-Z\-I\-P A\-P\-I can not check for. For example, Z\-I\-P/\-U\-N\-Z\-I\-P A\-P\-I has no \char`\"{}\-Z\-I\-P open mode\char`\"{} concept because read and write modes are completely separated. On the other hand, to avoid creating classes like \char`\"{}\-Qua\-Zip\-Reader\char`\"{}, \char`\"{}\-Qua\-Zip\-Writer\char`\"{} or something like that, Qua\-Z\-I\-P introduces \char`\"{}\-Z\-I\-P open mode\char`\"{} concept instead, thus making it possible to use one class (\doxyref{Qua\-Zip}{p.}{classQuaZip}) for both reading and writing. But this leads to additional open mode checks which are not done in Z\-I\-P/\-U\-N\-Z\-I\-P package.

Therefore, error checking is two-\/level (Qua\-Z\-I\-P's level and Z\-I\-P/\-U\-N\-Z\-I\-P A\-P\-I level), which sometimes can be confusing, so here are some advices on how the error checking should be properly done\-:


\begin{DoxyItemize}
\item Both \doxyref{Qua\-Zip}{p.}{classQuaZip} and \doxyref{Qua\-Zip\-File}{p.}{classQuaZipFile} have get\-Zip\-Error() function, which return error code of the last Z\-I\-P/\-U\-N\-Z\-I\-P A\-P\-I call. Most function calls reset error code to U\-N\-Z\-\_\-\-O\-K on success and set error code on failure. Some functions do not reset error code. Most of them are {\ttfamily const} and do not access Z\-I\-P archive in any way. Some, on the other hand, {\itshape do} access Z\-I\-P archive, but do not reset or set error code. For example, \doxyref{Qua\-Zip\-File\-::pos()}{p.}{classQuaZipFile_a90fd55dab83eca7f95df50b2c41b7f22} function. Such functions are explicitly marked in the documentation.
\item Most functions have their own way to report errors, by returning a null string, negative value or {\ttfamily false}. If such a function returns error value, call get\-Zip\-Error() to get more information about error. See \char`\"{}zip.\-h\char`\"{} and \char`\"{}unzip.\-h\char`\"{} of the Z\-I\-P/\-U\-N\-Z\-I\-P package for error codes.
\item If the function returns error-\/stating value (like {\ttfamily false}), but get\-Zip\-Error() returns U\-N\-Z\-\_\-\-O\-K, it means that you did something obviously wrong. For example, tried to write in the archive open for reading or not open at all. You better just not do that! Most functions also issue a warning using q\-Warning() function in such cases. See documentation for a specific function for details on when it should not be called.
\end{DoxyItemize}

I know that this is somewhat messy, but I could not find a better way to do all the error handling. 