[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qurl.cpp:91 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QUrl Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QUrl Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QUrl class provides a URL parser and simplifies working with URLs.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p><tt>#include <<a href="qurl-h.html">qurl.h</a>></tt>
|
---|
| 37 | <p>Inherited by <a href="qurloperator.html">QUrlOperator</a>.
|
---|
| 38 | <p><a href="qurl-members.html">List of all member functions.</a>
|
---|
| 39 | <h2>Public Members</h2>
|
---|
| 40 | <ul>
|
---|
| 41 | <li class=fn><a href="#QUrl"><b>QUrl</b></a> ()</li>
|
---|
| 42 | <li class=fn><a href="#QUrl-2"><b>QUrl</b></a> ( const QString & url )</li>
|
---|
| 43 | <li class=fn><a href="#QUrl-3"><b>QUrl</b></a> ( const QUrl & url )</li>
|
---|
| 44 | <li class=fn><a href="#QUrl-4"><b>QUrl</b></a> ( const QUrl & url, const QString & relUrl, bool checkSlash = FALSE )</li>
|
---|
| 45 | <li class=fn>virtual <a href="#~QUrl"><b>~QUrl</b></a> ()</li>
|
---|
| 46 | <li class=fn>QString <a href="#protocol"><b>protocol</b></a> () const</li>
|
---|
| 47 | <li class=fn>virtual void <a href="#setProtocol"><b>setProtocol</b></a> ( const QString & protocol )</li>
|
---|
| 48 | <li class=fn>QString <a href="#user"><b>user</b></a> () const</li>
|
---|
| 49 | <li class=fn>virtual void <a href="#setUser"><b>setUser</b></a> ( const QString & user )</li>
|
---|
| 50 | <li class=fn>bool <a href="#hasUser"><b>hasUser</b></a> () const</li>
|
---|
| 51 | <li class=fn>QString <a href="#password"><b>password</b></a> () const</li>
|
---|
| 52 | <li class=fn>virtual void <a href="#setPassword"><b>setPassword</b></a> ( const QString & pass )</li>
|
---|
| 53 | <li class=fn>bool <a href="#hasPassword"><b>hasPassword</b></a> () const</li>
|
---|
| 54 | <li class=fn>QString <a href="#host"><b>host</b></a> () const</li>
|
---|
| 55 | <li class=fn>virtual void <a href="#setHost"><b>setHost</b></a> ( const QString & host )</li>
|
---|
| 56 | <li class=fn>bool <a href="#hasHost"><b>hasHost</b></a> () const</li>
|
---|
| 57 | <li class=fn>int <a href="#port"><b>port</b></a> () const</li>
|
---|
| 58 | <li class=fn>virtual void <a href="#setPort"><b>setPort</b></a> ( int port )</li>
|
---|
| 59 | <li class=fn>bool <a href="#hasPort"><b>hasPort</b></a> () const</li>
|
---|
| 60 | <li class=fn>QString <a href="#path"><b>path</b></a> ( bool correct = TRUE ) const</li>
|
---|
| 61 | <li class=fn>virtual void <a href="#setPath"><b>setPath</b></a> ( const QString & path )</li>
|
---|
| 62 | <li class=fn>bool <a href="#hasPath"><b>hasPath</b></a> () const</li>
|
---|
| 63 | <li class=fn>virtual void <a href="#setEncodedPathAndQuery"><b>setEncodedPathAndQuery</b></a> ( const QString & pathAndQuery )</li>
|
---|
| 64 | <li class=fn>QString <a href="#encodedPathAndQuery"><b>encodedPathAndQuery</b></a> ()</li>
|
---|
| 65 | <li class=fn>virtual void <a href="#setQuery"><b>setQuery</b></a> ( const QString & txt )</li>
|
---|
| 66 | <li class=fn>QString <a href="#query"><b>query</b></a> () const</li>
|
---|
| 67 | <li class=fn>QString <a href="#ref"><b>ref</b></a> () const</li>
|
---|
| 68 | <li class=fn>virtual void <a href="#setRef"><b>setRef</b></a> ( const QString & txt )</li>
|
---|
| 69 | <li class=fn>bool <a href="#hasRef"><b>hasRef</b></a> () const</li>
|
---|
| 70 | <li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
|
---|
| 71 | <li class=fn>bool <a href="#isLocalFile"><b>isLocalFile</b></a> () const</li>
|
---|
| 72 | <li class=fn>virtual void <a href="#addPath"><b>addPath</b></a> ( const QString & pa )</li>
|
---|
| 73 | <li class=fn>virtual void <a href="#setFileName"><b>setFileName</b></a> ( const QString & name )</li>
|
---|
| 74 | <li class=fn>QString <a href="#fileName"><b>fileName</b></a> () const</li>
|
---|
| 75 | <li class=fn>QString <a href="#dirPath"><b>dirPath</b></a> () const</li>
|
---|
| 76 | <li class=fn>QUrl & <a href="#operator-eq"><b>operator=</b></a> ( const QUrl & url )</li>
|
---|
| 77 | <li class=fn>QUrl & <a href="#operator-eq-2"><b>operator=</b></a> ( const QString & url )</li>
|
---|
| 78 | <li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QUrl & url ) const</li>
|
---|
| 79 | <li class=fn>bool <a href="#operator-eq-eq-2"><b>operator==</b></a> ( const QString & url ) const</li>
|
---|
| 80 | <li class=fn><a href="#operator-QString"><b>operator QString</b></a> () const</li>
|
---|
| 81 | <li class=fn>virtual QString <a href="#toString"><b>toString</b></a> ( bool encodedPath = FALSE, bool forcePrependProtocol = TRUE ) const</li>
|
---|
| 82 | <li class=fn>virtual bool <a href="#cdUp"><b>cdUp</b></a> ()</li>
|
---|
| 83 | </ul>
|
---|
| 84 | <h2>Static Public Members</h2>
|
---|
| 85 | <ul>
|
---|
| 86 | <li class=fn>void <a href="#decode"><b>decode</b></a> ( QString & url )</li>
|
---|
| 87 | <li class=fn>void <a href="#encode"><b>encode</b></a> ( QString & url )</li>
|
---|
| 88 | <li class=fn>bool <a href="#isRelativeUrl"><b>isRelativeUrl</b></a> ( const QString & url )</li>
|
---|
| 89 | </ul>
|
---|
| 90 | <h2>Protected Members</h2>
|
---|
| 91 | <ul>
|
---|
| 92 | <li class=fn>virtual void <a href="#reset"><b>reset</b></a> ()</li>
|
---|
| 93 | <li class=fn>virtual bool <a href="#parse"><b>parse</b></a> ( const QString & url )</li>
|
---|
| 94 | </ul>
|
---|
| 95 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 96 |
|
---|
| 97 |
|
---|
| 98 | <p> The QUrl class provides a URL parser and simplifies working with URLs.
|
---|
| 99 |
|
---|
| 100 | <p>
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | <p>
|
---|
| 104 | <p> The QUrl class is provided for simple work with URLs. It can
|
---|
| 105 | parse, decode, encode, etc.
|
---|
| 106 | <p> QUrl works with the decoded path and encoded query in turn.
|
---|
| 107 | <p> Example:
|
---|
| 108 | <p> <tt>http://www.trolltech.com:80/cgi-bin/test%20me.pl?cmd=Hello%20you</tt>
|
---|
| 109 | <p> <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
| 110 | <tr bgcolor="#a2c511"> <th valign="top">Function <th valign="top">Returns
|
---|
| 111 | <tr bgcolor="#f0f0f0"> <td valign="top"><a href="#protocol">protocol</a>() <td valign="top">"http"
|
---|
| 112 | <tr bgcolor="#d0d0d0"> <td valign="top"><a href="#host">host</a>() <td valign="top">"www.trolltech.com"
|
---|
| 113 | <tr bgcolor="#f0f0f0"> <td valign="top"><a href="#port">port</a>() <td valign="top">80
|
---|
| 114 | <tr bgcolor="#d0d0d0"> <td valign="top"><a href="#path">path</a>() <td valign="top">"/cgi-bin/test me.pl"
|
---|
| 115 | <tr bgcolor="#f0f0f0"> <td valign="top"><a href="#fileName">fileName</a>() <td valign="top">"test me.pl"
|
---|
| 116 | <tr bgcolor="#d0d0d0"> <td valign="top"><a href="#query">query</a>() <td valign="top">"cmd=Hello%20you"
|
---|
| 117 | </table></center>
|
---|
| 118 | <p> Example:
|
---|
| 119 | <p> <tt>http://doc.trolltech.com/qdockarea.html#lines</tt>
|
---|
| 120 | <p> <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
| 121 | <tr bgcolor="#a2c511"> <th valign="top">Function <th valign="top">Returns
|
---|
| 122 | <tr bgcolor="#f0f0f0"> <td valign="top"><a href="#protocol">protocol</a>() <td valign="top">"http"
|
---|
| 123 | <tr bgcolor="#d0d0d0"> <td valign="top"><a href="#host">host</a>() <td valign="top">"doc.trolltech.com"
|
---|
| 124 | <tr bgcolor="#f0f0f0"> <td valign="top"><a href="#fileName">fileName</a>() <td valign="top">"qdockarea.html"
|
---|
| 125 | <tr bgcolor="#d0d0d0"> <td valign="top"><a href="#ref">ref</a>() <td valign="top">"lines"
|
---|
| 126 | </table></center>
|
---|
| 127 | <p> The individual parts of a URL can be set with <a href="#setProtocol">setProtocol</a>(),
|
---|
| 128 | <a href="#setHost">setHost</a>(), <a href="#setPort">setPort</a>(), <a href="#setPath">setPath</a>(), <a href="#setFileName">setFileName</a>(), <a href="#setRef">setRef</a>() and
|
---|
| 129 | <a href="#setQuery">setQuery</a>(). A URL could contain, for example, an ftp address which
|
---|
| 130 | requires a user name and password; these can be set with <a href="#setUser">setUser</a>()
|
---|
| 131 | and <a href="#setPassword">setPassword</a>().
|
---|
| 132 | <p> Because path is always encoded internally you must not use "%00"
|
---|
| 133 | in the path, although this is okay (but not recommended) for the
|
---|
| 134 | query.
|
---|
| 135 | <p> QUrl is normally used like this:
|
---|
| 136 | <p> <pre>
|
---|
| 137 | QUrl url( "http://www.trolltech.com" );
|
---|
| 138 | // or
|
---|
| 139 | QUrl url( "file:/home/myself/Mail", "Inbox" );
|
---|
| 140 | </pre>
|
---|
| 141 |
|
---|
| 142 | <p> You can then access and manipulate the various parts of the URL.
|
---|
| 143 | <p> To make it easy to work with QUrls and QStrings, QUrl implements
|
---|
| 144 | the necessary cast and assignment operators so you can do
|
---|
| 145 | following:
|
---|
| 146 | <p> <pre>
|
---|
| 147 | QUrl url( "http://www.trolltech.com" );
|
---|
| 148 | <a href="qstring.html">QString</a> s = url;
|
---|
| 149 | // or
|
---|
| 150 | <a href="qstring.html">QString</a> s( "http://www.trolltech.com" );
|
---|
| 151 | QUrl url( s );
|
---|
| 152 | </pre>
|
---|
| 153 |
|
---|
| 154 | <p> Use the static functions, <a href="#encode">encode</a>() and <a href="#decode">decode</a>() to encode or
|
---|
| 155 | decode a URL in a string. (They operate on the string in-place.)
|
---|
| 156 | The <a href="#isRelativeUrl">isRelativeUrl</a>() static function returns TRUE if the given
|
---|
| 157 | string is a relative URL.
|
---|
| 158 | <p> If you want to use a URL to work on a hierarchical structure (e.g.
|
---|
| 159 | a local or remote filesystem), you might want to use the subclass
|
---|
| 160 | <a href="qurloperator.html">QUrlOperator</a>.
|
---|
| 161 | <p> <p>See also <a href="qurloperator.html">QUrlOperator</a>, <a href="io.html">Input/Output and Networking</a>, and <a href="misc.html">Miscellaneous Classes</a>.
|
---|
| 162 |
|
---|
| 163 | <hr><h2>Member Function Documentation</h2>
|
---|
| 164 | <h3 class=fn><a name="QUrl"></a>QUrl::QUrl ()
|
---|
| 165 | </h3>
|
---|
| 166 | Constructs an empty URL that is invalid.
|
---|
| 167 |
|
---|
| 168 | <h3 class=fn><a name="QUrl-2"></a>QUrl::QUrl ( const <a href="qstring.html">QString</a> & url )
|
---|
| 169 | </h3>
|
---|
| 170 | Constructs a URL by parsing the string <em>url</em>.
|
---|
| 171 | <p> If you pass a string like "/home/qt", the "file" protocol is
|
---|
| 172 | assumed.
|
---|
| 173 |
|
---|
| 174 | <h3 class=fn><a name="QUrl-3"></a>QUrl::QUrl ( const <a href="qurl.html">QUrl</a> & url )
|
---|
| 175 | </h3>
|
---|
| 176 | Copy constructor. Copies the data of <em>url</em>.
|
---|
| 177 |
|
---|
| 178 | <h3 class=fn><a name="QUrl-4"></a>QUrl::QUrl ( const <a href="qurl.html">QUrl</a> & url, const <a href="qstring.html">QString</a> & relUrl, bool checkSlash = FALSE )
|
---|
| 179 | </h3>
|
---|
| 180 | Constructs an URL taking <em>url</em> as the base (context) and
|
---|
| 181 | <em>relUrl</em> as a relative URL to <em>url</em>. If <em>relUrl</em> is not relative,
|
---|
| 182 | <em>relUrl</em> is taken as the new URL.
|
---|
| 183 | <p> For example, the path of
|
---|
| 184 | <pre>
|
---|
| 185 | QUrl url( "ftp://ftp.trolltech.com/qt/source", "qt-2.1.0.tar.gz" );
|
---|
| 186 | </pre>
|
---|
| 187 |
|
---|
| 188 | will be "/qt/srource/qt-2.1.0.tar.gz".
|
---|
| 189 | <p> On the other hand,
|
---|
| 190 | <pre>
|
---|
| 191 | QUrl url( "ftp://ftp.trolltech.com/qt/source", "/usr/local" );
|
---|
| 192 | </pre>
|
---|
| 193 |
|
---|
| 194 | will result in a new URL, "ftp://ftp.trolltech.com/usr/local",
|
---|
| 195 | because "/usr/local" isn't relative.
|
---|
| 196 | <p> Similarly,
|
---|
| 197 | <pre>
|
---|
| 198 | QUrl url( "ftp://ftp.trolltech.com/qt/source", "file:/usr/local" );
|
---|
| 199 | </pre>
|
---|
| 200 |
|
---|
| 201 | will result in a new URL, with "/usr/local" as the path
|
---|
| 202 | and "file" as the protocol.
|
---|
| 203 | <p> Normally it is expected that the path of <em>url</em> points to a
|
---|
| 204 | directory, even if the path has no slash at the end. But if you
|
---|
| 205 | want the constructor to handle the last part of the path as a file
|
---|
| 206 | name if there is no slash at the end, and to let it be replaced by
|
---|
| 207 | the file name of <em>relUrl</em> (if it contains one), set <em>checkSlash</em>
|
---|
| 208 | to TRUE.
|
---|
| 209 |
|
---|
| 210 | <h3 class=fn><a name="~QUrl"></a>QUrl::~QUrl ()<tt> [virtual]</tt>
|
---|
| 211 | </h3>
|
---|
| 212 | Destructor.
|
---|
| 213 |
|
---|
| 214 | <h3 class=fn>void <a name="addPath"></a>QUrl::addPath ( const <a href="qstring.html">QString</a> & pa )<tt> [virtual]</tt>
|
---|
| 215 | </h3>
|
---|
| 216 | Adds the path <em>pa</em> to the path of the URL.
|
---|
| 217 | <p> <p>See also <a href="#setPath">setPath</a>() and <a href="#hasPath">hasPath</a>().
|
---|
| 218 |
|
---|
| 219 | <h3 class=fn>bool <a name="cdUp"></a>QUrl::cdUp ()<tt> [virtual]</tt>
|
---|
| 220 | </h3>
|
---|
| 221 | Changes the directory to one directory up.
|
---|
| 222 | <p> <p>See also <a href="#setPath">setPath</a>().
|
---|
| 223 |
|
---|
| 224 | <h3 class=fn>void <a name="decode"></a>QUrl::decode ( <a href="qstring.html">QString</a> & url )<tt> [static]</tt>
|
---|
| 225 | </h3>
|
---|
| 226 | Decodes the <em>url</em> in-place into UTF-8. For example
|
---|
| 227 | <p> <pre>
|
---|
| 228 | <a href="qstring.html">QString</a> url = "http%3A//www%20trolltech%20com"
|
---|
| 229 | QUrl::<a href="#decode">decode</a>( url );
|
---|
| 230 | // url is now "http://www.trolltech.com"
|
---|
| 231 | </pre>
|
---|
| 232 |
|
---|
| 233 | <p> <p>See also <a href="#encode">encode</a>().
|
---|
| 234 |
|
---|
| 235 | <h3 class=fn><a href="qstring.html">QString</a> <a name="dirPath"></a>QUrl::dirPath () const
|
---|
| 236 | </h3>
|
---|
| 237 | Returns the directory path of the URL. This is the part of the
|
---|
| 238 | path of the URL without the <a href="#fileName">fileName</a>(). See the documentation of
|
---|
| 239 | fileName() for a discussion of what is handled as file name and
|
---|
| 240 | what is handled as directory path.
|
---|
| 241 | <p> <p>See also <a href="#setPath">setPath</a>() and <a href="#hasPath">hasPath</a>().
|
---|
| 242 |
|
---|
| 243 | <p>Example: <a href="networkprotocol-example.html#x695">network/networkprotocol/nntp.cpp</a>.
|
---|
| 244 | <h3 class=fn>void <a name="encode"></a>QUrl::encode ( <a href="qstring.html">QString</a> & url )<tt> [static]</tt>
|
---|
| 245 | </h3>
|
---|
| 246 | Encodes the <em>url</em> in-place into UTF-8. For example
|
---|
| 247 | <p> <pre>
|
---|
| 248 | <a href="qstring.html">QString</a> url = http://www.trolltech.com
|
---|
| 249 | QUrl::<a href="#encode">encode</a>( url );
|
---|
| 250 | // url is now "http%3A//www%20trolltech%20com"
|
---|
| 251 | </pre>
|
---|
| 252 |
|
---|
| 253 | <p> <p>See also <a href="#decode">decode</a>().
|
---|
| 254 |
|
---|
| 255 | <p>Example: <a href="archivesearch-example.html#x484">network/archivesearch/archivedialog.ui.h</a>.
|
---|
| 256 | <h3 class=fn><a href="qstring.html">QString</a> <a name="encodedPathAndQuery"></a>QUrl::encodedPathAndQuery ()
|
---|
| 257 | </h3>
|
---|
| 258 | Returns the encoded path and query.
|
---|
| 259 | <p> <p>See also <a href="#decode">decode</a>().
|
---|
| 260 |
|
---|
| 261 | <h3 class=fn><a href="qstring.html">QString</a> <a name="fileName"></a>QUrl::fileName () const
|
---|
| 262 | </h3>
|
---|
| 263 | Returns the file name of the URL. If the path of the URL doesn't
|
---|
| 264 | have a slash at the end, the part between the last slash and the
|
---|
| 265 | end of the path string is considered to be the file name. If the
|
---|
| 266 | path has a slash at the end, an empty string is returned here.
|
---|
| 267 | <p> <p>See also <a href="#setFileName">setFileName</a>().
|
---|
| 268 |
|
---|
| 269 | <p>Example: <a href="networkprotocol-example.html#x696">network/networkprotocol/nntp.cpp</a>.
|
---|
| 270 | <h3 class=fn>bool <a name="hasHost"></a>QUrl::hasHost () const
|
---|
| 271 | </h3>
|
---|
| 272 | Returns TRUE if the URL contains a hostname; otherwise returns
|
---|
| 273 | FALSE.
|
---|
| 274 | <p> <p>See also <a href="#setHost">setHost</a>().
|
---|
| 275 |
|
---|
| 276 | <h3 class=fn>bool <a name="hasPassword"></a>QUrl::hasPassword () const
|
---|
| 277 | </h3>
|
---|
| 278 | Returns TRUE if the URL contains a password; otherwise returns
|
---|
| 279 | FALSE.
|
---|
| 280 | <p> <b>Warning:</b> Passwords passed in URLs are normally <em>insecure</em>; this
|
---|
| 281 | is due to the mechanism, not because of Qt.
|
---|
| 282 | <p> <p>See also <a href="#setPassword">setPassword</a>() and <a href="#setUser">setUser</a>().
|
---|
| 283 |
|
---|
| 284 | <h3 class=fn>bool <a name="hasPath"></a>QUrl::hasPath () const
|
---|
| 285 | </h3>
|
---|
| 286 | Returns TRUE if the URL contains a path; otherwise returns FALSE.
|
---|
| 287 | <p> <p>See also <a href="#path">path</a>() and <a href="#setPath">setPath</a>().
|
---|
| 288 |
|
---|
| 289 | <h3 class=fn>bool <a name="hasPort"></a>QUrl::hasPort () const
|
---|
| 290 | </h3>
|
---|
| 291 | Returns TRUE if the URL contains a port; otherwise returns FALSE.
|
---|
| 292 | <p> <p>See also <a href="#setPort">setPort</a>().
|
---|
| 293 |
|
---|
| 294 | <h3 class=fn>bool <a name="hasRef"></a>QUrl::hasRef () const
|
---|
| 295 | </h3>
|
---|
| 296 | Returns TRUE if the URL has a reference; otherwise returns FALSE.
|
---|
| 297 | <p> <p>See also <a href="#setRef">setRef</a>().
|
---|
| 298 |
|
---|
| 299 | <h3 class=fn>bool <a name="hasUser"></a>QUrl::hasUser () const
|
---|
| 300 | </h3>
|
---|
| 301 | Returns TRUE if the URL contains a username; otherwise returns
|
---|
| 302 | FALSE.
|
---|
| 303 | <p> <p>See also <a href="#setUser">setUser</a>() and <a href="#setPassword">setPassword</a>().
|
---|
| 304 |
|
---|
| 305 | <h3 class=fn><a href="qstring.html">QString</a> <a name="host"></a>QUrl::host () const
|
---|
| 306 | </h3>
|
---|
| 307 | Returns the hostname of the URL.
|
---|
| 308 | <p> <p>See also <a href="#setHost">setHost</a>() and <a href="#hasHost">hasHost</a>().
|
---|
| 309 |
|
---|
| 310 | <p>Example: <a href="archivesearch-example.html#x485">network/archivesearch/archivedialog.ui.h</a>.
|
---|
| 311 | <h3 class=fn>bool <a name="isLocalFile"></a>QUrl::isLocalFile () const
|
---|
| 312 | </h3>
|
---|
| 313 | Returns TRUE if the URL is a local file; otherwise returns FALSE.
|
---|
| 314 |
|
---|
| 315 | <p>Example: <a href="qdir-example.html#x1849">qdir/qdir.cpp</a>.
|
---|
| 316 | <h3 class=fn>bool <a name="isRelativeUrl"></a>QUrl::isRelativeUrl ( const <a href="qstring.html">QString</a> & url )<tt> [static]</tt>
|
---|
| 317 | </h3>
|
---|
| 318 | Returns TRUE if <em>url</em> is relative; otherwise returns FALSE.
|
---|
| 319 |
|
---|
| 320 | <h3 class=fn>bool <a name="isValid"></a>QUrl::isValid () const
|
---|
| 321 | </h3>
|
---|
| 322 | Returns TRUE if the URL is valid; otherwise returns FALSE. A URL
|
---|
| 323 | is invalid if it cannot be parsed, for example.
|
---|
| 324 |
|
---|
| 325 | <h3 class=fn><a name="operator-QString"></a>QUrl::operator QString () const
|
---|
| 326 | </h3>
|
---|
| 327 | Composes a string version of the URL and returns it.
|
---|
| 328 | <p> <p>See also <a href="#toString">QUrl::toString</a>().
|
---|
| 329 |
|
---|
| 330 | <h3 class=fn><a href="qurl.html">QUrl</a> & <a name="operator-eq"></a>QUrl::operator= ( const <a href="qurl.html">QUrl</a> & url )
|
---|
| 331 | </h3>
|
---|
| 332 | Assigns the data of <em>url</em> to this class.
|
---|
| 333 |
|
---|
| 334 | <h3 class=fn><a href="qurl.html">QUrl</a> & <a name="operator-eq-2"></a>QUrl::operator= ( const <a href="qstring.html">QString</a> & url )
|
---|
| 335 | </h3>
|
---|
| 336 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 337 | <p> Parses <em>url</em> and assigns the resulting data to this class.
|
---|
| 338 | <p> If you pass a string like "/home/qt" the "file" protocol will be
|
---|
| 339 | assumed.
|
---|
| 340 |
|
---|
| 341 | <h3 class=fn>bool <a name="operator-eq-eq"></a>QUrl::operator== ( const <a href="qurl.html">QUrl</a> & url ) const
|
---|
| 342 | </h3>
|
---|
| 343 | Compares this URL with <em>url</em> and returns TRUE if they are equal;
|
---|
| 344 | otherwise returns FALSE.
|
---|
| 345 |
|
---|
| 346 | <h3 class=fn>bool <a name="operator-eq-eq-2"></a>QUrl::operator== ( const <a href="qstring.html">QString</a> & url ) const
|
---|
| 347 | </h3>
|
---|
| 348 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 349 | <p> Compares this URL with <em>url</em>. <em>url</em> is parsed first. Returns
|
---|
| 350 | TRUE if <em>url</em> is equal to this url; otherwise returns FALSE.
|
---|
| 351 |
|
---|
| 352 | <h3 class=fn>bool <a name="parse"></a>QUrl::parse ( const <a href="qstring.html">QString</a> & url )<tt> [virtual protected]</tt>
|
---|
| 353 | </h3>
|
---|
| 354 | Parses the <em>url</em>.
|
---|
| 355 |
|
---|
| 356 | <h3 class=fn><a href="qstring.html">QString</a> <a name="password"></a>QUrl::password () const
|
---|
| 357 | </h3>
|
---|
| 358 | Returns the password of the URL.
|
---|
| 359 | <p> <b>Warning:</b> Passwords passed in URLs are normally <em>insecure</em>; this
|
---|
| 360 | is due to the mechanism, not because of Qt.
|
---|
| 361 | <p> <p>See also <a href="#setPassword">setPassword</a>() and <a href="#setUser">setUser</a>().
|
---|
| 362 |
|
---|
| 363 | <h3 class=fn><a href="qstring.html">QString</a> <a name="path"></a>QUrl::path ( bool correct = TRUE ) const
|
---|
| 364 | </h3>
|
---|
| 365 | Returns the path of the URL. If <em>correct</em> is TRUE, the path is
|
---|
| 366 | cleaned (deals with too many or too few slashes, cleans things
|
---|
| 367 | like "/../..", etc). Otherwise <a href="#path">path</a>() returns exactly the path
|
---|
| 368 | that was parsed or set.
|
---|
| 369 | <p> <p>See also <a href="#setPath">setPath</a>() and <a href="#hasPath">hasPath</a>().
|
---|
| 370 |
|
---|
| 371 | <p>Example: <a href="qdir-example.html#x1850">qdir/qdir.cpp</a>.
|
---|
| 372 | <h3 class=fn>int <a name="port"></a>QUrl::port () const
|
---|
| 373 | </h3>
|
---|
| 374 | Returns the port of the URL or -1 if no port has been set.
|
---|
| 375 | <p> <p>See also <a href="#setPort">setPort</a>().
|
---|
| 376 |
|
---|
| 377 | <h3 class=fn><a href="qstring.html">QString</a> <a name="protocol"></a>QUrl::protocol () const
|
---|
| 378 | </h3>
|
---|
| 379 | Returns the protocol of the URL. Typically, "file", "http", "ftp",
|
---|
| 380 | etc.
|
---|
| 381 | <p> <p>See also <a href="#setProtocol">setProtocol</a>().
|
---|
| 382 |
|
---|
| 383 | <h3 class=fn><a href="qstring.html">QString</a> <a name="query"></a>QUrl::query () const
|
---|
| 384 | </h3>
|
---|
| 385 | Returns the (encoded) query of the URL.
|
---|
| 386 | <p> <p>See also <a href="#setQuery">setQuery</a>() and <a href="#decode">decode</a>().
|
---|
| 387 |
|
---|
| 388 | <h3 class=fn><a href="qstring.html">QString</a> <a name="ref"></a>QUrl::ref () const
|
---|
| 389 | </h3>
|
---|
| 390 | Returns the (encoded) reference of the URL.
|
---|
| 391 | <p> <p>See also <a href="#setRef">setRef</a>(), <a href="#hasRef">hasRef</a>(), and <a href="#decode">decode</a>().
|
---|
| 392 |
|
---|
| 393 | <h3 class=fn>void <a name="reset"></a>QUrl::reset ()<tt> [virtual protected]</tt>
|
---|
| 394 | </h3>
|
---|
| 395 | Resets all parts of the URL to their default values and
|
---|
| 396 | invalidates it.
|
---|
| 397 |
|
---|
| 398 | <h3 class=fn>void <a name="setEncodedPathAndQuery"></a>QUrl::setEncodedPathAndQuery ( const <a href="qstring.html">QString</a> & pathAndQuery )<tt> [virtual]</tt>
|
---|
| 399 | </h3>
|
---|
| 400 | Parses <em>pathAndQuery</em> for a path and query and sets those values.
|
---|
| 401 | The whole string must be encoded.
|
---|
| 402 | <p> <p>See also <a href="#encode">encode</a>().
|
---|
| 403 |
|
---|
| 404 | <h3 class=fn>void <a name="setFileName"></a>QUrl::setFileName ( const <a href="qstring.html">QString</a> & name )<tt> [virtual]</tt>
|
---|
| 405 | </h3>
|
---|
| 406 | Sets the file name of the URL to <em>name</em>. If this URL contains a
|
---|
| 407 | <a href="#fileName">fileName</a>(), the original file name is replaced by <em>name</em>.
|
---|
| 408 | <p> See the documentation of fileName() for a more detailed discussion
|
---|
| 409 | of what is handled as file name and what is handled as a directory
|
---|
| 410 | path.
|
---|
| 411 | <p> <p>See also <a href="#fileName">fileName</a>().
|
---|
| 412 |
|
---|
| 413 | <h3 class=fn>void <a name="setHost"></a>QUrl::setHost ( const <a href="qstring.html">QString</a> & host )<tt> [virtual]</tt>
|
---|
| 414 | </h3>
|
---|
| 415 | Sets the hostname of the URL to <em>host</em>.
|
---|
| 416 | <p> <p>See also <a href="#host">host</a>() and <a href="#hasHost">hasHost</a>().
|
---|
| 417 |
|
---|
| 418 | <h3 class=fn>void <a name="setPassword"></a>QUrl::setPassword ( const <a href="qstring.html">QString</a> & pass )<tt> [virtual]</tt>
|
---|
| 419 | </h3>
|
---|
| 420 | Sets the password of the URL to <em>pass</em>.
|
---|
| 421 | <p> <b>Warning:</b> Passwords passed in URLs are normally <em>insecure</em>; this
|
---|
| 422 | is due to the mechanism, not because of Qt.
|
---|
| 423 | <p> <p>See also <a href="#password">password</a>() and <a href="#setUser">setUser</a>().
|
---|
| 424 |
|
---|
| 425 | <h3 class=fn>void <a name="setPath"></a>QUrl::setPath ( const <a href="qstring.html">QString</a> & path )<tt> [virtual]</tt>
|
---|
| 426 | </h3>
|
---|
| 427 | Sets the path of the URL to <em>path</em>.
|
---|
| 428 | <p> <p>See also <a href="#path">path</a>() and <a href="#hasPath">hasPath</a>().
|
---|
| 429 |
|
---|
| 430 | <h3 class=fn>void <a name="setPort"></a>QUrl::setPort ( int port )<tt> [virtual]</tt>
|
---|
| 431 | </h3>
|
---|
| 432 | Sets the port of the URL to <em>port</em>.
|
---|
| 433 | <p> <p>See also <a href="#port">port</a>().
|
---|
| 434 |
|
---|
| 435 | <h3 class=fn>void <a name="setProtocol"></a>QUrl::setProtocol ( const <a href="qstring.html">QString</a> & protocol )<tt> [virtual]</tt>
|
---|
| 436 | </h3>
|
---|
| 437 | Sets the protocol of the URL to <em>protocol</em>. Typically, "file",
|
---|
| 438 | "http", "ftp", etc.
|
---|
| 439 | <p> <p>See also <a href="#protocol">protocol</a>().
|
---|
| 440 |
|
---|
| 441 | <h3 class=fn>void <a name="setQuery"></a>QUrl::setQuery ( const <a href="qstring.html">QString</a> & txt )<tt> [virtual]</tt>
|
---|
| 442 | </h3>
|
---|
| 443 | Sets the query of the URL to <em>txt</em>. <em>txt</em> must be encoded.
|
---|
| 444 | <p> <p>See also <a href="#query">query</a>() and <a href="#encode">encode</a>().
|
---|
| 445 |
|
---|
| 446 | <h3 class=fn>void <a name="setRef"></a>QUrl::setRef ( const <a href="qstring.html">QString</a> & txt )<tt> [virtual]</tt>
|
---|
| 447 | </h3>
|
---|
| 448 | Sets the reference of the URL to <em>txt</em>. <em>txt</em> must be encoded.
|
---|
| 449 | <p> <p>See also <a href="#ref">ref</a>(), <a href="#hasRef">hasRef</a>(), and <a href="#encode">encode</a>().
|
---|
| 450 |
|
---|
| 451 | <h3 class=fn>void <a name="setUser"></a>QUrl::setUser ( const <a href="qstring.html">QString</a> & user )<tt> [virtual]</tt>
|
---|
| 452 | </h3>
|
---|
| 453 | Sets the username of the URL to <em>user</em>.
|
---|
| 454 | <p> <p>See also <a href="#user">user</a>() and <a href="#setPassword">setPassword</a>().
|
---|
| 455 |
|
---|
| 456 | <h3 class=fn><a href="qstring.html">QString</a> <a name="toString"></a>QUrl::toString ( bool encodedPath = FALSE, bool forcePrependProtocol = TRUE ) const<tt> [virtual]</tt>
|
---|
| 457 | </h3>
|
---|
| 458 | Composes a string version of the URL and returns it. If <em>encodedPath</em> is TRUE the path in the returned string is encoded. If
|
---|
| 459 | <em>forcePrependProtocol</em> is TRUE and <em>encodedPath</em> looks like a
|
---|
| 460 | local filename, the "file:/" protocol is also prepended.
|
---|
| 461 | <p> <p>See also <a href="#encode">encode</a>() and <a href="#decode">decode</a>().
|
---|
| 462 |
|
---|
| 463 | <h3 class=fn><a href="qstring.html">QString</a> <a name="user"></a>QUrl::user () const
|
---|
| 464 | </h3>
|
---|
| 465 | Returns the username of the URL.
|
---|
| 466 | <p> <p>See also <a href="#setUser">setUser</a>() and <a href="#setPassword">setPassword</a>().
|
---|
| 467 |
|
---|
| 468 | <!-- eof -->
|
---|
| 469 | <hr><p>
|
---|
| 470 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 471 | Copyright © 1995-2007
|
---|
| 472 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 473 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 474 | <td>Copyright © 2007
|
---|
| 475 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 476 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 477 | </table></div></address></body>
|
---|
| 478 | </html>
|
---|