2004-10-27 18:47:26 -04:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%% Name: uri.tex
|
|
|
|
%% Purpose: wxURI docs
|
|
|
|
%% Author: Ryan Norton <wxprojects@comcast.net>
|
|
|
|
%% Modified by:
|
|
|
|
%% Created: 7/7/2004
|
|
|
|
%% RCS-ID: $Id$
|
|
|
|
%% 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
|
2005-04-02 22:48:08 -05:00
|
|
|
\urlref{RFC 3986}{http://www.ietf.org/rfc/rfc3986.txt}.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
In short, a URL \em{is} a URI. In other
|
2004-10-27 19:30:59 -04:00
|
|
|
words, URL is a subset of a URI - all
|
2004-10-27 18:47:26 -04:00
|
|
|
acceptable URLs are also acceptable URIs.
|
|
|
|
|
2004-10-28 18:22:40 -04:00
|
|
|
wxURI automatically escapes invalid characters in a string,
|
|
|
|
so there is no chance of wxURI "failing" on construction/creation.
|
|
|
|
|
2004-10-27 18:47:26 -04:00
|
|
|
wxURI supports copy construction and standard assignment
|
|
|
|
operators. wxURI can also be inherited from to provide
|
|
|
|
furthur functionality.
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
2004-10-28 02:49:46 -04:00
|
|
|
\helpref{wxObject}{wxobject}
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
2006-05-16 07:53:35 -04:00
|
|
|
<wx/uri.h>
|
2004-10-27 18:47:26 -04:00
|
|
|
|
2007-07-28 08:21:03 -04:00
|
|
|
\wxheading{Library}
|
|
|
|
|
|
|
|
\helpref{wxBase}{librarieslist}
|
|
|
|
|
2006-09-17 06:59:18 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxURL}{wxurl}
|
|
|
|
|
2004-10-27 18:47:26 -04:00
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2004-10-28 10:20:10 -04:00
|
|
|
\membersection{Obtaining individual components}\label{obtainingwxuricomponents}
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
To obtain individual components you can use
|
2004-10-28 18:22:40 -04:00
|
|
|
one of the following methods
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
\helpref{GetScheme}{wxurigetscheme}\\
|
2005-02-28 15:01:44 -05:00
|
|
|
\helpref{GetUserInfo}{wxurigetuserinfo}\\
|
2004-10-27 18:47:26 -04:00
|
|
|
\helpref{GetServer}{wxurigetserver}\\
|
2006-09-17 06:59:18 -04:00
|
|
|
\helpref{GetPort}{wxurigetport}\\
|
2004-10-27 18:47:26 -04:00
|
|
|
\helpref{GetPath}{wxurigetpath}\\
|
|
|
|
\helpref{GetQuery}{wxurigetquery}\\
|
|
|
|
\helpref{GetFragment}{wxurigetfragment}
|
|
|
|
|
|
|
|
However, you should check HasXXX before
|
2004-10-28 18:22:40 -04:00
|
|
|
calling a get method, which determines whether or not the component referred
|
|
|
|
to by the method is defined according to RFC 2396.
|
|
|
|
|
2005-03-09 11:37:36 -05:00
|
|
|
Consider an undefined component equivalent to a
|
2004-10-28 18:22:40 -04:00
|
|
|
NULL C string.\\
|
|
|
|
\\
|
2004-10-27 18:47:26 -04:00
|
|
|
\helpref{HasScheme}{wxurihasscheme}\\
|
2005-02-28 15:01:44 -05:00
|
|
|
\helpref{HasUserInfo}{wxurihasuserinfo}\\
|
2004-10-27 18:47:26 -04:00
|
|
|
\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}
|
|
|
|
|
2006-02-08 22:09:36 -05:00
|
|
|
\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.
|
|
|
|
|
2004-10-27 18:47:26 -04:00
|
|
|
\membersection{wxURI::wxURI}\label{wxuriwxuri}
|
|
|
|
|
|
|
|
\func{}{wxURI}{\void}
|
|
|
|
|
2004-10-27 19:30:59 -04:00
|
|
|
Creates an empty URI.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
\func{}{wxURI}{\param{const wxChar* }{uri}}
|
|
|
|
|
2004-10-27 19:30:59 -04:00
|
|
|
Constructor for quick creation.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
\docparam{uri}{string to initialize with}
|
|
|
|
|
2004-10-27 19:30:59 -04:00
|
|
|
\func{}{wxURI}{\param{const wxURI\& }{uri}}
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
Copies this URI from another URI.
|
|
|
|
|
|
|
|
\docparam{uri}{URI (Uniform Resource Identifier) to initialize with}
|
|
|
|
|
|
|
|
|
2004-10-28 05:57:43 -04:00
|
|
|
\membersection{wxURI::BuildURI}\label{wxuribuilduri}
|
|
|
|
|
|
|
|
\constfunc{wxString}{BuildURI}{\void}
|
|
|
|
|
2005-05-31 05:20:43 -04:00
|
|
|
Builds the URI from its individual components and adds proper separators.
|
2004-10-28 05:57:43 -04:00
|
|
|
|
|
|
|
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}
|
|
|
|
|
2005-05-31 05:20:43 -04:00
|
|
|
Builds the URI from its individual components, adds proper separators, and
|
2004-10-28 05:57:43 -04:00
|
|
|
returns escape sequences to normal characters.
|
|
|
|
|
|
|
|
Note that it is preferred to call this over Unescape(BuildURI()) since
|
2004-12-23 15:33:04 -05:00
|
|
|
\helpref{BuildUnescapedURI}{wxuribuildunescapeduri} performs some optimizations over the plain method.
|
2004-10-28 05:57:43 -04:00
|
|
|
|
|
|
|
|
2004-10-27 18:47:26 -04:00
|
|
|
\membersection{wxURI::Create}\label{wxuricreate}
|
|
|
|
|
2005-03-09 11:37:36 -05:00
|
|
|
\func{const wxChar*}{Create}{\param{const wxString&}{uri}}
|
2004-10-27 18:47:26 -04:00
|
|
|
|
2004-10-27 21:05:20 -04:00
|
|
|
Creates this URI from the string \arg{uri}.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
2004-10-28 18:22:40 -04:00
|
|
|
Returns the position at which parsing stopped (there
|
|
|
|
is no such thing as an "invalid" wxURI).
|
|
|
|
|
2004-10-27 18:47:26 -04:00
|
|
|
\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}
|
|
|
|
|
2005-02-28 15:01:44 -05:00
|
|
|
|
|
|
|
\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}
|
|
|
|
|
|
|
|
|
2004-10-27 18:47:26 -04:00
|
|
|
\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}
|
|
|
|
|
2005-02-28 15:01:44 -05:00
|
|
|
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.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
The component of a URI before the server component
|
|
|
|
that is postfixed by a '@' character.
|
|
|
|
|
2005-02-28 15:01:44 -05:00
|
|
|
\tt{http://<userinfo>@mysite.com/mypath}
|
|
|
|
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
\membersection{wxURI::HasFragment}\label{wxurihasfragment}
|
|
|
|
|
|
|
|
\constfunc{bool}{HasFragment}{\void}
|
|
|
|
|
2004-10-27 21:05:20 -04:00
|
|
|
Returns \true if the Fragment component of the URI exists.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
2005-02-28 15:01:44 -05:00
|
|
|
|
2004-10-27 18:47:26 -04:00
|
|
|
\membersection{wxURI::HasPath}\label{wxurihaspath}
|
|
|
|
|
|
|
|
\constfunc{bool}{HasPath}{\void}
|
|
|
|
|
2004-10-27 21:05:20 -04:00
|
|
|
Returns \true if the Path component of the URI exists.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
2005-02-28 15:01:44 -05:00
|
|
|
|
2004-10-27 18:47:26 -04:00
|
|
|
\membersection{wxURI::HasPort}\label{wxurihasport}
|
|
|
|
|
|
|
|
\constfunc{bool}{HasPort}{\void}
|
|
|
|
|
2004-10-27 21:05:20 -04:00
|
|
|
Returns \true if the Port component of the URI exists.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxURI::HasQuery}\label{wxurihasquery}
|
|
|
|
|
|
|
|
\constfunc{bool}{HasQuery}{\void}
|
|
|
|
|
2004-10-27 21:05:20 -04:00
|
|
|
Returns \true if the Query component of the URI exists.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxURI::HasScheme}\label{wxurihasscheme}
|
|
|
|
|
|
|
|
\constfunc{bool}{HasScheme}{\void}
|
|
|
|
|
2004-10-27 21:05:20 -04:00
|
|
|
Returns \true if the Scheme component of the URI exists.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxURI::HasServer}\label{wxurihasserver}
|
|
|
|
|
|
|
|
\constfunc{bool}{HasServer}{\void}
|
|
|
|
|
2004-10-27 21:05:20 -04:00
|
|
|
Returns \true if the Server component of the URI exists.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
|
2005-03-01 20:05:21 -05:00
|
|
|
\membersection{wxURI::HasUser}\label{wxurihasuserinfo}
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
\constfunc{bool}{HasUser}{\void}
|
|
|
|
|
2004-10-27 21:05:20 -04:00
|
|
|
Returns \true if the User component of the URI exists.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxURI::IsReference}\label{wxuriisreference}
|
|
|
|
|
|
|
|
\constfunc{bool}{IsReference}{\void}
|
|
|
|
|
2004-10-27 21:05:20 -04:00
|
|
|
Returns \true if a valid [absolute] URI, otherwise this URI
|
2004-10-27 18:47:26 -04:00
|
|
|
is a URI reference and not a full URI, and IsReference
|
2004-10-27 21:05:20 -04:00
|
|
|
returns \false.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxURI::operator ==}\label{wxurioperatorcompare}
|
|
|
|
|
2004-10-27 19:30:59 -04:00
|
|
|
\func{void}{operator ==}{\param{const wxURI\& }{uricomp}}
|
2004-10-27 18:47:26 -04:00
|
|
|
|
2004-10-27 21:05:20 -04:00
|
|
|
Compares this URI to another URI, and returns \true if
|
|
|
|
this URI equals \arg{uricomp}, otherwise it returns \false.
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
\docparam{uricomp}{URI to compare to}
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxURI::Resolve}\label{wxuriresolve}
|
|
|
|
|
2004-10-27 21:03:38 -04:00
|
|
|
\func{void}{Resolve}{\param{const wxURI\& }{base}, \param{int }{flags = \texttt{wxURI\_STRICT}}}
|
2004-10-27 18:47:26 -04:00
|
|
|
|
|
|
|
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}
|
2006-05-28 19:56:51 -04:00
|
|
|
\docparam{flags}{Currently either \texttt{wxURI\_STRICT} or $0$, in non-strict
|
2005-02-16 14:25:35 -05:00
|
|
|
mode some compatibility layers are enabled to allow loopholes from RFCs prior
|
2004-10-27 21:03:38 -04:00
|
|
|
to 2396}
|
2004-10-27 18:47:26 -04:00
|
|
|
|
2004-10-28 05:57:43 -04:00
|
|
|
\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.
|
|
|
|
|
2004-12-23 15:33:04 -05:00
|
|
|
This is the preferred over deprecated wxURL::ConvertFromURI.
|
2004-10-28 05:57:43 -04:00
|
|
|
|
2004-12-23 15:33:04 -05:00
|
|
|
If you want to unescape an entire wxURI, use \helpref{BuildUnescapedURI}{wxuribuildunescapeduri} instead,
|
2004-10-28 05:57:43 -04:00
|
|
|
as it performs some optimizations over this method.
|
|
|
|
|
|
|
|
\docparam{uri}{string with escaped characters to convert}
|
|
|
|
|
|
|
|
|