2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: url.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxURL
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxURL
|
|
|
|
@wxheader{url.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
wxURL is a specialization of wxURI for parsing URLs.
|
|
|
|
Please look at wxURI documentation for more info about the functions
|
|
|
|
you can use to retrieve the various parts of the URL (scheme, server, port,
|
|
|
|
etc).
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Supports standard assignment operators, copy constructors,
|
|
|
|
and comparison operators.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxnet}
|
|
|
|
@category{net}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxSocketBase, wxProtocol
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxURL : public wxURI
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
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
|
|
|
|
@c file://hostname/path/to/file otherwise GetError()
|
|
|
|
will return a value different from @c wxURL_NOERR.
|
2008-03-08 09:43:31 -05:00
|
|
|
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
|
2008-03-08 08:52:38 -05:00
|
|
|
(e.g. @c file:///somepath/myfile).
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param url
|
2008-03-09 08:33:59 -04:00
|
|
|
Url string to parse.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxURL(const wxString& url = wxEmptyString);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destroys the URL object.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
~wxURL();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the last error. This error refers to the URL parsing or to the protocol.
|
|
|
|
It can be one of these errors:
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@b wxURL_NOERR
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
No error.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@b wxURL_SNTXERR
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Syntax error in the URL string.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@b wxURL_NOPROTO
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Found no protocol which can get this URL.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@b wxURL_NOHOST
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A host name is required for this protocol.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@b wxURL_NOPATH
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A path is required for this protocol.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@b wxURL_CONNERR
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Connection error.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@b wxURL_PROTOERR
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
An error occurred during negotiation.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxURLError GetError() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
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 wxFileSystem instead.
|
|
|
|
Example:
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@returns Returns the initialized stream. You will have to delete it
|
2008-03-09 08:33:59 -04:00
|
|
|
yourself.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see wxInputStream
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxInputStream* GetInputStream();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a reference to the protocol which will be used to get the URL.
|
|
|
|
*/
|
|
|
|
wxProtocol GetProtocol();
|
|
|
|
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
Returns @true if this object is correctly initialized, i.e. if
|
2008-03-08 08:52:38 -05:00
|
|
|
GetError() returns @c wxURL_NOERR.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsOk() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the default proxy server to use to get the URL. The string specifies
|
|
|
|
the proxy like this: hostname:port number.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param url_proxy
|
2008-03-09 08:33:59 -04:00
|
|
|
Specifies the proxy to use
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetProxy()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
static void SetDefaultProxy(const wxString& url_proxy);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the proxy to use for this URL.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetDefaultProxy()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetProxy(const wxString& url_proxy);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Initializes this object with the given URL and returns @c wxURL_NOERR
|
|
|
|
if it's valid (see GetError() for more info).
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxURLError SetURL(const wxString& url);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|