summaryrefslogtreecommitdiffstats
path: root/doc/html/qurl.html
blob: cb97e7ab2295e63ba49217286f6ef5c48aef1df7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qurl.cpp:91 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QUrl 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>QUrl Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1>

<p>The QUrl class provides a URL parser and simplifies working with URLs.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qurl-h.html">qurl.h</a>&gt;</tt>
<p>Inherited by <a href="qurloperator.html">QUrlOperator</a>.
<p><a href="qurl-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QUrl"><b>QUrl</b></a> ()</li>
<li class=fn><a href="#QUrl-2"><b>QUrl</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;url )</li>
<li class=fn><a href="#QUrl-3"><b>QUrl</b></a> ( const&nbsp;QUrl&nbsp;&amp;&nbsp;url )</li>
<li class=fn><a href="#QUrl-4"><b>QUrl</b></a> ( const&nbsp;QUrl&nbsp;&amp;&nbsp;url, const&nbsp;QString&nbsp;&amp;&nbsp;relUrl, bool&nbsp;checkSlash = FALSE )</li>
<li class=fn>virtual <a href="#~QUrl"><b>~QUrl</b></a> ()</li>
<li class=fn>QString <a href="#protocol"><b>protocol</b></a> () const</li>
<li class=fn>virtual void <a href="#setProtocol"><b>setProtocol</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;protocol )</li>
<li class=fn>QString <a href="#user"><b>user</b></a> () const</li>
<li class=fn>virtual void <a href="#setUser"><b>setUser</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;user )</li>
<li class=fn>bool <a href="#hasUser"><b>hasUser</b></a> () const</li>
<li class=fn>QString <a href="#password"><b>password</b></a> () const</li>
<li class=fn>virtual void <a href="#setPassword"><b>setPassword</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;pass )</li>
<li class=fn>bool <a href="#hasPassword"><b>hasPassword</b></a> () const</li>
<li class=fn>QString <a href="#host"><b>host</b></a> () const</li>
<li class=fn>virtual void <a href="#setHost"><b>setHost</b></a> ( const&nbsp;QString&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>QString <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;QString&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;QString&nbsp;&amp;&nbsp;pathAndQuery )</li>
<li class=fn>QString <a href="#encodedPathAndQuery"><b>encodedPathAndQuery</b></a> ()</li>
<li class=fn>virtual void <a href="#setQuery"><b>setQuery</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;txt )</li>
<li class=fn>QString <a href="#query"><b>query</b></a> () const</li>
<li class=fn>QString <a href="#ref"><b>ref</b></a> () const</li>
<li class=fn>virtual void <a href="#setRef"><b>setRef</b></a> ( const&nbsp;QString&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;QString&nbsp;&amp;&nbsp;pa )</li>
<li class=fn>virtual void <a href="#setFileName"><b>setFileName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;name )</li>
<li class=fn>QString <a href="#fileName"><b>fileName</b></a> () const</li>
<li class=fn>QString <a href="#dirPath"><b>dirPath</b></a> () const</li>
<li class=fn>QUrl &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QUrl&nbsp;&amp;&nbsp;url )</li>
<li class=fn>QUrl &amp; <a href="#operator-eq-2"><b>operator=</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;url )</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QUrl&nbsp;&amp;&nbsp;url ) const</li>
<li class=fn>bool <a href="#operator-eq-eq-2"><b>operator==</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;url ) const</li>
<li class=fn><a href="#operator-QString"><b>operator QString</b></a> () const</li>
<li class=fn>virtual QString <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> ( QString&nbsp;&amp;&nbsp;url )</li>
<li class=fn>void <a href="#encode"><b>encode</b></a> ( QString&nbsp;&amp;&nbsp;url )</li>
<li class=fn>bool <a href="#isRelativeUrl"><b>isRelativeUrl</b></a> ( const&nbsp;QString&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;QString&nbsp;&amp;&nbsp;url )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


<p> The QUrl class provides a URL parser and simplifies working with URLs.

<p> 


<p> 
<p> The QUrl class is provided for simple work with URLs. It can
parse, decode, encode, etc.
<p> QUrl 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/qdockarea.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">"qdockarea.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> QUrl is normally used like this:
<p> <pre>
    QUrl url( "http://www.trolltech.com" );
    // or
    QUrl 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 QUrls and QStrings, QUrl implements
the necessary cast and assignment operators so you can do
following:
<p> <pre>
    QUrl url( "http://www.trolltech.com" );
    <a href="qstring.html">QString</a> s = url;
    // or
    <a href="qstring.html">QString</a> s( "http://www.trolltech.com" );
    QUrl 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="qurloperator.html">QUrlOperator</a>.
<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>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QUrl"></a>QUrl::QUrl ()
</h3>
Constructs an empty URL that is invalid.

