]>
Commit | Line | Data |
---|---|---|
1 | \section{\class{wxURL}}\label{wxurl} | |
2 | ||
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). | |
6 | ||
7 | Supports standard assignment operators, copy constructors, | |
8 | and comparison operators. | |
9 | ||
10 | \wxheading{Derived from} | |
11 | ||
12 | \helpref{wxURI}{wxuri}\\ | |
13 | \helpref{wxObject}{wxobject} | |
14 | ||
15 | \wxheading{Include files} | |
16 | ||
17 | <wx/url.h> | |
18 | ||
19 | \wxheading{Library} | |
20 | ||
21 | \helpref{wxNet}{librarieslist} | |
22 | ||
23 | \wxheading{See also} | |
24 | ||
25 | \helpref{wxSocketBase}{wxsocketbase}, \helpref{wxProtocol}{wxprotocol} | |
26 | ||
27 | % ---------------------------------------------------------------------------- | |
28 | % Members | |
29 | % ---------------------------------------------------------------------------- | |
30 | ||
31 | \latexignore{\rtfignore{\wxheading{Members}}} | |
32 | ||
33 | \membersection{wxURL::wxURL}\label{wxurlctor} | |
34 | ||
35 | \func{}{wxURL}{\param{const wxString\&}{ url = wxEmptyString}} | |
36 | ||
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 | |
39 | {\tt file://hostname/path/to/file} otherwise \helpref{GetError}{wxurlgeterror} | |
40 | will return a value different from {\tt wxURL\_NOERR}. | |
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}). | |
45 | ||
46 | \wxheading{Parameters} | |
47 | ||
48 | \docparam{url}{Url string to parse.} | |
49 | ||
50 | \membersection{wxURL::\destruct{wxURL}}\label{wxurldtor} | |
51 | ||
52 | \func{}{\destruct{wxURL}}{\void} | |
53 | ||
54 | Destroys the URL object. | |
55 | ||
56 | % | |
57 | % GetProtocol | |
58 | % | |
59 | \membersection{wxURL::GetProtocol}\label{wxurlgetprotocol} | |
60 | ||
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 | % | |
68 | \membersection{wxURL::GetError}\label{wxurlgeterror} | |
69 | ||
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} | |
76 | \begin{twocollist}\itemsep=0pt% | |
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.} | |
80 | \twocolitem{{\bf wxURL\_NOHOST}}{A host name is required for this protocol.} | |
81 | \twocolitem{{\bf wxURL\_NOPATH}}{A path is required for this protocol.} | |
82 | \twocolitem{{\bf wxURL\_CONNERR}}{Connection error.} | |
83 | \twocolitem{{\bf wxURL\_PROTOERR}}{An error occurred during negotiation.} | |
84 | \end{twocollist}% | |
85 | ||
86 | % | |
87 | % GetInputStream | |
88 | % | |
89 | \membersection{wxURL::GetInputStream}\label{wxurlgetinputstream} | |
90 | ||
91 | \func{wxInputStream *}{GetInputStream}{\void} | |
92 | ||
93 | Creates a new input stream on the specified URL. You can use all but seek | |
94 | functionality of wxStream. Seek isn't available on all streams. For example, | |
95 | HTTP or FTP streams don't deal with it. | |
96 | ||
97 | Note that this method is somewhat deprecated, all future wxWidgets applications | |
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 | ||
113 | \wxheading{Return value} | |
114 | ||
115 | Returns the initialized stream. You will have to delete it yourself. | |
116 | ||
117 | \wxheading{See also} | |
118 | ||
119 | \helpref{wxInputStream}{wxinputstream} | |
120 | ||
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 | |
130 | \helpref{GetError}{wxurlgeterror} returns {\tt wxURL\_NOERR}. | |
131 | ||
132 | ||
133 | % | |
134 | % SetDefaultProxy | |
135 | % | |
136 | \membersection{wxURL::SetDefaultProxy}\label{wxurlsetdefaultproxy} | |
137 | ||
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 | % | |
154 | \membersection{wxURL::SetProxy}\label{wxurlsetproxy} | |
155 | ||
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} | |
163 | ||
164 | ||
165 | % | |
166 | % SetURL | |
167 | % | |
168 | \membersection{wxURL::SetURL}\label{wxurlseturl} | |
169 | ||
170 | \func{wxURLError}{SetURL}{\param{const wxString\&}{ url}} | |
171 | ||
172 | Initializes this object with the given URL and returns {\tt wxURL\_NOERR} | |
173 | if it's valid (see \helpref{GetError}{wxurlgeterror} for more info). | |
174 |