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