~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/q3url.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/qt3support/network/q3url.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: Q3Url Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">Q3Url Class Reference</h1>
 
21
<p>The Q3Url class provides a URL parser and simplifies working with URLs. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;Q3Url&gt;</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 the <a href="porting4.html">Porting Guide</a> for more information.</p>
 
23
<p>Part of the <a href="qt3support.html">Qt3Support</a> module.</p>
 
24
<p>Inherited by <a href="q3urloperator.html">Q3UrlOperator</a>.</p>
 
25
<ul>
 
26
<li><a href="q3url-members.html">List of all members, including inherited members</a></li>
 
27
</ul>
 
28
<a name="public-functions"></a>
 
29
<h3>Public Functions</h3>
 
30
<ul>
 
31
<li><div class="fn"/><b><a href="q3url.html#Q3Url">Q3Url</a></b> ()</li>
 
32
<li><div class="fn"/><b><a href="q3url.html#Q3Url-2">Q3Url</a></b> ( const QString &amp; <i>url</i> )</li>
 
33
<li><div class="fn"/><b><a href="q3url.html#Q3Url-3">Q3Url</a></b> ( const Q3Url &amp; <i>url</i> )</li>
 
34
<li><div class="fn"/><b><a href="q3url.html#Q3Url-4">Q3Url</a></b> ( const Q3Url &amp; <i>url</i>, const QString &amp; <i>relUrl</i>, bool <i>checkSlash</i> = false )</li>
 
35
<li><div class="fn"/>virtual <b><a href="q3url.html#dtor.Q3Url">~Q3Url</a></b> ()</li>
 
36
<li><div class="fn"/>virtual void <b><a href="q3url.html#addPath">addPath</a></b> ( const QString &amp; <i>pa</i> )</li>
 
37
<li><div class="fn"/>virtual bool <b><a href="q3url.html#cdUp">cdUp</a></b> ()</li>
 
38
<li><div class="fn"/>QString <b><a href="q3url.html#dirPath">dirPath</a></b> () const</li>
 
39
<li><div class="fn"/>QString <b><a href="q3url.html#encodedPathAndQuery">encodedPathAndQuery</a></b> ()</li>
 
40
<li><div class="fn"/>QString <b><a href="q3url.html#fileName">fileName</a></b> () const</li>
 
41
<li><div class="fn"/>bool <b><a href="q3url.html#hasHost">hasHost</a></b> () const</li>
 
42
<li><div class="fn"/>bool <b><a href="q3url.html#hasPassword">hasPassword</a></b> () const</li>
 
43
<li><div class="fn"/>bool <b><a href="q3url.html#hasPath">hasPath</a></b> () const</li>
 
44
<li><div class="fn"/>bool <b><a href="q3url.html#hasPort">hasPort</a></b> () const</li>
 
45
<li><div class="fn"/>bool <b><a href="q3url.html#hasRef">hasRef</a></b> () const</li>
 
46
<li><div class="fn"/>bool <b><a href="q3url.html#hasUser">hasUser</a></b> () const</li>
 
47
<li><div class="fn"/>QString <b><a href="q3url.html#host">host</a></b> () const</li>
 
48
<li><div class="fn"/>bool <b><a href="q3url.html#isLocalFile">isLocalFile</a></b> () const</li>
 
49
<li><div class="fn"/>bool <b><a href="q3url.html#isValid">isValid</a></b> () const</li>
 
50
<li><div class="fn"/>QString <b><a href="q3url.html#password">password</a></b> () const</li>
 
51
<li><div class="fn"/>QString <b><a href="q3url.html#path">path</a></b> ( bool <i>correct</i> = true ) const</li>
 
52
<li><div class="fn"/>int <b><a href="q3url.html#port">port</a></b> () const</li>
 
53
<li><div class="fn"/>QString <b><a href="q3url.html#protocol">protocol</a></b> () const</li>
 
54
<li><div class="fn"/>QString <b><a href="q3url.html#query">query</a></b> () const</li>
 
