]>
Commit | Line | Data |
---|---|---|
e79848ac GL |
1 | \section{\class{wxURL}}\label{wxurl} |
2 | ||
7d90da2b RR |
3 | wxURL is a specialization of \helpref{wxURI}{wxuri} for parsing URLs. |
4 | Please look at \helpref{wxURI}{wxuri} documentation for more info about the functions | |
5 | you can use to retrieve the various parts of the URL (scheme, server, port, etc). | |
b60b2ec8 RN |
6 | |
7 | Supports standard assignment operators, copy constructors, | |
8 | and comparison operators. | |
9 | ||
e79848ac GL |
10 | \wxheading{Derived from} |
11 | ||
7d90da2b RR |
12 | \helpref{wxURI}{wxuri}\\ |
13 | \helpref{wxObject}{wxobject} | |
e79848ac | 14 | |
954b8ae6 JS |
15 | \wxheading{Include files} |
16 | ||
17 | <wx/url.h> | |
18 | ||
a7af285d VZ |
19 | \wxheading{Library} |
20 | ||
21 | \helpref{wxNet}{librarieslist} | |
22 | ||
e79848ac GL |
23 | \wxheading{See also} |
24 | ||
42ff6409 | 25 | \helpref{wxSocketBase}{wxsocketbase}, \helpref{wxProtocol}{wxprotocol} |
e79848ac GL |
26 | |
27 | % ---------------------------------------------------------------------------- | |
28 | % Members | |
29 | % ---------------------------------------------------------------------------- | |
296ec7d3 VZ |
30 | |
31 | \latexignore{\rtfignore{\wxheading{Members}}} | |
e79848ac | 32 | |
15d83f72 | 33 | \membersection{wxURL::wxURL}\label{wxurlctor} |
42ff6409 | 34 | |
7d90da2b | 35 | \func{}{wxURL}{\param{const wxString\&}{ url = wxEmptyString}} |
e79848ac | 36 | |
085c39b4 DE |
37 | Constructs a URL object from the string. The URL must be valid according |
38 | to RFC 1738. In particular, file URLs must be of the format | |
7d90da2b | 39 | {\tt file://hostname/path/to/file} otherwise \helpref{GetError}{wxurlgeterror} |
418ab1e7 | 40 | will return a value different from {\tt wxURL\_NOERR}. |
7d90da2b RR |
41 | |
42 | It is valid to leave out the hostname but slashes must remain in place - | |
43 | i.e. a file URL without a hostname must contain three consecutive slashes | |
44 | (e.g. {\tt file:///somepath/myfile}). | |
e79848ac GL |
45 | |
46 | \wxheading{Parameters} | |
47 | ||
48 | \docparam{url}{Url string to parse.} | |
49 | ||
15d83f72 | 50 | \membersection{wxURL::\destruct{wxURL}}\label{wxurldtor} |
42ff6409 | 51 | |
e79848ac GL |
52 | \func{}{\destruct{wxURL}}{\void} |
53 | ||
54 | Destroys the URL object. | |
55 | ||
e79848ac GL |
56 | % |
57 | % GetProtocol | |
58 | % | |
15d83f72 | 59 | \membersection{wxURL::GetProtocol}\label{wxurlgetprotocol} |
42ff6409 | 60 | |
e79848ac GL |
61 | \func{wxProtocol\&}{GetProtocol}{\void} |
62 | ||
63 | Returns a reference to the protocol which will be used to get the URL. | |
64 | ||
65 | % | |
66 | % GetError | |
67 | % | |
15d83f72 | 68 | \membersection{wxURL::GetError}\label{wxurlgeterror} |
42ff6409 | 69 | |
e79848ac GL |
70 | \constfunc{wxURLError}{GetError}{\void} |
71 | ||
72 | Returns the last error. This error refers to the URL parsing or to the protocol. | |
73 | It can be one of these errors: | |
74 | ||
75 | \twocolwidtha{7cm} | |
6be663cf | 76 | \begin{twocollist}\itemsep=0pt% |
e79848ac GL |
77 | \twocolitem{{\bf wxURL\_NOERR}}{No error.} |
78 | \twocolitem{{\bf wxURL\_SNTXERR}}{Syntax error in the URL string.} | |
79 | \twocolitem{{\bf wxURL\_NOPROTO}}{Found no protocol which can get this URL.} | |
fab86f26 | 80 | \twocolitem{{\bf wxURL\_NOHOST}}{A host name is required for this protocol.} |
e79848ac GL |
81 | \twocolitem{{\bf wxURL\_NOPATH}}{A path is required for this protocol.} |
82 | \twocolitem{{\bf wxURL\_CONNERR}}{Connection error.} | |
f6bcfd97 | 83 | \twocolitem{{\bf wxURL\_PROTOERR}}{An error occurred during negotiation.} |
e79848ac GL |
84 | \end{twocollist}% |
85 | ||
86 | % | |
87 | % GetInputStream | |
88 | % | |
15d83f72 | 89 | \membersection{wxURL::GetInputStream}\label{wxurlgetinputstream} |
42ff6409 | 90 | |
e79848ac GL |
91 | \func{wxInputStream *}{GetInputStream}{\void} |
92 | ||
43e8916f | 93 | Creates a new input stream on the specified URL. You can use all but seek |
154b6b0f VZ |
94 | functionality of wxStream. Seek isn't available on all streams. For example, |
95 | HTTP or FTP streams don't deal with it. | |
e79848ac | 96 | |
235fb242 | 97 | Note that this method is somewhat deprecated, all future wxWidgets applications |
ce321570 RN |
98 | should really use \helpref{wxFileSystem}{wxfilesystem} instead. |
99 | ||
100 | Example: | |
101 | ||
102 | \begin{verbatim} | |
103 | wxURL url("http://a.host/a.dir/a.file"); | |
104 | if (url.GetError() == wxURL_NOERR) | |
105 | { | |
106 | wxInputStream *in_stream; | |
107 | ||
108 | in_stream = url.GetInputStream(); | |
109 | // Then, you can use all IO calls of in_stream (See wxStream) | |
110 | } | |
111 | \end{verbatim} | |
112 | ||
42ff6409 | 113 | \wxheading{Return value} |
e79848ac | 114 | |
7d2946d2 | 115 | Returns the initialized stream. You will have to delete it yourself. |
e79848ac | 116 | |
42ff6409 | 117 | \wxheading{See also} |
e79848ac | 118 | |
b2cf617c | 119 | \helpref{wxInputStream}{wxinputstream} |
e79848ac | 120 | |
7d90da2b RR |
121 | |
122 | % | |
123 | % IsOk | |
124 | % | |
125 | \membersection{wxURL::IsOk}\label{wxurlgetisok} | |
126 | ||
127 | \constfunc{bool}{IsOk}{\void} | |
128 | ||
129 | Returns \true if this object is correctly initialized, i.e. if | |
418ab1e7 | 130 | \helpref{GetError}{wxurlgeterror} returns {\tt wxURL\_NOERR}. |
7d90da2b RR |
131 | |
132 | ||
e79848ac GL |
133 | % |
134 | % SetDefaultProxy | |
135 | % | |
42ff6409 JS |
136 | \membersection{wxURL::SetDefaultProxy}\label{wxurlsetdefaultproxy} |
137 | ||
e79848ac GL |
138 | \func{static void}{SetDefaultProxy}{\param{const wxString\&}{ url\_proxy}} |
139 | ||
140 | Sets the default proxy server to use to get the URL. The string specifies | |
141 | the proxy like this: <hostname>:<port number>. | |
142 | ||
143 | \wxheading{Parameters} | |
144 | ||
145 | \docparam{url\_proxy}{Specifies the proxy to use} | |
146 | ||
147 | \wxheading{See also} | |
148 | ||
149 | \helpref{wxURL::SetProxy}{wxurlsetproxy} | |
150 | ||
151 | % | |
152 | % SetProxy | |
153 | % | |
42ff6409 JS |
154 | \membersection{wxURL::SetProxy}\label{wxurlsetproxy} |
155 | ||
e79848ac GL |
156 | \func{void}{SetProxy}{\param{const wxString\&}{ url\_proxy}} |
157 | ||
158 | Sets the proxy to use for this URL. | |
159 | ||
160 | \wxheading{See also} | |
161 | ||
162 | \helpref{wxURL::SetDefaultProxy}{wxurlsetdefaultproxy} | |
42ff6409 | 163 | |
7d90da2b RR |
164 | |
165 | % | |
166 | % SetURL | |
167 | % | |
168 | \membersection{wxURL::SetURL}\label{wxurlseturl} | |
169 | ||
170 | \func{wxURLError}{SetURL}{\param{const wxString\&}{ url}} | |
171 | ||
418ab1e7 | 172 | Initializes this object with the given URL and returns {\tt wxURL\_NOERR} |
7d90da2b | 173 | if it's valid (see \helpref{GetError}{wxurlgeterror} for more info). |
b67a86d5 | 174 |