1 |
\section{QuaZIODevice Class Reference} |
2 |
\label{classQuaZIODevice}\index{QuaZIODevice@{QuaZIODevice}} |
3 |
|
4 |
|
5 |
A class to compress/decompress {\bf QIODevice}. |
6 |
|
7 |
|
8 |
|
9 |
|
10 |
{\ttfamily \#include $<$quaziodevice.h$>$} |
11 |
|
12 |
|
13 |
|
14 |
Inheritance diagram for QuaZIODevice: |
15 |
\nopagebreak |
16 |
\begin{figure}[H] |
17 |
\begin{center} |
18 |
\leavevmode |
19 |
\includegraphics[width=122pt]{classQuaZIODevice__inherit__graph} |
20 |
\end{center} |
21 |
\end{figure} |
22 |
|
23 |
|
24 |
Collaboration diagram for QuaZIODevice: |
25 |
\nopagebreak |
26 |
\begin{figure}[H] |
27 |
\begin{center} |
28 |
\leavevmode |
29 |
\includegraphics[width=122pt]{classQuaZIODevice__coll__graph} |
30 |
\end{center} |
31 |
\end{figure} |
32 |
\subsection*{Public Member Functions} |
33 |
\begin{DoxyCompactItemize} |
34 |
\item |
35 |
{\bf QuaZIODevice} ({\bf QIODevice} $\ast$io, {\bf QObject} $\ast${\bf parent}=NULL) |
36 |
\begin{DoxyCompactList}\small\item\em Constructor. \end{DoxyCompactList}\item |
37 |
{\bf $\sim$QuaZIODevice} ()\label{classQuaZIODevice_ab3524cef44c240c21e6b7680ee5f42de} |
38 |
|
39 |
\begin{DoxyCompactList}\small\item\em Destructor. \end{DoxyCompactList}\item |
40 |
virtual bool {\bf flush} () |
41 |
\begin{DoxyCompactList}\small\item\em Flushes data waiting to be written. \end{DoxyCompactList}\item |
42 |
virtual bool {\bf open} ({\bf QIODevice::OpenMode} mode) |
43 |
\begin{DoxyCompactList}\small\item\em Opens the device. \end{DoxyCompactList}\item |
44 |
virtual void {\bf close} () |
45 |
\begin{DoxyCompactList}\small\item\em Closes this device, but not the underlying one. \end{DoxyCompactList}\item |
46 |
{\bf QIODevice} $\ast$ {\bf getIoDevice} () const \label{classQuaZIODevice_ad63e7f1717c7d91b3c2c5ace908c98b7} |
47 |
|
48 |
\begin{DoxyCompactList}\small\item\em Returns the underlying device. \end{DoxyCompactList}\item |
49 |
virtual bool {\bf isSequential} () const \label{classQuaZIODevice_af2697f58c228741d3715801bf48a9a8b} |
50 |
|
51 |
\begin{DoxyCompactList}\small\item\em Returns true. \end{DoxyCompactList}\item |
52 |
virtual bool {\bf atEnd} () const \label{classQuaZIODevice_ae727c48089ca1b161323ec8423a653ab} |
53 |
|
54 |
\begin{DoxyCompactList}\small\item\em Returns true iff the end of the compressed stream is reached. \end{DoxyCompactList}\item |
55 |
virtual qint64 {\bf bytesAvailable} () const \label{classQuaZIODevice_ac18b45c3d7009c8d231b13fe994ebcb9} |
56 |
|
57 |
\begin{DoxyCompactList}\small\item\em Returns the number of the bytes buffered. \end{DoxyCompactList}\end{DoxyCompactItemize} |
58 |
\subsection*{Protected Member Functions} |
59 |
\begin{DoxyCompactItemize} |
60 |
\item |
61 |
virtual qint64 {\bf readData} (char $\ast$data, qint64 maxSize)\label{classQuaZIODevice_aa12b8bc9c923e543eda9ae22dbd1ecbb} |
62 |
|
63 |
\begin{DoxyCompactList}\small\item\em Implementation of {\bf QIODevice::readData()}. \end{DoxyCompactList}\item |
64 |
virtual qint64 {\bf writeData} (const char $\ast$data, qint64 maxSize)\label{classQuaZIODevice_aab23b6badbc3548eb71ca86bf6211902} |
65 |
|
66 |
\begin{DoxyCompactList}\small\item\em Implementation of {\bf QIODevice::writeData()}. \end{DoxyCompactList}\end{DoxyCompactItemize} |
67 |
|
68 |
|
69 |
\subsection{Detailed Description} |
70 |
A class to compress/decompress {\bf QIODevice}. |
71 |
|
72 |
This class can be used to compress any data written to {\bf QIODevice} or decompress it back. Compressing data sent over a QTcpSocket is a good example. |
73 |
|
74 |
\subsection{Constructor \& Destructor Documentation} |
75 |
\index{QuaZIODevice@{QuaZIODevice}!QuaZIODevice@{QuaZIODevice}} |
76 |
\index{QuaZIODevice@{QuaZIODevice}!QuaZIODevice@{QuaZIODevice}} |
77 |
\subsubsection[{QuaZIODevice}]{\setlength{\rightskip}{0pt plus 5cm}QuaZIODevice::QuaZIODevice ( |
78 |
\begin{DoxyParamCaption} |
79 |
\item[{{\bf QIODevice} $\ast$}]{io, } |
80 |
\item[{{\bf QObject} $\ast$}]{parent = {\ttfamily NULL}} |
81 |
\end{DoxyParamCaption} |
82 |
)}\label{classQuaZIODevice_a8321ed35ee9b57cf9b1104912e236361} |
83 |
|
84 |
|
85 |
Constructor. |
86 |
|
87 |
|
88 |
\begin{DoxyParams}{Parameters} |
89 |
{\em io} & The {\bf QIODevice} to read/write. \\ |
90 |
\hline |
91 |
{\em parent} & The parent object, as per {\bf QObject} logic. \\ |
92 |
\hline |
93 |
\end{DoxyParams} |
94 |
|
95 |
|
96 |
References QObject::connect(), and QIODevice::readyRead(). |
97 |
|
98 |
|
99 |
|
100 |
\subsection{Member Function Documentation} |
101 |
\index{QuaZIODevice@{QuaZIODevice}!flush@{flush}} |
102 |
\index{flush@{flush}!QuaZIODevice@{QuaZIODevice}} |
103 |
\subsubsection[{flush}]{\setlength{\rightskip}{0pt plus 5cm}bool QuaZIODevice::flush ( |
104 |
\begin{DoxyParamCaption} |
105 |
{} |
106 |
\end{DoxyParamCaption} |
107 |
)\hspace{0.3cm}{\ttfamily [virtual]}}\label{classQuaZIODevice_a25f586eb564841b51c395fd17f1cc080} |
108 |
|
109 |
|
110 |
Flushes data waiting to be written. |
111 |
|
112 |
Unfortunately, as {\bf QIODevice} doesn't support \doxyref{flush()}{p.}{classQuaZIODevice_a25f586eb564841b51c395fd17f1cc080} 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 {\bf QIODevice}, you need to call its \doxyref{flush()}{p.}{classQuaZIODevice_a25f586eb564841b51c395fd17f1cc080} method as well, providing it supports it (like QTcpSocket does). Example: |
113 |
\begin{DoxyCode} |
114 |
QuaZIODevice dev(&sock); |
115 |
dev.open(QIODevice::Write); |
116 |
dev.write(yourDataGoesHere); |
117 |
dev.flush(); |
118 |
sock->flush(); // this actually sends data to network |
119 |
\end{DoxyCode} |
120 |
|
121 |
|
122 |
This may change in the future versions of QuaZIP by implementing an ugly hack: trying to cast the {\bf QIODevice} using qobject\_\-cast to known \doxyref{flush()}{p.}{classQuaZIODevice_a25f586eb564841b51c395fd17f1cc080}-\/supporting subclasses, and calling flush if the resulting pointer is not zero. |
123 |
|
124 |
References QString::fromLocal8Bit(), and QIODevice::setErrorString(). |
125 |
|
126 |
|
127 |
|
128 |
Referenced by close(). |
129 |
|
130 |
\index{QuaZIODevice@{QuaZIODevice}!open@{open}} |
131 |
\index{open@{open}!QuaZIODevice@{QuaZIODevice}} |
132 |
\subsubsection[{open}]{\setlength{\rightskip}{0pt plus 5cm}bool QuaZIODevice::open ( |
133 |
\begin{DoxyParamCaption} |
134 |
\item[{{\bf QIODevice::OpenMode}}]{mode} |
135 |
\end{DoxyParamCaption} |
136 |
)\hspace{0.3cm}{\ttfamily [virtual]}}\label{classQuaZIODevice_a175446c18eb20c9aff6faf23f09cc67a} |
137 |
|
138 |
|
139 |
Opens the device. |
140 |
|
141 |
|
142 |
\begin{DoxyParams}{Parameters} |
143 |
{\em mode} & Neither QIODevice::ReadWrite nor QIODevice::Append are not supported. \\ |
144 |
\hline |
145 |
\end{DoxyParams} |
146 |
|
147 |
|
148 |
References QIODevice::setErrorString(), and QObject::trUtf8(). |
149 |
|
150 |
\index{QuaZIODevice@{QuaZIODevice}!close@{close}} |
151 |
\index{close@{close}!QuaZIODevice@{QuaZIODevice}} |
152 |
\subsubsection[{close}]{\setlength{\rightskip}{0pt plus 5cm}void QuaZIODevice::close ( |
153 |
\begin{DoxyParamCaption} |
154 |
{} |
155 |
\end{DoxyParamCaption} |
156 |
)\hspace{0.3cm}{\ttfamily [virtual]}}\label{classQuaZIODevice_ad27e447544d57f897316ee6f44535895} |
157 |
|
158 |
|
159 |
Closes this device, but not the underlying one. |
160 |
|
161 |
The underlying {\bf QIODevice} is not closed in case you want to write something else to it. |
162 |
|
163 |
Reimplemented from {\bf QIODevice}. |
164 |
|
165 |
|
166 |
|
167 |
References flush(), QIODevice::openMode(), and QIODevice::setErrorString(). |
168 |
|
169 |
|
170 |
|
171 |
Referenced by $\sim$QuaZIODevice(). |
172 |
|
173 |
|
174 |
|
175 |
The documentation for this class was generated from the following files:\begin{DoxyCompactItemize} |
176 |
\item |
177 |
quazip/quaziodevice.h\item |
178 |
quazip/quaziodevice.cpp\end{DoxyCompactItemize} |