]>
git.saurik.com Git - wxWidgets.git/blob - interface/url.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxURL
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 Error types returned from wxURL::GetError().
13 wxURL_NOERR
= 0, ///< No error.
14 wxURL_SNTXERR
, ///< Syntax error in the URL string.
15 wxURL_NOPROTO
, ///< Found no protocol which can get this URL.
16 wxURL_NOHOST
, ///< A host name is required for this protocol.
17 wxURL_NOPATH
, ///< A path is required for this protocol.
18 wxURL_CONNERR
, ///< Connection error.
19 wxURL_PROTOERR
///< An error occurred during negotiation.
26 wxURL is a specialization of wxURI for parsing URLs. Please look at wxURI
27 documentation for more info about the functions you can use to retrieve the
28 various parts of the URL (scheme, server, port, etc).
30 Supports standard assignment operators, copy constructors, and comparison
36 @see wxSocketBase, wxProtocol
38 class wxURL
: public wxURI
42 Constructs a URL object from the string. The URL must be valid
43 according to RFC 1738. In particular, file URLs must be of the format
44 @c "file://hostname/path/to/file", otherwise GetError() will return a
45 value different from ::wxURL_NOERR.
47 It is valid to leave out the hostname but slashes must remain in place,
48 in other words, a file URL without a hostname must contain three
49 consecutive slashes (e.g. @c "file:///somepath/myfile").
54 wxURL(const wxString
& url
= wxEmptyString
);
57 Destroys the URL object.
62 Returns the last error. This error refers to the URL parsing or to the
63 protocol. It can be one of ::wxURLError.
65 wxURLError
GetError() const;
68 Creates a new input stream on the specified URL. You can use all but
69 seek functionality of wxStream. Seek isn't available on all streams.
70 For example, HTTP or FTP streams don't deal with it.
72 Note that this method is somewhat deprecated, all future wxWidgets
73 applications should use wxFileSystem instead.
78 wxURL url("http://a.host/a.dir/a.file");
79 if (url.GetError() == wxURL_NOERR)
81 wxInputStream *in_stream;
83 in_stream = url.GetInputStream();
84 // Then, you can use all IO calls of in_stream (See wxStream)
88 @return Returns the initialized stream. You will have to delete it
93 wxInputStream
* GetInputStream();
96 Returns a reference to the protocol which will be used to get the URL.
98 wxProtocol
GetProtocol();
101 Returns @true if this object is correctly initialized, i.e. if
102 GetError() returns ::wxURL_NOERR.
107 Sets the default proxy server to use to get the URL. The string
108 specifies the proxy like this: @c "<hostname>:<port number>".
111 Specifies the proxy to use.
115 static void SetDefaultProxy(const wxString
& url_proxy
);
118 Sets the proxy to use for this URL.
120 @see SetDefaultProxy()
122 void SetProxy(const wxString
& url_proxy
);
125 Initializes this object with the given URL and returns ::wxURL_NOERR if
126 it's valid (see GetError() for more info).
128 wxURLError
SetURL(const wxString
& url
);