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