A modifiable container for a URL.

Synopsis

Declared in header <boost/url/url.hpp>

class url
    : public url_base;

Member Functions

Name

Description

authority

Return the authority

buffer

Return the url string

c_str

Return the url as a null-terminated string

capacity

Return the number of characters that can be stored without reallocating

clear

Clear the contents while preserving the capacity

compare

Return the result of comparing this with another url

data

Return a pointer to the url’s character buffer

digest

empty

Return true if the url is empty

encoded_authority

Return the authority.

encoded_fragment

Return the fragment

encoded_host

Return the host

encoded_host_address

Return the host

encoded_host_and_port

Return the host and port

encoded_host_name

Return the host name

encoded_origin

Return the origin

encoded_params

Return the query as a container of parameters

encoded_password

Return the password

encoded_path

Return the path

encoded_query

Return the query

encoded_resource

Return the resource

encoded_segments

Return the path as a container of segments

encoded_target

Return the target

encoded_user

Return the user

encoded_userinfo

Return the userinfo

encoded_zone_id

Return the IPv6 Zone ID

fragment

Return the fragment

has_authority

Return true if an authority is present

has_fragment

Return true if a fragment is present

has_password

Return true if a password is present

has_port

Return true if a port is present

has_query

Return true if a query is present

has_scheme

Return true a scheme is present

has_userinfo

Return true if a userinfo is present

host

Return the host

host_address

Return the host

host_ipv4_address

Return the host IPv4 address

host_ipv6_address

Return the host IPv6 address

host_ipvfuture

Return the host IPvFuture address

host_name

Return the host name

host_type

Return the host type

is_path_absolute

Return true if the path is absolute

normalize

Normalize the URL components

normalize_authority

Normalize the URL authority

normalize_fragment

Normalize the URL fragment

normalize_path

Normalize the URL path

normalize_query

Normalize the URL query

normalize_scheme

Normalize the URL scheme

operator core::string_view

Return the URL as a core::string_view

operator=

Assignment

params

Return the query as a container of parameters

url_view_base::params

password

Return the password

path

Return the path

persist

Return a shared, persistent copy of the url

port

Return the port

port_number

Return the port

query

Return the query

remove_authority

Remove the authority

remove_fragment

Remove the fragment

remove_origin

Remove the origin component

remove_password

Remove the password

remove_port

Remove the port

remove_query

Remove the query

remove_scheme

Remove the scheme

remove_userinfo

Remove the userinfo

reserve

Adjust the capacity without changing the size

resolve

Resolve a URL reference against this base URL

scheme

Return the scheme

scheme_id

Return the scheme

segments

Return the path as a container of segments

set_encoded_authority

Set the authority

set_encoded_fragment

Set the fragment.

set_encoded_host

Set the host

set_encoded_host_address

Set the host to an address

set_encoded_host_name

Set the host to a name

set_encoded_params

Set the query params

set_encoded_password

Set the password.

set_encoded_path

Set the path.

set_encoded_query

Set the query

set_encoded_user

Set the user

set_encoded_userinfo

Set the userinfo.

set_fragment

Set the fragment.

set_host

Set the host

set_host_address

Set the host to an address

set_host_ipv4

Set the host to an address

set_host_ipv6

Set the host to an address

set_host_ipvfuture

Set the host to an address

set_host_name

Set the host to a name

set_params

Set the query params

set_password

Set the password.

set_path

Set the path.

set_path_absolute

Set if the path is absolute

set_port

Set the port

set_port_number

Set the port

set_query

Set the query

set_scheme

Set the scheme

set_scheme_id

url_base::set_scheme_id

set_user

Set the user

set_userinfo

Set the userinfo

size

Return the number of characters in the url

swap

Swap the contents.

url [constructor]

Constructor

user

Return the user

userinfo

Return the userinfo

zone_id

Return the IPv6 Zone ID

~url [destructor]

Destructor

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Friends

Name

Description

operator!=

Return the result of comparing two URLs

operator<

Return the result of comparing two URLs

operator<<

operator⇐

Return the result of comparing two URLs

operator==

Return the result of comparing two URLs

operator>

Return the result of comparing two URLs

operator>=

Return the result of comparing two URLs

resolve

swap

Swap

Description

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

Exception Safety

  • Functions marked noexcept provide the no-throw guarantee, otherwise:

  • Functions which throw offer the strong exception safety guarantee.

BNF

URI-reference = URI / relative-ref

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

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

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

See Also