source: trunk/doc/html/qurl.html@ 190

Last change on this file since 190 was 190, checked in by rudi, 14 years ago

reference documentation added

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