...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Constructor.
url_view( core::string_view s);
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.
url_view u( "http://www.example.com/index.htm" );
return parse_uri_reference( s ).value();
Linear in s.size()
.
Exceptions thrown on invalid input.
Type |
Thrown On |
---|---|
|
The input failed to parse correctly. |
Name |
Description |
---|---|
|
The string to parse. |
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ]