📄 qurloperator.3qt
字号:
This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPCopies the \fIfiles\fR to the directory \fIdest\fR. If \fImove\fR is TRUE the files are moved, not copied. \fIdest\fR must point to a directory..PPThis function calls copy() for each entry in \fIfiles\fR in turn. You don't get a result from this function; each time a new copy begins, startedNextCopy() is emitted, with a list of QNetworkOperations that describe the new copy operation..SH "void QUrlOperator::createdDirectory ( const QUrlInfo & i, QNetworkOperation * op )\fC [signal]\fR"This signal is emitted when mkdir() succeeds and the directory has been created. \fIi\fR holds the information about the new directory..PP\fIop\fR is a pointer to the operation object, which contains all the information about the operation, including the state. \fCop->arg(0)\fR holds the new directory's name..PPSee also QNetworkOperation and QNetworkProtocol..SH "void QUrlOperator::data ( const QByteArray & data, QNetworkOperation * op )\fC [signal]\fR"This signal is emitted when new \fIdata\fR has been received after calling get() or put(). \fIop\fR is a pointer to the operation object which contains all the information about the operation, including the state. \fCop->arg(0)\fR holds the name of the file whose data is retrieved and op->rawArg(1) holds the (raw) data..PPSee also QNetworkOperation and QNetworkProtocol..SH "void QUrlOperator::dataTransferProgress ( int bytesDone, int bytesTotal, QNetworkOperation * op )\fC [signal]\fR"This signal is emitted during data transfer (using put() or get()). \fIbytesDone\fR specifies how many bytes of \fIbytesTotal\fR have been transferred. More information about the operation is stored in \fIop\fR, a pointer to the network operation that is processed. \fIbytesTotal\fR may be -1, which means that the total number of bytes is not known..PPSee also QNetworkOperation and QNetworkProtocol..SH "void QUrlOperator::deleteNetworkProtocol ()\fC [protected]\fR"Deletes the currently used network protocol..SH "void QUrlOperator::finished ( QNetworkOperation * op )\fC [signal]\fR"This signal is emitted when an operation of some sort finishes, whether with success or failure. \fIop\fR is a pointer to the operation object, which contains all the information, including the state, of the operation which has been finished. Check the state and error code of the operation object to see whether or not the operation was successful..PPSee also QNetworkOperation and QNetworkProtocol..SH "const QNetworkOperation * QUrlOperator::get ( const QString & location = QString::null )\fC [virtual]\fR"Tells the network protocol to get data from \fIlocation\fR or, if this is QString::null, to get data from the location to which this URL points (see QUrl::fileName() and QUrl::encodedPathAndQuery()). What happens then depends on the network protocol. The data() signal is emitted when data comes in. Because it's unlikely that all data will come in at once, it is common for multiple data() signals to be emitted. The dataTransferProgress() signal is emitted while processing the operation. At the end, finished() (with success or failure) is emitted, so check the state of the network operation object to see whether or not the operation was successful..PPIf \fIlocation\fR is QString::null, the path of this QUrlOperator should point to a file when you use this operation. If \fIlocation\fR is not empty, it can be a relative URL (a child of the path to which the QUrlOperator points) or an absolute URL..PPFor example, to get a web page you might do something like this:.PP.nf.br QUrlOperator op( "http://www.whatever.org/cgi-bin/search.pl?cmd=Hello" );.br op.get();.br.fi.PPFor most other operations, the path of the QUrlOperator must point to a directory. If you want to download a file you could do the following:.PP.nf.br QUrlOperator op( "ftp://ftp.whatever.org/pub" );.br // do some other stuff like op.listChildren() or op.mkdir( "new_dir" ).br op.get( "a_file.txt" );.br.fi.PPThis will get the data of ftp://ftp.whatever.org/pub/a_file.txt..PP\fINever\fR do anything like this:.PP.nf.br QUrlOperator op( "http://www.whatever.org/cgi-bin" );.br op.get( "search.pl?cmd=Hello" ); // WRONG!.br.fi.PPIf \fIlocation\fR is not empty and relative it must not contain any queries or references, just the name of a child. So if you need to specify a query or reference, do it as shown in the first example or specify the full URL (such as http://www.whatever.org/cgi-bin/search.pl?cmd=Hello) as \fIlocation\fR..PPSee also copy()..SH "void QUrlOperator::getNetworkProtocol ()\fC [protected]\fR"Finds a network protocol for the URL and deletes the old network protocol..SH "QUrlInfo QUrlOperator::info ( const QString & entry ) const\fC [virtual]\fR"Returns the URL information for the child \fIentry\fR, or returns an empty QUrlInfo object if there is no information available about \fIentry\fR..SH "bool QUrlOperator::isDir ( bool * ok = 0 )\fC [virtual]\fR"Returns TRUE if the URL is a directory; otherwise returns FALSE. This may not always work correctly, if the protocol of the URL is something other than file (local filesystem). If you pass a bool pointer as the \fIok\fR argument, \fI*ok\fR is set to TRUE if the result of this function is known to be correct, and to FALSE otherwise..SH "void QUrlOperator::itemChanged ( QNetworkOperation * op )\fC [signal]\fR"This signal is emitted whenever a file which is a child of the URL has been changed, for example by successfully calling rename(). \fIop\fR is a pointer to the operation object which contains all the information about the operation, including the state. \fCop->arg(0)\fR holds the original file name and \fCop->arg(1)\fR holds the new file name (if it was changed)..PPSee also QNetworkOperation and QNetworkProtocol..SH "const QNetworkOperation * QUrlOperator::listChildren ()\fC [virtual]\fR"Starts listing the children of this URL (e.g. the files in the directory). The start() signal is emitted before the first entry is listed and finished() is emitted after the last one. The newChildren() signal is emitted for each list of new entries. If an error occurs, the signal finished() is emitted, so be sure to check the state of the network operation pointer..PPBecause the operation may not be executed immediately, a pointer to the QNetworkOperation object created by this function is returned. This object contains all the data about the operation and is used to refer to this operation later (e.g. in the signals that are emitted by the QUrlOperator). The return value can also be 0 if the operation object couldn't be created..PPThe path of this QUrlOperator must to point to a directory (because the children of this directory will be listed), not to a file..SH "const QNetworkOperation * QUrlOperator::mkdir ( const QString & dirname )\fC [virtual]\fR"Tries to create a directory (child) with the name \fIdirname\fR. If it is successful, a newChildren() signal with the new child is emitted, and the createdDirectory() signal with the information about the new child is also emitted. The finished() signal (with success or failure) is emitted after the operation has been processed, so check the state of the network operation object to see whether or not the operation was successful..PPBecause the operation will not be executed immediately, a pointer to the QNetworkOperation object created by this function is returned. This object contains all the data about the operation and is used to refer to this operation later (e.g. in the signals that are emitted by the QUrlOperator). The return value can also be 0 if the operation object couldn't be created..PPThe path of this QUrlOperator must to point to a directory (not a file) because the new directory will be created in this path..SH "QString QUrlOperator::nameFilter () const"Returns the name filter of the URL..PPSee also QUrlOperator::setNameFilter() and QDir::nameFilter()..SH "void QUrlOperator::newChildren ( const QValueList<QUrlInfo> & i, QNetworkOperation * op )\fC [signal]\fR"This signal is emitted after listChildren() was called and new children (i.e. files) have been read from a list of files. \fIi\fR holds the information about the new files. \fIop\fR is a pointer to the operation object which contains all the information about the operation, including the state..PPSee also QNetworkOperation and QNetworkProtocol..SH "const QNetworkOperation * QUrlOperator::put ( const QByteArray & data, const QString & location = QString::null )\fC [virtual]\fR"This function tells the network protocol to put \fIdata\fR in \fIlocation\fR. If \fIlocation\fR is empty (QString::null), it puts the \fIdata\fR in the location to which the URL points. What happens depends on the network protocol. Depending on the network protocol, some data might come back after putting data, in which case the data() signal is emitted. The dataTransferProgress() signal is emitted during processing of the operation. At the end, finished() (with success or failure) is emitted, so check the state of the network operation object to see whether or not the operation was successful..PPIf \fIlocation\fR is QString::null, the path of this QUrlOperator should point to a file when you use this operation. If \fIlocation\fR is not empty, it can be a relative (a child of the path to which the QUrlOperator points) or an absolute URL..PPFor putting some data to a file you can do the following:.PP.nf.br QUrlOperator op( "ftp://ftp.whatever.com/home/me/filename.dat" );.br op.put( data );.br.fi.PPFor most other operations, the path of the QUrlOperator must point to a directory. If you want to upload data to a file you could do the following:.PP.nf.br QUrlOperator op( "ftp://ftp.whatever.com/home/me" );.br // do some other stuff like op.listChildren() or op.mkdir( "new_dir" ).br op.put( data, "filename.dat" );.br.fi.PPThis will upload the data to ftp://ftp.whatever.com/home/me/filename.dat..PPSee also copy()..SH "const QNetworkOperation * QUrlOperator::remove ( const QString & filename )\fC [virtual]\fR"Tries to remove the file (child) \fIfilename\fR. If it succeeds the removed() signal is emitted. finished() (with success or failure) is also emitted after the operation has been processed, so check the state of the network operation object to see whether or not the operation was successful..PPBecause the operation will not be executed immediately, a pointer to the QNetworkOperation object created by this function is returned. This object contains all the data about the operation and is used to refer to this operation later (e.g. in the signals that are emitted by the QUrlOperator). The return value can also be 0 if the operation object couldn't be created..PPThe path of this QUrlOperator must point to a directory; because if \fIfilename\fR is relative, it will try to remove it in this directory..SH "void QUrlOperator::removed ( QNetworkOperation * op )\fC [signal]\fR"This signal is emitted when remove() has been succesful and the file has been removed..PP\fIop\fR is a pointer to the operation object which contains all the information about the operation, including the state. \fCop->arg(0)\fR holds the name of the file that was removed..PPSee also QNetworkOperation and QNetworkProtocol..SH "const QNetworkOperation * QUrlOperator::rename ( const QString & oldname, const QString & newname )\fC [virtual]\fR"Tries to rename the file (child) called \fIoldname\fR to \fInewname\fR. If it succeeds, the itemChanged() signal is emitted. finished() (with success or failure) is also emitted after the operation has been processed, so check the state of the network operation object to see whether or not the operation was successful..PPBecause the operation may not be executed immediately, a pointer to the QNetworkOperation object created by this function is returned. This object contains all the data about the operation and is used to refer to this operation later (e.g. in the signals that are emitted by the QUrlOperator). The return value can also be 0 if the operation object couldn't be created..PPThis path of this QUrlOperator must to point to a directory because \fIoldname\fR and \fInewname\fR are handled relative to this directory..SH "void QUrlOperator::setNameFilter ( const QString & nameFilter )\fC [virtual]\fR"Sets the name filter of the URL to \fInameFilter\fR..PPSee also QDir::setNameFilter()..SH "void QUrlOperator::start ( QNetworkOperation * op )\fC [signal]\fR"Some operations (such as listChildren()) emit this signal when they start processing the operation. \fIop\fR is a pointer to the operation object which contains all the information about the operation, including the state..PPSee also QNetworkOperation and QNetworkProtocol..SH "void QUrlOperator::startedNextCopy ( const QPtrList<QNetworkOperation> & lst )\fC [signal]\fR"This signal is emitted if copy() starts a new copy operation. \fIlst\fR contains all QNetworkOperations related to this copy operation..PPSee also copy()..SH "void QUrlOperator::stop ()\fC [virtual]\fR"Stops the current network operation and removes all this QUrlOperator's waiting network operations..SH RELATED FUNCTION DOCUMENTATION.SH "void qInitNetworkProtocols ()"This function registers the network protocols for FTP and HTTP. You must call this function before you use QUrlOperator for these protocols..PPThis function is declared in qnetwork.h..SH "SEE ALSO".BR http://doc.trolltech.com/qurloperator.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qurloperator.3qt) and the Qtversion (3.1.1).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -