1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qnetworkprotocol.cpp:98 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QNetworkProtocol Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QNetworkProtocol Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1>
|
---|
33 |
|
---|
34 | <p>The QNetworkProtocol class provides a common API for network protocols.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qnetworkprotocol-h.html">qnetworkprotocol.h</a>></tt>
|
---|
37 | <p>Inherits <a href="qobject.html">QObject</a>.
|
---|
38 | <p>Inherited by <a href="qftp.html">QFtp</a>, <a href="qhttp.html">QHttp</a>, and <a href="qlocalfs.html">QLocalFs</a>.
|
---|
39 | <p><a href="qnetworkprotocol-members.html">List of all member functions.</a>
|
---|
40 | <h2>Public Members</h2>
|
---|
41 | <ul>
|
---|
42 | <li class=fn>enum <a href="#State-enum"><b>State</b></a> { StWaiting = 0, StInProgress, StDone, StFailed, StStopped }</li>
|
---|
43 | <li class=fn>enum <a href="#Operation-enum"><b>Operation</b></a> { OpListChildren = 1, OpMkDir = 2, OpMkdir = OpMkDir, OpRemove = 4, OpRename = 8, OpGet = 32, OpPut = 64 }</li>
|
---|
44 | <li class=fn>enum <a href="#ConnectionState-enum"><b>ConnectionState</b></a> { ConHostFound, ConConnected, ConClosed }</li>
|
---|
45 | <li class=fn>enum <a href="#Error-enum"><b>Error</b></a> { NoError = 0, ErrValid, ErrUnknownProtocol, ErrUnsupported, ErrParse, ErrLoginIncorrect, ErrHostNotFound, ErrListChildren, ErrListChlidren = ErrListChildren, ErrMkDir, ErrMkdir = ErrMkDir, ErrRemove, ErrRename, ErrGet, ErrPut, ErrFileNotExisting, ErrPermissionDenied }</li>
|
---|
46 | <li class=fn><a href="#QNetworkProtocol"><b>QNetworkProtocol</b></a> ()</li>
|
---|
47 | <li class=fn>virtual <a href="#~QNetworkProtocol"><b>~QNetworkProtocol</b></a> ()</li>
|
---|
48 | <li class=fn>virtual void <a href="#setUrl"><b>setUrl</b></a> ( QUrlOperator * u )</li>
|
---|
49 | <li class=fn>virtual void <a href="#setAutoDelete"><b>setAutoDelete</b></a> ( bool b, int i = 10000 )</li>
|
---|
50 | <li class=fn>bool <a href="#autoDelete"><b>autoDelete</b></a> () const</li>
|
---|
51 | <li class=fn>virtual int <a href="#supportedOperations"><b>supportedOperations</b></a> () const</li>
|
---|
52 | <li class=fn>virtual void <a href="#addOperation"><b>addOperation</b></a> ( QNetworkOperation * op )</li>
|
---|
53 | <li class=fn>QUrlOperator * <a href="#url"><b>url</b></a> () const</li>
|
---|
54 | <li class=fn>QNetworkOperation * <a href="#operationInProgress"><b>operationInProgress</b></a> () const</li>
|
---|
55 | <li class=fn>virtual void <a href="#clearOperationQueue"><b>clearOperationQueue</b></a> ()</li>
|
---|
56 | <li class=fn>virtual void <a href="#stop"><b>stop</b></a> ()</li>
|
---|
57 | </ul>
|
---|
58 | <h2>Signals</h2>
|
---|
59 | <ul>
|
---|
60 | <li class=fn>void <a href="#data"><b>data</b></a> ( const QByteArray & data, QNetworkOperation * op )</li>
|
---|
61 | <li class=fn>void <a href="#connectionStateChanged"><b>connectionStateChanged</b></a> ( int state, const QString & data )</li>
|
---|
62 | <li class=fn>void <a href="#finished"><b>finished</b></a> ( QNetworkOperation * op )</li>
|
---|
63 | <li class=fn>void <a href="#start"><b>start</b></a> ( QNetworkOperation * op )</li>
|
---|
64 | <li class=fn>void <a href="#newChildren"><b>newChildren</b></a> ( const QValueList<QUrlInfo> & i, QNetworkOperation * op )</li>
|
---|
65 | <li class=fn>void <a href="#newChild"><b>newChild</b></a> ( const QUrlInfo & i, QNetworkOperation * op )</li>
|
---|
66 | <li class=fn>void <a href="#createdDirectory"><b>createdDirectory</b></a> ( const QUrlInfo & i, QNetworkOperation * op )</li>
|
---|
67 | <li class=fn>void <a href="#removed"><b>removed</b></a> ( QNetworkOperation * op )</li>
|
---|
68 | <li class=fn>void <a href="#itemChanged"><b>itemChanged</b></a> ( QNetworkOperation * op )</li>
|
---|
69 | <li class=fn>void <a href="#dataTransferProgress"><b>dataTransferProgress</b></a> ( int bytesDone, int bytesTotal, QNetworkOperation * op )</li>
|
---|
70 | </ul>
|
---|
71 | <h2>Static Public Members</h2>
|
---|
72 | <ul>
|
---|
73 | <li class=fn>void <a href="#registerNetworkProtocol"><b>registerNetworkProtocol</b></a> ( const QString & protocol, QNetworkProtocolFactoryBase * protocolFactory )</li>
|
---|
74 | <li class=fn>QNetworkProtocol * <a href="#getNetworkProtocol"><b>getNetworkProtocol</b></a> ( const QString & protocol )</li>
|
---|
75 | <li class=fn>bool <a href="#hasOnlyLocalFileSystem"><b>hasOnlyLocalFileSystem</b></a> ()</li>
|
---|
76 | </ul>
|
---|
77 | <h2>Protected Members</h2>
|
---|
78 | <ul>
|
---|
79 | <li class=fn>virtual void <a href="#operationListChildren"><b>operationListChildren</b></a> ( QNetworkOperation * op )</li>
|
---|
80 | <li class=fn>virtual void <a href="#operationMkDir"><b>operationMkDir</b></a> ( QNetworkOperation * op )</li>
|
---|
81 | <li class=fn>virtual void <a href="#operationRemove"><b>operationRemove</b></a> ( QNetworkOperation * op )</li>
|
---|
82 | <li class=fn>virtual void <a href="#operationRename"><b>operationRename</b></a> ( QNetworkOperation * op )</li>
|
---|
83 | <li class=fn>virtual void <a href="#operationGet"><b>operationGet</b></a> ( QNetworkOperation * op )</li>
|
---|
84 | <li class=fn>virtual void <a href="#operationPut"><b>operationPut</b></a> ( QNetworkOperation * op )</li>
|
---|
85 | <li class=fn>virtual bool <a href="#checkConnection"><b>checkConnection</b></a> ( QNetworkOperation * op )</li>
|
---|
86 | </ul>
|
---|
87 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
88 |
|
---|
89 |
|
---|
90 | The QNetworkProtocol class provides a common API for network protocols.
|
---|
91 |
|
---|
92 | <p>
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 | <p> This is a base class which should be used for network protocols
|
---|
97 | implementations that can then be used in Qt (e.g. in the file
|
---|
98 | dialog) together with the <a href="qurloperator.html">QUrlOperator</a>.
|
---|
99 | <p> The easiest way to implement a new network protocol is to
|
---|
100 | reimplement the operation*() methods, e.g. <a href="#operationGet">operationGet</a>(), etc.
|
---|
101 | Only the supported operations should be reimplemented. To specify
|
---|
102 | which operations are supported, also reimplement
|
---|
103 | <a href="#supportedOperations">supportedOperations</a>() and return an int that is OR'd together
|
---|
104 | using the supported operations from the <a href="#Operation-enum">QNetworkProtocol::Operation</a> enum.
|
---|
105 | <p> When you implement a network protocol this way, it is important to
|
---|
106 | emit the correct signals. Also, always emit the <a href="#finished">finished</a>() signal
|
---|
107 | when an operation is done (on success <em>and</em> on failure). Qt
|
---|
108 | relies on correctly emitted finished() signals.
|
---|
109 | <p> For a detailed description of the Qt Network Architecture and how
|
---|
110 | to implement and use network protocols in Qt, see the <a href="network.html">Qt Network Documentation</a>.
|
---|
111 | <p>See also <a href="io.html">Input/Output and Networking</a>.
|
---|
112 |
|
---|
113 | <hr><h2>Member Type Documentation</h2>
|
---|
114 | <h3 class=fn><a name="ConnectionState-enum"></a>QNetworkProtocol::ConnectionState</h3>
|
---|
115 |
|
---|
116 | <p> When the connection state of a network protocol changes it emits
|
---|
117 | the signal <a href="#connectionStateChanged">connectionStateChanged</a>(). The first argument is one of
|
---|
118 | the following values:
|
---|
119 | <ul>
|
---|
120 | <li><tt>QNetworkProtocol::ConHostFound</tt> - Host has been found.
|
---|
121 | <li><tt>QNetworkProtocol::ConConnected</tt> - Connection to the host has been established.
|
---|
122 | <li><tt>QNetworkProtocol::ConClosed</tt> - Connection has been closed.
|
---|
123 | </ul>
|
---|
124 | <h3 class=fn><a name="Error-enum"></a>QNetworkProtocol::Error</h3>
|
---|
125 |
|
---|
126 | <p> When an operation fails (finishes unsuccessfully), the
|
---|
127 | <a href="qnetworkoperation.html">QNetworkOperation</a> of the operation returns an error code which has
|
---|
128 | one of the following values:
|
---|
129 | <ul>
|
---|
130 | <li><tt>QNetworkProtocol::NoError</tt> - No error occurred.
|
---|
131 | <li><tt>QNetworkProtocol::ErrValid</tt> - The URL you are operating on is not valid.
|
---|
132 | <li><tt>QNetworkProtocol::ErrUnknownProtocol</tt> - There is no protocol implementation
|
---|
133 | available for the protocol of the URL you are operating on (e.g.
|
---|
134 | if the protocol is http and no http implementation has been
|
---|
135 | registered).
|
---|
136 | <li><tt>QNetworkProtocol::ErrUnsupported</tt> - The operation is not supported by the
|
---|
137 | protocol.
|
---|
138 | <li><tt>QNetworkProtocol::ErrParse</tt> - The URL could not be parsed correctly.
|
---|
139 | <li><tt>QNetworkProtocol::ErrLoginIncorrect</tt> - You needed to login but the username
|
---|
140 | or password is wrong.
|
---|
141 | <li><tt>QNetworkProtocol::ErrHostNotFound</tt> - The specified host (in the URL) couldn't
|
---|
142 | be found.
|
---|
143 | <li><tt>QNetworkProtocol::ErrListChildren</tt> - An error occurred while listing the
|
---|
144 | children (files).
|
---|
145 | <li><tt>QNetworkProtocol::ErrMkDir</tt> - An error occurred when creating a directory.
|
---|
146 | <li><tt>QNetworkProtocol::ErrRemove</tt> - An error occurred when removing a child (file).
|
---|
147 | <li><tt>QNetworkProtocol::ErrRename</tt> - An error occurred when renaming a child (file).
|
---|
148 | <li><tt>QNetworkProtocol::ErrGet</tt> - An error occurred while getting (retrieving) data.
|
---|
149 | <li><tt>QNetworkProtocol::ErrPut</tt> - An error occurred while putting (uploading) data.
|
---|
150 | <li><tt>QNetworkProtocol::ErrFileNotExisting</tt> - A file which is needed by the operation
|
---|
151 | doesn't exist.
|
---|
152 | <li><tt>QNetworkProtocol::ErrPermissionDenied</tt> - Permission for doing the operation has
|
---|
153 | been denied.
|
---|
154 | </ul><p> You should also use these error codes when implementing custom
|
---|
155 | network protocols. If this is not possible, you can define your own
|
---|
156 | error codes by using integer values that don't conflict with any
|
---|
157 | of these values.
|
---|
158 |
|
---|
159 | <h3 class=fn><a name="Operation-enum"></a>QNetworkProtocol::Operation</h3>
|
---|
160 |
|
---|
161 | <p> This enum lists the possible operations that a network protocol
|
---|
162 | can support. <a href="#supportedOperations">supportedOperations</a>() returns an int of these that is
|
---|
163 | OR'd together. Also, the type() of a <a href="qnetworkoperation.html">QNetworkOperation</a> is always
|
---|
164 | one of these values.
|
---|
165 | <ul>
|
---|
166 | <li><tt>QNetworkProtocol::OpListChildren</tt> - List the children of a URL, e.g. of a directory.
|
---|
167 | <li><tt>QNetworkProtocol::OpMkDir</tt> - Create a directory.
|
---|
168 | <li><tt>QNetworkProtocol::OpRemove</tt> - Remove a child (e.g. a file).
|
---|
169 | <li><tt>QNetworkProtocol::OpRename</tt> - Rename a child (e.g. a file).
|
---|
170 | <li><tt>QNetworkProtocol::OpGet</tt> - Get data from a location.
|
---|
171 | <li><tt>QNetworkProtocol::OpPut</tt> - Put data to a location.
|
---|
172 | </ul>
|
---|
173 | <h3 class=fn><a name="State-enum"></a>QNetworkProtocol::State</h3>
|
---|
174 |
|
---|
175 | <p> This enum contains the state that a <a href="qnetworkoperation.html">QNetworkOperation</a> can have.
|
---|
176 | <ul>
|
---|
177 | <li><tt>QNetworkProtocol::StWaiting</tt> - The operation is in the QNetworkProtocol's queue
|
---|
178 | waiting to be prcessed.
|
---|
179 | <li><tt>QNetworkProtocol::StInProgress</tt> - The operation is being processed.
|
---|
180 | <li><tt>QNetworkProtocol::StDone</tt> - The operation has been processed succesfully.
|
---|
181 | <li><tt>QNetworkProtocol::StFailed</tt> - The operation has been processed but an error occurred.
|
---|
182 | <li><tt>QNetworkProtocol::StStopped</tt> - The operation has been processed but has been
|
---|
183 | stopped before it finished, and is waiting to be processed.
|
---|
184 | </ul><p>
|
---|
185 | <hr><h2>Member Function Documentation</h2>
|
---|
186 | <h3 class=fn><a name="QNetworkProtocol"></a>QNetworkProtocol::QNetworkProtocol ()
|
---|
187 | </h3>
|
---|
188 | Constructor of the network protocol base class. Does some
|
---|
189 | initialization and connecting of signals and slots.
|
---|
190 |
|
---|
191 | <h3 class=fn><a name="~QNetworkProtocol"></a>QNetworkProtocol::~QNetworkProtocol ()<tt> [virtual]</tt>
|
---|
192 | </h3>
|
---|
193 | Destructor.
|
---|
194 |
|
---|
195 | <h3 class=fn>void <a name="addOperation"></a>QNetworkProtocol::addOperation ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [virtual]</tt>
|
---|
196 | </h3>
|
---|
197 | Adds the operation <em>op</em> to the operation queue. The operation
|
---|
198 | will be processed as soon as possible. This method returns
|
---|
199 | immediately.
|
---|
200 |
|
---|
201 | <h3 class=fn>bool <a name="autoDelete"></a>QNetworkProtocol::autoDelete () const
|
---|
202 | </h3>
|
---|
203 | Returns TRUE if auto-deleting is enabled; otherwise returns FALSE.
|
---|
204 | <p> <p>See also <a href="#setAutoDelete">QNetworkProtocol::setAutoDelete</a>().
|
---|
205 |
|
---|
206 | <h3 class=fn>bool <a name="checkConnection"></a>QNetworkProtocol::checkConnection ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [virtual protected]</tt>
|
---|
207 | </h3>
|
---|
208 | For processing operations the network protocol base class calls
|
---|
209 | this method quite often. This should be reimplemented by new
|
---|
210 | network protocols. It should return TRUE if the connection is OK
|
---|
211 | (open); otherwise it should return FALSE. If the connection is not
|
---|
212 | open the protocol should open it.
|
---|
213 | <p> If the connection can't be opened (e.g. because you already tried
|
---|
214 | but the host couldn't be found), set the state of <em>op</em> to
|
---|
215 | QNetworkProtocol::StFailed and emit the <a href="#finished">finished</a>() signal with
|
---|
216 | this <a href="qnetworkoperation.html">QNetworkOperation</a> as argument.
|
---|
217 | <p> <em>op</em> is the operation that needs an open connection.
|
---|
218 |
|
---|
219 | <p>Example: <a href="networkprotocol-example.html#x673">network/networkprotocol/nntp.cpp</a>.
|
---|
220 | <h3 class=fn>void <a name="clearOperationQueue"></a>QNetworkProtocol::clearOperationQueue ()<tt> [virtual]</tt>
|
---|
221 | </h3>
|
---|
222 | Clears the operation queue.
|
---|
223 |
|
---|
224 | <h3 class=fn>void <a name="connectionStateChanged"></a>QNetworkProtocol::connectionStateChanged ( int state, const <a href="qstring.html">QString</a> & data )<tt> [signal]</tt>
|
---|
225 | </h3>
|
---|
226 |
|
---|
227 | <p> This signal is emitted whenever the state of the connection of the
|
---|
228 | network protocol is changed. <em>state</em> describes the new state,
|
---|
229 | which is one of, <a href="#ConnectionState-enum">ConHostFound</a>, <a href="#ConnectionState-enum">ConConnected</a> or <a href="#ConnectionState-enum">ConClosed</a>.
|
---|
230 | <em>data</em> is a message text.
|
---|
231 |
|
---|
232 | <h3 class=fn>void <a name="createdDirectory"></a>QNetworkProtocol::createdDirectory ( const <a href="qurlinfo.html">QUrlInfo</a> & i, <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [signal]</tt>
|
---|
233 | </h3>
|
---|
234 |
|
---|
235 | <p> This signal is emitted when mkdir() has been succesful and the
|
---|
236 | directory has been created. <em>i</em> holds the information about the
|
---|
237 | new directory. <em>op</em> is the pointer to the operation object which
|
---|
238 | contains all the information about the operation, including the
|
---|
239 | state, etc. Using op->arg( 0 ), you can get the file name of the
|
---|
240 | new directory.
|
---|
241 | <p> When a protocol emits this signal, QNetworkProtocol is smart
|
---|
242 | enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
|
---|
243 | protocol, emit its corresponding signal.
|
---|
244 |
|
---|
245 | <h3 class=fn>void <a name="data"></a>QNetworkProtocol::data ( const <a href="qbytearray.html">QByteArray</a> & data, <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [signal]</tt>
|
---|
246 | </h3>
|
---|
247 |
|
---|
248 | <p> This signal is emitted when new <em>data</em> has been received after
|
---|
249 | calling get() or put(). <em>op</em> holds the name of the file from
|
---|
250 | which data is retrieved or uploaded in its first argument, and the
|
---|
251 | (raw) data in its second argument. You can get them with
|
---|
252 | op->arg( 0 ) and op->rawArg( 1 ). <em>op</em> is the pointer to the
|
---|
253 | operation object, which contains all the information about the
|
---|
254 | operation, including the state, etc.
|
---|
255 | <p> When a protocol emits this signal, QNetworkProtocol is smart
|
---|
256 | enough to let the <a href="qurloperator.html">QUrlOperator</a> (which is used by the network
|
---|
257 | protocol) emit its corresponding signal.
|
---|
258 |
|
---|
259 | <h3 class=fn>void <a name="dataTransferProgress"></a>QNetworkProtocol::dataTransferProgress ( int bytesDone, int bytesTotal, <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [signal]</tt>
|
---|
260 | </h3>
|
---|
261 |
|
---|
262 | <p> This signal is emitted during the transfer of data (using put() or
|
---|
263 | get()). <em>bytesDone</em> is how many bytes of <em>bytesTotal</em> have been
|
---|
264 | transferred. <em>bytesTotal</em> may be -1, which means that the total
|
---|
265 | number of bytes is not known. <em>op</em> is the pointer to the
|
---|
266 | operation object which contains all the information about the
|
---|
267 | operation, including the state, etc.
|
---|
268 | <p> When a protocol emits this signal, QNetworkProtocol is smart
|
---|
269 | enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
|
---|
270 | protocol, emit its corresponding signal.
|
---|
271 |
|
---|
272 | <h3 class=fn>void <a name="finished"></a>QNetworkProtocol::finished ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [signal]</tt>
|
---|
273 | </h3>
|
---|
274 |
|
---|
275 | <p> This signal is emitted when an operation finishes. This signal is
|
---|
276 | always emitted, for both success and failure. <em>op</em> is the pointer
|
---|
277 | to the operation object which contains all the information about
|
---|
278 | the operation, including the state, etc. Check the state and error
|
---|
279 | code of the operation object to determine whether or not the
|
---|
280 | operation was successful.
|
---|
281 | <p> When a protocol emits this signal, QNetworkProtocol is smart
|
---|
282 | enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
|
---|
283 | protocol, emit its corresponding signal.
|
---|
284 |
|
---|
285 | <h3 class=fn><a href="qnetworkprotocol.html">QNetworkProtocol</a> * <a name="getNetworkProtocol"></a>QNetworkProtocol::getNetworkProtocol ( const <a href="qstring.html">QString</a> & protocol )<tt> [static]</tt>
|
---|
286 | </h3>
|
---|
287 | Static method to get a new instance of the network protocol <em>protocol</em>. For example, if you need to do some FTP operations, do
|
---|
288 | the following:
|
---|
289 | <pre>
|
---|
290 | <a href="qftp.html">QFtp</a> *ftp = QNetworkProtocol::<a href="#getNetworkProtocol">getNetworkProtocol</a>( "ftp" );
|
---|
291 | </pre>
|
---|
292 |
|
---|
293 | This returns a pointer to a new instance of an ftp implementation
|
---|
294 | or null if no protocol for ftp was registered. The ownership of
|
---|
295 | the pointer is transferred to you, so you must delete it if you
|
---|
296 | don't need it anymore.
|
---|
297 | <p> Normally you should not work directly with network protocols, so
|
---|
298 | you will not need to call this method yourself. Instead, use
|
---|
299 | <a href="qurloperator.html">QUrlOperator</a>, which makes working with network protocols much more
|
---|
300 | convenient.
|
---|
301 | <p> <p>See also <a href="qurloperator.html">QUrlOperator</a>.
|
---|
302 |
|
---|
303 | <h3 class=fn>bool <a name="hasOnlyLocalFileSystem"></a>QNetworkProtocol::hasOnlyLocalFileSystem ()<tt> [static]</tt>
|
---|
304 | </h3>
|
---|
305 | Returns TRUE if the only protocol registered is for working on the
|
---|
306 | local filesystem; returns FALSE if other network protocols are
|
---|
307 | also registered.
|
---|
308 |
|
---|
309 | <h3 class=fn>void <a name="itemChanged"></a>QNetworkProtocol::itemChanged ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [signal]</tt>
|
---|
310 | </h3>
|
---|
311 |
|
---|
312 | <p> This signal is emitted whenever a file which is a child of this
|
---|
313 | URL has been changed, e.g. by successfully calling rename(). <em>op</em>
|
---|
314 | holds the original and the new file names in the first and second
|
---|
315 | arguments, accessible with op->arg( 0 ) and op->arg( 1 )
|
---|
316 | respectively. <em>op</em> is the pointer to the operation object which
|
---|
317 | contains all the information about the operation, including the
|
---|
318 | state, etc.
|
---|
319 | <p> When a protocol emits this signal, QNetworkProtocol is smart
|
---|
320 | enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
|
---|
321 | protocol, emit its corresponding signal.
|
---|
322 |
|
---|
323 | <h3 class=fn>void <a name="newChild"></a>QNetworkProtocol::newChild ( const <a href="qurlinfo.html">QUrlInfo</a> & i, <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [signal]</tt>
|
---|
324 | </h3>
|
---|
325 |
|
---|
326 | <p> This signal is emitted if a new child (file) has been read.
|
---|
327 | QNetworkProtocol automatically connects it to a slot which creates
|
---|
328 | a list of <a href="qurlinfo.html">QUrlInfo</a> objects (with just one QUrlInfo <em>i</em>) and emits
|
---|
329 | the <a href="#newChildren">newChildren</a>() signal with this list. <em>op</em> is the pointer to
|
---|
330 | the operation object which contains all the information about the
|
---|
331 | operation that has finished, including the state, etc.
|
---|
332 | <p> This is just a convenience signal useful for implementing your own
|
---|
333 | network protocol. In all other cases connect to the newChildren()
|
---|
334 | signal with its list of QUrlInfo objects.
|
---|
335 |
|
---|
336 | <h3 class=fn>void <a name="newChildren"></a>QNetworkProtocol::newChildren ( const <a href="qvaluelist.html">QValueList</a><QUrlInfo> & i, <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [signal]</tt>
|
---|
337 | </h3>
|
---|
338 |
|
---|
339 | <p> This signal is emitted after listChildren() was called and new
|
---|
340 | children (files) have been read from the list of files. <em>i</em> holds
|
---|
341 | the information about the new children. <em>op</em> is the pointer to
|
---|
342 | the operation object which contains all the information about the
|
---|
343 | operation, including the state, etc.
|
---|
344 | <p> When a protocol emits this signal, QNetworkProtocol is smart
|
---|
345 | enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
|
---|
346 | protocol, emit its corresponding signal.
|
---|
347 | <p> When implementing your own network protocol and reading children,
|
---|
348 | you usually don't read one child at once, but rather a list of
|
---|
349 | them. That's why this signal takes a list of <a href="qurlinfo.html">QUrlInfo</a> objects. If
|
---|
350 | you prefer to read just one child at a time you can use the
|
---|
351 | convenience signal <a href="#newChild">newChild</a>(), which takes a single QUrlInfo
|
---|
352 | object.
|
---|
353 |
|
---|
354 | <h3 class=fn>void <a name="operationGet"></a>QNetworkProtocol::operationGet ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [virtual protected]</tt>
|
---|
355 | </h3>
|
---|
356 | When implementing a new network protocol, this method should be
|
---|
357 | reimplemented if the protocol supports getting data; this method
|
---|
358 | should then process the <a href="qnetworkoperation.html">QNetworkOperation</a>.
|
---|
359 | <p> When you reimplement this method it's very important that you emit
|
---|
360 | the correct signals at the correct time (especially the <a href="#finished">finished</a>()
|
---|
361 | signal after processing an operation). Take a look at the <a href="network.html">Qt Network Documentation</a> which describes in
|
---|
362 | detail how to reimplement this method. You may also want to look
|
---|
363 | at the example implementation in
|
---|
364 | examples/network/networkprotocol/nntp.cpp.
|
---|
365 | <p> <em>op</em> is the pointer to the operation object which contains all
|
---|
366 | the information on the operation that has finished, including the
|
---|
367 | state, etc.
|
---|
368 |
|
---|
369 | <p>Example: <a href="networkprotocol-example.html#x674">network/networkprotocol/nntp.cpp</a>.
|
---|
370 | <h3 class=fn><a href="qnetworkoperation.html">QNetworkOperation</a> * <a name="operationInProgress"></a>QNetworkProtocol::operationInProgress () const
|
---|
371 | </h3>
|
---|
372 | Returns the operation, which is being processed, or 0 of no
|
---|
373 | operation is being processed at the moment.
|
---|
374 |
|
---|
375 | <h3 class=fn>void <a name="operationListChildren"></a>QNetworkProtocol::operationListChildren ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [virtual protected]</tt>
|
---|
376 | </h3>
|
---|
377 | When implementing a new network protocol, this method should be
|
---|
378 | reimplemented if the protocol supports listing children (files);
|
---|
379 | this method should then process this <a href="qnetworkoperation.html">QNetworkOperation</a>.
|
---|
380 | <p> When you reimplement this method it's very important that you emit
|
---|
381 | the correct signals at the correct time (especially the <a href="#finished">finished</a>()
|
---|
382 | signal after processing an operation). Take a look at the <a href="network.html">Qt Network Documentation</a> which describes in
|
---|
383 | detail how to reimplement this method. You may also want to look
|
---|
384 | at the example implementation in
|
---|
385 | examples/network/networkprotocol/nntp.cpp.
|
---|
386 | <p> <em>op</em> is the pointer to the operation object which contains all
|
---|
387 | the information on the operation that has finished, including the
|
---|
388 | state, etc.
|
---|
389 |
|
---|
390 | <p>Example: <a href="networkprotocol-example.html#x675">network/networkprotocol/nntp.cpp</a>.
|
---|
391 | <h3 class=fn>void <a name="operationMkDir"></a>QNetworkProtocol::operationMkDir ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [virtual protected]</tt>
|
---|
392 | </h3>
|
---|
393 | When implementing a new network protocol, this method should be
|
---|
394 | reimplemented if the protocol supports making directories; this
|
---|
395 | method should then process this <a href="qnetworkoperation.html">QNetworkOperation</a>.
|
---|
396 | <p> When you reimplement this method it's very important that you emit
|
---|
397 | the correct signals at the correct time (especially the <a href="#finished">finished</a>()
|
---|
398 | signal after processing an operation). Take a look at the <a href="network.html">Qt Network Documentation</a> which describes in
|
---|
399 | detail how to reimplement this method. You may also want to look
|
---|
400 | at the example implementation in
|
---|
401 | examples/network/networkprotocol/nntp.cpp.
|
---|
402 | <p> <em>op</em> is the pointer to the operation object which contains all
|
---|
403 | the information on the operation that has finished, including the
|
---|
404 | state, etc.
|
---|
405 |
|
---|
406 | <h3 class=fn>void <a name="operationPut"></a>QNetworkProtocol::operationPut ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [virtual protected]</tt>
|
---|
407 | </h3>
|
---|
408 | When implementing a new network protocol, this method should be
|
---|
409 | reimplemented if the protocol supports putting (uploading) data;
|
---|
410 | this method should then process the <a href="qnetworkoperation.html">QNetworkOperation</a>.
|
---|
411 | <p> When you reimplement this method it's very important that you emit
|
---|
412 | the correct signals at the correct time (especially the <a href="#finished">finished</a>()
|
---|
413 | signal after processing an operation). Take a look at the <a href="network.html">Qt Network Documentation</a> which describes in
|
---|
414 | detail how to reimplement this method. You may also want to look
|
---|
415 | at the example implementation in
|
---|
416 | examples/network/networkprotocol/nntp.cpp.
|
---|
417 | <p> <em>op</em> is the pointer to the operation object which contains all
|
---|
418 | the information on the operation that has finished, including the
|
---|
419 | state, etc.
|
---|
420 |
|
---|
421 | <h3 class=fn>void <a name="operationRemove"></a>QNetworkProtocol::operationRemove ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [virtual protected]</tt>
|
---|
422 | </h3>
|
---|
423 | When implementing a new network protocol, this method should be
|
---|
424 | reimplemented if the protocol supports removing children (files);
|
---|
425 | this method should then process this <a href="qnetworkoperation.html">QNetworkOperation</a>.
|
---|
426 | <p> When you reimplement this method it's very important that you emit
|
---|
427 | the correct signals at the correct time (especially the <a href="#finished">finished</a>()
|
---|
428 | signal after processing an operation). Take a look at the <a href="network.html">Qt Network Documentation</a> which is describes
|
---|
429 | in detail how to reimplement this method. You may also want to
|
---|
430 | look at the example implementation in
|
---|
431 | examples/network/networkprotocol/nntp.cpp.
|
---|
432 | <p> <em>op</em> is the pointer to the operation object which contains all
|
---|
433 | the information on the operation that has finished, including the
|
---|
434 | state, etc.
|
---|
435 |
|
---|
436 | <h3 class=fn>void <a name="operationRename"></a>QNetworkProtocol::operationRename ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [virtual protected]</tt>
|
---|
437 | </h3>
|
---|
438 | When implementing a new newtork protocol, this method should be
|
---|
439 | reimplemented if the protocol supports renaming children (files);
|
---|
440 | this method should then process this <a href="qnetworkoperation.html">QNetworkOperation</a>.
|
---|
441 | <p> When you reimplement this method it's very important that you emit
|
---|
442 | the correct signals at the correct time (especially the <a href="#finished">finished</a>()
|
---|
443 | signal after processing an operation). Take a look at the <a href="network.html">Qt Network Documentation</a> which describes in
|
---|
444 | detail how to reimplement this method. You may also want to look
|
---|
445 | at the example implementation in
|
---|
446 | examples/network/networkprotocol/nntp.cpp.
|
---|
447 | <p> <em>op</em> is the pointer to the operation object which contains all
|
---|
448 | the information on the operation that has finished, including the
|
---|
449 | state, etc.
|
---|
450 |
|
---|
451 | <h3 class=fn>void <a name="registerNetworkProtocol"></a>QNetworkProtocol::registerNetworkProtocol ( const <a href="qstring.html">QString</a> & protocol, QNetworkProtocolFactoryBase * protocolFactory )<tt> [static]</tt>
|
---|
452 | </h3>
|
---|
453 | Static method to register a network protocol for Qt. For example,
|
---|
454 | if you have an implementation of NNTP (called Nntp) which is
|
---|
455 | derived from QNetworkProtocol, call:
|
---|
456 | <pre>
|
---|
457 | QNetworkProtocol::<a href="#registerNetworkProtocol">registerNetworkProtocol</a>( "nntp", new QNetworkProtocolFactory<Nntp> );
|
---|
458 | </pre>
|
---|
459 |
|
---|
460 | after which your implementation is registered for future nntp
|
---|
461 | operations.
|
---|
462 | <p> The name of the protocol is given in <em>protocol</em> and a pointer to
|
---|
463 | the protocol factory is given in <em>protocolFactory</em>.
|
---|
464 |
|
---|
465 | <h3 class=fn>void <a name="removed"></a>QNetworkProtocol::removed ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [signal]</tt>
|
---|
466 | </h3>
|
---|
467 |
|
---|
468 | <p> This signal is emitted when remove() has been succesful and the
|
---|
469 | file has been removed. <em>op</em> holds the file name of the removed
|
---|
470 | file in the first argument, accessible with op->arg( 0 ). <em>op</em> is
|
---|
471 | the pointer to the operation object which contains all the
|
---|
472 | information about the operation, including the state, etc.
|
---|
473 | <p> When a protocol emits this signal, QNetworkProtocol is smart
|
---|
474 | enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
|
---|
475 | protocol, emit its corresponding signal.
|
---|
476 |
|
---|
477 | <h3 class=fn>void <a name="setAutoDelete"></a>QNetworkProtocol::setAutoDelete ( bool b, int i = 10000 )<tt> [virtual]</tt>
|
---|
478 | </h3>
|
---|
479 | Because it's sometimes hard to take care of removing network
|
---|
480 | protocol instances, QNetworkProtocol provides an auto-delete
|
---|
481 | mechanism. If you set <em>b</em> to TRUE, the network protocol instance
|
---|
482 | is removed after it has been inactive for <em>i</em> milliseconds (i.e.
|
---|
483 | <em>i</em> milliseconds after the last operation has been processed).
|
---|
484 | If you set <em>b</em> to FALSE the auto-delete mechanism is switched
|
---|
485 | off.
|
---|
486 | <p> If you switch on auto-delete, the QNetworkProtocol also deletes
|
---|
487 | its <a href="qurloperator.html">QUrlOperator</a>.
|
---|
488 |
|
---|
489 | <h3 class=fn>void <a name="setUrl"></a>QNetworkProtocol::setUrl ( <a href="qurloperator.html">QUrlOperator</a> * u )<tt> [virtual]</tt>
|
---|
490 | </h3>
|
---|
491 | Sets the <a href="qurloperator.html">QUrlOperator</a>, on which the protocol works, to <em>u</em>.
|
---|
492 | <p> <p>See also <a href="qurloperator.html">QUrlOperator</a>.
|
---|
493 |
|
---|
494 | <h3 class=fn>void <a name="start"></a>QNetworkProtocol::start ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [signal]</tt>
|
---|
495 | </h3>
|
---|
496 |
|
---|
497 | <p> Some operations (such as listChildren()) emit this signal when
|
---|
498 | they start processing the operation. <em>op</em> is the pointer to the
|
---|
499 | operation object which contains all the information about the
|
---|
500 | operation, including the state, etc.
|
---|
501 | <p> When a protocol emits this signal, QNetworkProtocol is smart
|
---|
502 | enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
|
---|
503 | protocol, emit its corresponding signal.
|
---|
504 |
|
---|
505 | <h3 class=fn>void <a name="stop"></a>QNetworkProtocol::stop ()<tt> [virtual]</tt>
|
---|
506 | </h3>
|
---|
507 | Stops the current operation that is being processed and clears all
|
---|
508 | waiting operations.
|
---|
509 |
|
---|
510 | <h3 class=fn>int <a name="supportedOperations"></a>QNetworkProtocol::supportedOperations () const<tt> [virtual]</tt>
|
---|
511 | </h3>
|
---|
512 | Returns an int that is OR'd together using the enum values of
|
---|
513 | <a href="#Operation-enum">QNetworkProtocol::Operation</a>, which describes which operations
|
---|
514 | are supported by the network protocol. Should be reimplemented by
|
---|
515 | new network protocols.
|
---|
516 |
|
---|
517 | <p>Example: <a href="networkprotocol-example.html#x676">network/networkprotocol/nntp.cpp</a>.
|
---|
518 | <h3 class=fn><a href="qurloperator.html">QUrlOperator</a> * <a name="url"></a>QNetworkProtocol::url () const
|
---|
519 | </h3>
|
---|
520 | Returns the <a href="qurloperator.html">QUrlOperator</a> on which the protocol works.
|
---|
521 |
|
---|
522 | <!-- eof -->
|
---|
523 | <hr><p>
|
---|
524 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
525 | Copyright © 1995-2007
|
---|
526 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
527 | <table width=100% cellspacing=0 border=0><tr>
|
---|
528 | <td>Copyright © 2007
|
---|
529 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
530 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
531 | </table></div></address></body>
|
---|
532 | </html>
|
---|