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
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name: uri.tex
%% Purpose: wxURI docs
%% Author: Ryan Norton <wxprojects@comcast.net>
%% Modified by:
%% Created: 7/7/2004
%% RCS-ID: $Id: uri.tex 41263 2006-09-17 10:59:18Z RR $
%% Copyright: (c) Ryan Norton
%% License: wxWindows license
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{\class{wxURI}}\label{wxuri}
wxURI is used to extract information from
a URI (Uniform Resource Identifier).
For information about URIs, see
\urlref{RFC 3986}{http://www.ietf.org/rfc/rfc3986.txt}.
In short, a URL \em{is} a URI. In other
words, URL is a subset of a URI - all
acceptable URLs are also acceptable URIs.
wxURI automatically escapes invalid characters in a string,
so there is no chance of wxURI "failing" on construction/creation.
wxURI supports copy construction and standard assignment
operators. wxURI can also be inherited from to provide
furthur functionality.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/uri.h>
\wxheading{See also}
\helpref{wxURL}{wxurl}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{Obtaining individual components}\label{obtainingwxuricomponents}
To obtain individual components you can use
one of the following methods
\helpref{GetScheme}{wxurigetscheme}\\
\helpref{GetUserInfo}{wxurigetuserinfo}\\
\helpref{GetServer}{wxurigetserver}\\
\helpref{GetPort}{wxurigetport}\\
\helpref{GetPath}{wxurigetpath}\\
\helpref{GetQuery}{wxurigetquery}\\
\helpref{GetFragment}{wxurigetfragment}
However, you should check HasXXX before
calling a get method, which determines whether or not the component referred
to by the method is defined according to RFC 2396.
Consider an undefined component equivalent to a
NULL C string.\\
\\
\helpref{HasScheme}{wxurihasscheme}\\
\helpref{HasUserInfo}{wxurihasuserinfo}\\
\helpref{HasServer}{wxurihasserver}\\
\helpref{HasPort}{wxurihasserver}\\
\helpref{HasPath}{wxurihaspath}\\
\helpref{HasQuery}{wxurihasquery}\\
\helpref{HasFragment}{wxurihasfragment}
Example:
\begin{verbatim}
//protocol will hold the http protocol (i.e. "http")
wxString protocol;
wxURI myuri(wxT("http://mysite.com"));
if(myuri.HasScheme())
protocol = myuri.GetScheme();
\end{verbatim}
\membersection{Deviations from the RFC}\label{deviationsfromrfc}
Note that on URIs with a "file" scheme wxURI does not
parse the userinfo, server, or port portion. This is to keep
compatability with wxFileSystem, the old wxURL, and older url specifications.
\membersection{wxURI::wxURI}\label{wxuriwxuri}
\func{}{wxURI}{\void}
Creates an empty URI.
\func{}{wxURI}{\param{const wxChar* }{uri}}
Constructor for quick creation.
\docparam{uri}{string to initialize with}
\func{}{wxURI}{\param{const wxURI\& }{uri}}
Copies this URI from another URI.
\docparam{uri}{URI (Uniform Resource Identifier) to initialize with}
\membersection{wxURI::BuildURI}\label{wxuribuilduri}
\constfunc{wxString}{BuildURI}{\void}
Builds the URI from its individual components and adds proper separators.
If the URI is not a reference or is not resolved,
the URI that is returned from Get is the same one
passed to Create.
\membersection{wxURI::BuildUnescapedURI}\label{wxuribuildunescapeduri}
\constfunc{wxString}{BuildUnescapedURI}{\void}
Builds the URI from its individual components, adds proper separators, and
returns escape sequences to normal characters.
Note that it is preferred to call this over Unescape(BuildURI()) since
\helpref{BuildUnescapedURI}{wxuribuildunescapeduri} performs some optimizations over the plain method.
\membersection{wxURI::Create}\label{wxuricreate}
\func{const wxChar*}{Create}{\param{const wxString&}{uri}}
Creates this URI from the string \arg{uri}.
Returns the position at which parsing stopped (there
is no such thing as an "invalid" wxURI).
\docparam{uri}{string to initialize from}
\membersection{wxURI::GetFragment}\label{wxurigetfragment}
\constfunc{const wxString&}{GetFragment}{\void}
Obtains the fragment of this URI.
The fragment of a URI is the last value of the URI,
and is the value after a '#' character after the path
of the URI.
\tt{http://mysite.com/mypath\#<fragment>}
\membersection{wxURI::GetHostType}\label{wxurigethosttype}
\constfunc{const HostType\&}{GetHostType}{\void}
Obtains the host type of this URI, which is of type
wxURI::HostType:
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxURI\_REGNAME}}{Server is a host name, or the Server component itself is undefined.}
\twocolitem{{\bf wxURI\_IPV4ADDRESS}}{Server is a IP version 4 address (XXX.XXX.XXX.XXX)}
\twocolitem{{\bf wxURI\_IPV6ADDRESS}}{Server is a IP version 6 address ((XXX:)XXX::(XXX)XXX:XXX}
\twocolitem{{\bf wxURI\_IPVFUTURE}}{Server is an IP address, but not versions 4 or 6}
\end{twocollist}
\membersection{wxURI::GetPassword}\label{wxurigetpassword}
\constfunc{const wxString&}{GetPassword}{\void}
Returns the password part of the userinfo component of
this URI. Note that this is explicitly depreciated by
RFC 1396 and should generally be avoided if possible.
\tt{http://<user>:<password>@mysite.com/mypath}
\membersection{wxURI::GetPath}\label{wxurigetpath}
\constfunc{const wxString&}{GetPath}{\void}
Returns the (normalized) path of the URI.
The path component of a URI comes
directly after the scheme component
if followed by zero or one slashes ('/'),
or after the server/port component.
Absolute paths include the leading '/'
character.
\tt{http://mysite.com<path>}
\membersection{wxURI::GetPort}\label{wxurigetport}
\constfunc{const wxString&}{GetPort}{\void}
Returns a string representation of the URI's port.
The Port of a URI is a value after the server, and
must come after a colon (:).
\tt{http://mysite.com:<port>}
Note that you can easily get the numeric value of the port
by using wxAtoi or wxString::Format.
\membersection{wxURI::GetQuery}\label{wxurigetquery}
\constfunc{const wxString&}{GetQuery}{\void}
Returns the Query component of the URI.
The query component is what is commonly passed to a
cgi application, and must come after the path component,
and after a '?' character.
\tt{http://mysite.com/mypath?<query>}
\membersection{wxURI::GetScheme}\label{wxurigetscheme}
\constfunc{const wxString&}{GetScheme}{\void}
Returns the Scheme component of the URI.
The first part of the uri.
\tt{<scheme>://mysite.com}
\membersection{wxURI::GetServer}\label{wxurigetserver}
\constfunc{const wxString&}{GetServer}{\void}
Returns the Server component of the URI.
The server of the uri can be a server name or
a type of ip address. See
\helpref{GetHostType}{wxurigethosttype} for the
possible values for the host type of the
server component.
\tt{http://<server>/mypath}
\membersection{wxURI::GetUser}\label{wxurigetuser}
\constfunc{const wxString&}{GetUser}{\void}
Returns the username part of the userinfo component of
this URI. Note that this is explicitly depreciated by
RFC 1396 and should generally be avoided if possible.
\tt{http://<user>:<password>@mysite.com/mypath}
\membersection{wxURI::GetUserInfo}\label{wxurigetuserinfo}
\constfunc{const wxString&}{GetUserInfo}{\void}
Returns the UserInfo component of the URI.
The component of a URI before the server component
that is postfixed by a '@' character.
\tt{http://<userinfo>@mysite.com/mypath}
\membersection{wxURI::HasFragment}\label{wxurihasfragment}
\constfunc{bool}{HasFragment}{\void}
Returns \true if the Fragment component of the URI exists.
\membersection{wxURI::HasPath}\label{wxurihaspath}
\constfunc{bool}{HasPath}{\void}
Returns \true if the Path component of the URI exists.
\membersection{wxURI::HasPort}\label{wxurihasport}
\constfunc{bool}{HasPort}{\void}
Returns \true if the Port component of the URI exists.
\membersection{wxURI::HasQuery}\label{wxurihasquery}
\constfunc{bool}{HasQuery}{\void}
Returns \true if the Query component of the URI exists.
\membersection{wxURI::HasScheme}\label{wxurihasscheme}
\constfunc{bool}{HasScheme}{\void}
Returns \true if the Scheme component of the URI exists.
\membersection{wxURI::HasServer}\label{wxurihasserver}
\constfunc{bool}{HasServer}{\void}
Returns \true if the Server component of the URI exists.
\membersection{wxURI::HasUser}\label{wxurihasuserinfo}
\constfunc{bool}{HasUser}{\void}
Returns \true if the User component of the URI exists.
\membersection{wxURI::IsReference}\label{wxuriisreference}
\constfunc{bool}{IsReference}{\void}
Returns \true if a valid [absolute] URI, otherwise this URI
is a URI reference and not a full URI, and IsReference
returns \false.
\membersection{wxURI::operator ==}\label{wxurioperatorcompare}
\func{void}{operator ==}{\param{const wxURI\& }{uricomp}}
Compares this URI to another URI, and returns \true if
this URI equals \arg{uricomp}, otherwise it returns \false.
\docparam{uricomp}{URI to compare to}
\membersection{wxURI::Resolve}\label{wxuriresolve}
\func{void}{Resolve}{\param{const wxURI\& }{base}, \param{int }{flags = \texttt{wxURI\_STRICT}}}
Inherits this URI from a base URI - components that do not
exist in this URI are copied from the base, and if this URI's
path is not an absolute path (prefixed by a '/'), then this URI's
path is merged with the base's path.
For instance, resolving "../mydir" from "http://mysite.com/john/doe"
results in the scheme (http) and server (mysite.com) being copied into
this URI, since they do not exist. In addition, since the path
of this URI is not absolute (does not begin with '/'), the path
of the base's is merged with this URI's path, resulting in the URI
"http://mysite.com/john/mydir".
\docparam{base}{Base URI to inherit from. Must be a full URI and not a reference}
\docparam{flags}{Currently either \texttt{wxURI\_STRICT} or $0$, in non-strict
mode some compatibility layers are enabled to allow loopholes from RFCs prior
to 2396}
\membersection{wxURI::Unescape}\label{wxuriunescape}
\func{wxString}{Unescape}{\param{const wxString\& }{uri}}
Translates all escape sequences (% hex hex) of \arg{uri} into
normal characters and returns the result.
This is the preferred over deprecated wxURL::ConvertFromURI.
If you want to unescape an entire wxURI, use \helpref{BuildUnescapedURI}{wxuribuildunescapeduri} instead,
as it performs some optimizations over this method.
\docparam{uri}{string with escaped characters to convert}
|