]>
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{See also} | |
20 | ||
21 | \helpref{wxSocketBase}{wxsocketbase}, \helpref{wxProtocol}{wxprotocol} | |
22 | ||
23 | % ---------------------------------------------------------------------------- | |
24 | % Members | |
25 | % ---------------------------------------------------------------------------- | |
26 | ||
27 | \latexignore{\rtfignore{\wxheading{Members}}} | |
28 | ||
29 | \membersection{wxURL::wxURL}\label{wxurlctor} | |
30 | ||
31 | \func{}{wxURL}{\param{const wxString\&}{ url = wxEmptyString}} | |
32 | ||
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 | |
35 | {\tt file://hostname/path/to/file} otherwise \helpref{GetError}{wxurlgeterror} | |
36 | will return a value different from {\tt wxURL\_NOERR}. | |
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}). | |
41 | ||
42 | \wxheading{Parameters} | |
43 | ||
44 | \docparam{url}{Url string to parse.} | |
45 | ||
46 | \membersection{wxURL::\destruct{wxURL}}\label{wxurldtor} | |
47 | ||
48 | \func{}{\destruct{wxURL}}{\void} | |
49 | ||
50 | Destroys the URL object. | |
51 | ||
52 | % | |
53 | % GetProtocol | |
54 | % | |
55 | \membersection{wxURL::GetProtocol}\label{wxurlgetprotocol} | |
56 | ||
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 | % | |
64 | \membersection{wxURL::GetError}\label{wxurlgeterror} | |
65 | ||
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} | |
72 | \begin{twocollist}\itemsep=0pt% | |
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.} | |
76 | \twocolitem{{\bf wxURL\_NOHOST}}{An host name is required for this protocol.} | |
77 | \twocolitem{{\bf wxURL\_NOPATH}}{A path is required for this protocol.} | |
78 | \twocolitem{{\bf wxURL\_CONNERR}}{Connection error.} | |
79 | \twocolitem{{\bf wxURL\_PROTOERR}}{An error occurred during negotiation.} | |
80 | \end{twocollist}% | |
81 | ||
82 | % | |
83 | % GetInputStream | |
84 | % | |
85 | \membersection{wxURL::GetInputStream}\label{wxurlgetinputstream} | |
86 | ||
87 | \func{wxInputStream *}{GetInputStream}{\void} | |
88 | ||
89 | Creates a new input stream on the specified URL. You can use all but seek | |
90 | functionality of wxStream. Seek isn't available on all streams. For example, | |
91 | HTTP or FTP streams don't deal with it. | |
92 | ||
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 | ||
109 | \wxheading{Return value} | |
110 | ||
111 | Returns the initialized stream. You will have to delete it yourself. | |
112 | ||
113 | \wxheading{See also} | |
114 | ||
115 | \helpref{wxInputStream}{wxinputstream} | |
116 | ||
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 | |
126 | \helpref{GetError}{wxurlgeterror} returns {\tt wxURL\_NOERR}. | |
127 | ||
128 | ||
129 | % | |
130 | % SetDefaultProxy | |
131 | % | |
132 | \membersection{wxURL::SetDefaultProxy}\label{wxurlsetdefaultproxy} | |
133 | ||
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 | % | |
150 | \membersection{wxURL::SetProxy}\label{wxurlsetproxy} | |
151 | ||
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} | |
159 | ||
160 | ||
161 | % | |
162 | % SetURL | |
163 | % | |
164 | \membersection{wxURL::SetURL}\label{wxurlseturl} | |
165 | ||
166 | \func{wxURLError}{SetURL}{\param{const wxString\&}{ url}} | |
167 | ||
168 | Initializes this object with the given URL and returns {\tt wxURL\_NOERR} | |
169 | if it's valid (see \helpref{GetError}{wxurlgeterror} for more info). |