<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- /tmp/qt-4.2.1-harald-1161357942206/qt-x11-opensource-src-4.2.1/src/qt3support/network/q3url.cpp --> <head> <title>Qt 4.2: Q3Url Class Reference</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">Q3Url Class Reference<br /><sup><sup>[<a href="qt3support.html">Qt3Support</a> module]</sup></sup></h1> <p>The Q3Url class provides a URL parser and simplifies working with URLs. <a href="#details">More...</a></p> <pre> #include <Q3Url></pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html#qurl">Porting to Qt 4</a> for more information.</p> <p>Inherited by <a href="q3urloperator.html">Q3UrlOperator</a>.</p> <ul> <li><a href="q3url-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h3>Public Functions</h3> <ul> <li><div class="fn"/><b><a href="q3url.html#Q3Url">Q3Url</a></b> ()</li> <li><div class="fn"/><b><a href="q3url.html#Q3Url-2">Q3Url</a></b> ( const QString & <i>url</i> )</li> <li><div class="fn"/><b><a href="q3url.html#Q3Url-3">Q3Url</a></b> ( const Q3Url & <i>url</i> )</li> <li><div class="fn"/><b><a href="q3url.html#Q3Url-4">Q3Url</a></b> ( const Q3Url & <i>url</i>, const QString & <i>relUrl</i>, bool <i>checkSlash</i> = false )</li> <li><div class="fn"/>virtual <b><a href="q3url.html#dtor.Q3Url">~Q3Url</a></b> ()</li> <li><div class="fn"/>virtual void <b><a href="q3url.html#addPath">addPath</a></b> ( const QString & <i>pa</i> )</li> <li><div class="fn"/>virtual bool <b><a href="q3url.html#cdUp">cdUp</a></b> ()</li> <li><div class="fn"/>QString <b><a href="q3url.html#dirPath">dirPath</a></b> () const</li> <li><div class="fn"/>QString <b><a href="q3url.html#encodedPathAndQuery">encodedPathAndQuery</a></b> ()</li> <li><div class="fn"/>QString <b><a href="q3url.html#fileName">fileName</a></b> () const</li> <li><div class="fn"/>bool <b><a href="q3url.html#hasHost">hasHost</a></b> () const</li> <li><div class="fn"/>bool <b><a href="q3url.html#hasPassword">hasPassword</a></b> () const</li> <li><div class="fn"/>bool <b><a href="q3url.html#hasPath">hasPath</a></b> () const</li> <li><div class="fn"/>bool <b><a href="q3url.html#hasPort">hasPort</a></b> () const</li> <li><div class="fn"/>bool <b><a href="q3url.html#hasRef">hasRef</a></b> () const</li> <li><div class="fn"/>bool <b><a href="q3url.html#hasUser">hasUser</a></b> () const</li> <li><div class="fn"/>QString <b><a href="q3url.html#host">host</a></b> () const</li> <li><div class="fn"/>bool <b><a href="q3url.html#isLocalFile">isLocalFile</a></b> () const</li> <li><div class="fn"/>bool <b><a href="q3url.html#isValid">isValid</a></b> () const</li> <li><div class="fn"/>QString <b><a href="q3url.html#password">password</a></b> () const</li> <li><div class="fn"/>QString <b><a href="q3url.html#path">path</a></b> ( bool <i>correct</i> = true ) const</li> <li><div class="fn"/>int <b><a href="q3url.html#port">port</a></b> () const</li> <li><div class="fn"/>QString <b><a href="q3url.html#protocol">protocol</a></b> () const</li> <li><div class="fn"/>QString <b><a href="q3url.html#query">query</a></b> () const</li> <li><div class="fn"/>QString <b><a href="q3url.html#ref">ref</a></b> () const</li> <li><div class="fn"/>virtual void <b><a href="q3url.html#setEncodedPathAndQuery">setEncodedPathAndQuery</a></b> ( const QString & <i>pathAndQuery</i> )</li> <li><div class="fn"/>virtual void <b><a href="q3url.html#setFileName">setFileName</a></b> ( const QString & <i>name</i> )</li> <li><div class="fn"/>virtual void <b><a href="q3url.html#setHost">setHost</a></b> ( const QString & <i>host</i> )</li> <li><div class="fn"/>virtual void <b><a href="q3url.html#setPassword">setPassword</a></b> ( const QString & <i>pass</i> )</li> <li><div class="fn"/>virtual void <b><a href="q3url.html#setPath">setPath</a></b> ( const QString & <i>path</i> )</li> <li><div class="fn"/>virtual void <b><a href="q3url.html#setPort">setPort</a></b> ( int <i>port</i> )</li> <li><div class="fn"/>virtual void <b><a href="q3url.html#setProtocol">setProtocol</a></b> ( const QString & <i>protocol</i> )</li> <li><div class="fn"/>virtual void <b><a href="q3url.html#setQuery">setQuery</a></b> ( const QString & <i>txt</i> )</li> <li><div class="fn"/>virtual void <b><a href="q3url.html#setRef">setRef</a></b> ( const QString & <i>txt</i> )</li> <li><div class="fn"/>virtual void <b><a href="q3url.html#setUser">setUser</a></b> ( const QString & <i>user</i> )</li> <li><div class="fn"/>virtual QString <b><a href="q3url.html#toString">toString</a></b> ( bool <i>encodedPath</i> = false, bool <i>forcePrependProtocol</i> = true ) const</li> <li><div class="fn"/>QString <b><a href="q3url.html#user">user</a></b> () const</li> <li><div class="fn"/><b><a href="q3url.html#operator-QString">operator QString</a></b> () const</li> <li><div class="fn"/>Q3Url & <b><a href="q3url.html#operator-eq">operator=</a></b> ( const Q3Url & <i>url</i> )</li> <li><div class="fn"/>Q3Url & <b><a href="q3url.html#operator-eq-2">operator=</a></b> ( const QString & <i>url</i> )</li> <li><div class="fn"/>bool <b><a href="q3url.html#operator-eq-eq">operator==</a></b> ( const Q3Url & <i>url</i> ) const</li> <li><div class="fn"/>bool <b><a href="q3url.html#operator-eq-eq-2">operator==</a></b> ( const QString & <i>url</i> ) const</li> </ul> <a name="static-public-members"></a> <h3>Static Public Members</h3> <ul> <li><div class="fn"/>void <b><a href="q3url.html#decode">decode</a></b> ( QString & <i>url</i> )</li> <li><div class="fn"/>void <b><a href="q3url.html#encode">encode</a></b> ( QString & <i>url</i> )</li> <li><div class="fn"/>bool <b><a href="q3url.html#isRelativeUrl">isRelativeUrl</a></b> ( const QString & <i>url</i> )</li> </ul> <a name="protected-functions"></a> <h3>Protected Functions</h3> <ul> <li><div class="fn"/>virtual bool <b><a href="q3url.html#parse">parse</a></b> ( const QString & <i>url</i> )</li> <li><div class="fn"/>virtual void <b><a href="q3url.html#reset">reset</a></b> ()</li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The Q3Url class provides a URL parser and simplifies working with URLs.</p> <p>The Q3Url class is provided for simple work with URLs. It can parse, decode, encode, etc.</p> <p>Q3Url works with the decoded path and encoded query in turn.</p> <p>Example:</p> <p><tt>http://www.trolltech.com:80/cgi-bin/test%20me.pl?cmd=Hello%20you</tt></p> <p><table align="center" cellpadding="2" cellspacing="1" border="0"> <thead><tr valign="top" class="qt-style"><th>Function</th><th>Returns</th></tr></thead> <tr valign="top" class="odd"><td><a href="q3url.html#protocol">protocol</a>()</td><td>"http"</td></tr> <tr valign="top" class="even"><td><a href="q3url.html#host">host</a>()</td><td>"www.trolltech.com"</td></tr> <tr valign="top" class="odd"><td><a href="q3url.html#port">port</a>()</td><td>80</td></tr> <tr valign="top" class="even"><td><a href="q3url.html#path">path</a>()</td><td>"/cgi-bin/test&nbsp;me.pl"</td></tr> <tr valign="top" class="odd"><td><a href="q3url.html#fileName">fileName</a>()</td><td>"test&nbsp;me.pl"</td></tr> <tr valign="top" class="even"><td><a href="q3url.html#query">query</a>()</td><td>"cmd=Hello%20you"</td></tr> </table></p> <p>Example:</p> <p><tt>http://doc.trolltech.com/qdockarea.html#lines</tt></p> <p><table align="center" cellpadding="2" cellspacing="1" border="0"> <thead><tr valign="top" class="qt-style"><th>Function</th><th>Returns</th></tr></thead> <tr valign="top" class="odd"><td><a href="q3url.html#protocol">protocol</a>()</td><td>"http"</td></tr> <tr valign="top" class="even"><td><a href="q3url.html#host">host</a>()</td><td>"doc.trolltech.com"</td></tr> <tr valign="top" class="odd"><td><a href="q3url.html#fileName">fileName</a>()</td><td>"qdockarea.html"</td></tr> <tr valign="top" class="even"><td><a href="q3url.html#ref">ref</a>()</td><td>"lines"</td></tr> </table></p> <p>The individual parts of a URL can be set with <a href="q3url.html#setProtocol">setProtocol</a>(), <a href="q3url.html#setHost">setHost</a>(), <a href="q3url.html#setPort">setPort</a>(), <a href="q3url.html#setPath">setPath</a>(), <a href="q3url.html#setFileName">setFileName</a>(), <a href="q3url.html#setRef">setRef</a>() and <a href="q3url.html#setQuery">setQuery</a>(). A URL could contain, for example, an ftp address which requires a user name and password; these can be set with <a href="q3url.html#setUser">setUser</a>() and <a href="q3url.html#setPassword">setPassword</a>().</p> <p>Because path is always encoded internally you must not use "%00" in the path, although this is okay (but not recommended) for the query.</p> <p>Q3Url is normally used like this:</p> <pre> Q3Url url( "http:<span class="comment">//www.trolltech.com" );</span> <span class="comment"> // or</span> Q3Url url( "file:<span class="comment">///home/myself/Mail", "Inbox" );</span></pre> <p>You can then access and manipulate the various parts of the URL.</p> <p>To make it easy to work with Q3Urls and QStrings, Q3Url implements the necessary cast and assignment operators so you can do following:</p> <pre> Q3Url url( "http:<span class="comment">//www.trolltech.com" );</span> QString s = url; <span class="comment"> // or</span> QString s( "http:<span class="comment">//www.trolltech.com" );</span> Q3Url url( s );</pre> <p>Use the static functions, <a href="q3url.html#encode">encode</a>() and <a href="q3url.html#decode">decode</a>() to encode or decode a URL in a string. (They operate on the string in-place.) The <a href="q3url.html#isRelativeUrl">isRelativeUrl</a>() static function returns true if the given string is a relative URL.</p> <p>If 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 <a href="q3urloperator.html">Q3UrlOperator</a>.</p> <p>See also <a href="q3urloperator.html">Q3UrlOperator</a>.</p> <hr /> <h2>Member Function Documentation</h2> <h3 class="fn"><a name="Q3Url"></a>Q3Url::Q3Url ()</h3> <p>Constructs an empty URL that is invalid.</p> <h3 class="fn"><a name="Q3Url-2"></a>Q3Url::Q3Url ( const <a href="qstring.html">QString</a> & <i>url</i> )</h3> <p>Constructs a URL by parsing the string <i>url</i>.</p> <p>If you pass a string like "/home/qt", the "file" protocol is assumed.</p> <h3 class="fn"><a name="Q3Url-3"></a>Q3Url::Q3Url ( const Q3Url & <i>url</i> )</h3> <p>Copy constructor. Copies the data of <i>url</i>.</p> <h3 class="fn"><a name="Q3Url-4"></a>Q3Url::Q3Url ( const Q3Url & <i>url</i>, const <a href="qstring.html">QString</a> & <i>relUrl</i>, bool <i>checkSlash</i> = false )</h3> <p>Constructs an URL taking <i>url</i> as the base (context) and <i>relUrl</i> as a relative URL to <i>url</i>. If <i>relUrl</i> is not relative, <i>relUrl</i> is taken as the new URL.</p> <p>For example, the path of</p> <pre> Q3Url url( "ftp:<span class="comment">//ftp.trolltech.com/qt/source", "qt-2.1.0.tar.gz" );</span></pre> <p>will be "/qt/srource/qt-2.1.0.tar.gz".</p> <p>On the other hand,</p> <pre> Q3Url url( "ftp:<span class="comment">//ftp.trolltech.com/qt/source", "/usr/local" );</span></pre> <p>will result in a new URL, "ftp://ftp.trolltech.com/usr/local", because "/usr/local" isn't relative.</p> <p>Similarly,</p> <pre> Q3Url url( "ftp:<span class="comment">//ftp.trolltech.com/qt/source", "file:///usr/local" );</span></pre> <p>will result in a new URL, with "/usr/local" as the path and "file" as the protocol.</p> <p>Normally it is expected that the path of <i>url</i> points to a directory, even if the path has no slash at the end. But if you want the constructor to handle the last part of the path as a file name if there is no slash at the end, and to let it be replaced by the file name of <i>relUrl</i> (if it contains one), set <i>checkSlash</i> to true.</p> <h3 class="fn"><a name="dtor.Q3Url"></a>Q3Url::~Q3Url () <tt> [virtual]</tt></h3> <p>Destructor.</p> <h3 class="fn"><a name="addPath"></a>void Q3Url::addPath ( const <a href="qstring.html">QString</a> & <i>pa</i> ) <tt> [virtual]</tt></h3> <p>Adds the path <i>pa</i> to the path of the URL.</p> <p>See also <a href="q3url.html#setPath">setPath</a>() and <a href="q3url.html#hasPath">hasPath</a>().</p> <h3 class="fn"><a name="cdUp"></a>bool Q3Url::cdUp () <tt> [virtual]</tt></h3> <p>Changes the directory to one directory up.</p> <p>See also <a href="q3url.html#setPath">setPath</a>().</p> <h3 class="fn"><a name="decode"></a>void Q3Url::decode ( <a href="qstring.html">QString</a> & <i>url</i> ) <tt> [static]</tt></h3> <p>Decodes the <i>url</i> in-place into UTF-8. For example</p> <pre> QString url = "http%3A<span class="comment">//www%20trolltech%20com"</span> Q3Url::decode( url ); <span class="comment"> // url is now "http://www.trolltech.com"</span></pre> <p>See also <a href="q3url.html#encode">encode</a>().</p> <h3 class="fn"><a name="dirPath"></a><a href="qstring.html">QString</a> Q3Url::dirPath () const</h3> <p>Returns the directory path of the URL. This is the part of the path of the URL without the <a href="q3url.html#fileName">fileName</a>(). See the documentation of <a href="q3url.html#fileName">fileName</a>() for a discussion of what is handled as file name and what is handled as directory path.</p> <p>See also <a href="q3url.html#setPath">setPath</a>() and <a href="q3url.html#hasPath">hasPath</a>().</p> <h3 class="fn"><a name="encode"></a>void Q3Url::encode ( <a href="qstring.html">QString</a> & <i>url</i> ) <tt> [static]</tt></h3> <p>Encodes the <i>url</i> in-place into UTF-8. For example</p> <pre> QString url = http:<span class="comment">//www.trolltech.com</span> Q3Url::encode( url ); <span class="comment"> // url is now "http%3A//www%20trolltech%20com"</span></pre> <p>See also <a href="q3url.html#decode">decode</a>().</p> <h3 class="fn"><a name="encodedPathAndQuery"></a><a href="qstring.html">QString</a> Q3Url::encodedPathAndQuery ()</h3> <p>Returns the encoded path and query.</p> <p>See also <a href="q3url.html#setEncodedPathAndQuery">setEncodedPathAndQuery</a>() and <a href="q3url.html#decode">decode</a>().</p> <h3 class="fn"><a name="fileName"></a><a href="qstring.html">QString</a> Q3Url::fileName () const</h3> <p>Returns the file name of the URL. If the path of the URL doesn't have a slash at the end, the part between the last slash and the end of the path string is considered to be the file name. If the path has a slash at the end, an empty string is returned here.</p> <p>See also <a href="q3url.html#setFileName">setFileName</a>().</p> <h3 class="fn"><a name="hasHost"></a>bool Q3Url::hasHost () const</h3> <p>Returns true if the URL contains a hostname; otherwise returns false.</p> <p>See also <a href="q3url.html#setHost">setHost</a>().</p> <h3 class="fn"><a name="hasPassword"></a>bool Q3Url::hasPassword () const</h3> <p>Returns true if the URL contains a password; otherwise returns false.</p> <p><b>Warning:</b> Passwords passed in URLs are normally <i>insecure</i>; this is due to the mechanism, not because of Qt.</p> <p>See also <a href="q3url.html#setPassword">setPassword</a>() and <a href="q3url.html#setUser">setUser</a>().</p> <h3 class="fn"><a name="hasPath"></a>bool Q3Url::hasPath () const</h3> <p>Returns true if the URL contains a path; otherwise returns false.</p> <p>See also <a href="q3url.html#path">path</a>() and <a href="q3url.html#setPath">setPath</a>().</p> <h3 class="fn"><a name="hasPort"></a>bool Q3Url::hasPort () const</h3> <p>Returns true if the URL contains a port; otherwise returns false.</p> <p>See also <a href="q3url.html#setPort">setPort</a>().</p> <h3 class="fn"><a name="hasRef"></a>bool Q3Url::hasRef () const</h3> <p>Returns true if the URL has a reference; otherwise returns false.</p> <p>See also <a href="q3url.html#setRef">setRef</a>().</p> <h3 class="fn"><a name="hasUser"></a>bool Q3Url::hasUser () const</h3> <p>Returns true if the URL contains a username; otherwise returns false.</p> <p>See also <a href="q3url.html#setUser">setUser</a>() and <a href="q3url.html#setPassword">setPassword</a>().</p> <h3 class="fn"><a name="host"></a><a href="qstring.html">QString</a> Q3Url::host () const</h3> <p>Returns the hostname of the URL.</p> <p>See also <a href="q3url.html#setHost">setHost</a>() and <a href="q3url.html#hasHost">hasHost</a>().</p> <h3 class="fn"><a name="isLocalFile"></a>bool Q3Url::isLocalFile () const</h3> <p>Returns true if the URL is a local file; otherwise returns false.</p> <h3 class="fn"><a name="isRelativeUrl"></a>bool Q3Url::isRelativeUrl ( const <a href="qstring.html">QString</a> & <i>url</i> ) <tt> [static]</tt></h3> <p>Returns true if <i>url</i> is relative; otherwise returns false.</p> <h3 class="fn"><a name="isValid"></a>bool Q3Url::isValid () const</h3> <p>Returns true if the URL is valid; otherwise returns false. A URL is invalid if it cannot be parsed, for example.</p> <h3 class="fn"><a name="parse"></a>bool Q3Url::parse ( const <a href="qstring.html">QString</a> & <i>url</i> ) <tt> [virtual protected]</tt></h3> <p>Parses the <i>url</i>.</p> <h3 class="fn"><a name="password"></a><a href="qstring.html">QString</a> Q3Url::password () const</h3> <p>Returns the password of the URL.</p> <p><b>Warning:</b> Passwords passed in URLs are normally <i>insecure</i>; this is due to the mechanism, not because of Qt.</p> <p>See also <a href="q3url.html#setPassword">setPassword</a>() and <a href="q3url.html#setUser">setUser</a>().</p> <h3 class="fn"><a name="path"></a><a href="qstring.html">QString</a> Q3Url::path ( bool <i>correct</i> = true ) const</h3> <p>Returns the path of the URL. If <i>correct</i> is true, the path is cleaned (deals with too many or too few slashes, cleans things like "/../..", etc). Otherwise path() returns exactly the path that was parsed or set.</p> <p>See also <a href="q3url.html#setPath">setPath</a>() and <a href="q3url.html#hasPath">hasPath</a>().</p> <h3 class="fn"><a name="port"></a>int Q3Url::port () const</h3> <p>Returns the port of the URL or -1 if no port has been set.</p> <p>See also <a href="q3url.html#setPort">setPort</a>().</p> <h3 class="fn"><a name="protocol"></a><a href="qstring.html">QString</a> Q3Url::protocol () const</h3> <p>Returns the protocol of the URL. Typically, "file", "http", "ftp", etc.</p> <p>See also <a href="q3url.html#setProtocol">setProtocol</a>().</p> <h3 class="fn"><a name="query"></a><a href="qstring.html">QString</a> Q3Url::query () const</h3> <p>Returns the (encoded) query of the URL.</p> <p>See also <a href="q3url.html#setQuery">setQuery</a>() and <a href="q3url.html#decode">decode</a>().</p> <h3 class="fn"><a name="ref"></a><a href="qstring.html">QString</a> Q3Url::ref () const</h3> <p>Returns the (encoded) reference of the URL.</p> <p>See also <a href="q3url.html#setRef">setRef</a>(), <a href="q3url.html#hasRef">hasRef</a>(), and <a href="q3url.html#decode">decode</a>().</p> <h3 class="fn"><a name="reset"></a>void Q3Url::reset () <tt> [virtual protected]</tt></h3> <p>Resets all parts of the URL to their default values and invalidates it.</p> <h3 class="fn"><a name="setEncodedPathAndQuery"></a>void Q3Url::setEncodedPathAndQuery ( const <a href="qstring.html">QString</a> & <i>pathAndQuery</i> ) <tt> [virtual]</tt></h3> <p>Parses <i>pathAndQuery</i> for a path and query and sets those values. The whole string must be encoded.</p> <p>See also <a href="q3url.html#encodedPathAndQuery">encodedPathAndQuery</a>() and <a href="q3url.html#encode">encode</a>().</p> <h3 class="fn"><a name="setFileName"></a>void Q3Url::setFileName ( const <a href="qstring.html">QString</a> & <i>name</i> ) <tt> [virtual]</tt></h3> <p>Sets the file name of the URL to <i>name</i>. If this URL contains a <a href="q3url.html#fileName">fileName</a>(), the original file name is replaced by <i>name</i>.</p> <p>See the documentation of <a href="q3url.html#fileName">fileName</a>() for a more detailed discussion of what is handled as file name and what is handled as a directory path.</p> <p>See also <a href="q3url.html#fileName">fileName</a>().</p> <h3 class="fn"><a name="setHost"></a>void Q3Url::setHost ( const <a href="qstring.html">QString</a> & <i>host</i> ) <tt> [virtual]</tt></h3> <p>Sets the hostname of the URL to <i>host</i>.</p> <p>See also <a href="q3url.html#host">host</a>() and <a href="q3url.html#hasHost">hasHost</a>().</p> <h3 class="fn"><a name="setPassword"></a>void Q3Url::setPassword ( const <a href="qstring.html">QString</a> & <i>pass</i> ) <tt> [virtual]</tt></h3> <p>Sets the password of the URL to <i>pass</i>.</p> <p><b>Warning:</b> Passwords passed in URLs are normally <i>insecure</i>; this is due to the mechanism, not because of Qt.</p> <p>See also <a href="q3url.html#password">password</a>() and <a href="q3url.html#setUser">setUser</a>().</p> <h3 class="fn"><a name="setPath"></a>void Q3Url::setPath ( const <a href="qstring.html">QString</a> & <i>path</i> ) <tt> [virtual]</tt></h3> <p>Sets the path of the URL to <i>path</i>.</p> <p>See also <a href="q3url.html#path">path</a>() and <a href="q3url.html#hasPath">hasPath</a>().</p> <h3 class="fn"><a name="setPort"></a>void Q3Url::setPort ( int <i>port</i> ) <tt> [virtual]</tt></h3> <p>Sets the port of the URL to <i>port</i>.</p> <p>See also <a href="q3url.html#port">port</a>().</p> <h3 class="fn"><a name="setProtocol"></a>void Q3Url::setProtocol ( const <a href="qstring.html">QString</a> & <i>protocol</i> ) <tt> [virtual]</tt></h3> <p>Sets the protocol of the URL to <i>protocol</i>. Typically, "file", "http", "ftp", etc.</p> <p>See also <a href="q3url.html#protocol">protocol</a>().</p> <h3 class="fn"><a name="setQuery"></a>void Q3Url::setQuery ( const <a href="qstring.html">QString</a> & <i>txt</i> ) <tt> [virtual]</tt></h3> <p>Sets the query of the URL to <i>txt</i>. <i>txt</i> must be encoded.</p> <p>See also <a href="q3url.html#query">query</a>() and <a href="q3url.html#encode">encode</a>().</p> <h3 class="fn"><a name="setRef"></a>void Q3Url::setRef ( const <a href="qstring.html">QString</a> & <i>txt</i> ) <tt> [virtual]</tt></h3> <p>Sets the reference of the URL to <i>txt</i>. <i>txt</i> must be encoded.</p> <p>See also <a href="q3url.html#ref">ref</a>(), <a href="q3url.html#hasRef">hasRef</a>(), and <a href="q3url.html#encode">encode</a>().</p> <h3 class="fn"><a name="setUser"></a>void Q3Url::setUser ( const <a href="qstring.html">QString</a> & <i>user</i> ) <tt> [virtual]</tt></h3> <p>Sets the username of the URL to <i>user</i>.</p> <p>See also <a href="q3url.html#user">user</a>() and <a href="q3url.html#setPassword">setPassword</a>().</p> <h3 class="fn"><a name="toString"></a><a href="qstring.html">QString</a> Q3Url::toString ( bool <i>encodedPath</i> = false, bool <i>forcePrependProtocol</i> = true ) const <tt> [virtual]</tt></h3> <p>Composes a string version of the URL and returns it. If <i>encodedPath</i> is true the path in the returned string is encoded. If <i>forcePrependProtocol</i> is true and <i>encodedPath</i> looks like a local filename, the "file:/" protocol is also prepended.</p> <p>See also <a href="q3url.html#encode">encode</a>() and <a href="q3url.html#decode">decode</a>().</p> <h3 class="fn"><a name="user"></a><a href="qstring.html">QString</a> Q3Url::user () const</h3> <p>Returns the username of the URL.</p> <p>See also <a href="q3url.html#setUser">setUser</a>() and <a href="q3url.html#setPassword">setPassword</a>().</p> <h3 class="fn"><a name="operator-QString"></a>Q3Url::operator QString () const</h3> <p>Composes a string version of the URL and returns it.</p> <p>See also <a href="q3url.html#toString">Q3Url::toString</a>().</p> <h3 class="fn"><a name="operator-eq"></a>Q3Url & Q3Url::operator= ( const Q3Url & <i>url</i> )</h3> <p>Assigns the data of <i>url</i> to this class.</p> <h3 class="fn"><a name="operator-eq-2"></a>Q3Url & Q3Url::operator= ( const <a href="qstring.html">QString</a> & <i>url</i> )</h3> <p>This is an overloaded member function, provided for convenience.</p> <p>Parses <i>url</i> and assigns the resulting data to this class.</p> <p>If you pass a string like "/home/qt" the "file" protocol will be assumed.</p> <h3 class="fn"><a name="operator-eq-eq"></a>bool Q3Url::operator== ( const Q3Url & <i>url</i> ) const</h3> <p>Compares this URL with <i>url</i> and returns true if they are equal; otherwise returns false.</p> <h3 class="fn"><a name="operator-eq-eq-2"></a>bool Q3Url::operator== ( const <a href="qstring.html">QString</a> & <i>url</i> ) const</h3> <p>This is an overloaded member function, provided for convenience.</p> <p>Compares this URL with <i>url</i>. <i>url</i> is parsed first. Returns true if <i>url</i> is equal to this url; otherwise returns false.</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="30%">Copyright © 2006 <a href="trolltech.html">Trolltech</a></td> <td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="30%" align="right"><div align="right">Qt 4.2.1</div></td> </tr></table></div></address></body> </html>