[1050] | 1 | \section{QuaZipFile Class Reference}
|
---|
| 2 | \label{classQuaZipFile}\index{QuaZipFile@{QuaZipFile}}
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 | A file inside ZIP archive.
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 | {\ttfamily \#include $<$quazip/quazipfile.h$>$}
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | Inheritance diagram for QuaZipFile:
|
---|
| 15 | \nopagebreak
|
---|
| 16 | \begin{figure}[H]
|
---|
| 17 | \begin{center}
|
---|
| 18 | \leavevmode
|
---|
| 19 | \includegraphics[width=106pt]{classQuaZipFile__inherit__graph}
|
---|
| 20 | \end{center}
|
---|
| 21 | \end{figure}
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | Collaboration diagram for QuaZipFile:
|
---|
| 25 | \nopagebreak
|
---|
| 26 | \begin{figure}[H]
|
---|
| 27 | \begin{center}
|
---|
| 28 | \leavevmode
|
---|
| 29 | \includegraphics[width=400pt]{classQuaZipFile__coll__graph}
|
---|
| 30 | \end{center}
|
---|
| 31 | \end{figure}
|
---|
| 32 | \subsection*{Public Member Functions}
|
---|
| 33 | \begin{DoxyCompactItemize}
|
---|
| 34 | \item
|
---|
| 35 | {\bf QuaZipFile} ()
|
---|
| 36 | \begin{DoxyCompactList}\small\item\em Constructs a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance. \end{DoxyCompactList}\item
|
---|
| 37 | {\bf QuaZipFile} ({\bf QObject} $\ast${\bf parent})
|
---|
| 38 | \begin{DoxyCompactList}\small\item\em Constructs a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance. \end{DoxyCompactList}\item
|
---|
| 39 | {\bf QuaZipFile} (const {\bf QString} \&zipName, {\bf QObject} $\ast${\bf parent}=NULL)
|
---|
| 40 | \begin{DoxyCompactList}\small\item\em Constructs a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance. \end{DoxyCompactList}\item
|
---|
| 41 | {\bf QuaZipFile} (const {\bf QString} \&zipName, const {\bf QString} \&fileName, {\bf QuaZip::CaseSensitivity} cs=QuaZip::csDefault, {\bf QObject} $\ast${\bf parent}=NULL)
|
---|
| 42 | \begin{DoxyCompactList}\small\item\em Constructs a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance. \end{DoxyCompactList}\item
|
---|
| 43 | {\bf QuaZipFile} ({\bf QuaZip} $\ast$zip, {\bf QObject} $\ast${\bf parent}=NULL)
|
---|
| 44 | \begin{DoxyCompactList}\small\item\em Constructs a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance. \end{DoxyCompactList}\item
|
---|
| 45 | virtual {\bf $\sim$QuaZipFile} ()
|
---|
| 46 | \begin{DoxyCompactList}\small\item\em Destroys a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance. \end{DoxyCompactList}\item
|
---|
| 47 | {\bf QString} {\bf getZipName} () const
|
---|
| 48 | \begin{DoxyCompactList}\small\item\em Returns the ZIP archive file name. \end{DoxyCompactList}\item
|
---|
| 49 | {\bf QuaZip} $\ast$ {\bf getZip} () const
|
---|
| 50 | \begin{DoxyCompactList}\small\item\em Returns a pointer to the associated \doxyref{QuaZip}{p.}{classQuaZip} object. \end{DoxyCompactList}\item
|
---|
| 51 | {\bf QString} {\bf getFileName} () const
|
---|
| 52 | \begin{DoxyCompactList}\small\item\em Returns file name. \end{DoxyCompactList}\item
|
---|
| 53 | {\bf QuaZip::CaseSensitivity} {\bf getCaseSensitivity} () const
|
---|
| 54 | \begin{DoxyCompactList}\small\item\em Returns case sensitivity of the file name. \end{DoxyCompactList}\item
|
---|
| 55 | {\bf QString} {\bf getActualFileName} () const
|
---|
| 56 | \begin{DoxyCompactList}\small\item\em Returns the actual file name in the archive. \end{DoxyCompactList}\item
|
---|
| 57 | void {\bf setZipName} (const {\bf QString} \&zipName)
|
---|
| 58 | \begin{DoxyCompactList}\small\item\em Sets the ZIP archive file name. \end{DoxyCompactList}\item
|
---|
| 59 | bool {\bf isRaw} () const
|
---|
| 60 | \begin{DoxyCompactList}\small\item\em Returns {\ttfamily true} if the file was opened in raw mode. \end{DoxyCompactList}\item
|
---|
| 61 | void {\bf setZip} ({\bf QuaZip} $\ast$zip)
|
---|
| 62 | \begin{DoxyCompactList}\small\item\em Binds to the existing \doxyref{QuaZip}{p.}{classQuaZip} instance. \end{DoxyCompactList}\item
|
---|
| 63 | void {\bf setFileName} (const {\bf QString} \&fileName, {\bf QuaZip::CaseSensitivity} cs=QuaZip::csDefault)
|
---|
| 64 | \begin{DoxyCompactList}\small\item\em Sets the file name. \end{DoxyCompactList}\item
|
---|
| 65 | virtual bool {\bf open} ({\bf OpenMode} mode)
|
---|
| 66 | \begin{DoxyCompactList}\small\item\em Opens a file for reading. \end{DoxyCompactList}\item
|
---|
| 67 | bool {\bf open} ({\bf OpenMode} mode, const char $\ast$password)
|
---|
| 68 | \begin{DoxyCompactList}\small\item\em Opens a file for reading. \end{DoxyCompactList}\item
|
---|
| 69 | bool {\bf open} ({\bf OpenMode} mode, int $\ast$method, int $\ast$level, bool raw, const char $\ast$password=NULL)
|
---|
| 70 | \begin{DoxyCompactList}\small\item\em Opens a file for reading. \end{DoxyCompactList}\item
|
---|
| 71 | bool {\bf open} ({\bf OpenMode} mode, const {\bf QuaZipNewInfo} \&info, const char $\ast$password=NULL, quint32 crc=0, int method=Z\_\-DEFLATED, int level=Z\_\-DEFAULT\_\-COMPRESSION, bool raw=false, int windowBits=-\/MAX\_\-WBITS, int memLevel=DEF\_\-MEM\_\-LEVEL, int strategy=Z\_\-DEFAULT\_\-STRATEGY)
|
---|
| 72 | \begin{DoxyCompactList}\small\item\em Opens a file for writing. \end{DoxyCompactList}\item
|
---|
| 73 | virtual bool {\bf isSequential} () const \label{classQuaZipFile_a64430ec50820c8096f963a7e5f53001f}
|
---|
| 74 |
|
---|
| 75 | \begin{DoxyCompactList}\small\item\em Returns {\ttfamily true}, but \doxyref{beware}{p.}{classQuaZipFile_quazipfile-sequential}! \end{DoxyCompactList}\item
|
---|
| 76 | virtual qint64 {\bf pos} () const
|
---|
| 77 | \begin{DoxyCompactList}\small\item\em Returns current position in the file. \end{DoxyCompactList}\item
|
---|
| 78 | virtual bool {\bf atEnd} () const
|
---|
| 79 | \begin{DoxyCompactList}\small\item\em Returns {\ttfamily true} if the end of file was reached. \end{DoxyCompactList}\item
|
---|
| 80 | virtual qint64 {\bf size} () const
|
---|
| 81 | \begin{DoxyCompactList}\small\item\em Returns file size. \end{DoxyCompactList}\item
|
---|
| 82 | qint64 {\bf csize} () const
|
---|
| 83 | \begin{DoxyCompactList}\small\item\em Returns compressed file size. \end{DoxyCompactList}\item
|
---|
| 84 | qint64 {\bf usize} () const
|
---|
| 85 | \begin{DoxyCompactList}\small\item\em Returns uncompressed file size. \end{DoxyCompactList}\item
|
---|
| 86 | bool {\bf getFileInfo} ({\bf QuaZipFileInfo} $\ast$info)
|
---|
| 87 | \begin{DoxyCompactList}\small\item\em Gets information about current file. \end{DoxyCompactList}\item
|
---|
| 88 | bool {\bf getFileInfo} ({\bf QuaZipFileInfo64} $\ast$info)
|
---|
| 89 | \begin{DoxyCompactList}\small\item\em Gets information about current file with zip64 support. \end{DoxyCompactList}\item
|
---|
| 90 | virtual void {\bf close} ()
|
---|
| 91 | \begin{DoxyCompactList}\small\item\em Closes the file. \end{DoxyCompactList}\item
|
---|
| 92 | int {\bf getZipError} () const \label{classQuaZipFile_a26d2ee56aad947193b73052f80597ef0}
|
---|
| 93 |
|
---|
| 94 | \begin{DoxyCompactList}\small\item\em Returns the error code returned by the last ZIP/UNZIP API call. \end{DoxyCompactList}\item
|
---|
| 95 | virtual qint64 {\bf bytesAvailable} () const \label{classQuaZipFile_a29fbfb34677f69394ae7c986ffd3a0c1}
|
---|
| 96 |
|
---|
| 97 | \begin{DoxyCompactList}\small\item\em Returns the number of bytes available for reading. \end{DoxyCompactList}\end{DoxyCompactItemize}
|
---|
| 98 | \subsection*{Protected Member Functions}
|
---|
| 99 | \begin{DoxyCompactItemize}
|
---|
| 100 | \item
|
---|
| 101 | qint64 {\bf readData} (char $\ast$data, qint64 maxSize)\label{classQuaZipFile_aa1f2274e1579327855a17d67a9046ec2}
|
---|
| 102 |
|
---|
| 103 | \begin{DoxyCompactList}\small\item\em Implementation of the {\bf QIODevice::readData()}. \end{DoxyCompactList}\item
|
---|
| 104 | qint64 {\bf writeData} (const char $\ast$data, qint64 maxSize)\label{classQuaZipFile_abd07949a6fcc2ef094d2be5398bc8e7c}
|
---|
| 105 |
|
---|
| 106 | \begin{DoxyCompactList}\small\item\em Implementation of the {\bf QIODevice::writeData()}. \end{DoxyCompactList}\end{DoxyCompactItemize}
|
---|
| 107 | \subsection*{Friends}
|
---|
| 108 | \begin{DoxyCompactItemize}
|
---|
| 109 | \item
|
---|
| 110 | class {\bf QuaZipFilePrivate}\label{classQuaZipFile_abeded291f2788ca39fe2256d78f95266}
|
---|
| 111 |
|
---|
| 112 | \end{DoxyCompactItemize}
|
---|
| 113 |
|
---|
| 114 |
|
---|
| 115 | \subsection{Detailed Description}
|
---|
| 116 | A file inside ZIP archive.
|
---|
| 117 |
|
---|
| 118 | This is the most interesting class. Not only it provides C++ interface to the ZIP/UNZIP package, but also integrates it with {\bf Qt} by subclassing {\bf QIODevice}. This makes possible to access files inside ZIP archive using {\bf QTextStream} or {\bf QDataStream}, for example. Actually, this is the main purpose of the whole QuaZIP library.
|
---|
| 119 |
|
---|
| 120 | You can either use existing \doxyref{QuaZip}{p.}{classQuaZip} instance to create instance of this class or pass ZIP archive file name to this class, in which case it will create internal \doxyref{QuaZip}{p.}{classQuaZip} object. See constructors' descriptions for details. Writing is only possible with the existing instance.
|
---|
| 121 |
|
---|
| 122 | Note that due to the underlying library's limitation it is not possible to use multiple \doxyref{QuaZipFile}{p.}{classQuaZipFile} instances to open several files in the same archive at the same time. If you need to write to multiple files in parallel, then you should write to temporary files first, then pack them all at once when you have finished writing. If you need to read multiple files inside the same archive in parallel, you should extract them all into a temporary directory first.\subsection{Sequential or random-\/access?}\label{classQuaZipFile_quazipfile-sequential}
|
---|
| 123 | At the first thought, \doxyref{QuaZipFile}{p.}{classQuaZipFile} has fixed size, the start and the end and should be therefore considered random-\/access device. But there is one major obstacle to making it random-\/access: ZIP/UNZIP API does not support {\bf seek()} operation and the only way to implement it is through reopening the file and re-\/reading to the required position, but this is prohibitively slow.
|
---|
| 124 |
|
---|
| 125 | Therefore, \doxyref{QuaZipFile}{p.}{classQuaZipFile} is considered to be a sequential device. This has advantage of availability of the {\bf ungetChar()} operation ({\bf QIODevice} does not implement it properly for non-\/sequential devices unless they support {\bf seek()}). Disadvantage is a somewhat strange behaviour of the \doxyref{size()}{p.}{classQuaZipFile_ad1a17cc690a01c3edfb82984c3a4c8f0} and \doxyref{pos()}{p.}{classQuaZipFile_a90fd55dab83eca7f95df50b2c41b7f22} functions. This should be kept in mind while using this class.
|
---|
| 126 |
|
---|
| 127 | \subsection{Constructor \& Destructor Documentation}
|
---|
| 128 | \index{QuaZipFile@{QuaZipFile}!QuaZipFile@{QuaZipFile}}
|
---|
| 129 | \index{QuaZipFile@{QuaZipFile}!QuaZipFile@{QuaZipFile}}
|
---|
| 130 | \subsubsection[{QuaZipFile}]{\setlength{\rightskip}{0pt plus 5cm}QuaZipFile::QuaZipFile (
|
---|
| 131 | \begin{DoxyParamCaption}
|
---|
| 132 | {}
|
---|
| 133 | \end{DoxyParamCaption}
|
---|
| 134 | )}\label{classQuaZipFile_ad31592e0e8a9eaa009c6c0e2040a2158}
|
---|
| 135 |
|
---|
| 136 |
|
---|
| 137 | Constructs a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance.
|
---|
| 138 |
|
---|
| 139 | You should use \doxyref{setZipName()}{p.}{classQuaZipFile_ac8109e9a5c19bea75982ff6986b5cb1e} and \doxyref{setFileName()}{p.}{classQuaZipFile_a3732ca7704379d457b6a27db8837de95} or \doxyref{setZip()}{p.}{classQuaZipFile_ab7939a26d1e8de2f6aca54f49a12b980} before trying to call \doxyref{open()}{p.}{classQuaZipFile_a4c20c0ef00ae79c9a59eafe2906c9384} on the constructed object. \index{QuaZipFile@{QuaZipFile}!QuaZipFile@{QuaZipFile}}
|
---|
| 140 | \index{QuaZipFile@{QuaZipFile}!QuaZipFile@{QuaZipFile}}
|
---|
| 141 | \subsubsection[{QuaZipFile}]{\setlength{\rightskip}{0pt plus 5cm}QuaZipFile::QuaZipFile (
|
---|
| 142 | \begin{DoxyParamCaption}
|
---|
| 143 | \item[{{\bf QObject} $\ast$}]{parent}
|
---|
| 144 | \end{DoxyParamCaption}
|
---|
| 145 | )}\label{classQuaZipFile_a1349ad27f1947bc3e346d83dbf9586c4}
|
---|
| 146 |
|
---|
| 147 |
|
---|
| 148 | Constructs a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance.
|
---|
| 149 |
|
---|
| 150 | {\itshape parent\/} argument specifies this object's parent object.
|
---|
| 151 |
|
---|
| 152 | You should use \doxyref{setZipName()}{p.}{classQuaZipFile_ac8109e9a5c19bea75982ff6986b5cb1e} and \doxyref{setFileName()}{p.}{classQuaZipFile_a3732ca7704379d457b6a27db8837de95} or \doxyref{setZip()}{p.}{classQuaZipFile_ab7939a26d1e8de2f6aca54f49a12b980} before trying to call \doxyref{open()}{p.}{classQuaZipFile_a4c20c0ef00ae79c9a59eafe2906c9384} on the constructed object. \index{QuaZipFile@{QuaZipFile}!QuaZipFile@{QuaZipFile}}
|
---|
| 153 | \index{QuaZipFile@{QuaZipFile}!QuaZipFile@{QuaZipFile}}
|
---|
| 154 | \subsubsection[{QuaZipFile}]{\setlength{\rightskip}{0pt plus 5cm}QuaZipFile::QuaZipFile (
|
---|
| 155 | \begin{DoxyParamCaption}
|
---|
| 156 | \item[{const {\bf QString} \&}]{zipName, }
|
---|
| 157 | \item[{{\bf QObject} $\ast$}]{parent = {\ttfamily NULL}}
|
---|
| 158 | \end{DoxyParamCaption}
|
---|
| 159 | )}\label{classQuaZipFile_ae614495d6b2404a6c59d7cfca5c3f6fd}
|
---|
| 160 |
|
---|
| 161 |
|
---|
| 162 | Constructs a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance.
|
---|
| 163 |
|
---|
| 164 | {\itshape parent\/} argument specifies this object's parent object and {\itshape zipName\/} specifies ZIP archive file name.
|
---|
| 165 |
|
---|
| 166 | You should use \doxyref{setFileName()}{p.}{classQuaZipFile_a3732ca7704379d457b6a27db8837de95} before trying to call \doxyref{open()}{p.}{classQuaZipFile_a4c20c0ef00ae79c9a59eafe2906c9384} on the constructed object.
|
---|
| 167 |
|
---|
| 168 | \doxyref{QuaZipFile}{p.}{classQuaZipFile} constructed by this constructor can be used for read only access. Use \doxyref{QuaZipFile(QuaZip$\ast$,QObject$\ast$)}{p.}{classQuaZipFile_a54e944a6b3d27030f64c8f30d2cc33bb} for writing. \index{QuaZipFile@{QuaZipFile}!QuaZipFile@{QuaZipFile}}
|
---|
| 169 | \index{QuaZipFile@{QuaZipFile}!QuaZipFile@{QuaZipFile}}
|
---|
| 170 | \subsubsection[{QuaZipFile}]{\setlength{\rightskip}{0pt plus 5cm}QuaZipFile::QuaZipFile (
|
---|
| 171 | \begin{DoxyParamCaption}
|
---|
| 172 | \item[{const {\bf QString} \&}]{zipName, }
|
---|
| 173 | \item[{const {\bf QString} \&}]{fileName, }
|
---|
| 174 | \item[{{\bf QuaZip::CaseSensitivity}}]{cs = {\ttfamily QuaZip::csDefault}, }
|
---|
| 175 | \item[{{\bf QObject} $\ast$}]{parent = {\ttfamily NULL}}
|
---|
| 176 | \end{DoxyParamCaption}
|
---|
| 177 | )}\label{classQuaZipFile_ac6e883b5a5d3a58c9c56eb497dd91220}
|
---|
| 178 |
|
---|
| 179 |
|
---|
| 180 | Constructs a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance.
|
---|
| 181 |
|
---|
| 182 | {\itshape parent\/} argument specifies this object's parent object, {\itshape zipName\/} specifies ZIP archive file name and {\itshape fileName\/} and {\itshape cs\/} specify a name of the file to open inside archive.
|
---|
| 183 |
|
---|
| 184 | \doxyref{QuaZipFile}{p.}{classQuaZipFile} constructed by this constructor can be used for read only access. Use \doxyref{QuaZipFile(QuaZip$\ast$,QObject$\ast$)}{p.}{classQuaZipFile_a54e944a6b3d27030f64c8f30d2cc33bb} for writing.
|
---|
| 185 |
|
---|
| 186 | \begin{DoxySeeAlso}{See also}
|
---|
| 187 | \doxyref{QuaZip::setCurrentFile()}{p.}{classQuaZip_a6c657bfcfccb59d728e0da24c677d899}
|
---|
| 188 | \end{DoxySeeAlso}
|
---|
| 189 | \index{QuaZipFile@{QuaZipFile}!QuaZipFile@{QuaZipFile}}
|
---|
| 190 | \index{QuaZipFile@{QuaZipFile}!QuaZipFile@{QuaZipFile}}
|
---|
| 191 | \subsubsection[{QuaZipFile}]{\setlength{\rightskip}{0pt plus 5cm}QuaZipFile::QuaZipFile (
|
---|
| 192 | \begin{DoxyParamCaption}
|
---|
| 193 | \item[{{\bf QuaZip} $\ast$}]{zip, }
|
---|
| 194 | \item[{{\bf QObject} $\ast$}]{parent = {\ttfamily NULL}}
|
---|
| 195 | \end{DoxyParamCaption}
|
---|
| 196 | )}\label{classQuaZipFile_a54e944a6b3d27030f64c8f30d2cc33bb}
|
---|
| 197 |
|
---|
| 198 |
|
---|
| 199 | Constructs a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance.
|
---|
| 200 |
|
---|
| 201 | {\itshape parent\/} argument specifies this object's parent object.
|
---|
| 202 |
|
---|
| 203 | {\itshape zip\/} is the pointer to the existing \doxyref{QuaZip}{p.}{classQuaZip} object. This \doxyref{QuaZipFile}{p.}{classQuaZipFile} object then can be used to read current file in the {\itshape zip\/} or to write to the file inside it.
|
---|
| 204 |
|
---|
| 205 | \begin{DoxyWarning}{Warning}
|
---|
| 206 | Using this constructor for reading current file can be tricky. Let's take the following example:
|
---|
| 207 | \begin{DoxyCode}
|
---|
| 208 | QuaZip zip("archive.zip");
|
---|
| 209 | zip.open(QuaZip::mdUnzip);
|
---|
| 210 | zip.setCurrentFile("file-in-archive");
|
---|
| 211 | QuaZipFile file(&zip);
|
---|
| 212 | file.open(QIODevice::ReadOnly);
|
---|
| 213 | // ok, now we can read from the file
|
---|
| 214 | file.read(somewhere, some);
|
---|
| 215 | zip.setCurrentFile("another-file-in-archive"); // oops...
|
---|
| 216 | QuaZipFile anotherFile(&zip);
|
---|
| 217 | anotherFile.open(QIODevice::ReadOnly);
|
---|
| 218 | anotherFile.read(somewhere, some); // this is still ok...
|
---|
| 219 | file.read(somewhere, some); // and this is NOT
|
---|
| 220 | \end{DoxyCode}
|
---|
| 221 | So, what exactly happens here? When we change current file in the {\ttfamily zip} archive, {\ttfamily file} that references it becomes invalid (actually, as far as I understand ZIP/UNZIP sources, it becomes closed, but \doxyref{QuaZipFile}{p.}{classQuaZipFile} has no means to detect it).
|
---|
| 222 | \end{DoxyWarning}
|
---|
| 223 | Summary: do not close {\ttfamily zip} object or change its current file as long as \doxyref{QuaZipFile}{p.}{classQuaZipFile} is open. Even better -\/ use another constructors which create internal \doxyref{QuaZip}{p.}{classQuaZip} instances, one per object, and therefore do not cause unnecessary trouble. This constructor may be useful, though, if you already have a \doxyref{QuaZip}{p.}{classQuaZip} instance and do not want to access several files at once. Good example:
|
---|
| 224 | \begin{DoxyCode}
|
---|
| 225 | QuaZip zip("archive.zip");
|
---|
| 226 | zip.open(QuaZip::mdUnzip);
|
---|
| 227 | // first, we need some information about archive itself
|
---|
| 228 | QByteArray comment=zip.getComment();
|
---|
| 229 | // and now we are going to access files inside it
|
---|
| 230 | QuaZipFile file(&zip);
|
---|
| 231 | for(bool more=zip.goToFirstFile(); more; more=zip.goToNextFile()) {
|
---|
| 232 | file.open(QIODevice::ReadOnly);
|
---|
| 233 | // do something cool with file here
|
---|
| 234 | file.close(); // do not forget to close!
|
---|
| 235 | }
|
---|
| 236 | zip.close();
|
---|
| 237 | \end{DoxyCode}
|
---|
| 238 | \index{QuaZipFile@{QuaZipFile}!$\sim$QuaZipFile@{$\sim$QuaZipFile}}
|
---|
| 239 | \index{$\sim$QuaZipFile@{$\sim$QuaZipFile}!QuaZipFile@{QuaZipFile}}
|
---|
| 240 | \subsubsection[{$\sim$QuaZipFile}]{\setlength{\rightskip}{0pt plus 5cm}QuaZipFile::$\sim$QuaZipFile (
|
---|
| 241 | \begin{DoxyParamCaption}
|
---|
| 242 | {}
|
---|
| 243 | \end{DoxyParamCaption}
|
---|
| 244 | )\hspace{0.3cm}{\ttfamily [virtual]}}\label{classQuaZipFile_aa1e5a0cf491bafae6cc73e649caa97fc}
|
---|
| 245 |
|
---|
| 246 |
|
---|
| 247 | Destroys a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance.
|
---|
| 248 |
|
---|
| 249 | Closes file if open, destructs internal \doxyref{QuaZip}{p.}{classQuaZip} object (if it exists and {\itshape is\/} internal, of course).
|
---|
| 250 |
|
---|
| 251 | References close(), and QIODevice::isOpen().
|
---|
| 252 |
|
---|
| 253 |
|
---|
| 254 |
|
---|
| 255 | \subsection{Member Function Documentation}
|
---|
| 256 | \index{QuaZipFile@{QuaZipFile}!getZipName@{getZipName}}
|
---|
| 257 | \index{getZipName@{getZipName}!QuaZipFile@{QuaZipFile}}
|
---|
| 258 | \subsubsection[{getZipName}]{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} QuaZipFile::getZipName (
|
---|
| 259 | \begin{DoxyParamCaption}
|
---|
| 260 | {}
|
---|
| 261 | \end{DoxyParamCaption}
|
---|
| 262 | ) const}\label{classQuaZipFile_a6f034a714aa94631367590de3f8f4e22}
|
---|
| 263 |
|
---|
| 264 |
|
---|
| 265 | Returns the ZIP archive file name.
|
---|
| 266 |
|
---|
| 267 | If this object was created by passing \doxyref{QuaZip}{p.}{classQuaZip} pointer to the constructor, this function will return that QuaZip's file name (or null string if that object does not have file name yet).
|
---|
| 268 |
|
---|
| 269 | Otherwise, returns associated ZIP archive file name or null string if there are no name set yet.
|
---|
| 270 |
|
---|
| 271 | \begin{DoxySeeAlso}{See also}
|
---|
| 272 | \doxyref{setZipName()}{p.}{classQuaZipFile_ac8109e9a5c19bea75982ff6986b5cb1e} \doxyref{getFileName()}{p.}{classQuaZipFile_a6999362e70a5b2396fba5cfb30095ff9}
|
---|
| 273 | \end{DoxySeeAlso}
|
---|
| 274 |
|
---|
| 275 |
|
---|
| 276 | References QuaZip::getZipName().
|
---|
| 277 |
|
---|
| 278 | \index{QuaZipFile@{QuaZipFile}!getZip@{getZip}}
|
---|
| 279 | \index{getZip@{getZip}!QuaZipFile@{QuaZipFile}}
|
---|
| 280 | \subsubsection[{getZip}]{\setlength{\rightskip}{0pt plus 5cm}{\bf QuaZip} $\ast$ QuaZipFile::getZip (
|
---|
| 281 | \begin{DoxyParamCaption}
|
---|
| 282 | {}
|
---|
| 283 | \end{DoxyParamCaption}
|
---|
| 284 | ) const}\label{classQuaZipFile_a72daf8a9da14907a801a783603003205}
|
---|
| 285 |
|
---|
| 286 |
|
---|
| 287 | Returns a pointer to the associated \doxyref{QuaZip}{p.}{classQuaZip} object.
|
---|
| 288 |
|
---|
| 289 | Returns {\ttfamily NULL} if there is no associated \doxyref{QuaZip}{p.}{classQuaZip} or it is internal (so you will not mess with it). \index{QuaZipFile@{QuaZipFile}!getFileName@{getFileName}}
|
---|
| 290 | \index{getFileName@{getFileName}!QuaZipFile@{QuaZipFile}}
|
---|
| 291 | \subsubsection[{getFileName}]{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} QuaZipFile::getFileName (
|
---|
| 292 | \begin{DoxyParamCaption}
|
---|
| 293 | {}
|
---|
| 294 | \end{DoxyParamCaption}
|
---|
| 295 | ) const}\label{classQuaZipFile_a6999362e70a5b2396fba5cfb30095ff9}
|
---|
| 296 |
|
---|
| 297 |
|
---|
| 298 | Returns file name.
|
---|
| 299 |
|
---|
| 300 | This function returns file name you passed to this object either by using \doxyref{QuaZipFile(const QString\&,const QString\&,QuaZip::CaseSensitivity,QObject$\ast$)}{p.}{classQuaZipFile_ac6e883b5a5d3a58c9c56eb497dd91220} or by calling \doxyref{setFileName()}{p.}{classQuaZipFile_a3732ca7704379d457b6a27db8837de95}. Real name of the file may differ in case if you used case-\/insensitivity.
|
---|
| 301 |
|
---|
| 302 | Returns null string if there is no file name set yet. This is the case when this \doxyref{QuaZipFile}{p.}{classQuaZipFile} operates on the existing \doxyref{QuaZip}{p.}{classQuaZip} object (constructor \doxyref{QuaZipFile(QuaZip$\ast$,QObject$\ast$)}{p.}{classQuaZipFile_a54e944a6b3d27030f64c8f30d2cc33bb} or \doxyref{setZip()}{p.}{classQuaZipFile_ab7939a26d1e8de2f6aca54f49a12b980} was used).
|
---|
| 303 |
|
---|
| 304 | \begin{DoxySeeAlso}{See also}
|
---|
| 305 | \doxyref{getActualFileName}{p.}{classQuaZipFile_a7b8e3c39026855cd98661a1b2815c220}
|
---|
| 306 | \end{DoxySeeAlso}
|
---|
| 307 | \index{QuaZipFile@{QuaZipFile}!getCaseSensitivity@{getCaseSensitivity}}
|
---|
| 308 | \index{getCaseSensitivity@{getCaseSensitivity}!QuaZipFile@{QuaZipFile}}
|
---|
| 309 | \subsubsection[{getCaseSensitivity}]{\setlength{\rightskip}{0pt plus 5cm}{\bf QuaZip::CaseSensitivity} QuaZipFile::getCaseSensitivity (
|
---|
| 310 | \begin{DoxyParamCaption}
|
---|
| 311 | {}
|
---|
| 312 | \end{DoxyParamCaption}
|
---|
| 313 | ) const}\label{classQuaZipFile_a25dbfddc589bf6b69b39905f3c3bcc73}
|
---|
| 314 |
|
---|
| 315 |
|
---|
| 316 | Returns case sensitivity of the file name.
|
---|
| 317 |
|
---|
| 318 | This function returns case sensitivity argument you passed to this object either by using \doxyref{QuaZipFile(const QString\&,const QString\&,QuaZip::CaseSensitivity,QObject$\ast$)}{p.}{classQuaZipFile_ac6e883b5a5d3a58c9c56eb497dd91220} or by calling \doxyref{setFileName()}{p.}{classQuaZipFile_a3732ca7704379d457b6a27db8837de95}.
|
---|
| 319 |
|
---|
| 320 | Returns unpredictable value if \doxyref{getFileName()}{p.}{classQuaZipFile_a6999362e70a5b2396fba5cfb30095ff9} returns null string (this is the case when you did not used \doxyref{setFileName()}{p.}{classQuaZipFile_a3732ca7704379d457b6a27db8837de95} or constructor above).
|
---|
| 321 |
|
---|
| 322 | \begin{DoxySeeAlso}{See also}
|
---|
| 323 | \doxyref{getFileName}{p.}{classQuaZipFile_a6999362e70a5b2396fba5cfb30095ff9}
|
---|
| 324 | \end{DoxySeeAlso}
|
---|
| 325 | \index{QuaZipFile@{QuaZipFile}!getActualFileName@{getActualFileName}}
|
---|
| 326 | \index{getActualFileName@{getActualFileName}!QuaZipFile@{QuaZipFile}}
|
---|
| 327 | \subsubsection[{getActualFileName}]{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} QuaZipFile::getActualFileName (
|
---|
| 328 | \begin{DoxyParamCaption}
|
---|
| 329 | {}
|
---|
| 330 | \end{DoxyParamCaption}
|
---|
| 331 | ) const}\label{classQuaZipFile_a7b8e3c39026855cd98661a1b2815c220}
|
---|
| 332 |
|
---|
| 333 |
|
---|
| 334 | Returns the actual file name in the archive.
|
---|
| 335 |
|
---|
| 336 | This is {\itshape not\/} a ZIP archive file name, but a name of file inside archive. It is not necessary the same name that you have passed to the \doxyref{QuaZipFile(const QString\&,const QString\&,QuaZip::CaseSensitivity,QObject$\ast$)}{p.}{classQuaZipFile_ac6e883b5a5d3a58c9c56eb497dd91220}, \doxyref{setFileName()}{p.}{classQuaZipFile_a3732ca7704379d457b6a27db8837de95} or \doxyref{QuaZip::setCurrentFile()}{p.}{classQuaZip_a6c657bfcfccb59d728e0da24c677d899} -\/ this is the real file name inside archive, so it may differ in case if the file name search was case-\/insensitive.
|
---|
| 337 |
|
---|
| 338 | Equivalent to calling getCurrentFileName() on the associated \doxyref{QuaZip}{p.}{classQuaZip} object. Returns null string if there is no associated \doxyref{QuaZip}{p.}{classQuaZip} object or if it does not have a current file yet. And this is the case if you called \doxyref{setFileName()}{p.}{classQuaZipFile_a3732ca7704379d457b6a27db8837de95} but did not open the file yet. So this is perfectly fine:
|
---|
| 339 | \begin{DoxyCode}
|
---|
| 340 | QuaZipFile file("somezip.zip");
|
---|
| 341 | file.setFileName("somefile");
|
---|
| 342 | QString name=file.getName(); // name=="somefile"
|
---|
| 343 | QString actual=file.getActualFileName(); // actual is null string
|
---|
| 344 | file.open(QIODevice::ReadOnly);
|
---|
| 345 | QString actual=file.getActualFileName(); // actual can be "SoMeFiLe" on Windows
|
---|
| 346 | \end{DoxyCode}
|
---|
| 347 |
|
---|
| 348 |
|
---|
| 349 | \begin{DoxySeeAlso}{See also}
|
---|
| 350 | \doxyref{getZipName()}{p.}{classQuaZipFile_a6f034a714aa94631367590de3f8f4e22}, \doxyref{getFileName()}{p.}{classQuaZipFile_a6999362e70a5b2396fba5cfb30095ff9}, \doxyref{QuaZip::CaseSensitivity}{p.}{classQuaZip_a6053a1d249ed210a85c9d5eb7cf9cdbe}
|
---|
| 351 | \end{DoxySeeAlso}
|
---|
| 352 |
|
---|
| 353 |
|
---|
| 354 | References QuaZip::getCurrentFileName(), QuaZip::getZipError(), QString::isNull(), and QIODevice::openMode().
|
---|
| 355 |
|
---|
| 356 | \index{QuaZipFile@{QuaZipFile}!setZipName@{setZipName}}
|
---|
| 357 | \index{setZipName@{setZipName}!QuaZipFile@{QuaZipFile}}
|
---|
| 358 | \subsubsection[{setZipName}]{\setlength{\rightskip}{0pt plus 5cm}void QuaZipFile::setZipName (
|
---|
| 359 | \begin{DoxyParamCaption}
|
---|
| 360 | \item[{const {\bf QString} \&}]{zipName}
|
---|
| 361 | \end{DoxyParamCaption}
|
---|
| 362 | )}\label{classQuaZipFile_ac8109e9a5c19bea75982ff6986b5cb1e}
|
---|
| 363 |
|
---|
| 364 |
|
---|
| 365 | Sets the ZIP archive file name.
|
---|
| 366 |
|
---|
| 367 | Automatically creates internal \doxyref{QuaZip}{p.}{classQuaZip} object and destroys previously created internal \doxyref{QuaZip}{p.}{classQuaZip} object, if any.
|
---|
| 368 |
|
---|
| 369 | Will do nothing if this file is already open. You must \doxyref{close()}{p.}{classQuaZipFile_a42a39b12619bccd3d419ee60bbb3fcf6} it first.
|
---|
| 370 |
|
---|
| 371 | References QIODevice::isOpen().
|
---|
| 372 |
|
---|
| 373 | \index{QuaZipFile@{QuaZipFile}!isRaw@{isRaw}}
|
---|
| 374 | \index{isRaw@{isRaw}!QuaZipFile@{QuaZipFile}}
|
---|
| 375 | \subsubsection[{isRaw}]{\setlength{\rightskip}{0pt plus 5cm}bool QuaZipFile::isRaw (
|
---|
| 376 | \begin{DoxyParamCaption}
|
---|
| 377 | {}
|
---|
| 378 | \end{DoxyParamCaption}
|
---|
| 379 | ) const}\label{classQuaZipFile_a0df3db94c2a34c8d17ddaa0f54fc32c1}
|
---|
| 380 |
|
---|
| 381 |
|
---|
| 382 | Returns {\ttfamily true} if the file was opened in raw mode.
|
---|
| 383 |
|
---|
| 384 | If the file is not open, the returned value is undefined.
|
---|
| 385 |
|
---|
| 386 | \begin{DoxySeeAlso}{See also}
|
---|
| 387 | \doxyref{open(OpenMode,int$\ast$,int$\ast$,bool,const char$\ast$)}{p.}{classQuaZipFile_aed75bace51f2bb4c3e4f656ab4493aac}
|
---|
| 388 | \end{DoxySeeAlso}
|
---|
| 389 |
|
---|
| 390 |
|
---|
| 391 | Referenced by close().
|
---|
| 392 |
|
---|
| 393 | \index{QuaZipFile@{QuaZipFile}!setZip@{setZip}}
|
---|
| 394 | \index{setZip@{setZip}!QuaZipFile@{QuaZipFile}}
|
---|
| 395 | \subsubsection[{setZip}]{\setlength{\rightskip}{0pt plus 5cm}void QuaZipFile::setZip (
|
---|
| 396 | \begin{DoxyParamCaption}
|
---|
| 397 | \item[{{\bf QuaZip} $\ast$}]{zip}
|
---|
| 398 | \end{DoxyParamCaption}
|
---|
| 399 | )}\label{classQuaZipFile_ab7939a26d1e8de2f6aca54f49a12b980}
|
---|
| 400 |
|
---|
| 401 |
|
---|
| 402 | Binds to the existing \doxyref{QuaZip}{p.}{classQuaZip} instance.
|
---|
| 403 |
|
---|
| 404 | This function destroys internal \doxyref{QuaZip}{p.}{classQuaZip} object, if any, and makes this \doxyref{QuaZipFile}{p.}{classQuaZipFile} to use current file in the {\itshape zip\/} object for any further operations. See \doxyref{QuaZipFile(QuaZip$\ast$,QObject$\ast$)}{p.}{classQuaZipFile_a54e944a6b3d27030f64c8f30d2cc33bb} for the possible pitfalls.
|
---|
| 405 |
|
---|
| 406 | Will do nothing if the file is currently open. You must \doxyref{close()}{p.}{classQuaZipFile_a42a39b12619bccd3d419ee60bbb3fcf6} it first.
|
---|
| 407 |
|
---|
| 408 | References QIODevice::isOpen().
|
---|
| 409 |
|
---|
| 410 | \index{QuaZipFile@{QuaZipFile}!setFileName@{setFileName}}
|
---|
| 411 | \index{setFileName@{setFileName}!QuaZipFile@{QuaZipFile}}
|
---|
| 412 | \subsubsection[{setFileName}]{\setlength{\rightskip}{0pt plus 5cm}void QuaZipFile::setFileName (
|
---|
| 413 | \begin{DoxyParamCaption}
|
---|
| 414 | \item[{const {\bf QString} \&}]{fileName, }
|
---|
| 415 | \item[{{\bf QuaZip::CaseSensitivity}}]{cs = {\ttfamily QuaZip::csDefault}}
|
---|
| 416 | \end{DoxyParamCaption}
|
---|
| 417 | )}\label{classQuaZipFile_a3732ca7704379d457b6a27db8837de95}
|
---|
| 418 |
|
---|
| 419 |
|
---|
| 420 | Sets the file name.
|
---|
| 421 |
|
---|
| 422 | Will do nothing if at least one of the following conditions is met:
|
---|
| 423 | \begin{DoxyItemize}
|
---|
| 424 | \item ZIP name has not been set yet (\doxyref{getZipName()}{p.}{classQuaZipFile_a6f034a714aa94631367590de3f8f4e22} returns null string).
|
---|
| 425 | \item This \doxyref{QuaZipFile}{p.}{classQuaZipFile} is associated with external \doxyref{QuaZip}{p.}{classQuaZip}. In this case you should call that QuaZip's setCurrentFile() function instead!
|
---|
| 426 | \item File is already open so setting the name is meaningless.
|
---|
| 427 | \end{DoxyItemize}
|
---|
| 428 |
|
---|
| 429 | \begin{DoxySeeAlso}{See also}
|
---|
| 430 | \doxyref{QuaZip::setCurrentFile}{p.}{classQuaZip_a6c657bfcfccb59d728e0da24c677d899}
|
---|
| 431 | \end{DoxySeeAlso}
|
---|
| 432 |
|
---|
| 433 |
|
---|
| 434 | References QIODevice::isOpen(), QString::mid(), and QString::startsWith().
|
---|
| 435 |
|
---|
| 436 | \index{QuaZipFile@{QuaZipFile}!open@{open}}
|
---|
| 437 | \index{open@{open}!QuaZipFile@{QuaZipFile}}
|
---|
| 438 | \subsubsection[{open}]{\setlength{\rightskip}{0pt plus 5cm}bool QuaZipFile::open (
|
---|
| 439 | \begin{DoxyParamCaption}
|
---|
| 440 | \item[{{\bf OpenMode}}]{mode}
|
---|
| 441 | \end{DoxyParamCaption}
|
---|
| 442 | )\hspace{0.3cm}{\ttfamily [virtual]}}\label{classQuaZipFile_a4c20c0ef00ae79c9a59eafe2906c9384}
|
---|
| 443 |
|
---|
| 444 |
|
---|
| 445 | Opens a file for reading.
|
---|
| 446 |
|
---|
| 447 | Returns {\ttfamily true} on success, {\ttfamily false} otherwise. Call \doxyref{getZipError()}{p.}{classQuaZipFile_a26d2ee56aad947193b73052f80597ef0} to get error code.
|
---|
| 448 |
|
---|
| 449 | \begin{DoxyNote}{Note}
|
---|
| 450 | Since ZIP/UNZIP API provides buffered reading only, \doxyref{QuaZipFile}{p.}{classQuaZipFile} does not support unbuffered reading. So do not pass QIODevice::Unbuffered flag in {\itshape mode\/}, or open will fail.
|
---|
| 451 | \end{DoxyNote}
|
---|
| 452 |
|
---|
| 453 |
|
---|
| 454 | Reimplemented from {\bf QIODevice}.
|
---|
| 455 |
|
---|
| 456 | \index{QuaZipFile@{QuaZipFile}!open@{open}}
|
---|
| 457 | \index{open@{open}!QuaZipFile@{QuaZipFile}}
|
---|
| 458 | \subsubsection[{open}]{\setlength{\rightskip}{0pt plus 5cm}bool QuaZipFile::open (
|
---|
| 459 | \begin{DoxyParamCaption}
|
---|
| 460 | \item[{{\bf OpenMode}}]{mode, }
|
---|
| 461 | \item[{const char $\ast$}]{password}
|
---|
| 462 | \end{DoxyParamCaption}
|
---|
| 463 | )\hspace{0.3cm}{\ttfamily [inline]}}\label{classQuaZipFile_a0bff0d15bbcd70306dc4a553a55776b9}
|
---|
| 464 |
|
---|
| 465 |
|
---|
| 466 | Opens a file for reading.
|
---|
| 467 |
|
---|
| 468 | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Argument {\itshape password\/} specifies a password to decrypt the file. If it is NULL then this function behaves just like \doxyref{open(OpenMode)}{p.}{classQuaZipFile_a4c20c0ef00ae79c9a59eafe2906c9384}.
|
---|
| 469 |
|
---|
| 470 | References open().
|
---|
| 471 |
|
---|
| 472 |
|
---|
| 473 |
|
---|
| 474 | Referenced by open().
|
---|
| 475 |
|
---|
| 476 | \index{QuaZipFile@{QuaZipFile}!open@{open}}
|
---|
| 477 | \index{open@{open}!QuaZipFile@{QuaZipFile}}
|
---|
| 478 | \subsubsection[{open}]{\setlength{\rightskip}{0pt plus 5cm}bool QuaZipFile::open (
|
---|
| 479 | \begin{DoxyParamCaption}
|
---|
| 480 | \item[{{\bf OpenMode}}]{mode, }
|
---|
| 481 | \item[{int $\ast$}]{method, }
|
---|
| 482 | \item[{int $\ast$}]{level, }
|
---|
| 483 | \item[{bool}]{raw, }
|
---|
| 484 | \item[{const char $\ast$}]{password = {\ttfamily NULL}}
|
---|
| 485 | \end{DoxyParamCaption}
|
---|
| 486 | )}\label{classQuaZipFile_aed75bace51f2bb4c3e4f656ab4493aac}
|
---|
| 487 |
|
---|
| 488 |
|
---|
| 489 | Opens a file for reading.
|
---|
| 490 |
|
---|
| 491 | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Argument {\itshape password\/} specifies a password to decrypt the file.
|
---|
| 492 |
|
---|
| 493 | An integers pointed by {\itshape method\/} and {\itshape level\/} will receive codes of the compression method and level used. See unzip.h.
|
---|
| 494 |
|
---|
| 495 | If raw is {\ttfamily true} then no decompression is performed.
|
---|
| 496 |
|
---|
| 497 | {\itshape method\/} should not be {\ttfamily NULL}. {\itshape level\/} can be {\ttfamily NULL} if you don't want to know the compression level.
|
---|
| 498 |
|
---|
| 499 | References QuaZip::close(), QuaZip::getMode(), QuaZip::getUnzFile(), QuaZip::getZipError(), QuaZip::hasCurrentFile(), QIODevice::isOpen(), QuaZip::mdUnzip, QuaZip::open(), QuaZip::setCurrentFile(), and QIODevice::setOpenMode().
|
---|
| 500 |
|
---|
| 501 | \index{QuaZipFile@{QuaZipFile}!open@{open}}
|
---|
| 502 | \index{open@{open}!QuaZipFile@{QuaZipFile}}
|
---|
| 503 | \subsubsection[{open}]{\setlength{\rightskip}{0pt plus 5cm}bool QuaZipFile::open (
|
---|
| 504 | \begin{DoxyParamCaption}
|
---|
| 505 | \item[{{\bf OpenMode}}]{mode, }
|
---|
| 506 | \item[{const {\bf QuaZipNewInfo} \&}]{info, }
|
---|
| 507 | \item[{const char $\ast$}]{password = {\ttfamily NULL}, }
|
---|
| 508 | \item[{quint32}]{crc = {\ttfamily 0}, }
|
---|
| 509 | \item[{int}]{method = {\ttfamily Z\_\-DEFLATED}, }
|
---|
| 510 | \item[{int}]{level = {\ttfamily Z\_\-DEFAULT\_\-COMPRESSION}, }
|
---|
| 511 | \item[{bool}]{raw = {\ttfamily false}, }
|
---|
| 512 | \item[{int}]{windowBits = {\ttfamily -\/MAX\_\-WBITS}, }
|
---|
| 513 | \item[{int}]{memLevel = {\ttfamily DEF\_\-MEM\_\-LEVEL}, }
|
---|
| 514 | \item[{int}]{strategy = {\ttfamily Z\_\-DEFAULT\_\-STRATEGY}}
|
---|
| 515 | \end{DoxyParamCaption}
|
---|
| 516 | )}\label{classQuaZipFile_a2429ea59c77371d7af56d739db130b18}
|
---|
| 517 |
|
---|
| 518 |
|
---|
| 519 | Opens a file for writing.
|
---|
| 520 |
|
---|
| 521 | {\itshape info\/} argument specifies information about file. It should at least specify a correct file name. Also, it is a good idea to specify correct timestamp (by default, current time will be used). See \doxyref{QuaZipNewInfo}{p.}{structQuaZipNewInfo}.
|
---|
| 522 |
|
---|
| 523 | The {\itshape password\/} argument specifies the password for crypting. Pass NULL if you don't need any crypting. The {\itshape crc\/} argument was supposed to be used for crypting too, but then it turned out that it's false information, so you need to set it to 0 unless you want to use the raw mode (see below).
|
---|
| 524 |
|
---|
| 525 | Arguments {\itshape method\/} and {\itshape level\/} specify compression method and level. The only method supported is Z\_\-DEFLATED, but you may also specify 0 for no compression. If all of the files in the archive use both method 0 and either level 0 is explicitly specified or data descriptor writing is disabled with \doxyref{QuaZip::setDataDescriptorWritingEnabled()}{p.}{classQuaZip_a6c23a12af88f7ea5edd4f9c0a24b9453}, then the resulting archive is supposed to be compatible with the 1.0 ZIP format version, should you need that. Except for this, {\itshape level\/} has no other effects with method 0.
|
---|
| 526 |
|
---|
| 527 | If {\itshape raw\/} is {\ttfamily true}, no compression is performed. In this case, {\itshape crc\/} and uncompressedSize field of the {\itshape info\/} are required.
|
---|
| 528 |
|
---|
| 529 | Arguments {\itshape windowBits\/}, {\itshape memLevel\/}, {\itshape strategy\/} provide zlib algorithms tuning. See deflateInit2() in zlib.
|
---|
| 530 |
|
---|
| 531 | References QuaZipNewInfo::comment, QByteArray::constData(), QDateTime::date(), QuaZipNewInfo::dateTime, QDate::day(), QuaZipNewInfo::externalAttr, QuaZipNewInfo::extraGlobal, QuaZipNewInfo::extraLocal, QTextCodec::fromUnicode(), QuaZip::getCommentCodec(), QuaZip::getFileNameCodec(), QuaZip::getMode(), QuaZip::getZipFile(), QTime::hour(), QuaZipNewInfo::internalAttr, QuaZip::isDataDescriptorWritingEnabled(), QIODevice::isOpen(), QuaZip::isZip64Enabled(), QByteArray::length(), QuaZip::mdAdd, QuaZip::mdAppend, QuaZip::mdCreate, QTime::minute(), QDate::month(), QuaZipNewInfo::name, QTime::second(), QIODevice::setOpenMode(), QDateTime::time(), QuaZipNewInfo::uncompressedSize, and QDate::year().
|
---|
| 532 |
|
---|
| 533 | \index{QuaZipFile@{QuaZipFile}!pos@{pos}}
|
---|
| 534 | \index{pos@{pos}!QuaZipFile@{QuaZipFile}}
|
---|
| 535 | \subsubsection[{pos}]{\setlength{\rightskip}{0pt plus 5cm}qint64 QuaZipFile::pos (
|
---|
| 536 | \begin{DoxyParamCaption}
|
---|
| 537 | {}
|
---|
| 538 | \end{DoxyParamCaption}
|
---|
| 539 | ) const\hspace{0.3cm}{\ttfamily [virtual]}}\label{classQuaZipFile_a90fd55dab83eca7f95df50b2c41b7f22}
|
---|
| 540 |
|
---|
| 541 |
|
---|
| 542 | Returns current position in the file.
|
---|
| 543 |
|
---|
| 544 | Implementation of the {\bf QIODevice::pos()}. When reading, this function is a wrapper to the ZIP/UNZIP unztell(), therefore it is unable to keep track of the {\bf ungetChar()} calls (which is non-\/virtual and therefore is dangerous to reimplement). So if you are using {\bf ungetChar()} feature of the {\bf QIODevice}, this function reports incorrect value until you get back characters which you ungot.
|
---|
| 545 |
|
---|
| 546 | When writing, \doxyref{pos()}{p.}{classQuaZipFile_a90fd55dab83eca7f95df50b2c41b7f22} returns number of bytes already written (uncompressed unless you use raw mode).
|
---|
| 547 |
|
---|
| 548 | \begin{DoxyNote}{Note}
|
---|
| 549 | Although \doxyref{QuaZipFile is a sequential device}{p.}{classQuaZipFile_quazipfile-sequential} and therefore \doxyref{pos()}{p.}{classQuaZipFile_a90fd55dab83eca7f95df50b2c41b7f22} should always return zero, it does not, because it would be misguiding. Keep this in mind.
|
---|
| 550 | \end{DoxyNote}
|
---|
| 551 | This function returns -\/1 if the file or archive is not open.
|
---|
| 552 |
|
---|
| 553 | Error code returned by \doxyref{getZipError()}{p.}{classQuaZipFile_a26d2ee56aad947193b73052f80597ef0} is not affected by this function call.
|
---|
| 554 |
|
---|
| 555 | Reimplemented from {\bf QIODevice}.
|
---|
| 556 |
|
---|
| 557 |
|
---|
| 558 |
|
---|
| 559 | References QIODevice::bytesAvailable(), QuaZip::getUnzFile(), QIODevice::isOpen(), and QIODevice::openMode().
|
---|
| 560 |
|
---|
| 561 |
|
---|
| 562 |
|
---|
| 563 | Referenced by bytesAvailable().
|
---|
| 564 |
|
---|
| 565 | \index{QuaZipFile@{QuaZipFile}!atEnd@{atEnd}}
|
---|
| 566 | \index{atEnd@{atEnd}!QuaZipFile@{QuaZipFile}}
|
---|
| 567 | \subsubsection[{atEnd}]{\setlength{\rightskip}{0pt plus 5cm}bool QuaZipFile::atEnd (
|
---|
| 568 | \begin{DoxyParamCaption}
|
---|
| 569 | {}
|
---|
| 570 | \end{DoxyParamCaption}
|
---|
| 571 | ) const\hspace{0.3cm}{\ttfamily [virtual]}}\label{classQuaZipFile_a1e3f4c3c075da98af426fc167440cfc3}
|
---|
| 572 |
|
---|
| 573 |
|
---|
| 574 | Returns {\ttfamily true} if the end of file was reached.
|
---|
| 575 |
|
---|
| 576 | This function returns {\ttfamily false} in the case of error. This means that you called this function on either not open file, or a file in the not open archive or even on a \doxyref{QuaZipFile}{p.}{classQuaZipFile} instance that does not even have \doxyref{QuaZip}{p.}{classQuaZip} instance associated. Do not do that because there is no means to determine whether {\ttfamily false} is returned because of error or because end of file was reached. Well, on the other side you may interpret {\ttfamily false} return value as \char`\"{}there is no file open to check for end of file and there is
|
---|
| 577 | no end of file therefore\char`\"{}.
|
---|
| 578 |
|
---|
| 579 | When writing, this function always returns {\ttfamily true} (because you are always writing to the end of file).
|
---|
| 580 |
|
---|
| 581 | Error code returned by \doxyref{getZipError()}{p.}{classQuaZipFile_a26d2ee56aad947193b73052f80597ef0} is not affected by this function call.
|
---|
| 582 |
|
---|
| 583 | Reimplemented from {\bf QIODevice}.
|
---|
| 584 |
|
---|
| 585 |
|
---|
| 586 |
|
---|
| 587 | References bytesAvailable(), QuaZip::getUnzFile(), QIODevice::isOpen(), and QIODevice::openMode().
|
---|
| 588 |
|
---|
| 589 | \index{QuaZipFile@{QuaZipFile}!size@{size}}
|
---|
| 590 | \index{size@{size}!QuaZipFile@{QuaZipFile}}
|
---|
| 591 | \subsubsection[{size}]{\setlength{\rightskip}{0pt plus 5cm}qint64 QuaZipFile::size (
|
---|
| 592 | \begin{DoxyParamCaption}
|
---|
| 593 | {}
|
---|
| 594 | \end{DoxyParamCaption}
|
---|
| 595 | ) const\hspace{0.3cm}{\ttfamily [virtual]}}\label{classQuaZipFile_ad1a17cc690a01c3edfb82984c3a4c8f0}
|
---|
| 596 |
|
---|
| 597 |
|
---|
| 598 | Returns file size.
|
---|
| 599 |
|
---|
| 600 | This function returns \doxyref{csize()}{p.}{classQuaZipFile_ac4da08e5cdec368a2a686775f7dc5639} if the file is open for reading in raw mode, \doxyref{usize()}{p.}{classQuaZipFile_a4814b5e6e39fb254737b81ea10964f50} if it is open for reading in normal mode and \doxyref{pos()}{p.}{classQuaZipFile_a90fd55dab83eca7f95df50b2c41b7f22} if it is open for writing.
|
---|
| 601 |
|
---|
| 602 | Returns -\/1 on error, call \doxyref{getZipError()}{p.}{classQuaZipFile_a26d2ee56aad947193b73052f80597ef0} to get error code.
|
---|
| 603 |
|
---|
| 604 | \begin{DoxyNote}{Note}
|
---|
| 605 | This function returns file size despite that \doxyref{QuaZipFile is considered to be sequential device}{p.}{classQuaZipFile_quazipfile-sequential}, for which \doxyref{size()}{p.}{classQuaZipFile_ad1a17cc690a01c3edfb82984c3a4c8f0} should return \doxyref{bytesAvailable()}{p.}{classQuaZipFile_a29fbfb34677f69394ae7c986ffd3a0c1} instead. But its name would be very misguiding otherwise, so just keep in mind this inconsistence.
|
---|
| 606 | \end{DoxyNote}
|
---|
| 607 |
|
---|
| 608 |
|
---|
| 609 | Reimplemented from {\bf QIODevice}.
|
---|
| 610 |
|
---|
| 611 |
|
---|
| 612 |
|
---|
| 613 | References csize(), QIODevice::isOpen(), QIODevice::openMode(), and usize().
|
---|
| 614 |
|
---|
| 615 |
|
---|
| 616 |
|
---|
| 617 | Referenced by bytesAvailable().
|
---|
| 618 |
|
---|
| 619 | \index{QuaZipFile@{QuaZipFile}!csize@{csize}}
|
---|
| 620 | \index{csize@{csize}!QuaZipFile@{QuaZipFile}}
|
---|
| 621 | \subsubsection[{csize}]{\setlength{\rightskip}{0pt plus 5cm}qint64 QuaZipFile::csize (
|
---|
| 622 | \begin{DoxyParamCaption}
|
---|
| 623 | {}
|
---|
| 624 | \end{DoxyParamCaption}
|
---|
| 625 | ) const}\label{classQuaZipFile_ac4da08e5cdec368a2a686775f7dc5639}
|
---|
| 626 |
|
---|
| 627 |
|
---|
| 628 | Returns compressed file size.
|
---|
| 629 |
|
---|
| 630 | Equivalent to calling \doxyref{getFileInfo()}{p.}{classQuaZipFile_ad3f5807329321be21b12c1ba5798b359} and then getting compressedSize field, but more convenient and faster.
|
---|
| 631 |
|
---|
| 632 | File must be open for reading before calling this function.
|
---|
| 633 |
|
---|
| 634 | Returns -\/1 on error, call \doxyref{getZipError()}{p.}{classQuaZipFile_a26d2ee56aad947193b73052f80597ef0} to get error code.
|
---|
| 635 |
|
---|
| 636 | References QuaZip::getMode(), QuaZip::getUnzFile(), and QuaZip::mdUnzip.
|
---|
| 637 |
|
---|
| 638 |
|
---|
| 639 |
|
---|
| 640 | Referenced by size().
|
---|
| 641 |
|
---|
| 642 | \index{QuaZipFile@{QuaZipFile}!usize@{usize}}
|
---|
| 643 | \index{usize@{usize}!QuaZipFile@{QuaZipFile}}
|
---|
| 644 | \subsubsection[{usize}]{\setlength{\rightskip}{0pt plus 5cm}qint64 QuaZipFile::usize (
|
---|
| 645 | \begin{DoxyParamCaption}
|
---|
| 646 | {}
|
---|
| 647 | \end{DoxyParamCaption}
|
---|
| 648 | ) const}\label{classQuaZipFile_a4814b5e6e39fb254737b81ea10964f50}
|
---|
| 649 |
|
---|
| 650 |
|
---|
| 651 | Returns uncompressed file size.
|
---|
| 652 |
|
---|
| 653 | Equivalent to calling \doxyref{getFileInfo()}{p.}{classQuaZipFile_ad3f5807329321be21b12c1ba5798b359} and then getting uncompressedSize field, but more convenient and faster. See \doxyref{getFileInfo()}{p.}{classQuaZipFile_ad3f5807329321be21b12c1ba5798b359} for a warning.
|
---|
| 654 |
|
---|
| 655 | File must be open for reading before calling this function.
|
---|
| 656 |
|
---|
| 657 | Returns -\/1 on error, call \doxyref{getZipError()}{p.}{classQuaZipFile_a26d2ee56aad947193b73052f80597ef0} to get error code.
|
---|
| 658 |
|
---|
| 659 | References QuaZip::getMode(), QuaZip::getUnzFile(), and QuaZip::mdUnzip.
|
---|
| 660 |
|
---|
| 661 |
|
---|
| 662 |
|
---|
| 663 | Referenced by size().
|
---|
| 664 |
|
---|
| 665 | \index{QuaZipFile@{QuaZipFile}!getFileInfo@{getFileInfo}}
|
---|
| 666 | \index{getFileInfo@{getFileInfo}!QuaZipFile@{QuaZipFile}}
|
---|
| 667 | \subsubsection[{getFileInfo}]{\setlength{\rightskip}{0pt plus 5cm}bool QuaZipFile::getFileInfo (
|
---|
| 668 | \begin{DoxyParamCaption}
|
---|
| 669 | \item[{{\bf QuaZipFileInfo} $\ast$}]{info}
|
---|
| 670 | \end{DoxyParamCaption}
|
---|
| 671 | )}\label{classQuaZipFile_ad3f5807329321be21b12c1ba5798b359}
|
---|
| 672 |
|
---|
| 673 |
|
---|
| 674 | Gets information about current file.
|
---|
| 675 |
|
---|
| 676 | This function does the same thing as calling \doxyref{QuaZip::getCurrentFileInfo()}{p.}{classQuaZip_a9c91a53ed4c2038e153c64bdc097ebe8} on the associated \doxyref{QuaZip}{p.}{classQuaZip} object, but you can not call getCurrentFileInfo() if the associated \doxyref{QuaZip}{p.}{classQuaZip} is internal (because you do not have access to it), while you still can call this function in that case.
|
---|
| 677 |
|
---|
| 678 | File must be open for reading before calling this function.
|
---|
| 679 |
|
---|
| 680 | \begin{DoxyReturn}{Returns}
|
---|
| 681 | {\ttfamily false} in the case of an error.
|
---|
| 682 | \end{DoxyReturn}
|
---|
| 683 | This function doesn't support zip64, but will still work fine on zip64 archives if file sizes are below 4 GB, otherwise the values will be set as if converted using \doxyref{QuaZipFileInfo64::toQuaZipFileInfo()}{p.}{structQuaZipFileInfo64_ada29945c7ee4c9df6fbe95864793aade}.
|
---|
| 684 |
|
---|
| 685 | \begin{DoxySeeAlso}{See also}
|
---|
| 686 | \doxyref{getFileInfo(QuaZipFileInfo64$\ast$)}{p.}{classQuaZipFile_af35876a5ac6e9c35234275a9e503110d}
|
---|
| 687 | \end{DoxySeeAlso}
|
---|
| 688 |
|
---|
| 689 |
|
---|
| 690 | References QuaZipFileInfo64::toQuaZipFileInfo().
|
---|
| 691 |
|
---|
| 692 | \index{QuaZipFile@{QuaZipFile}!getFileInfo@{getFileInfo}}
|
---|
| 693 | \index{getFileInfo@{getFileInfo}!QuaZipFile@{QuaZipFile}}
|
---|
| 694 | \subsubsection[{getFileInfo}]{\setlength{\rightskip}{0pt plus 5cm}bool QuaZipFile::getFileInfo (
|
---|
| 695 | \begin{DoxyParamCaption}
|
---|
| 696 | \item[{{\bf QuaZipFileInfo64} $\ast$}]{info}
|
---|
| 697 | \end{DoxyParamCaption}
|
---|
| 698 | )}\label{classQuaZipFile_af35876a5ac6e9c35234275a9e503110d}
|
---|
| 699 |
|
---|
| 700 |
|
---|
| 701 | Gets information about current file with zip64 support.
|
---|
| 702 |
|
---|
| 703 | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. \begin{DoxySeeAlso}{See also}
|
---|
| 704 | \doxyref{getFileInfo(QuaZipFileInfo$\ast$)}{p.}{classQuaZipFile_ad3f5807329321be21b12c1ba5798b359}
|
---|
| 705 | \end{DoxySeeAlso}
|
---|
| 706 |
|
---|
| 707 |
|
---|
| 708 | References QuaZip::getCurrentFileInfo(), QuaZip::getMode(), QuaZip::getZipError(), and QuaZip::mdUnzip.
|
---|
| 709 |
|
---|
| 710 | \index{QuaZipFile@{QuaZipFile}!close@{close}}
|
---|
| 711 | \index{close@{close}!QuaZipFile@{QuaZipFile}}
|
---|
| 712 | \subsubsection[{close}]{\setlength{\rightskip}{0pt plus 5cm}void QuaZipFile::close (
|
---|
| 713 | \begin{DoxyParamCaption}
|
---|
| 714 | {}
|
---|
| 715 | \end{DoxyParamCaption}
|
---|
| 716 | )\hspace{0.3cm}{\ttfamily [virtual]}}\label{classQuaZipFile_a42a39b12619bccd3d419ee60bbb3fcf6}
|
---|
| 717 |
|
---|
| 718 |
|
---|
| 719 | Closes the file.
|
---|
| 720 |
|
---|
| 721 | Call \doxyref{getZipError()}{p.}{classQuaZipFile_a26d2ee56aad947193b73052f80597ef0} to determine if the close was successful.
|
---|
| 722 |
|
---|
| 723 | Reimplemented from {\bf QIODevice}.
|
---|
| 724 |
|
---|
| 725 |
|
---|
| 726 |
|
---|
| 727 | References QuaZip::close(), QuaZip::getUnzFile(), QuaZip::getZipError(), QuaZip::getZipFile(), QIODevice::isOpen(), QuaZip::isOpen(), isRaw(), QIODevice::openMode(), and QIODevice::setOpenMode().
|
---|
| 728 |
|
---|
| 729 |
|
---|
| 730 |
|
---|
| 731 | Referenced by $\sim$QuaZipFile().
|
---|
| 732 |
|
---|
| 733 |
|
---|
| 734 |
|
---|
| 735 | The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
|
---|
| 736 | \item
|
---|
| 737 | quazip/quazipfile.h\item
|
---|
| 738 | quazip/quazipfile.cpp\end{DoxyCompactItemize}
|
---|