]>
git.saurik.com Git - wxWidgets.git/blob - interface/uri.h
eb502fe316d712c5b2a1c77ac4b59fb8c4dda4c2
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxURI class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 wxURI is used to extract information from
14 a URI (Uniform Resource Identifier).
16 For information about URIs, see
19 In short, a URL is a URI. In other
20 words, URL is a subset of a URI - all
21 acceptable URLs are also acceptable URIs.
23 wxURI automatically escapes invalid characters in a string,
24 so there is no chance of wxURI "failing" on construction/creation.
26 wxURI supports copy construction and standard assignment
27 operators. wxURI can also be inherited from to provide
28 furthur functionality.
36 class wxURI
: public wxObject
41 Copies this URI from another URI.
44 URI (Uniform Resource Identifier) to initialize with
47 wxURI(const wxChar
* uri
);
48 wxURI(const wxURI
& uri
);
52 Builds the URI from its individual components and adds proper separators.
54 If the URI is not a reference or is not resolved,
55 the URI that is returned from Get is the same one
61 Builds the URI from its individual components, adds proper separators, and
62 returns escape sequences to normal characters.
64 Note that it is preferred to call this over Unescape(BuildURI()) since
65 BuildUnescapedURI() performs some optimizations over the plain method.
67 wxString
BuildUnescapedURI();
70 Creates this URI from the string
74 Returns the position at which parsing stopped (there
75 is no such thing as an "invalid" wxURI).
78 string to initialize from
80 const wxChar
* Create(const wxString uri
);
83 Note that on URIs with a "file" scheme wxURI does not
84 parse the userinfo, server, or port portion. This is to keep
85 compatability with wxFileSystem, the old wxURL, and older url specifications.
90 Obtains the fragment of this URI.
92 The fragment of a URI is the last value of the URI,
93 and is the value after a '' character after the path
96 @c http://mysite.com/mypath#fragment
98 const wxString
GetFragment();
101 Obtains the host type of this URI, which is of type
108 Server is a host name, or the Server component itself is undefined.
113 Server is a IP version 4 address (XXX.XXX.XXX.XXX)
118 Server is a IP version 6 address ((XXX:)XXX::(XXX)XXX:XXX
123 Server is an IP address, but not versions 4 or 6
125 const HostType
GetHostType();
128 Returns the password part of the userinfo component of
129 this URI. Note that this is explicitly depreciated by
130 RFC 1396 and should generally be avoided if possible.
132 @c http://user:password@mysite.com/mypath
134 const wxString
GetPassword();
137 Returns the (normalized) path of the URI.
139 The path component of a URI comes
140 directly after the scheme component
141 if followed by zero or one slashes ('/'),
142 or after the server/port component.
144 Absolute paths include the leading '/'
147 @c http://mysite.compath
149 const wxString
GetPath();
152 Returns a string representation of the URI's port.
154 The Port of a URI is a value after the server, and
155 must come after a colon (:).
157 @c http://mysite.com:port
159 Note that you can easily get the numeric value of the port
160 by using wxAtoi or wxString::Format.
162 const wxString
GetPort();
165 Returns the Query component of the URI.
167 The query component is what is commonly passed to a
168 cgi application, and must come after the path component,
169 and after a '?' character.
171 @c http://mysite.com/mypath?query
173 const wxString
GetQuery();
176 Returns the Scheme component of the URI.
178 The first part of the uri.
180 @c scheme://mysite.com
182 const wxString
GetScheme();
185 Returns the Server component of the URI.
187 The server of the uri can be a server name or
188 a type of ip address. See
189 GetHostType() for the
190 possible values for the host type of the
193 @c http://server/mypath
195 const wxString
GetServer();
198 Returns the username part of the userinfo component of
199 this URI. Note that this is explicitly depreciated by
200 RFC 1396 and should generally be avoided if possible.
202 @c http://user:password@mysite.com/mypath
204 const wxString
GetUser();
207 Returns the UserInfo component of the URI.
209 The component of a URI before the server component
210 that is postfixed by a '@' character.
212 @c http://userinfo@mysite.com/mypath
214 const wxString
GetUserInfo();
217 Returns @true if the Fragment component of the URI exists.
222 Returns @true if the Path component of the URI exists.
227 Returns @true if the Port component of the URI exists.
232 Returns @true if the Query component of the URI exists.
237 Returns @true if the Scheme component of the URI exists.
242 Returns @true if the Server component of the URI exists.
247 Returns @true if the User component of the URI exists.
252 Returns @true if a valid [absolute] URI, otherwise this URI
253 is a URI reference and not a full URI, and IsReference
259 To obtain individual components you can use
260 one of the following methods
276 However, you should check HasXXX before
277 calling a get method, which determines whether or not the component referred
278 to by the method is defined according to RFC 2396.
280 Consider an undefined component equivalent to a
290 @ref hasserver() HasPort
303 Inherits this URI from a base URI - components that do not
304 exist in this URI are copied from the base, and if this URI's
305 path is not an absolute path (prefixed by a '/'), then this URI's
306 path is merged with the base's path.
308 For instance, resolving "../mydir" from "http://mysite.com/john/doe"
309 results in the scheme (http) and server (mysite.com) being copied into
310 this URI, since they do not exist. In addition, since the path
311 of this URI is not absolute (does not begin with '/'), the path
312 of the base's is merged with this URI's path, resulting in the URI
313 "http://mysite.com/john/mydir".
316 Base URI to inherit from. Must be a full URI and not a reference
319 Currently either wxURI_STRICT or 0, in non-strict
320 mode some compatibility layers are enabled to allow loopholes from RFCs prior
323 void Resolve(const wxURI
& base
, int flags
= wxURI_STRICT
);
326 Translates all escape sequences (normal characters and returns the result.
328 This is the preferred over deprecated wxURL::ConvertFromURI.
330 If you want to unescape an entire wxURI, use BuildUnescapedURI() instead,
331 as it performs some optimizations over this method.
334 string with escaped characters to convert
336 wxString
Unescape(const wxString
& uri
);
339 Compares this URI to another URI, and returns @true if
342 @param uricomp, otherwise it returns @false.
347 void operator ==(const wxURI
& uricomp
);