source: trunk/doc/html/qnetworkprotocol.html@ 190

Last change on this file since 190 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 32.1 KB
Line 
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"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { 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&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;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&nbsp;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 &lt;<a href="qnetworkprotocol-h.html">qnetworkprotocol.h</a>&gt;</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&nbsp;*&nbsp;u )</li>
49<li class=fn>virtual void <a href="#setAutoDelete"><b>setAutoDelete</b></a> ( bool&nbsp;b, int&nbsp;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&nbsp;*&nbsp;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&nbsp;QByteArray&nbsp;&amp;&nbsp;data, QNetworkOperation&nbsp;*&nbsp;op )</li>
61<li class=fn>void <a href="#connectionStateChanged"><b>connectionStateChanged</b></a> ( int&nbsp;state, const&nbsp;QString&nbsp;&amp;&nbsp;data )</li>
62<li class=fn>void <a href="#finished"><b>finished</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
63<li class=fn>void <a href="#start"><b>start</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
64<li class=fn>void <a href="#newChildren"><b>newChildren</b></a> ( const&nbsp;QValueList&lt;QUrlInfo&gt;&nbsp;&amp;&nbsp;i, QNetworkOperation&nbsp;*&nbsp;op )</li>
65<li class=fn>void <a href="#newChild"><b>newChild</b></a> ( const&nbsp;QUrlInfo&nbsp;&amp;&nbsp;i, QNetworkOperation&nbsp;*&nbsp;op )</li>
66<li class=fn>void <a href="#createdDirectory"><b>createdDirectory</b></a> ( const&nbsp;QUrlInfo&nbsp;&amp;&nbsp;i, QNetworkOperation&nbsp;*&nbsp;op )</li>
67<li class=fn>void <a href="#removed"><b>removed</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
68<li class=fn>void <a href="#itemChanged"><b>itemChanged</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
69<li class=fn>void <a href="#dataTransferProgress"><b>dataTransferProgress</b></a> ( int&nbsp;bytesDone, int&nbsp;bytesTotal, QNetworkOperation&nbsp;*&nbsp;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&nbsp;QString&nbsp;&amp;&nbsp;protocol, QNetworkProtocolFactoryBase&nbsp;*&nbsp;protocolFactory )</li>
74<li class=fn>QNetworkProtocol * <a href="#getNetworkProtocol"><b>getNetworkProtocol</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;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&nbsp;*&nbsp;op )</li>
80<li class=fn>virtual void <a href="#operationMkDir"><b>operationMkDir</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
81<li class=fn>virtual void <a href="#operationRemove"><b>operationRemove</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
82<li class=fn>virtual void <a href="#operationRename"><b>operationRename</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
83<li class=fn>virtual void <a href="#operationGet"><b>operationGet</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
84<li class=fn>virtual void <a href="#operationPut"><b>operationPut</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
85<li class=fn>virtual bool <a href="#checkConnection"><b>checkConnection</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</li>
86</ul>
87<hr><a name="details"></a><h2>Detailed Description</h2>
88
89
90The 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
97implementations that can then be used in Qt (e.g. in the file
98dialog) together with the <a href="qurloperator.html">QUrlOperator</a>.
99<p> The easiest way to implement a new network protocol is to
100reimplement the operation*() methods, e.g. <a href="#operationGet">operationGet</a>(), etc.
101Only the supported operations should be reimplemented. To specify
102which operations are supported, also reimplement
103<a href="#supportedOperations">supportedOperations</a>() and return an int that is OR'd together
104using 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
106emit the correct signals. Also, always emit the <a href="#finished">finished</a>() signal
107when an operation is done (on success <em>and</em> on failure). Qt
108relies on correctly emitted finished() signals.
109<p> For a detailed description of the Qt Network Architecture and how
110to 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
117the signal <a href="#connectionStateChanged">connectionStateChanged</a>(). The first argument is one of
118the 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
128one 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
133available for the protocol of the URL you are operating on (e.g.
134if the protocol is http and no http implementation has been
135registered).
136<li><tt>QNetworkProtocol::ErrUnsupported</tt> - The operation is not supported by the
137protocol.
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
140or password is wrong.
141<li><tt>QNetworkProtocol::ErrHostNotFound</tt> - The specified host (in the URL) couldn't
142be found.
143<li><tt>QNetworkProtocol::ErrListChildren</tt> - An error occurred while listing the
144children (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
151doesn't exist.
152<li><tt>QNetworkProtocol::ErrPermissionDenied</tt> - Permission for doing the operation has
153been denied.
154</ul><p> You should also use these error codes when implementing custom
155network protocols. If this is not possible, you can define your own
156error codes by using integer values that don't conflict with any
157of 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
162can support. <a href="#supportedOperations">supportedOperations</a>() returns an int of these that is
163OR'd together. Also, the type() of a <a href="qnetworkoperation.html">QNetworkOperation</a> is always
164one 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
178waiting 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
183stopped 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>
188Constructor of the network protocol base class. Does some
189initialization and connecting of signals and slots.
190
191<h3 class=fn><a name="~QNetworkProtocol"></a>QNetworkProtocol::~QNetworkProtocol ()<tt> [virtual]</tt>
192</h3>
193Destructor.
194
195<h3 class=fn>void <a name="addOperation"></a>QNetworkProtocol::addOperation ( <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [virtual]</tt>
196</h3>
197Adds the operation <em>op</em> to the operation queue. The operation
198will be processed as soon as possible. This method returns
199immediately.
200
201<h3 class=fn>bool <a name="autoDelete"></a>QNetworkProtocol::autoDelete () const
202</h3>
203Returns 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>&nbsp;*&nbsp;op )<tt> [virtual protected]</tt>
207</h3>
208For processing operations the network protocol base class calls
209this method quite often. This should be reimplemented by new
210network protocols. It should return TRUE if the connection is OK
211(open); otherwise it should return FALSE. If the connection is not
212open the protocol should open it.
213<p> If the connection can't be opened (e.g. because you already tried
214but the host couldn't be found), set the state of <em>op</em> to
215QNetworkProtocol::StFailed and emit the <a href="#finished">finished</a>() signal with
216this <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>
222Clears the operation queue.
223
224<h3 class=fn>void <a name="connectionStateChanged"></a>QNetworkProtocol::connectionStateChanged ( int&nbsp;state, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;data )<tt> [signal]</tt>
225</h3>
226
227<p> This signal is emitted whenever the state of the connection of the
228network protocol is changed. <em>state</em> describes the new state,
229which 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&nbsp;<a href="qurlinfo.html">QUrlInfo</a>&nbsp;&amp;&nbsp;i, <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
233</h3>
234
235<p> This signal is emitted when mkdir() has been succesful and the
236directory has been created. <em>i</em> holds the information about the
237new directory. <em>op</em> is the pointer to the operation object which
238contains all the information about the operation, including the
239state, etc. Using op->arg( 0 ), you can get the file name of the
240new directory.
241<p> When a protocol emits this signal, QNetworkProtocol is smart
242enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
243protocol, emit its corresponding signal.
244
245<h3 class=fn>void <a name="data"></a>QNetworkProtocol::data ( const&nbsp;<a href="qbytearray.html">QByteArray</a>&nbsp;&amp;&nbsp;data, <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
246</h3>
247
248<p> This signal is emitted when new <em>data</em> has been received after
249calling get() or put(). <em>op</em> holds the name of the file from
250which data is retrieved or uploaded in its first argument, and the
251(raw) data in its second argument. You can get them with
252op->arg( 0 ) and op->rawArg( 1 ). <em>op</em> is the pointer to the
253operation object, which contains all the information about the
254operation, including the state, etc.
255<p> When a protocol emits this signal, QNetworkProtocol is smart
256enough to let the <a href="qurloperator.html">QUrlOperator</a> (which is used by the network
257protocol) emit its corresponding signal.
258
259<h3 class=fn>void <a name="dataTransferProgress"></a>QNetworkProtocol::dataTransferProgress ( int&nbsp;bytesDone, int&nbsp;bytesTotal, <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
260</h3>
261
262<p> This signal is emitted during the transfer of data (using put() or
263get()). <em>bytesDone</em> is how many bytes of <em>bytesTotal</em> have been
264transferred. <em>bytesTotal</em> may be -1, which means that the total
265number of bytes is not known. <em>op</em> is the pointer to the
266operation object which contains all the information about the
267operation, including the state, etc.
268<p> When a protocol emits this signal, QNetworkProtocol is smart
269enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
270protocol, emit its corresponding signal.
271
272<h3 class=fn>void <a name="finished"></a>QNetworkProtocol::finished ( <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
273</h3>
274
275<p> This signal is emitted when an operation finishes. This signal is
276always emitted, for both success and failure. <em>op</em> is the pointer
277to the operation object which contains all the information about
278the operation, including the state, etc. Check the state and error
279code of the operation object to determine whether or not the
280operation was successful.
281<p> When a protocol emits this signal, QNetworkProtocol is smart
282enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
283protocol, emit its corresponding signal.
284
285<h3 class=fn><a href="qnetworkprotocol.html">QNetworkProtocol</a>&nbsp;* <a name="getNetworkProtocol"></a>QNetworkProtocol::getNetworkProtocol ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;protocol )<tt> [static]</tt>
286</h3>
287Static method to get a new instance of the network protocol <em>protocol</em>. For example, if you need to do some FTP operations, do
288the following:
289<pre>
290 <a href="qftp.html">QFtp</a> *ftp = QNetworkProtocol::<a href="#getNetworkProtocol">getNetworkProtocol</a>( "ftp" );
291 </pre>
292
293This returns a pointer to a new instance of an ftp implementation
294or null if no protocol for ftp was registered. The ownership of
295the pointer is transferred to you, so you must delete it if you
296don't need it anymore.
297<p> Normally you should not work directly with network protocols, so
298you 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
300convenient.
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>
305Returns TRUE if the only protocol registered is for working on the
306local filesystem; returns FALSE if other network protocols are
307also registered.
308
309<h3 class=fn>void <a name="itemChanged"></a>QNetworkProtocol::itemChanged ( <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
310</h3>
311
312<p> This signal is emitted whenever a file which is a child of this
313URL has been changed, e.g. by successfully calling rename(). <em>op</em>
314holds the original and the new file names in the first and second
315arguments, accessible with op->arg( 0 ) and op->arg( 1 )
316respectively. <em>op</em> is the pointer to the operation object which
317contains all the information about the operation, including the
318state, etc.
319<p> When a protocol emits this signal, QNetworkProtocol is smart
320enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
321protocol, emit its corresponding signal.
322
323<h3 class=fn>void <a name="newChild"></a>QNetworkProtocol::newChild ( const&nbsp;<a href="qurlinfo.html">QUrlInfo</a>&nbsp;&amp;&nbsp;i, <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
324</h3>
325
326<p> This signal is emitted if a new child (file) has been read.
327QNetworkProtocol automatically connects it to a slot which creates
328a list of <a href="qurlinfo.html">QUrlInfo</a> objects (with just one QUrlInfo <em>i</em>) and emits
329the <a href="#newChildren">newChildren</a>() signal with this list. <em>op</em> is the pointer to
330the operation object which contains all the information about the
331operation that has finished, including the state, etc.
332<p> This is just a convenience signal useful for implementing your own
333network protocol. In all other cases connect to the newChildren()
334signal with its list of QUrlInfo objects.
335
336<h3 class=fn>void <a name="newChildren"></a>QNetworkProtocol::newChildren ( const&nbsp;<a href="qvaluelist.html">QValueList</a>&lt;QUrlInfo&gt;&nbsp;&amp;&nbsp;i, <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [signal]</tt>
337</h3>
338
339<p> This signal is emitted after listChildren() was called and new
340children (files) have been read from the list of files. <em>i</em> holds
341the information about the new children. <em>op</em> is the pointer to
342the operation object which contains all the information about the
343operation, including the state, etc.
344<p> When a protocol emits this signal, QNetworkProtocol is smart
345enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
346protocol, emit its corresponding signal.
347<p> When implementing your own network protocol and reading children,
348you usually don't read one child at once, but rather a list of
349them. That's why this signal takes a list of <a href="qurlinfo.html">QUrlInfo</a> objects. If
350you prefer to read just one child at a time you can use the
351convenience signal <a href="#newChild">newChild</a>(), which takes a single QUrlInfo
352object.
353
354<h3 class=fn>void <a name="operationGet"></a>QNetworkProtocol::operationGet ( <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [virtual protected]</tt>
355</h3>
356When implementing a new network protocol, this method should be
357reimplemented if the protocol supports getting data; this method
358should then process the <a href="qnetworkoperation.html">QNetworkOperation</a>.
359<p> When you reimplement this method it's very important that you emit
360the correct signals at the correct time (especially the <a href="#finished">finished</a>()
361signal after processing an operation). Take a look at the <a href="network.html">Qt Network Documentation</a> which describes in
362detail how to reimplement this method. You may also want to look
363at the example implementation in
364examples/network/networkprotocol/nntp.cpp.
365<p> <em>op</em> is the pointer to the operation object which contains all
366the information on the operation that has finished, including the
367state, 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>&nbsp;* <a name="operationInProgress"></a>QNetworkProtocol::operationInProgress () const
371</h3>
372Returns the operation, which is being processed, or 0 of no
373operation is being processed at the moment.
374
375<h3 class=fn>void <a name="operationListChildren"></a>QNetworkProtocol::operationListChildren ( <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [virtual protected]</tt>
376</h3>
377When implementing a new network protocol, this method should be
378reimplemented if the protocol supports listing children (files);
379this 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
381the correct signals at the correct time (especially the <a href="#finished">finished</a>()
382signal after processing an operation). Take a look at the <a href="network.html">Qt Network Documentation</a> which describes in
383detail how to reimplement this method. You may also want to look
384at the example implementation in
385examples/network/networkprotocol/nntp.cpp.
386<p> <em>op</em> is the pointer to the operation object which contains all
387the information on the operation that has finished, including the
388state, 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>&nbsp;*&nbsp;op )<tt> [virtual protected]</tt>
392</h3>
393When implementing a new network protocol, this method should be
394reimplemented if the protocol supports making directories; this
395method should then process this <a href="qnetworkoperation.html">QNetworkOperation</a>.
396<p> When you reimplement this method it's very important that you emit
397the correct signals at the correct time (especially the <a href="#finished">finished</a>()
398signal after processing an operation). Take a look at the <a href="network.html">Qt Network Documentation</a> which describes in
399detail how to reimplement this method. You may also want to look
400at the example implementation in
401examples/network/networkprotocol/nntp.cpp.
402<p> <em>op</em> is the pointer to the operation object which contains all
403the information on the operation that has finished, including the
404state, etc.
405
406<h3 class=fn>void <a name="operationPut"></a>QNetworkProtocol::operationPut ( <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [virtual protected]</tt>
407</h3>
408When implementing a new network protocol, this method should be
409reimplemented if the protocol supports putting (uploading) data;
410this 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
412the correct signals at the correct time (especially the <a href="#finished">finished</a>()
413signal after processing an operation). Take a look at the <a href="network.html">Qt Network Documentation</a> which describes in
414detail how to reimplement this method. You may also want to look
415at the example implementation in
416examples/network/networkprotocol/nntp.cpp.
417<p> <em>op</em> is the pointer to the operation object which contains all
418the information on the operation that has finished, including the
419state, etc.
420
421<h3 class=fn>void <a name="operationRemove"></a>QNetworkProtocol::operationRemove ( <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [virtual protected]</tt>
422</h3>
423When implementing a new network protocol, this method should be
424reimplemented if the protocol supports removing children (files);
425this 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
427the correct signals at the correct time (especially the <a href="#finished">finished</a>()
428signal after processing an operation). Take a look at the <a href="network.html">Qt Network Documentation</a> which is describes
429in detail how to reimplement this method. You may also want to
430look at the example implementation in
431examples/network/networkprotocol/nntp.cpp.
432<p> <em>op</em> is the pointer to the operation object which contains all
433the information on the operation that has finished, including the
434state, etc.
435
436<h3 class=fn>void <a name="operationRename"></a>QNetworkProtocol::operationRename ( <a href="qnetworkoperation.html">QNetworkOperation</a>&nbsp;*&nbsp;op )<tt> [virtual protected]</tt>
437</h3>
438When implementing a new newtork protocol, this method should be
439reimplemented if the protocol supports renaming children (files);
440this 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
442the correct signals at the correct time (especially the <a href="#finished">finished</a>()
443signal after processing an operation). Take a look at the <a href="network.html">Qt Network Documentation</a> which describes in
444detail how to reimplement this method. You may also want to look
445at the example implementation in
446examples/network/networkprotocol/nntp.cpp.
447<p> <em>op</em> is the pointer to the operation object which contains all
448the information on the operation that has finished, including the
449state, etc.
450
451<h3 class=fn>void <a name="registerNetworkProtocol"></a>QNetworkProtocol::registerNetworkProtocol ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;protocol, QNetworkProtocolFactoryBase&nbsp;*&nbsp;protocolFactory )<tt> [static]</tt>
452</h3>
453Static method to register a network protocol for Qt. For example,
454if you have an implementation of NNTP (called Nntp) which is
455derived from QNetworkProtocol, call:
456<pre>
457 QNetworkProtocol::<a href="#registerNetworkProtocol">registerNetworkProtocol</a>( "nntp", new QNetworkProtocolFactory&lt;Nntp&gt; );
458 </pre>
459
460after which your implementation is registered for future nntp
461operations.
462<p> The name of the protocol is given in <em>protocol</em> and a pointer to
463the 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>&nbsp;*&nbsp;op )<tt> [signal]</tt>
466</h3>
467
468<p> This signal is emitted when remove() has been succesful and the
469file has been removed. <em>op</em> holds the file name of the removed
470file in the first argument, accessible with op->arg( 0 ). <em>op</em> is
471the pointer to the operation object which contains all the
472information about the operation, including the state, etc.
473<p> When a protocol emits this signal, QNetworkProtocol is smart
474enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
475protocol, emit its corresponding signal.
476
477<h3 class=fn>void <a name="setAutoDelete"></a>QNetworkProtocol::setAutoDelete ( bool&nbsp;b, int&nbsp;i = 10000 )<tt> [virtual]</tt>
478</h3>
479Because it's sometimes hard to take care of removing network
480protocol instances, QNetworkProtocol provides an auto-delete
481mechanism. If you set <em>b</em> to TRUE, the network protocol instance
482is 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).
484If you set <em>b</em> to FALSE the auto-delete mechanism is switched
485off.
486<p> If you switch on auto-delete, the QNetworkProtocol also deletes
487its <a href="qurloperator.html">QUrlOperator</a>.
488
489<h3 class=fn>void <a name="setUrl"></a>QNetworkProtocol::setUrl ( <a href="qurloperator.html">QUrlOperator</a>&nbsp;*&nbsp;u )<tt> [virtual]</tt>
490</h3>
491Sets 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>&nbsp;*&nbsp;op )<tt> [signal]</tt>
495</h3>
496
497<p> Some operations (such as listChildren()) emit this signal when
498they start processing the operation. <em>op</em> is the pointer to the
499operation object which contains all the information about the
500operation, including the state, etc.
501<p> When a protocol emits this signal, QNetworkProtocol is smart
502enough to let the <a href="qurloperator.html">QUrlOperator</a>, which is used by the network
503protocol, emit its corresponding signal.
504
505<h3 class=fn>void <a name="stop"></a>QNetworkProtocol::stop ()<tt> [virtual]</tt>
506</h3>
507Stops the current operation that is being processed and clears all
508waiting operations.
509
510<h3 class=fn>int <a name="supportedOperations"></a>QNetworkProtocol::supportedOperations () const<tt> [virtual]</tt>
511</h3>
512Returns an int that is OR'd together using the enum values of
513<a href="#Operation-enum">QNetworkProtocol::Operation</a>, which describes which operations
514are supported by the network protocol. Should be reimplemented by
515new 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>&nbsp;* <a name="url"></a>QNetworkProtocol::url () const
519</h3>
520Returns the <a href="qurloperator.html">QUrlOperator</a> on which the protocol works.
521
522<!-- eof -->
523<hr><p>
524This file is part of the <a href="index.html">Qt toolkit</a>.
525Copyright &copy; 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 &copy; 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>
Note: See TracBrowser for help on using the repository browser.