Contents Up Previous Next

wxURL

Derived from

wxObject

Include files

<wx/url.h>

See also

wxSocketBase, wxProtocol

Example

  wxURL url("http://a.host/a.dir/a.file");
  wxInputStream *in_stream;

  in_stream = url.GetInputStream();
  // Then, you can use all IO calls of in_stream (See wxStream)
Members

wxURL::wxURL
wxURL::~wxURL
wxURL::GetProtocolName
wxURL::GetProtocol
wxURL::GetPath
wxURL::GetError
wxURL::GetInputStream
wxURL::SetDefaultProxy
wxURL::SetProxy
wxURL::ConvertToValidURI


wxURL::wxURL

wxURL(const wxString& url)

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 'file://hostname/path/to/file'. 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.

Parameters

url


wxURL::~wxURL

~wxURL()

Destroys the URL object.


wxURL::GetProtocolName

wxString GetProtocolName() const

Returns the name of the protocol which will be used to get the URL.


wxURL::GetProtocol

wxProtocol& GetProtocol()

Returns a reference to the protocol which will be used to get the URL.


wxURL::GetPath

wxString GetPath()

Returns the path of the file to fetch. This path was encoded in the URL.


wxURL::GetError

wxURLError GetError() const

Returns the last error. This error refers to the URL parsing or to the protocol. It can be one of these errors:

wxURL_NOERR No error.
wxURL_SNTXERR Syntax error in the URL string.
wxURL_NOPROTO Found no protocol which can get this URL.
wxURL_NOHOST An host name is required for this protocol.
wxURL_NOPATH A path is required for this protocol.
wxURL_CONNERR Connection error.
wxURL_PROTOERR An error occurred during negotiation.


wxURL::GetInputStream

wxInputStream * GetInputStream()

Creates a new input stream on the the specified URL. You can use all but seek functionality of wxStream. Seek isn't available on all stream. For example, http or ftp streams doesn't deal with it.

Return value

Returns the initialized stream. You will have to delete it yourself.

See also

wxInputStream


wxURL::SetDefaultProxy

static void SetDefaultProxy(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>.

Parameters

url_proxy

See also

wxURL::SetProxy


wxURL::SetProxy

void SetProxy(const wxString& url_proxy)

Sets the proxy to use for this URL.

See also

wxURL::SetDefaultProxy


wxURL::ConvertToValidURI

static wxString ConvertToValidURI(const wxString& uri)

It converts a non-standardized URI to a valid network URI. It encodes non standard characters.