Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
url_view::url_view (2 of 5 overloads)

Constructor.

Synopsis
url_view(
    core::string_view s);
Description

This function constructs a URL from the string s, which must contain a valid URI or relative-ref or else an exception is thrown. Upon successful construction, the view refers to the characters in the buffer pointed to by s. Ownership is not transferred; The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.

Example
[link url.ref.boost__urls__url_view.url_view `url_view`] u( "http://www.example.com/index.htm" );
Effects
return [link url.ref.boost__urls__parse_uri_reference `parse_uri_reference`]( s ).value();
Complexity

Linear in s.size().

Exception Safety

Exceptions thrown on invalid input.

Exceptions

Type

Thrown On

system_error

The input failed to parse correctly.

Parameters

Name

Description

s

The string to parse.

BNF
URI           = [link url.ref.boost__urls__url_view.scheme `scheme`] ":" hier-part [ "?" [link url.ref.boost__urls__url_view.query `query`] ] [ "#" [link url.ref.boost__urls__url_view.fragment `fragment`] ]

relative-[link url.ref.boost__urls__grammar__ref `ref`]  = relative-part [ "?" [link url.ref.boost__urls__url_view.query `query`] ] [ "#" [link url.ref.boost__urls__url_view.fragment `fragment`] ]
Specification
See Also

parse_uri_reference.


PrevUpHomeNext