]>
git.saurik.com Git - wxWidgets.git/blob - interface/uri.h
20b9d96b561ced1fe5e5dbfbfb766944491df21b
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.
53 If the URI is not a reference or is not resolved,
54 the URI that is returned from Get is the same one
60 Builds the URI from its individual components, adds proper separators, and
61 returns escape sequences to normal characters.
62 Note that it is preferred to call this over Unescape(BuildURI()) since
63 BuildUnescapedURI() performs some optimizations over the plain method.
65 wxString
BuildUnescapedURI();
68 Creates this URI from the string
72 Returns the position at which parsing stopped (there
73 is no such thing as an "invalid" wxURI).
76 string to initialize from
78 const wxChar
* Create(const wxString uri
);
81 Note that on URIs with a "file" scheme wxURI does not
82 parse the userinfo, server, or port portion. This is to keep
83 compatability with wxFileSystem, the old wxURL, and older url specifications.
88 Obtains the fragment of this URI.
89 The fragment of a URI is the last value of the URI,
90 and is the value after a '' character after the path
92 @c http://mysite.com/mypath#fragment
94 const wxString
GetFragment();
97 Obtains the host type of this URI, which is of type
102 Server is a host name, or the Server component itself is undefined.
106 Server is a IP version 4 address (XXX.XXX.XXX.XXX)
110 Server is a IP version 6 address ((XXX:)XXX::(XXX)XXX:XXX
114 Server is an IP address, but not versions 4 or 6
116 const HostType
GetHostType();
119 Returns the password part of the userinfo component of
120 this URI. Note that this is explicitly depreciated by
121 RFC 1396 and should generally be avoided if possible.
122 @c http://user:password@mysite.com/mypath
124 const wxString
GetPassword();
127 Returns the (normalized) path of the URI.
128 The path component of a URI comes
129 directly after the scheme component
130 if followed by zero or one slashes ('/'),
131 or after the server/port component.
132 Absolute paths include the leading '/'
134 @c http://mysite.compath
136 const wxString
GetPath();
139 Returns a string representation of the URI's port.
140 The Port of a URI is a value after the server, and
141 must come after a colon (:).
142 @c http://mysite.com:port
143 Note that you can easily get the numeric value of the port
144 by using wxAtoi or wxString::Format.
146 const wxString
GetPort();
149 Returns the Query component of the URI.
150 The query component is what is commonly passed to a
151 cgi application, and must come after the path component,
152 and after a '?' character.
153 @c http://mysite.com/mypath?query
155 const wxString
GetQuery();
158 Returns the Scheme component of the URI.
159 The first part of the uri.
160 @c scheme://mysite.com
162 const wxString
GetScheme();
165 Returns the Server component of the URI.
166 The server of the uri can be a server name or
167 a type of ip address. See
168 GetHostType() for the
169 possible values for the host type of the
171 @c http://server/mypath
173 const wxString
GetServer();
176 Returns the username part of the userinfo component of
177 this URI. Note that this is explicitly depreciated by
178 RFC 1396 and should generally be avoided if possible.
179 @c http://user:password@mysite.com/mypath
181 const wxString
GetUser();
184 Returns the UserInfo component of the URI.
185 The component of a URI before the server component
186 that is postfixed by a '@' character.
187 @c http://userinfo@mysite.com/mypath
189 const wxString
GetUserInfo();
192 Returns @true if the Fragment component of the URI exists.
197 Returns @true if the Path component of the URI exists.
202 Returns @true if the Port component of the URI exists.
207 Returns @true if the Query component of the URI exists.
212 Returns @true if the Scheme component of the URI exists.
217 Returns @true if the Server component of the URI exists.
222 Returns @true if the User component of the URI exists.
227 Returns @true if a valid [absolute] URI, otherwise this URI
228 is a URI reference and not a full URI, and IsReference
234 To obtain individual components you can use
235 one of the following methods
249 However, you should check HasXXX before
250 calling a get method, which determines whether or not the component referred
251 to by the method is defined according to RFC 2396.
252 Consider an undefined component equivalent to a
261 @ref hasserver() HasPort
273 Inherits this URI from a base URI - components that do not
274 exist in this URI are copied from the base, and if this URI's
275 path is not an absolute path (prefixed by a '/'), then this URI's
276 path is merged with the base's path.
277 For instance, resolving "../mydir" from "http://mysite.com/john/doe"
278 results in the scheme (http) and server (mysite.com) being copied into
279 this URI, since they do not exist. In addition, since the path
280 of this URI is not absolute (does not begin with '/'), the path
281 of the base's is merged with this URI's path, resulting in the URI
282 "http://mysite.com/john/mydir".
285 Base URI to inherit from. Must be a full URI and not a reference
287 Currently either wxURI_STRICT or 0, in non-strict
288 mode some compatibility layers are enabled to allow loopholes from RFCs
292 void Resolve(const wxURI
& base
, int flags
= wxURI_STRICT
);
295 Translates all escape sequences (normal characters and returns the result.
296 This is the preferred over deprecated wxURL::ConvertFromURI.
297 If you want to unescape an entire wxURI, use BuildUnescapedURI() instead,
298 as it performs some optimizations over this method.
301 string with escaped characters to convert
303 wxString
Unescape(const wxString
& uri
);
306 Compares this URI to another URI, and returns @true if
309 @param uricomp, otherwise it returns @false.
314 void operator ==(const wxURI
& uricomp
);