📄 qurl.3qt
字号:
'\" t.TH QUrl 3qt "9 December 2002" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQUrl \- URL parser and simplifies working with URLs.SH SYNOPSIS\fC#include <qurl.h>\fR.PPInherited by QUrlOperator..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQUrl\fR ()".br.ti -1c.BI "\fBQUrl\fR ( const QString & url )".br.ti -1c.BI "\fBQUrl\fR ( const QUrl & url )".br.ti -1c.BI "\fBQUrl\fR ( const QUrl & url, const QString & relUrl, bool checkSlash = FALSE )".br.ti -1c.BI "virtual \fB~QUrl\fR ()".br.ti -1c.BI "QString \fBprotocol\fR () const".br.ti -1c.BI "virtual void \fBsetProtocol\fR ( const QString & protocol )".br.ti -1c.BI "QString \fBuser\fR () const".br.ti -1c.BI "virtual void \fBsetUser\fR ( const QString & user )".br.ti -1c.BI "bool \fBhasUser\fR () const".br.ti -1c.BI "QString \fBpassword\fR () const".br.ti -1c.BI "virtual void \fBsetPassword\fR ( const QString & pass )".br.ti -1c.BI "bool \fBhasPassword\fR () const".br.ti -1c.BI "QString \fBhost\fR () const".br.ti -1c.BI "virtual void \fBsetHost\fR ( const QString & host )".br.ti -1c.BI "bool \fBhasHost\fR () const".br.ti -1c.BI "int \fBport\fR () const".br.ti -1c.BI "virtual void \fBsetPort\fR ( int port )".br.ti -1c.BI "bool \fBhasPort\fR () const".br.ti -1c.BI "QString \fBpath\fR ( bool correct = TRUE ) const".br.ti -1c.BI "virtual void \fBsetPath\fR ( const QString & path )".br.ti -1c.BI "bool \fBhasPath\fR () const".br.ti -1c.BI "virtual void \fBsetEncodedPathAndQuery\fR ( const QString & pathAndQuery )".br.ti -1c.BI "QString \fBencodedPathAndQuery\fR ()".br.ti -1c.BI "virtual void \fBsetQuery\fR ( const QString & txt )".br.ti -1c.BI "QString \fBquery\fR () const".br.ti -1c.BI "QString \fBref\fR () const".br.ti -1c.BI "virtual void \fBsetRef\fR ( const QString & txt )".br.ti -1c.BI "bool \fBhasRef\fR () const".br.ti -1c.BI "bool \fBisValid\fR () const".br.ti -1c.BI "bool \fBisLocalFile\fR () const".br.ti -1c.BI "virtual void \fBaddPath\fR ( const QString & pa )".br.ti -1c.BI "virtual void \fBsetFileName\fR ( const QString & name )".br.ti -1c.BI "QString \fBfileName\fR () const".br.ti -1c.BI "QString \fBdirPath\fR () const".br.ti -1c.BI "QUrl & \fBoperator=\fR ( const QUrl & url )".br.ti -1c.BI "QUrl & \fBoperator=\fR ( const QString & url )".br.ti -1c.BI "bool \fBoperator==\fR ( const QUrl & url ) const".br.ti -1c.BI "bool \fBoperator==\fR ( const QString & url ) const".br.ti -1c.BI "\fBoperator QString\fR () const".br.ti -1c.BI "virtual QString \fBtoString\fR ( bool encodedPath = FALSE, bool forcePrependProtocol = TRUE ) const".br.ti -1c.BI "virtual bool \fBcdUp\fR ()".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "void \fBdecode\fR ( QString & url )".br.ti -1c.BI "void \fBencode\fR ( QString & url )".br.ti -1c.BI "bool \fBisRelativeUrl\fR ( const QString & url )".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBreset\fR ()".br.ti -1c.BI "virtual bool \fBparse\fR ( const QString & url )".br.in -1c.SH DESCRIPTIONThe QUrl class provides a URL parser and simplifies working with URLs..PPThe QUrl class is provided for simple work with URLs. It can parse, decode, encode, etc..PPQUrl works with the decoded path and encoded query in turn..PPExample:.PP\fChttp://www.trolltech.com:80/cgi-bin/test%20me.pl?cmd=Hello%20you\fR.PP<center>.nf.TSl - l. Function Returns protocol() "http" host() "www.trolltech.com" port() 80 path() "cgi-bin" fileName() "testme.pl" query().TE.fi</center>.PPExample:.PP\fChttp://doc.trolltech.com/qdockarea.html#lines\fR.PP<center>.nf.TSl - l. Function Returns protocol() "http" host() "doc.trolltech.com" fileName() "qdockarea.html" ref().TE.fi</center>.PPThe individual parts of a URL can be set with setProtocol(), setHost(), setPort(), setPath(), setFileName(), setRef() and setQuery(). A URL could contain, for example, an ftp address which requires a user name and password; these can be set with setUser() and setPassword()..PPBecause path is always encoded internally you must not use "%00" in the path, although this is okay (but not recommended) for the query..PPQUrl is normally used like this:.PP.nf.br QUrl url( "http://www.trolltech.com" );.br // or.br QUrl url( "file:/home/myself/Mail", "Inbox" );.br.fi.PPYou can then access and manipulate the various parts of the URL..PPTo make it easy to work with QUrls and QStrings, QUrl implements the necessary cast and assignment operators so you can do following:.PP.nf.br QUrl url( "http://www.trolltech.com" );.br QString s = url;.br // or.br QString s( "http://www.trolltech.com" );.br QUrl url( s );.br.fi.PPUse the static functions, encode() and decode() to encode or decode a URL in a string. (They operate on the string in-place.) The isRelativeUrl() static function returns TRUE if the given string is a relative URL..PPIf you want to use a URL to work on a hierarchical structure (e.g. a local or remote filesystem), you might want to use the subclass QUrlOperator..PPSee also QUrlOperator, Input/Output and Networking, and Miscellaneous Classes..SH MEMBER FUNCTION DOCUMENTATION.SH "QUrl::QUrl ()"Constructs an empty URL that is invalid..SH "QUrl::QUrl ( const QString & url )"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -