[#boost-urls-url]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::url
:relfileprefix: ../../
:mrdocs:

A modifiable container for a URL&period;

== Synopsis

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

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

== Description

This container owns a url, represented by a null&hyphen;terminated character buffer which is managed by performing dymamic memory allocations as needed&period; The contents may be inspected and modified, and the implementation maintains a useful invariant&colon; changes to the url always leave it in a valid state&period;

== Exception Safety

* Functions marked `noexcept` provide the no&hyphen;throw guarantee, otherwise&colon;
* Functions which throw offer the strong exception safety guarantee&period;

== BNF

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

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

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

absolute-URI  = scheme ":" hier-part [ "?" query ]
----
== Specification

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

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:boost/urls/url_base.adoc[url&lowbar;base]`
| Common functionality for containers
|===

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:boost/urls/url/2constructor-0a.adoc[`url`]         [.small]#[constructor]#
| Constructor
| xref:boost/urls/url/2destructor.adoc[`&#126;url`] [.small]#[destructor]# [.small]#[virtual]#
| Destructor
| xref:boost/urls/url/operator_assign-064.adoc[`operator&equals;`] 
| Assignment
| 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_base/c_str.adoc[`c&lowbar;str`] 
| Return the url as a null&hyphen;terminated string
| xref:boost/urls/url_base/capacity.adoc[`capacity`] 
| Return the number of characters that can be stored without reallocating
| xref:boost/urls/url_base/clear.adoc[`clear`] 
| Clear the contents while preserving the capacity
| 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_base/encoded_params-0b.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_base/encoded_segments-0a.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/normalize.adoc[`normalize`] 
| Normalize the URL components
| xref:boost/urls/url/normalize_authority.adoc[`normalize&lowbar;authority`] 
| Normalize the URL authority
| xref:boost/urls/url/normalize_fragment.adoc[`normalize&lowbar;fragment`] 
| Normalize the URL fragment
| xref:boost/urls/url/normalize_path.adoc[`normalize&lowbar;path`] 
| Normalize the URL path
| xref:boost/urls/url/normalize_query.adoc[`normalize&lowbar;query`] 
| Normalize the URL query
| xref:boost/urls/url/normalize_scheme.adoc[`normalize&lowbar;scheme`] 
| Normalize the URL scheme
| xref:boost/urls/url_base/params-0c1.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/remove_authority.adoc[`remove&lowbar;authority`] 
| Remove the authority
| xref:boost/urls/url/remove_fragment.adoc[`remove&lowbar;fragment`] 
| Remove the fragment
| xref:boost/urls/url/remove_origin.adoc[`remove&lowbar;origin`] 
| Remove the origin component
| xref:boost/urls/url/remove_password.adoc[`remove&lowbar;password`] 
| Remove the password
| xref:boost/urls/url/remove_port.adoc[`remove&lowbar;port`] 
| Remove the port
| xref:boost/urls/url/remove_query.adoc[`remove&lowbar;query`] 
| Remove the query
| xref:boost/urls/url/remove_scheme.adoc[`remove&lowbar;scheme`] 
| Remove the scheme
| xref:boost/urls/url/remove_userinfo.adoc[`remove&lowbar;userinfo`] 
| Remove the userinfo
| xref:boost/urls/url_base/reserve.adoc[`reserve`] 
| Adjust the capacity without changing the size
| xref:boost/urls/url_base/resolve.adoc[`resolve`] 
| Resolve a URL reference against this base URL
| 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_base/segments-07.adoc[`segments`] 
| Return the path as a container of segments
| xref:boost/urls/url/set_encoded_authority.adoc[`set&lowbar;encoded&lowbar;authority`] 
| Set the authority
| xref:boost/urls/url/set_encoded_fragment.adoc[`set&lowbar;encoded&lowbar;fragment`] 
| Set the fragment&period;
| xref:boost/urls/url/set_encoded_host.adoc[`set&lowbar;encoded&lowbar;host`] 
| Set the host
| xref:boost/urls/url/set_encoded_host_address.adoc[`set&lowbar;encoded&lowbar;host&lowbar;address`] 
| Set the host to an address
| xref:boost/urls/url/set_encoded_host_name.adoc[`set&lowbar;encoded&lowbar;host&lowbar;name`] 
| Set the host to a name
| xref:boost/urls/url/set_encoded_params.adoc[`set&lowbar;encoded&lowbar;params`] 
| Set the query params
| xref:boost/urls/url/set_encoded_password.adoc[`set&lowbar;encoded&lowbar;password`] 
| Set the password&period;
| xref:boost/urls/url/set_encoded_path.adoc[`set&lowbar;encoded&lowbar;path`] 
| Set the path&period;
| xref:boost/urls/url/set_encoded_query.adoc[`set&lowbar;encoded&lowbar;query`] 
| Set the query
| xref:boost/urls/url/set_encoded_user.adoc[`set&lowbar;encoded&lowbar;user`] 
| Set the user
| xref:boost/urls/url/set_encoded_userinfo.adoc[`set&lowbar;encoded&lowbar;userinfo`] 
| Set the userinfo&period;
| xref:boost/urls/url/set_encoded_zone_id-07.adoc[`set&lowbar;encoded&lowbar;zone&lowbar;id`] 
| Set the zone ID for an IPv6 address (percent&hyphen;encoded)&period;
| xref:boost/urls/url/set_fragment.adoc[`set&lowbar;fragment`] 
| Set the fragment&period;
| xref:boost/urls/url/set_host.adoc[`set&lowbar;host`] 
| Set the host
| xref:boost/urls/url/set_host_address.adoc[`set&lowbar;host&lowbar;address`] 
| Set the host to an address
| xref:boost/urls/url/set_host_ipv4.adoc[`set&lowbar;host&lowbar;ipv4`] 
| Set the host to an address
| xref:boost/urls/url/set_host_ipv6.adoc[`set&lowbar;host&lowbar;ipv6`] 
| Set the host to an address
| xref:boost/urls/url/set_host_ipvfuture.adoc[`set&lowbar;host&lowbar;ipvfuture`] 
| Set the host to an address
| xref:boost/urls/url/set_host_name.adoc[`set&lowbar;host&lowbar;name`] 
| Set the host to a name
| xref:boost/urls/url/set_params.adoc[`set&lowbar;params`] 
| Set the query params
| xref:boost/urls/url/set_password.adoc[`set&lowbar;password`] 
| Set the password&period;
| xref:boost/urls/url/set_path.adoc[`set&lowbar;path`] 
| Set the path&period;
| xref:boost/urls/url_base/set_path_absolute.adoc[`set&lowbar;path&lowbar;absolute`] 
| Set if the path is absolute
| xref:boost/urls/url/set_port.adoc[`set&lowbar;port`] 
| Set the port
| xref:boost/urls/url/set_port_number.adoc[`set&lowbar;port&lowbar;number`] 
| Set the port
| xref:boost/urls/url/set_query.adoc[`set&lowbar;query`] 
| Set the query
| xref:boost/urls/url/set_scheme.adoc[`set&lowbar;scheme`] 
| Set the scheme
| xref:boost/urls/url/set_scheme_id.adoc[`set&lowbar;scheme&lowbar;id`] 
| Set the scheme
| xref:boost/urls/url/set_user.adoc[`set&lowbar;user`] 
| Set the user
| xref:boost/urls/url/set_userinfo.adoc[`set&lowbar;userinfo`] 
| Set the userinfo
| xref:boost/urls/url/set_zone_id.adoc[`set&lowbar;zone&lowbar;id`] 
| Set the zone ID for an IPv6 address&period;
| xref:boost/urls/url_view_base/size.adoc[`size`] 
| Return the number of characters in the url
| xref:boost/urls/url/swap.adoc[`swap`] 
| Swap the contents&period;
| 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_base/2conversion.adoc[`operator core::string&lowbar;view`] 
| Return the URL as a core&colon;&colon;string&lowbar;view
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:boost/urls/url_view_base/max_size.adoc[`max&lowbar;size`] 
| Return the maximum number of characters possible
|===


== Protected Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:boost/urls/url_view_base/digest.adoc[`digest`] 
| Calculate a hash of the url
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:boost/urls/swap.adoc[boost::urls::swap]`
| Swap
| `std::hash&lt;url&gt;`
| 
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:boost/urls/format-02.adoc[`format`]
| Format arguments into a URL
| xref:boost/urls/format-05.adoc[`format`]
| Format arguments into a URL
| xref:boost/urls/format_to-02.adoc[`format&lowbar;to`]
| Format arguments into a URL
| xref:boost/urls/format_to-0b.adoc[`format&lowbar;to`]
| Format arguments into a URL
| xref:boost/urls/operator_not_eq-040.adoc[`operator!&equals;`]
| Return the result of comparing two URLs
| xref:boost/urls/operator_lt-04a.adoc[`operator&lt;`]
| Return the result of comparing two URLs
| xref:boost/urls/operator_le-0a.adoc[`operator&lt;&equals;`]
| Return the result of comparing two URLs
| xref:boost/urls/operator_eq-013.adoc[`operator&equals;&equals;`]
| Return the result of comparing two URLs
| xref:boost/urls/operator_gt-09.adoc[`operator&gt;`]
| Return the result of comparing two URLs
| xref:boost/urls/operator_ge-00.adoc[`operator&gt;&equals;`]
| Return the result of comparing two URLs
| xref:boost/urls/resolve.adoc[`resolve`]
| Resolve a URL reference against a base URL
|===

== See Also

xref:boost/urls/parse_absolute_uri.adoc[`parse&lowbar;absolute&lowbar;uri`], 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`], xref:boost/urls/url_base/resolve.adoc[`resolve`]&period;


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