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

◆ uri() [3/5]

xtd::uri::uri ( const xtd::ustring uri,
xtd::uri_kind  uri_kind 
)

Initializes a new instance of the xtd::uri class with the specified URI. This constructor allows you to specify if the URI string is a relative URI, absolute URI, or is indeterminate.

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]".
uri_kind: Specifies whether the URI string is a relative URI, absolute URI, or is indeterminate.
Exceptions
xtd::uri_format_exceptionuri_string contains a relative URI and uri_kind is xtd::uri_kind::absolute.
-or-
uri_string contains an absolute URI and uri_kind is xtd::uri_kind::relative.
-or-
uri_string is empty.
-or-
The scheme specified in uri_string is not correctly formed. See CheckSchemeName(String).
-or-
uri_string contains too many slashes.
-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-
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:\.
Remarks
Relative and absolute URIs have different restrictions on their format. For example, a relative URI does not require a scheme or an authority. The value you specify in uri_kind must match the type of URI passed in uri_string. However, if xtd::uri::relative_orA_asolute is specified, the URI string can be relative or absolute.