qurloperator.html

来自「QT 下载资料仅供参考」· HTML 代码 · 共 511 行 · 第 1/3 页

HTML
511
字号
<!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/qurloperator.cpp:88 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QUrlOperator 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&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;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>QUrlOperator Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1><p>The QUrlOperator class provides common operations on URLs.<a href="#details">More...</a><p><tt>#include &lt;<a href="qurloperator-h.html">qurloperator.h</a>&gt;</tt><p>Inherits <a href="qobject.html">QObject</a> and <a href="qurl.html">QUrl</a>.<p><a href="qurloperator-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QUrlOperator"><b>QUrlOperator</b></a> ()</div></li><li><div class=fn><a href="#QUrlOperator-2"><b>QUrlOperator</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;url )</div></li><li><div class=fn><a href="#QUrlOperator-3"><b>QUrlOperator</b></a> ( const&nbsp;QUrlOperator&nbsp;&amp;&nbsp;url )</div></li><li><div class=fn><a href="#QUrlOperator-4"><b>QUrlOperator</b></a> ( const&nbsp;QUrlOperator&nbsp;&amp;&nbsp;url, const&nbsp;QString&nbsp;&amp;&nbsp;relUrl, bool&nbsp;checkSlash = FALSE )</div></li><li><div class=fn>virtual <a href="#~QUrlOperator"><b>~QUrlOperator</b></a> ()</div></li><li><div class=fn>virtual const QNetworkOperation * <a href="#listChildren"><b>listChildren</b></a> ()</div></li><li><div class=fn>virtual const QNetworkOperation * <a href="#mkdir"><b>mkdir</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;dirname )</div></li><li><div class=fn>virtual const QNetworkOperation * <a href="#remove"><b>remove</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;filename )</div></li><li><div class=fn>virtual const QNetworkOperation * <a href="#rename"><b>rename</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;oldname, const&nbsp;QString&nbsp;&amp;&nbsp;newname )</div></li><li><div class=fn>virtual const QNetworkOperation * <a href="#get"><b>get</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;location = QString::null )</div></li><li><div class=fn>virtual const QNetworkOperation * <a href="#put"><b>put</b></a> ( const&nbsp;QByteArray&nbsp;&amp;&nbsp;data, const&nbsp;QString&nbsp;&amp;&nbsp;location = QString::null )</div></li><li><div class=fn>virtual QPtrList&lt;QNetworkOperation&gt; <a href="#copy"><b>copy</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;from, const&nbsp;QString&nbsp;&amp;&nbsp;to, bool&nbsp;move = FALSE, bool&nbsp;toPath = TRUE )</div></li><li><div class=fn>virtual void <a href="#copy-2"><b>copy</b></a> ( const&nbsp;QStringList&nbsp;&amp;&nbsp;files, const&nbsp;QString&nbsp;&amp;&nbsp;dest, bool&nbsp;move = FALSE )</div></li><li><div class=fn>virtual bool <a href="#isDir"><b>isDir</b></a> ( bool&nbsp;*&nbsp;ok = 0 )</div></li><li><div class=fn>virtual void <a href="#setNameFilter"><b>setNameFilter</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;nameFilter )</div></li><li><div class=fn>QString <a href="#nameFilter"><b>nameFilter</b></a> () const</div></li><li><div class=fn>virtual QUrlInfo <a href="#info"><b>info</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;entry ) const</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="#newChildren"><b>newChildren</b></a> ( const&nbsp;QValueList&lt;QUrlInfo&gt;&nbsp;&amp;&nbsp;i, QNetworkOperation&nbsp;*&nbsp;op )</div></li><li><div class=fn>void <a href="#finished"><b>finished</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</div></li><li><div class=fn>void <a href="#start"><b>start</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</div></li><li><div class=fn>void <a href="#createdDirectory"><b>createdDirectory</b></a> ( const&nbsp;QUrlInfo&nbsp;&amp;&nbsp;i, QNetworkOperation&nbsp;*&nbsp;op )</div></li><li><div class=fn>void <a href="#removed"><b>removed</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</div></li><li><div class=fn>void <a href="#itemChanged"><b>itemChanged</b></a> ( QNetworkOperation&nbsp;*&nbsp;op )</div></li><li><div class=fn>void <a href="#data"><b>data</b></a> ( const&nbsp;QByteArray&nbsp;&amp;&nbsp;data, QNetworkOperation&nbsp;*&nbsp;op )</div></li><li><div class=fn>void <a href="#dataTransferProgress"><b>dataTransferProgress</b></a> ( int&nbsp;bytesDone, int&nbsp;bytesTotal, QNetworkOperation&nbsp;*&nbsp;op )</div></li><li><div class=fn>void <a href="#startedNextCopy"><b>startedNextCopy</b></a> ( const&nbsp;QPtrList&lt;QNetworkOperation&gt;&nbsp;&amp;&nbsp;lst )</div></li><li><div class=fn>void <a href="#connectionStateChanged"><b>connectionStateChanged</b></a> ( int&nbsp;state, const&nbsp;QString&nbsp;&amp;&nbsp;data )</div></li></ul><h2>Protected Members</h2><ul><li><div class=fn>virtual void <a href="#clearEntries"><b>clearEntries</b></a> ()</div></li><li><div class=fn>void <a href="#getNetworkProtocol"><b>getNetworkProtocol</b></a> ()</div></li><li><div class=fn>void <a href="#deleteNetworkProtocol"><b>deleteNetworkProtocol</b></a> ()</div></li></ul><h2>Related Functions</h2><ul><li><div class=fn>void <a href="#qInitNetworkProtocols"><b>qInitNetworkProtocols</b></a> ()</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2><p> The QUrlOperator class provides common operations on URLs.<p> <p> <p> This class operates on hierarchical structures (such asfilesystems) using URLs. Its API facilitates all the commonoperations:<center><table cellpadding="4" cellspacing="2" border="0"><tr bgcolor="#a2c511"> <th valign="top">Operation	<th valign="top">Function<tr bgcolor="#f0f0f0"> <td valign="top">List files		<td valign="top"><a href="#listChildren">listChildren</a>()<tr bgcolor="#d0d0d0"> <td valign="top">Make a directory	<td valign="top"><a href="#mkdir">mkdir</a>()<tr bgcolor="#f0f0f0"> <td valign="top">Remove a file	<td valign="top"><a href="#remove">remove</a>()<tr bgcolor="#d0d0d0"> <td valign="top">Rename a file	<td valign="top"><a href="#rename">rename</a>()<tr bgcolor="#f0f0f0"> <td valign="top">Get a file		<td valign="top"><a href="#get">get</a>()<tr bgcolor="#d0d0d0"> <td valign="top">Put a file		<td valign="top"><a href="#put">put</a>()<tr bgcolor="#f0f0f0"> <td valign="top">Copy a file		<td valign="top"><a href="#copy">copy</a>()</table></center><p> You can obtain additional information about the URL with <a href="#isDir">isDir</a>()and <a href="#info">info</a>(). If a directory is to be traversed using<a href="#listChildren">listChildren</a>(), a name filter can be set with <a href="#setNameFilter">setNameFilter</a>().<p> A QUrlOperator can be used like this, for example to download afile (and assuming that the FTP protocol is <a href="#qInitNetworkProtocols">registered</a>):<pre>    QUrlOperator *op = new QUrlOperator();    op-&gt;<a href="#copy">copy</a>( QString("ftp://ftp.trolltech.com/qt/source/qt-2.1.0.tar.gz"),             "file:/tmp" );    </pre> <p> If you want to be notified about success/failure, progress, etc.,you can connect to QUrlOperator's signals, e.g. to <a href="#start">start</a>(),<a href="#newChildren">newChildren</a>(), <a href="#createdDirectory">createdDirectory</a>(), <a href="#removed">removed</a>(), <a href="#data">data</a>(),<a href="#dataTransferProgress">dataTransferProgress</a>(), <a href="#startedNextCopy">startedNextCopy</a>(),<a href="#connectionStateChanged">connectionStateChanged</a>(), <a href="#finished">finished</a>(), etc. A network operation canbe stopped with <a href="#stop">stop</a>().<p> The class uses the functionality of registered network protocolsto perform these operations. Depending of the protocol of the URL,it uses an appropriate network protocol class for the operations.Each of the operation functions of QUrlOperator creates a<a href="qnetworkoperation.html">QNetworkOperation</a> object that describes the operation and puts itinto the operation queue for the network protocol used. If nosuitable protocol could be found (because no implementation of thenecessary network protocol is registered), the URL operator emitserrors. Not every protocol supports every operation, but errorhandling deals with this problem.<p> To register the available network protocols, use the<a href="#qInitNetworkProtocols">qInitNetworkProtocols</a>() function. The protocols currentlysupported are:<ul><li> <a href="qftp.html">FTP</a>,<li> <a href="qhttp.html">HTTP</a>,<li> <a href="qlocalfs.html">local file system</a>.</ul><p> For more information about the Qt Network Architecture see the<a href="network.html">Qt Network Documentation</a>.<p> <p>See also <a href="qnetworkprotocol.html">QNetworkProtocol</a>, <a href="qnetworkoperation.html">QNetworkOperation</a>, <a href="io.html">Input/Output and Networking</a> and <a href="misc.html">Miscellaneous Classes</a>.<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QUrlOperator"></a>QUrlOperator::QUrlOperator ()</h3>Constructs a QUrlOperator with an empty (i.e. invalid) URL.<h3 class=fn><a name="QUrlOperator-2"></a>QUrlOperator::QUrlOperator ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;url )</h3>Constructs a QUrlOperator using <em>url</em> and parses this string.<p> If you pass strings like "/home/qt" the "file" protocol isassumed.<h3 class=fn><a name="QUrlOperator-3"></a>QUrlOperator::QUrlOperator ( const&nbsp;<a href="qurloperator.html">QUrlOperator</a>&nbsp;&amp;&nbsp;url )</h3>Constructs a copy of <em>url</em>.<h3 class=fn><a name="QUrlOperator-4"></a>QUrlOperator::QUrlOperator ( const&nbsp;<a href="qurloperator.html">QUrlOperator</a>&nbsp;&amp;&nbsp;url, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;relUrl, bool&nbsp;checkSlash = FALSE )</h3>Constructs a QUrlOperator. The URL on which this QUrlOperatoroperates is constructed out of the arguments <em>url</em>, <em>relUrl</em> and<em>checkSlash</em>: see the corresponding <a href="qurl.html">QUrl</a> constructor for anexplanation of these arguments.<h3 class=fn><a name="~QUrlOperator"></a>QUrlOperator::~QUrlOperator ()<tt> [virtual]</tt></h3>Destructor.<h3 class=fn>void <a name="clearEntries"></a>QUrlOperator::clearEntries ()<tt> [virtual protected]</tt></h3>Clears the cache of children.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?