<h3 class=fn><a name="QUrl-2"></a>QUrl::QUrl ( const&nbsp;<a href="qstring.html">QString</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="QUrl-3"></a>QUrl::QUrl ( const&nbsp;<a href="qurl.html">QUrl</a>&nbsp;&amp;&nbsp;url )
</h3>
Copy constructor. Copies the data of <em>url</em>.

<h3 class=fn><a name="QUrl-4"></a>QUrl::QUrl ( const&nbsp;<a href="qurl.html">QUrl</a>&nbsp;&amp;&nbsp;url, const&nbsp;<a href="qstring.html">QString</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>
    QUrl 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>
    QUrl 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>
    QUrl 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="~QUrl"></a>QUrl::~QUrl ()<tt> [virtual]</tt>
</h3>
Destructor.

<h3 class=fn>void <a name="addPath"></a>QUrl::addPath ( const&nbsp;<a href="qstring.html">QString</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>QUrl::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>QUrl::decode ( <a href="qstring.html">QString</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="qstring.html">QString</a> url = "http%3A//www%20trolltech%20com"
        QUrl::<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="qstring.html">QString</a> <a name="dirPath"></a>QUrl::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>QUrl::encode ( <a href="qstring.html">QString</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="qstring.html">QString</a> url = http://www.trolltech.com
        QUrl::<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="qstring.html">QString</a> <a name="encodedPathAndQuery"></a>QUrl::encodedPathAndQuery ()
</h3>
Returns the encoded path and query.
<p> <p>See also <a href="#decode">decode</a>().

<h3 class=fn><a href="qstring.html">QString</a> <a name="fileName"></a>QUrl::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>QUrl::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>QUrl::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 Qt.
<p> <p>See also <a href="#setPassword">setPassword</a>() and <a href="#setUser">setUser</a>().

<h3 class=fn>bool <a name="hasPath"></a>QUrl::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>QUrl::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>QUrl::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>QUrl::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="qstring.html">QString</a> <a name="host"></a>QUrl::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>QUrl::isLocalFile () const
</h3>
Returns TRUE if the URL is a local file; otherwise returns FALSE.

<p>Example: <a href="qdir-example.html#x1849">qdir/qdir.cpp</a>.
<h3 class=fn>bool <a name="isRelativeUrl"></a>QUrl::isRelativeUrl ( const&nbsp;<a href="qstring.html">QString</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>QUrl::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-QString"></a>QUrl::operator QString () const
</h3>
Composes a string version of the URL and returns it.
<p> <p>See also <a href="#toString">QUrl::toString</a>().

<h3 class=fn><a href="qurl.html">QUrl</a>&nbsp;&amp; <a name="operator-eq"></a>QUrl::operator= ( const&nbsp;<a href="qurl.html">QUrl</a>&nbsp;&amp;&nbsp;url )
</h3>
Assigns the data of <em>url</em> to this class.

<h3 class=fn><a href="qurl.html">QUrl</a>&nbsp;&amp; <a name="operator-eq-2"></a>QUrl::operator= ( const&nbsp;<a href="qstring.html">QString</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>QUrl::operator== ( const&nbsp;<a href="qurl.html">QUrl</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>QUrl::operator== ( const&nbsp;<a href="qstring.html">QString</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>QUrl::parse ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;url )<tt> [virtual protected]</tt>
</h3>
Parses the <em>url</em>.

<h3 class=fn><a href="qstring.html">QString</a> <a name="password"></a>QUrl::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 Qt.
<p> <p>See also <a href="#setPassword">setPassword</a>() and <a href="#setUser">setUser</a>().

<h3 class=fn><a href="qstring.html">QString</a> <a name="path"></a>QUrl::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="qdir-example.html#x1850">qdir/qdir.cpp</a>.
<h3 class=fn>int <a name="port"></a>QUrl::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="qstring.html">QString</a> <a name="protocol"></a>QUrl::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="qstring.html">QString</a> <a name="query"></a>QUrl::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="qstring.html">QString</a> <a name="ref"></a>QUrl::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>QUrl::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>QUrl::setEncodedPathAndQuery ( const&nbsp;<a href="qstring.html">QString</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>QUrl::setFileName ( const&nbsp;<a href="qstring.html">QString</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>QUrl::setHost ( const&nbsp;<a href="qstring.html">QString</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>QUrl::setPassword ( const&nbsp;<a href="qstring.html">QString</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 Qt.
<p> <p>See also <a href="#password">password</a>() and <a href="#setUser">setUser</a>().

<h3 class=fn>void <a name="setPath"></a>QUrl::setPath ( const&nbsp;<a href="qstring.html">QString</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>QUrl::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>QUrl::setProtocol ( const&nbsp;<a href="qstring.html">QString</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>QUrl::setQuery ( const&nbsp;<a href="qstring.html">QString</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>QUrl::setRef ( const&nbsp;<a href="qstring.html">QString</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>QUrl::setUser ( const&nbsp;<a href="qstring.html">QString</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="qstring.html">QString</a> <a name="toString"></a>QUrl::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="qstring.html">QString</a> <a name="user"></a>QUrl::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">Qt 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>Qt 3.3.8</div>
</table></div></address></body>
</html>