55
<li><div class="fn"/>QString <b><a href="q3url.html#ref">ref</a></b> () const</li>
 
56
<li><div class="fn"/>virtual void <b><a href="q3url.html#setEncodedPathAndQuery">setEncodedPathAndQuery</a></b> ( const QString &amp; <i>pathAndQuery</i> )</li>
 
57
<li><div class="fn"/>virtual void <b><a href="q3url.html#setFileName">setFileName</a></b> ( const QString &amp; <i>name</i> )</li>
 
58
<li><div class="fn"/>virtual void <b><a href="q3url.html#setHost">setHost</a></b> ( const QString &amp; <i>host</i> )</li>
 
59
<li><div class="fn"/>virtual void <b><a href="q3url.html#setPassword">setPassword</a></b> ( const QString &amp; <i>pass</i> )</li>
 
60
<li><div class="fn"/>virtual void <b><a href="q3url.html#setPath">setPath</a></b> ( const QString &amp; <i>path</i> )</li>
 
61
<li><div class="fn"/>virtual void <b><a href="q3url.html#setPort">setPort</a></b> ( int <i>port</i> )</li>
 
62
<li><div class="fn"/>virtual void <b><a href="q3url.html#setProtocol">setProtocol</a></b> ( const QString &amp; <i>protocol</i> )</li>
 
63
<li><div class="fn"/>virtual void <b><a href="q3url.html#setQuery">setQuery</a></b> ( const QString &amp; <i>txt</i> )</li>
 
64
<li><div class="fn"/>virtual void <b><a href="q3url.html#setRef">setRef</a></b> ( const QString &amp; <i>txt</i> )</li>
 
65
<li><div class="fn"/>virtual void <b><a href="q3url.html#setUser">setUser</a></b> ( const QString &amp; <i>user</i> )</li>
 
66
<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>
 
67
<li><div class="fn"/>QString <b><a href="q3url.html#user">user</a></b> () const</li>
 
68
<li><div class="fn"/><b><a href="q3url.html#operator-QString">operator QString</a></b> () const</li>
 
69
<li><div class="fn"/>Q3Url &amp; <b><a href="q3url.html#operator-eq">operator=</a></b> ( const Q3Url &amp; <i>url</i> )</li>
 
70
<li><div class="fn"/>Q3Url &amp; <b><a href="q3url.html#operator-eq-2">operator=</a></b> ( const QString &amp; <i>url</i> )</li>
 
71
<li><div class="fn"/>bool <b><a href="q3url.html#operator-eq-eq">operator==</a></b> ( const Q3Url &amp; <i>url</i> ) const</li>
 
72
<li><div class="fn"/>bool <b><a href="q3url.html#operator-eq-eq-2">operator==</a></b> ( const QString &amp; <i>url</i> ) const</li>
 
73
</ul>
 
74
<a name="static-public-members"></a>
 
75
<h3>Static Public Members</h3>
 
76
<ul>
 
77
<li><div class="fn"/>void <b><a href="q3url.html#decode">decode</a></b> ( QString &amp; <i>url</i> )</li>
 
78
<li><div class="fn"/>void <b><a href="q3url.html#encode">encode</a></b> ( QString &amp; <i>url</i> )</li>
 
79
<li><div class="fn"/>bool <b><a href="q3url.html#isRelativeUrl">isRelativeUrl</a></b> ( const QString &amp; <i>url</i> )</li>
 
80
</ul>
 
81
<a name="protected-functions"></a>
 
82
<h3>Protected Functions</h3>
 
83
<ul>
 
84
<li><div class="fn"/>virtual bool <b><a href="q3url.html#parse">parse</a></b> ( const QString &amp; <i>url</i> )</li>
 
85
<li><div class="fn"/>virtual void <b><a href="q3url.html#reset">reset</a></b> ()</li>
 
86
</ul>
 
87
<a name="details"></a>
 
88
<hr />
 
89
<h2>Detailed Description</h2>
 
90
<p>The Q3Url class provides a URL parser and simplifies working with URLs.</p>
 
