wxWidgets/docs/latex/wx/url.tex

175 lines
4.5 KiB
TeX

\section{\class{wxURL}}\label{wxurl}
wxURL is a specialization of \helpref{wxURI}{wxuri} for parsing URLs.
Please look at \helpref{wxURI}{wxuri} documentation for more info about the functions
you can use to retrieve the various parts of the URL (scheme, server, port, etc).
Supports standard assignment operators, copy constructors,
and comparison operators.
\wxheading{Derived from}
\helpref{wxURI}{wxuri}\\
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/url.h>
\wxheading{Library}
\helpref{wxNet}{librarieslist}
\wxheading{See also}
\helpref{wxSocketBase}{wxsocketbase}, \helpref{wxProtocol}{wxprotocol}
% ----------------------------------------------------------------------------
% Members
% ----------------------------------------------------------------------------
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxURL::wxURL}\label{wxurlctor}
\func{}{wxURL}{\param{const wxString\&}{ url = wxEmptyString}}
Constructs a URL object from the string. The URL must be valid according
to RFC 1738. In particular, file URLs must be of the format
{\tt file://hostname/path/to/file} otherwise \helpref{GetError}{wxurlgeterror}
will return a value different from {\tt wxURL\_NOERR}.
It is valid to leave out the hostname but slashes must remain in place -
i.e. a file URL without a hostname must contain three consecutive slashes
(e.g. {\tt file:///somepath/myfile}).
\wxheading{Parameters}
\docparam{url}{Url string to parse.}
\membersection{wxURL::\destruct{wxURL}}\label{wxurldtor}
\func{}{\destruct{wxURL}}{\void}
Destroys the URL object.
%
% GetProtocol
%
\membersection{wxURL::GetProtocol}\label{wxurlgetprotocol}
\func{wxProtocol\&}{GetProtocol}{\void}
Returns a reference to the protocol which will be used to get the URL.
%
% GetError
%
\membersection{wxURL::GetError}\label{wxurlgeterror}
\constfunc{wxURLError}{GetError}{\void}
Returns the last error. This error refers to the URL parsing or to the protocol.
It can be one of these errors:
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt%
\twocolitem{{\bf wxURL\_NOERR}}{No error.}
\twocolitem{{\bf wxURL\_SNTXERR}}{Syntax error in the URL string.}
\twocolitem{{\bf wxURL\_NOPROTO}}{Found no protocol which can get this URL.}
\twocolitem{{\bf wxURL\_NOHOST}}{A host name is required for this protocol.}
\twocolitem{{\bf wxURL\_NOPATH}}{A path is required for this protocol.}
\twocolitem{{\bf wxURL\_CONNERR}}{Connection error.}
\twocolitem{{\bf wxURL\_PROTOERR}}{An error occurred during negotiation.}
\end{twocollist}%
%
% GetInputStream
%
\membersection{wxURL::GetInputStream}\label{wxurlgetinputstream}
\func{wxInputStream *}{GetInputStream}{\void}
Creates a new input stream on the specified URL. You can use all but seek
functionality of wxStream. Seek isn't available on all streams. For example,
HTTP or FTP streams don't deal with it.
Note that this method is somewhat deprecated, all future wxWidgets applications
should really use \helpref{wxFileSystem}{wxfilesystem} instead.
Example:
\begin{verbatim}
wxURL url("http://a.host/a.dir/a.file");
if (url.GetError() == wxURL_NOERR)
{
wxInputStream *in_stream;
in_stream = url.GetInputStream();
// Then, you can use all IO calls of in_stream (See wxStream)
}
\end{verbatim}
\wxheading{Return value}
Returns the initialized stream. You will have to delete it yourself.
\wxheading{See also}
\helpref{wxInputStream}{wxinputstream}
%
% IsOk
%
\membersection{wxURL::IsOk}\label{wxurlgetisok}
\constfunc{bool}{IsOk}{\void}
Returns \true if this object is correctly initialized, i.e. if
\helpref{GetError}{wxurlgeterror} returns {\tt wxURL\_NOERR}.
%
% SetDefaultProxy
%
\membersection{wxURL::SetDefaultProxy}\label{wxurlsetdefaultproxy}
\func{static void}{SetDefaultProxy}{\param{const wxString\&}{ url\_proxy}}
Sets the default proxy server to use to get the URL. The string specifies
the proxy like this: <hostname>:<port number>.
\wxheading{Parameters}
\docparam{url\_proxy}{Specifies the proxy to use}
\wxheading{See also}
\helpref{wxURL::SetProxy}{wxurlsetproxy}
%
% SetProxy
%
\membersection{wxURL::SetProxy}\label{wxurlsetproxy}
\func{void}{SetProxy}{\param{const wxString\&}{ url\_proxy}}
Sets the proxy to use for this URL.
\wxheading{See also}
\helpref{wxURL::SetDefaultProxy}{wxurlsetdefaultproxy}
%
% SetURL
%
\membersection{wxURL::SetURL}\label{wxurlseturl}
\func{wxURLError}{SetURL}{\param{const wxString\&}{ url}}
Initializes this object with the given URL and returns {\tt wxURL\_NOERR}
if it's valid (see \helpref{GetError}{wxurlgeterror} for more info).