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