]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/uri.tex
Added wxRect::Intersect() documentation (patch 1868322 from Laurent Humbertclaude).
[wxWidgets.git] / docs / latex / wx / uri.tex
... / ...
CommitLineData
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: uri.tex
3%% Purpose: wxURI docs
4%% Author: Ryan Norton <wxprojects@comcast.net>
5%% Modified by:
6%% Created: 7/7/2004
7%% RCS-ID: $Id$
8%% Copyright: (c) Ryan Norton
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxURI}}\label{wxuri}
13
14wxURI is used to extract information from
15a URI (Uniform Resource Identifier).
16
17For information about URIs, see
18\urlref{RFC 3986}{http://www.ietf.org/rfc/rfc3986.txt}.
19
20In short, a URL \em{is} a URI. In other
21words, URL is a subset of a URI - all
22acceptable URLs are also acceptable URIs.
23
24wxURI automatically escapes invalid characters in a string,
25so there is no chance of wxURI "failing" on construction/creation.
26
27wxURI supports copy construction and standard assignment
28operators. wxURI can also be inherited from to provide
29furthur functionality.
30
31\wxheading{Derived from}
32
33\helpref{wxObject}{wxobject}
34
35\wxheading{Include files}
36
37<wx/uri.h>
38
39\wxheading{Library}
40
41\helpref{wxBase}{librarieslist}
42
43\wxheading{See also}
44
45\helpref{wxURL}{wxurl}
46
47\latexignore{\rtfignore{\wxheading{Members}}}
48
49\membersection{Obtaining individual components}\label{obtainingwxuricomponents}
50
51To obtain individual components you can use
52one of the following methods
53
54\helpref{GetScheme}{wxurigetscheme}\\
55\helpref{GetUserInfo}{wxurigetuserinfo}\\
56\helpref{GetServer}{wxurigetserver}\\
57\helpref{GetPort}{wxurigetport}\\
58\helpref{GetPath}{wxurigetpath}\\
59\helpref{GetQuery}{wxurigetquery}\\
60\helpref{GetFragment}{wxurigetfragment}
61
62However, you should check HasXXX before
63calling a get method, which determines whether or not the component referred
64to by the method is defined according to RFC 2396.
65
66Consider an undefined component equivalent to a
67NULL C string.\\
68\\
69\helpref{HasScheme}{wxurihasscheme}\\
70\helpref{HasUserInfo}{wxurihasuserinfo}\\
71\helpref{HasServer}{wxurihasserver}\\
72\helpref{HasPort}{wxurihasserver}\\
73\helpref{HasPath}{wxurihaspath}\\
74\helpref{HasQuery}{wxurihasquery}\\
75\helpref{HasFragment}{wxurihasfragment}
76
77Example:
78\begin{verbatim}
79//protocol will hold the http protocol (i.e. "http")
80wxString protocol;
81wxURI myuri(wxT("http://mysite.com"));
82if(myuri.HasScheme())
83 protocol = myuri.GetScheme();
84\end{verbatim}
85
86\membersection{Deviations from the RFC}\label{deviationsfromrfc}
87
88Note that on URIs with a "file" scheme wxURI does not
89parse the userinfo, server, or port portion. This is to keep
90compatability with wxFileSystem, the old wxURL, and older url specifications.
91
92\membersection{wxURI::wxURI}\label{wxuriwxuri}
93
94\func{}{wxURI}{\void}
95
96Creates an empty URI.
97
98\func{}{wxURI}{\param{const wxChar* }{uri}}
99
100Constructor for quick creation.
101
102\docparam{uri}{string to initialize with}
103
104\func{}{wxURI}{\param{const wxURI\& }{uri}}
105
106Copies this URI from another URI.
107
108\docparam{uri}{URI (Uniform Resource Identifier) to initialize with}
109
110
111\membersection{wxURI::BuildURI}\label{wxuribuilduri}
112
113\constfunc{wxString}{BuildURI}{\void}
114
115Builds the URI from its individual components and adds proper separators.
116
117If the URI is not a reference or is not resolved,
118the URI that is returned from Get is the same one
119passed to Create.
120
121
122\membersection{wxURI::BuildUnescapedURI}\label{wxuribuildunescapeduri}
123
124\constfunc{wxString}{BuildUnescapedURI}{\void}
125
126Builds the URI from its individual components, adds proper separators, and
127returns escape sequences to normal characters.
128
129Note that it is preferred to call this over Unescape(BuildURI()) since
130\helpref{BuildUnescapedURI}{wxuribuildunescapeduri} performs some optimizations over the plain method.
131
132
133\membersection{wxURI::Create}\label{wxuricreate}
134
135\func{const wxChar*}{Create}{\param{const wxString&}{uri}}
136
137Creates this URI from the string \arg{uri}.
138
139Returns the position at which parsing stopped (there
140is no such thing as an "invalid" wxURI).
141
142\docparam{uri}{string to initialize from}
143
144
145\membersection{wxURI::GetFragment}\label{wxurigetfragment}
146
147\constfunc{const wxString&}{GetFragment}{\void}
148
149Obtains the fragment of this URI.
150
151The fragment of a URI is the last value of the URI,
152and is the value after a '#' character after the path
153of the URI.
154
155\tt{http://mysite.com/mypath\#<fragment>}
156
157\membersection{wxURI::GetHostType}\label{wxurigethosttype}
158
159\constfunc{const HostType\&}{GetHostType}{\void}
160
161Obtains the host type of this URI, which is of type
162wxURI::HostType:
163
164\twocolwidtha{7cm}
165\begin{twocollist}\itemsep=0pt
166\twocolitem{{\bf wxURI\_REGNAME}}{Server is a host name, or the Server component itself is undefined.}
167\twocolitem{{\bf wxURI\_IPV4ADDRESS}}{Server is a IP version 4 address (XXX.XXX.XXX.XXX)}
168\twocolitem{{\bf wxURI\_IPV6ADDRESS}}{Server is a IP version 6 address ((XXX:)XXX::(XXX)XXX:XXX}
169\twocolitem{{\bf wxURI\_IPVFUTURE}}{Server is an IP address, but not versions 4 or 6}
170\end{twocollist}
171
172
173\membersection{wxURI::GetPassword}\label{wxurigetpassword}
174
175\constfunc{const wxString&}{GetPassword}{\void}
176
177Returns the password part of the userinfo component of
178this URI. Note that this is explicitly depreciated by
179RFC 1396 and should generally be avoided if possible.
180
181\tt{http://<user>:<password>@mysite.com/mypath}
182
183
184\membersection{wxURI::GetPath}\label{wxurigetpath}
185
186\constfunc{const wxString&}{GetPath}{\void}
187
188Returns the (normalized) path of the URI.
189
190The path component of a URI comes
191directly after the scheme component
192if followed by zero or one slashes ('/'),
193or after the server/port component.
194
195Absolute paths include the leading '/'
196character.
197
198\tt{http://mysite.com<path>}
199
200\membersection{wxURI::GetPort}\label{wxurigetport}
201
202\constfunc{const wxString&}{GetPort}{\void}
203
204Returns a string representation of the URI's port.
205
206The Port of a URI is a value after the server, and
207must come after a colon (:).
208
209\tt{http://mysite.com:<port>}
210
211Note that you can easily get the numeric value of the port
212by using wxAtoi or wxString::Format.
213
214\membersection{wxURI::GetQuery}\label{wxurigetquery}
215
216\constfunc{const wxString&}{GetQuery}{\void}
217
218Returns the Query component of the URI.
219
220The query component is what is commonly passed to a
221cgi application, and must come after the path component,
222and after a '?' character.
223
224\tt{http://mysite.com/mypath?<query>}
225
226
227\membersection{wxURI::GetScheme}\label{wxurigetscheme}
228
229\constfunc{const wxString&}{GetScheme}{\void}
230
231Returns the Scheme component of the URI.
232
233The first part of the uri.
234
235\tt{<scheme>://mysite.com}
236
237
238\membersection{wxURI::GetServer}\label{wxurigetserver}
239
240\constfunc{const wxString&}{GetServer}{\void}
241
242Returns the Server component of the URI.
243
244The server of the uri can be a server name or
245a type of ip address. See
246\helpref{GetHostType}{wxurigethosttype} for the
247possible values for the host type of the
248server component.
249
250\tt{http://<server>/mypath}
251
252
253\membersection{wxURI::GetUser}\label{wxurigetuser}
254
255\constfunc{const wxString&}{GetUser}{\void}
256
257Returns the username part of the userinfo component of
258this URI. Note that this is explicitly depreciated by
259RFC 1396 and should generally be avoided if possible.
260
261\tt{http://<user>:<password>@mysite.com/mypath}
262
263
264\membersection{wxURI::GetUserInfo}\label{wxurigetuserinfo}
265
266\constfunc{const wxString&}{GetUserInfo}{\void}
267
268Returns the UserInfo component of the URI.
269
270The component of a URI before the server component
271that is postfixed by a '@' character.
272
273\tt{http://<userinfo>@mysite.com/mypath}
274
275
276\membersection{wxURI::HasFragment}\label{wxurihasfragment}
277
278\constfunc{bool}{HasFragment}{\void}
279
280Returns \true if the Fragment component of the URI exists.
281
282
283\membersection{wxURI::HasPath}\label{wxurihaspath}
284
285\constfunc{bool}{HasPath}{\void}
286
287Returns \true if the Path component of the URI exists.
288
289
290\membersection{wxURI::HasPort}\label{wxurihasport}
291
292\constfunc{bool}{HasPort}{\void}
293
294Returns \true if the Port component of the URI exists.
295
296
297\membersection{wxURI::HasQuery}\label{wxurihasquery}
298
299\constfunc{bool}{HasQuery}{\void}
300
301Returns \true if the Query component of the URI exists.
302
303
304\membersection{wxURI::HasScheme}\label{wxurihasscheme}
305
306\constfunc{bool}{HasScheme}{\void}
307
308Returns \true if the Scheme component of the URI exists.
309
310
311\membersection{wxURI::HasServer}\label{wxurihasserver}
312
313\constfunc{bool}{HasServer}{\void}
314
315Returns \true if the Server component of the URI exists.
316
317
318\membersection{wxURI::HasUser}\label{wxurihasuserinfo}
319
320\constfunc{bool}{HasUser}{\void}
321
322Returns \true if the User component of the URI exists.
323
324
325\membersection{wxURI::IsReference}\label{wxuriisreference}
326
327\constfunc{bool}{IsReference}{\void}
328
329Returns \true if a valid [absolute] URI, otherwise this URI
330is a URI reference and not a full URI, and IsReference
331returns \false.
332
333
334\membersection{wxURI::operator ==}\label{wxurioperatorcompare}
335
336\func{void}{operator ==}{\param{const wxURI\& }{uricomp}}
337
338Compares this URI to another URI, and returns \true if
339this URI equals \arg{uricomp}, otherwise it returns \false.
340
341\docparam{uricomp}{URI to compare to}
342
343
344\membersection{wxURI::Resolve}\label{wxuriresolve}
345
346\func{void}{Resolve}{\param{const wxURI\& }{base}, \param{int }{flags = \texttt{wxURI\_STRICT}}}
347
348Inherits this URI from a base URI - components that do not
349exist in this URI are copied from the base, and if this URI's
350path is not an absolute path (prefixed by a '/'), then this URI's
351path is merged with the base's path.
352
353For instance, resolving "../mydir" from "http://mysite.com/john/doe"
354results in the scheme (http) and server (mysite.com) being copied into
355this URI, since they do not exist. In addition, since the path
356of this URI is not absolute (does not begin with '/'), the path
357of the base's is merged with this URI's path, resulting in the URI
358"http://mysite.com/john/mydir".
359
360\docparam{base}{Base URI to inherit from. Must be a full URI and not a reference}
361\docparam{flags}{Currently either \texttt{wxURI\_STRICT} or $0$, in non-strict
362mode some compatibility layers are enabled to allow loopholes from RFCs prior
363to 2396}
364
365\membersection{wxURI::Unescape}\label{wxuriunescape}
366
367\func{wxString}{Unescape}{\param{const wxString\& }{uri}}
368
369Translates all escape sequences (% hex hex) of \arg{uri} into
370normal characters and returns the result.
371
372This is the preferred over deprecated wxURL::ConvertFromURI.
373
374If you want to unescape an entire wxURI, use \helpref{BuildUnescapedURI}{wxuribuildunescapeduri} instead,
375as it performs some optimizations over this method.
376
377\docparam{uri}{string with escaped characters to convert}
378
379