A non-owning reference to a valid URL
Synopsis
Declared in header </boost/url/url_view.hpp#L74[boost/url/url_view.hpp,window=blank_]>
class url_view
: public url_view_base;
Member Functions
Name |
Description |
Return the authority |
|
Return the url string |
|
Return the result of comparing this with another url |
|
Return a pointer to the url's character buffer |
|
Return true if the url is empty |
|
Return the authority. |
|
Return the fragment |
|
Return the host |
|
Return the host |
|
Return the host and port |
|
Return the host name |
|
Return the origin |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return the query |
|
Return the resource |
|
Return the path as a container of segments |
|
Return the target |
|
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
|
Return the fragment |
|
Return true if an authority is present |
|
Return true if a fragment is present |
|
Return true if a password is present |
|
Return true if a port is present |
|
Return true if a query is present |
|
Return true a scheme is present |
|
Return true if a userinfo is present |
|
Return the host |
|
Return the host |
|
Return the host IPv4 address |
|
Return the host IPv6 address |
|
Return the host IPvFuture address |
|
Return the host name |
|
Return the host type |
|
Return true if the path is absolute |
|
Return the URL as a core::string_view |
|
Assignment |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return a shared, persistent copy of the url |
|
Return the port |
|
Return the port |
|
Return the query |
|
Return the scheme |
|
Return the scheme |
|
Return the path as a container of segments |
|
Return the number of characters in the url |
|
Constructor |
|
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
|
Destructor |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Friends
Name |
Description |
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
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" );
BNF
URI-reference = URI / relative-ref
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
relative-ref = relative-part [ "?" query ] [ "#" fragment ]