91
<p>The Q3Url class is provided for simple work with URLs. It can parse, decode, encode, etc.</p>
 
92
<p>Q3Url works with the decoded path and encoded query in turn.</p>
 
93
<p>Example:</p>
 
94
<p>&lt;tt&gt;http://www.trolltech.com:80/cgi-bin/test%20me.pl?cmd=Hello%20you&lt;/tt&gt;</p>
 
95
<table align="center" cellpadding="2" cellspacing="1" border="0">
 
96
<tr valign="top" bgcolor="#a2c511"><th>Function</th><th>Returns</th></tr>
 
97
<tr valign="top" bgcolor="#f0f0f0"><td><a href="q3url.html#protocol">protocol</a>()</td><td>&quot;http&quot;</td></tr>
 
98
<tr valign="top" bgcolor="#e0e0e0"><td><a href="q3url.html#host">host</a>()</td><td>&quot;www.trolltech.com&quot;</td></tr>
 
99
<tr valign="top" bgcolor="#f0f0f0"><td><a href="q3url.html#port">port</a>()</td><td>80</td></tr>
 
100
<tr valign="top" bgcolor="#e0e0e0"><td><a href="q3url.html#path">path</a>()</td><td>&quot;/cgi-bin/test&amp;nbsp;me.pl&quot;</td></tr>
 
101
<tr valign="top" bgcolor="#f0f0f0"><td><a href="q3url.html#fileName">fileName</a>()</td><td>&quot;test&amp;nbsp;me.pl&quot;</td></tr>
 
102
<tr valign="top" bgcolor="#e0e0e0"><td><a href="q3url.html#query">query</a>()</td><td>&quot;cmd=Hello%20you&quot;</td></tr>
 
103
</table>
 
104
<p>Example:</p>
 
105
<p>&lt;tt&gt;http://doc.trolltech.com/qdockarea.html#lines&lt;/tt&gt;</p>
 
106
<table align="center" cellpadding="2" cellspacing="1" border="0">
 
107
<tr valign="top" bgcolor="#a2c511"><th>Function</th><th>Returns</th></tr>
 
108
<tr valign="top" bgcolor="#f0f0f0"><td><a href="q3url.html#protocol">protocol</a>()</td><td>&quot;http&quot;</td></tr>
 
109
<tr valign="top" bgcolor="#e0e0e0"><td><a href="q3url.html#host">host</a>()</td><td>&quot;doc.trolltech.com&quot;</td></tr>
 
110
<tr valign="top" bgcolor="#f0f0f0"><td><a href="q3url.html#fileName">fileName</a>()</td><td>&quot;qdockarea.html&quot;</td></tr>
 
111
<tr valign="top" bgcolor="#e0e0e0"><td><a href="q3url.html#ref">ref</a>()</td><td>&quot;lines&quot;</td></tr>
 
112
</table>
 
113
<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>
 
114
<p>Because path is always encoded internally you must not use &quot;%00&quot; in the path, although this is okay (but not recommended) for the query.</p>
 
115
<p>Q3Url is normally used like this:</p>
 
