qnetworkprotocol.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 530 行 · 第 1/3 页
HTML
530 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/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"><!--h3.fn,span.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</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><div class=fn>enum <a href="#State-enum"><b>State</b></a> { StWaiting = 0, StInProgress, StDone, StFailed, StStopped }</div></li><li><div 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 }</div></li><li><div class=fn>enum <a href="#ConnectionState-enum"><b>ConnectionState</b></a> { ConHostFound, ConConnected, ConClosed }</div></li><li><div 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 }</div></li><li><div class=fn><a href="#QNetworkProtocol"><b>QNetworkProtocol</b></a> ()</div></li><li><div class=fn>virtual <a href="#~QNetworkProtocol"><b>~QNetworkProtocol</b></a> ()</div></li><li><div class=fn>virtual void <a href="#setUrl"><b>setUrl</b></a> ( QUrlOperator * u )</div></li><li><div class=fn>virtual void <a href="#setAutoDelete"><b>setAutoDelete</b></a> ( bool b, int i = 10000 )</div></li><li><div class=fn>bool <a href="#autoDelete"><b>autoDelete</b></a> () const</div></li><li><div class=fn>virtual int <a href="#supportedOperations"><b>supportedOperations</b></a> () const</div></li><li><div class=fn>virtual void <a href="#addOperation"><b>addOperation</b></a> ( QNetworkOperation * op )</div></li><li><div class=fn>QUrlOperator * <a href="#url"><b>url</b></a> () const</div></li><li><div class=fn>QNetworkOperation * <a href="#operationInProgress"><b>operationInProgress</b></a> () const</div></li><li><div class=fn>virtual void <a href="#clearOperationQueue"><b>clearOperationQueue</b></a> ()</div></li><li><div class=fn>virtual void <a href="#stop"><b>stop</b></a> ()</div></li></ul><h2>Signals</h2><ul><li><div class=fn>void <a href="#data"><b>data</b></a> ( const QByteArray & data, QNetworkOperation * op )</div></li><li><div class=fn>void <a href="#connectionStateChanged"><b>connectionStateChanged</b></a> ( int state, const QString & data )</div></li><li><div class=fn>void <a href="#finished"><b>finished</b></a> ( QNetworkOperation * op )</div></li><li><div class=fn>void <a href="#start"><b>start</b></a> ( QNetworkOperation * op )</div></li><li><div class=fn>void <a href="#newChildren"><b>newChildren</b></a> ( const QValueList<QUrlInfo> & i, QNetworkOperation * op )</div></li><li><div class=fn>void <a href="#newChild"><b>newChild</b></a> ( const QUrlInfo & i, QNetworkOperation * op )</div></li><li><div class=fn>void <a href="#createdDirectory"><b>createdDirectory</b></a> ( const QUrlInfo & i, QNetworkOperation * op )</div></li><li><div class=fn>void <a href="#removed"><b>removed</b></a> ( QNetworkOperation * op )</div></li><li><div class=fn>void <a href="#itemChanged"><b>itemChanged</b></a> ( QNetworkOperation * op )</div></li><li><div class=fn>void <a href="#dataTransferProgress"><b>dataTransferProgress</b></a> ( int bytesDone, int bytesTotal, QNetworkOperation * op )</div></li></ul><h2>Static Public Members</h2><ul><li><div class=fn>void <a href="#registerNetworkProtocol"><b>registerNetworkProtocol</b></a> ( const QString & protocol, QNetworkProtocolFactoryBase * protocolFactory )</div></li><li><div class=fn>QNetworkProtocol * <a href="#getNetworkProtocol"><b>getNetworkProtocol</b></a> ( const QString & protocol )</div></li><li><div class=fn>bool <a href="#hasOnlyLocalFileSystem"><b>hasOnlyLocalFileSystem</b></a> ()</div></li></ul><h2>Protected Members</h2><ul><li><div class=fn>virtual void <a href="#operationListChildren"><b>operationListChildren</b></a> ( QNetworkOperation * op )</div></li><li><div class=fn>virtual void <a href="#operationMkDir"><b>operationMkDir</b></a> ( QNetworkOperation * op )</div></li><li><div class=fn>virtual void <a href="#operationRemove"><b>operationRemove</b></a> ( QNetworkOperation * op )</div></li><li><div class=fn>virtual void <a href="#operationRename"><b>operationRename</b></a> ( QNetworkOperation * op )</div></li><li><div class=fn>virtual void <a href="#operationGet"><b>operationGet</b></a> ( QNetworkOperation * op )</div></li><li><div class=fn>virtual void <a href="#operationPut"><b>operationPut</b></a> ( QNetworkOperation * op )</div></li><li><div class=fn>virtual bool <a href="#checkConnection"><b>checkConnection</b></a> ( QNetworkOperation * op )</div></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 protocolsimplementations that can then be used in Qt (e.g. in the filedialog) together with the <a href="qurloperator.html">QUrlOperator</a>.<p> The easiest way to implement a new network protocol is toreimplement the operation*() methods, e.g. <a href="#operationGet">operationGet</a>(), etc.Only the supported operations should be reimplemented. To specifywhich operations are supported, also reimplement<a href="#supportedOperations">supportedOperations</a>() and return an int that is OR'd togetherusing 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 toemit the correct signals. Also, always emit the <a href="#finished">finished</a>() signalwhen an operation is done (on success <em>and</em> on failure). Qtrelies on correctly emitted finished() signals.<p> For a detailed description of the Qt Network Architecture and howto 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 emitsthe signal <a href="#connectionStateChanged">connectionStateChanged</a>(). The first argument is one ofthe 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 hasone 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 implementationavailable for the protocol of the URL you are operating on (e.g.if the protocol is http and no http implementation has beenregistered).<li><tt>QNetworkProtocol::ErrUnsupported</tt> - The operation is not supported by theprotocol.<li><tt>QNetworkProtocol::ErrParse</tt> - The URL could not be parsed correctly.<li><tt>QNetworkProtocol::ErrLoginIncorrect</tt> - You needed to login but the usernameor password is wrong.<li><tt>QNetworkProtocol::ErrHostNotFound</tt> - The specified host (in the URL) couldn'tbe found.<li><tt>QNetworkProtocol::ErrListChildren</tt> - An error occurred while listing thechildren (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 operationdoesn't exist.<li><tt>QNetworkProtocol::ErrPermissionDenied</tt> - Permission for doing the operation hasbeen denied.</ul><p> You should also use these error codes when implementing customnetwork protocols. If this is not possible, you can define your ownerror codes by using integer values that don't conflict with anyof these values.<h3 class=fn><a name="Operation-enum"></a>QNetworkProtocol::Operation</h3><p> This enum lists the possible operations that a network protocolcan support. <a href="#supportedOperations">supportedOperations</a>() returns an int of these that isOR'd together. Also, the type() of a <a href="qnetworkoperation.html">QNetworkOperation</a> is alwaysone 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 queuewaiting to be prcessed.<li><tt>QNetworkProtocol::StInProgress</tt> - The operation is being processed.<li><tt>QNetworkProtocol::StDone</tt> - The operation has been processed succesfully.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?