You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/html/tqurl.html

478 lines
24 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQUrl Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQUrl Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1>
<p>The TQUrl class provides a URL parser and simplifies working with URLs.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="tqurl-h.html">tqurl.h</a>&gt;</tt>
<p>Inherited by <a href="tqurloperator.html">TQUrlOperator</a>.
<p><a href="tqurl-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQUrl"><b>TQUrl</b></a> ()</li>
<li class=fn><a href="#TQUrl-2"><b>TQUrl</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;url )</li>
<li class=fn><a href="#TQUrl-3"><b>TQUrl</b></a> ( const&nbsp;TQUrl&nbsp;&amp;&nbsp;url )</li>
<li class=fn><a href="#TQUrl-4"><b>TQUrl</b></a> ( const&nbsp;TQUrl&nbsp;&amp;&nbsp;url, const&nbsp;TQString&nbsp;&amp;&nbsp;relUrl, bool&nbsp;checkSlash = FALSE )</li>
<li class=fn>virtual <a href="#~TQUrl"><b>~TQUrl</b></a> ()</li>
<li class=fn>TQString <a href="#protocol"><b>protocol</b></a> () const</li>
<li class=fn>virtual void <a href="#setProtocol"><b>setProtocol</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;protocol )</li>
<li class=fn>TQString <a href="#user"><b>user</b></a> () const</li>
<li class=fn>virtual void <a href="#setUser"><b>setUser</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;user )</li>
<li class=fn>bool <a href="#hasUser"><b>hasUser</b></a> () const</li>
<li class=fn>TQString <a href="#password"><b>password</b></a> () const</li>
<li class=fn>virtual void <a href="#setPassword"><b>setPassword</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;pass )</li>
<li class=fn>bool <a href="#hasPassword"><b>hasPassword</b></a> () const</li>
<li class=fn>TQString <a href="#host"><b>host</b></a> () const</li>
<li class=fn>virtual void <a href="#setHost"><b>setHost</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;host )</li>
<li class=fn>bool <a href="#hasHost"><b>hasHost</b></a> () const</li>
<li class=fn>int <a href="#port"><b>port</b></a> () const</li>
<li class=fn>virtual void <a href="#setPort"><b>setPort</b></a> ( int&nbsp;port )</li>
<li class=fn>bool <a href="#hasPort"><b>hasPort</b></a> () const</li>
<li class=fn>TQString <a href="#path"><b>path</b></a> ( bool&nbsp;correct = TRUE ) const</li>
<li class=fn>virtual void <a href="#setPath"><b>setPath</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;path )</li>
<li class=fn>bool <a href="#hasPath"><b>hasPath</b></a> () const</li>
<li class=fn>virtual void <a href="#setEncodedPathAndQuery"><b>setEncodedPathAndQuery</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;pathAndQuery )</li>
<li class=fn>TQString <a href="#encodedPathAndQuery"><b>encodedPathAndQuery</b></a> ()</li>
<li class=fn>virtual void <a href="#setQuery"><b>setQuery</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;txt )</li>
<li class=fn>TQString <a href="#query"><b>query</b></a> () const</li>
<li class=fn>TQString <a href="#ref"><b>ref</b></a> () const</li>
<li class=fn>virtual void <a href="#setRef"><b>setRef</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;txt )</li>
<li class=fn>bool <a href="#hasRef"><b>hasRef</b></a> () const</li>
<li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
<li class=fn>bool <a href="#isLocalFile"><b>isLocalFile</b></a> () const</li>
<li class=fn>virtual void <a href="#addPath"><b>addPath</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;pa )</li>
<li class=fn>virtual void <a href="#setFileName"><b>setFileName</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;name )</li>
<li class=fn>TQString <a href="#fileName"><b>fileName</b></a> () const</li>
<li class=fn>TQString <a href="#dirPath"><b>dirPath</b></a> () const</li>
<li class=fn>TQUrl &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;TQUrl&nbsp;&amp;&nbsp;url )</li>
<li class=fn>TQUrl &amp; <a href="#operator-eq-2"><b>operator=</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;url )</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;TQUrl&nbsp;&amp;&nbsp;url ) const</li>
<li class=fn>bool <a href="#operator-eq-eq-2"><b>operator==</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;url ) const</li>
<li class=fn><a href="#operator-TQString"><b>operator TQString</b></a> () const</li>
<li class=fn>virtual TQString <a href="#toString"><b>toString</b></a> ( bool&nbsp;encodedPath = FALSE, bool&nbsp;forcePrependProtocol = TRUE ) const</li>
<li class=fn>virtual bool <a href="#cdUp"><b>cdUp</b></a> ()</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>void <a href="#decode"><b>decode</b></a> ( TQString&nbsp;&amp;&nbsp;url )</li>
<li class=fn>void <a href="#encode"><b>encode</b></a> ( TQString&nbsp;&amp;&nbsp;url )</li>
<li class=fn>bool <a href="#isRelativeUrl"><b>isRelativeUrl</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;url )</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual void <a href="#reset"><b>reset</b></a> ()</li>
<li class=fn>virtual bool <a href="#parse"><b>parse</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;url )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
<p> The TQUrl class provides a URL parser and simplifies working with URLs.
<p>
<p>
<p> The TQUrl class is provided for simple work with URLs. It can
parse, decode, encode, etc.
<p> TQUrl works with the decoded path and encoded query in turn.
<p> Example:
<p> <tt>http://www.trolltech.com:80/cgi-bin/test%20me.pl?cmd=Hello%20you</tt>
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Function <th valign="top">Returns
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#protocol">protocol</a>() <td valign="top">"http"
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#host">host</a>() <td valign="top">"www.trolltech.com"
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#port">port</a>() <td valign="top">80
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#path">path</a>() <td valign="top">"/cgi-bin/test&nbsp;me.pl"
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#fileName">fileName</a>() <td valign="top">"test&nbsp;me.pl"
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#query">query</a>() <td valign="top">"cmd=Hello%20you"
</table></center>
<p> Example:
<p> <tt>http://doc.trolltech.com/tqdockarea.html#lines</tt>
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Function <th valign="top">Returns
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#protocol">protocol</a>() <td valign="top">"http"
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#host">host</a>() <td valign="top">"doc.trolltech.com"
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#fileName">fileName</a>() <td valign="top">"tqdockarea.html"
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#ref">ref</a>() <td valign="top">"lines"
</table></center>
<p> The individual parts of a URL can be set with <a href="#setProtocol">setProtocol</a>(),
<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
<a href="#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="#setUser">setUser</a>()
and <a href="#setPassword">setPassword</a>().
<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> TQUrl is normally used like this:
<p> <pre>
TQUrl url( "http://www.trolltech.com" );
// or
TQUrl url( "file:/home/myself/Mail", "Inbox" );
</pre>
<p> You can then access and manipulate the various parts of the URL.
<p> To make it easy to work with TQUrls and TQStrings, TQUrl implements
the necessary cast and assignment operators so you can do
following:
<p> <pre>
TQUrl url( "http://www.trolltech.com" );
<a href="tqstring.html">TQString</a> s = url;
// or
<a href="tqstring.html">TQString</a> s( "http://www.trolltech.com" );
TQUrl url( s );
</pre>
<p> Use the static functions, <a href="#encode">encode</a>() and <a href="#decode">decode</a>() to encode or
decode a URL in a string. (They operate on the string in-place.)
The <a href="#isRelativeUrl">isRelativeUrl</a>() static function returns TRUE if the given
string is a relative URL.
<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="tqurloperator.html">TQUrlOperator</a>.
<p> <p>See also <a href="tqurloperator.html">TQUrlOperator</a>, <a href="io.html">Input/Output and Networking</a>, and <a href="misc.html">Miscellaneous Classes</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQUrl"></a>TQUrl::TQUrl ()
</h3>
Constructs an empty URL that is invalid.
<h3 class=fn><a name="TQUrl-2"></a>TQUrl::TQUrl ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;url )
</h3>
Constructs a URL by parsing the string <em>url</em>.
<p> If you pass a string like "/home/qt", the "file" protocol is
assumed.
<h3 class=fn><a name="TQUrl-3"></a>TQUrl::TQUrl ( const&nbsp;<a href="tqurl.html">TQUrl</a>&nbsp;&amp;&nbsp;url )
</h3>
Copy constructor. Copies the data of <em>url</em>.
<h3 class=fn><a name="TQUrl-4"></a>TQUrl::TQUrl ( const&nbsp;<a href="tqurl.html">TQUrl</a>&nbsp;&amp;&nbsp;url, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;relUrl, bool&nbsp;checkSlash = FALSE )
</h3>
Constructs an URL taking <em>url</em> as the base (context) and
<em>relUrl</em> as a relative URL to <em>url</em>. If <em>relUrl</em> is not relative,
<em>relUrl</em> is taken as the new URL.
<p> For example, the path of
<pre>
TQUrl url( "ftp://ftp.trolltech.com/qt/source", "qt-2.1.0.tar.gz" );
</pre>
will be "/qt/srource/qt-2.1.0.tar.gz".
<p> On the other hand,
<pre>
TQUrl url( "ftp://ftp.trolltech.com/qt/source", "/usr/local" );
</pre>
will result in a new URL, "ftp://ftp.trolltech.com/usr/local",
because "/usr/local" isn't relative.
<p> Similarly,
<pre>
TQUrl url( "ftp://ftp.trolltech.com/qt/source", "file:/usr/local" );
</pre>
will result in a new URL, with "/usr/local" as the path
and "file" as the protocol.
<p> Normally it is expected that the path of <em>url</em> 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 <em>relUrl</em> (if it contains one), set <em>checkSlash</em>
to TRUE.
<h3 class=fn><a name="~TQUrl"></a>TQUrl::~TQUrl ()<tt> [virtual]</tt>
</h3>
Destructor.
<h3 class=fn>void <a name="addPath"></a>TQUrl::addPath ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;pa )<tt> [virtual]</tt>
</h3>
Adds the path <em>pa</em> to the path of the URL.
<p> <p>See also <a href="#setPath">setPath</a>() and <a href="#hasPath">hasPath</a>().
<h3 class=fn>bool <a name="cdUp"></a>TQUrl::cdUp ()<tt> [virtual]</tt>
</h3>
Changes the directory to one directory up.
<p> <p>See also <a href="#setPath">setPath</a>().
<h3 class=fn>void <a name="decode"></a>TQUrl::decode ( <a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;url )<tt> [static]</tt>
</h3>
Decodes the <em>url</em> in-place into UTF-8. For example
<p> <pre>
<a href="tqstring.html">TQString</a> url = "http%3A//www%20trolltech%20com"
TQUrl::<a href="#decode">decode</a>( url );
// url is now "http://www.trolltech.com"
</pre>
<p> <p>See also <a href="#encode">encode</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="dirPath"></a>TQUrl::dirPath () const
</h3>
Returns the directory path of the URL. This is the part of the
path of the URL without the <a href="#fileName">fileName</a>(). See the documentation of
fileName() for a discussion of what is handled as file name and
what is handled as directory path.
<p> <p>See also <a href="#setPath">setPath</a>() and <a href="#hasPath">hasPath</a>().
<p>Example: <a href="networkprotocol-example.html#x695">network/networkprotocol/nntp.cpp</a>.
<h3 class=fn>void <a name="encode"></a>TQUrl::encode ( <a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;url )<tt> [static]</tt>
</h3>
Encodes the <em>url</em> in-place into UTF-8. For example
<p> <pre>
<a href="tqstring.html">TQString</a> url = http://www.trolltech.com
TQUrl::<a href="#encode">encode</a>( url );
// url is now "http%3A//www%20trolltech%20com"
</pre>
<p> <p>See also <a href="#decode">decode</a>().
<p>Example: <a href="archivesearch-example.html#x484">network/archivesearch/archivedialog.ui.h</a>.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="encodedPathAndQuery"></a>TQUrl::encodedPathAndQuery ()
</h3>
Returns the encoded path and query.
<p> <p>See also <a href="#decode">decode</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="fileName"></a>TQUrl::fileName () const
</h3>
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="#setFileName">setFileName</a>().
<p>Example: <a href="networkprotocol-example.html#x696">network/networkprotocol/nntp.cpp</a>.
<h3 class=fn>bool <a name="hasHost"></a>TQUrl::hasHost () const
</h3>
Returns TRUE if the URL contains a hostname; otherwise returns
FALSE.
<p> <p>See also <a href="#setHost">setHost</a>().
<h3 class=fn>bool <a name="hasPassword"></a>TQUrl::hasPassword () const
</h3>
Returns TRUE if the URL contains a password; otherwise returns
FALSE.
<p> <b>Warning:</b> Passwords passed in URLs are normally <em>insecure</em>; this
is due to the mechanism, not because of TQt.
<p> <p>See also <a href="#setPassword">setPassword</a>() and <a href="#setUser">setUser</a>().
<h3 class=fn>bool <a name="hasPath"></a>TQUrl::hasPath () const
</h3>
Returns TRUE if the URL contains a path; otherwise returns FALSE.
<p> <p>See also <a href="#path">path</a>() and <a href="#setPath">setPath</a>().
<h3 class=fn>bool <a name="hasPort"></a>TQUrl::hasPort () const
</h3>
Returns TRUE if the URL contains a port; otherwise returns FALSE.
<p> <p>See also <a href="#setPort">setPort</a>().
<h3 class=fn>bool <a name="hasRef"></a>TQUrl::hasRef () const
</h3>
Returns TRUE if the URL has a reference; otherwise returns FALSE.
<p> <p>See also <a href="#setRef">setRef</a>().
<h3 class=fn>bool <a name="hasUser"></a>TQUrl::hasUser () const
</h3>
Returns TRUE if the URL contains a username; otherwise returns
FALSE.
<p> <p>See also <a href="#setUser">setUser</a>() and <a href="#setPassword">setPassword</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="host"></a>TQUrl::host () const
</h3>
Returns the hostname of the URL.
<p> <p>See also <a href="#setHost">setHost</a>() and <a href="#hasHost">hasHost</a>().
<p>Example: <a href="archivesearch-example.html#x485">network/archivesearch/archivedialog.ui.h</a>.
<h3 class=fn>bool <a name="isLocalFile"></a>TQUrl::isLocalFile () const
</h3>
Returns TRUE if the URL is a local file; otherwise returns FALSE.
<p>Example: <a href="tqdir-example.html#x1849">tqdir/tqdir.cpp</a>.
<h3 class=fn>bool <a name="isRelativeUrl"></a>TQUrl::isRelativeUrl ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;url )<tt> [static]</tt>
</h3>
Returns TRUE if <em>url</em> is relative; otherwise returns FALSE.
<h3 class=fn>bool <a name="isValid"></a>TQUrl::isValid () const
</h3>
Returns TRUE if the URL is valid; otherwise returns FALSE. A URL
is invalid if it cannot be parsed, for example.
<h3 class=fn><a name="operator-TQString"></a>TQUrl::operator TQString () const
</h3>
Composes a string version of the URL and returns it.
<p> <p>See also <a href="#toString">TQUrl::toString</a>().
<h3 class=fn><a href="tqurl.html">TQUrl</a>&nbsp;&amp; <a name="operator-eq"></a>TQUrl::operator= ( const&nbsp;<a href="tqurl.html">TQUrl</a>&nbsp;&amp;&nbsp;url )
</h3>
Assigns the data of <em>url</em> to this class.
<h3 class=fn><a href="tqurl.html">TQUrl</a>&nbsp;&amp; <a name="operator-eq-2"></a>TQUrl::operator= ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;url )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Parses <em>url</em> and assigns the resulting data to this class.
<p> If you pass a string like "/home/qt" the "file" protocol will be
assumed.
<h3 class=fn>bool <a name="operator-eq-eq"></a>TQUrl::operator== ( const&nbsp;<a href="tqurl.html">TQUrl</a>&nbsp;&amp;&nbsp;url ) const
</h3>
Compares this URL with <em>url</em> and returns TRUE if they are equal;
otherwise returns FALSE.
<h3 class=fn>bool <a name="operator-eq-eq-2"></a>TQUrl::operator== ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;url ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Compares this URL with <em>url</em>. <em>url</em> is parsed first. Returns
TRUE if <em>url</em> is equal to this url; otherwise returns FALSE.
<h3 class=fn>bool <a name="parse"></a>TQUrl::parse ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;url )<tt> [virtual protected]</tt>
</h3>
Parses the <em>url</em>.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="password"></a>TQUrl::password () const
</h3>
Returns the password of the URL.
<p> <b>Warning:</b> Passwords passed in URLs are normally <em>insecure</em>; this
is due to the mechanism, not because of TQt.
<p> <p>See also <a href="#setPassword">setPassword</a>() and <a href="#setUser">setUser</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="path"></a>TQUrl::path ( bool&nbsp;correct = TRUE ) const
</h3>
Returns the path of the URL. If <em>correct</em> is TRUE, the path is
cleaned (deals with too many or too few slashes, cleans things
like "/../..", etc). Otherwise <a href="#path">path</a>() returns exactly the path
that was parsed or set.
<p> <p>See also <a href="#setPath">setPath</a>() and <a href="#hasPath">hasPath</a>().
<p>Example: <a href="tqdir-example.html#x1850">tqdir/tqdir.cpp</a>.
<h3 class=fn>int <a name="port"></a>TQUrl::port () const
</h3>
Returns the port of the URL or -1 if no port has been set.
<p> <p>See also <a href="#setPort">setPort</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="protocol"></a>TQUrl::protocol () const
</h3>
Returns the protocol of the URL. Typically, "file", "http", "ftp",
etc.
<p> <p>See also <a href="#setProtocol">setProtocol</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="query"></a>TQUrl::query () const
</h3>
Returns the (encoded) query of the URL.
<p> <p>See also <a href="#setQuery">setQuery</a>() and <a href="#decode">decode</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="ref"></a>TQUrl::ref () const
</h3>
Returns the (encoded) reference of the URL.
<p> <p>See also <a href="#setRef">setRef</a>(), <a href="#hasRef">hasRef</a>(), and <a href="#decode">decode</a>().
<h3 class=fn>void <a name="reset"></a>TQUrl::reset ()<tt> [virtual protected]</tt>
</h3>
Resets all parts of the URL to their default values and
invalidates it.
<h3 class=fn>void <a name="setEncodedPathAndQuery"></a>TQUrl::setEncodedPathAndQuery ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;pathAndQuery )<tt> [virtual]</tt>
</h3>
Parses <em>pathAndQuery</em> for a path and query and sets those values.
The whole string must be encoded.
<p> <p>See also <a href="#encode">encode</a>().
<h3 class=fn>void <a name="setFileName"></a>TQUrl::setFileName ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;name )<tt> [virtual]</tt>
</h3>
Sets the file name of the URL to <em>name</em>. If this URL contains a
<a href="#fileName">fileName</a>(), the original file name is replaced by <em>name</em>.
<p> See the documentation of fileName() 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="#fileName">fileName</a>().
<h3 class=fn>void <a name="setHost"></a>TQUrl::setHost ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;host )<tt> [virtual]</tt>
</h3>
Sets the hostname of the URL to <em>host</em>.
<p> <p>See also <a href="#host">host</a>() and <a href="#hasHost">hasHost</a>().
<h3 class=fn>void <a name="setPassword"></a>TQUrl::setPassword ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;pass )<tt> [virtual]</tt>
</h3>
Sets the password of the URL to <em>pass</em>.
<p> <b>Warning:</b> Passwords passed in URLs are normally <em>insecure</em>; this
is due to the mechanism, not because of TQt.
<p> <p>See also <a href="#password">password</a>() and <a href="#setUser">setUser</a>().
<h3 class=fn>void <a name="setPath"></a>TQUrl::setPath ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;path )<tt> [virtual]</tt>
</h3>
Sets the path of the URL to <em>path</em>.
<p> <p>See also <a href="#path">path</a>() and <a href="#hasPath">hasPath</a>().
<h3 class=fn>void <a name="setPort"></a>TQUrl::setPort ( int&nbsp;port )<tt> [virtual]</tt>
</h3>
Sets the port of the URL to <em>port</em>.
<p> <p>See also <a href="#port">port</a>().
<h3 class=fn>void <a name="setProtocol"></a>TQUrl::setProtocol ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;protocol )<tt> [virtual]</tt>
</h3>
Sets the protocol of the URL to <em>protocol</em>. Typically, "file",
"http", "ftp", etc.
<p> <p>See also <a href="#protocol">protocol</a>().
<h3 class=fn>void <a name="setQuery"></a>TQUrl::setQuery ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;txt )<tt> [virtual]</tt>
</h3>
Sets the query of the URL to <em>txt</em>. <em>txt</em> must be encoded.
<p> <p>See also <a href="#query">query</a>() and <a href="#encode">encode</a>().
<h3 class=fn>void <a name="setRef"></a>TQUrl::setRef ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;txt )<tt> [virtual]</tt>
</h3>
Sets the reference of the URL to <em>txt</em>. <em>txt</em> must be encoded.
<p> <p>See also <a href="#ref">ref</a>(), <a href="#hasRef">hasRef</a>(), and <a href="#encode">encode</a>().
<h3 class=fn>void <a name="setUser"></a>TQUrl::setUser ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;user )<tt> [virtual]</tt>
</h3>
Sets the username of the URL to <em>user</em>.
<p> <p>See also <a href="#user">user</a>() and <a href="#setPassword">setPassword</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="toString"></a>TQUrl::toString ( bool&nbsp;encodedPath = FALSE, bool&nbsp;forcePrependProtocol = TRUE ) const<tt> [virtual]</tt>
</h3>
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
<em>forcePrependProtocol</em> is TRUE and <em>encodedPath</em> looks like a
local filename, the "file:/" protocol is also prepended.
<p> <p>See also <a href="#encode">encode</a>() and <a href="#decode">decode</a>().
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="user"></a>TQUrl::user () const
</h3>
Returns the username of the URL.
<p> <p>See also <a href="#setUser">setUser</a>() and <a href="#setPassword">setPassword</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>