Class url_view
A non-owning reference to a valid URL
Synopsis
class url_view
: public url_view_base;
Declared in file <include/boost/url/detail/url_impl.hpp> on line 24
Defined in file <include/boost/url/url_view.hpp> on line 74
Member Functions
Name |
Description |
Destructor |
|
Constructor |
|
Constructor |
|
Constructor |
|
Constructor |
|
Assignment |
|
Assignment |
Description
Objects of this type represent valid URL strings constructed from a parsed, external
character buffer whose storage is managed
by the caller. That is, it acts like a
core::string_view
in terms of ownership.
The caller is responsible for ensuring
that the lifetime of the underlying
character buffer extends until it is no
longer referenced.
Example 1
Construction from a string parses the input as a URI-reference and throws an exception on error. Upon success, the constructed object points to the passed character buffer; ownership is not transferred.
url_view u( "https://www.example.com/index.htm?text=none#a1" );
Example 2
Parsing functions like parse_uri_reference return a result containing either a valid url_view upon succcess, otherwise they contain an error. The error can be converted to an exception by the caller if desired:
system::result< url_view > rv = parse_uri_reference( "https://www.example.com/index.htm?text=none#a1" );