116
<pre>&nbsp;   Q3Url url( &quot;http://www.trolltech.com&quot; );
 
117
    // or
 
118
    Q3Url url( &quot;file:/home/myself/Mail&quot;, &quot;Inbox&quot; );</pre>
 
119
<p>You can then access and manipulate the various parts of the URL.</p>
 
120
<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>
 
121
<pre>&nbsp;   Q3Url url( &quot;http://www.trolltech.com&quot; );
 
122
    QString s = url;
 
123
    // or
 
124
    QString s( &quot;http://www.trolltech.com&quot; );
 
125
    Q3Url url( s );</pre>
 
126
<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>
 
127
<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>
 
128
<p>See also <a href="q3urloperator.html">Q3UrlOperator</a>.</p>
 
129
<hr />
 
130
<h2>Member Function Documentation</h2>
 
131
<h3 class="fn"><a name="Q3Url"></a>Q3Url::Q3Url ()</h3>
 
132
<p>Constructs an empty URL that is invalid.</p>
 
133
<h3 class="fn"><a name="Q3Url-2"></a>Q3Url::Q3Url ( const <a href="qstring.html">QString</a> &amp; <i>url</i> )</h3>
 
134
<p>Constructs a URL by parsing the string <i>url</i>.</p>
 
135
<p>If you pass a string like &quot;/home/qt&quot;, the &quot;file&quot; protocol is assumed.</p>
 
136
<h3 class="fn"><a name="Q3Url-3"></a>Q3Url::Q3Url ( const Q3Url &amp; <i>url</i> )</h3>
 
137
<p>Copy constructor. Copies the data of <i>url</i>.</p>
 
138
<h3 class="fn"><a name="Q3Url-4"></a>Q3Url::Q3Url ( const Q3Url &amp; <i>url</i>, const <a href="qstring.html">QString</a> &amp; <i>relUrl</i>, bool <i>checkSlash</i> = false )</h3>
 
139
<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>
 
140
<p>For example, the path of</p>
 
141
<pre>&nbsp;   Q3Url url( &quot;ftp://ftp.trolltech.com/qt/source&quot;, &quot;qt-2.1.0.tar.gz&quot; );</pre>
 
142
<p>will be &quot;/qt/srource/qt-2.1.0.tar.gz&quot;.</p>
 
143
<p>On the other hand,</p>
 
144
<pre>&nbsp;   Q3Url url( &quot;ftp://ftp.trolltech.com/qt/source&quot;, &quot;/usr/local&quot; );</pre>
 
145
<p>will result in a new URL, &quot;ftp://ftp.trolltech.com/usr/local&quot;, because &quot;/usr/local&quot; isn't relative.</p>
 
146
<p>Similarly,</p>
 
147
<pre>&nbsp;   Q3Url url( &quot;ftp://ftp.trolltech.com/qt/source&quot;, &quot;file:/usr/local&quot; );</pre>
 
148
<p>will result in a new URL, with &quot;/usr/local&quot; as the path and &quot;file&quot; as the protocol.</p>
 
149
<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>
 
150
<h3 class="fn"><a name="dtor.Q3Url"></a>Q3Url::~Q3Url ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
151
<p>Destructor.</p>
 
152
<h3 class="fn"><a name="addPath"></a>void Q3Url::addPath ( const <a href="qstring.html">QString</a> &amp; <i>pa</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
153
<p>Adds the path <i>pa</i> to the path of the URL.</p>
 
154
<p>See also <a href="q3url.html#setPath">setPath</a>() and <a href="q3url.html#hasPath">hasPath</a>().</p>
 
155
<h3 class="fn"><a name="cdUp"></a>bool Q3Url::cdUp ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
156
<p>Changes the directory to one directory up.</p>
 
157
<p>See also <a href="q3url.html#setPath">setPath</a>().</p>
 
158
<h3 class="fn"><a name="decode"></a>void Q3Url::decode ( <a href="qstring.html">QString</a> &amp; <i>url</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
159
<p>Decodes the <i>url</i> in-place into UTF-8. For example</p>
 
160
<pre>&nbsp;   QString url = &quot;http%3A//www%20trolltech%20com&quot;
 
161
    Q3Url::decode( url );
 
162
    // url is now &quot;http://www.trolltech.com&quot;</pre>
 
163
<p>See also <a href="q3url.html#encode">encode</a>().</p>
 
164
<h3 class="fn"><a name="dirPath"></a><a href="qstring.html">QString</a> Q3Url::dirPath () const</h3>
 
165
<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>
 
166
<p>See also <a href="q3url.html#setPath">setPath</a>() and <a href="q3url.html#hasPath">hasPath</a>().</p>
 
167
<h3 class="fn"><a name="encode"></a>void Q3Url::encode ( <a href="qstring.html">QString</a> &amp; <i>url</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
168
<p>Encodes the <i>url</i> in-place into UTF-8. For example</p>
 
169
<pre>&nbsp;   QString url = http://www.trolltech.com
 
170
    Q3Url::encode( url );
 
171
    // url is now &quot;http%3A//www%20trolltech%20com&quot;</pre>
 
172
<p>See also <a href="q3url.html#decode">decode</a>().</p>
 
173
<h3 class="fn"><a name="encodedPathAndQuery"></a><a href="qstring.html">QString</a> Q3Url::encodedPathAndQuery ()</h3>
 
174
<p>Returns the encoded path and query.</p>
 
175
<p>See also <a href="q3url.html#decode">decode</a>().</p>
 
176
<h3 class="fn"><a name="fileName"></a><a href="qstring.html">QString</a> Q3Url::fileName () const</h3>
 
177
<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>
 
178
<p>See also <a href="q3url.html#setFileName">setFileName</a>().</p>
 
179
<h3 class="fn"><a name="hasHost"></a>bool Q3Url::hasHost () const</h3>
 
180
<p>Returns true if the URL contains a hostname; otherwise returns false.</p>
 
181
<p>See also <a href="q3url.html#setHost">setHost</a>().</p>
 
182
<h3 class="fn"><a name="hasPassword"></a>bool Q3Url::hasPassword () const</h3>
 
183
<p>Returns true if the URL contains a password; otherwise returns false.</p>
 
184
<p><b>Warning:</b> Passwords passed in URLs are normally <i>insecure</i>; this is due to the mechanism, not because of Qt.</p>
 
185
<p>See also <a href="q3url.html#setPassword">setPassword</a>() and <a href="q3url.html#setUser">setUser</a>().</p>
 
186
<h3 class="fn"><a name="hasPath"></a>bool Q3Url::hasPath () const</h3>
 
187
<p>Returns true if the URL contains a path; otherwise returns false.</p>
 
188
<p>See also <a href="q3url.html#path">path</a>() and <a href="q3url.html#setPath">setPath</a>().</p>
 
189
<h3 class="fn"><a name="hasPort"></a>bool Q3Url::hasPort () const</h3>
 
190
<p>Returns true if the URL contains a port; otherwise returns false.</p>
 
191
<p>See also <a href="q3url.html#setPort">setPort</a>().</p>
 
192
<h3 class="fn"><a name="hasRef"></a>bool Q3Url::hasRef () const</h3>
 
193
<p>Returns true if the URL has a reference; otherwise returns false.</p>
 
194
<p>See also <a href="q3url.html#setRef">setRef</a>().</p>
 
195
<h3 class="fn"><a name="hasUser"></a>bool Q3Url::hasUser () const</h3>
 
196
<p>Returns true if the URL contains a username; otherwise returns false.</p>
 
197
<p>See also <a href="q3url.html#setUser">setUser</a>() and <a href="q3url.html#setPassword">setPassword</a>().</p>
 
198
<h3 class="fn"><a name="host"></a><a href="qstring.html">QString</a> Q3Url::host () const</h3>
 
199
<p>Returns the hostname of the URL.</p>
 
200
<p>See also <a href="q3url.html#setHost">setHost</a>() and <a href="q3url.html#hasHost">hasHost</a>().</p>
 
201
<h3 class="fn"><a name="isLocalFile"></a>bool Q3Url::isLocalFile () const</h3>
 
202
<p>Returns true if the URL is a local file; otherwise returns false.</p>
 
203
<h3 class="fn"><a name="isRelativeUrl"></a>bool Q3Url::isRelativeUrl ( const <a href="qstring.html">QString</a> &amp; <i>url</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
 
204
<p>Returns true if <i>url</i> is relative; otherwise returns false.</p>
 
205
<h3 class="fn"><a name="isValid"></a>bool Q3Url::isValid () const</h3>
 
206
<p>Returns true if the URL is valid; otherwise returns false. A URL is invalid if it cannot be parsed, for example.</p>
 
207
<h3 class="fn"><a name="parse"></a>bool Q3Url::parse ( const <a href="qstring.html">QString</a> &amp; <i>url</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
 
208
<p>Parses the <i>url</i>.</p>
 
209
<h3 class="fn"><a name="password"></a><a href="qstring.html">QString</a> Q3Url::password () const</h3>
 
210
<p>Returns the password of the URL.</p>
 
211
<p><b>Warning:</b> Passwords passed in URLs are normally <i>insecure</i>; this is due to the mechanism, not because of Qt.</p>
 
212
<p>See also <a href="q3url.html#setPassword">setPassword</a>() and <a href="q3url.html#setUser">setUser</a>().</p>
 
213
<h3 class="fn"><a name="path"></a><a href="qstring.html">QString</a> Q3Url::path ( bool <i>correct</i> = true ) const</h3>
 
214
<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 &quot;/../..&quot;, etc). Otherwise path() returns exactly the path that was parsed or set.</p>
 
215
<p>See also <a href="q3url.html#setPath">setPath</a>() and <a href="q3url.html#hasPath">hasPath</a>().</p>
 
216
<h3 class="fn"><a name="port"></a>int Q3Url::port () const</h3>
 
217
<p>Returns the port of the URL or -1 if no port has been set.</p>
 
218
<p>See also <a href="q3url.html#setPort">setPort</a>().</p>
 
219
<h3 class="fn"><a name="protocol"></a><a href="qstring.html">QString</a> Q3Url::protocol () const</h3>
 
220
<p>Returns the protocol of the URL. Typically, &quot;file&quot;, &quot;http&quot;, &quot;ftp&quot;, etc.</p>
 
221
<p>See also <a href="q3url.html#setProtocol">setProtocol</a>().</p>
 
222
<h3 class="fn"><a name="query"></a><a href="qstring.html">QString</a> Q3Url::query () const</h3>
 
223
<p>Returns the (encoded) query of the URL.</p>
 
224
<p>See also <a href="q3url.html#setQuery">setQuery</a>() and <a href="q3url.html#decode">decode</a>().</p>
 
225
<h3 class="fn"><a name="ref"></a><a href="qstring.html">QString</a> Q3Url::ref () const</h3>
 
226
<p>Returns the (encoded) reference of the URL.</p>
 
227
<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>
 
228
<h3 class="fn"><a name="reset"></a>void Q3Url::reset ()&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
 
229
<p>Resets all parts of the URL to their default values and invalidates it.</p>
 
230
<h3 class="fn"><a name="setEncodedPathAndQuery"></a>void Q3Url::setEncodedPathAndQuery ( const <a href="qstring.html">QString</a> &amp; <i>pathAndQuery</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
231
<p>Parses <i>pathAndQuery</i> for a path and query and sets those values. The whole string must be encoded.</p>
 
232
<p>See also <a href="q3url.html#encode">encode</a>().</p>
 
233
<h3 class="fn"><a name="setFileName"></a>void Q3Url::setFileName ( const <a href="qstring.html">QString</a> &amp; <i>name</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
234
<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>
 
235
<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>
 
236
<p>See also <a href="q3url.html#fileName">fileName</a>().</p>
 
237
<h3 class="fn"><a name="setHost"></a>void Q3Url::setHost ( const <a href="qstring.html">QString</a> &amp; <i>host</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
238
<p>Sets the hostname of the URL to <i>host</i>.</p>
 
239
<p>See also <a href="q3url.html#host">host</a>() and <a href="q3url.html#hasHost">hasHost</a>().</p>
 
240
<h3 class="fn"><a name="setPassword"></a>void Q3Url::setPassword ( const <a href="qstring.html">QString</a> &amp; <i>pass</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
241
<p>Sets the password of the URL to <i>pass</i>.</p>
 
242
<p><b>Warning:</b> Passwords passed in URLs are normally <i>insecure</i>; this is due to the mechanism, not because of Qt.</p>
 
243
<p>See also <a href="q3url.html#password">password</a>() and <a href="q3url.html#setUser">setUser</a>().</p>
 
244
<h3 class="fn"><a name="setPath"></a>void Q3Url::setPath ( const <a href="qstring.html">QString</a> &amp; <i>path</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
245
<p>Sets the path of the URL to <i>path</i>.</p>
 
246
<p>See also <a href="q3url.html#path">path</a>() and <a href="q3url.html#hasPath">hasPath</a>().</p>
 
247
<h3 class="fn"><a name="setPort"></a>void Q3Url::setPort ( int <i>port</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
248
<p>Sets the port of the URL to <i>port</i>.</p>
 
249
<p>See also <a href="q3url.html#port">port</a>().</p>
 
250
<h3 class="fn"><a name="setProtocol"></a>void Q3Url::setProtocol ( const <a href="qstring.html">QString</a> &amp; <i>protocol</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
251
<p>Sets the protocol of the URL to <i>protocol</i>. Typically, &quot;file&quot;, &quot;http&quot;, &quot;ftp&quot;, etc.</p>
 
252
<p>See also <a href="q3url.html#protocol">protocol</a>().</p>
 
253
<h3 class="fn"><a name="setQuery"></a>void Q3Url::setQuery ( const <a href="qstring.html">QString</a> &amp; <i>txt</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
254
<p>Sets the query of the URL to <i>txt</i>. <i>txt</i> must be encoded.</p>
 
255
<p>See also <a href="q3url.html#query">query</a>() and <a href="q3url.html#encode">encode</a>().</p>
 
256
<h3 class="fn"><a name="setRef"></a>void Q3Url::setRef ( const <a href="qstring.html">QString</a> &amp; <i>txt</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
257
<p>Sets the reference of the URL to <i>txt</i>. <i>txt</i> must be encoded.</p>
 
258
<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>
 
259
<h3 class="fn"><a name="setUser"></a>void Q3Url::setUser ( const <a href="qstring.html">QString</a> &amp; <i>user</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
260
<p>Sets the username of the URL to <i>user</i>.</p>
 
261
<p>See also <a href="q3url.html#user">user</a>() and <a href="q3url.html#setPassword">setPassword</a>().</p>
 
262
<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&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
263
<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 &quot;file:/&quot; protocol is also prepended.</p>
 
264
<p>See also <a href="q3url.html#encode">encode</a>() and <a href="q3url.html#decode">decode</a>().</p>
 
265
<h3 class="fn"><a name="user"></a><a href="qstring.html">QString</a> Q3Url::user () const</h3>
 
266
<p>Returns the username of the URL.</p>
 
267
<p>See also <a href="q3url.html#setUser">setUser</a>() and <a href="q3url.html#setPassword">setPassword</a>().</p>
 
268
<h3 class="fn"><a name="operator-QString"></a>Q3Url::operator QString () const</h3>
 
269
<p>Composes a string version of the URL and returns it.</p>
 
270
<p>See also <a href="q3url.html#toString">Q3Url::toString</a>().</p>
 
271
<h3 class="fn"><a name="operator-eq"></a>Q3Url &amp; Q3Url::operator= ( const Q3Url &amp; <i>url</i> )</h3>
 
272
<p>Assigns the data of <i>url</i> to this class.</p>
 
273
<h3 class="fn"><a name="operator-eq-2"></a>Q3Url &amp; Q3Url::operator= ( const <a href="qstring.html">QString</a> &amp; <i>url</i> )</h3>
 
274
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
275
<p>Parses <i>url</i> and assigns the resulting data to this class.</p>
 
276
<p>If you pass a string like &quot;/home/qt&quot; the &quot;file&quot; protocol will be assumed.</p>
 
277
<h3 class="fn"><a name="operator-eq-eq"></a>bool Q3Url::operator== ( const Q3Url &amp; <i>url</i> ) const</h3>
 
278
<p>Compares this URL with <i>url</i> and returns true if they are equal; otherwise returns false.</p>
 
279
<h3 class="fn"><a name="operator-eq-eq-2"></a>bool Q3Url::operator== ( const <a href="qstring.html">QString</a> &amp; <i>url</i> ) const</h3>
 
280
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
281
<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>
 
282
<p /><address><hr /><div align="center">
 
283
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
284
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
285
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
286
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
287
</tr></table></div></address></body>
 
288
</html>