Global namespace

Namespaces

Name

Description

boost

std

boost

Namespaces

Name

Description

system

urls

boost::urls

Namespaces

Name

Description

error_types

grammar

string_token

Types

Name

Description

absolute_uri_rule_t

authority_rule_t

authority_view

A non-owning reference to a valid authority

decode_view

A reference to a valid, percent-encoded string

encoding_opts

Percent-encoding options

ignore_case_param

An optional parameter to determine case-sensitivity

ignore_case_t

ipv4_address

An IP version 4 style address.

ipv4_address_rule_t

ipv6_address

An IP version 6 style address.

ipv6_address_rule_t

make_void

no_value_t

The type of no_value

optional

origin_form_rule_t

param

A query parameter

param_pct_view

A query parameter

param_view

A query parameter

params_base

Common functionality for containers

params_encoded_base

Common functionality for containers

params_encoded_ref

A view representing query parameters in a URL

params_encoded_view

A view representing query parameters in a URL

params_ref

A view representing query parameters in a URL

params_view

A view representing query parameters in a URL

pct_encoded_rule_t

pct_string_view

A reference to a valid percent-encoded string

query_rule_t

relative_ref_rule_t

segments_base

Common functionality for containers

segments_encoded_base

Common functionality for containers

segments_encoded_ref

A view representing path segments in a URL

segments_encoded_view

A view representing path segments in a URL

segments_ref

A view representing path segments in a URL

segments_view

A view representing path segments in a URL

static_url

A modifiable container for a URL.

static_url_base

Common implementation for all static URLs

string_view

The type of string_view used by the library

uri_reference_rule_t

uri_rule_t

url

A modifiable container for a URL.

url_base

Common functionality for containers

url_view

A non-owning reference to a valid URL

url_view_base

Common functionality for containers

variant

The type of variant used by the library

void_t

Enums

Name

Description

error

Error codes returned the library

host_type

Identifies the type of host in a URL.

scheme

Identifies a known URL scheme

Functions

Name

Description

arg

default_port

Return the default port for a known scheme

encode

Apply percent-encoding to a string

Return a percent-encoded string

encode_unsafe

encoded_size

Return the buffer size needed for percent-encoding

format

Format arguments into a URL

format_to

Format arguments into a URL

make_error_code

make_pct_string_view

Return a valid percent-encoded string

make_pct_string_view_unsafe

operator!=

Return the result of comparing two URLs

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

Return true if two addresses are not equal

operator<

Return the result of comparing two URLs

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

operator<<

Format the address to an output stream

Format the address to an output stream.

Format the encoded authority to the output stream

Format the string with percent-decoding applied to the output stream

Format the url to the output stream

Format to an output stream

operator⇐

Return the result of comparing two URLs

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

operator==

Return the result of comparing two URLs

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

Return true if two addresses are equal

operator>

Return the result of comparing two URLs

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

operator>=

Return the result of comparing two URLs

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

parse_absolute_uri

Return a reference to a parsed URL string

parse_authority

Parse an authority

parse_ipv4_address

Return an IPv4 address from an IP address string in dotted decimal form

parse_ipv6_address

Parse a string containing an IPv6 address.

parse_origin_form

Return a reference to a parsed URL string

parse_path

Parse a string and return an encoded segment view

parse_query

Parse a string and return an encoded params view

parse_relative_ref

Return a reference to a parsed URL string

parse_uri

Return a reference to a parsed URL string

parse_uri_reference

Return a reference to a parsed URL string

pct_encoded_rule

resolve

Resolve a URL reference against a base URL

string_to_scheme

Return the known scheme for a non-normalized string, if known

swap

Swap

to_string

Return the normalized string for a known scheme

Variables

Name

Description

absolute_uri_rule

authority_rule

gen_delim_chars

The gen-delims character set

ignore_case

ipv4_address_rule

ipv6_address_rule

no_value

Constant indicating no value in a param

origin_form_rule

pchars

The path character set

query_rule

relative_ref_rule

reserved_chars

The reserved character set

sub_delim_chars

The sub-delims character set

unreserved_chars

The unreserved character set

uri_reference_rule

uri_rule

Using Directives

Name

Description

error_types

boost::urls::make_void

Synopsis

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

template<class...>
struct make_void;

Types

Name

Description

type

boost::urls::make_void::type

Synopsis

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

typedef void type;

boost::urls::void_t

Synopsis

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

template<class... Ts>
using void_t = make_void<Ts...>::type;

boost::urls::no_value_t

The type of no_value

Synopsis

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

struct no_value_t;

boost::urls::encoding_opts

Percent-encoding options

Synopsis

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

struct encoding_opts;

Member Functions

Name

Description

encoding_opts [constructor]

Data Members

Name

Description

disallow_null

True if nulls are not allowed

lower_case

True if hexadecimal digits are emitted as lower case

space_as_plus

True if spaces encode to and from plus signs

Description

These options are used to customize the behavior of algorithms which use percent escapes, such as encoding or decoding.

See Also

boost::urls::encoding_opts::space_as_plus

True if spaces encode to and from plus signs

Synopsis

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

bool space_as_plus = false;

Description

This option controls whether or not the PLUS character ("+") is used to represent the SP character (" ") when encoding or decoding. Although not prescribed by the RFC, plus signs are commonly treated as spaces upon decoding when used in the query of URLs using well known schemes such as HTTP.

boost::urls::encoding_opts::lower_case

True if hexadecimal digits are emitted as lower case

Synopsis

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

bool lower_case = false;

Description

By default, percent-encoding algorithms emit hexadecimal digits A through F as uppercase letters. When this option is true, lowercase letters are used.

boost::urls::encoding_opts::disallow_null

True if nulls are not allowed

Synopsis

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

bool disallow_null = false;

Description

Normally all possible character values (from 0 to 255) are allowed, with reserved characters being replaced with escapes upon encoding. When this option is true, attempting to decode a null will result in an error.

boost::urls::encoding_opts::encoding_opts

Synopsis

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

encoding_opts(
    bool space_as_plus_ = false,
    bool lower_case_ = false,
    bool disallow_null_ = false) noexcept;

boost::urls::error_types

Types

Name

Description

error_category

The type of error category used by the library

error_code

The type of error code used by the library

error_condition

The type of error condition used by the library

result

The type of result returned by library functions

system_error

The type of system error thrown by the library

boost::urls::error_types::error_category

The type of error category used by the library

Synopsis

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

using error_category = boost::system::error_category;

Description

Warning
This alias is no longer supported and should not be used in new code. Please use system::error_category instead.

This alias is included for backwards compatibility with earlier versions of the library.

However, it will be removed in future releases, and using it in new code is not recommended.

Please use the updated version instead to ensure compatibility with future versions of the library.

boost::urls::error_types::error_code

The type of error code used by the library

Synopsis

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

using error_code = boost::system::error_code;

Description

Warning
This alias is no longer supported and should not be used in new code. Please use system::error_code instead.

This alias is included for backwards compatibility with earlier versions of the library.

However, it will be removed in future releases, and using it in new code is not recommended.

Please use the updated version instead to ensure compatibility with future versions of the library.

boost::urls::error_types::error_condition

The type of error condition used by the library

Synopsis

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

using error_condition = boost::system::error_condition;

Description

Warning
This alias is no longer supported and should not be used in new code. Please use system::error_condition instead.

This alias is included for backwards compatibility with earlier versions of the library.

However, it will be removed in future releases, and using it in new code is not recommended.

Please use the updated version instead to ensure compatibility with future versions of the library.

boost::urls::error_types::system_error

The type of system error thrown by the library

Synopsis

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

using system_error = boost::system::system_error;

Description

Warning
This alias is no longer supported and should not be used in new code. Please use system::system_error instead.

This alias is included for backwards compatibility with earlier versions of the library.

However, it will be removed in future releases, and using it in new code is not recommended.

Please use the updated version instead to ensure compatibility with future versions of the library.

boost::urls::error_types::generic_category

Synopsis

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

using boost::system::generic_category;

boost::urls::error_types::system_category

Synopsis

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

using boost::system::system_category;

boost::urls::error_types::errc

Synopsis

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

namespace errc = boost::system::errc;

boost::urls::error_types::result

The type of result returned by library functions

Synopsis

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

template<class T>
using result = boost::system::result<T, system::error_code>;

Description

Warning
This alias is no longer supported and should not be used in new code. Please use system::result instead.

This alias is included for backwards compatibility with earlier versions of the library.

However, it will be removed in future releases, and using it in new code is not recommended.

Please use the updated version instead to ensure compatibility with future versions of the library.

This is an alias template used as the return type for functions that can either return a container, or fail with an error code. This is a brief synopsis of the type:

Declaration

template< class T >
class result
{
public:
    //
    // Return true if the result contains an error
    //
    constexpr bool has_error() const noexcept;

    //
    // Return the error
    //
    constexpr system::error_code error() const noexcept;

    //
    // Return true if the result contains a value
    //
    constexpr bool has_value() const noexcept;
    constexpr explicit operator bool() const noexcept;

    //
    // Return the value, or throw an exception
    //
    constexpr T& value();
    constexpr T const& value() const;

    // Return the value.
    // Precondition: has_value()==true
    //
    constexpr T& operator*() noexcept;
    constexpr T* operator->() noexcept;
    constexpr T const& operator*() const noexcept;
    constexpr T const* operator->() const noexcept;

