xtd 0.2.0
Loading...
Searching...
No Matches

◆ uri() [2/5]

xtd::uri::uri ( const xtd::ustring uri_string)
explicit

Initializes a new instance of the xtd::uri class with the specified URI.

Parameters
uri_string: A string that identifies the resource to be represented by the xtd::uri instance. Note that an IPv6 address in string form must be enclosed within brackets. For example, "http://[2607:f8b0:400d:c06::69]".
Exceptions
xtd::uri_format_exceptionuri_string is empty.
-or-
The scheme specified in uri_string is not correctly formed. See xtd::uricheck_scheme_name.
-or-
The password specified in uri_string is not valid.
-or-
The host name specified in uri_string is not valid.
-or-
The file name specified in uri_string is not valid.
-or-
The user name specified in uri_string is not valid.
-or-<or>The host or authority name specified in uri_string cannot be terminated by backslashes.
-or-
The port number specified in uri_string is not valid or cannot be parsed.
-or-
The length of uri_string exceeds 65519 characters.
-or-
The length of the scheme specified in uri_string exceeds 1023 characters.
-or-
There is an invalid character sequence in uri_string.
-or-
The MS-DOS path specified in uri_string must start with c:\.
Examples
The following example creates a xtd::uri instance with the URI http://www.contoso.com/.
auto my_uri = uri("http://www.contoso.com/");
uri()=default
Initializes a new instance of the xtd::uri class.
Remarks
This constructor creates a xtd::uri instance from a URI string. It parses the URI, puts it in canonical format, and makes any required escape encodings.
This constructor does not ensure that the xtd::uri refers to an accessible resource.
This constructor assumes that the string parameter references an absolute URI and is equivalent to calling the xtd::uri constructor with xtd::uri_kind set to xtd::uri_kind::absolute. If the string parameter passed to the constructor is a relative URI, this constructor will throw a xtd::uri_format_exception.