## Qt例程之Spider(ftp)

The QUrl class provides a convenient interface for working with URLs.
//QUrl提供了方便的接口爲urls
It can parse and construct URLs in both encoded and unencoded form. QUrl also has support for internationalized domain names (IDNs).
//可以解析和構造url在解碼和編碼格式

bool QUrl::isValid() const
Returns true if the URL is valid; otherwise returns false.
//當url是有效時,返回真

QString QUrl::scheme() const
Returns the scheme of the URL. If an empty string is returned, this means the scheme is undefined and the URL is then relative.
//返回url的scheme,當scheme是未定義,url是相對的,返回空string

QString QUrl::host() const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
//返回url的host,

int QUrl::port(int defaultPort) const
This is an overloaded function.
Returns the port of the URL, or defaultPort if the port is unspecified.
//返回url的port

int QFtp::connectToHost(const QString & host, quint16 port = 21)
Connects to the FTP server host using port port.
//使用port連接到ftp的服務host

int QFtp::login(const QString & user = QString(), const QString & password = QString())
Logs in to the FTP server with the username user and the password password.
//使用用戶名字和密碼登錄ftp,

QString QUrl::path() const
Returns the path of the URL.
//返回url的path

int QFtp::cd(const QString & dir)
Changes the working directory of the server to dir.
//改變服務器的工作目錄到dir

int QFtp::list(const QString & dir = QString())
Lists the contents of directory dir on the FTP server. If dir is empty, it lists the contents of the current directory.
//列出ftp服務器的目錄內容

QString QFtp::errorString() const
Returns a human-readable description of the last error that occurred.
//返回發生最後錯誤的描述
This is useful for presenting a error message to the user when receiving a commandFinished() or a done() signal with
the error argument set to true.

void QFtp::done(bool error)
This signal is emitted when the last pending command has finished; (it is emitted after the last command’s commandFinished() signal).
最後掛起的命令完成後,信號會發出。
error is true if an error occurred during the processing; otherwise error is false.

void QFtp::listInfo(const QUrlInfo & i)
This signal is emitted for each directory entry the list() command finds. The details of the entry are stored in i.
//爲list命令尋找的每個目錄 入口發射信號

The QUrlInfo class stores information about URLs.

bool QUrlInfo::isFile() const
Returns true if the URL is a file; otherwise returns false.
//url是文件返回true

bool QUrlInfo::isReadable() const
Returns true if the URL is readable; otherwise returns false.
//url是可讀的,返回true

QString QUrlInfo::name() const
Returns the file name of the URL.
//返回url的名字

bool QUrlInfo::isDir() const
Returns true if the URL is a directory; otherwise returns false.
//如果url是目錄,返回true

bool QUrlInfo::isSymLink() const
Returns true if the URL is a symbolic link; otherwise returns false.
//url是符號鏈接,返回真

int QFtp::get(const QString & file, QIODevice * dev = 0, TransferType type = Binary)
Downloads the file file from the server.
//從服務器下載文件

int QFtp::close()
Closes the connection to the FTP server.
//關閉ftp服務器的連接

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章