    ...more

Usage

Given the function parse_uri with this signature:

system::result< url_view > parse_uri( core::string_view s ) noexcept;

The following statement captures the value in a variable upon success, otherwise throws:

url_view u = parse_uri( "http://example.com/path/to/file.txt" ).value();

This statement captures the result in a local variable and inspects the error condition:

system::result< url_view > rv = parse_uri( "http://example.com/path/to/file.txt" );

if(! rv )
    std::cout << rv.error();
else
    std::cout << *rv;

See Also

boost::urls::string_token

Types

Functions

Name

Description

append_to

assign_to

preserve_size

boost::urls::string_token::arg

Base class for string tokens, and algorithm parameters

Synopsis

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

struct arg;

Member Functions

Name

Description

arg [constructor]

operator=

prepare

Return a modifiable character buffer

~arg [destructor]

Description

This abstract interface provides a means for an algorithm to generically obtain a modifiable, contiguous character buffer of prescribed size. As the author of an algorithm simply declare an rvalue reference as a parameter type.

Instances of this type are intended only to be used once and then destroyed.

Example

The declared function accepts any temporary instance of arg to be used for writing:

void algorithm( string_token::arg&& dest );

To implement the interface for your type or use-case, derive from the class and implement the prepare function.

boost::urls::string_token::arg::prepare

Return a modifiable character buffer

Synopsis

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

virtual
char*
prepare(std::size_t n) = 0;

Description

This function attempts to obtain a character buffer with space for at least n characters. Upon success, a pointer to the beginning of the buffer is returned. Ownership is not transferred; the caller should not attempt to free the storage. The buffer shall remain valid until this is destroyed.

Note
This function may only be called once. After invoking the function, the only valid operation is destruction.

boost::urls::string_token::arg::~arg

Synopsis

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

virtual
~arg() = default;

boost::urls::string_token::arg::arg

Members

constexpr
arg() = default;
  » more...
constexpr
arg(arg&&) = default;
  » more...
arg(arg const&) = delete;
  » more...

boost::urls::string_token::arg::operator=

Members

arg&
operator=(arg&&) = delete;
  » more...
arg&
operator=(arg const&) = delete;
  » more...

boost::urls::string_token::is_token

Synopsis

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

template<
    class T,
    class = void>
struct is_token
    : std::false_type;

boost::urls::string_token::is_token

Synopsis

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

template<class T>
struct is_token<T, void_t<decltype(std::declval<T&>().prepare(
                std::declval<std::size_t>())), decltype(std::declval<T&>().result())>>
    : std::integral_constant<bool, std::is_convertible<decltype(std::declval<T &>().result()), typename T::result_type>::value && std::is_same<decltype(std::declval<T &>().prepare(0)), char *>::value && std::is_base_of<arg, T>::value && std::is_convertible<const volatile T *, const volatile arg *>::value>;

boost::urls::string_token::return_string

Synopsis

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

struct return_string
    : arg;

Types

Name

Description

result_type

Member Functions

Name

Description

operator=

prepare

Return a modifiable character buffer

result

boost::urls::string_token::return_string::result_type

Synopsis

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

using result_type = std::string;

boost::urls::string_token::return_string::prepare

Synopsis

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

virtual
char*
prepare(std::size_t n) override;

boost::urls::string_token::return_string::result

Synopsis

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

result_type
result() noexcept;

boost::urls::string_token::append_to_t

Synopsis

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

template<class Alloc>
struct append_to_t
    : arg;

Types

Name

Description

result_type

string_type

Member Functions

Name

Description

append_to_t [constructor]

operator=

prepare

Return a modifiable character buffer

result

boost::urls::string_token::append_to_t::string_type

Synopsis

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

using string_type = std::basic_string<char, std::char_traits<char>, Alloc>;

boost::urls::string_token::append_to_t::result_type

Synopsis

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

using result_type = string_type&;

boost::urls::string_token::append_to_t::append_to_t

Synopsis

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

explicit
append_to_t(string_type& s) noexcept;

boost::urls::string_token::append_to_t::prepare

Synopsis

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

virtual
char*
prepare(std::size_t n) override;

boost::urls::string_token::append_to_t::result

Synopsis

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

result_type
result() noexcept;

boost::urls::string_token::append_to

Synopsis

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

template<class Alloc = std::allocator<char>>
append_to_t<Alloc>
append_to(std::basic_string<char, std::char_traits<char>, Alloc>& s);

boost::urls::string_token::assign_to_t

Synopsis

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

template<class Alloc>
struct assign_to_t
    : arg;

Types

Name

Description

result_type

string_type

Member Functions

Name

Description

assign_to_t [constructor]

operator=

prepare

Return a modifiable character buffer

result

boost::urls::string_token::assign_to_t::string_type

Synopsis

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

using string_type = std::basic_string<char, std::char_traits<char>, Alloc>;

boost::urls::string_token::assign_to_t::result_type

Synopsis

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

using result_type = string_type&;

boost::urls::string_token::assign_to_t::assign_to_t

Synopsis

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

explicit
assign_to_t(string_type& s) noexcept;

boost::urls::string_token::assign_to_t::prepare

Synopsis

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

virtual
char*
prepare(std::size_t n) override;

boost::urls::string_token::assign_to_t::result

Synopsis

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

result_type
result() noexcept;

boost::urls::string_token::assign_to

Synopsis

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

template<class Alloc = std::allocator<char>>
assign_to_t<Alloc>
assign_to(std::basic_string<char, std::char_traits<char>, Alloc>& s);

boost::urls::string_token::preserve_size_t

Synopsis

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

template<class Alloc>
struct preserve_size_t
    : arg;

Types

Name

Description

result_type

string_type

Member Functions

Name

Description

operator=

prepare

Return a modifiable character buffer

preserve_size_t [constructor]

result

boost::urls::string_token::preserve_size_t::result_type

Synopsis

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

using result_type = core::string_view;

boost::urls::string_token::preserve_size_t::string_type

Synopsis

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

using string_type = std::basic_string<char, std::char_traits<char>, Alloc>;

boost::urls::string_token::preserve_size_t::preserve_size_t

Synopsis

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

explicit
preserve_size_t(string_type& s) noexcept;

boost::urls::string_token::preserve_size_t::prepare

Synopsis

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

virtual
char*
prepare(std::size_t n) override;

boost::urls::string_token::preserve_size_t::result

Synopsis

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

result_type
result() noexcept;

boost::urls::string_token::preserve_size

Synopsis

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

template<class Alloc = std::allocator<char>>
preserve_size_t<Alloc>
preserve_size(std::basic_string<char, std::char_traits<char>, Alloc>& s);

boost::urls::grammar

Types

Enums

Name

Description

condition

Error conditions for errors received from rules

error

Error codes returned when using rules

Functions

Name

Description

ci_compare

Return the case-insensitive comparison of s0 and s1

ci_digest

Return the case-insensitive digest of a string

ci_is_equal

ci_is_less

Return true if s0 is less than s1 using case-insensitive comparison

delim_rule

find_if

Find the first character in the string that is in the set.

find_if_not

Find the first character in the string that is not in CharSet

hash_value

Return the hash of this value

hexdig_value

Return the decimal value of a hex character

make_error_code

make_error_condition

not_empty_rule

operator!=

operator+

Return the union of two character sets.

operator-

Return a new character set by subtracting

operator<

operator<<

Format a string to an output stream

operator⇐

operator==

operator>

operator>=

optional_rule

parse

Parse a character buffer using a rule

range_rule

ref

squelch

to_lower

Return c converted to lowercase

to_upper

Return c converted to uppercase

token_rule

tuple_rule

variant_rule

Variables

Name

Description

all_chars

A character set containing all characters.

alnum_chars

alpha_chars

A character set containing the alphabetical characters.

dec_octet_rule

digit_chars

hexdig_chars

vchars

boost::urls::grammar::string_token

Synopsis

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

namespace string_token = boost::urls::string_token;

boost::urls::grammar::string_view_base

Common functionality for string views

Synopsis

class string_view_base;

Types

Name

Description

const_iterator

The const iterator type

const_pointer

The const pointer type

const_reference

The const reference type

const_reverse_iterator

The const reverse iterator type

difference_type

The difference type

iterator

The iterator type

pointer

The pointer type

reference

The reference type

reverse_iterator

The reverse iterator type

size_type

The size type

traits_type

The character traits

value_type

The value type

Member Functions

Name

Description

at

Access a character

back

Return the last character

begin

Return an iterator to the beginning

cbegin

Return an iterator to the beginning

cend

Return an iterator to the end

compare

Return the result of comparing to another string

contains

Return true if matching characters are found

copy

Copy the characters to another buffer

crbegin

crend

data

Return a pointer to the character buffer

empty

Return true if the string is empty

end

Return an iterator to the end

ends_with

Return true if a matching suffix exists

find

Return the position of matching characters

find_first_not_of

Return the position of the first non-match

find_first_of

Return the position of the first match

find_last_not_of

Return the position of the last non-match

find_last_of

Return the position of the last match

front

Return the first character

length

Return the size

max_size

Return the maximum allowed size

operator core::string_view

Conversion

operator std::string

Conversion

operator[]

Access a character

rbegin

rend

rfind

Return the position of matching characters

size

Return the size

starts_with

Return true if a matching prefix exists

substr

Return a view to part of the string

Static Data Members

Name

Description

npos

A constant used to represent "no position"

Friends

Name

Description

hash_value

Return the hash of this value

operator!=

operator<

operator<<

operator⇐

operator==

operator>

operator>=

Description

This base class is used to provide common member functions for reference types that behave like string views. This cannot be instantiated directly; Instead, derive from the type and provide constructors which offer any desired preconditions and invariants.

boost::urls::grammar::string_view_base::traits_type

The character traits

Synopsis

typedef std::char_traits<char> traits_type;

boost::urls::grammar::string_view_base::value_type

The value type

Synopsis

typedef char value_type;

boost::urls::grammar::string_view_base::pointer

The pointer type

Synopsis

typedef char* pointer;

boost::urls::grammar::string_view_base::const_pointer

The const pointer type

Synopsis

typedef char const* const_pointer;

boost::urls::grammar::string_view_base::reference

The reference type

Synopsis

typedef char& reference;

boost::urls::grammar::string_view_base::const_reference

The const reference type

Synopsis

typedef char const& const_reference;

boost::urls::grammar::string_view_base::const_iterator

The const iterator type

Synopsis

typedef char const* const_iterator;

boost::urls::grammar::string_view_base::iterator

The iterator type

Synopsis

typedef const_iterator iterator;

boost::urls::grammar::string_view_base::const_reverse_iterator

The const reverse iterator type

Synopsis

typedef std::reverse_iterator<const_iterator> const_reverse_iterator;

boost::urls::grammar::string_view_base::reverse_iterator

The reverse iterator type

Synopsis

typedef const_reverse_iterator reverse_iterator;

boost::urls::grammar::string_view_base::size_type

The size type

Synopsis

typedef std::size_t size_type;

boost::urls::grammar::string_view_base::difference_type

The difference type

Synopsis

typedef std::ptrdiff_t difference_type;

boost::urls::grammar::string_view_base::npos

A constant used to represent "no position"

Synopsis

constexpr
static
std::size_t const npos = core::string_view::npos;

boost::urls::grammar::string_view_base::operator core::string_view

Conversion

Synopsis

operator core::string_view() const noexcept;

boost::urls::grammar::string_view_base::operator std::string

Conversion

Synopsis

explicit
operator std::string() const noexcept;

Description

Conversion to std::string is explicit because assigning to string using an implicit constructor does not preserve capacity.

boost::urls::grammar::string_view_base::begin

Return an iterator to the beginning

Synopsis

constexpr
const_iterator
begin() const noexcept;

Description

See core::string_view::begin

boost::urls::grammar::string_view_base::end

Return an iterator to the end

Synopsis

constexpr
const_iterator
end() const noexcept;

Description

See core::string_view::end

boost::urls::grammar::string_view_base::cbegin

Return an iterator to the beginning

Synopsis

constexpr
const_iterator
cbegin() const noexcept;

Description

See core::string_view::cbegin

boost::urls::grammar::string_view_base::cend

Return an iterator to the end

Synopsis

constexpr
const_iterator
cend() const noexcept;

Description

See core::string_view::cend

boost::urls::grammar::string_view_base::rbegin

Synopsis

constexpr
const_reverse_iterator
rbegin() const noexcept;

boost::urls::grammar::string_view_base::rend

Synopsis

constexpr
const_reverse_iterator
rend() const noexcept;

boost::urls::grammar::string_view_base::crbegin

Synopsis

constexpr
const_reverse_iterator
crbegin() const noexcept;

boost::urls::grammar::string_view_base::crend

Synopsis

constexpr
const_reverse_iterator
crend() const noexcept;

boost::urls::grammar::string_view_base::size

Return the size

Synopsis

constexpr
size_type
size() const noexcept;

Description

See core::string_view::size

boost::urls::grammar::string_view_base::length

Return the size

Synopsis

constexpr
size_type
length() const noexcept;

Description

See core::string_view::length

boost::urls::grammar::string_view_base::max_size

Return the maximum allowed size

Synopsis

constexpr
size_type
max_size() const noexcept;

Description

See core::string_view::max_size

boost::urls::grammar::string_view_base::empty

Return true if the string is empty

Synopsis

constexpr
bool
empty() const noexcept;

Description

See core::string_view::size

boost::urls::grammar::string_view_base::operator[]

Access a character

Synopsis

constexpr
const_reference
operator[](size_type pos) const noexcept;

Description

See core::string_view::operator[]

boost::urls::grammar::string_view_base::at

Access a character

Synopsis

constexpr
const_reference
at(size_type pos) const;

Description

See core::string_view::at

boost::urls::grammar::string_view_base::front

Return the first character

Synopsis

constexpr
const_reference
front() const noexcept;

Description

See core::string_view::front

boost::urls::grammar::string_view_base::back

Return the last character

Synopsis

constexpr
const_reference
back() const noexcept;

Description

See core::string_view::back

boost::urls::grammar::string_view_base::data

Return a pointer to the character buffer

Synopsis

constexpr
const_pointer
data() const noexcept;

Description

See core::string_view::data

boost::urls::grammar::string_view_base::copy

Copy the characters to another buffer

Synopsis

constexpr
size_type
copy(
    char* s,
    size_type n,
    size_type pos = 0) const;

Description

See core::string_view::copy

boost::urls::grammar::string_view_base::substr

Return a view to part of the string

Synopsis

constexpr
core::string_view
substr(
    size_type pos = 0,
    size_type n = core::string_view::npos) const;

Description

See core::string_view::substr

boost::urls::grammar::string_view_base::compare

Members

Return the result of comparing to another string

constexpr
int
compare(core::string_view str) const noexcept;
  » more...

Return the result of comparing to another string

constexpr
int
compare(
    size_type pos1,
    size_type n1,
    core::string_view str) const;
  » more...

Return the result of comparing to another string

constexpr
int
compare(
    size_type pos1,
    size_type n1,
    core::string_view str,
    size_type pos2,
    size_type n2) const;
  » more...

Return the result of comparing to another string

constexpr
int
compare(char const* s) const noexcept;
  » more...

Return the result of comparing to another string

constexpr
int
compare(
    size_type pos1,
    size_type n1,
    char const* s) const;
  » more...

Return the result of comparing to another string

constexpr
int
compare(
    size_type pos1,
    size_type n1,
    char const* s,
    size_type n2) const;
  » more...

boost::urls::grammar::string_view_base::starts_with

Members

Return true if a matching prefix exists

constexpr
bool
starts_with(core::string_view x) const noexcept;
  » more...

Return true if a matching prefix exists

constexpr
bool
starts_with(char x) const noexcept;
  » more...

Return true if a matching prefix exists

constexpr
bool
starts_with(char const* x) const noexcept;
  » more...

boost::urls::grammar::string_view_base::ends_with

Members

Return true if a matching suffix exists

constexpr
bool
ends_with(core::string_view x) const noexcept;
  » more...

Return true if a matching suffix exists

constexpr
bool
ends_with(char x) const noexcept;
  » more...

Return true if a matching suffix exists

constexpr
bool
ends_with(char const* x) const noexcept;
  » more...

boost::urls::grammar::string_view_base::find

Members

Return the position of matching characters

constexpr
size_type
find(
    core::string_view str,
    size_type pos = 0) const noexcept;
  » more...

Return the position of matching characters

constexpr
size_type
find(
    char c,
    size_type pos = 0) const noexcept;
  » more...

Return the position of matching characters

constexpr
size_type
find(
    char const* s,
    size_type pos,
    size_type n) const noexcept;
  » more...

Return the position of matching characters

constexpr
size_type
find(
    char const* s,
    size_type pos = 0) const noexcept;
  » more...

boost::urls::grammar::string_view_base::rfind

Members

Return the position of matching characters

constexpr
size_type
rfind(
    core::string_view str,
    size_type pos = core::string_view::npos) const noexcept;
  » more...

Return the position of matching characters

constexpr
size_type
rfind(
    char c,
    size_type pos = core::string_view::npos) const noexcept;
  » more...

Return the position of matching characters

constexpr
size_type
rfind(
    char const* s,
    size_type pos,
    size_type n) const noexcept;
  » more...

Return the position of matching characters

constexpr
size_type
rfind(
    char const* s,
    size_type pos = core::string_view::npos) const noexcept;
  » more...

boost::urls::grammar::string_view_base::find_first_of

Members

Return the position of the first match

constexpr
size_type
find_first_of(
    core::string_view str,
    size_type pos = 0) const noexcept;
  » more...

Return the position of the first match

constexpr
size_type
find_first_of(
    char c,
    size_type pos = 0) const noexcept;
  » more...

Return the position of the first match

constexpr
size_type
find_first_of(
    char const* s,
    size_type pos,
    size_type n) const noexcept;
  » more...

Return the position of the first match

constexpr
size_type
find_first_of(
    char const* s,
    size_type pos = 0) const noexcept;
  » more...

boost::urls::grammar::string_view_base::find_last_of

Members

Return the position of the last match

constexpr
size_type
find_last_of(
    core::string_view str,
    size_type pos = core::string_view::npos) const noexcept;
  » more...

Return the position of the last match

constexpr
size_type
find_last_of(
    char c,
    size_type pos = core::string_view::npos) const noexcept;
  » more...

Return the position of the last match

constexpr
size_type
find_last_of(
    char const* s,
    size_type pos,
    size_type n) const noexcept;
  » more...

Return the position of the last match

constexpr
size_type
find_last_of(
    char const* s,
    size_type pos = core::string_view::npos) const noexcept;
  » more...

boost::urls::grammar::string_view_base::find_first_not_of

Members

Return the position of the first non-match

constexpr
size_type
find_first_not_of(
    core::string_view str,
    size_type pos = 0) const noexcept;
  » more...

Return the position of the first non-match

constexpr
size_type
find_first_not_of(
    char c,
    size_type pos = 0) const noexcept;
  » more...

Return the position of the first non-match

constexpr
size_type
find_first_not_of(
    char const* s,
    size_type pos,
    size_type n) const noexcept;
  » more...

Return the position of the first non-match

constexpr
size_type
find_first_not_of(
    char const* s,
    size_type pos = 0) const noexcept;
  » more...

boost::urls::grammar::string_view_base::find_last_not_of

Members

Return the position of the last non-match

constexpr
size_type
find_last_not_of(
    core::string_view str,
    size_type pos = core::string_view::npos) const noexcept;
  » more...

Return the position of the last non-match

constexpr
size_type
find_last_not_of(
    char c,
    size_type pos = core::string_view::npos) const noexcept;
  » more...

Return the position of the last non-match

constexpr
size_type
find_last_not_of(
    char const* s,
    size_type pos,
    size_type n) const noexcept;
  » more...

Return the position of the last non-match

constexpr
size_type
find_last_not_of(
    char const* s,
    size_type pos = core::string_view::npos) const noexcept;
  » more...

boost::urls::grammar::string_view_base::contains

Members

Return true if matching characters are found

constexpr
bool
contains(core::string_view sv) const noexcept;
  » more...

Return true if matching characters are found

constexpr
bool
contains(char c) const noexcept;
  » more...

Return true if matching characters are found

constexpr
bool
contains(char const* s) const noexcept;
  » more...

boost::urls::grammar::operator==

Synopsis

template<
    class S0,
    class S1>
friend
constexpr
bool
operator==(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::grammar::operator!=

Synopsis

template<
    class S0,
    class S1>
friend
constexpr
bool
operator!=(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::grammar::operator<

Synopsis

template<
    class S0,
    class S1>
friend
constexpr
bool
operator<(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::grammar::operator⇐

Synopsis

template<
    class S0,
    class S1>
friend
constexpr
bool
operator<=(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::grammar::operator>

Synopsis

template<
    class S0,
    class S1>
friend
constexpr
bool
operator>(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::grammar::operator>=

Synopsis

template<
    class S0,
    class S1>
friend
constexpr
bool
operator>=(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::grammar::hash_value

Return the hash of this value

Synopsis

friend
std::size_t
hash_value(string_view_base const& s) noexcept;

boost::urls::grammar::operator<<

Synopsis

friend
std::ostream&
operator<<(
    std::ostream& os,
    string_view_base const& s);

boost::urls::grammar::operator==

Synopsis

template<
    class S0,
    class S1>
constexpr
bool
operator==(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::grammar::operator!=

Synopsis

template<
    class S0,
    class S1>
constexpr
bool
operator!=(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::grammar::operator<

Synopsis

template<
    class S0,
    class S1>
constexpr
bool
operator<(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::grammar::operator⇐

Synopsis

template<
    class S0,
    class S1>
constexpr
bool
operator<=(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::grammar::operator>

Synopsis

template<
    class S0,
    class S1>
constexpr
bool
operator>(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::grammar::operator>=

Synopsis

template<
    class S0,
    class S1>
constexpr
bool
operator>=(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::grammar::hash_value

Return the hash of this value

Synopsis

std::size_t
hash_value(string_view_base const& s) noexcept;

boost::urls::grammar::operator<<

Format a string to an output stream

Synopsis

std::ostream&
operator<<(
    std::ostream& os,
    string_view_base const& s);

boost::urls::grammar::all_chars_t

Synopsis

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

struct all_chars_t;

Member Functions

Name

Description

all_chars_t [constructor]

find_if

find_if_not

operator()

boost::urls::grammar::all_chars_t::all_chars_t

Synopsis

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

constexpr
all_chars_t() noexcept = default;

boost::urls::grammar::all_chars_t::operator()

Synopsis

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

constexpr
bool
operator()(char) const noexcept;

boost::urls::grammar::all_chars_t::find_if

Synopsis

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

char const*
find_if(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::all_chars_t::find_if_not

Synopsis

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

char const*
find_if_not(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::all_chars

A character set containing all characters.

Synopsis

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

constexpr
all_chars_t const all_chars = {};

See Also

boost::urls::grammar::hexdig_chars_t

Synopsis

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

struct hexdig_chars_t;

Member Functions

Name

Description

find_if

find_if_not

operator()

Return true if c is in the character set.

boost::urls::grammar::hexdig_chars_t::operator()

Return true if c is in the character set.

Synopsis

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

constexpr
bool
operator()(char c) const noexcept;

boost::urls::grammar::hexdig_chars_t::find_if

Synopsis

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

char const*
find_if(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::hexdig_chars_t::find_if_not

Synopsis

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

char const*
find_if_not(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::hexdig_chars

Synopsis

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

constexpr
hexdig_chars_t const hexdig_chars = {};

boost::urls::grammar::hexdig_value

Return the decimal value of a hex character

Synopsis

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

signed char
hexdig_value(char ch) noexcept;

Description

This function returns the decimal value of a hexadecimal character, or -1 if the argument is not a valid hexadecimal digit.

BNF

HEXDIG      = DIGIT
            / "A" / "B" / "C" / "D" / "E" / "F"
            / "a" / "b" / "c" / "d" / "e" / "f"

Return Value

The decimal value or -1

Parameters

Name Description

ch

The character to check

boost::urls::grammar::is_charset

Synopsis

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

template<
    class T,
    class = void>
struct is_charset
    : std::false_type;

boost::urls::grammar::is_charset

Synopsis

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

template<class T>
struct is_charset<T, void_t<decltype(std::declval<bool&>() =
                std::declval<T const&>().operator()(
                    std::declval<char>()))>>
    : std::true_type;

boost::urls::grammar::find_if

Find the first character in the string that is in the set.

Synopsis

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

template<class CharSet>
char const*
find_if(
    char const const* first,
    char const const* last,
    CharSet const& cs) noexcept;

Description

Exception Safety

Throws nothing.

Return Value

A pointer to the found character, otherwise the value last.

Parameters

Name Description

first

A pointer to the first character in the string to search.

last

A pointer to one past the last character in the string to search.

cs

The character set to use.

See Also

boost::urls::grammar::find_if_not

Find the first character in the string that is not in CharSet

Synopsis

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

template<class CharSet>
char const*
find_if_not(
    char const const* first,
    char const const* last,
    CharSet const& cs) noexcept;

Description

Exception Safety

Throws nothing.

Return Value

A pointer to the found character, otherwise the value last.

Parameters

Name Description

first

A pointer to the first character in the string to search.

last

A pointer to one past the last character in the string to search.

cs

The character set to use.

See Also

boost::urls::grammar::ref

Members

template<class CharSet>
constexpr
detail::charset_ref<CharSet>
ref(CharSet const& cs) noexcept;
  » more...
template<class Rule>
constexpr
detail::rule_ref<Rule>
ref(Rule const& r) noexcept;
  » more...
constexpr
void
ref(...) = delete;
  » more...

boost::urls::grammar::is_rule

Synopsis

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

template<
    class T,
    class = void>
struct is_rule
    : std::false_type;

boost::urls::grammar::is_rule

Synopsis

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

template<class T>
struct is_rule<T, void_t<decltype(std::declval<system::result<typename T::value_type>&>() =
                std::declval<T const&>().parse(
                    std::declval<char const*&>(),
                    std::declval<char const*>()))>>
    : std::is_nothrow_copy_constructible<T>;

boost::urls::grammar::lut_chars

A set of characters

Synopsis

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

class lut_chars;

Member Functions

Name

Description

find_if

find_if_not

lut_chars [constructor]

Constructor

operator()

Return true if ch is in the character set.

operator~

Return a new character set which is the complement of another character set.

Friends

Name

Description

operator+

Return the union of two character sets.

operator-

Return a new character set by subtracting

Description

The characters defined by instances of this set are provided upon construction. The constexpr implementation allows these to become compile-time constants.

Example

Character sets are used with rules and the functions find_if and find_if_not .

constexpr lut_chars vowel_chars = "AEIOU" "aeiou";

system::result< core::string_view > rv = parse( "Aiea", token_rule( vowel_chars ) );

See Also

boost::urls::grammar::lut_chars::lut_chars

Members

Constructor

constexpr
lut_chars(char ch) noexcept;
  » more...

Constructor

constexpr
lut_chars(char const* s) noexcept;
  » more...
template<
    class Pred,
    class = void>
constexpr
lut_chars(Pred const& pred) noexcept;
  » more...

boost::urls::grammar::lut_chars::operator()

Members

Return true if ch is in the character set.

constexpr
bool
operator()(unsigned char ch) const noexcept;
  » more...

Return true if ch is in the character set.

constexpr
bool
operator()(char ch) const noexcept;
  » more...

boost::urls::grammar::operator+

Return the union of two character sets.

Synopsis

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

friend
constexpr
lut_chars
operator+(
    lut_chars const& cs0,
    lut_chars const& cs1) noexcept;

Description

This function returns a new character set which contains all of the characters in cs0 as well as all of the characters in cs.

Example

This creates a character set which includes all letters and numbers

constexpr lut_chars alpha_chars(
    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    "abcdefghijklmnopqrstuvwxyz");

constexpr lut_chars alnum_chars = alpha_chars + "0123456789";

Complexity

Constant.

boost::urls::grammar::operator-

Return a new character set by subtracting

Synopsis

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

friend
constexpr
lut_chars
operator-(
    lut_chars const& cs0,
    lut_chars const& cs1) noexcept;

Description

This function returns a new character set which is formed from all of the characters in cs0 which are not in cs.

Example

This statement declares a character set containing all the lowercase letters which are not vowels:

constexpr lut_chars consonants = lut_chars("abcdefghijklmnopqrstuvwxyz") - "aeiou";

Complexity

Constant.

boost::urls::grammar::lut_chars::operator~

Return a new character set which is the complement of another character set.

Synopsis

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

constexpr
lut_chars
operator~() const noexcept;

Description

This function returns a new character set which contains all of the characters that are not in *this.

Example

This statement declares a character set containing everything but vowels:

constexpr lut_chars not_vowels = ~lut_chars( "AEIOU" "aeiou" );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

The new character set.

boost::urls::grammar::lut_chars::find_if

Synopsis

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

char const*
find_if(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::lut_chars::find_if_not

Synopsis

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

char const*
find_if_not(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::operator+

Return the union of two character sets.

Synopsis

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

constexpr
lut_chars
operator+(
    lut_chars const& cs0,
    lut_chars const& cs1) noexcept;

Description

This function returns a new character set which contains all of the characters in cs0 as well as all of the characters in cs.

Example

This creates a character set which includes all letters and numbers

constexpr lut_chars alpha_chars(
    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    "abcdefghijklmnopqrstuvwxyz");

constexpr lut_chars alnum_chars = alpha_chars + "0123456789";

Complexity

Constant.

Return Value

The new character set.

Parameters

Name Description

cs0

A character to join

cs1

A character to join

boost::urls::grammar::operator-

Return a new character set by subtracting

Synopsis

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

constexpr
lut_chars
operator-(
    lut_chars const& cs0,
    lut_chars const& cs1) noexcept;

Description

This function returns a new character set which is formed from all of the characters in cs0 which are not in cs.

Example

This statement declares a character set containing all the lowercase letters which are not vowels:

constexpr lut_chars consonants = lut_chars("abcdefghijklmnopqrstuvwxyz") - "aeiou";

Complexity

Constant.

Return Value

The new character set.

Parameters

Name Description

cs0

A character set to join.

cs1

A character set to join.

boost::urls::grammar::parse

Members

Parse a character buffer using a rule

template<class Rule>
system::result<Rule::value_type>
parse(
    char const*& it,
    char const* end,
    Rule const& r);
  » more...

Parse a character buffer using a rule

template<class Rule>
system::result<Rule::value_type>
parse(
    core::string_view s,
    Rule const& r);
  » more...

boost::urls::grammar::error

Error codes returned when using rules

Synopsis

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

enum error : int;

Members

Name

Description

need_more

More input is needed to match the rule

mismatch

The rule did not match the input.

end_of_range

A rule reached the end of a range

leftover

Leftover input remaining after match.

invalid

A rule encountered unrecoverable invalid input.

out_of_range

An integer overflowed during parsing.

syntax

An unspecified syntax error was found.

See Also

boost::urls::grammar::error::need_more

More input is needed to match the rule

Synopsis

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

need_more = 1

Description

A rule reached the end of the input, resulting in a partial match. The error is recoverable; the caller may obtain more input if possible and attempt to parse the character buffer again. Custom rules should only return this error if it is completely unambiguous that the rule cannot be matched without more input.

boost::urls::grammar::error::mismatch

The rule did not match the input.

Synopsis

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

mismatch

Description

This error is returned when a rule fails to match the input. The error is recoverable; the caller may rewind the input pointer and attempt to parse again using a different rule.

boost::urls::grammar::error::end_of_range

A rule reached the end of a range

Synopsis

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

end_of_range

Description

This indicates that the input was consumed when parsing a range . The range_rule avoids rewinding the input buffer when this error is returned. Thus the consumed characters are be considered part of the range without contributing additional elements.

boost::urls::grammar::error::leftover

Leftover input remaining after match.

Synopsis

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

leftover

boost::urls::grammar::error::invalid

A rule encountered unrecoverable invalid input.

Synopsis

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

invalid

Description

This error is returned when input is matching but one of the requirements is violated. For example if a percent escape is found, but one or both characters that follow are not valid hexadecimal digits. This is usually an unrecoverable error.

boost::urls::grammar::error::out_of_range

An integer overflowed during parsing.

Synopsis

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

out_of_range

boost::urls::grammar::error::syntax

An unspecified syntax error was found.

Synopsis

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

syntax

boost::urls::grammar::condition

Error conditions for errors received from rules

Synopsis

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

enum condition : int;

Members

Name

Description

fatal

A fatal error in syntax was encountered.

See Also

error , parse .

boost::urls::grammar::condition::fatal

A fatal error in syntax was encountered.

Synopsis

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

fatal = 1

Description

This indicates that parsing cannot continue.

boost::urls::grammar::make_error_code

Synopsis

Declared in header <boost/url/grammar/impl/error.hpp>

system::error_code
make_error_code(error ev) noexcept;

boost::urls::grammar::make_error_condition

Synopsis

Declared in header <boost/url/grammar/impl/error.hpp>

system::error_condition
make_error_condition(condition c) noexcept;

boost::urls::grammar::to_lower

Return c converted to lowercase

Synopsis

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

constexpr
char
to_lower(char c) noexcept;

Description

This function returns the character, converting it to lowercase if it is uppercase. The function is defined only for low-ASCII characters.

Example

assert( to_lower( 'A' ) == 'a' );

Exception Safety

Throws nothing.

Return Value

The converted character

Parameters

Name Description

c

The character to convert

See Also

boost::urls::grammar::to_upper

Return c converted to uppercase

Synopsis

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

constexpr
char
to_upper(char c) noexcept;

Description

This function returns the character, converting it to uppercase if it is lowercase. The function is defined only for low-ASCII characters.

Example

assert( to_upper( 'a' ) == 'A' );

Exception Safety

Throws nothing.

Return Value

The converted character

Parameters

Name Description

c

The character to convert

See Also

boost::urls::grammar::ci_compare

Return the case-insensitive comparison of s0 and s1

Synopsis

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

int
ci_compare(
    core::string_view s0,
    core::string_view s1) noexcept;

Description

This returns the lexicographical comparison of two strings, ignoring case. The function is defined only for strings containing low-ASCII characters.

Example

assert( ci_compare( "boost", "Boost" ) == 0 );

Exception Safety

Throws nothing.

Return Value

0 if the strings are equal, -1 if s0 is less than s1, or 1 if s0 is greater than s1.

Parameters

Name Description

s0

The first string

s1

The second string

See Also

boost::urls::grammar::ci_digest

Return the case-insensitive digest of a string

Synopsis

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

std::size_t
ci_digest(core::string_view s) noexcept;

Description

The hash function is non-cryptographic and not hardened against algorithmic complexity attacks. Returned digests are suitable for usage in unordered containers. The function is defined only for strings containing low-ASCII characters.

Return Value

The digest

Parameters

Name Description

s

The string

boost::urls::grammar::ci_is_equal

Members

template<
    class String0,
    class String1>
bool
ci_is_equal(
    String0 const& s0,
    String1 const& s1);
  » more...
bool
ci_is_equal(
    core::string_view s0,
    core::string_view s1) noexcept;
  » more...

boost::urls::grammar::ci_is_less

Return true if s0 is less than s1 using case-insensitive comparison

Synopsis

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

bool
ci_is_less(
    core::string_view s0,
    core::string_view s1) noexcept;

Description

The comparison algorithm implements a case-insensitive total order on the set of all strings; however, it is not a lexicographical comparison. The function is defined only for strings containing low-ASCII characters.

Example

assert( ! ci_is_less( "Boost", "boost" ) );

See Also

boost::urls::grammar::ci_hash

Synopsis

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

struct ci_hash;

Types

Name

Description

is_transparent

Member Functions

Name

Description

operator()

boost::urls::grammar::ci_hash::is_transparent

Synopsis

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

using is_transparent = void;

boost::urls::grammar::ci_hash::operator()

Synopsis

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

std::size_t
operator()(core::string_view s) const noexcept;

boost::urls::grammar::ci_equal

Synopsis

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

struct ci_equal;

Types

Name

Description

is_transparent

Member Functions

Name

Description

operator()

boost::urls::grammar::ci_equal::is_transparent

Synopsis

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

using is_transparent = void;

boost::urls::grammar::ci_equal::operator()

Synopsis

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

template<
    class String0,
    class String1>
bool
operator()(
    String0 s0,
    String1 s1) const noexcept;

boost::urls::grammar::ci_less

Synopsis

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

struct ci_less;

Types

Name

Description

is_transparent

Member Functions

Name

Description

operator()

boost::urls::grammar::ci_less::is_transparent

Synopsis

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

using is_transparent = void;

boost::urls::grammar::ci_less::operator()

Synopsis

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

std::size_t
operator()(
    core::string_view s0,
    core::string_view s1) const noexcept;

boost::urls::grammar::variant_rule_t

Synopsis

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

template<
    class R0,
    class... Rn>
class variant_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

Friends

Name

Description

variant_rule

boost::urls::grammar::variant_rule_t::value_type

Synopsis

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

using value_type = variant<R0::value_type, Rn::value_type...>;

boost::urls::grammar::variant_rule_t::parse

Synopsis

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

system::result<value_type>
parse(
    char const*& it,
    char const* end) const;

boost::urls::grammar::variant_rule

Synopsis

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

template<
    class R0_,
    class... Rn_>
friend
constexpr
variant_rule_t<R0_, Rn_...>
variant_rule(
    R0_ const& r0,
    Rn_ const&... rn) noexcept;

boost::urls::grammar::variant_rule

Members

template<
    class R0_,
    class... Rn_>
constexpr
variant_rule_t<R0_, Rn_...>
variant_rule(
    R0_ const& r0,
    Rn_ const&... rn) noexcept;
  » more...
template<
    class R0,
    class... Rn>
constexpr
variant_rule_t<R0, Rn...>
variant_rule(
    R0 const& r0,
    Rn const&... rn) noexcept;
  » more...

boost::urls::grammar::unsigned_rule

Synopsis

template<class Unsigned>
struct unsigned_rule;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

boost::urls::grammar::unsigned_rule::value_type

Synopsis

using value_type = Unsigned;

boost::urls::grammar::unsigned_rule::parse

Synopsis

system::result<value_type>
parse(
    char const*& it,
    char const* end) const noexcept;

boost::urls::grammar::digit_chars_t

Synopsis

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

struct digit_chars_t;

Member Functions

Name

Description

find_if

find_if_not

operator()

boost::urls::grammar::digit_chars_t::operator()

Synopsis

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

constexpr
bool
operator()(char c) const noexcept;

boost::urls::grammar::digit_chars_t::find_if

Synopsis

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

char const*
find_if(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::digit_chars_t::find_if_not

Synopsis

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

char const*
find_if_not(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::digit_chars

Synopsis

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

constexpr
digit_chars_t const digit_chars = {};

boost::urls::grammar::ch_delim_rule

Synopsis

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

struct ch_delim_rule;

Types

Name

Description

value_type

Member Functions

Name

Description

ch_delim_rule [constructor]

parse

boost::urls::grammar::ch_delim_rule::value_type

Synopsis

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

using value_type = core::string_view;

boost::urls::grammar::ch_delim_rule::ch_delim_rule

Synopsis

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

constexpr
ch_delim_rule(char ch) noexcept;

boost::urls::grammar::ch_delim_rule::parse

Synopsis

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

system::result<value_type>
parse(
    char const*& it,
    char const* end) const noexcept;

boost::urls::grammar::delim_rule

Members

constexpr
ch_delim_rule
delim_rule(char ch) noexcept;
  » more...
template<class CharSet>
constexpr
cs_delim_rule<CharSet>
delim_rule(CharSet const& cs) noexcept;
  » more...

boost::urls::grammar::cs_delim_rule

Synopsis

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

template<class CharSet>
struct cs_delim_rule;

Types

Name

Description

value_type

Member Functions

Name

Description

cs_delim_rule [constructor]

parse

boost::urls::grammar::cs_delim_rule::value_type

Synopsis

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

using value_type = core::string_view;

boost::urls::grammar::cs_delim_rule::cs_delim_rule

Synopsis

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

constexpr
cs_delim_rule(CharSet const& cs) noexcept;

boost::urls::grammar::cs_delim_rule::parse

Synopsis

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

system::result<value_type>
parse(
    char const*& it,
    char const* end) const noexcept;

boost::urls::grammar::optional_rule_t

Synopsis

template<class Rule>
struct optional_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

Friends

Name

Description

optional_rule

boost::urls::grammar::optional_rule_t::value_type

Synopsis

using value_type = boost::optional<Rule::value_type>;

boost::urls::grammar::optional_rule_t::parse

Synopsis

system::result<value_type>
parse(
    char const*& it,
    char const* end) const;

boost::urls::grammar::optional_rule

Synopsis

template<class R_>
friend
constexpr
optional_rule_t<R_>
optional_rule(R_ const& r);

boost::urls::grammar::optional_rule

Members

template<class R_>
constexpr
optional_rule_t<R_>
optional_rule(R_ const& r);
  » more...
template<class Rule>
constexpr
optional_rule_t<Rule>
optional_rule(Rule const& r);
  » more...

boost::urls::grammar::tuple_rule_t

Synopsis

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

template<
    class R0,
    class... Rn>
class tuple_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

Friends

Name

Description

tuple_rule

boost::urls::grammar::tuple_rule_t::value_type

Synopsis

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

using value_type = mp11::mp_eval_if_c<IsList, T, mp_first, T>;

boost::urls::grammar::tuple_rule

Synopsis

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

template<
    class R0_,
    class... Rn_>
friend
constexpr
tuple_rule_t<R0_, Rn_...>
tuple_rule(
    R0_ const& r0,
    Rn_ const&... rn) noexcept;

boost::urls::grammar::tuple_rule_t::parse

Synopsis

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

system::result<value_type>
parse(
    char const*& it,
    char const* end) const;

boost::urls::grammar::tuple_rule

Members

template<
    class R0_,
    class... Rn_>
constexpr
tuple_rule_t<R0_, Rn_...>
tuple_rule(
    R0_ const& r0,
    Rn_ const&... rn) noexcept;
  » more...
template<
    class R0,
    class... Rn>
constexpr
tuple_rule_t<R0, Rn...>
tuple_rule(
    R0 const& r0,
    Rn const&... rn) noexcept;
  » more...

boost::urls::grammar::squelch

Synopsis

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

template<class Rule>
constexpr
detail::squelch_rule_t<Rule>
squelch(Rule const& r) noexcept;

boost::urls::grammar::aligned_storage

Synopsis

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

template<class T>
using aligned_storage = detail::aligned_storage_impl<detail::nearest_pow2(sizeof(T), 64), (alignof(::max_align_t) > alignof(T)) ? alignof(::max_align_t) : alignof(T)>;

boost::urls::grammar::recycled

A thread-safe collection of instances of T

Synopsis

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

template<class T>
class recycled;

Member Functions

Name

Description

recycled [constructor]

Constructor

~recycled [destructor]

Destructor

Description

Instances of this type may be used to control where recycled instances of T come from when used with recycled_ptr .

Example

static recycled< std::string > bin;

recycled_ptr< std::string > ps( bin );

// Put the string into a known state
ps->clear();

See Also

boost::urls::grammar::recycled::~recycled

Destructor

Synopsis

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

~recycled();

Description

All recycled instances of T are destroyed. Undefined behavior results if there are any recycled_ptr which reference this recycle bin.

boost::urls::grammar::recycled::recycled

Constructor

Synopsis

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

constexpr
recycled() = default;

boost::urls::grammar::recycled_ptr

A pointer to shared instance of T

Synopsis

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

template<class T>
class recycled_ptr;

Member Functions

Name

Description

acquire

Return the referenced object

bin

Return the referenced recycle bin

empty

Return true if this does not reference an object

get

Return the referenced object

operator bool

Return true if this references an object

operator*

Return the referenced object

operator→

Return the referenced object

operator=

Assignment

recycled_ptr [constructor]

Constructor

release

Release the referenced object

~recycled_ptr [destructor]

Destructor

Description

This is a smart pointer container which can acquire shared ownership of an instance of T upon or after construction. The instance is guaranteed to be in a valid, but unknown state. Every recycled pointer references a valid recycle bin.

Example

static recycled< std::string > bin;

recycled_ptr< std::string > ps( bin );

// Put the string into a known state
ps->clear();

boost::urls::grammar::recycled_ptr::~recycled_ptr

Destructor

Synopsis

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

~recycled_ptr();

Description

If this is not empty, shared ownership of the pointee is released. If this was the last reference, the object is returned to the original recycle bin.

Effects

this->release();

boost::urls::grammar::recycled_ptr::recycled_ptr

Members

Constructor

explicit
recycled_ptr(recycled<T>& bin);
  » more...

Constructor

recycled_ptr(
    recycled<T>& bin,
    std::nullptr_t) noexcept;
  » more...

Constructor

Constructor

recycled_ptr(std::nullptr_t) noexcept;
  » more...

Constructor

recycled_ptr(recycled_ptr const& other) noexcept;
  » more...

Constructor

recycled_ptr(recycled_ptr&& other) noexcept;
  » more...

boost::urls::grammar::recycled_ptr::operator=

Members

Assignment

Assignment

recycled_ptr&
operator=(recycled_ptr const& other) noexcept;
  » more...

boost::urls::grammar::recycled_ptr::empty

Return true if this does not reference an object

Synopsis

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

bool
empty() const noexcept;

Description

Exception Safety

Throws nothing.

boost::urls::grammar::recycled_ptr::operator bool

Return true if this references an object

Synopsis

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

explicit
operator bool() const noexcept;

Description

Effects

return ! this->empty();

Exception Safety

Throws nothing.

boost::urls::grammar::recycled_ptr::bin

Return the referenced recycle bin

Synopsis

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

recycled<T>&
bin() const noexcept;

Description

Exception Safety

Throws nothing.

boost::urls::grammar::recycled_ptr::get

Return the referenced object

Synopsis

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

T*
get() const noexcept;

Description

If this is empty, nullptr is returned.

Exception Safety

Throws nothing.

boost::urls::grammar::recycled_ptr::operator→

Return the referenced object

Synopsis

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

T*
operator->() const noexcept;

Description

If this is empty, nullptr is returned.

Exception Safety

Throws nothing.

boost::urls::grammar::recycled_ptr::operator*

Return the referenced object

Synopsis

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

T&
operator*() const noexcept;

Description

Preconditions

not this->empty()

boost::urls::grammar::recycled_ptr::acquire

Return the referenced object

Synopsis

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

T&
acquire();

Description

If this references an object, it is returned. Otherwise, exclusive ownership of a new object of type T is acquired and returned.

Postconditions

not this->empty()

boost::urls::grammar::recycled_ptr::release

Release the referenced object

Synopsis

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

void
release() noexcept;

Description

If this references an object, it is released to the referenced recycle bin. The pointer continues to reference the same recycle bin.

Postconditions

this->empty()

Exception Safety

Throws nothing.

boost::urls::grammar::alpha_chars_t

Synopsis

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

struct alpha_chars_t;

Member Functions

Name

Description

alpha_chars_t [constructor]

find_if

find_if_not

operator()

boost::urls::grammar::alpha_chars_t::alpha_chars_t

Synopsis

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

constexpr
alpha_chars_t() noexcept = default;

boost::urls::grammar::alpha_chars_t::operator()

Synopsis

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

constexpr
bool
operator()(char c) const noexcept;

boost::urls::grammar::alpha_chars_t::find_if

Synopsis

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

char const*
find_if(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::alpha_chars_t::find_if_not

Synopsis

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

char const*
find_if_not(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::alpha_chars

A character set containing the alphabetical characters.

Synopsis

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

constexpr
alpha_chars_t const alpha_chars = {};

See Also

boost::urls::grammar::token_rule_t

Synopsis

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

template<class CharSet>
struct token_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

boost::urls::grammar::token_rule_t::value_type

Synopsis

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

using value_type = core::string_view;

boost::urls::grammar::token_rule_t::parse

Synopsis

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

system::result<value_type>
parse(
    char const*& it,
    char const* end) const noexcept;

boost::urls::grammar::token_rule

Synopsis

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

template<class CharSet>
constexpr
token_rule_t<CharSet>
token_rule(CharSet const& cs) noexcept;

boost::urls::grammar::range

A forward range of parsed elements

Synopsis

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

template<class T>
class range;

Types

Name

Description

const_iterator

A constant, forward iterator to elements of the range

const_reference

The type of each element of the range

difference_type

The type used to represent signed integers

iterator

A constant, forward iterator to elements of the range

pointer

Provided for compatibility, unused

reference

The type of each element of the range

size_type

The type used to represent unsigned integers

value_type

The type of each element of the range

Member Functions

Name

Description

begin

Return an iterator to the beginning

empty

Return true if the range is empty

end

Return an iterator to the end

operator=

Assignment

range [constructor]

Constructor

size

Return the number of elements in the range

string

Return the matching part of the string

~range [destructor]

Destructor

Description

Objects of this type are forward ranges returned when parsing using the range_rule . Iteration is performed by re-parsing the underlying character buffer. Ownership of the buffer is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced by the range.

Note
The implementation may use temporary, recycled storage for type-erasure. Objects of type range are intended to be used ephemerally. That is, for short durations such as within a function scope. If it is necessary to store the range for a long period of time or with static storage duration, it is necessary to copy the contents to an object of a different type.

See Also

boost::urls::grammar::range::value_type

The type of each element of the range

Synopsis

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

using value_type = T;

boost::urls::grammar::range::reference

The type of each element of the range

Synopsis

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

using reference = T const&;

boost::urls::grammar::range::const_reference

The type of each element of the range

Synopsis

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

using const_reference = T const&;

boost::urls::grammar::range::pointer

Provided for compatibility, unused

Synopsis

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

using pointer = void const*;

boost::urls::grammar::range::size_type

The type used to represent unsigned integers

Synopsis

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

using size_type = std::size_t;

boost::urls::grammar::range::difference_type

The type used to represent signed integers

Synopsis

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

using difference_type = std::ptrdiff_t;

boost::urls::grammar::range::iterator

A constant, forward iterator to elements of the range

Synopsis

class iterator;

Types

Member Functions

Name

Description

iterator [constructor]

operator!=

operator*

operator++

operator=

operator==

boost::urls::grammar::range::iterator::value_type

Synopsis

using value_type = T;

boost::urls::grammar::range::iterator::reference

Synopsis

using reference = T const&;

boost::urls::grammar::range::iterator::pointer

Synopsis

using pointer = void const*;

boost::urls::grammar::range::iterator::difference_type

Synopsis

using difference_type = std::ptrdiff_t;

boost::urls::grammar::range::iterator::iterator_category

Synopsis

using iterator_category = std::forward_iterator_tag;

boost::urls::grammar::range::iterator::iterator

Members

iterator() = default;
  » more...
iterator(iterator const&) = default;
  » more...

boost::urls::grammar::range::iterator::operator=

Synopsis

iterator&
operator=(iterator const&) = default;

boost::urls::grammar::range::iterator::operator*

Synopsis

reference
operator*() const noexcept;

boost::urls::grammar::range::iterator::operator==

Synopsis

bool
operator==(iterator const& other) const noexcept;

boost::urls::grammar::range::iterator::operator!=

Synopsis

bool
operator!=(iterator const& other) const noexcept;

boost::urls::grammar::range::iterator::operator++

Members

boost::urls::grammar::range::const_iterator

A constant, forward iterator to elements of the range

Synopsis

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

using const_iterator = iterator;

boost::urls::grammar::range::~range

Destructor

Synopsis

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

~range();

boost::urls::grammar::range::range

Members

Constructor

range() noexcept;
  » more...

Constructor

range(range&& other) noexcept;
  » more...

Constructor

range(range const& other) noexcept;
  » more...

boost::urls::grammar::range::operator=

Members

Assignment

range&
operator=(range&& other) noexcept;
  » more...

Assignment

range&
operator=(range const& other) noexcept;
  » more...

boost::urls::grammar::range::begin

Return an iterator to the beginning

Synopsis

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

iterator
begin() const noexcept;

boost::urls::grammar::range::end

Return an iterator to the end

Synopsis

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

iterator
end() const noexcept;

boost::urls::grammar::range::empty

Return true if the range is empty

Synopsis

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

bool
empty() const noexcept;

boost::urls::grammar::range::size

Return the number of elements in the range

Synopsis

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

std::size_t
size() const noexcept;

boost::urls::grammar::range::string

Return the matching part of the string

Synopsis

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

core::string_view
string() const noexcept;

boost::urls::grammar::range_rule_t

Synopsis

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

template<
    class R0,
    class R1 = void>
struct range_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

boost::urls::grammar::range_rule_t::value_type

Synopsis

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

using value_type = range<R0::value_type>;

boost::urls::grammar::range_rule_t::parse

Synopsis

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

system::result<value_type>
parse(
    char const*& it,
    char const* end) const;

boost::urls::grammar::range_rule_t

Synopsis

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

template<class R>
struct range_rule_t<R>;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

boost::urls::grammar::range_rule_t<R>::value_type

Synopsis

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

using value_type = range<R::value_type>;

boost::urls::grammar::range_rule_t<R>::parse

Synopsis

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

system::result<value_type>
parse(
    char const*& it,
    char const* end) const;

boost::urls::grammar::range_rule

Members

template<class Rule>
constexpr
range_rule_t<Rule>
range_rule(
    Rule const& next,
    std::size_t N = 0,
    std::size_t M = std::size_t(-1)) noexcept;
  » more...
template<
    class Rule1,
    class Rule2>
constexpr
range_rule_t<Rule1, Rule2>
range_rule(
    Rule1 const& first,
    Rule2 const& next,
    std::size_t N = 0,
    std::size_t M = std::size_t(-1)) noexcept;
  » more...

boost::urls::grammar::alnum_chars_t

Synopsis

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

struct alnum_chars_t;

Member Functions

Name

Description

find_if

find_if_not

operator()

boost::urls::grammar::alnum_chars_t::operator()

Synopsis

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

constexpr
bool
operator()(char c) const noexcept;

boost::urls::grammar::alnum_chars_t::find_if

Synopsis

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

char const*
find_if(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::alnum_chars_t::find_if_not

Synopsis

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

char const*
find_if_not(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::alnum_chars

Synopsis

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

constexpr
alnum_chars_t const alnum_chars = {};

boost::urls::grammar::vchars_t

Synopsis

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

struct vchars_t;

Member Functions

Name

Description

find_if

find_if_not

operator()

boost::urls::grammar::vchars_t::operator()

Synopsis

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

constexpr
bool
operator()(char c) const noexcept;

boost::urls::grammar::vchars_t::find_if

Synopsis

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

char const*
find_if(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::vchars_t::find_if_not

Synopsis

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

char const*
find_if_not(
    char const* first,
    char const* last) const noexcept;

boost::urls::grammar::vchars

Synopsis

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

constexpr
vchars_t const vchars = {};

boost::urls::grammar::dec_octet_rule_t

Synopsis

struct dec_octet_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

boost::urls::grammar::dec_octet_rule_t::value_type

Synopsis

using value_type = unsigned char;

boost::urls::grammar::dec_octet_rule_t::parse

Synopsis

system::result<value_type>
parse(
    char const*& it,
    char const* end) const noexcept;

boost::urls::grammar::dec_octet_rule

Synopsis

constexpr
dec_octet_rule_t const dec_octet_rule = {};

boost::urls::grammar::literal_rule

Synopsis

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

class literal_rule;

Types

Name

Description

value_type

Member Functions

Name

Description

literal_rule [constructor]

parse

boost::urls::grammar::literal_rule::value_type

Synopsis

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

using value_type = core::string_view;

boost::urls::grammar::literal_rule::literal_rule

Synopsis

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

constexpr
explicit
literal_rule(char const* s) noexcept;

boost::urls::grammar::literal_rule::parse

Synopsis

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

system::result<value_type>
parse(
    char const*& it,
    char const* end) const noexcept;

boost::urls::grammar::not_empty_rule_t

Synopsis

template<class R>
struct not_empty_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

Friends

Name

Description

not_empty_rule

boost::urls::grammar::not_empty_rule_t::value_type

Synopsis

using value_type = R::value_type;

boost::urls::grammar::not_empty_rule_t::parse

Synopsis

system::result<value_type>
parse(
    char const*& it,
    char const* end) const;

boost::urls::grammar::not_empty_rule

Synopsis

template<class R_>
friend
constexpr
not_empty_rule_t<R_>
not_empty_rule(R_ const& r);

boost::urls::grammar::not_empty_rule

Members

template<class R_>
constexpr
not_empty_rule_t<R_>
not_empty_rule(R_ const& r);
  » more...
template<class Rule>
constexpr
not_empty_rule_t<Rule>
not_empty_rule(Rule const& r);
  » more...

boost::urls::decode_view

A reference to a valid, percent-encoded string

Synopsis

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

class decode_view;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

The signed integer type

iterator

reference

The reference type

size_type

The unsigned integer type

value_type

The value type

Member Functions

Name

Description

back

Return the last character

begin

Return an iterator to the beginning

compare

Return the result of comparing to another string

decode_view [constructor]

Constructor

empty

Return true if the string is empty

end

Return an iterator to the end

ends_with

Checks if the string ends with the given prefix

find

Finds the first occurrence of character in this view

front

Return the first character

options

Return the decoding options

remove_prefix

Remove the first characters

remove_suffix

Remove the last characters

rfind

Finds the first occurrence of character in this view

size

Return the number of decoded characters

starts_with

Checks if the string begins with the given prefix

Friends

Description

These views reference strings in parts of URLs or other components that are percent-encoded. The special characters (those not in the allowed character set) are stored as three character escapes that consist of a percent sign ('%%') followed by a two-digit hexadecimal number of the corresponding unescaped character code, which may be part of a UTF-8 code point depending on the context.

The view refers to the original character buffer and only decodes escaped sequences when needed. In particular these operations perform percent-decoding automatically without the need to allocate memory:

  • Iteration of the string

  • Accessing the encoded character buffer

  • Comparison to encoded or plain strings

These objects can only be constructed from strings that have a valid percent-encoding, otherwise construction fails. The caller is responsible for ensuring that the lifetime of the character buffer from which the view is constructed extends unmodified until the view is no longer accessed.

Operators

The following operators are supported between decode_view and any object that is convertible to core::string_view

bool operator==( decode_view, decode_view ) noexcept;
bool operator!=( decode_view, decode_view ) noexcept;
bool operator<=( decode_view, decode_view ) noexcept;
bool operator< ( decode_view, decode_view ) noexcept;
bool operator> ( decode_view, decode_view ) noexcept;
bool operator>=( decode_view, decode_view ) noexcept;

boost::urls::decode_view::value_type

The value type

Synopsis

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

using value_type = char;

boost::urls::decode_view::reference

The reference type

Synopsis

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

using reference = char;

boost::urls::decode_view::const_reference

The reference type

Synopsis

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

using const_reference = char;

boost::urls::decode_view::size_type

The unsigned integer type

Synopsis

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

using size_type = std::size_t;

boost::urls::decode_view::difference_type

The signed integer type

Synopsis

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

using difference_type = std::ptrdiff_t;

boost::urls::decode_view::iterator

Synopsis

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

class iterator;

Types

Member Functions

boost::urls::decode_view::iterator::value_type

Synopsis

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

using value_type = char;

boost::urls::decode_view::iterator::reference

Synopsis

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

using reference = char;

boost::urls::decode_view::iterator::pointer

Synopsis

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

using pointer = void const*;

boost::urls::decode_view::iterator::const_reference

Synopsis

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

using const_reference = char;

boost::urls::decode_view::iterator::size_type

Synopsis

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

using size_type = std::size_t;

boost::urls::decode_view::iterator::difference_type

Synopsis

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

using difference_type = std::ptrdiff_t;

boost::urls::decode_view::iterator::iterator_category

Synopsis

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

using iterator_category = std::bidirectional_iterator_tag;

boost::urls::decode_view::iterator::iterator

Members

constexpr
iterator() = default;
  » more...
constexpr
iterator(iterator const&) = default;
  » more...

boost::urls::decode_view::iterator::operator=

Synopsis

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

constexpr
iterator&
operator=(iterator const&) = default;

boost::urls::decode_view::iterator::operator*

Synopsis

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

reference
operator*() const noexcept;

boost::urls::decode_view::iterator::operator++

Members

boost::urls::decode_view::iterator::operator--

Members

boost::urls::decode_view::iterator::base

Synopsis

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

char const*
base();

boost::urls::decode_view::iterator::operator==

Synopsis

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

bool
operator==(iterator const& other) const noexcept;

boost::urls::decode_view::iterator::operator!=

Synopsis

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

bool
operator!=(iterator const& other) const noexcept;

boost::urls::decode_view::const_iterator

Synopsis

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

using const_iterator = iterator;

boost::urls::decode_view::decode_view

Members

Constructor

constexpr
decode_view() noexcept = default;
  » more...

Constructor

explicit
decode_view(
    pct_string_view s,
    encoding_opts opt = = {}) noexcept;
  » more...

boost::urls::decode_view::empty

Return true if the string is empty

Synopsis

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

bool
empty() const noexcept;

Description

Example

assert( decode_view( "" ).empty() );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::decode_view::size

Return the number of decoded characters

Synopsis

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

size_type
size() const noexcept;

Description

Example

assert( decode_view( "Program%20Files" ).size() == 13 );

Effects

return std::distance( this->begin(), this->end() );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::decode_view::begin

Return an iterator to the beginning

Synopsis

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

iterator
begin() const noexcept;

Description

Example

auto it = this->begin();

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::decode_view::end

Return an iterator to the end

Synopsis

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

iterator
end() const noexcept;

Description

Example

auto it = this->end();

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::decode_view::front

Return the first character

Synopsis

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

reference
front() const noexcept;

Description

Example

assert( decode_view( "Program%20Files" ).front() == 'P' );

Preconditions

not this->empty()

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::decode_view::back

Return the last character

Synopsis

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

reference
back() const noexcept;

Description

Example

assert( decode_view( "Program%20Files" ).back() == 's' );

Preconditions

not this->empty()

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::decode_view::starts_with

Members

Checks if the string begins with the given prefix

bool
starts_with(core::string_view s) const noexcept;
  » more...

Checks if the string begins with the given prefix

bool
starts_with(char ch) const noexcept;
  » more...

boost::urls::decode_view::ends_with

Members

Checks if the string ends with the given prefix

bool
ends_with(core::string_view s) const noexcept;
  » more...

Checks if the string ends with the given prefix

bool
ends_with(char ch) const noexcept;
  » more...

boost::urls::decode_view::find

Finds the first occurrence of character in this view

Synopsis

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

const_iterator
find(char ch) const noexcept;

Description

Complexity

Linear.

Exception Safety

Throws nothing.

boost::urls::decode_view::rfind

Finds the first occurrence of character in this view

Synopsis

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

const_iterator
rfind(char ch) const noexcept;

Description

Complexity

Linear.

Exception Safety

Throws nothing.

boost::urls::decode_view::remove_prefix

Remove the first characters

Synopsis

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

void
remove_prefix(size_type n);

Description

Example

decode_view d( "Program%20Files" );
d.remove_prefix( 8 );
assert( d == "Files" );

Preconditions

not this->empty()

Complexity

Linear.

boost::urls::decode_view::remove_suffix

Remove the last characters

Synopsis

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

void
remove_suffix(size_type n);

Description

Example

decode_view d( "Program%20Files" );
d.remove_prefix( 6 );
assert( d == "Program" );

Preconditions

not this->empty()

Complexity

Linear.

boost::urls::decode_view::options

Return the decoding options

Synopsis

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

encoding_opts
options() const noexcept;

boost::urls::decode_view::compare

Members

Return the result of comparing to another string

int
compare(core::string_view other) const noexcept;
  » more...

Return the result of comparing to another string

int
compare(decode_view other) const noexcept;
  » more...

boost::urls::operator==

Synopsis

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

template<
    class S0,
    class S1>
friend
constexpr
bool
operator==(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::operator!=

Synopsis

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

template<
    class S0,
    class S1>
friend
constexpr
bool
operator!=(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::operator<

Synopsis

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

template<
    class S0,
    class S1>
friend
constexpr
bool
operator<(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::operator⇐

Synopsis

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

template<
    class S0,
    class S1>
friend
constexpr
bool
operator<=(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::operator>

Synopsis

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

template<
    class S0,
    class S1>
friend
constexpr
bool
operator>(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::operator>=

Synopsis

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

template<
    class S0,
    class S1>
friend
constexpr
bool
operator>=(
    S0 const& s0,
    S1 const& s1) noexcept;

boost::urls::operator<<

Synopsis

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

friend
std::ostream&
operator<<(
    std::ostream& os,
    decode_view const& s);

boost::urls::pct_string_view

A reference to a valid percent-encoded string

Synopsis

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

class pct_string_view
    : public grammar::string_view_base;

Types

Name

Description

const_iterator

The const iterator type

const_pointer

The const pointer type

const_reference

The const reference type

const_reverse_iterator

The const reverse iterator type

difference_type

The difference type

iterator

The iterator type

pointer

The pointer type

reference

The reference type

reverse_iterator

The reverse iterator type

size_type

The size type

traits_type

The character traits

value_type

The value type

Member Functions

Name

Description

at

Access a character

back

Return the last character

begin

Return an iterator to the beginning

cbegin

Return an iterator to the beginning

cend

Return an iterator to the end

compare

Return the result of comparing to another string

contains

Return true if matching characters are found

copy

Copy the characters to another buffer

crbegin

crend

data

Return a pointer to the character buffer

decode

Return the string with percent-decoding

decoded_size

Return the decoded size

empty

Return true if the string is empty

end

Return an iterator to the end

ends_with

Return true if a matching suffix exists

find

Return the position of matching characters

find_first_not_of

Return the position of the first non-match

find_first_of

Return the position of the first match

find_last_not_of

Return the position of the last non-match

find_last_of

Return the position of the last match

front

Return the first character

length

Return the size

max_size

Return the maximum allowed size

operator core::string_view

Conversion

operator std::string

Conversion

operator*

Return the string as a range of decoded characters

operator→

operator=

Assignment

operator[]

Access a character

pct_string_view [constructor]

Constructor

Constructor (deleted)

rbegin

rend

rfind

Return the position of matching characters

size

Return the size

starts_with

Return true if a matching prefix exists

substr

Return a view to part of the string

swap

Swap

Static Data Members

Name

Description

npos

A constant used to represent "no position"

Friends

Description

Objects of this type behave like a core::string_view and have the same interface, but offer an additional invariant: they can only be constructed from strings containing valid percent-escapes.

Attempting construction from a string containing invalid or malformed percent escapes results in an exception.

Operators

The following operators are supported between pct_string_view and any object that is convertible to core::string_view

bool operator==( pct_string_view, pct_string_view ) noexcept;
bool operator!=( pct_string_view, pct_string_view ) noexcept;
bool operator<=( pct_string_view, pct_string_view ) noexcept;
bool operator< ( pct_string_view, pct_string_view ) noexcept;
bool operator> ( pct_string_view, pct_string_view ) noexcept;
bool operator>=( pct_string_view, pct_string_view ) noexcept;

boost::urls::pct_string_view::pct_string_view

Members

Constructor

constexpr
pct_string_view() = default;
  » more...

Constructor

constexpr
pct_string_view(pct_string_view const& other) = default;
  » more...
template<
    class String,
    class = void>
pct_string_view(String const& s);
  » more...

Constructor (deleted)

pct_string_view(std::nullptr_t) = delete;
  » more...

Constructor

pct_string_view(
    char const* s,
    std::size_t len);
  » more...

Constructor

pct_string_view(core::string_view s);
  » more...

boost::urls::pct_string_view::operator=

Assignment

Synopsis

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

constexpr
pct_string_view&
operator=(pct_string_view const& other) = default;

Description

The copy references the same underlying character buffer. Ownership is not transferred.

Postconditions

this->data() == other.data()

Complexity

Constant.

Exception Safety

Throws nothing.

other The string to copy.

boost::urls::make_pct_string_view

Synopsis

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

friend
system::result<pct_string_view>
make_pct_string_view(core::string_view s) noexcept;

boost::urls::pct_string_view::decoded_size

Return the decoded size

Synopsis

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

std::size_t
decoded_size() const noexcept;

Description

This function returns the number of characters in the resulting string if percent escapes were converted into ordinary characters.

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::pct_string_view::operator*

Return the string as a range of decoded characters

Synopsis

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

decode_view
operator*() const noexcept;

Description

Complexity

Constant.

Exception Safety

Throws nothing.

See Also

boost::urls::pct_string_view::decode

Return the string with percent-decoding

Synopsis

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

template<class StringToken = string_token::return_string>
StringToken::result_type
decode(
    encoding_opts opt = = {},
    StringToken&& token) const;

Description

This function converts percent escapes in the string into ordinary characters and returns the result. When called with no arguments, the return type is std::string. Otherwise, the return type and style of output is determined by which string token is passed.

Example

assert( pct_string_view( "Program%20Files" ).decode() == "Program Files" );

Complexity

Linear in this->size().

Exception Safety

Calls to allocate may throw. String tokens may throw exceptions.

Parameters

Name Description

opt

The options for encoding. If this parameter is omitted, the default options are used.

token

An optional string token. If this parameter is omitted, then a new std::string is returned. Otherwise, the function return type is the result type of the token.

See Also

boost::urls::pct_string_view::operator→

Synopsis

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

pct_string_view const*
operator->() const noexcept;

boost::urls::pct_string_view::swap

Swap

Synopsis

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

void
swap(pct_string_view& s) noexcept;

boost::urls::make_pct_string_view_unsafe

Synopsis

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

pct_string_view
make_pct_string_view_unsafe(
    char const* data,
    std::size_t size,
    std::size_t decoded_size) noexcept;

boost::urls::make_pct_string_view

Return a valid percent-encoded string

Synopsis

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

system::result<pct_string_view>
make_pct_string_view(core::string_view s) noexcept;

Description

If s is a valid percent-encoded string, the function returns the buffer as a valid view which may be used to perform decoding or measurements. Otherwise the result contains an error code. Upon success, the returned view references the original character buffer; Ownership is not transferred.

Complexity

Linear in s.size().

Exception Safety

Throws nothing.

Parameters

Name Description

s

The string to validate.

boost::urls::param_pct_view

A query parameter

Synopsis

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

struct param_pct_view;

Member Functions

Name

Description

operator param

Conversion

operator param_view

operator→

param_pct_view [constructor]

Construction

Constructor

Data Members

Name

Description

has_value

True if a value is present

key

The key

value

The value

Description

Objects of this type represent a single key and value pair in a query string where a key is always present and may be empty, while the presence of a value is indicated by has_value equal to true. An empty value is distinct from no value.

The strings may have percent escapes, and offer an additional invariant: they never contain an invalid percent-encoding.

For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.

Keys and values in this object reference external character buffers. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced.

BNF

query-params    = query-param *( "&" query-param )
query-param     = key [ "=" value ]
key             = *qpchar
value           = *( qpchar / "=" )

Specification

See Also

boost::urls::param_pct_view::key

The key

Synopsis

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

Description

For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.

boost::urls::param_pct_view::value

The value

Synopsis

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

Description

The presence of a value is indicated by has_value equal to true. An empty value is distinct from no value.

boost::urls::param_pct_view::has_value

True if a value is present

Synopsis

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

bool has_value = false;

Description

The presence of a value is indicated by has_value == true. An empty value is distinct from no value.

boost::urls::param_pct_view::param_pct_view

Members

Constructor

constexpr
param_pct_view() = default;
  » more...

Constructor

Constructor

template<class OptionalString>
param_pct_view(
    pct_string_view key,
    OptionalString const& value);
  » more...

Construction

explicit
param_pct_view(param_view const& p);
  » more...
param_pct_view(
    pct_string_view key,
    pct_string_view value,
    bool has_value) noexcept;
  » more...

boost::urls::param_pct_view::operator param

Conversion

Synopsis

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

explicit
operator param() const;

Description

This function performs a conversion from a reference-like query parameter to one retaining ownership of the strings by making a copy.

Complexity

Linear in this->key.size() + this->value.size().

Exception Safety

Calls to allocate may throw.

boost::urls::param_pct_view::operator param_view

Synopsis

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

operator param_view() const noexcept;

boost::urls::param_pct_view::operator→

Synopsis

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

param_pct_view const*
operator->() const noexcept;

boost::urls::param_view

A query parameter

Synopsis

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

struct param_view;

Member Functions

Name

Description

operator param

Conversion

operator→

param_view [constructor]

Constructor

Data Members

Name

Description

has_value

True if a value is present

key

The key

value

The value

Description

Objects of this type represent a single key and value pair in a query string where a key is always present and may be empty, while the presence of a value is indicated by has_value equal to true. An empty value is distinct from no value.

Depending on where the object was obtained, the strings may or may not contain percent escapes.

For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.

Keys and values in this object reference external character buffers. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced.

BNF

query-params    = query-param *( "&" query-param )
query-param     = key [ "=" value ]
key             = *qpchar
value           = *( qpchar / "=" )

Specification

See Also

boost::urls::param_view::key

The key

Synopsis

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

core::string_view key;

Description

For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.

boost::urls::param_view::value

The value

Synopsis

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

core::string_view value;

Description

The presence of a value is indicated by has_value equal to true. An empty value is distinct from no value.

boost::urls::param_view::has_value

True if a value is present

Synopsis

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

bool has_value = false;

Description

The presence of a value is indicated by has_value == true. An empty value is distinct from no value.

boost::urls::param_view::param_view

Members

Constructor

constexpr
param_view() = default;
  » more...

Constructor

template<class OptionalString>
param_view(
    core::string_view key,
    OptionalString const& value) noexcept;
  » more...

Constructor

param_view(param const& other) noexcept;
  » more...
param_view(
    core::string_view key_,
    core::string_view value_,
    bool has_value_) noexcept;
  » more...

boost::urls::param_view::operator param

Conversion

Synopsis

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

explicit
operator param();

Description

This function performs a conversion from a reference-like query parameter to one retaining ownership of the strings by making a copy. No validation is performed on the strings.

Complexity

Linear in this->key.size() + this->value.size().

Exception Safety

Calls to allocate may throw.

boost::urls::param_view::operator→

Synopsis

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

param_view const*
operator->() const noexcept;

boost::urls::no_value

Constant indicating no value in a param

Synopsis

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

constexpr
no_value_t const no_value = {};

boost::urls::param

A query parameter

Synopsis

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

struct param;

Member Functions

Name

Description

operator→

operator=

Assignment

param [constructor]

Constructor

Data Members

Name

Description

has_value

True if a value is present

key

The key

value

The value

Description

Objects of this type represent a single key and value pair in a query string where a key is always present and may be empty, while the presence of a value is indicated by has_value equal to true. An empty value is distinct from no value.

Depending on where the object was obtained, the strings may or may not contain percent escapes.

For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.

BNF

query-params    = query-param *( "&" query-param )
query-param     = key [ "=" value ]
key             = *qpchar
value           = *( qpchar / "=" )

Specification

See Also

boost::urls::param::key

The key

Synopsis

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

std::string key;

Description

For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.

boost::urls::param::value

The value

Synopsis

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

std::string value;

Description

The presence of a value is indicated by has_value equal to true. An empty value is distinct from no value.

boost::urls::param::has_value

True if a value is present

Synopsis

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

bool has_value = false;

Description

The presence of a value is indicated by has_value == true. An empty value is distinct from no value.

boost::urls::param::param

Members

Constructor

param() = default;
  » more...

Constructor

param(param&& other) noexcept;
  » more...

Constructor

param(param const& other) = default;
  » more...

Constructor

template<class OptionalString>
param(
    core::string_view key,
    OptionalString const& value);
  » more...
param(
    core::string_view key,
    core::string_view value,
    bool has_value) noexcept;
  » more...

boost::urls::param::operator=

Members

Assignment

param&
operator=(param&& other) noexcept;
  » more...

Assignment

param&
operator=(param const&) = default;
  » more...

Assignment

Assignment

boost::urls::param::operator→

Synopsis

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

param const*
operator->() const noexcept;

boost::urls::encoded_size

Return the buffer size needed for percent-encoding

Synopsis

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

template<class CharSet>
std::size_t
encoded_size(
    core::string_view s,
    CharSet const& unreserved,
    encoding_opts opt = = {}) noexcept;

Description

This function returns the exact number of bytes necessary to store the result of applying percent-encoding to the string using the given options and character set. No encoding is actually performed.

Example

assert( encoded_size( "My Stuff", pchars ) == 10 );

Exception Safety

Throws nothing.

Return Value

The number of bytes needed, excluding any null terminator.

Parameters

Name Description

s

The string to measure.

unreserved

The set of characters that is not percent-encoded.

opt

The options for encoding. If this parameter is omitted, the default options are be used.

See Also

boost::urls::encode

Members

Apply percent-encoding to a string

template<class CharSet>
std::size_t
encode(
    char* dest,
    std::size_t size,
    core::string_view s,
    CharSet const& unreserved,
    encoding_opts opt = = {});
  » more...

Return a percent-encoded string

template<
    class StringToken = string_token::return_string,
    class CharSet>
StringToken::result_type
encode(
    core::string_view s,
    CharSet const& unreserved,
    encoding_opts opt = = {},
    StringToken&& token) noexcept;
  » more...

boost::urls::encode_unsafe

Synopsis

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

template<class CharSet>
std::size_t
encode_unsafe(
    char* dest,
    std::size_t size,
    core::string_view s,
    CharSet const& unreserved,
    encoding_opts opt);

boost::urls::sub_delim_chars

The sub-delims character set

Synopsis

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

constexpr
grammar::lut_chars const sub_delim_chars = "!$&()*+,;=\x27";

Description

Example

Character sets are used with rules and the functions grammar::find_if and grammar::find_if_not .

system::result< decode_view > = grammar::parse( "Program%20Files", pct_encoded_rule( sub_delim_chars ) );

BNF

sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
              / "*" / "+" / "," / ";" / "="

See Also

boost::urls::unreserved_chars

The unreserved character set

Synopsis

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

constexpr
grammar::lut_chars const unreserved_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    "abcdefghijklmnopqrstuvwxyz"
    "0123456789"
    "-._~";

Description

Example

Character sets are used with rules and the functions grammar::find_if and grammar::find_if_not .

system::result< decode_view > rv = grammar::parse( "Program%20Files", pct_encoded_rule( unreserved_chars ) );

BNF

unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"

See Also

boost::urls::pchars

The path character set

Synopsis

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

constexpr
lut_chars const pchars = unreserved_chars + sub_delim_chars + ':' + '@';

Description

Example

Character sets are used with rules and the functions grammar::find_if and grammar::find_if_not .

system::result< decode_view > rv = grammar::parse( "Program%20Files", pchars );

BNF

pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"

Specification

See Also

boost::urls::operator==

Members

template<
    class S0,
    class S1>
constexpr
bool
operator==(
    S0 const& s0,
    S1 const& s1) noexcept;
  » more...

Return true if two addresses are equal

bool
operator==(
    ipv4_address const& a1,
    ipv4_address const& a2) noexcept;
  » more...

Return true if two addresses are equal

bool
operator==(
    ipv6_address const& a1,
    ipv6_address const& a2) noexcept;
  » more...

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

bool
operator==(
    authority_view const& a0,
    authority_view const& a1) noexcept;
  » more...
bool
operator==(
    iterator const& it0,
    iterator const& it1) noexcept;
  » more...

Return the result of comparing two URLs

bool
operator==(
    url_view_base const& u0,
    url_view_base const& u1) noexcept;
  » more...

boost::urls::operator!=

Members

template<
    class S0,
    class S1>
constexpr
bool
operator!=(
    S0 const& s0,
    S1 const& s1) noexcept;
  » more...

Return true if two addresses are not equal

bool
operator!=(
    ipv4_address const& a1,
    ipv4_address const& a2) noexcept;
  » more...

Return true if two addresses are not equal

bool
operator!=(
    ipv6_address const& a1,
    ipv6_address const& a2) noexcept;
  » more...

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

bool
operator!=(
    authority_view const& a0,
    authority_view const& a1) noexcept;
  » more...
bool
operator!=(
    iterator const& it0,
    iterator const& it1) noexcept;
  » more...

Return the result of comparing two URLs

bool
operator!=(
    url_view_base const& u0,
    url_view_base const& u1) noexcept;
  » more...

boost::urls::operator<

Members

template<
    class S0,
    class S1>
constexpr
bool
operator<(
    S0 const& s0,
    S1 const& s1) noexcept;
  » more...

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

bool
operator<(
    authority_view const& a0,
    authority_view const& a1) noexcept;
  » more...

Return the result of comparing two URLs

bool
operator<(
    url_view_base const& u0,
    url_view_base const& u1) noexcept;
  » more...

boost::urls::operator⇐

Members

template<
    class S0,
    class S1>
constexpr
bool
operator<=(
    S0 const& s0,
    S1 const& s1) noexcept;
  » more...

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

bool
operator<=(
    authority_view const& a0,
    authority_view const& a1) noexcept;
  » more...

Return the result of comparing two URLs

bool
operator<=(
    url_view_base const& u0,
    url_view_base const& u1) noexcept;
  » more...

boost::urls::operator>

Members

template<
    class S0,
    class S1>
constexpr
bool
operator>(
    S0 const& s0,
    S1 const& s1) noexcept;
  » more...

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

bool
operator>(
    authority_view const& a0,
    authority_view const& a1) noexcept;
  » more...

Return the result of comparing two URLs

bool
operator>(
    url_view_base const& u0,
    url_view_base const& u1) noexcept;
  » more...

boost::urls::operator>=

Members

template<
    class S0,
    class S1>
constexpr
bool
operator>=(
    S0 const& s0,
    S1 const& s1) noexcept;
  » more...

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

bool
operator>=(
    authority_view const& a0,
    authority_view const& a1) noexcept;
  » more...

Return the result of comparing two URLs

bool
operator>=(
    url_view_base const& u0,
    url_view_base const& u1) noexcept;
  » more...

boost::urls::operator<<

Members

Format the string with percent-decoding applied to the output stream

std::ostream&
operator<<(
    std::ostream& os,
    decode_view const& s);
  » more...

Format the address to an output stream.

std::ostream&
operator<<(
    std::ostream& os,
    ipv4_address const& addr);
  » more...

Format the address to an output stream

std::ostream&
operator<<(
    std::ostream& os,
    ipv6_address const& addr);
  » more...

Format the encoded authority to the output stream

std::ostream&
operator<<(
    std::ostream& os,
    authority_view const& a);
  » more...

Format to an output stream

std::ostream&
operator<<(
    std::ostream& os,
    segments_encoded_base const& ps);
  » more...

Format to an output stream

std::ostream&
operator<<(
    std::ostream& os,
    segments_base const& ps);
  » more...

Format to an output stream

std::ostream&
operator<<(
    std::ostream& os,
    params_encoded_base const& qp);
  » more...

Format to an output stream

std::ostream&
operator<<(
    std::ostream& os,
    params_base const& qp);
  » more...

Format the url to the output stream

std::ostream&
operator<<(
    std::ostream& os,
    url_view_base const& u);
  » more...

boost::urls::host_type

Identifies the type of host in a URL.

Synopsis

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

enum host_type : int;

Members

Name

Description

none

No host is specified.

name

A host is specified by reg-name.

ipv4

A host is specified by ipv4_address .

ipv6

A host is specified by ipv6_address .

ipvfuture

A host is specified by IPvFuture.

Description

Values of this type are returned by URL views and containers to indicate the type of host present in a URL.

boost::urls::host_type::none

No host is specified.

Synopsis

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

none

boost::urls::host_type::name

A host is specified by reg-name.

Synopsis

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

name

boost::urls::host_type::ipv4

A host is specified by ipv4_address .

Synopsis

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

ipv4

boost::urls::host_type::ipv6

A host is specified by ipv6_address .

Synopsis

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

ipv6

boost::urls::host_type::ipvfuture

A host is specified by IPvFuture.

Synopsis

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

ipvfuture

boost::urls::error

Error codes returned the library

Synopsis

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

enum error : int;

Members

Name

Description

success

The operation completed successfully.

illegal_null

Null encountered in pct-encoded.

illegal_reserved_char

Illegal reserved character in encoded string.

non_canonical

A grammar element was not in canonical form.

bad_pct_hexdig

Bad hexadecimal digit.

incomplete_encoding

The percent-encoded sequence is incomplete.

missing_pct_hexdig

Missing hexadecimal digit.

no_space

No space in output buffer

not_a_base

The URL is not a base URL

boost::urls::error::success

The operation completed successfully.

Synopsis

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

success = 0

boost::urls::error::illegal_null

Null encountered in pct-encoded.

Synopsis

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

illegal_null

boost::urls::error::illegal_reserved_char

Illegal reserved character in encoded string.

Synopsis

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

illegal_reserved_char

boost::urls::error::non_canonical

A grammar element was not in canonical form.

Synopsis

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

non_canonical

boost::urls::error::bad_pct_hexdig

Bad hexadecimal digit.

Synopsis

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

bad_pct_hexdig

Description

This error condition is fatal.

boost::urls::error::incomplete_encoding

The percent-encoded sequence is incomplete.

Synopsis

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

incomplete_encoding

Description

This error condition is fatal.

boost::urls::error::missing_pct_hexdig

Missing hexadecimal digit.

Synopsis

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

missing_pct_hexdig

Description

This error condition is fatal.

boost::urls::error::no_space

No space in output buffer

Synopsis

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

no_space

Description

This error is returned when a provided output buffer was too small to hold the complete result of an algorithm.

boost::urls::error::not_a_base

The URL is not a base URL

Synopsis

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

not_a_base

boost::urls::make_error_code

Synopsis

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

constexpr
system::error_code
make_error_code(error ev) noexcept;

boost::urls::ipv4_address

An IP version 4 style address.

Synopsis

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

class ipv4_address;

Types

Name

Description

bytes_type

The type used to represent an address as an array of bytes

uint_type

The type used to represent an address as an unsigned integer

Member Functions

Name

Description

ipv4_address [constructor]

Construct from a string.

Construct from an array of bytes.

Construct from an unsigned integer.

Constructor.

is_loopback

Return true if the address is a loopback address

is_multicast

Return true if the address is a multicast address

is_unspecified

Return true if the address is unspecified

operator=

Copy Assignment.

to_buffer

Write a dotted decimal string representing the address to a buffer

to_bytes

Return the address as bytes, in network byte order.

to_string

Return the address as a string in dotted decimal format

to_uint

Return the address as an unsigned integer.

Static Member Functions

Name

Description

any

Return an address object that represents any address

broadcast

Return an address object that represents the broadcast address

loopback

Return an address object that represents the loopback address

Static Data Members

Name

Description

max_str_len

The number of characters in the longest possible IPv4 string.

Friends

Name

Description

operator!=

Return true if two addresses are not equal

operator<<

operator==

Return true if two addresses are equal

Description

Objects of this type are used to construct, parse, and manipulate IP version 6 addresses.

BNF

IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet

dec-octet   = DIGIT                 ; 0-9
            / %x31-39 DIGIT         ; 10-99
            / "1" 2DIGIT            ; 100-199
            / "2" %x30-34 DIGIT     ; 200-249
            / "25" %x30-35          ; 250-255

See Also

boost::urls::ipv4_address::max_str_len

The number of characters in the longest possible IPv4 string.

Synopsis

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

constexpr
static
std::size_t const max_str_len = 15;

Description

The longest ipv4 address string is "255.255.255.255".

boost::urls::ipv4_address::uint_type

The type used to represent an address as an unsigned integer

Synopsis

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

using uint_type = std::uint_least32_t;

boost::urls::ipv4_address::bytes_type

The type used to represent an address as an array of bytes

Synopsis

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

using bytes_type = std::array<unsigned char, 4>;

boost::urls::ipv4_address::ipv4_address

Members

Constructor.

constexpr
ipv4_address() = default;
  » more...

Constructor.

constexpr
ipv4_address(ipv4_address const&) = default;
  » more...

Construct from an unsigned integer.

explicit
ipv4_address(uint_type u) noexcept;
  » more...

Construct from an array of bytes.

explicit
ipv4_address(bytes_type const& bytes) noexcept;
  » more...

Construct from a string.

explicit
ipv4_address(core::string_view s);
  » more...

boost::urls::ipv4_address::operator=

Copy Assignment.

Synopsis

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

constexpr
ipv4_address&
operator=(ipv4_address const&) = default;

boost::urls::ipv4_address::to_bytes

Return the address as bytes, in network byte order.

Synopsis

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

bytes_type
to_bytes() const noexcept;

boost::urls::ipv4_address::to_uint

Return the address as an unsigned integer.

Synopsis

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

uint_type
to_uint() const noexcept;

boost::urls::ipv4_address::to_string

Return the address as a string in dotted decimal format

Synopsis

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

template<class StringToken = string_token::return_string>
StringToken::result_type
to_string(StringToken&& token) const;

Description

When called with no arguments, the return type is std::string. Otherwise, the return type and style of output is determined by which string token is passed.

Example

assert( ipv4_address(0x01020304).to_string() == "1.2.3.4" );

Complexity

Constant.

Exception Safety

Strong guarantee. Calls to allocate may throw. String tokens may throw exceptions.

Return Value

The return type of the string token. If the token parameter is omitted, then a new std::string is returned. Otherwise, the function return type is the result type of the token.

Parameters

Name Description

token

An optional string token.

boost::urls::ipv4_address::to_buffer

Write a dotted decimal string representing the address to a buffer

Synopsis

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

core::string_view
to_buffer(
    char* dest,
    std::size_t dest_size) const;

Description

The resulting buffer is not null-terminated.

Exceptions

Name Thrown on

std::length_error

dest_size < ipv4_address::max_str_len

Return Value

The formatted string

Parameters

Name Description

dest

The buffer in which to write, which must have at least dest_size space.

dest_size

The size of the output buffer.

boost::urls::ipv4_address::is_loopback

Return true if the address is a loopback address

Synopsis

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

bool
is_loopback() const noexcept;

boost::urls::ipv4_address::is_unspecified

Return true if the address is unspecified

Synopsis

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

bool
is_unspecified() const noexcept;

boost::urls::ipv4_address::is_multicast

Return true if the address is a multicast address

Synopsis

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

bool
is_multicast() const noexcept;

boost::urls::operator==

Return true if two addresses are equal

Synopsis

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

friend
bool
operator==(
    ipv4_address const& a1,
    ipv4_address const& a2) noexcept;

boost::urls::operator!=

Return true if two addresses are not equal

Synopsis

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

friend
bool
operator!=(
    ipv4_address const& a1,
    ipv4_address const& a2) noexcept;

boost::urls::ipv4_address::any

Return an address object that represents any address

Synopsis

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

static
ipv4_address
any() noexcept;

boost::urls::ipv4_address::loopback

Return an address object that represents the loopback address

Synopsis

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

static
ipv4_address
loopback() noexcept;

boost::urls::ipv4_address::broadcast

Return an address object that represents the broadcast address

Synopsis

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

static
ipv4_address
broadcast() noexcept;

boost::urls::operator<<

Synopsis

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

friend
std::ostream&
operator<<(
    std::ostream& os,
    ipv4_address const& addr);

boost::urls::parse_ipv4_address

Return an IPv4 address from an IP address string in dotted decimal form

Synopsis

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

system::result<ipv4_address>
parse_ipv4_address(core::string_view s) noexcept;

boost::urls::ipv6_address

An IP version 6 style address.

Synopsis

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

class ipv6_address;

Types

Name

Description

bytes_type

The type used to represent an address as an array of bytes.

Member Functions

Name

Description

ipv6_address [constructor]

Construct from a string.

Construct from an IPv4 address.

Construct from an array of bytes.

Constructor.

is_loopback

Return true if the address is a loopback address

is_unspecified

Return true if the address is unspecified

is_v4_mapped

Return true if the address is a mapped IPv4 address

operator=

Copy Assignment

to_buffer

Write a dotted decimal string representing the address to a buffer

to_bytes

Return the address as bytes, in network byte order

to_string

Return the address as a string.

Static Member Functions

Name

Description

loopback

Return an address object that represents the loopback address

Static Data Members

Name

Description

max_str_len

The number of characters in the longest possible IPv6 string.

Friends

Name

Description

operator!=

Return true if two addresses are not equal

operator<<

operator==

Return true if two addresses are equal

Description

Objects of this type are used to construct, parse, and manipulate IP version 6 addresses.

BNF

IPv6address =                            6( h16 ":" ) ls32
            /                       "::" 5( h16 ":" ) ls32
            / [               h16 ] "::" 4( h16 ":" ) ls32
            / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
            / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
            / [ *3( h16 ":" ) h16 ] "::"    h16 ":"   ls32
            / [ *4( h16 ":" ) h16 ] "::"              ls32
            / [ *5( h16 ":" ) h16 ] "::"              h16
            / [ *6( h16 ":" ) h16 ] "::"

ls32        = ( h16 ":" h16 ) / IPv4address
            ; least-significant 32 bits of address

h16         = 1*4HEXDIG
            ; 16 bits of address represented in hexadecimal

See Also

boost::urls::ipv6_address::max_str_len

The number of characters in the longest possible IPv6 string.

Synopsis

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

constexpr
static
std::size_t const max_str_len = 49;

Description

The longest IPv6 address is:

ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff

See Also

boost::urls::ipv6_address::bytes_type

The type used to represent an address as an array of bytes.

Synopsis

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

using bytes_type = std::array<unsigned char, 16>;

Description

Octets are stored in network byte order.

boost::urls::ipv6_address::ipv6_address

Members

Constructor.

constexpr
ipv6_address() = default;
  » more...

Constructor.

constexpr
ipv6_address(ipv6_address const&) = default;
  » more...

Construct from an array of bytes.

ipv6_address(bytes_type const& bytes) noexcept;
  » more...

Construct from an IPv4 address.

ipv6_address(ipv4_address const& addr) noexcept;
  » more...

Construct from a string.

ipv6_address(core::string_view s);
  » more...

boost::urls::ipv6_address::operator=

Copy Assignment

Synopsis

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

constexpr
ipv6_address&
operator=(ipv6_address const&) = default;

boost::urls::ipv6_address::to_bytes

Return the address as bytes, in network byte order

Synopsis

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

bytes_type
to_bytes() const noexcept;

boost::urls::ipv6_address::to_string

Return the address as a string.

Synopsis

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

template<class StringToken = string_token::return_string>
StringToken::result_type
to_string(StringToken&& token) const;

Description

The returned string does not contain surrounding square brackets.

When called with no arguments, the return type is std::string. Otherwise, the return type and style of output is determined by which string token is passed.

Example

ipv6_address::bytes_type b = {{
        0, 1, 0, 2, 0, 3, 0, 4,
        0, 5, 0, 6, 0, 7, 0, 8 }};
ipv6_address a(b);
assert(a.to_string() == "1:2:3:4:5:6:7:8");
assert( ipv4_address(0x01020304).to_string() == "1.2.3.4" );

Complexity

Constant.

Exception Safety

Strong guarantee. Calls to allocate may throw. String tokens may throw exceptions.

Return Value

The return type of the string token. If the token parameter is omitted, then a new std::string is returned. Otherwise, the function return type is the result type of the token.

Parameters

Name Description

token

An optional string token.

boost::urls::ipv6_address::to_buffer

Write a dotted decimal string representing the address to a buffer

Synopsis

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

core::string_view
to_buffer(
    char* dest,
    std::size_t dest_size) const;

Description

The resulting buffer is not null-terminated.

Exceptions

Name Thrown on

std::length_error

dest_size < ipv6_address::max_str_len

Return Value

The formatted string

Parameters

Name Description

dest

The buffer in which to write, which must have at least dest_size space.

dest_size

The size of the output buffer.

boost::urls::ipv6_address::is_unspecified

Return true if the address is unspecified

Synopsis

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

bool
is_unspecified() const noexcept;

Description

The address 0:0:0:0:0:0:0:0 is called the unspecified address. It indicates the absence of an address.

boost::urls::ipv6_address::is_loopback

Return true if the address is a loopback address

Synopsis

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

bool
is_loopback() const noexcept;

Description

The unicast address 0:0:0:0:0:0:0:1 is called the loopback address. It may be used by a node to send an IPv6 packet to itself.

boost::urls::ipv6_address::is_v4_mapped

Return true if the address is a mapped IPv4 address

Synopsis

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

bool
is_v4_mapped() const noexcept;

Description

This address type is used to represent the addresses of IPv4 nodes as IPv6 addresses.

boost::urls::operator==

Return true if two addresses are equal

Synopsis

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

friend
bool
operator==(
    ipv6_address const& a1,
    ipv6_address const& a2) noexcept;

boost::urls::operator!=

Return true if two addresses are not equal

Synopsis

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

friend
bool
operator!=(
    ipv6_address const& a1,
    ipv6_address const& a2) noexcept;

boost::urls::ipv6_address::loopback

Return an address object that represents the loopback address

Synopsis

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

static
ipv6_address
loopback() noexcept;

Description

The unicast address 0:0:0:0:0:0:0:1 is called the loopback address. It may be used by a node to send an IPv6 packet to itself.

boost::urls::operator<<

Synopsis

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

friend
std::ostream&
operator<<(
    std::ostream& os,
    ipv6_address const& addr);

boost::urls::parse_ipv6_address

Parse a string containing an IPv6 address.

Synopsis

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

system::result<ipv6_address>
parse_ipv6_address(core::string_view s) noexcept;

Description

This function attempts to parse the string as an IPv6 address and returns a result containing the address upon success, or an error code if the string does not contain a valid IPv6 address.

Exception Safety

Throws nothing.

Return Value

A result containing the address.

Parameters

Name Description

s

The string to parse.

boost::urls::scheme

Identifies a known URL scheme

Synopsis

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

enum scheme : unsigned short;

Members

Name

Description

none

Indicates that no scheme is present

unknown

Indicates the scheme is not a well-known scheme

ftp

File Transfer Protocol (FTP)

file

File URI Scheme

http

The Hypertext Transfer Protocol URI Scheme

https

The Secure Hypertext Transfer Protocol URI Scheme

ws

The WebSocket URI Scheme

wss

The Secure WebSocket URI Scheme

Description

Specification

boost::urls::scheme::none

Indicates that no scheme is present

Synopsis

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

none = 0

boost::urls::scheme::unknown

Indicates the scheme is not a well-known scheme

Synopsis

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

unknown

boost::urls::scheme::ftp

File Transfer Protocol (FTP)

Synopsis

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

ftp

Description

FTP is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network.

Specification

boost::urls::scheme::file

File URI Scheme

Synopsis

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

file

Description

The File URI Scheme is typically used to retrieve files from within one’s own computer.

boost::urls::scheme::http

The Hypertext Transfer Protocol URI Scheme

Synopsis

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

http

Description

URLs of this type indicate a resource which is interacted with using the HTTP protocol.

boost::urls::scheme::https

The Secure Hypertext Transfer Protocol URI Scheme

Synopsis

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

https

Description

URLs of this type indicate a resource which is interacted with using the Secure HTTP protocol.

boost::urls::scheme::ws

The WebSocket URI Scheme

Synopsis

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

ws

Description

URLs of this type indicate a resource which is interacted with using the WebSocket protocol.

boost::urls::scheme::wss

The Secure WebSocket URI Scheme

Synopsis

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

wss

Description

URLs of this type indicate a resource which is interacted with using the Secure WebSocket protocol.

boost::urls::string_to_scheme

Return the known scheme for a non-normalized string, if known

Synopsis

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

scheme
string_to_scheme(core::string_view s) noexcept;

Description

If the string does not identify a known scheme, the value scheme::unknown is returned.

BNF

scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

Specification

Return Value

The known scheme

Parameters

Name Description

s

The string holding the scheme

boost::urls::to_string

Return the normalized string for a known scheme

Synopsis

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

core::string_view
to_string(scheme s) noexcept;

Return Value

A string representing the known scheme

Parameters

Name Description

s

The known scheme constant

boost::urls::default_port

Return the default port for a known scheme

Synopsis

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

std::uint16_t
default_port(scheme s) noexcept;

Description

This function returns the default port for the known schemes. If the value does not represent a known scheme or the scheme does not represent a protocol, the function returns zero.

The following ports are returned by the function:

Return Value

An integer with the default port number

Parameters

Name Description

s

The known scheme constant

boost::urls::url_view

A non-owning reference to a valid URL

Synopsis

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

class url_view
    : public url_view_base;

Member Functions

Name

Description

authority

Return the authority

buffer

Return the url string

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

operator core::string_view

Return the URL as a core::string_view

operator=

Assignment

params

Return the query as a container of parameters

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

scheme

Return the scheme

scheme_id

Return the scheme

segments

Return the path as a container of segments

size

Return the number of characters in the url

url_view [constructor]

Constructor

user

Return the user

userinfo

Return the userinfo

zone_id

Return the IPv6 Zone ID

~url_view [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

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 ]

See Also

boost::urls::url_view::~url_view

Destructor

Synopsis

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

~url_view() = default;

Description

Any params, segments, iterators, or other views which reference the same underlying character buffer remain valid.

boost::urls::url_view::url_view

Members

Constructor

url_view() noexcept;
  » more...

Constructor

url_view(core::string_view s);
  » more...
template<
    class String,
    class = void>
url_view(String const& s);
  » more...

Constructor

url_view(url_view const& other) noexcept;
  » more...

Constructor

url_view(url_view_base const& other) noexcept;
  » more...

boost::urls::url_view::operator=

Members

Assignment

url_view&
operator=(url_view const& other) noexcept;
  » more...

Assignment

url_view&
operator=(url_view_base const& other) noexcept;
  » more...

boost::urls::url_view::max_size

Return the maximum number of characters possible

Synopsis

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

constexpr
static
std::size_t
max_size() noexcept;

Description

This represents the largest number of characters that are possible in a url, not including any null terminator.

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::authority_view

A non-owning reference to a valid authority

Synopsis

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

class authority_view;

Member Functions

Name

Description

authority_view [constructor]

Construct from a string.

Constructor

buffer

Return the complete authority

compare

Return the result of comparing this with another authority

data

Return a pointer to the first character

empty

Return true if the authority is empty

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_password

Return the password

encoded_user

Return the user

encoded_userinfo

Return the userinfo

has_password

Return true if a password is present

has_port

Return true if a port 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

operator=

Assignment

password

Return the password

port

Return the port

port_number

Return the port

size

Return the number of characters in the authority

user

Return the user

userinfo

Return the userinfo

~authority_view [destructor]

Destructor

Friends

Name

Description

operator!=

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

operator<

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

operator<<

operator⇐

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

operator==

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

operator>

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

operator>=

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

Description

Objects of this type represent valid authority 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 an authority and throws an exception on error. Upon success, the constructed object points to the passed character buffer; ownership is not transferred.

authority_view a( "user:pass@www.example.com:8080" );

Example 2

The parsing function parse_authority returns a result containing either a valid authority_view upon succcess, otherwise it contain an error. The error can be converted to an exception by the caller if desired:

system::result< authority_view > rv = parse_authority( "user:pass@www.example.com:8080" );

BNF

authority     = [ userinfo "@" ] host [ ":" port ]

userinfo      = user [ ":" [ password ] ]

user          = *( unreserved / pct-encoded / sub-delims )
password      = *( unreserved / pct-encoded / sub-delims / ":" )

host          = IP-literal / IPv4address / reg-name

port          = *DIGIT

Specification

See Also

boost::urls::authority_view::~authority_view

Destructor

Synopsis

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

virtual
~authority_view();

boost::urls::authority_view::authority_view

Members

Constructor

Construct from a string.

explicit
authority_view(core::string_view s);
  » more...

Constructor

boost::urls::authority_view::operator=

Assignment

Synopsis

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

authority_view&
operator=(authority_view const&) noexcept;

boost::urls::authority_view::size

Return the number of characters in the authority

Synopsis

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

std::size_t
size() const noexcept;

Description

This function returns the number of characters in the authority.

Example

assert( authority_view( "user:pass@www.example.com:8080" ).size() == 30 );

Exception Safety

Throws nothing.

boost::urls::authority_view::empty

Return true if the authority is empty

Synopsis

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

bool
empty() const noexcept;

Description

An empty authority has an empty host, no userinfo, and no port.

Example

assert( authority_view( "" ).empty() );

Exception Safety

Throws nothing.

boost::urls::authority_view::data

Return a pointer to the first character

Synopsis

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

char const*
data() const noexcept;

Description

This function returns a pointer to the beginning of the view, which is not guaranteed to be null-terminated.

Exception Safety

Throws nothing.

boost::urls::authority_view::buffer

Return the complete authority

Synopsis

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

core::string_view
buffer() const noexcept;

Description

This function returns the authority as a percent-encoded string.

Example

assert( parse_authority( "www.example.com" ).value().buffer() == "www.example.com" );

BNF

authority   = [ userinfo "@" ] host [ ":" port ]

Exception Safety

Throws nothing.

Specification

boost::urls::authority_view::has_userinfo

Return true if a userinfo is present

Synopsis

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

bool
has_userinfo() const noexcept;

Description

This function returns true if this contains a userinfo.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

userinfo    = user [ ":" [ password ] ]

authority   = [ userinfo "@" ] host [ ":" port ]

See Also

boost::urls::authority_view::userinfo

Return the userinfo

Synopsis

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

template<class StringToken = string_token::return_string>
StringToken::result_type
userinfo(StringToken&& token) const;

Description

If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" );

Complexity

Linear in this->userinfo().size().

Exception Safety

Calls to allocate may throw.

BNF

userinfo    = user [ ":" [ password ] ]

authority   = [ userinfo "@" ] host [ ":" port ]

See Also

boost::urls::authority_view::encoded_userinfo

Return the userinfo

Synopsis

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

pct_string_view
encoded_userinfo() const noexcept;

Description

If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" );

Complexity

Constant.

Exception Safety

Throws nothing

BNF

userinfo    = user [ ":" [ password ] ]

authority   = [ userinfo "@" ] host [ ":" port ]

See Also

boost::urls::authority_view::user

Return the user

Synopsis

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

template<class StringToken = string_token::return_string>
StringToken::result_type
user(StringToken&& token) const;

Description

If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );

Complexity

Linear in this->user().size().

Exception Safety

Calls to allocate may throw.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

See Also

boost::urls::authority_view::encoded_user

Return the user

Synopsis

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

pct_string_view
encoded_user() const noexcept;

Description

If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

See Also

boost::urls::authority_view::has_password

Return true if a password is present

Synopsis

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

bool
has_password() const noexcept;

Description

This function returns true if the userinfo is present and contains a password.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

See Also

boost::urls::authority_view::password

Return the password

Synopsis

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

template<class StringToken = string_token::return_string>
StringToken::result_type
password(StringToken&& token) const;

Description

If present, this function returns a string representing the password (which may be an empty string). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" );

Complexity

Linear in this->password().size().

Exception Safety

Calls to allocate may throw.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

See Also

boost::urls::authority_view::encoded_password

Return the password

Synopsis

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

pct_string_view
encoded_password() const noexcept;

Description

This function returns the password portion of the userinfo as a percent-encoded string.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

See Also

boost::urls::authority_view::host_type

Return the host type

Synopsis

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

urls::host_type
host_type() const noexcept;

Description

This function returns one of the following constants representing the type of host present.

Example

assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );

Complexity

Constant.

Exception Safety

Throws nothing.

Specification

boost::urls::authority_view::host

Return the host

Synopsis

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

template<class StringToken = string_token::return_string>
StringToken::result_type
host(StringToken&& token) const;

Description

This function returns the host portion of the authority as a string, or the empty string if there is no authority. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" );

Complexity

Linear in this->host().size().

Exception Safety

Calls to allocate may throw.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

boost::urls::authority_view::encoded_host

Return the host

Synopsis

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

pct_string_view
encoded_host() const noexcept;

Description

This function returns the host portion of the authority as a string, or the empty string if there is no authority. The returned string may contain percent escapes.

Example

assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

boost::urls::authority_view::host_address

Return the host

Synopsis

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

template<class StringToken = string_token::return_string>
StringToken::result_type
host_address(StringToken&& token) const;

Description

The value returned by this function depends on the type of host returned from the function host_type .

  • If the type is host_type::ipv4 , then the IPv4 address string is returned.

  • If the type is host_type::ipv6 , then the IPv6 address string is returned, without any enclosing brackets.

  • If the type is host_type::ipvfuture , then the IPvFuture address string is returned, without any enclosing brackets.

  • If the type is host_type::name , then the host name string is returned. Any percent-escapes in the string are decoded first.

  • If the type is host_type::none , then an empty string is returned.

Example

assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" );

Complexity

Linear in this->host_address().size().

Exception Safety

Calls to allocate may throw.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

boost::urls::authority_view::encoded_host_address

Return the host

Synopsis

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

pct_string_view
encoded_host_address() const noexcept;

Description

The value returned by this function depends on the type of host returned from the function host_type .

  • If the type is host_type::ipv4 , then the IPv4 address string is returned.

  • If the type is host_type::ipv6 , then the IPv6 address string is returned, without any enclosing brackets.

  • If the type is host_type::ipvfuture , then the IPvFuture address string is returned, without any enclosing brackets.

  • If the type is host_type::name , then the host name string is returned. Any percent-escapes in the string are decoded first.

  • If the type is host_type::none , then an empty string is returned. The returned string may contain percent escapes.

Example

assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

boost::urls::authority_view::host_ipv4_address

Return the host IPv4 address

Synopsis

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

ipv4_address
host_ipv4_address() const noexcept;

Description

If the host type is host_type::ipv4 , this function returns the address as a value of type ipv4_address . Otherwise, if the host type is not an IPv4 address, it returns a default-constructed value which is equal to the unspecified address "0.0.0.0".

Example

assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet

dec-octet   = DIGIT                 ; 0-9
            / %x31-39 DIGIT         ; 10-99
            / "1" 2DIGIT            ; 100-199
            / "2" %x30-34 DIGIT     ; 200-249
            / "25" %x30-35          ; 250-255

Specification

boost::urls::authority_view::host_ipv6_address

Return the host IPv6 address

Synopsis

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

ipv6_address
host_ipv6_address() const noexcept;

Description

If the host type is host_type::ipv6 , this function returns the address as a value of type ipv6_address . Otherwise, if the host type is not an IPv6 address, it returns a default-constructed value which is equal to the unspecified address "0:0:0:0:0:0:0:0".

Example

assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

IPv6address =                            6( h16 ":" ) ls32
            /                       "::" 5( h16 ":" ) ls32
            / [               h16 ] "::" 4( h16 ":" ) ls32
            / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
            / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
            / [ *3( h16 ":" ) h16 ] "::"    h16 ":"   ls32
            / [ *4( h16 ":" ) h16 ] "::"              ls32
            / [ *5( h16 ":" ) h16 ] "::"              h16
            / [ *6( h16 ":" ) h16 ] "::"

ls32        = ( h16 ":" h16 ) / IPv4address
            ; least-significant 32 bits of address

h16         = 1*4HEXDIG
            ; 16 bits of address represented in hexadecimal

Specification

boost::urls::authority_view::host_ipvfuture

Return the host IPvFuture address

Synopsis

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

core::string_view
host_ipvfuture() const noexcept;

Description

If the host type is host_type::ipvfuture , this function returns the address as a string. Otherwise, if the host type is not an IPvFuture address, it returns an empty string.

Example

assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

IPvFuture  = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )

Specification

boost::urls::authority_view::host_name

Return the host name

Synopsis

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

template<class StringToken = string_token::return_string>
StringToken::result_type
host_name(StringToken&& token) const;

Description

If the host type is host_type::name , this function returns the name as a string. Otherwise, if the host type is not an name, it returns an empty string. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" );

Complexity

Linear in this->host_name().size().

Exception Safety

Calls to allocate may throw.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

boost::urls::authority_view::encoded_host_name

Return the host name

Synopsis

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

pct_string_view
encoded_host_name() const noexcept;

Description

If the host type is host_type::name , this function returns the name as a string. Otherwise, if the host type is not an name, it returns an empty string. The returned string may contain percent escapes.

Example

assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

boost::urls::authority_view::has_port

Return true if a port is present

Synopsis

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

bool
has_port() const noexcept;

Description

This function returns true if an authority is present and contains a port.

Example

assert( url_view( "wss://www.example.com:443" ).has_port() );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

authority   = [ userinfo "@" ] host [ ":" port ]

port        = *DIGIT

Specification

See Also

boost::urls::authority_view::port

Return the port

Synopsis

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

core::string_view
port() const noexcept;

Description

If present, this function returns a string representing the port (which may be empty). Otherwise it returns an empty string.

Example

assert( url_view( "http://localhost.com:8080" ).port() == "8080" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

port        = *DIGIT

Specification

See Also

boost::urls::authority_view::port_number

Return the port

Synopsis

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

std::uint16_t
port_number() const noexcept;

Description

If a port is present and the numerical value is representable, it is returned as an unsigned integer. Otherwise, the number zero is returned.

Example

assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

port        = *DIGIT

Specification

See Also

boost::urls::authority_view::encoded_host_and_port

Return the host and port

Synopsis

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

pct_string_view
encoded_host_and_port() const noexcept;

Description

If an authority is present, this function returns the host and optional port as a string, which may be empty. Otherwise it returns an empty string. The returned string may contain percent escapes.

Example

assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

authority   = [ userinfo "@" ] host [ ":" port ]

See Also

boost::urls::authority_view::compare

Return the result of comparing this with another authority

Synopsis

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

int
compare(authority_view const& other) const noexcept;

Description

This function compares two authorities according to Syntax-Based comparison algorithm.

Exception Safety

Throws nothing.

Return Value

-1 if *this < other, 0 if this == other, and 1 if this > other.

boost::urls::operator==

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

Synopsis

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

friend
bool
operator==(
    authority_view const& a0,
    authority_view const& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

boost::urls::operator!=

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

Synopsis

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

friend
bool
operator!=(
    authority_view const& a0,
    authority_view const& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

boost::urls::operator<

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

Synopsis

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

friend
bool
operator<(
    authority_view const& a0,
    authority_view const& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

boost::urls::operator⇐

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

Synopsis

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

friend
bool
operator<=(
    authority_view const& a0,
    authority_view const& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

boost::urls::operator>

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

Synopsis

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

friend
bool
operator>(
    authority_view const& a0,
    authority_view const& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

boost::urls::operator>=

Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.

Synopsis

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

friend
bool
operator>=(
    authority_view const& a0,
    authority_view const& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

boost::urls::operator<<

Synopsis

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

friend
std::ostream&
operator<<(
    std::ostream& os,
    authority_view const& a);

boost::urls::parse_authority

Parse an authority

Synopsis

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

system::result<authority_view>
parse_authority(core::string_view s) noexcept;

Description

This function parses a string according to the authority grammar below, and returns an authority_view referencing the string. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the string extends until the view is no longer being accessed.

BNF

authority     = [ userinfo "@" ] host [ ":" port ]

userinfo      = user [ ":" [ password ] ]

user          = *( unreserved / pct-encoded / sub-delims )
password      = *( unreserved / pct-encoded / sub-delims / ":" )

host          = IP-literal / IPv4address / reg-name

port          = *DIGIT

Exception Safety

Throws nothing.

Specification

Return Value

A view to the parsed authority

Parameters

Name Description

s

The string to parse

See Also

boost::urls::ignore_case_t

Synopsis

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

struct ignore_case_t;

boost::urls::ignore_case

Synopsis

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

constexpr
ignore_case_t const ignore_case = {};

boost::urls::ignore_case_param

An optional parameter to determine case-sensitivity

Synopsis

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

class ignore_case_param;

Member Functions

Name

Description

ignore_case_param [constructor]

Constructor

operator bool

True if an algorithm should ignore case

Description

Functions may use parameters of this type to allow the user to optionally indicate that comparisons should be case-insensitive when the value ignore_case is passed.

boost::urls::ignore_case_param::ignore_case_param

Members

Constructor

constexpr
ignore_case_param() noexcept = default;
  » more...

Constructor

boost::urls::ignore_case_param::operator bool

True if an algorithm should ignore case

Synopsis

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

operator bool() const noexcept;

Description

Values of type ignore_case_param evaluate to true when constructed with the constant ignore_case . Otherwise, they are default-constructed and evaluate to false.

boost::urls::segments_encoded_base

Common functionality for containers

Synopsis

class segments_encoded_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type used to represent size.

value_type

The value type

Member Functions

Name

Description

back

Return the last segment

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

empty

Return true if there are no segments

end

Return an iterator to the end

front

Return the first segment

is_absolute

Returns true if this references an absolute path.

size

Return the number of segments

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Description

This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:

boost::urls::segments_encoded_base::iterator

Synopsis

class iterator;

Types

Member Functions

boost::urls::segments_encoded_base::iterator::value_type

Synopsis

boost::urls::segments_encoded_base::iterator::reference

Synopsis

boost::urls::segments_encoded_base::iterator::pointer

Synopsis

using pointer = reference;

boost::urls::segments_encoded_base::iterator::difference_type

Synopsis

using difference_type = std::ptrdiff_t;

boost::urls::segments_encoded_base::iterator::iterator_category

Synopsis

using iterator_category = std::bidirectional_iterator_tag;

boost::urls::segments_encoded_base::iterator::iterator

Members

constexpr
iterator() = default;
  » more...
constexpr
iterator(iterator const&) = default;
  » more...

boost::urls::segments_encoded_base::iterator::operator=

Synopsis

constexpr
iterator&
operator=(iterator const&) = default;

boost::urls::segments_encoded_base::iterator::operator*

Synopsis

reference
operator*() const noexcept;

boost::urls::segments_encoded_base::iterator::operator→

Synopsis

pointer
operator->() const noexcept;

boost::urls::segments_encoded_base::iterator::operator++

Members

boost::urls::segments_encoded_base::iterator::operator--

Members

boost::urls::segments_encoded_base::iterator::operator==

Synopsis

bool
operator==(iterator const& other) const noexcept;

boost::urls::segments_encoded_base::iterator::operator!=

Synopsis

bool
operator!=(iterator const& other) const noexcept;

boost::urls::segments_encoded_base::const_iterator

Synopsis

using const_iterator = iterator;

boost::urls::segments_encoded_base::value_type

The value type

Synopsis

using value_type = std::string;

Description

Values of this type represent a segment where unique ownership is retained by making a copy.

Example

segments_encoded_base::value_type ps( url_view( "/path/to/file.txt" ).encoded_segments().back() );

boost::urls::segments_encoded_base::reference

The reference type

Synopsis

using reference = pct_string_view;

Description

This is the type of value returned when iterators of the view are dereferenced.

boost::urls::segments_encoded_base::const_reference

The reference type

Synopsis

using const_reference = pct_string_view;

Description

This is the type of value returned when iterators of the view are dereferenced.

boost::urls::segments_encoded_base::size_type

An unsigned integer type used to represent size.

Synopsis

using size_type = std::size_t;

boost::urls::segments_encoded_base::difference_type

A signed integer type used to represent differences.

Synopsis

using difference_type = std::ptrdiff_t;

boost::urls::segments_encoded_base::max_size

Return the maximum number of characters possible

Synopsis

constexpr
static
std::size_t
max_size() noexcept;

Description

This represents the largest number of characters that are possible in a path, not including any null terminator.

Exception Safety

Throws nothing.

boost::urls::segments_encoded_base::buffer

Return the referenced character buffer.

Synopsis

pct_string_view
buffer() const noexcept;

Description

This function returns the character buffer referenced by the view. The returned string may contain percent escapes.

Example

assert( url_view( "/path/to/file.txt" ).encoded_segments().buffer() == "/path/to/file.txt" );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::segments_encoded_base::is_absolute

Returns true if this references an absolute path.

Synopsis

bool
is_absolute() const noexcept;

Description

Absolute paths always start with a forward slash ('/').

Example

assert( url_view( "/path/to/file.txt" ).encoded_segments().is_absolute() == true );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::segments_encoded_base::empty

Return true if there are no segments

Synopsis

bool
empty() const noexcept;

Description

Example

assert( ! url_view( "/index.htm" ).encoded_segments().empty() );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::segments_encoded_base::size

Return the number of segments

Synopsis

std::size_t
size() const noexcept;

Description

Example

assert( url_view( "/path/to/file.txt" ).encoded_segments().size() == 3 );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::segments_encoded_base::front

Return the first segment

Synopsis

pct_string_view
front() const noexcept;

Description

This function returns a string with the first segment of the path without any leading or trailing '/' separators. The returned string may contain percent escapes.

Preconditions

this->empty() == false

Effects

return *begin();

Example

assert( url_view( "/path/to/file.txt" ).encoded_segments().front() == "path" );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::segments_encoded_base::back

Return the last segment

Synopsis

pct_string_view
back() const noexcept;

Description

This function returns a string with the last segment of the path without any leading or trailing '/' separators. The returned string may contain percent escapes.

Preconditions

this->empty() == false

Example

assert( url_view( "/path/to/file.txt" ).encoded_segments().back() == "file.txt" );

Preconditions

this->empty() == false

Effects

return *--end();

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::segments_encoded_base::begin

Return an iterator to the beginning

Synopsis

iterator
begin() const noexcept;

Description

Complexity

Linear in this->front().size() or constant if this->empty().

Exception Safety

Throws nothing.

boost::urls::segments_encoded_base::end

Return an iterator to the end

Synopsis

iterator
end() const noexcept;

Description

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::segments_base

Common functionality for containers

Synopsis

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

class segments_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type used to represent size.

value_type

The value type

Member Functions

Name

Description

back

Return the last segment

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

empty

Return true if there are no segments

end

Return an iterator to the end

front

Return the first segment

is_absolute

Returns true if this references an absolute path.

size

Return the number of segments

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Description

This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:

boost::urls::segments_base::iterator

Synopsis

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

class iterator;

Types

Member Functions

boost::urls::segments_base::iterator::value_type

Synopsis

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

using value_type = segments_base::value_type;

boost::urls::segments_base::iterator::reference

Synopsis

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

using reference = segments_base::reference;

boost::urls::segments_base::iterator::pointer

Synopsis

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

using pointer = reference;

boost::urls::segments_base::iterator::difference_type

Synopsis

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

using difference_type = segments_base::difference_type;

boost::urls::segments_base::iterator::iterator_category

Synopsis

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

using iterator_category = std::bidirectional_iterator_tag;

boost::urls::segments_base::iterator::iterator

Members

constexpr
iterator() = default;
  » more...
constexpr
iterator(iterator const&) = default;
  » more...

boost::urls::segments_base::iterator::operator=

Synopsis

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

constexpr
iterator&
operator=(iterator const&) noexcept = default;

boost::urls::segments_base::iterator::operator*

Synopsis

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

reference
operator*() const;

boost::urls::segments_base::iterator::operator→

Synopsis

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

pointer
operator->() const = delete;

boost::urls::segments_base::iterator::operator++

Members

boost::urls::segments_base::iterator::operator--

Members

boost::urls::segments_base::iterator::operator==

Synopsis

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

bool
operator==(iterator const& other) const noexcept;

boost::urls::segments_base::iterator::operator!=

Synopsis

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

bool
operator!=(iterator const& other) const noexcept;

boost::urls::segments_base::const_iterator

Synopsis

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

using const_iterator = iterator;

boost::urls::segments_base::value_type

The value type

Synopsis

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

using value_type = std::string;

Description

Values of this type represent a segment where unique ownership is retained by making a copy.

Example

segments_base::value_type ps( url_view( "/path/to/file.txt" ).segments().back() );

boost::urls::segments_base::reference

The reference type

Synopsis

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

using reference = std::string;

Description

This is the type of value returned when iterators of the view are dereferenced.

boost::urls::segments_base::const_reference

The reference type

Synopsis

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

using const_reference = std::string;

Description

This is the type of value returned when iterators of the view are dereferenced.

boost::urls::segments_base::size_type

An unsigned integer type used to represent size.

Synopsis

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

using size_type = std::size_t;

boost::urls::segments_base::difference_type

A signed integer type used to represent differences.

Synopsis

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

using difference_type = std::ptrdiff_t;

boost::urls::segments_base::max_size

Return the maximum number of characters possible

Synopsis

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

constexpr
static
std::size_t
max_size() noexcept;

Description

This represents the largest number of characters that are possible in a path, not including any null terminator.

Exception Safety

Throws nothing.

boost::urls::segments_base::buffer

Return the referenced character buffer.

Synopsis

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

pct_string_view
buffer() const noexcept;

Description

This function returns the character buffer referenced by the view. The returned string may contain percent escapes.

Example

assert( url_view( "/path/to/file.txt" ).segments().buffer() == "/path/to/file.txt" );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::segments_base::is_absolute

Returns true if this references an absolute path.

Synopsis

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

bool
is_absolute() const noexcept;

Description

Absolute paths always start with a forward slash ('/').

Example

assert( url_view( "/path/to/file.txt" ).segments().is_absolute() == true );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::segments_base::empty

Return true if there are no segments

Synopsis

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

bool
empty() const noexcept;

Description

Example

assert( ! url_view( "/index.htm" ).segments().empty() );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::segments_base::size

Return the number of segments

Synopsis

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

std::size_t
size() const noexcept;

Description

Example

assert( url_view( "/path/to/file.txt" ).segments().size() == 3 );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::segments_base::front

Return the first segment

Synopsis

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

std::string
front() const noexcept;

Description

This function returns a string with the first segment of the path without any leading or trailing '/' separators. Any percent-escapes in the string are decoded first.

Preconditions

this->empty() == false

Effects

return *begin();

Example

assert( url_view( "/path/to/file.txt" ).segments().front() == "path" );

Complexity

Linear in this->front().size().

Exception Safety

Calls to allocate may throw.

boost::urls::segments_base::back

Return the last segment

Synopsis

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

std::string
back() const noexcept;

Description

Preconditions

this->empty() == false

Example

assert( url_view( "/path/to/file.txt" ).segments().back() == "file.txt" );

Preconditions

this->empty() == false

Effects

return *--end();

Complexity

Linear in this->back().size().

Exception Safety

Calls to allocate may throw.

boost::urls::segments_base::begin

Return an iterator to the beginning

Synopsis

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

iterator
begin() const noexcept;

Description

Complexity

Linear in this->front().size() or constant if this->empty().

Exception Safety

Throws nothing.

boost::urls::segments_base::end

Return an iterator to the end

Synopsis

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

iterator
end() const noexcept;

Description

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::segments_view

A view representing path segments in a URL

Synopsis

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

class segments_view
    : public segments_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type used to represent size.

value_type

The value type

Member Functions

Name

Description

back

Return the last segment

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

empty

Return true if there are no segments

end

Return an iterator to the end

front

Return the first segment

is_absolute

Returns true if this references an absolute path.

operator=

Assignment

segments_view [constructor]

Constructor

size

Return the number of segments

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Description

Objects of this type are used to interpret the path as a bidirectional view of segment strings.

The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.

Example

url_view u( "/path/to/file.txt" );

segments_view ps = u.segments();

assert( ps.buffer().data() == u.buffer().data() );

Percent escapes in strings returned when dereferencing iterators are automatically decoded.

Iterator Invalidation

Changes to the underlying character buffer can invalidate iterators which reference it.

See Also

boost::urls::segments_view::segments_view

Members

Constructor

constexpr
segments_view() = default;
  » more...

Constructor

constexpr
segments_view(segments_view const& other) = default;
  » more...

Constructor

segments_view(core::string_view s);
  » more...

boost::urls::segments_view::operator=

Assignment

Synopsis

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

constexpr
segments_view&
operator=(segments_view const& other) = default;

Description

After assignment, both views reference the same underlying character buffer.

Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.

Postconditions

this->buffer().data() == other.buffer().data()

Complexity

Constant

Exception Safety

Throws nothing

boost::urls::segments_encoded_view

A view representing path segments in a URL

Synopsis

class segments_encoded_view
    : public segments_encoded_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type used to represent size.

value_type

The value type

Member Functions

Name

Description

back

Return the last segment

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

empty

Return true if there are no segments

end

Return an iterator to the end

front

Return the first segment

is_absolute

Returns true if this references an absolute path.

operator segments_view

Conversion

operator=

Assignment

segments_encoded_view [constructor]

Constructor

size

Return the number of segments

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Friends

Name

Description

parse_path

Description

Objects of this type are used to interpret the path as a bidirectional view of segment strings.

The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.

Example

url_view u( "/path/to/file.txt" );

segments_encoded_view ps = u.encoded_segments();

assert( ps.buffer().data() == u.buffer().data() );

Strings produced when elements are returned have type param_pct_view and represent encoded strings. Strings passed to member functions may contain percent escapes, and throw exceptions on invalid inputs.

Iterator Invalidation

Changes to the underlying character buffer can invalidate iterators which reference it.

See Also

boost::urls::segments_encoded_view::segments_encoded_view

Members

Constructor

constexpr
segments_encoded_view() = default;
  » more...

Constructor

constexpr
segments_encoded_view(segments_encoded_view const&) noexcept = default;
  » more...

Constructor

segments_encoded_view(core::string_view s);
  » more...

boost::urls::segments_encoded_view::operator=

Assignment

Synopsis

constexpr
segments_encoded_view&
operator=(segments_encoded_view const&) = default;

Description

After assignment, both views reference the same underlying character buffer.

Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.

Postconditions

this->buffer().data() == other.buffer().data()

Complexity

Constant

Exception Safety

Throws nothing

boost::urls::segments_encoded_view::operator segments_view

Conversion

Synopsis

operator segments_view() const noexcept;

Description

This conversion returns a new view which references the same underlying character buffer, and whose iterators and members return ordinary strings with decoding applied to any percent escapes.

Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.

Example

segments_view ps = parse_path( "/path/to/file.txt" ).value();

Postconditions

segments_view( *this ).buffer().data() == this->buffer().data()

Complexity

Constant

Exception Safety

Throws nothing

boost::urls::parse_path

Synopsis

friend
system::result<segments_encoded_view>
parse_path(core::string_view s) noexcept;

boost::urls::parse_path

Parse a string and return an encoded segment view

Synopsis

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

system::result<segments_encoded_view>
parse_path(core::string_view s) noexcept;

Description

This function parses the string and returns the corresponding path object if the string is valid, otherwise returns an error.

BNF

path          = [ "/" ] segment *( "/" segment )

Exception Safety

No-throw guarantee.

Specification

Return Value

A valid view on success, otherwise an error code.

Parameters

Name Description

s

The string to parse

See Also

boost::urls::authority_rule_t

Synopsis

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

struct authority_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

boost::urls::authority_rule_t::value_type

Synopsis

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

using value_type = authority_view;

boost::urls::authority_rule_t::parse

Synopsis

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

system::result<value_type>
parse(
    char const*& it,
    char const* end) const noexcept;

boost::urls::authority_rule

Synopsis

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

constexpr
authority_rule_t const authority_rule = {};

boost::urls::pct_encoded_rule_t

Synopsis

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

template<class CharSet>
struct pct_encoded_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

Friends

Name

Description

pct_encoded_rule

boost::urls::pct_encoded_rule_t::value_type

Synopsis

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

using value_type = pct_string_view;

boost::urls::pct_encoded_rule

Synopsis

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

template<class CharSet_>
friend
constexpr
pct_encoded_rule_t<CharSet_>
pct_encoded_rule(CharSet_ const& cs) noexcept;

boost::urls::pct_encoded_rule_t::parse

Synopsis

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

system::result<value_type>
parse(
    char const*& it,
    char const* end) const noexcept;

boost::urls::pct_encoded_rule

Members

template<class CharSet_>
constexpr
pct_encoded_rule_t<CharSet_>
pct_encoded_rule(CharSet_ const& cs) noexcept;
  » more...
template<class CharSet>
constexpr
pct_encoded_rule_t<CharSet>
pct_encoded_rule(CharSet const& cs) noexcept;
  » more...

boost::urls::variant

The type of variant used by the library

Synopsis

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

template<class... Ts>
using variant = boost::variant2::variant<Ts...>;

Description

Warning
This alias is no longer supported and should not be used in new code. Please use boost::variant2::variant instead.

This alias is included for backwards compatibility with earlier versions of the library.

However, it will be removed in future releases, and using it in new code is not recommended.

Please use the updated version instead to ensure compatibility with future versions of the library.

boost::urls::optional

Synopsis

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

template<class T>
using optional = boost::optional<T>;

boost::urls::params_encoded_base

Common functionality for containers

Synopsis

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

class params_encoded_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type to represent sizes.

value_type

The value type

Member Functions

Name

Description

begin

Return an iterator to the beginning

buffer

Return the query corresponding to these params

contains

Return true if a matching key exists

count

Return the number of matching keys

empty

Return true if there are no params

end

Return an iterator to the end

find

Find a matching key

find_last

Find a matching key

size

Return the number of params

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Description

This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:

boost::urls::params_encoded_base::iterator

Synopsis

class iterator;

Types

Member Functions

Name

Description

iterator [constructor]

operator*

operator++

operator--

operator→

operator=

Friends

Name

Description

operator!=

operator==

boost::urls::params_encoded_base::iterator::value_type

Synopsis

using value_type = params_encoded_base::value_type;

boost::urls::params_encoded_base::iterator::reference

Synopsis

using reference = params_encoded_base::reference;

boost::urls::params_encoded_base::iterator::pointer

Synopsis

using pointer = reference;

boost::urls::params_encoded_base::iterator::difference_type

Synopsis

using difference_type = std::ptrdiff_t;

boost::urls::params_encoded_base::iterator::iterator_category

Synopsis

using iterator_category = std::bidirectional_iterator_tag;

boost::urls::params_encoded_base::iterator::iterator

Members

iterator() = default;
  » more...
constexpr
iterator(iterator const&) = default;
  » more...

boost::urls::params_encoded_base::iterator::operator=

Synopsis

iterator&
operator=(iterator const&) = default;

boost::urls::params_encoded_base::iterator::operator++

Members

boost::urls::params_encoded_base::iterator::operator--

Members

boost::urls::params_encoded_base::iterator::operator*

Synopsis

reference
operator*() const;

boost::urls::params_encoded_base::iterator::operator→

Synopsis

pointer
operator->() const;

boost::urls::operator==

Synopsis

friend
bool
operator==(
    iterator const& it0,
    iterator const& it1) noexcept;

boost::urls::operator!=

Synopsis

friend
bool
operator!=(
    iterator const& it0,
    iterator const& it1) noexcept;

boost::urls::params_encoded_base::const_iterator

Synopsis

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

using const_iterator = iterator;

boost::urls::params_encoded_base::value_type

The value type

Synopsis

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

using value_type = param;

Description

Values of this type represent parameters whose strings retain unique ownership by making a copy.

Example

params_encoded_view::value_type qp( *url_view( "?first=John&last=Doe" ).params().find( "first" ) );

See Also

param .

boost::urls::params_encoded_base::reference

The reference type

Synopsis

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

using reference = param_pct_view;

Description

This is the type of value returned when iterators of the view are dereferenced.

See Also

boost::urls::params_encoded_base::const_reference

The reference type

Synopsis

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

using const_reference = param_pct_view;

Description

This is the type of value returned when iterators of the view are dereferenced.

See Also

boost::urls::params_encoded_base::size_type

An unsigned integer type to represent sizes.

Synopsis

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

using size_type = std::size_t;

boost::urls::params_encoded_base::difference_type

A signed integer type used to represent differences.

Synopsis

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

using difference_type = std::ptrdiff_t;

boost::urls::params_encoded_base::max_size

Return the maximum number of characters possible

Synopsis

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

constexpr
static
std::size_t
max_size() noexcept;

Description

This represents the largest number of characters that are possible in a path, not including any null terminator.

Exception Safety

Throws nothing.

boost::urls::params_encoded_base::buffer

Return the query corresponding to these params

Synopsis

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

pct_string_view
buffer() const noexcept;

Description

This function returns the query string referenced by the container. The returned string may contain percent escapes.

Example

assert( url_view( "?first=John&last=Doe" ).encoded_params().buffer() == "first=John&last=Doe" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

query-params    = query-param *( "&" query-param )
query-param     = key [ "=" value ]
key             = *qpchar
value           = *( qpchar / "=" )

Specification

boost::urls::params_encoded_base::empty

Return true if there are no params

Synopsis

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

bool
empty() const noexcept;

Description

Example

assert( ! url_view( "?key=value" ).encoded_params().empty() );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::params_encoded_base::size

Return the number of params

Synopsis

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

std::size_t
size() const noexcept;

Description

Example

assert( url_view( "?key=value").encoded_params().size() == 1 );

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::params_encoded_base::begin

Return an iterator to the beginning

Synopsis

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

iterator
begin() const noexcept;

Description

Complexity

Linear in the size of the first param.

Exception Safety

Throws nothing.

boost::urls::params_encoded_base::end

Return an iterator to the end

Synopsis

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

iterator
end() const noexcept;

Description

Complexity

Constant.

Exception Safety

Throws nothing.

boost::urls::params_encoded_base::contains

Return true if a matching key exists

Synopsis

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

bool
contains(
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first.

Example

assert( url_view( "?first=John&last=Doe" ).encoded_params().contains( "first" ) );

Complexity

Linear in this->buffer().size().

Exception Safety

Exceptions thrown on invalid input.

Exceptions

Name Thrown on

system_error

key contains an invalid percent-encoding.

Parameters

Name Description

key

The key to match. By default, a case-sensitive comparison is used.

ic

An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive.

boost::urls::params_encoded_base::count

Return the number of matching keys

Synopsis

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

std::size_t
count(
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find the number of matches for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first.

Example

assert( url_view( "?first=John&last=Doe" ).encoded_params().count( "first" ) == 1 );

Complexity

Linear in this->buffer().size().

Exception Safety

Exceptions thrown on invalid input.

Exceptions

Name Thrown on

system_error

key contains an invalid percent-encoding.

Parameters

Name Description

key

The key to match. By default, a case-sensitive comparison is used.

ic

An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive.

boost::urls::params_encoded_base::find

Members

Find a matching key

iterator
find(
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;
  » more...

Find a matching key

iterator
find(
    iterator from,
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;
  » more...

boost::urls::params_encoded_base::find_last

Members

Find a matching key

Find a matching key

iterator
find_last(
    iterator before,
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;
  » more...

boost::urls::params_ref

A view representing query parameters in a URL

Synopsis

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