[#boost-urls-url_view]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::url&lowbar;view
:relfileprefix: ../../
:mrdocs:


A non&hyphen;owning reference to a valid URL

== Synopsis


Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view.hpp#L74[boost&sol;url&sol;url&lowbar;view&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class url&lowbar;view
    : public xref:boost/urls/url_view_base.adoc[url&lowbar;view&lowbar;base];
----

== Member Functions

[cols=2]
|===
| Name | Description 

| xref:boost/urls/url_view_base/authority.adoc[`authority`] 
| Return the authority

| xref:boost/urls/url_view_base/buffer.adoc[`buffer`] 
| Return the url string

| xref:boost/urls/url_view_base/compare.adoc[`compare`] 
| Return the result of comparing this with another url

| xref:boost/urls/url_view_base/data.adoc[`data`] 
| Return a pointer to the url&apos;s character buffer

| xref:boost/urls/url_view_base/empty.adoc[`empty`] 
| Return true if the url is empty

| xref:boost/urls/url_view_base/encoded_authority.adoc[`encoded&lowbar;authority`] 
| Return the authority&period;

| xref:boost/urls/url_view_base/encoded_fragment.adoc[`encoded&lowbar;fragment`] 
| Return the fragment

| xref:boost/urls/url_view_base/encoded_host.adoc[`encoded&lowbar;host`] 
| Return the host

| xref:boost/urls/url_view_base/encoded_host_address.adoc[`encoded&lowbar;host&lowbar;address`] 
| Return the host

| xref:boost/urls/url_view_base/encoded_host_and_port.adoc[`encoded&lowbar;host&lowbar;and&lowbar;port`] 
| Return the host and port

| xref:boost/urls/url_view_base/encoded_host_name.adoc[`encoded&lowbar;host&lowbar;name`] 
| Return the host name

| xref:boost/urls/url_view_base/encoded_origin.adoc[`encoded&lowbar;origin`] 
| Return the origin

| xref:boost/urls/url_view_base/encoded_params.adoc[`encoded&lowbar;params`] 
| Return the query as a container of parameters

| xref:boost/urls/url_view_base/encoded_password.adoc[`encoded&lowbar;password`] 
| Return the password

| xref:boost/urls/url_view_base/encoded_path.adoc[`encoded&lowbar;path`] 
| Return the path

| xref:boost/urls/url_view_base/encoded_query.adoc[`encoded&lowbar;query`] 
| Return the query

| xref:boost/urls/url_view_base/encoded_resource.adoc[`encoded&lowbar;resource`] 
| Return the resource

| xref:boost/urls/url_view_base/encoded_segments.adoc[`encoded&lowbar;segments`] 
| Return the path as a container of segments

| xref:boost/urls/url_view_base/encoded_target.adoc[`encoded&lowbar;target`] 
| Return the target

| xref:boost/urls/url_view_base/encoded_user.adoc[`encoded&lowbar;user`] 
| Return the user

| xref:boost/urls/url_view_base/encoded_userinfo.adoc[`encoded&lowbar;userinfo`] 
| Return the userinfo

| xref:boost/urls/url_view_base/encoded_zone_id.adoc[`encoded&lowbar;zone&lowbar;id`] 
| Return the IPv6 Zone ID

| xref:boost/urls/url_view_base/fragment.adoc[`fragment`] 
| Return the fragment

| xref:boost/urls/url_view_base/has_authority.adoc[`has&lowbar;authority`] 
| Return true if an authority is present

| xref:boost/urls/url_view_base/has_fragment.adoc[`has&lowbar;fragment`] 
| Return true if a fragment is present

| xref:boost/urls/url_view_base/has_password.adoc[`has&lowbar;password`] 
| Return true if a password is present

| xref:boost/urls/url_view_base/has_port.adoc[`has&lowbar;port`] 
| Return true if a port is present

| xref:boost/urls/url_view_base/has_query.adoc[`has&lowbar;query`] 
| Return true if a query is present

| xref:boost/urls/url_view_base/has_scheme.adoc[`has&lowbar;scheme`] 
| Return true a scheme is present

| xref:boost/urls/url_view_base/has_userinfo.adoc[`has&lowbar;userinfo`] 
| Return true if a userinfo is present

| xref:boost/urls/url_view_base/host.adoc[`host`] 
| Return the host

| xref:boost/urls/url_view_base/host_address.adoc[`host&lowbar;address`] 
| Return the host

| xref:boost/urls/url_view_base/host_ipv4_address.adoc[`host&lowbar;ipv4&lowbar;address`] 
| Return the host IPv4 address

| xref:boost/urls/url_view_base/host_ipv6_address.adoc[`host&lowbar;ipv6&lowbar;address`] 
| Return the host IPv6 address

| xref:boost/urls/url_view_base/host_ipvfuture.adoc[`host&lowbar;ipvfuture`] 
| Return the host IPvFuture address

| xref:boost/urls/url_view_base/host_name.adoc[`host&lowbar;name`] 
| Return the host name

| xref:boost/urls/url_view_base/host_type.adoc[`host&lowbar;type`] 
| Return the host type

| xref:boost/urls/url_view_base/is_path_absolute.adoc[`is&lowbar;path&lowbar;absolute`] 
| Return true if the path is absolute

| xref:boost/urls/url_view_base/2conversion.adoc[`operator core::string&lowbar;view`] 
| Return the URL as a core&colon;&colon;string&lowbar;view

| xref:boost/urls/url_view/operator_assign.adoc[`operator&equals;`] 
| Assignment


| xref:boost/urls/url_view_base/params.adoc[`params`] 
| Return the query as a container of parameters


| xref:boost/urls/url_view_base/password.adoc[`password`] 
| Return the password

| xref:boost/urls/url_view_base/path.adoc[`path`] 
| Return the path

| xref:boost/urls/url_view_base/persist.adoc[`persist`] 
| Return a shared, persistent copy of the url

| xref:boost/urls/url_view_base/port.adoc[`port`] 
| Return the port

| xref:boost/urls/url_view_base/port_number.adoc[`port&lowbar;number`] 
| Return the port

| xref:boost/urls/url_view_base/query.adoc[`query`] 
| Return the query

| xref:boost/urls/url_view_base/scheme.adoc[`scheme`] 
| Return the scheme

| xref:boost/urls/url_view_base/scheme_id.adoc[`scheme&lowbar;id`] 
| Return the scheme

| xref:boost/urls/url_view_base/segments.adoc[`segments`] 
| Return the path as a container of segments

| xref:boost/urls/url_view_base/size.adoc[`size`] 
| Return the number of characters in the url

| xref:boost/urls/url_view/2constructor.adoc[`url&lowbar;view`]         [.small]#[constructor]#
| Constructor

xref:boost/urls/url_view/2constructor-00.adoc[url&lowbar;view(core&colon;&colon;string&lowbar;view)]


| xref:boost/urls/url_view_base/user.adoc[`user`] 
| Return the user

| xref:boost/urls/url_view_base/userinfo.adoc[`userinfo`] 
| Return the userinfo

| xref:boost/urls/url_view_base/zone_id.adoc[`zone&lowbar;id`] 
| Return the IPv6 Zone ID

| xref:boost/urls/url_view/2destructor.adoc[`&#126;url&lowbar;view`] [.small]#[destructor]#
| Destructor

|===
== Static Member Functions

[cols=2]
|===
| Name | Description 

| xref:boost/urls/url_view/max_size.adoc[`max&lowbar;size`] 
| Return the maximum number of characters possible


|===
== Friends

[cols=2]
|===
| Name | Description 

| xref:boost/urls/url_view_base/08friend-02.adoc[`operator!&equals;`] 
| Return the result of comparing two URLs

| xref:boost/urls/url_view_base/08friend-05.adoc[`operator&lt;`] 
| Return the result of comparing two URLs

| xref:boost/urls/url_view_base/08friend-0ff.adoc[`operator&lt;&lt;`] 
| Format the url to the output stream

| xref:boost/urls/url_view_base/08friend-04a.adoc[`operator&lt;&equals;`] 
| Return the result of comparing two URLs

| xref:boost/urls/url_view_base/08friend-07c.adoc[`operator&equals;&equals;`] 
| Return the result of comparing two URLs

| xref:boost/urls/url_view_base/08friend-073.adoc[`operator&gt;`] 
| Return the result of comparing two URLs

| xref:boost/urls/url_view_base/08friend-06.adoc[`operator&gt;&equals;`] 
| Return the result of comparing two URLs

|===

== Protected Member Functions

[cols=2]
|===
| Name | Description 

| xref:boost/urls/url_view_base/digest.adoc[`digest`] 
| Calculate a hash of the url

|===


== Description


Objects of this type represent valid URL    strings constructed from a parsed, external    character buffer whose storage is managed    by the caller&period; That is, it acts like a    `core&colon;&colon;string&lowbar;view` in terms of ownership&period;    The caller is responsible for ensuring    that the lifetime of the underlying    character buffer extends until it is no    longer referenced&period;


=== Example 1

Construction from a string parses the input    as a _URI&hyphen;reference_ and throws an    exception on error&period; Upon success, the    constructed object points to the passed    character buffer&semi; ownership is not    transferred&period;

[,cpp]
----
url_view u( "https://www.example.com/index.htm?text=none#a1" );
----

=== Example 2

Parsing functions like xref:boost/urls/parse_uri_reference.adoc[parse&lowbar;uri&lowbar;reference]    return a result containing either a valid    xref:boost/urls/url_view/2constructor-00.adoc[url&lowbar;view] upon succcess, otherwise they    contain an error&period; The error can be converted to    an exception by the caller if desired&colon;

[,cpp]
----
system::result< url_view > rv = parse_uri_reference( "https://www.example.com/index.htm?text=none#a1" );
----

=== BNF

[,cpp]
----
URI-reference = URI / relative-ref

URI           = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

relative-ref  = relative-part [ "?" query ] [ "#" fragment ]
----

=== Specification

* link:https://tools.ietf.org/html/rfc3986[Uniform Resource Identifier (URI)&colon; Generic Syntax (rfc3986)]

A non&hyphen;owning reference to a valid URL

Objects of this type represent valid URL    strings constructed from a parsed, external    character buffer whose storage is managed    by the caller&period; That is, it acts like a    `core&colon;&colon;string&lowbar;view` in terms of ownership&period;    The caller is responsible for ensuring    that the lifetime of the underlying    character buffer extends until it is no    longer referenced&period;


=== Example 1

Construction from a string parses the input    as a _URI&hyphen;reference_ and throws an    exception on error&period; Upon success, the    constructed object points to the passed    character buffer&semi; ownership is not    transferred&period;

[,cpp]
----
url_view u( "https://www.example.com/index.htm?text=none#a1" );
----

=== Example 2

Parsing functions like xref:boost/urls/parse_uri_reference.adoc[parse&lowbar;uri&lowbar;reference]    return a result containing either a valid    xref:boost/urls/url_view/2constructor-00.adoc[url&lowbar;view] upon succcess, otherwise they    contain an error&period; The error can be converted to    an exception by the caller if desired&colon;

[,cpp]
----
system::result< url_view > rv = parse_uri_reference( "https://www.example.com/index.htm?text=none#a1" );
----

=== BNF

[,cpp]
----
URI-reference = URI / relative-ref

URI           = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

relative-ref  = relative-part [ "?" query ] [ "#" fragment ]
----

=== Specification

* link:https://tools.ietf.org/html/rfc3986[Uniform Resource Identifier (URI)&colon; Generic Syntax (rfc3986)]



== See Also


xref:boost/urls/parse_absolute_uri.adoc[parse&lowbar;absolute&lowbar;uri],        xref:boost/urls/parse_origin_form.adoc[parse&lowbar;origin&lowbar;form],        xref:boost/urls/parse_relative_ref.adoc[parse&lowbar;relative&lowbar;ref],        xref:boost/urls/parse_uri.adoc[parse&lowbar;uri],        xref:boost/urls/parse_uri_reference.adoc[parse&lowbar;uri&lowbar;reference]&period;



xref:boost/urls/parse_absolute_uri.adoc[parse&lowbar;absolute&lowbar;uri],        xref:boost/urls/parse_origin_form.adoc[parse&lowbar;origin&lowbar;form],        xref:boost/urls/parse_relative_ref.adoc[parse&lowbar;relative&lowbar;ref],        xref:boost/urls/parse_uri.adoc[parse&lowbar;uri],        xref:boost/urls/parse_uri_reference.adoc[parse&lowbar;uri&lowbar;reference]&period;






[.small]#Created with https://www.mrdocs.com[MrDocs]#
