]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: url.h | |
e54c96f1 | 3 | // Purpose: interface of wxURL |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxURL | |
11 | @wxheader{url.h} | |
7c913512 | 12 | |
23324ae1 FM |
13 | wxURL is a specialization of wxURI for parsing URLs. |
14 | Please look at wxURI documentation for more info about the functions | |
15 | you can use to retrieve the various parts of the URL (scheme, server, port, | |
16 | etc). | |
7c913512 | 17 | |
23324ae1 FM |
18 | Supports standard assignment operators, copy constructors, |
19 | and comparison operators. | |
7c913512 | 20 | |
23324ae1 FM |
21 | @library{wxnet} |
22 | @category{net} | |
7c913512 | 23 | |
e54c96f1 | 24 | @see wxSocketBase, wxProtocol |
23324ae1 FM |
25 | */ |
26 | class wxURL : public wxURI | |
27 | { | |
28 | public: | |
29 | /** | |
30 | Constructs a URL object from the string. The URL must be valid according | |
31 | to RFC 1738. In particular, file URLs must be of the format | |
32 | @c file://hostname/path/to/file otherwise GetError() | |
33 | will return a value different from @c wxURL_NOERR. | |
7c913512 FM |
34 | It is valid to leave out the hostname but slashes must remain in place - |
35 | i.e. a file URL without a hostname must contain three consecutive slashes | |
23324ae1 FM |
36 | (e.g. @c file:///somepath/myfile). |
37 | ||
7c913512 | 38 | @param url |
4cc4bfaf | 39 | Url string to parse. |
23324ae1 | 40 | */ |
4cc4bfaf | 41 | wxURL(const wxString& url = wxEmptyString); |
23324ae1 FM |
42 | |
43 | /** | |
44 | Destroys the URL object. | |
45 | */ | |
4cc4bfaf | 46 | ~wxURL(); |
23324ae1 FM |
47 | |
48 | /** | |
49 | Returns the last error. This error refers to the URL parsing or to the protocol. | |
50 | It can be one of these errors: | |
51 | ||
23324ae1 FM |
52 | @b wxURL_NOERR |
53 | ||
23324ae1 FM |
54 | No error. |
55 | ||
56 | @b wxURL_SNTXERR | |
57 | ||
23324ae1 FM |
58 | Syntax error in the URL string. |
59 | ||
60 | @b wxURL_NOPROTO | |
61 | ||
23324ae1 FM |
62 | Found no protocol which can get this URL. |
63 | ||
64 | @b wxURL_NOHOST | |
65 | ||
23324ae1 FM |
66 | A host name is required for this protocol. |
67 | ||
68 | @b wxURL_NOPATH | |
69 | ||
23324ae1 FM |
70 | A path is required for this protocol. |
71 | ||
72 | @b wxURL_CONNERR | |
73 | ||
23324ae1 FM |
74 | Connection error. |
75 | ||
76 | @b wxURL_PROTOERR | |
77 | ||
23324ae1 FM |
78 | An error occurred during negotiation. |
79 | */ | |
328f5751 | 80 | wxURLError GetError() const; |
23324ae1 FM |
81 | |
82 | /** | |
83 | Creates a new input stream on the specified URL. You can use all but seek | |
84 | functionality of wxStream. Seek isn't available on all streams. For example, | |
85 | HTTP or FTP streams don't deal with it. | |
23324ae1 FM |
86 | Note that this method is somewhat deprecated, all future wxWidgets applications |
87 | should really use wxFileSystem instead. | |
23324ae1 FM |
88 | Example: |
89 | ||
90 | @returns Returns the initialized stream. You will have to delete it | |
4cc4bfaf | 91 | yourself. |
23324ae1 | 92 | |
4cc4bfaf | 93 | @see wxInputStream |
23324ae1 | 94 | */ |
4cc4bfaf | 95 | wxInputStream* GetInputStream(); |
23324ae1 FM |
96 | |
97 | /** | |
98 | Returns a reference to the protocol which will be used to get the URL. | |
99 | */ | |
100 | wxProtocol GetProtocol(); | |
101 | ||
102 | /** | |
7c913512 | 103 | Returns @true if this object is correctly initialized, i.e. if |
23324ae1 FM |
104 | GetError() returns @c wxURL_NOERR. |
105 | */ | |
328f5751 | 106 | bool IsOk() const; |
23324ae1 FM |
107 | |
108 | /** | |
109 | Sets the default proxy server to use to get the URL. The string specifies | |
110 | the proxy like this: hostname:port number. | |
111 | ||
7c913512 | 112 | @param url_proxy |
4cc4bfaf | 113 | Specifies the proxy to use |
23324ae1 | 114 | |
4cc4bfaf | 115 | @see SetProxy() |
23324ae1 FM |
116 | */ |
117 | static void SetDefaultProxy(const wxString& url_proxy); | |
118 | ||
119 | /** | |
120 | Sets the proxy to use for this URL. | |
121 | ||
4cc4bfaf | 122 | @see SetDefaultProxy() |
23324ae1 FM |
123 | */ |
124 | void SetProxy(const wxString& url_proxy); | |
125 | ||
126 | /** | |
127 | Initializes this object with the given URL and returns @c wxURL_NOERR | |
128 | if it's valid (see GetError() for more info). | |
129 | */ | |
4cc4bfaf | 130 | wxURLError SetURL(const wxString& url); |
23324ae1 | 131 | }; |
e54c96f1 | 132 |