Reference

Namespace

Name Description
boost
std

Namespace boost

Name Description
urls
system

Namespace urls

Name Description
make_void
void_t
encoding_opts

Percent-encoding options

error_types
string_token
grammar
decode_view

A reference to a valid, percent-encoded string

pct_string_view

A reference to a valid percent-encoded string

make_pct_string_view_unsafe
make_pct_string_view

Return a valid percent-encoded string

operator==
operator!=
operator<
operator<=
operator>
operator>=
operator<<

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

sub_delim_chars

The sub-delims character set

unreserved_chars

The unreserved character set

pchars

The path character set

encoded_size

Return the buffer size needed for percent-encoding

encode

Apply percent-encoding to a string

encode_unsafe
encode

Return a percent-encoded string

no_value_t

The type of no_value

param_pct_view

A query parameter

param_view

A query parameter

no_value

Constant indicating no value in a param

param

A query parameter

host_type

Identifies the type of host in a URL.

error

Error codes returned the library

make_error_code
ipv4_address

An IP version 4 style address.

operator==

Return true if two addresses are equal

operator!=

Return true if two addresses are not equal

operator<<

Format the address to an output stream.

parse_ipv4_address

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

ipv6_address

An IP version 6 style address.

operator==

Return true if two addresses are equal

operator!=

Return true if two addresses are not equal

operator<<

Format the address to an output stream

parse_ipv6_address

Parse a string containing an IPv6 address.

scheme

Identifies a known URL scheme

string_to_scheme

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

to_string

Return the normalized string for a known scheme

default_port

Return the default port for a known scheme

url_view

A non-owning reference to a valid URL

authority_view

A non-owning reference to a valid authority

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.

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<<

Format the encoded authority to the output stream

parse_authority

Parse an authority

ignore_case_t
ignore_case
ignore_case_param

An optional parameter to determine case-sensitivity

segments_encoded_base

Common functionality for containers

operator<<

Format to an output stream

segments_base

Common functionality for containers

operator<<

Format to an output stream

segments_view

A view representing path segments in a URL

segments_encoded_view

A view representing path segments in a URL

parse_path

Parse a string and return an encoded segment view

authority_rule_t
authority_rule
pct_encoded_rule_t
pct_encoded_rule
pct_encoded_rule
variant

The type of variant used by the library

optional
params_encoded_base

Common functionality for containers

operator<<

Format to an output stream

params_ref

A view representing query parameters in a URL

operator==
operator!=
params_base

Common functionality for containers

operator<<

Format to an output stream

params_view

A view representing query parameters in a URL

params_encoded_view

A view representing query parameters in a URL

parse_query

Parse a string and return an encoded params view

url_base

Common functionality for containers

params_encoded_ref

A view representing query parameters in a URL

segments_encoded_ref

A view representing path segments in a URL

segments_ref

A view representing path segments in a URL

url_view_base

Common functionality for containers

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

operator>

Return the result of comparing two URLs

operator>=

Return the result of comparing two URLs

operator<<

Format the url to the output stream

resolve

Resolve a URL reference against a base URL

url

A modifiable container for a URL.

swap

Swap

ipv4_address_rule_t
ipv4_address_rule
ipv6_address_rule_t
ipv6_address_rule
parse_absolute_uri

Return a reference to a parsed URL string

parse_origin_form

Return a reference to a parsed URL string

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

absolute_uri_rule_t
absolute_uri_rule
relative_ref_rule_t
relative_ref_rule
uri_rule_t
uri_rule
uri_reference_rule_t
uri_reference_rule
origin_form_rule_t
origin_form_rule
query_rule_t
query_rule
static_url

A modifiable container for a URL.

static_url_base

Common implementation for all static URLs

make_void

Synopsis

template< class...> struct make_void ;

Declared in file <boost/url/detail/config.hpp> at line 138

Types

Name Description
type

type

Synopsis

typedef void type ;

Declared in file <boost/url/detail/config.hpp> at line 138

void_t

Synopsis

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

Declared in file <boost/url/detail/config.hpp> at line 139

encoding_opts

Percent-encoding options

Synopsis

struct encoding_opts ;

Declared in file <boost/url/encoding_opts.hpp> at line 31

Member Functions

Name Description
encoding_opts

Data Members

Name Description
space_as_plus

True if spaces encode to and from plus signs

lower_case

True if hexadecimal digits are emitted as lower case

disallow_null

True if nulls are not allowed

Description

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

encoding_opts

Synopsis

void encoding_opts( bool space_as_plus_, bool lower_case_, bool disallow_null_) noexcept;

Declared in file <src/encoding_opts.cpp> at line 19

Namespace error_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

system_error

The type of system error thrown by the library

result

The type of result returned by library functions

error_category

The type of error category used by the library

Synopsis

using error_category = error_category ;

Declared in file <boost/url/error_types.hpp> at line 43

Description

NOTE

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.

error_code

The type of error code used by the library

Synopsis

using error_code = error_code ;

Declared in file <boost/url/error_types.hpp> at line 65

Description

NOTE

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.

error_condition

The type of error condition used by the library

Synopsis

using error_condition = error_condition ;

Declared in file <boost/url/error_types.hpp> at line 87

Description

NOTE

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.

system_error

The type of system error thrown by the library

Synopsis

using system_error = system_error ;

Declared in file <boost/url/error_types.hpp> at line 109

Description

NOTE

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.

result

The type of result returned by library functions

Synopsis

template< class T> using result = result<T, error_code> ;

Declared in file <boost/url/error_types.hpp> at line 280

Description

NOTE

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.

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;
  • `boost::system::result`
  • Namespace string_token

    Name Description
    arg

    Base class for string tokens, and algorithm parameters

    is_token
    is_token
    return_string
    append_to_t
    append_to
    assign_to_t
    assign_to
    preserve_size_t
    preserve_size

    arg

    Base class for string tokens, and algorithm parameters

    Synopsis

    struct arg ;

    Declared in file <boost/url/grammar/string_token.hpp> at line 49

    Member Functions

    Name Description
    prepare

    Return a modifiable character buffer

    ~arg
    arg
    arg
    arg
    operator=
    operator=

    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.

    prepare

    Return a modifiable character buffer

    Synopsis

    char* prepare( size_t n);

    Declared in file <boost/url/grammar/string_token.hpp> at line 68

    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.

    ~arg

    Synopsis

    void ~arg();

    Declared in file <boost/url/grammar/string_token.hpp> at line 71

    arg

    Synopsis

    void arg();

    Declared in file <boost/url/grammar/string_token.hpp> at line 72

    arg

    Synopsis

    void arg( arg&&);

    Declared in file <boost/url/grammar/string_token.hpp> at line 73

    arg

    Synopsis

    void arg( const arg&) = delete;

    Declared in file <boost/url/grammar/string_token.hpp> at line 74

    operator=

    Synopsis

    arg& operator=( arg&&) = delete;

    Declared in file <boost/url/grammar/string_token.hpp> at line 75

    operator=

    Synopsis

    arg& operator=( const arg&) = delete;

    Declared in file <boost/url/grammar/string_token.hpp> at line 76

    is_token

    Synopsis

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

    Declared in file <boost/url/grammar/string_token.hpp> at line 88

    Types

    Name Description
    value_type
    type

    Member Functions

    Name Description
    operator value_type
    operator()

    is_token

    Synopsis

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

    Declared in file <boost/url/grammar/string_token.hpp> at line 91

    Types

    Name Description
    value_type
    type

    Member Functions

    Name Description
    operator value_type
    operator()

    return_string

    Synopsis

    struct return_string : arg;

    Declared in file <boost/url/grammar/string_token.hpp> at line 117

    Types

    Name Description
    result_type

    Member Functions

    Name Description
    prepare

    Return a modifiable character buffer

    operator=
    operator=
    prepare
    result

    result_type

    Synopsis

    using result_type = string ;

    Declared in file <boost/url/grammar/string_token.hpp> at line 120

    prepare

    Synopsis

    char* prepare( size_t n);

    Declared in file <boost/url/grammar/string_token.hpp> at line 122

    result

    Synopsis

    result_type result() noexcept;

    Declared in file <boost/url/grammar/string_token.hpp> at line 129

    append_to_t

    Synopsis

    template< class Alloc> struct append_to_t : arg;

    Declared in file <boost/url/grammar/string_token.hpp> at line 156

    Types

    Name Description
    string_type
    result_type

    Member Functions

    Name Description
    prepare

    Return a modifiable character buffer

    operator=
    operator=
    append_to_t
    prepare
    result

    string_type

    Synopsis

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

    Declared in file <boost/url/grammar/string_token.hpp> at line 159

    result_type

    Synopsis

    using result_type = string_type& ;

    Declared in file <boost/url/grammar/string_token.hpp> at line 163

    append_to_t

    Synopsis

    void append_to_t( string_type& s) noexcept;

    Declared in file <boost/url/grammar/string_token.hpp> at line 165

    prepare

    Synopsis

    char* prepare( size_t n);

    Declared in file <boost/url/grammar/string_token.hpp> at line 172

    result

    Synopsis

    result_type result() noexcept;

    Declared in file <boost/url/grammar/string_token.hpp> at line 182

    append_to

    Synopsis

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

    Declared in file <boost/url/grammar/string_token.hpp> at line 195

    assign_to_t

    Synopsis

    template< class Alloc> struct assign_to_t : arg;

    Declared in file <boost/url/grammar/string_token.hpp> at line 222

    Types

    Name Description
    string_type
    result_type

    Member Functions

    Name Description
    prepare

    Return a modifiable character buffer

    operator=
    operator=
    assign_to_t
    prepare
    result

    string_type

    Synopsis

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

    Declared in file <boost/url/grammar/string_token.hpp> at line 225

    result_type

    Synopsis

    using result_type = string_type& ;

    Declared in file <boost/url/grammar/string_token.hpp> at line 229

    assign_to_t

    Synopsis

    void assign_to_t( string_type& s) noexcept;

    Declared in file <boost/url/grammar/string_token.hpp> at line 231

    prepare

    Synopsis

    char* prepare( size_t n);

    Declared in file <boost/url/grammar/string_token.hpp> at line 238

    result

    Synopsis

    result_type result() noexcept;

    Declared in file <boost/url/grammar/string_token.hpp> at line 245

    assign_to

    Synopsis

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

    Declared in file <boost/url/grammar/string_token.hpp> at line 258

    preserve_size_t

    Synopsis

    template< class Alloc> struct preserve_size_t : arg;

    Declared in file <boost/url/grammar/string_token.hpp> at line 285

    Types

    Name Description
    result_type
    string_type

    Member Functions

    Name Description
    prepare

    Return a modifiable character buffer

    operator=
    operator=
    preserve_size_t
    prepare
    result

    result_type

    Synopsis

    using result_type = string_view ;

    Declared in file <boost/url/grammar/string_token.hpp> at line 288

    string_type

    Synopsis

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

    Declared in file <boost/url/grammar/string_token.hpp> at line 290

    preserve_size_t

    Synopsis

    void preserve_size_t( string_type& s) noexcept;

    Declared in file <boost/url/grammar/string_token.hpp> at line 294

    prepare

    Synopsis

    char* prepare( size_t n);

    Declared in file <boost/url/grammar/string_token.hpp> at line 301

    result

    Synopsis

    result_type result() noexcept;

    Declared in file <boost/url/grammar/string_token.hpp> at line 312

    preserve_size

    Synopsis

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

    Declared in file <boost/url/grammar/string_token.hpp> at line 327

    Namespace grammar

    Name Description
    string_view_base

    Common functionality for string views

    operator==
    operator!=
    operator<
    operator<=
    operator>
    operator>=
    hash_value

    Return the hash of this value

    operator<<

    Format a string to an output stream

    is_rule
    is_rule
    hexdig_chars_t
    hexdig_chars
    hexdig_value

    Return the decimal value of a hex character

    lut_chars

    A set of characters

    operator+

    Return the union of two character sets.

    operator-

    Return a new character set by subtracting

    all_chars_t
    all_chars

    A character set containing all characters.

    is_charset
    is_charset
    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

    ref
    parse

    Parse a character buffer using a rule

    parse

    Parse a character buffer using a rule

    ref
    ref
    error

    Error codes returned when using rules

    condition

    Error conditions for errors received from rules

    make_error_code
    make_error_condition
    to_lower

    Return c converted to lowercase

    to_upper

    Return c converted to uppercase

    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_equal
    ci_is_less

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

    ci_hash
    ci_equal
    ci_less
    variant_rule_t
    variant_rule
    variant_rule
    unsigned_rule
    digit_chars_t
    digit_chars
    ch_delim_rule
    delim_rule
    cs_delim_rule
    delim_rule
    optional_rule_t
    optional_rule
    optional_rule
    tuple_rule_t
    tuple_rule
    tuple_rule
    squelch
    aligned_storage
    recycled

    A thread-safe collection of instances of T

    recycled_ptr

    A pointer to shared instance of T

    alpha_chars_t
    alpha_chars

    A character set containing the alphabetical characters.

    token_rule_t
    token_rule
    range

    A forward range of parsed elements

    range_rule_t
    range_rule_t
    range_rule
    range_rule
    alnum_chars_t
    alnum_chars
    vchars_t
    vchars
    dec_octet_rule_t
    dec_octet_rule
    literal_rule

    string_view_base

    Common functionality for string views

    Synopsis

    class string_view_base ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 36

    Types

    Name Description
    traits_type

    The character traits

    value_type

    The value type

    pointer

    The pointer type

    const_pointer

    The const pointer type

    reference

    The reference type

    const_reference

    The const reference type

    const_iterator

    The const iterator type

    iterator

    The iterator type

    const_reverse_iterator

    The const reverse iterator type

    reverse_iterator

    The reverse iterator type

    size_type

    The size type

    difference_type

    The difference type

    Member Functions

    Name Description
    operator string_view

    Conversion

    operator string

    Conversion

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    cbegin

    Return an iterator to the beginning

    cend

    Return an iterator to the end

    rbegin
    rend
    crbegin
    crend
    size

    Return the size

    length

    Return the size

    max_size

    Return the maximum allowed size

    empty

    Return true if the string is empty

    operator[]

    Access a character

    at

    Access a character

    front

    Return the first character

    back

    Return the last character

    data

    Return a pointer to the character buffer

    copy

    Copy the characters to another buffer

    substr

    Return a view to part of the string

    compare

    Return the result of comparing to another string

    compare

    Return the result of comparing to another string

    compare

    Return the result of comparing to another string

    compare

    Return the result of comparing to another string

    compare

    Return the result of comparing to another string

    compare

    Return the result of comparing to another string

    starts_with

    Return true if a matching prefix exists

    starts_with

    Return true if a matching prefix exists

    starts_with

    Return true if a matching prefix exists

    ends_with

    Return true if a matching suffix exists

    ends_with

    Return true if a matching suffix exists

    ends_with

    Return true if a matching suffix exists

    find

    Return the position of matching characters

    find

    Return the position of matching characters

    find

    Return the position of matching characters

    find

    Return the position of matching characters

    rfind

    Return the position of matching characters

    rfind

    Return the position of matching characters

    rfind

    Return the position of matching characters

    rfind

    Return the position of matching characters

    find_first_of

    Return the position of the first match

    find_first_of

    Return the position of the first match

    find_first_of

    Return the position of the first match

    find_first_of

    Return the position of the first match

    find_last_of

    Return the position of the last match

    find_last_of

    Return the position of the last match

    find_last_of

    Return the position of the last match

    find_last_of

    Return the position of the last match

    find_first_not_of

    Return the position of the first non-match

    find_first_not_of

    Return the position of the first non-match

    find_first_not_of

    Return the position of the first non-match

    find_first_not_of

    Return the position of the first non-match

    find_last_not_of

    Return the position of the last non-match

    find_last_not_of

    Return the position of the last non-match

    find_last_not_of

    Return the position of the last non-match

    find_last_not_of

    Return the position of the last non-match

    contains

    Return true if matching characters are found

    contains

    Return true if matching characters are found

    contains

    Return true if matching characters are found

    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.

    traits_type

    The character traits

    Synopsis

    typedef char_traits<char> traits_type ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 87

    value_type

    The value type

    Synopsis

    typedef char value_type ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 89

    pointer

    The pointer type

    Synopsis

    typedef char* pointer ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 91

    const_pointer

    The const pointer type

    Synopsis

    typedef const char* const_pointer ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 93

    reference

    The reference type

    Synopsis

    typedef char& reference ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 95

    const_reference

    The const reference type

    Synopsis

    typedef const char& const_reference ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 97

    const_iterator

    The const iterator type

    Synopsis

    typedef const char* const_iterator ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 99

    iterator

    The iterator type

    Synopsis

    typedef const_iterator iterator ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 101

    const_reverse_iterator

    The const reverse iterator type

    Synopsis

    typedef reverse_iterator<const_iterator> const_reverse_iterator ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 103

    reverse_iterator

    The reverse iterator type

    Synopsis

    typedef const_reverse_iterator reverse_iterator ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 106

    size_type

    The size type

    Synopsis

    typedef size_t size_type ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 108

    difference_type

    The difference type

    Synopsis

    typedef ptrdiff_t difference_type ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 110

    npos

    A constant used to represent "no position"

    Synopsis

    const size_t npos ;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 113

    operator string_view

    Conversion

    Synopsis

    string_view operator string_view() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 119

    operator string

    Conversion

    Synopsis

    string operator string() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 142

    Description

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

    begin

    Return an iterator to the beginning

    Synopsis

    const_iterator begin() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 157

    Description

    See `core::string_view::begin`

    end

    Return an iterator to the end

    Synopsis

    const_iterator end() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 166

    Description

    See `core::string_view::end`

    cbegin

    Return an iterator to the beginning

    Synopsis

    const_iterator cbegin() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 175

    Description

    See `core::string_view::cbegin`

    cend

    Return an iterator to the end

    Synopsis

    const_iterator cend() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 184

    Description

    See `core::string_view::cend`

    rbegin

    Synopsis

    const_reverse_iterator rbegin() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 194

    rend

    Synopsis

    const_reverse_iterator rend() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 206

    crbegin

    Synopsis

    const_reverse_iterator crbegin() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 218

    crend

    Synopsis

    const_reverse_iterator crend() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 230

    size

    Return the size

    Synopsis

    size_type size() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 243

    Description

    See `core::string_view::size`

    length

    Return the size

    Synopsis

    size_type length() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 252

    Description

    See `core::string_view::length`

    max_size

    Return the maximum allowed size

    Synopsis

    size_type max_size() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 261

    Description

    See `core::string_view::max_size`

    empty

    Return true if the string is empty

    Synopsis

    bool empty() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 270

    Description

    See `core::string_view::size`

    operator[]

    Access a character

    Synopsis

    const_reference operator[]( size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 281

    Description

    See `core::string_view::operator[]`

    at

    Access a character

    Synopsis

    const_reference at( size_type pos);

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 291

    Description

    See `core::string_view::at`

    front

    Return the first character

    Synopsis

    const_reference front() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 301

    Description

    See `core::string_view::front`

    back

    Return the last character

    Synopsis

    const_reference back() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 311

    Description

    See `core::string_view::back`

    data

    Return a pointer to the character buffer

    Synopsis

    const_pointer data() noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 321

    Description

    See `core::string_view::data`

    copy

    Copy the characters to another buffer

    Synopsis

    size_type copy( char* s, size_type n, size_type pos);

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 333

    Description

    See `core::string_view::copy`

    substr

    Return a view to part of the string

    Synopsis

    string_view substr( size_type pos, size_type n);

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 343

    Description

    See `core::string_view::substr`

    compare

    Return the result of comparing to another string

    Synopsis

    int compare( string_view str) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 355

    Description

    See `core::string_view::compare`

    compare

    Return the result of comparing to another string

    Synopsis

    int compare( size_type pos1, size_type n1, string_view str);

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 365

    Description

    See `core::string_view::compare`

    compare

    Return the result of comparing to another string

    Synopsis

    int compare( size_type pos1, size_type n1, string_view str, size_type pos2, size_type n2);

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 375

    Description

    See `core::string_view::compare`

    compare

    Return the result of comparing to another string

    Synopsis

    int compare( const char* s) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 386

    Description

    See `core::string_view::compare`

    compare

    Return the result of comparing to another string

    Synopsis

    int compare( size_type pos1, size_type n1, const char* s);

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 396

    Description

    See `core::string_view::compare`

    compare

    Return the result of comparing to another string

    Synopsis

    int compare( size_type pos1, size_type n1, const char* s, size_type n2);

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 406

    Description

    See `core::string_view::compare`

    starts_with

    Return true if a matching prefix exists

    Synopsis

    bool starts_with( string_view x) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 419

    Description

    See `core::string_view::starts_with`

    starts_with

    Return true if a matching prefix exists

    Synopsis

    bool starts_with( char x) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 429

    Description

    See `core::string_view::starts_with`

    starts_with

    Return true if a matching prefix exists

    Synopsis

    bool starts_with( const char* x) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 439

    Description

    See `core::string_view::starts_with`

    ends_with

    Return true if a matching suffix exists

    Synopsis

    bool ends_with( string_view x) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 451

    Description

    See `core::string_view::ends_with`

    ends_with

    Return true if a matching suffix exists

    Synopsis

    bool ends_with( char x) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 461

    Description

    See `core::string_view::ends_with`

    ends_with

    Return true if a matching suffix exists

    Synopsis

    bool ends_with( const char* x) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 471

    Description

    See `core::string_view::ends_with`

    find

    Return the position of matching characters

    Synopsis

    size_type find( string_view str, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 483

    Description

    See `core::string_view::find`

    find

    Return the position of matching characters

    Synopsis

    size_type find( char c, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 493

    Description

    See `core::string_view::find`

    find

    Return the position of matching characters

    Synopsis

    size_type find( const char* s, size_type pos, size_type n) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 503

    Description

    See `core::string_view::find`

    find

    Return the position of matching characters

    Synopsis

    size_type find( const char* s, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 513

    Description

    See `core::string_view::find`

    rfind

    Return the position of matching characters

    Synopsis

    size_type rfind( string_view str, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 525

    Description

    See `core::string_view::rfind`

    rfind

    Return the position of matching characters

    Synopsis

    size_type rfind( char c, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 535

    Description

    See `core::string_view::rfind`

    rfind

    Return the position of matching characters

    Synopsis

    size_type rfind( const char* s, size_type pos, size_type n) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 545

    Description

    See `core::string_view::rfind`

    rfind

    Return the position of matching characters

    Synopsis

    size_type rfind( const char* s, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 555

    Description

    See `core::string_view::rfind`

    find_first_of

    Return the position of the first match

    Synopsis

    size_type find_first_of( string_view str, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 567

    Description

    See `core::string_view::find_first_of`

    find_first_of

    Return the position of the first match

    Synopsis

    size_type find_first_of( char c, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 577

    Description

    See `core::string_view::find_first_of`

    find_first_of

    Return the position of the first match

    Synopsis

    size_type find_first_of( const char* s, size_type pos, size_type n) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 587

    Description

    See `core::string_view::find_first_of`

    find_first_of

    Return the position of the first match

    Synopsis

    size_type find_first_of( const char* s, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 597

    Description

    See `core::string_view::find_first_of`

    find_last_of

    Return the position of the last match

    Synopsis

    size_type find_last_of( string_view str, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 609

    Description

    See `core::string_view::find_last_of`

    find_last_of

    Return the position of the last match

    Synopsis

    size_type find_last_of( char c, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 619

    Description

    See `core::string_view::find_last_of`

    find_last_of

    Return the position of the last match

    Synopsis

    size_type find_last_of( const char* s, size_type pos, size_type n) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 629

    Description

    See `core::string_view::find_last_of`

    find_last_of

    Return the position of the last match

    Synopsis

    size_type find_last_of( const char* s, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 639

    Description

    See `core::string_view::find_last_of`

    find_first_not_of

    Return the position of the first non-match

    Synopsis

    size_type find_first_not_of( string_view str, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 651

    Description

    See `core::string_view::find_first_not_of`

    find_first_not_of

    Return the position of the first non-match

    Synopsis

    size_type find_first_not_of( char c, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 661

    Description

    See `core::string_view::find_first_not_of`

    find_first_not_of

    Return the position of the first non-match

    Synopsis

    size_type find_first_not_of( const char* s, size_type pos, size_type n) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 671

    Description

    See `core::string_view::find_first_not_of`

    find_first_not_of

    Return the position of the first non-match

    Synopsis

    size_type find_first_not_of( const char* s, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 681

    Description

    See `core::string_view::find_first_not_of`

    find_last_not_of

    Return the position of the last non-match

    Synopsis

    size_type find_last_not_of( string_view str, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 693

    Description

    See `core::string_view::find_last_not_of`

    find_last_not_of

    Return the position of the last non-match

    Synopsis

    size_type find_last_not_of( char c, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 703

    Description

    See `core::string_view::find_last_not_of`

    find_last_not_of

    Return the position of the last non-match

    Synopsis

    size_type find_last_not_of( const char* s, size_type pos, size_type n) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 713

    Description

    See `core::string_view::find_last_not_of`

    find_last_not_of

    Return the position of the last non-match

    Synopsis

    size_type find_last_not_of( const char* s, size_type pos) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 723

    Description

    See `core::string_view::find_last_not_of`

    contains

    Return true if matching characters are found

    Synopsis

    bool contains( string_view sv) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 735

    Description

    See `core::string_view::contains`

    contains

    Return true if matching characters are found

    Synopsis

    bool contains( char c) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 744

    Description

    See `core::string_view::contains`

    contains

    Return true if matching characters are found

    Synopsis

    bool contains( const char* s) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 753

    Description

    See `core::string_view::contains`

    operator==

    Synopsis

    template< class S0, class S1> enable_if<is_match::value, bool>::type operator==( const S0& s0, const S1& s1) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 776

    operator!=

    Synopsis

    template< class S0, class S1> enable_if<is_match::value, bool>::type operator!=( const S0& s0, const S1& s1) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 785

    operator<

    Synopsis

    template< class S0, class S1> enable_if<is_match::value, bool>::type operator<( const S0& s0, const S1& s1) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 794

    operator<=

    Synopsis

    template< class S0, class S1> enable_if<is_match::value, bool>::type operator<=( const S0& s0, const S1& s1) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 803

    operator>

    Synopsis

    template< class S0, class S1> enable_if<is_match::value, bool>::type operator>( const S0& s0, const S1& s1) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 812

    operator>=

    Synopsis

    template< class S0, class S1> enable_if<is_match::value, bool>::type operator>=( const S0& s0, const S1& s1) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 821

    hash_value

    Return the hash of this value

    Synopsis

    size_t hash_value( const string_view_base& s) noexcept;

    Declared in file <boost/url/grammar/string_view_base.hpp> at line 834

    operator<<

    Format a string to an output stream

    Synopsis

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

    Declared in file <src/grammar/string_view_base.cpp> at line 21

    is_rule

    Synopsis

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

    Declared in file <boost/url/grammar/type_traits.hpp> at line 51

    Types

    Name Description
    value_type
    type

    Member Functions

    Name Description
    operator value_type
    operator()

    is_rule

    Synopsis

    template< class T> struct is_rule<T, void_t<>> : is_nothrow_copy_constructible<T>;

    Declared in file <boost/url/grammar/type_traits.hpp> at line 54

    hexdig_chars_t

    Synopsis

    struct hexdig_chars_t ;

    Declared in file <boost/url/grammar/hexdig_chars.hpp> at line 61

    Member Functions

    Name Description
    operator()

    Return true if c is in the character set.

    find_if
    find_if_not

    operator()

    Return true if c is in the character set.

    Synopsis

    bool operator()( char c) noexcept;

    Declared in file <boost/url/grammar/hexdig_chars.hpp> at line 65

    find_if

    Synopsis

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

    Declared in file <boost/url/grammar/hexdig_chars.hpp> at line 76

    find_if_not

    Synopsis

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

    Declared in file <boost/url/grammar/hexdig_chars.hpp> at line 85

    hexdig_chars

    Synopsis

    const hexdig_chars_t hexdig_chars ;

    Declared in file <boost/url/grammar/hexdig_chars.hpp> at line 96

    hexdig_value

    Return the decimal value of a hex character

    Synopsis

    signed char hexdig_value( char ch) noexcept;

    Declared in file <boost/url/grammar/hexdig_chars.hpp> at line 123

    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"

    lut_chars

    A set of characters

    Synopsis

    class lut_chars ;

    Declared in file <boost/url/grammar/lut_chars.hpp> at line 64

    Member Functions

    Name Description
    lut_chars

    Constructor

    lut_chars

    Constructor

    lut_chars
    operator()

    Return true if ch is in the character set.

    operator~

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

    find_if
    find_if_not

    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 ) );

    lut_chars

    Constructor

    Synopsis

    void lut_chars( char ch) noexcept;

    Declared in file <boost/url/grammar/lut_chars.hpp> at line 157

    Description

    This function constructs a character set which has as a single member, the character `ch`.

    Example

    constexpr lut_chars asterisk( '*' );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    lut_chars

    Constructor

    Synopsis

    void lut_chars( const char* s) noexcept;

    Declared in file <boost/url/grammar/lut_chars.hpp> at line 188

    Description

    This function constructs a character set which has as members, all of the characters present in the null-terminated string `s`.

    Example

    constexpr lut_chars digits = "0123456789";

    Complexity

    Linear in `::strlen(s)`, or constant if `s` is a constant expression.

    Exception Safety

    Throws nothing.

    lut_chars

    Synopsis

    template< class Pred, class = enable_if<detail::is_pred::value && !std::is_base_of::value>::type> void lut_chars( const Pred& pred) noexcept;

    Declared in file <boost/url/grammar/lut_chars.hpp> at line 235

    operator()

    Return true if ch is in the character set.

    Synopsis

    bool operator()( unsigned char ch) noexcept;

    Declared in file <boost/url/grammar/lut_chars.hpp> at line 256

    Description

    This function returns true if the character `ch` is in the set, otherwise it returns false.

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    operator~

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

    Synopsis

    lut_chars operator~() noexcept;

    Declared in file <boost/url/grammar/lut_chars.hpp> at line 363

    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.

    find_if

    Synopsis

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

    Declared in file <boost/url/grammar/lut_chars.hpp> at line 377

    find_if_not

    Synopsis

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

    Declared in file <boost/url/grammar/lut_chars.hpp> at line 386

    operator+

    Return the union of two character sets.

    Synopsis

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

    Declared in file <boost/url/grammar/lut_chars.hpp> at line 291

    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.

    operator-

    Return a new character set by subtracting

    Synopsis

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

    Declared in file <boost/url/grammar/lut_chars.hpp> at line 328

    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.

    all_chars_t

    Synopsis

    struct all_chars_t ;

    Declared in file <boost/url/grammar/all_chars.hpp> at line 43

    Member Functions

    Name Description
    all_chars_t
    operator()
    find_if
    find_if_not

    all_chars_t

    Synopsis

    void all_chars_t() noexcept;

    Declared in file <boost/url/grammar/all_chars.hpp> at line 45

    operator()

    Synopsis

    bool operator()( char) noexcept;

    Declared in file <boost/url/grammar/all_chars.hpp> at line 48

    find_if

    Synopsis

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

    Declared in file <boost/url/grammar/all_chars.hpp> at line 56

    find_if_not

    Synopsis

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

    Declared in file <boost/url/grammar/all_chars.hpp> at line 65

    all_chars

    A character set containing all characters.

    Synopsis

    const all_chars_t all_chars ;

    Declared in file <boost/url/grammar/all_chars.hpp> at line 81

    is_charset

    Synopsis

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

    Declared in file <boost/url/grammar/charset.hpp> at line 51

    Types

    Name Description
    value_type
    type

    Member Functions

    Name Description
    operator value_type
    operator()

    is_charset

    Synopsis

    template< class T> struct is_charset<T, void_t<>> : true_type;

    Declared in file <boost/url/grammar/charset.hpp> at line 54

    Types

    Name Description
    value_type
    type

    Member Functions

    Name Description
    operator value_type
    operator()

    find_if

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

    Synopsis

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

    Declared in file <boost/url/grammar/charset.hpp> at line 86

    Description

    Exception Safety

    Throws nothing.

    find_if_not

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

    Synopsis

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

    Declared in file <boost/url/grammar/charset.hpp> at line 124

    Description

    Exception Safety

    Throws nothing.

    ref

    Synopsis

    template< class CharSet> enable_if<is_charset::value && !std::is_same>::value, charset_ref<CharSet>>::type ref( const CharSet& cs) noexcept;

    Declared in file <boost/url/grammar/charset.hpp> at line 197

    parse

    Parse a character buffer using a rule

    Synopsis

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

    Declared in file <boost/url/grammar/impl/parse.hpp> at line 22

    parse

    Parse a character buffer using a rule

    Synopsis

    template< class R> result<Rule::value_type> parse( string_view s, const Rule& r);

    Declared in file <boost/url/grammar/impl/parse.hpp> at line 41

    Description

    This function parses a complete string into the specified sequence of rules. If the string is not completely consumed, an error is returned instead.

    ref

    Synopsis

    template< class Rule> enable_if<is_rule::value && !std::is_same>::value, rule_ref<Rule>>::type ref( const Rule& r) noexcept;

    Declared in file <boost/url/grammar/parse.hpp> at line 113

    ref

    Synopsis

    void ref() = delete;

    Declared in file <boost/url/grammar/parse.hpp> at line 133

    error

    Error codes returned when using rules

    Synopsis

    enum error;

    Declared in file <boost/url/grammar/error.hpp> at line 26

    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.

    need_more

    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.

    mismatch

    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.

    end_of_range

    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.

    invalid

    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.

    condition

    Error conditions for errors received from rules

    Synopsis

    enum condition;

    Declared in file <boost/url/grammar/error.hpp> at line 114

    Members

    Name Description
    fatal

    A fatal error in syntax was encountered.

    fatal

    This indicates that parsing cannot continue.

    make_error_code

    Synopsis

    error_code make_error_code( error ev) noexcept;

    Declared in file <boost/url/grammar/impl/error.hpp> at line 97

    make_error_condition

    Synopsis

    error_condition make_error_condition( condition c) noexcept;

    Declared in file <boost/url/grammar/impl/error.hpp> at line 108

    to_lower

    Return c converted to lowercase

    Synopsis

    char to_lower( char c) noexcept;

    Declared in file <boost/url/grammar/ci_string.hpp> at line 53

    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.

    to_upper

    Return c converted to uppercase

    Synopsis

    char to_upper( char c) noexcept;

    Declared in file <boost/url/grammar/ci_string.hpp> at line 83

    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.

    ci_compare

    Return the case-insensitive comparison of s0 and s1

    Synopsis

    int ci_compare( string_view s0, string_view s1) noexcept;

    Declared in file <src/grammar/ci_string.cpp> at line 82

    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.

    ci_digest

    Return the case-insensitive digest of a string

    Synopsis

    size_t ci_digest( string_view s) noexcept;

    Declared in file <src/grammar/ci_string.cpp> at line 123

    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.

    ci_is_equal

    Synopsis

    template< class String0, class String1> enable_if<!std::is_convertible::value || !std::is_convertible::value, bool>::type ci_is_equal( const String0& s0, const String1& s1);

    Declared in file <boost/url/grammar/ci_string.hpp> at line 173

    ci_is_equal

    Synopsis

    bool ci_is_equal( string_view s0, string_view s1) noexcept;

    Declared in file <boost/url/grammar/ci_string.hpp> at line 192

    ci_is_less

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

    Synopsis

    bool ci_is_less( string_view s0, string_view s1) noexcept;

    Declared in file <boost/url/grammar/ci_string.hpp> at line 224

    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" ) );

    ci_hash

    Synopsis

    struct ci_hash ;

    Declared in file <boost/url/grammar/ci_string.hpp> at line 261

    Types

    Name Description
    is_transparent

    Member Functions

    Name Description
    operator()

    is_transparent

    Synopsis

    using is_transparent = void ;

    Declared in file <boost/url/grammar/ci_string.hpp> at line 263

    operator()

    Synopsis

    size_t operator()( string_view s) noexcept;

    Declared in file <boost/url/grammar/ci_string.hpp> at line 265

    ci_equal

    Synopsis

    struct ci_equal ;

    Declared in file <boost/url/grammar/ci_string.hpp> at line 297

    Types

    Name Description
    is_transparent

    Member Functions

    Name Description
    operator()

    is_transparent

    Synopsis

    using is_transparent = void ;

    Declared in file <boost/url/grammar/ci_string.hpp> at line 299

    operator()

    Synopsis

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

    Declared in file <boost/url/grammar/ci_string.hpp> at line 303

    ci_less

    Synopsis

    struct ci_less ;

    Declared in file <boost/url/grammar/ci_string.hpp> at line 338

    Types

    Name Description
    is_transparent

    Member Functions

    Name Description
    operator()

    is_transparent

    Synopsis

    using is_transparent = void ;

    Declared in file <boost/url/grammar/ci_string.hpp> at line 340

    operator()

    Synopsis

    size_t operator()( string_view s0, string_view s1) noexcept;

    Declared in file <boost/url/grammar/ci_string.hpp> at line 342

    variant_rule_t

    Synopsis

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

    Declared in file <boost/url/grammar/variant_rule.hpp> at line 78

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

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

    Declared in file <boost/url/grammar/variant_rule.hpp> at line 81

    parse

    Synopsis

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

    Declared in file <boost/url/grammar/impl/variant_rule.hpp> at line 84

    variant_rule

    Synopsis

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

    Declared in file <boost/url/grammar/variant_rule.hpp> at line 94

    variant_rule

    Synopsis

    template< class R0, class... Rn> variant_rule_t<R0, Rn...> variant_rule( const R0& r0, const Rn&... rn) noexcept;

    Declared in file <boost/url/grammar/impl/variant_rule.hpp> at line 102

    unsigned_rule

    Synopsis

    template< class Unsigned> struct unsigned_rule ;

    Declared in file <boost/url/grammar/unsigned_rule.hpp> at line 57

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = Unsigned ;

    Declared in file <boost/url/grammar/unsigned_rule.hpp> at line 65

    parse

    Synopsis

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

    Declared in file <boost/url/grammar/impl/unsigned_rule.hpp> at line 21

    digit_chars_t

    Synopsis

    struct digit_chars_t ;

    Declared in file <boost/url/grammar/digit_chars.hpp> at line 48

    Member Functions

    Name Description
    operator()
    find_if
    find_if_not

    operator()

    Synopsis

    bool operator()( char c) noexcept;

    Declared in file <boost/url/grammar/digit_chars.hpp> at line 50

    find_if

    Synopsis

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

    Declared in file <boost/url/grammar/digit_chars.hpp> at line 58

    find_if_not

    Synopsis

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

    Declared in file <boost/url/grammar/digit_chars.hpp> at line 67

    digit_chars

    Synopsis

    const digit_chars_t digit_chars ;

    Declared in file <boost/url/grammar/digit_chars.hpp> at line 78

    ch_delim_rule

    Synopsis

    struct ch_delim_rule ;

    Declared in file <boost/url/grammar/delim_rule.hpp> at line 61

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    ch_delim_rule
    parse

    value_type

    Synopsis

    using value_type = string_view ;

    Declared in file <boost/url/grammar/delim_rule.hpp> at line 63

    ch_delim_rule

    Synopsis

    void ch_delim_rule( char ch) noexcept;

    Declared in file <boost/url/grammar/delim_rule.hpp> at line 65

    parse

    Synopsis

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

    Declared in file <src/grammar/delim_rule.cpp> at line 21

    delim_rule

    Synopsis

    ch_delim_rule delim_rule( char ch) noexcept;

    Declared in file <boost/url/grammar/delim_rule.hpp> at line 81

    cs_delim_rule

    Synopsis

    template< class CharSet> struct cs_delim_rule ;

    Declared in file <boost/url/grammar/delim_rule.hpp> at line 127

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    cs_delim_rule
    parse

    value_type

    Synopsis

    using value_type = string_view ;

    Declared in file <boost/url/grammar/delim_rule.hpp> at line 129

    cs_delim_rule

    Synopsis

    void cs_delim_rule( const CharSet& cs) noexcept;

    Declared in file <boost/url/grammar/delim_rule.hpp> at line 131

    parse

    Synopsis

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

    Declared in file <boost/url/grammar/delim_rule.hpp> at line 138

    delim_rule

    Synopsis

    template< class CharSet> enable_if<!std::is_convertible::value, cs_delim_rule<CharSet>>::type delim_rule( const CharSet& cs) noexcept;

    Declared in file <boost/url/grammar/delim_rule.hpp> at line 164

    optional_rule_t

    Synopsis

    template< class Rule> struct optional_rule_t ;

    Declared in file <boost/url/grammar/optional_rule.hpp> at line 65

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = optional<Rule::value_type> ;

    Declared in file <boost/url/grammar/optional_rule.hpp> at line 68

    parse

    Synopsis

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

    Declared in file <boost/url/grammar/impl/optional_rule.hpp> at line 19

    optional_rule

    Synopsis

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

    Declared in file <boost/url/grammar/optional_rule.hpp> at line 77

    optional_rule

    Synopsis

    template< class Rule> optional_rule_t<Rule> optional_rule( const Rule& r);

    Declared in file <boost/url/grammar/optional_rule.hpp> at line 96

    tuple_rule_t

    Synopsis

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

    Declared in file <boost/url/grammar/tuple_rule.hpp> at line 89

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

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

    Declared in file <boost/url/grammar/tuple_rule.hpp> at line 102

    parse

    Synopsis

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

    Declared in file <boost/url/grammar/impl/tuple_rule.hpp> at line 265

    tuple_rule

    Synopsis

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

    Declared in file <boost/url/grammar/tuple_rule.hpp> at line 109

    tuple_rule

    Synopsis

    template< class R0, class... Rn> tuple_rule_t<R0, Rn...> tuple_rule( const R0& r0, const Rn&... rn) noexcept;

    Declared in file <boost/url/grammar/tuple_rule.hpp> at line 138

    squelch

    Synopsis

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

    Declared in file <boost/url/grammar/tuple_rule.hpp> at line 231

    aligned_storage

    Synopsis

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

    Declared in file <boost/url/grammar/recycled.hpp> at line 44

    recycled

    A thread-safe collection of instances of T

    Synopsis

    template< class T> class recycled ;

    Declared in file <boost/url/grammar/recycled.hpp> at line 73

    Member Functions

    Name Description
    ~recycled

    Destructor

    recycled

    Constructor

    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();

    ~recycled

    Destructor

    Synopsis

    void ~recycled();

    Declared in file <boost/url/grammar/impl/recycled.hpp> at line 21

    Description

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

    recycled

    Constructor

    Synopsis

    void recycled();

    Declared in file <boost/url/grammar/recycled.hpp> at line 87

    recycled_ptr

    A pointer to shared instance of T

    Synopsis

    template< class T> class recycled_ptr ;

    Declared in file <boost/url/grammar/recycled.hpp> at line 150

    Member Functions

    Name Description
    ~recycled_ptr

    Destructor

    recycled_ptr

    Constructor

    recycled_ptr

    Constructor

    recycled_ptr

    Constructor

    recycled_ptr

    Constructor

    recycled_ptr

    Constructor

    recycled_ptr

    Constructor

    operator=

    Assignment

    operator=

    Assignment

    empty

    Return true if this does not reference an object

    operator bool

    Return true if this references an object

    bin

    Return the referenced recycle bin

    get

    Return the referenced object

    operator->

    Return the referenced object

    operator*

    Return the referenced object

    acquire

    Return the referenced object

    release

    Release the referenced object

    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();

    ~recycled_ptr

    Destructor

    Synopsis

    void ~recycled_ptr();

    Declared in file <boost/url/grammar/impl/recycled.hpp> at line 94

    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();

    recycled_ptr

    Constructor

    Synopsis

    void recycled_ptr( recycled<T>& bin);

    Declared in file <boost/url/grammar/impl/recycled.hpp> at line 102

    Description

    Upon construction, this acquires exclusive access to an object of type `T` which is either recycled from the specified bin, or newly allocated. The object is in an unknown but valid state.

    Example

    static recycled< std::string > bin; recycled_ptr< std::string > ps( bin ); // Put the string into a known state ps->clear();

    Postconditions

    &this->bin() == &bin && ! this->empty()

    recycled_ptr

    Constructor

    Synopsis

    void recycled_ptr( recycled<T>& bin, nullptr_t) noexcept;

    Declared in file <boost/url/grammar/impl/recycled.hpp> at line 111

    Description

    After construction, this is empty and refers to the specified recycle bin.

    Example

    static recycled< std::string > bin; recycled_ptr< std::string > ps( bin, nullptr ); // Acquire a string and put it into a known state ps->acquire(); ps->clear();

    Postconditions

    &this->bin() == &bin && this->empty()

    Exception Safety

    Throws nothing.

    recycled_ptr

    Constructor

    Synopsis

    void recycled_ptr();

    Declared in file <boost/url/grammar/impl/recycled.hpp> at line 120

    Description

    Upon construction, this acquires exclusive access to an object of type `T` which is either recycled from a global recycle bin, or newly allocated. The object is in an unknown but valid state.

    Example

    recycled_ptr< std::string > ps; // Put the string into a known state ps->clear();

    Postconditions

    &this->bin() != nullptr && ! this->empty()

    recycled_ptr

    Constructor

    Synopsis

    void recycled_ptr( nullptr_t) noexcept;

    Declared in file <boost/url/grammar/impl/recycled.hpp> at line 128

    Description

    After construction, this is empty and refers to a global recycle bin.

    Example

    recycled_ptr< std::string > ps( nullptr ); // Acquire a string and put it into a known state ps->acquire(); ps->clear();

    Postconditions

    &this->bin() != nullptr && this->empty()

    Exception Safety

    Throws nothing.

    recycled_ptr

    Constructor

    Synopsis

    void recycled_ptr( const recycled_ptr& other) noexcept;

    Declared in file <boost/url/grammar/impl/recycled.hpp> at line 141

    Description

    If `other` references an object, the newly constructed pointer acquires shared ownership. Otherwise this is empty. The new pointer references the same recycle bin as `other`.

    Postconditions

    &this->bin() == &other->bin() && this->get() == other.get()

    Exception Safety

    Throws nothing.

    recycled_ptr

    Constructor

    Synopsis

    void recycled_ptr( recycled_ptr&& other) noexcept;

    Declared in file <boost/url/grammar/impl/recycled.hpp> at line 152

    Description

    If `other` references an object, ownership is transferred including a reference to the recycle bin. After the move, the moved-from object is empty.

    Postconditions

    &this->bin() == &other->bin() && ! this->empty() && other.empty()

    Exception Safety

    Throws nothing.

    operator=

    Assignment

    Synopsis

    recycled_ptr& operator=( recycled_ptr&& other) noexcept;

    Declared in file <boost/url/grammar/impl/recycled.hpp> at line 162

    Description

    If `other` references an object, ownership is transferred including a reference to the recycle bin. After the move, the moved-from object is empty.

    Effects

    this->release()

    Postconditions

    &this->bin() == &other->bin()

    Exception Safety

    Throws nothing.

    operator=

    Assignment

    Synopsis

    recycled_ptr& operator=( const recycled_ptr& other) noexcept;

    Declared in file <boost/url/grammar/impl/recycled.hpp> at line 178

    Description

    If `other` references an object, this acquires shared ownership and references the same recycle bin as `other`. The previous object if any is released.

    Effects

    this->release()

    Postconditions

    &this->bin() == &other->bin() && this->get() == other.get()

    Exception Safety

    Throws nothing.

    empty

    Return true if this does not reference an object

    Synopsis

    bool empty() noexcept;

    Declared in file <boost/url/grammar/recycled.hpp> at line 403

    Description

    Exception Safety

    Throws nothing.

    operator bool

    Return true if this references an object

    Synopsis

    bool operator bool() noexcept;

    Declared in file <boost/url/grammar/recycled.hpp> at line 419

    Description

    Effects

    return ! this->empty();

    Exception Safety

    Throws nothing.

    bin

    Return the referenced recycle bin

    Synopsis

    recycled<T>& bin() noexcept;

    Declared in file <boost/url/grammar/recycled.hpp> at line 430

    Description

    Exception Safety

    Throws nothing.

    get

    Return the referenced object

    Synopsis

    T* get() noexcept;

    Declared in file <boost/url/grammar/recycled.hpp> at line 443

    Description

    If this is empty, `nullptr` is returned.

    Exception Safety

    Throws nothing.

    operator->

    Return the referenced object

    Synopsis

    T* operator->() noexcept;

    Declared in file <boost/url/grammar/recycled.hpp> at line 455

    Description

    If this is empty, `nullptr` is returned.

    Exception Safety

    Throws nothing.

    operator*

    Return the referenced object

    Synopsis

    T& operator*() noexcept;

    Declared in file <boost/url/grammar/recycled.hpp> at line 467

    Description

    Preconditions

    not this->empty()

    acquire

    Return the referenced object

    Synopsis

    T& acquire();

    Declared in file <boost/url/grammar/impl/recycled.hpp> at line 195

    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()

    release

    Release the referenced object

    Synopsis

    void release() noexcept;

    Declared in file <boost/url/grammar/impl/recycled.hpp> at line 205

    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.

    alpha_chars_t

    Synopsis

    struct alpha_chars_t ;

    Declared in file <boost/url/grammar/alpha_chars.hpp> at line 48

    Member Functions

    Name Description
    alpha_chars_t
    operator()
    find_if
    find_if_not

    alpha_chars_t

    Synopsis

    void alpha_chars_t() noexcept;

    Declared in file <boost/url/grammar/alpha_chars.hpp> at line 50

    operator()

    Synopsis

    bool operator()( char c) noexcept;

    Declared in file <boost/url/grammar/alpha_chars.hpp> at line 53

    find_if

    Synopsis

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

    Declared in file <boost/url/grammar/alpha_chars.hpp> at line 63

    find_if_not

    Synopsis

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

    Declared in file <boost/url/grammar/alpha_chars.hpp> at line 72

    alpha_chars

    A character set containing the alphabetical characters.

    Synopsis

    const alpha_chars_t alpha_chars ;

    Declared in file <boost/url/grammar/alpha_chars.hpp> at line 88

    token_rule_t

    Synopsis

    template< class CharSet> struct token_rule_t ;

    Declared in file <boost/url/grammar/token_rule.hpp> at line 57

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = string_view ;

    Declared in file <boost/url/grammar/token_rule.hpp> at line 59

    parse

    Synopsis

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

    Declared in file <boost/url/grammar/impl/token_rule.hpp> at line 19

    token_rule

    Synopsis

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

    Declared in file <boost/url/grammar/token_rule.hpp> at line 92

    range

    A forward range of parsed elements

    Synopsis

    template< class T> class range ;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 60

    Types

    Name Description
    iterator

    A constant, forward iterator to elements of the range

    Types

    Name Description
    value_type

    The type of each element of the range

    reference

    The type of each element of the range

    const_reference

    The type of each element of the range

    pointer

    Provided for compatibility, unused

    size_type

    The type used to represent unsigned integers

    difference_type

    The type used to represent signed integers

    const_iterator

    A constant, forward iterator to elements of the range

    Member Functions

    Name Description
    ~range

    Destructor

    range

    Constructor

    range

    Constructor

    range

    Constructor

    operator=

    Constructor

    operator=

    Assignment

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    empty

    Return true if the range is empty

    size

    Return the number of elements in the range

    string

    Return the matching part of the string

    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.

    value_type

    The type of each element of the range

    Synopsis

    using value_type = T ;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 133

    reference

    The type of each element of the range

    Synopsis

    using reference = const T& ;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 137

    const_reference

    The type of each element of the range

    Synopsis

    using const_reference = const T& ;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 141

    pointer

    Provided for compatibility, unused

    Synopsis

    using pointer = const void* ;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 145

    size_type

    The type used to represent unsigned integers

    Synopsis

    using size_type = size_t ;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 149

    difference_type

    The type used to represent signed integers

    Synopsis

    using difference_type = ptrdiff_t ;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 153

    iterator

    A constant, forward iterator to elements of the range

    Synopsis

    class iterator ;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 361

    Types

    Name Description
    value_type
    reference
    pointer
    difference_type
    iterator_category

    Member Functions

    Name Description
    iterator
    iterator
    operator=
    operator*
    operator==
    operator!=
    operator++
    operator++

    value_type

    Synopsis

    using value_type = T ;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 365

    reference

    Synopsis

    using reference = const T& ;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 366

    pointer

    Synopsis

    using pointer = const void* ;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 367

    difference_type

    Synopsis

    using difference_type = ptrdiff_t ;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 368

    iterator_category

    Synopsis

    using iterator_category = forward_iterator_tag ;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 370

    iterator

    Synopsis

    void iterator();

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 373

    iterator

    Synopsis

    void iterator( const iterator&);

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 374

    operator=

    Synopsis

    iterator& operator=( const iterator&);

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 376

    operator*

    Synopsis

    reference operator*() noexcept;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 379

    operator==

    Synopsis

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

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 385

    operator!=

    Synopsis

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

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 396

    operator++

    Synopsis

    iterator& operator++() noexcept;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 403

    operator++

    Synopsis

    iterator operator++( int) noexcept;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 417

    const_iterator

    A constant, forward iterator to elements of the range

    Synopsis

    using const_iterator = iterator ;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 161

    ~range

    Destructor

    Synopsis

    void ~range();

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 502

    range

    Constructor

    Synopsis

    void range() noexcept;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 509

    Description

    Default-constructed ranges have zero elements.

    Exception Safety

    Throws nothing.

    range

    Constructor

    Synopsis

    void range( range&& other) noexcept;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 519

    Description

    The new range references the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. The moved-from object becomes as if default-constructed.

    Exception Safety

    Throws nothing.

    range

    Constructor

    Synopsis

    void range( const range& other) noexcept;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 533

    Description

    The copy references the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.

    Exception Safety

    Throws nothing.

    operator=

    Constructor

    Synopsis

    range& operator=( range&& other) noexcept;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 543

    Description

    After the move, this references the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced. The moved-from object becomes as if default-constructed.

    Exception Safety

    Throws nothing.

    operator=

    Assignment

    Synopsis

    range& operator=( const range& other) noexcept;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 564

    Description

    The copy references the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.

    Exception Safety

    Throws nothing.

    begin

    Return an iterator to the beginning

    Synopsis

    iterator begin() noexcept;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 581

    end

    Return an iterator to the end

    Synopsis

    iterator end() noexcept;

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 590

    empty

    Return true if the range is empty

    Synopsis

    bool empty() noexcept;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 250

    size

    Return the number of elements in the range

    Synopsis

    size_t size() noexcept;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 258

    string

    Return the matching part of the string

    Synopsis

    string_view string() noexcept;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 266

    range_rule_t

    Synopsis

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

    Declared in file <boost/url/grammar/range_rule.hpp> at line 504

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = range<R0::value_type> ;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 506

    parse

    Synopsis

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

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 670

    range_rule_t

    Synopsis

    template< class R> struct range_rule_t<R> ;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 359

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = range<R::value_type> ;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 361

    parse

    Synopsis

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

    Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 601

    range_rule

    Synopsis

    template< class Rule> range_rule_t<Rule> range_rule( const Rule& next, size_t N, size_t M) noexcept;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 396

    range_rule

    Synopsis

    template< class Rule1, class Rule2> enable_if<!std::is_integral::value, range_rule_t<Rule1, Rule2>>::type range_rule( const Rule1& first, const Rule2& next, size_t N, size_t M) noexcept;

    Declared in file <boost/url/grammar/range_rule.hpp> at line 554

    alnum_chars_t

    Synopsis

    struct alnum_chars_t ;

    Declared in file <boost/url/grammar/alnum_chars.hpp> at line 53

    Member Functions

    Name Description
    operator()
    find_if
    find_if_not

    operator()

    Synopsis

    bool operator()( char c) noexcept;

    Declared in file <boost/url/grammar/alnum_chars.hpp> at line 55

    find_if

    Synopsis

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

    Declared in file <boost/url/grammar/alnum_chars.hpp> at line 66

    find_if_not

    Synopsis

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

    Declared in file <boost/url/grammar/alnum_chars.hpp> at line 75

    alnum_chars

    Synopsis

    const alnum_chars_t alnum_chars ;

    Declared in file <boost/url/grammar/alnum_chars.hpp> at line 86

    vchars_t

    Synopsis

    struct vchars_t ;

    Declared in file <boost/url/grammar/vchars.hpp> at line 48

    Member Functions

    Name Description
    operator()
    find_if
    find_if_not

    operator()

    Synopsis

    bool operator()( char c) noexcept;

    Declared in file <boost/url/grammar/vchars.hpp> at line 50

    find_if

    Synopsis

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

    Declared in file <boost/url/grammar/vchars.hpp> at line 58

    find_if_not

    Synopsis

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

    Declared in file <boost/url/grammar/vchars.hpp> at line 67

    vchars

    Synopsis

    const vchars_t vchars ;

    Declared in file <boost/url/grammar/vchars.hpp> at line 78

    dec_octet_rule_t

    Synopsis

    struct dec_octet_rule_t ;

    Declared in file <boost/url/grammar/dec_octet_rule.hpp> at line 56

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = unsigned char ;

    Declared in file <boost/url/grammar/dec_octet_rule.hpp> at line 58

    parse

    Synopsis

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

    Declared in file <src/grammar/dec_octet_rule.cpp> at line 23

    dec_octet_rule

    Synopsis

    const dec_octet_rule_t dec_octet_rule ;

    Declared in file <boost/url/grammar/dec_octet_rule.hpp> at line 69

    literal_rule

    Synopsis

    class literal_rule ;

    Declared in file <boost/url/grammar/literal_rule.hpp> at line 49

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    literal_rule
    parse

    value_type

    Synopsis

    using value_type = string_view ;

    Declared in file <boost/url/grammar/literal_rule.hpp> at line 65

    literal_rule

    Synopsis

    void literal_rule( const char* s) noexcept;

    Declared in file <boost/url/grammar/literal_rule.hpp> at line 67

    parse

    Synopsis

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

    Declared in file <src/grammar/literal_rule.cpp> at line 23

    decode_view

    A reference to a valid, percent-encoded string

    Synopsis

    class decode_view ;

    Declared in file <boost/url/decode_view.hpp> at line 87

    Types

    Name Description
    iterator

    Types

    Name Description
    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    The unsigned integer type

    difference_type

    The signed integer type

    const_iterator

    iterator

    Member Functions

    Name Description
    decode_view

    Constructor

    decode_view

    Constructor

    empty

    Return true if the string is empty

    size

    Return the number of decoded characters

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    front

    Return the first character

    back

    Return the last character

    starts_with

    Checks if the string begins with the given prefix

    ends_with

    Checks if the string ends with the given prefix

    starts_with

    Checks if the string begins with the given prefix

    ends_with

    Checks if the string ends with the given prefix

    find

    Finds the first occurrence of character in this view

    rfind

    Finds the first occurrence of character in this view

    remove_prefix

    Remove the first characters

    remove_suffix

    Remove the last characters

    options

    Return the decoding options

    compare

    Return the result of comparing to another string

    compare

    Return the result of comparing to another string

    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;

    value_type

    The value type

    Synopsis

    using value_type = char ;

    Declared in file <boost/url/decode_view.hpp> at line 113

    reference

    The reference type

    Synopsis

    using reference = char ;

    Declared in file <boost/url/decode_view.hpp> at line 117

    const_reference

    The reference type

    Synopsis

    using const_reference = char ;

    Declared in file <boost/url/decode_view.hpp> at line 120

    size_type

    The unsigned integer type

    Synopsis

    using size_type = size_t ;

    Declared in file <boost/url/decode_view.hpp> at line 124

    difference_type

    The signed integer type

    Synopsis

    using difference_type = ptrdiff_t ;

    Declared in file <boost/url/decode_view.hpp> at line 128

    iterator

    Synopsis

    class iterator ;

    Declared in file <boost/url/impl/decode_view.hpp> at line 19

    Types

    Name Description
    value_type
    reference
    pointer
    const_reference
    size_type
    difference_type
    iterator_category

    Member Functions

    Name Description
    iterator
    iterator
    operator=
    operator*
    operator++
    operator--
    operator++
    operator--
    base
    operator==
    operator!=

    value_type

    Synopsis

    using value_type = char ;

    Declared in file <boost/url/impl/decode_view.hpp> at line 49

    reference

    Synopsis

    using reference = char ;

    Declared in file <boost/url/impl/decode_view.hpp> at line 50

    pointer

    Synopsis

    using pointer = const void* ;

    Declared in file <boost/url/impl/decode_view.hpp> at line 51

    const_reference

    Synopsis

    using const_reference = char ;

    Declared in file <boost/url/impl/decode_view.hpp> at line 52

    size_type

    Synopsis

    using size_type = size_t ;

    Declared in file <boost/url/impl/decode_view.hpp> at line 53

    difference_type

    Synopsis

    using difference_type = ptrdiff_t ;

    Declared in file <boost/url/impl/decode_view.hpp> at line 54

    iterator_category

    Synopsis

    using iterator_category = bidirectional_iterator_tag ;

    Declared in file <boost/url/impl/decode_view.hpp> at line 55

    iterator

    Synopsis

    void iterator();

    Declared in file <boost/url/impl/decode_view.hpp> at line 58

    iterator

    Synopsis

    void iterator( const iterator&);

    Declared in file <boost/url/impl/decode_view.hpp> at line 60

    operator=

    Synopsis

    iterator& operator=( const iterator&);

    Declared in file <boost/url/impl/decode_view.hpp> at line 62

    operator*

    Synopsis

    reference operator*() noexcept;

    Declared in file <src/decode_view.cpp> at line 48

    operator++

    Synopsis

    iterator& operator++() noexcept;

    Declared in file <boost/url/impl/decode_view.hpp> at line 69

    operator--

    Synopsis

    iterator& operator--() noexcept;

    Declared in file <boost/url/impl/decode_view.hpp> at line 80

    operator++

    Synopsis

    iterator operator++( int) noexcept;

    Declared in file <boost/url/impl/decode_view.hpp> at line 92

    operator--

    Synopsis

    iterator operator--( int) noexcept;

    Declared in file <boost/url/impl/decode_view.hpp> at line 100

    base

    Synopsis

    const char* base();

    Declared in file <boost/url/impl/decode_view.hpp> at line 108

    operator==

    Synopsis

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

    Declared in file <boost/url/impl/decode_view.hpp> at line 114

    operator!=

    Synopsis

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

    Declared in file <boost/url/impl/decode_view.hpp> at line 121

    const_iterator

    iterator

    Synopsis

    using const_iterator = iterator ;

    Declared in file <boost/url/decode_view.hpp> at line 145

    decode_view

    Constructor

    Synopsis

    void decode_view() noexcept;

    Declared in file <boost/url/decode_view.hpp> at line 174

    Description

    Default-constructed views represent empty strings.

    Example

    decode_view ds;

    Postconditions

    this->empty() == true

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    decode_view

    Constructor

    Synopsis

    void decode_view( pct_string_view s, encoding_opts opt) noexcept;

    Declared in file <boost/url/decode_view.hpp> at line 209

    Description

    This constructs a view from the character buffer `s`, which must remain valid and unmodified until the view is no longer accessed.

    Example

    decode_view ds( "Program%20Files" );

    Postconditions

    this->encoded() == s

    Complexity

    Linear in `s.size()`.

    Exception Safety

    Exceptions thrown on invalid input.

    empty

    Return true if the string is empty

    Synopsis

    bool empty() noexcept;

    Declared in file <boost/url/decode_view.hpp> at line 239

    Description

    Example

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

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    size

    Return the number of decoded characters

    Synopsis

    size_type size() noexcept;

    Declared in file <boost/url/decode_view.hpp> at line 263

    Description

    Example

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

    Effects

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

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    begin

    Return an iterator to the beginning

    Synopsis

    iterator begin() noexcept;

    Declared in file <boost/url/impl/decode_view.hpp> at line 131

    Description

    Example

    auto it = this->begin();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    end

    Return an iterator to the end

    Synopsis

    iterator end() noexcept;

    Declared in file <boost/url/impl/decode_view.hpp> at line 140

    Description

    Example

    auto it = this->end();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    front

    Return the first character

    Synopsis

    reference front() noexcept;

    Declared in file <boost/url/impl/decode_view.hpp> at line 149

    Description

    Example

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

    Preconditions

    not this->empty()

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    back

    Return the last character

    Synopsis

    reference back() noexcept;

    Declared in file <boost/url/impl/decode_view.hpp> at line 159

    Description

    Example

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

    Preconditions

    not this->empty()

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    starts_with

    Checks if the string begins with the given prefix

    Synopsis

    bool starts_with( string_view s) noexcept;

    Declared in file <src/decode_view.cpp> at line 137

    Description

    Example

    assert( decode_view( "Program%20Files" ).starts_with("Program") );

    Complexity

    Linear.

    Exception Safety

    Throws nothing.

    ends_with

    Checks if the string ends with the given prefix

    Synopsis

    bool ends_with( string_view s) noexcept;

    Declared in file <src/decode_view.cpp> at line 157

    Description

    Example

    assert( decode_view( "Program%20Files" ).ends_with("Files") );

    Complexity

    Linear.

    Exception Safety

    Throws nothing.

    starts_with

    Checks if the string begins with the given prefix

    Synopsis

    bool starts_with( char ch) noexcept;

    Declared in file <src/decode_view.cpp> at line 179

    Description

    Example

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

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    ends_with

    Checks if the string ends with the given prefix

    Synopsis

    bool ends_with( char ch) noexcept;

    Declared in file <src/decode_view.cpp> at line 188

    Description

    Example

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

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    find

    Finds the first occurrence of character in this view

    Synopsis

    const_iterator find( char ch) noexcept;

    Declared in file <src/decode_view.cpp> at line 197

    Description

    Complexity

    Linear.

    Exception Safety

    Throws nothing.

    rfind

    Finds the first occurrence of character in this view

    Synopsis

    const_iterator rfind( char ch) noexcept;

    Declared in file <src/decode_view.cpp> at line 212

    Description

    Complexity

    Linear.

    Exception Safety

    Throws nothing.

    remove_prefix

    Remove the first characters

    Synopsis

    void remove_prefix( size_type n);

    Declared in file <src/decode_view.cpp> at line 106

    Description

    Example

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

    Preconditions

    not this->empty()

    Complexity

    Linear.

    remove_suffix

    Remove the last characters

    Synopsis

    void remove_suffix( size_type n);

    Declared in file <src/decode_view.cpp> at line 122

    Description

    Example

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

    Preconditions

    not this->empty()

    Complexity

    Linear.

    options

    Return the decoding options

    Synopsis

    encoding_opts options() noexcept;

    Declared in file <boost/url/decode_view.hpp> at line 479

    compare

    Return the result of comparing to another string

    Synopsis

    int compare( string_view other) noexcept;

    Declared in file <src/decode_view.cpp> at line 82

    Description

    The length of the sequences to compare is the smaller of `size()` and `other.size()`.

    The function compares the two strings as if by calling `char_traits >::compare(to_string().data(), v.data(), rlen)`. This means the comparison is performed with percent-decoding applied to the current string.

    compare

    Return the result of comparing to another string

    Synopsis

    int compare( decode_view other) noexcept;

    Declared in file <src/decode_view.cpp> at line 89

    Description

    The length of the sequences to compare is the smaller of `size()` and `other.size()`.

    The function compares the two strings as if by calling `char_traits >::compare(to_string().data(), v.to_string().data(), rlen)`. This means the comparison is performed with percent-decoding applied to the current string.

    pct_string_view

    A reference to a valid percent-encoded string

    Synopsis

    class pct_string_view : public string_view_base;

    Declared in file <boost/url/pct_string_view.hpp> at line 73

    Types

    Name Description
    traits_type

    The character traits

    value_type

    The value type

    pointer

    The pointer type

    const_pointer

    The const pointer type

    reference

    The reference type

    const_reference

    The const reference type

    const_iterator

    The const iterator type

    iterator

    The iterator type

    const_reverse_iterator

    The const reverse iterator type

    reverse_iterator

    The reverse iterator type

    size_type

    The size type

    difference_type

    The difference type

    Member Functions

    Name Description
    operator string_view

    Conversion

    operator string

    Conversion

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    cbegin

    Return an iterator to the beginning

    cend

    Return an iterator to the end

    rbegin
    rend
    crbegin
    crend
    size

    Return the size

    length

    Return the size

    max_size

    Return the maximum allowed size

    empty

    Return true if the string is empty

    operator[]

    Access a character

    at

    Access a character

    front

    Return the first character

    back

    Return the last character

    data

    Return a pointer to the character buffer

    copy

    Copy the characters to another buffer

    substr

    Return a view to part of the string

    compare

    Return the result of comparing to another string

    compare

    Return the result of comparing to another string

    compare

    Return the result of comparing to another string

    compare

    Return the result of comparing to another string

    compare

    Return the result of comparing to another string

    compare

    Return the result of comparing to another string

    starts_with

    Return true if a matching prefix exists

    starts_with

    Return true if a matching prefix exists

    starts_with

    Return true if a matching prefix exists

    ends_with

    Return true if a matching suffix exists

    ends_with

    Return true if a matching suffix exists

    ends_with

    Return true if a matching suffix exists

    find

    Return the position of matching characters

    find

    Return the position of matching characters

    find

    Return the position of matching characters

    find

    Return the position of matching characters

    rfind

    Return the position of matching characters

    rfind

    Return the position of matching characters

    rfind

    Return the position of matching characters

    rfind

    Return the position of matching characters

    find_first_of

    Return the position of the first match

    find_first_of

    Return the position of the first match

    find_first_of

    Return the position of the first match

    find_first_of

    Return the position of the first match

    find_last_of

    Return the position of the last match

    find_last_of

    Return the position of the last match

    find_last_of

    Return the position of the last match

    find_last_of

    Return the position of the last match

    find_first_not_of

    Return the position of the first non-match

    find_first_not_of

    Return the position of the first non-match

    find_first_not_of

    Return the position of the first non-match

    find_first_not_of

    Return the position of the first non-match

    find_last_not_of

    Return the position of the last non-match

    find_last_not_of

    Return the position of the last non-match

    find_last_not_of

    Return the position of the last non-match

    find_last_not_of

    Return the position of the last non-match

    contains

    Return true if matching characters are found

    contains

    Return true if matching characters are found

    contains

    Return true if matching characters are found

    pct_string_view

    Constructor

    pct_string_view

    Constructor

    pct_string_view
    pct_string_view

    Constructor (deleted)

    pct_string_view

    Constructor

    pct_string_view

    Constructor

    operator=

    Assignment

    decoded_size

    Return the decoded size

    operator*

    Return the string as a range of decoded characters

    decode

    Return the string with percent-decoding

    operator->
    swap

    Swap

    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;

    pct_string_view

    Constructor

    Synopsis

    void pct_string_view();

    Declared in file <boost/url/pct_string_view.hpp> at line 117

    Description

    Default constructed string are empty.

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    pct_string_view

    Constructor

    Synopsis

    void pct_string_view( const pct_string_view& other);

    Declared in file <boost/url/pct_string_view.hpp> at line 138

    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.

    pct_string_view

    Synopsis

    template< class String, class = enable_if<std::is_convertible::value>::type> void pct_string_view( const String& s);

    Declared in file <boost/url/pct_string_view.hpp> at line 176

    pct_string_view

    Constructor (deleted)

    Synopsis

    void pct_string_view( nullptr_t) = delete;

    Declared in file <boost/url/pct_string_view.hpp> at line 185

    pct_string_view

    Constructor

    Synopsis

    void pct_string_view( const char* s, size_t len);

    Declared in file <boost/url/pct_string_view.hpp> at line 210

    Description

    The newly constructed string references the specified character buffer. Ownership is not transferred.

    Postconditions

    this->data() == s && this->size() == len

    Complexity

    Linear in `len`.

    Exception Safety

    Exceptions thrown on invalid input.

    pct_string_view

    Constructor

    Synopsis

    void pct_string_view( string_view s);

    Declared in file <src/pct_string_view.cpp> at line 37

    Description

    The newly constructed string references the specified character buffer. Ownership is not transferred.

    Postconditions

    this->data() == s.data() && this->size() == s.size()

    Complexity

    Linear in `s.size()`.

    Exception Safety

    Exceptions thrown on invalid input.

    operator=

    Assignment

    Synopsis

    pct_string_view& operator=( const pct_string_view& other);

    Declared in file <boost/url/pct_string_view.hpp> at line 263

    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.

    decoded_size

    Return the decoded size

    Synopsis

    size_t decoded_size() noexcept;

    Declared in file <boost/url/pct_string_view.hpp> at line 287

    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.

    operator*

    Return the string as a range of decoded characters

    Synopsis

    decode_view operator*() noexcept;

    Declared in file <boost/url/decode_view.hpp> at line 670

    Description

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    decode

    Return the string with percent-decoding

    Synopsis

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

    Declared in file <boost/url/pct_string_view.hpp> at line 345

    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.

    operator->

    Synopsis

    const pct_string_view* operator->() noexcept;

    Declared in file <boost/url/pct_string_view.hpp> at line 366

    swap

    Swap

    Synopsis

    void swap( pct_string_view& s) noexcept;

    Declared in file <boost/url/pct_string_view.hpp> at line 378

    make_pct_string_view_unsafe

    Synopsis

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

    Declared in file <boost/url/pct_string_view.hpp> at line 431

    make_pct_string_view

    Return a valid percent-encoded string

    Synopsis

    result<pct_string_view> make_pct_string_view( string_view s) noexcept;

    Declared in file <src/pct_string_view.cpp> at line 48

    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.

    operator==

    Synopsis

    template< class S0, class S1> enable_if<is_match::value, bool>::type operator==( const S0& s0, const S1& s1) noexcept;

    Declared in file <boost/url/decode_view.hpp> at line 579

    operator!=

    Synopsis

    template< class S0, class S1> enable_if<is_match::value, bool>::type operator!=( const S0& s0, const S1& s1) noexcept;

    Declared in file <boost/url/decode_view.hpp> at line 588

    operator<

    Synopsis

    template< class S0, class S1> enable_if<is_match::value, bool>::type operator<( const S0& s0, const S1& s1) noexcept;

    Declared in file <boost/url/decode_view.hpp> at line 597

    operator<=

    Synopsis

    template< class S0, class S1> enable_if<is_match::value, bool>::type operator<=( const S0& s0, const S1& s1) noexcept;

    Declared in file <boost/url/decode_view.hpp> at line 606

    operator>

    Synopsis

    template< class S0, class S1> enable_if<is_match::value, bool>::type operator>( const S0& s0, const S1& s1) noexcept;

    Declared in file <boost/url/decode_view.hpp> at line 615

    operator>=

    Synopsis

    template< class S0, class S1> enable_if<is_match::value, bool>::type operator>=( const S0& s0, const S1& s1) noexcept;

    Declared in file <boost/url/decode_view.hpp> at line 624

    operator<<

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

    Synopsis

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

    Declared in file <boost/url/decode_view.hpp> at line 634

    Description

    This function serializes the decoded view to the output stream.

    sub_delim_chars

    The sub-delims character set

    Synopsis

    const lut_chars sub_delim_chars ;

    Declared in file <boost/url/rfc/sub_delim_chars.hpp> at line 45

    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 = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="

    Specification

  • 2.2. Reserved Characters (rfc3986)
  • unreserved_chars

    The unreserved character set

    Synopsis

    const lut_chars unreserved_chars ;

    Declared in file <boost/url/rfc/unreserved_chars.hpp> at line 44

    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 / "-" / "." / "_" / "~"

    Specification

  • 2.3. Unreserved Characters (rfc3986)
  • pchars

    The path character set

    Synopsis

    lut_chars pchars ;

    Declared in file <boost/url/rfc/pchars.hpp> at line 45

    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

  • 3.3. Path (rfc3986)
  • encoded_size

    Return the buffer size needed for percent-encoding

    Synopsis

    template< class CharSet> size_t encoded_size( string_view s, const CharSet& unreserved, encoding_opts opt) noexcept;

    Declared in file <boost/url/impl/encode.hpp> at line 28

    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.

    Specification

  • 2.1. Percent-Encoding (rfc3986)
  • encode

    Apply percent-encoding to a string

    Synopsis

    template< class CharSet> size_t encode( char* dest, size_t size, string_view s, const CharSet& unreserved, encoding_opts opt);

    Declared in file <boost/url/impl/encode.hpp> at line 79

    Description

    This function applies percent-encoding to the string using the given options and character set. The destination buffer provided by the caller is used to store the result, which may be truncated if there is insufficient space.

    Example

    char buf[100]; assert( encode( buf, sizeof(buf), "Program Files", pchars ) == 15 );

    Exception Safety

    Throws nothing.

    Specification

  • 2.1. Percent-Encoding (rfc3986)
  • encode_unsafe

    Synopsis

    template< class CharSet> size_t encode_unsafe( char* dest, size_t size, string_view s, const CharSet& unreserved, encoding_opts opt);

    Declared in file <boost/url/impl/encode.hpp> at line 173

    encode

    Return a percent-encoded string

    Synopsis

    template< class StringToken = return_string, class CharSet> StringToken::result_type encode( string_view s, const CharSet& unreserved, encoding_opts opt, StringToken&& token) noexcept;

    Declared in file <boost/url/impl/encode.hpp> at line 250

    Description

    This function applies percent-encoding to the string using the given options and character set, and returns the result as a string when called with default arguments.

    Example

    encoding_opts opt; opt.space_as_plus = true; std::string s = encode( "My Stuff", opt, pchars ); assert( s == "My+Stuff" );

    Exception Safety

    Calls to allocate may throw.

    Specification

  • 2.1. Percent-Encoding (rfc3986)
  • no_value_t

    The type of no_value

    Synopsis

    struct no_value_t ;

    Declared in file <boost/url/param.hpp> at line 30

    param_pct_view

    A query parameter

    Synopsis

    struct param_pct_view ;

    Declared in file <boost/url/param.hpp> at line 638

    Member Functions

    Name Description
    param_pct_view

    Constructor

    param_pct_view

    Constructor

    param_pct_view

    Constructor

    param_pct_view

    Construction

    operator param

    Conversion

    operator param_view
    operator->
    param_pct_view

    Data Members

    Name Description
    key

    The key

    value

    The value

    has_value

    True if a value is present

    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

  • Query string (Wikipedia)
  • param_pct_view

    Constructor

    Synopsis

    void param_pct_view();

    Declared in file <boost/url/param.hpp> at line 689

    Description

    Default constructed query parameters have an empty key and no value.

    Example

    param_pct_view qp;

    Postconditions

    this->key == "" && this->value == "" && this->has_value == false

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    param_pct_view

    Constructor

    Synopsis

    void param_pct_view( pct_string_view key, pct_string_view value) noexcept;

    Declared in file <boost/url/param.hpp> at line 725

    Description

    This constructs a parameter with a key and value, which may both contain percent escapes. The new key and value reference the same corresponding underlying 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.

    Example

    param_pct_view qp( "key", "value" );

    Postconditions

    this->key.data() == key.data() && this->value.data() == value.data() && this->has_value == true

    Complexity

    Linear in `key.size() + value.size()`.

    Exception Safety

    Exceptions thrown on invalid input.

    param_pct_view

    Constructor

    Synopsis

    template< class OptionalString> void param_pct_view( pct_string_view key, const OptionalString& value);

    Declared in file <boost/url/param.hpp> at line 776

    Description

    This constructs a parameter with a key and optional value, which may both contain percent escapes.

    The new key and value reference the same corresponding underlying 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.

    Example

    param_pct_view qp( "key", optional("value") );

    Postconditions

    this->key.data() == key.data() && this->value->data() == value->data() && this->has_value == true

    Complexity

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

    Exception Safety

    Exceptions thrown on invalid input.

    param_pct_view

    Construction

    Synopsis

    void param_pct_view( const param_view& p);

    Declared in file <boost/url/param.hpp> at line 816

    Description

    This converts a param which may contain unvalidated percent-escapes into a param whose key and value are guaranteed to contain strings with no invalid percent-escapes, otherwise an exception is thrown.

    The new key and value reference the same corresponding underlying 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.

    Example

    param_pct_view qp( param_view( "key", "value" ) );

    Complexity

    Linear in `key.size() + value.size()`.

    Exception Safety

    Exceptions thrown on invalid input.

    operator param

    Conversion

    Synopsis

    param operator param();

    Declared in file <boost/url/param.hpp> at line 840

    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.

    operator param_view

    Synopsis

    param_view operator param_view() noexcept;

    Declared in file <boost/url/param.hpp> at line 850

    operator->

    Synopsis

    const param_pct_view* operator->() noexcept;

    Declared in file <boost/url/param.hpp> at line 859

    param_pct_view

    Synopsis

    void param_pct_view( pct_string_view key, pct_string_view value, bool has_value) noexcept;

    Declared in file <boost/url/param.hpp> at line 866

    param_view

    A query parameter

    Synopsis

    struct param_view ;

    Declared in file <boost/url/param.hpp> at line 404

    Member Functions

    Name Description
    param_view

    Constructor

    param_view

    Constructor

    param_view

    Constructor

    operator param

    Conversion

    operator->
    param_view

    Data Members

    Name Description
    key

    The key

    value

    The value

    has_value

    True if a value is present

    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

  • Query string (Wikipedia)
  • param_view

    Constructor

    Synopsis

    void param_view();

    Declared in file <boost/url/param.hpp> at line 455

    Description

    Default constructed query parameters have an empty key and no value.

    Example

    param_view qp;

    Postconditions

    this->key == "" && this->value == "" && this->has_value == false

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    param_view

    Constructor

    Synopsis

    template< class OptionalString> void param_view( string_view key, const OptionalString& value) noexcept;

    Declared in file <boost/url/param.hpp> at line 494

    Description

    This constructs a parameter with a key and value. No validation is performed on the strings. The new key and value reference the same corresponding underlying 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.

    Example

    param_view qp( "key", "value" );

    Postconditions

    this->key.data() == key.data() && this->value.data() == value.data() && this->has_value == true

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    param_view

    Constructor

    Synopsis

    void param_view( const param& other) noexcept;

    Declared in file <boost/url/param.hpp> at line 531

    Description

    This function constructs a param which references the character buffers representing the key and value in another container. 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.

    Example

    param qp( "key", "value" ); param_view qpv( qp );

    Postconditions

    this->key == key && this->value == value && this->has_value == other.has_value

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    operator param

    Conversion

    Synopsis

    param operator param();

    Declared in file <boost/url/param.hpp> at line 554

    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.

    operator->

    Synopsis

    const param_view* operator->() noexcept;

    Declared in file <boost/url/param.hpp> at line 563

    param_view

    Synopsis

    void param_view( string_view key_, string_view value_, bool has_value_) noexcept;

    Declared in file <boost/url/param.hpp> at line 570

    no_value

    Constant indicating no value in a param

    Synopsis

    const no_value_t no_value ;

    Declared in file <boost/url/param.hpp> at line 36

    param

    A query parameter

    Synopsis

    struct param ;

    Declared in file <boost/url/param.hpp> at line 75

    Member Functions

    Name Description
    param

    Constructor

    param

    Constructor

    param

    Constructor

    operator=

    Assignment

    operator=

    Assignment

    param

    Constructor

    operator=

    Assignment

    operator=

    Assignment

    operator->
    param

    Data Members

    Name Description
    key

    The key

    value

    The value

    has_value

    True if a value is present

    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

  • Query string (Wikipedia)
  • param

    Constructor

    Synopsis

    void param();

    Declared in file <boost/url/param.hpp> at line 124

    Description

    Default constructed query parameters have an empty key and no value.

    Example

    param qp;

    Postconditions

    this->key == "" && this->value == "" && this->has_value == false

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    param

    Constructor

    Synopsis

    void param( param&& other) noexcept;

    Declared in file <boost/url/param.hpp> at line 142

    Description

    Upon construction, this acquires ownership of the members of other via move construction. The moved from object is as if default constructed.

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    other The object to construct from.

    param

    Constructor

    Synopsis

    void param( const param& other);

    Declared in file <boost/url/param.hpp> at line 173

    Description

    Upon construction, this becomes a copy of `other`.

    Postconditions

    this->key == other.key && this->value == other.value && this->has_value == other.has_value

    Complexity

    Linear in `other.key.size() + other.value.size()`.

    Exception Safety

    Calls to allocate may throw.

    other The object to construct from.

    operator=

    Assignment

    Synopsis

    param& operator=( param&& other) noexcept;

    Declared in file <boost/url/param.hpp> at line 191

    Description

    Upon assignment, this acquires ownership of the members of other via move assignment. The moved from object is as if default constructed.

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    other The object to assign from.

    operator=

    Assignment

    Synopsis

    param& operator=( const param&);

    Declared in file <boost/url/param.hpp> at line 224

    Description

    Upon assignment, this becomes a copy of `other`.

    Postconditions

    this->key == other.key && this->value == other.value && this->has_value == other.has_value

    Complexity

    Linear in `other.key.size() + other.value.size()`.

    Exception Safety

    Calls to allocate may throw.

    other The object to assign from.

    param

    Constructor

    Synopsis

    template< class OptionalString> void param( string_view key, const OptionalString& value);

    Declared in file <boost/url/param.hpp> at line 278

    Description

    This constructs a parameter with a key and value.

    No validation is performed on the strings. Ownership of the key and value is acquired by making copies.

    Example

    param qp( "key", "value" ); param qp( "key", optional("value") ); param qp( "key", boost::none ); param qp( "key", nullptr ); param qp( "key", no_value );

    Postconditions

    this->key == key && this->value == value && this->has_value == true

    Complexity

    Linear in `key.size() + value.size()`.

    Exception Safety

    Calls to allocate may throw.

    operator=

    Assignment

    Synopsis

    param& operator=( const param_view& other);

    Declared in file <boost/url/param.hpp> at line 890

    Description

    The members of `other` are copied, re-using already existing string capacity.

    Postconditions

    this->key == other.key && this->value == other.value && this->has_value == other.has_value

    Complexity

    Linear in `other.key.size() + other.value.size()`.

    Exception Safety

    Calls to allocate may throw.

    operator=

    Assignment

    Synopsis

    param& operator=( const param_pct_view& other);

    Declared in file <boost/url/param.hpp> at line 914

    Description

    The members of `other` are copied, re-using already existing string capacity.

    Postconditions

    this->key == other.key && this->value == other.value && this->has_value == other.has_value

    Complexity

    Linear in `other.key.size() + other.value.size()`.

    Exception Safety

    Calls to allocate may throw.

    operator->

    Synopsis

    const param* operator->() noexcept;

    Declared in file <boost/url/param.hpp> at line 329

    param

    Synopsis

    void param( string_view key, string_view value, bool has_value) noexcept;

    Declared in file <boost/url/param.hpp> at line 336

    host_type

    Identifies the type of host in a URL.

    Synopsis

    enum host_type;

    Declared in file <boost/url/host_type.hpp> at line 24

    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.

    error

    Error codes returned the library

    Synopsis

    enum error;

    Declared in file <boost/url/error.hpp> at line 22

    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

    bad_pct_hexdig

    This error condition is fatal.

    incomplete_encoding

    This error condition is fatal.

    missing_pct_hexdig

    This error condition is fatal.

    no_space

    This error is returned when a provided output buffer was too small to hold the complete result of an algorithm.

    make_error_code

    Synopsis

    error_code make_error_code( error ev) noexcept;

    Declared in file <boost/url/impl/error.hpp> at line 64

    ipv4_address

    An IP version 4 style address.

    Synopsis

    class ipv4_address ;

    Declared in file <boost/url/ipv4_address.hpp> at line 53

    Types

    Name Description
    uint_type

    The type used to represent an address as an unsigned integer

    bytes_type

    The type used to represent an address as an array of bytes

    Member Functions

    Name Description
    ipv4_address

    Constructor.

    ipv4_address

    Constructor.

    operator=

    Copy Assignment.

    ipv4_address

    Construct from an unsigned integer.

    ipv4_address

    Construct from an array of bytes.

    ipv4_address

    Construct from a string.

    to_bytes

    Return the address as bytes, in network byte order.

    to_uint

    Return the address as an unsigned integer.

    to_string

    Return the address as a string in dotted decimal format

    to_buffer

    Write a dotted decimal string representing the address to a buffer

    is_loopback

    Return true if the address is a loopback address

    is_unspecified

    Return true if the address is unspecified

    is_multicast

    Return true if the address is a multicast address

    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

    Specification

  • IPv4 (Wikipedia)
  • 3.2.2. Host (rfc3986)
  • max_str_len

    The number of characters in the longest possible IPv4 string.

    Synopsis

    const size_t max_str_len ;

    Declared in file <boost/url/ipv4_address.hpp> at line 60

    Description

    The longest ipv4 address string is "255.255.255.255".

    uint_type

    The type used to represent an address as an unsigned integer

    Synopsis

    using uint_type = uint_least32_t ;

    Declared in file <boost/url/ipv4_address.hpp> at line 66

    bytes_type

    The type used to represent an address as an array of bytes

    Synopsis

    using bytes_type = array<unsigned char, 4> ;

    Declared in file <boost/url/ipv4_address.hpp> at line 71

    ipv4_address

    Constructor.

    Synopsis

    void ipv4_address();

    Declared in file <boost/url/ipv4_address.hpp> at line 76

    ipv4_address

    Constructor.

    Synopsis

    void ipv4_address( const ipv4_address&);

    Declared in file <boost/url/ipv4_address.hpp> at line 80

    operator=

    Copy Assignment.

    Synopsis

    ipv4_address& operator=( const ipv4_address&);

    Declared in file <boost/url/ipv4_address.hpp> at line 85

    ipv4_address

    Construct from an unsigned integer.

    Synopsis

    void ipv4_address( uint_type u) noexcept;

    Declared in file <src/ipv4_address.cpp> at line 23

    Description

    This function constructs an address from the unsigned integer `u`, where the most significant byte forms the first octet of the resulting address.

    ipv4_address

    Construct from an array of bytes.

    Synopsis

    void ipv4_address( const bytes_type& bytes) noexcept;

    Declared in file <src/ipv4_address.cpp> at line 30

    Description

    This function constructs an address from the array in `bytes`, which is interpreted in big-endian.

    ipv4_address

    Construct from a string.

    Synopsis

    void ipv4_address( string_view s);

    Declared in file <src/ipv4_address.cpp> at line 41

    Description

    This function constructs an address from the string `s`, which must contain a valid IPv4 address string or else an exception is thrown.

    NOTE

    For a non-throwing parse function, use parse_ipv4_address.

    Exception Safety

    Exceptions thrown on invalid input.

    Specification

  • 3.2.2. Host (rfc3986)
  • to_bytes

    Return the address as bytes, in network byte order.

    Synopsis

    bytes_type to_bytes() noexcept;

    Declared in file <src/ipv4_address.cpp> at line 50

    to_uint

    Return the address as an unsigned integer.

    Synopsis

    uint_type to_uint() noexcept;

    Declared in file <src/ipv4_address.cpp> at line 63

    to_string

    Return the address as a string in dotted decimal format

    Synopsis

    template< class StringToken = return_string> StringToken::result_type to_string( StringToken&& token);

    Declared in file <boost/url/ipv4_address.hpp> at line 196

    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.

    Specification

  • 2.2. Text Representation of Addresses (rfc4291)
  • to_buffer

    Write a dotted decimal string representing the address to a buffer

    Synopsis

    string_view to_buffer( char* dest, size_t dest_size);

    Declared in file <src/ipv4_address.cpp> at line 71

    Description

    The resulting buffer is not null-terminated.

    is_loopback

    Return true if the address is a loopback address

    Synopsis

    bool is_loopback() noexcept;

    Declared in file <src/ipv4_address.cpp> at line 83

    is_unspecified

    Return true if the address is unspecified

    Synopsis

    bool is_unspecified() noexcept;

    Declared in file <src/ipv4_address.cpp> at line 91

    is_multicast

    Return true if the address is a multicast address

    Synopsis

    bool is_multicast() noexcept;

    Declared in file <src/ipv4_address.cpp> at line 98

    any

    Return an address object that represents any address

    Synopsis

    static ipv4_address any() noexcept;

    Declared in file <boost/url/ipv4_address.hpp> at line 265

    loopback

    Return an address object that represents the loopback address

    Synopsis

    static ipv4_address loopback() noexcept;

    Declared in file <boost/url/ipv4_address.hpp> at line 274

    broadcast

    Return an address object that represents the broadcast address

    Synopsis

    static ipv4_address broadcast() noexcept;

    Declared in file <boost/url/ipv4_address.hpp> at line 283

    operator==

    Return true if two addresses are equal

    Synopsis

    bool operator==( const ipv4_address& a1, const ipv4_address& a2) noexcept;

    Declared in file <boost/url/ipv4_address.hpp> at line 243

    operator!=

    Return true if two addresses are not equal

    Synopsis

    bool operator!=( const ipv4_address& a1, const ipv4_address& a2) noexcept;

    Declared in file <boost/url/ipv4_address.hpp> at line 254

    operator<<

    Format the address to an output stream.

    Synopsis

    ostream& operator<<( ostream& os, const ipv4_address& addr);

    Declared in file <boost/url/ipv4_address.hpp> at line 291

    Description

    IPv4 addresses written to output streams are written in their dotted decimal format.

    parse_ipv4_address

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

    Synopsis

    result<ipv4_address> parse_ipv4_address( string_view s) noexcept;

    Declared in file <src/ipv4_address.cpp> at line 157

    ipv6_address

    An IP version 6 style address.

    Synopsis

    class ipv6_address ;

    Declared in file <boost/url/ipv6_address.hpp> at line 64

    Types

    Name Description
    bytes_type

    The type used to represent an address as an array of bytes.

    Member Functions

    Name Description
    ipv6_address

    Constructor.

    ipv6_address

    Constructor.

    operator=

    Copy Assignment

    ipv6_address

    Construct from an array of bytes.

    ipv6_address

    Construct from an IPv4 address.

    ipv6_address

    Construct from a string.

    to_bytes

    Return the address as bytes, in network byte order

    to_string

    Return the address as a string.

    to_buffer

    Write a dotted decimal string representing the address to a buffer

    is_unspecified

    Return true if the address is unspecified

    is_loopback

    Return true if the address is a loopback address

    is_v4_mapped

    Return true if the address is a mapped IPv4 address

    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

    Specification

  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • max_str_len

    The number of characters in the longest possible IPv6 string.

    Synopsis

    const size_t max_str_len ;

    Declared in file <boost/url/ipv6_address.hpp> at line 81

    Description

    The longest IPv6 address is:

    ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff

    bytes_type

    The type used to represent an address as an array of bytes.

    Synopsis

    using bytes_type = array<unsigned char, 16> ;

    Declared in file <boost/url/ipv6_address.hpp> at line 89

    Description

    Octets are stored in network byte order.

    ipv6_address

    Constructor.

    Synopsis

    void ipv6_address();

    Declared in file <boost/url/ipv6_address.hpp> at line 103

    Description

    Default constructed objects represent the unspecified address.

  • 2.5.2. The Unspecified Address
  • ipv6_address

    Constructor.

    Synopsis

    void ipv6_address( const ipv6_address&);

    Declared in file <boost/url/ipv6_address.hpp> at line 107

    operator=

    Copy Assignment

    Synopsis

    ipv6_address& operator=( const ipv6_address&);

    Declared in file <boost/url/ipv6_address.hpp> at line 112

    ipv6_address

    Construct from an array of bytes.

    Synopsis

    void ipv6_address( const bytes_type& bytes) noexcept;

    Declared in file <src/ipv6_address.cpp> at line 24

    Description

    This function constructs an address from the array in `bytes`, which is interpreted in big-endian.

    ipv6_address

    Construct from an IPv4 address.

    Synopsis

    void ipv6_address( const ipv4_address& addr) noexcept;

    Declared in file <src/ipv6_address.cpp> at line 32

    Description

    This function constructs an IPv6 address from the IPv4 address `addr`. The resulting address is an IPv4-Mapped IPv6 Address.

    Specification

  • 2.5.5.2. IPv4-Mapped IPv6 Address (rfc4291)
  • ipv6_address

    Construct from a string.

    Synopsis

    void ipv6_address( string_view s);

    Declared in file <src/ipv6_address.cpp> at line 43

    Description

    This function constructs an address from the string `s`, which must contain a valid IPv6 address string or else an exception is thrown.

    NOTE

    For a non-throwing parse function, use parse_ipv6_address.

    Exception Safety

    Exceptions thrown on invalid input.

    Specification

  • 3.2.2. Host (rfc3986)
  • to_bytes

    Return the address as bytes, in network byte order

    Synopsis

    bytes_type to_bytes() noexcept;

    Declared in file <boost/url/ipv6_address.hpp> at line 175

    to_string

    Return the address as a string.

    Synopsis

    template< class StringToken = return_string> StringToken::result_type to_string( StringToken&& token);

    Declared in file <boost/url/ipv6_address.hpp> at line 223

    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.

    Specification

  • 2.2. Text Representation of Addresses (rfc4291)
  • to_buffer

    Write a dotted decimal string representing the address to a buffer

    Synopsis

    string_view to_buffer( char* dest, size_t dest_size);

    Declared in file <src/ipv6_address.cpp> at line 52

    Description

    The resulting buffer is not null-terminated.

    is_unspecified

    Return true if the address is unspecified

    Synopsis

    bool is_unspecified() noexcept;

    Declared in file <src/ipv6_address.cpp> at line 71

    Description

    The address 0:0:0:0:0:0:0:0 is called the unspecified address. It indicates the absence of an address.

    Specification

  • 2.5.2. The Unspecified Address (rfc4291)
  • is_loopback

    Return true if the address is a loopback address

    Synopsis

    bool is_loopback() noexcept;

    Declared in file <src/ipv6_address.cpp> at line 64

    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.

    Specification

  • 2.5.3. The Loopback Address (rfc4291)
  • is_v4_mapped

    Return true if the address is a mapped IPv4 address

    Synopsis

    bool is_v4_mapped() noexcept;

    Declared in file <src/ipv6_address.cpp> at line 78

    Description

    This address type is used to represent the addresses of IPv4 nodes as IPv6 addresses.

    Specification

  • 2.5.5.2. IPv4-Mapped IPv6 Address (rfc4291)
  • loopback

    Return an address object that represents the loopback address

    Synopsis

    static ipv6_address loopback() noexcept;

    Declared in file <src/ipv6_address.cpp> at line 92

    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.

    Specification

  • 2.5.3. The Loopback Address (rfc4291)
  • operator==

    Return true if two addresses are equal

    Synopsis

    bool operator==( const ipv6_address& a1, const ipv6_address& a2) noexcept;

    Declared in file <boost/url/ipv6_address.hpp> at line 293

    operator!=

    Return true if two addresses are not equal

    Synopsis

    bool operator!=( const ipv6_address& a1, const ipv6_address& a2) noexcept;

    Declared in file <boost/url/ipv6_address.hpp> at line 304

    operator<<

    Format the address to an output stream

    Synopsis

    ostream& operator<<( ostream& os, const ipv6_address& addr);

    Declared in file <boost/url/ipv6_address.hpp> at line 329

    Description

    This function writes the address to an output stream using standard notation.

    parse_ipv6_address

    Parse a string containing an IPv6 address.

    Synopsis

    result<ipv6_address> parse_ipv6_address( string_view s) noexcept;

    Declared in file <src/ipv6_address.cpp> at line 242

    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.

    scheme

    Identifies a known URL scheme

    Synopsis

    enum scheme;

    Declared in file <boost/url/scheme.hpp> at line 33

    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

  • 3.1. Scheme (rfc3986)
  • ftp

    FTP is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network.

    Specification

  • The 'ftp' URI Scheme
  • file

    The File URI Scheme is typically used to retrieve files from within one's own computer.

    Specification

  • The "file" URI Scheme (rfc8089)
  • http

    URLs of this type indicate a resource which is interacted with using the HTTP protocol.

    Specification

  • Hypertext Transfer Protocol (HTTP/1.1) (rfc7230)
  • https

    URLs of this type indicate a resource which is interacted with using the Secure HTTP protocol.

    Specification

  • Hypertext Transfer Protocol (HTTP/1.1) (rfc7230)
  • ws

    URLs of this type indicate a resource which is interacted with using the WebSocket protocol.

    Specification

  • The WebSocket Protocol (rfc6455)
  • wss

    URLs of this type indicate a resource which is interacted with using the Secure WebSocket protocol.

    Specification

  • The WebSocket Protocol (rfc6455)
  • string_to_scheme

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

    Synopsis

    scheme string_to_scheme( string_view s) noexcept;

    Declared in file <src/scheme.cpp> at line 20

    Description

    If the string does not identify a known scheme, the value scheme::unknown is returned.

    BNF

    scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

    Specification

  • 3.1. Scheme (rfc3986)
  • to_string

    Return the normalized string for a known scheme

    Synopsis

    string_view to_string( scheme s) noexcept;

    Declared in file <src/scheme.cpp> at line 93

    default_port

    Return the default port for a known scheme

    Synopsis

    uint16_t default_port( scheme s) noexcept;

    Declared in file <src/scheme.cpp> at line 111

    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:

  • scheme::ftp = 21
  • scheme::http, scheme::ws = 80
  • scheme::https, scheme::wss = 443
  • url_view

    A non-owning reference to a valid URL

    Synopsis

    class url_view : public url_view_base;

    Declared in file <boost/url/url_view.hpp> at line 74

    Member Functions

    Name Description
    digest
    size

    Return the number of characters in the url

    empty

    Return true if the url is empty

    data

    Return a pointer to the url's character buffer

    buffer

    Return the url string

    operator string_view

    Return the URL as a core::string_view

    persist

    Return a shared, persistent copy of the url

    has_scheme

    Return true a scheme is present

    scheme

    Return the scheme

    scheme_id

    Return the scheme

    has_authority

    Return true if an authority is present

    authority

    Return the authority

    encoded_authority

    Return the authority.

    has_userinfo

    Return true if a userinfo is present

    has_password

    Return true if a password is present

    userinfo

    Return the userinfo

    encoded_userinfo

    Return the userinfo

    user

    Return the user

    encoded_user

    Return the user

    password

    Return the password

    encoded_password

    Return the password

    host_type

    Return the host type

    host

    Return the host

    encoded_host

    Return the host

    host_address

    Return the host

    encoded_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

    encoded_host_name

    Return the host name

    zone_id

    Return the IPv6 Zone ID

    encoded_zone_id

    Return the IPv6 Zone ID

    has_port

    Return true if a port is present

    port

    Return the port

    port_number

    Return the port

    is_path_absolute

    Return true if the path is absolute

    path

    Return the path

    encoded_path

    Return the path

    segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    has_query

    Return true if a query is present

    query

    Return the query

    encoded_query

    Return the query

    params

    Return the query as a container of parameters

    params
    encoded_params

    Return the query as a container of parameters

    has_fragment

    Return true if a fragment is present

    fragment

    Return the fragment

    encoded_fragment

    Return the fragment

    encoded_host_and_port

    Return the host and port

    encoded_origin

    Return the origin

    encoded_resource

    Return the resource

    encoded_target

    Return the target

    compare

    Return the result of comparing this with another url

    ~url_view

    Destructor

    url_view

    Constructor

    url_view

    Constructor

    url_view
    url_view

    Constructor

    url_view

    Constructor

    operator=

    Assignment

    operator=

    Assignment

    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 ]

    Specification

  • Uniform Resource Identifier (URI): Generic Syntax (rfc3986)
  • ~url_view

    Destructor

    Synopsis

    void ~url_view();

    Declared in file <boost/url/url_view.hpp> at line 110

    Description

    Any params, segments, iterators, or other views which reference the same underlying character buffer remain valid.

    url_view

    Constructor

    Synopsis

    void url_view() noexcept;

    Declared in file <src/url_view.cpp> at line 35

    Description

    Default constructed views refer to a string with zero length, which always remains valid. This matches the grammar for a relative-ref with an empty path and no query or fragment.

    Example

    url_view u;

    Postconditions

    this->empty() == true

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

    4.2. Relative Reference (rfc3986)

    url_view

    Constructor

    Synopsis

    void url_view( string_view s);

    Declared in file <src/url_view.cpp> at line 38

    Description

    This function constructs a URL from the string `s`, which must contain a valid URI or relative-ref or else an exception is thrown. Upon successful construction, the view refers to the characters in the buffer pointed to by `s`. Ownership is not transferred; The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.

    Example

    url_view u( "http://www.example.com/index.htm" );

    Effects

    return parse_uri_reference( s ).value();

    Complexity

    Linear in `s.size()`.

    Exception Safety

    Exceptions thrown on invalid input.

    BNF

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

    Specification

  • 4.1. URI Reference
  • url_view

    Synopsis

    template< class String, class = enable_if<std::is_convertible::value && !std::is_convertible::value>::type> void url_view( const String& s);

    Declared in file <boost/url/url_view.hpp> at line 215

    url_view

    Constructor

    Synopsis

    void url_view( const url_view& other) noexcept;

    Declared in file <boost/url/url_view.hpp> at line 239

    Description

    After construction, both views reference the same underlying character buffer. Ownership is not transferred.

    Postconditions

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

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    url_view

    Constructor

    Synopsis

    void url_view( const url_view_base& other) noexcept;

    Declared in file <src/url_view.cpp> at line 45

    Description

    After construction, both views reference the same underlying character buffer. Ownership is not transferred.

    Postconditions

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

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    operator=

    Assignment

    Synopsis

    url_view& operator=( const url_view& other) noexcept;

    Declared in file <boost/url/url_view.hpp> at line 283

    Description

    After assignment, both views reference the same underlying character buffer. Ownership is not transferred.

    Postconditions

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

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    operator=

    Assignment

    Synopsis

    url_view& operator=( const url_view_base& other) noexcept;

    Declared in file <src/url_view.cpp> at line 61

    Description

    After assignment, both views reference the same underlying character buffer. Ownership is not transferred.

    Postconditions

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

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    max_size

    Return the maximum number of characters possible

    Synopsis

    static size_t max_size() noexcept;

    Declared in file <boost/url/url_view.hpp> at line 331

    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.

    authority_view

    A non-owning reference to a valid authority

    Synopsis

    class authority_view ;

    Declared in file <boost/url/authority_view.hpp> at line 82

    Member Functions

    Name Description
    ~authority_view

    Destructor

    authority_view

    Constructor

    authority_view

    Construct from a string.

    authority_view

    Constructor

    operator=

    Assignment

    size

    Return the number of characters in the authority

    empty

    Return true if the authority is empty

    data

    Return a pointer to the first character

    buffer

    Return the complete authority

    has_userinfo

    Return true if a userinfo is present

    userinfo

    Return the userinfo

    encoded_userinfo

    Return the userinfo

    user

    Return the user

    encoded_user

    Return the user

    has_password

    Return true if a password is present

    password

    Return the password

    encoded_password

    Return the password

    host_type

    Return the host type

    host

    Return the host

    encoded_host

    Return the host

    host_address

    Return the host

    encoded_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

    encoded_host_name

    Return the host name

    has_port

    Return true if a port is present

    port

    Return the port

    port_number

    Return the port

    encoded_host_and_port

    Return the host and port

    compare

    Return the result of comparing this with another authority

    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

  • 3.2. Authority (rfc3986)
  • ~authority_view

    Destructor

    Synopsis

    void ~authority_view();

    Declared in file <src/authority_view.cpp> at line 49

    authority_view

    Constructor

    Synopsis

    void authority_view() noexcept;

    Declared in file <src/authority_view.cpp> at line 54

    Description

    Default constructed authorities refer to a string with zero length, which is always valid. This matches the grammar for a zero-length host.

    Exception Safety

    Throws nothing.

    Specification

    authority_view

    Construct from a string.

    Synopsis

    void authority_view( string_view s);

    Declared in file <src/authority_view.cpp> at line 60

    Description

    This function attempts to construct an authority from the string `s`, which must be a valid ['authority] or else an exception is thrown. Upon successful construction, the view refers to the characters in the buffer pointed to by `s`. Ownership is not transferred; The caller is responsible for ensuring that the lifetime of the buffer extends until the view is destroyed.

    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

  • 3.2. Authority (rfc3986)
  • authority_view

    Constructor

    Synopsis

    void authority_view( const authority_view&) noexcept;

    Declared in file <src/authority_view.cpp> at line 69

    operator=

    Assignment

    Synopsis

    authority_view& operator=( const authority_view&) noexcept;

    Declared in file <src/authority_view.cpp> at line 73

    size

    Return the number of characters in the authority

    Synopsis

    size_t size() noexcept;

    Declared in file <boost/url/authority_view.hpp> at line 191

    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.

    empty

    Return true if the authority is empty

    Synopsis

    bool empty() noexcept;

    Declared in file <boost/url/authority_view.hpp> at line 210

    Description

    An empty authority has an empty host, no userinfo, and no port.

    Example

    assert( authority_view( "" ).empty() );

    Exception Safety

    Throws nothing.

    data

    Return a pointer to the first character

    Synopsis

    const char* data() noexcept;

    Declared in file <boost/url/authority_view.hpp> at line 225

    Description

    This function returns a pointer to the beginning of the view, which is not guaranteed to be null-terminated.

    Exception Safety

    Throws nothing.

    buffer

    Return the complete authority

    Synopsis

    string_view buffer() noexcept;

    Declared in file <boost/url/authority_view.hpp> at line 253

    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

  • 3.2. Authority (rfc3986)
  • has_userinfo

    Return true if a userinfo is present

    Synopsis

    bool has_userinfo() noexcept;

    Declared in file <src/authority_view.cpp> at line 84

    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 ]

    Specification

  • 3.2.1. User Information (rfc3986)
  • userinfo

    Return the userinfo

    Synopsis

    template< class StringToken = return_string> StringToken::result_type userinfo( StringToken&& token);

    Declared in file <boost/url/authority_view.hpp> at line 346

    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 ]

    Specification

  • 3.2.1. User Information (rfc3986)
  • encoded_userinfo

    Return the userinfo

    Synopsis

    pct_string_view encoded_userinfo() noexcept;

    Declared in file <src/authority_view.cpp> at line 96

    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 ]

    Specification

  • 3.2.1. User Information (rfc3986)
  • user

    Return the user

    Synopsis

    template< class StringToken = return_string> StringToken::result_type user( StringToken&& token);

    Declared in file <boost/url/authority_view.hpp> at line 443

    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 / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • encoded_user

    Return the user

    Synopsis

    pct_string_view encoded_user() noexcept;

    Declared in file <src/authority_view.cpp> at line 115

    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 / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • has_password

    Return true if a password is present

    Synopsis

    bool has_password() noexcept;

    Declared in file <src/authority_view.cpp> at line 126

    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 / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • password

    Return the password

    Synopsis

    template< class StringToken = return_string> StringToken::result_type password( StringToken&& token);

    Declared in file <boost/url/authority_view.hpp> at line 580

    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 / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • encoded_password

    Return the password

    Synopsis

    pct_string_view encoded_password() noexcept;

    Declared in file <src/authority_view.cpp> at line 144

    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 / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • host_type

    Return the host type

    Synopsis

    host_type host_type() noexcept;

    Declared in file <boost/url/authority_view.hpp> at line 662

    Description

    This function returns one of the following constants representing the type of host present.

  • host_type::ipv4
  • host_type::ipv6
  • host_type::ipvfuture
  • host_type::name
  • Example

    assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    Specification

  • 3.2.2. Host (rfc3986)
  • host

    Return the host

    Synopsis

    template< class StringToken = return_string> StringToken::result_type host( StringToken&& token);

    Declared in file <boost/url/authority_view.hpp> at line 701

    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

  • 3.2.2. Host (rfc3986)
  • encoded_host

    Return the host

    Synopsis

    pct_string_view encoded_host() noexcept;

    Declared in file <src/authority_view.cpp> at line 190

    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

  • 3.2.2. Host (rfc3986)
  • host_address

    Return the host

    Synopsis

    template< class StringToken = return_string> StringToken::result_type host_address( StringToken&& token);

    Declared in file <boost/url/authority_view.hpp> at line 796

    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

  • 3.2.2. Host (rfc3986)
  • encoded_host_address

    Return the host

    Synopsis

    pct_string_view encoded_host_address() noexcept;

    Declared in file <src/authority_view.cpp> at line 197

    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

  • 3.2.2. Host (rfc3986)
  • host_ipv4_address

    Return the host IPv4 address

    Synopsis

    ipv4_address host_ipv4_address() noexcept;

    Declared in file <src/authority_view.cpp> at line 234

    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

  • 3.2.2. Host (rfc3986)
  • host_ipv6_address

    Return the host IPv6 address

    Synopsis

    ipv6_address host_ipv6_address() noexcept;

    Declared in file <src/authority_view.cpp> at line 247

    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

  • 3.2.2. Host (rfc3986)
  • host_ipvfuture

    Return the host IPvFuture address

    Synopsis

    string_view host_ipvfuture() noexcept;

    Declared in file <src/authority_view.cpp> at line 260

    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

  • 3.2.2. Host (rfc3986)
  • host_name

    Return the host name

    Synopsis

    template< class StringToken = return_string> StringToken::result_type host_name( StringToken&& token);

    Declared in file <boost/url/authority_view.hpp> at line 1013

    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

  • 3.2.2. Host (rfc3986)
  • encoded_host_name

    Return the host name

    Synopsis

    pct_string_view encoded_host_name() noexcept;

    Declared in file <src/authority_view.cpp> at line 275

    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

  • 3.2.2. Host (rfc3986)
  • has_port

    Return true if a port is present

    Synopsis

    bool has_port() noexcept;

    Declared in file <src/authority_view.cpp> at line 291

    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

  • 3.2.3. Port (rfc3986)
  • port

    Return the port

    Synopsis

    string_view port() noexcept;

    Declared in file <src/authority_view.cpp> at line 303

    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

  • 3.2.3. Port (rfc3986)
  • port_number

    Return the port

    Synopsis

    uint16_t port_number() noexcept;

    Declared in file <src/authority_view.cpp> at line 314

    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

  • 3.2.3. Port (rfc3986)
  • encoded_host_and_port

    Return the host and port

    Synopsis

    pct_string_view encoded_host_and_port() noexcept;

    Declared in file <src/authority_view.cpp> at line 324

    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 ]

    Specification

  • 3.2.2. Host (rfc3986)
  • 3.2.3. Port (rfc3986)
  • compare

    Return the result of comparing this with another authority

    Synopsis

    int compare( const authority_view& other) noexcept;

    Declared in file <src/authority_view.cpp> at line 350

    Description

    This function compares two authorities according to Syntax-Based comparison algorithm.

    Exception Safety

    Throws nothing.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • operator==

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

    Synopsis

    bool operator==( const authority_view& a0, const authority_view& a1) noexcept;

    Declared in file <boost/url/authority_view.hpp> at line 1246

    Description

    Complexity

    Linear in `min( a0.size(), a1.size() )`

    Exception Safety

    Throws nothing

    operator!=

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

    Synopsis

    bool operator!=( const authority_view& a0, const authority_view& a1) noexcept;

    Declared in file <boost/url/authority_view.hpp> at line 1266

    Description

    Complexity

    Linear in `min( a0.size(), a1.size() )`

    Exception Safety

    Throws nothing

    operator<

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

    Synopsis

    bool operator<( const authority_view& a0, const authority_view& a1) noexcept;

    Declared in file <boost/url/authority_view.hpp> at line 1286

    Description

    Complexity

    Linear in `min( a0.size(), a1.size() )`

    Exception Safety

    Throws nothing

    operator<=

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

    Synopsis

    bool operator<=( const authority_view& a0, const authority_view& a1) noexcept;

    Declared in file <boost/url/authority_view.hpp> at line 1306

    Description

    Complexity

    Linear in `min( a0.size(), a1.size() )`

    Exception Safety

    Throws nothing

    operator>

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

    Synopsis

    bool operator>( const authority_view& a0, const authority_view& a1) noexcept;

    Declared in file <boost/url/authority_view.hpp> at line 1326

    Description

    Complexity

    Linear in `min( a0.size(), a1.size() )`

    Exception Safety

    Throws nothing

    operator>=

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

    Synopsis

    bool operator>=( const authority_view& a0, const authority_view& a1) noexcept;

    Declared in file <boost/url/authority_view.hpp> at line 1346

    Description

    Complexity

    Linear in `min( a0.size(), a1.size() )`

    Exception Safety

    Throws nothing

    operator<<

    Format the encoded authority to the output stream

    Synopsis

    ostream& operator<<( ostream& os, const authority_view& a);

    Declared in file <boost/url/authority_view.hpp> at line 1358

    Description

    This function serializes the encoded URL to the output stream.

    Example

    authority_view a( "www.example.com" ); std::cout << a << std::endl;

    parse_authority

    Parse an authority

    Synopsis

    result<authority_view> parse_authority( string_view s) noexcept;

    Declared in file <src/authority_view.cpp> at line 337

    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

  • 3.2. Authority (rfc3986)
  • ignore_case_t

    Synopsis

    struct ignore_case_t ;

    Declared in file <boost/url/ignore_case.hpp> at line 19

    ignore_case

    Synopsis

    const ignore_case_t ignore_case ;

    Declared in file <boost/url/ignore_case.hpp> at line 31

    ignore_case_param

    An optional parameter to determine case-sensitivity

    Synopsis

    class ignore_case_param ;

    Declared in file <boost/url/ignore_case.hpp> at line 46

    Member Functions

    Name Description
    ignore_case_param

    Constructor

    ignore_case_param

    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.

    ignore_case_param

    Constructor

    Synopsis

    void ignore_case_param() noexcept;

    Declared in file <boost/url/ignore_case.hpp> at line 71

    Description

    By default, comparisons are case-sensitive.

    Example

    This function performs case-sensitive comparisons when called with no arguments:

    void f( ignore_case_param = {} );

    ignore_case_param

    Constructor

    Synopsis

    void ignore_case_param( ignore_case_t) noexcept;

    Declared in file <boost/url/ignore_case.hpp> at line 88

    Description

    Construction from ignore_case indicates that comparisons should be case-insensitive.

    Example

    When ignore_case is passed as an argument, this function ignores case when performing comparisons:

    void f( ignore_case_param = {} );

    operator bool

    True if an algorithm should ignore case

    Synopsis

    bool operator bool() noexcept;

    Declared in file <boost/url/ignore_case.hpp> at line 108

    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`.

    segments_encoded_base

    Common functionality for containers

    Synopsis

    class segments_encoded_base ;

    Declared in file <boost/url/segments_encoded_base.hpp> at line 37

    Types

    Name Description
    iterator

    Types

    Name Description
    const_iterator

    iterator

    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    An unsigned integer type used to represent size.

    difference_type

    A signed integer type used to represent differences.

    Member Functions

    Name Description
    buffer

    Return the referenced character buffer.

    is_absolute

    Returns true if this references an absolute path.

    empty

    Return true if there are no segments

    size

    Return the number of segments

    front

    Return the first segment

    back

    Return the last segment

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    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:

    Containers

  • segments_ref
  • segments_view
  • segments_encoded_ref
  • segments_encoded_view
  • iterator

    Synopsis

    class iterator ;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 20

    Types

    Name Description
    value_type
    reference
    pointer
    difference_type
    iterator_category

    Member Functions

    Name Description
    iterator
    iterator
    operator=
    operator*
    operator->
    operator++
    operator--
    operator++
    operator--
    operator==
    operator!=

    value_type

    Synopsis

    using value_type = segments_encoded_base::value_type ;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 38

    reference

    Synopsis

    using reference = segments_encoded_base::reference ;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 40

    pointer

    Synopsis

    using pointer = reference ;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 42

    difference_type

    Synopsis

    using difference_type = ptrdiff_t ;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 43

    iterator_category

    Synopsis

    using iterator_category = bidirectional_iterator_tag ;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 44

    iterator

    Synopsis

    void iterator();

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 47

    iterator

    Synopsis

    void iterator( const iterator&);

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 48

    operator=

    Synopsis

    iterator& operator=( const iterator&);

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 49

    operator*

    Synopsis

    reference operator*() noexcept;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 52

    operator->

    Synopsis

    pointer operator->() noexcept;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 58

    operator++

    Synopsis

    iterator& operator++() noexcept;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 64

    operator--

    Synopsis

    iterator& operator--() noexcept;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 71

    operator++

    Synopsis

    iterator operator++( int) noexcept;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 78

    operator--

    Synopsis

    iterator operator--( int) noexcept;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 86

    operator==

    Synopsis

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

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 94

    operator!=

    Synopsis

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

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 101

    const_iterator

    iterator

    Synopsis

    using const_iterator = iterator ;

    Declared in file <boost/url/segments_encoded_base.hpp> at line 83

    value_type

    The value type

    Synopsis

    using value_type = string ;

    Declared in file <boost/url/segments_encoded_base.hpp> at line 96

    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() );

    reference

    The reference type

    Synopsis

    using reference = pct_string_view ;

    Declared in file <boost/url/segments_encoded_base.hpp> at line 103

    Description

    This is the type of value returned when iterators of the view are dereferenced.

    const_reference

    The reference type

    Synopsis

    using const_reference = pct_string_view ;

    Declared in file <boost/url/segments_encoded_base.hpp> at line 106

    Description

    This is the type of value returned when iterators of the view are dereferenced.

    size_type

    An unsigned integer type used to represent size.

    Synopsis

    using size_type = size_t ;

    Declared in file <boost/url/segments_encoded_base.hpp> at line 110

    difference_type

    A signed integer type used to represent differences.

    Synopsis

    using difference_type = ptrdiff_t ;

    Declared in file <boost/url/segments_encoded_base.hpp> at line 114

    max_size

    Return the maximum number of characters possible

    Synopsis

    static size_t max_size() noexcept;

    Declared in file <boost/url/segments_encoded_base.hpp> at line 131

    Description

    This represents the largest number of characters that are possible in a path, not including any null terminator.

    Exception Safety

    Throws nothing.

    buffer

    Return the referenced character buffer.

    Synopsis

    pct_string_view buffer() noexcept;

    Declared in file <src/segments_encoded_base.cpp> at line 58

    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.

    is_absolute

    Returns true if this references an absolute path.

    Synopsis

    bool is_absolute() noexcept;

    Declared in file <src/segments_encoded_base.cpp> at line 65

    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.

    empty

    Return true if there are no segments

    Synopsis

    bool empty() noexcept;

    Declared in file <src/segments_encoded_base.cpp> at line 72

    Description

    Example

    assert( ! url_view( "/index.htm" ).encoded_segments().empty() );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    size

    Return the number of segments

    Synopsis

    size_t size() noexcept;

    Declared in file <src/segments_encoded_base.cpp> at line 79

    Description

    Example

    assert( url_view( "/path/to/file.txt" ).encoded_segments().size() == 3 );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    front

    Return the first segment

    Synopsis

    pct_string_view front() noexcept;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 111

    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.

    back

    Return the last segment

    Synopsis

    pct_string_view back() noexcept;

    Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 120

    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.

    begin

    Return an iterator to the beginning

    Synopsis

    iterator begin() noexcept;

    Declared in file <src/segments_encoded_base.cpp> at line 86

    Description

    Complexity

    Linear in `this->front().size()` or constant if `this->empty()`.

    Exception Safety

    Throws nothing.

    end

    Return an iterator to the end

    Synopsis

    iterator end() noexcept;

    Declared in file <src/segments_encoded_base.cpp> at line 94

    Description

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    operator<<

    Format to an output stream

    Synopsis

    ostream& operator<<( ostream& os, const segments_encoded_base& ps);

    Declared in file <src/segments_encoded_base.cpp> at line 104

    Description

    Any percent-escapes are emitted as-is; no decoding is performed.

    Complexity

    Linear in `ps.buffer().size()`.

    Effects

    return os << ps.buffer();

    segments_base

    Common functionality for containers

    Synopsis

    class segments_base ;

    Declared in file <boost/url/segments_base.hpp> at line 37

    Types

    Name Description
    iterator

    Types

    Name Description
    const_iterator

    iterator

    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    An unsigned integer type used to represent size.

    difference_type

    A signed integer type used to represent differences.

    Member Functions

    Name Description
    buffer

    Return the referenced character buffer.

    is_absolute

    Returns true if this references an absolute path.

    empty

    Return true if there are no segments

    size

    Return the number of segments

    front

    Return the first segment

    back

    Return the last segment

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    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:

    Containers

  • segments_ref
  • segments_view
  • segments_encoded_ref
  • segments_encoded_view
  • iterator

    Synopsis

    class iterator ;

    Declared in file <boost/url/impl/segments_base.hpp> at line 21

    Types

    Name Description
    value_type
    reference
    pointer
    difference_type
    iterator_category

    Member Functions

    Name Description
    iterator
    iterator
    operator=
    operator*
    operator->
    operator++
    operator--
    operator++
    operator--
    operator==
    operator!=

    value_type

    Synopsis

    using value_type = segments_base::value_type ;

    Declared in file <boost/url/impl/segments_base.hpp> at line 38

    reference

    Synopsis

    using reference = segments_base::reference ;

    Declared in file <boost/url/impl/segments_base.hpp> at line 39

    pointer

    Synopsis

    using pointer = reference ;

    Declared in file <boost/url/impl/segments_base.hpp> at line 40

    difference_type

    Synopsis

    using difference_type = segments_base::difference_type ;

    Declared in file <boost/url/impl/segments_base.hpp> at line 41

    iterator_category

    Synopsis

    using iterator_category = bidirectional_iterator_tag ;

    Declared in file <boost/url/impl/segments_base.hpp> at line 43

    iterator

    Synopsis

    void iterator();

    Declared in file <boost/url/impl/segments_base.hpp> at line 46

    iterator

    Synopsis

    void iterator( const iterator&);

    Declared in file <boost/url/impl/segments_base.hpp> at line 47

    operator=

    Synopsis

    iterator& operator=( const iterator&) noexcept;

    Declared in file <boost/url/impl/segments_base.hpp> at line 48

    operator*

    Synopsis

    reference operator*();

    Declared in file <src/segments_base.cpp> at line 21

    operator->

    Synopsis

    pointer operator->() = delete;

    Declared in file <boost/url/impl/segments_base.hpp> at line 56

    operator++

    Synopsis

    iterator& operator++() noexcept;

    Declared in file <boost/url/impl/segments_base.hpp> at line 58

    operator--

    Synopsis

    iterator& operator--() noexcept;

    Declared in file <boost/url/impl/segments_base.hpp> at line 65

    operator++

    Synopsis

    iterator operator++( int) noexcept;

    Declared in file <boost/url/impl/segments_base.hpp> at line 72

    operator--

    Synopsis

    iterator operator--( int) noexcept;

    Declared in file <boost/url/impl/segments_base.hpp> at line 80

    operator==

    Synopsis

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

    Declared in file <boost/url/impl/segments_base.hpp> at line 88

    operator!=

    Synopsis

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

    Declared in file <boost/url/impl/segments_base.hpp> at line 95

    const_iterator

    iterator

    Synopsis

    using const_iterator = iterator ;

    Declared in file <boost/url/segments_base.hpp> at line 80

    value_type

    The value type

    Synopsis

    using value_type = string ;

    Declared in file <boost/url/segments_base.hpp> at line 93

    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() );

    reference

    The reference type

    Synopsis

    using reference = string ;

    Declared in file <boost/url/segments_base.hpp> at line 100

    Description

    This is the type of value returned when iterators of the view are dereferenced.

    const_reference

    The reference type

    Synopsis

    using const_reference = string ;

    Declared in file <boost/url/segments_base.hpp> at line 103

    Description

    This is the type of value returned when iterators of the view are dereferenced.

    size_type

    An unsigned integer type used to represent size.

    Synopsis

    using size_type = size_t ;

    Declared in file <boost/url/segments_base.hpp> at line 107

    difference_type

    A signed integer type used to represent differences.

    Synopsis

    using difference_type = ptrdiff_t ;

    Declared in file <boost/url/segments_base.hpp> at line 111

    max_size

    Return the maximum number of characters possible

    Synopsis

    static size_t max_size() noexcept;

    Declared in file <boost/url/segments_base.hpp> at line 128

    Description

    This represents the largest number of characters that are possible in a path, not including any null terminator.

    Exception Safety

    Throws nothing.

    buffer

    Return the referenced character buffer.

    Synopsis

    pct_string_view buffer() noexcept;

    Declared in file <src/segments_base.cpp> at line 62

    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.

    is_absolute

    Returns true if this references an absolute path.

    Synopsis

    bool is_absolute() noexcept;

    Declared in file <src/segments_base.cpp> at line 69

    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.

    empty

    Return true if there are no segments

    Synopsis

    bool empty() noexcept;

    Declared in file <src/segments_base.cpp> at line 76

    Description

    Example

    assert( ! url_view( "/index.htm" ).segments().empty() );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    size

    Return the number of segments

    Synopsis

    size_t size() noexcept;

    Declared in file <src/segments_base.cpp> at line 83

    Description

    Example

    assert( url_view( "/path/to/file.txt" ).segments().size() == 3 );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    front

    Return the first segment

    Synopsis

    string front() noexcept;

    Declared in file <boost/url/impl/segments_base.hpp> at line 105

    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.

    back

    Return the last segment

    Synopsis

    string back() noexcept;

    Declared in file <boost/url/impl/segments_base.hpp> at line 114

    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.

    begin

    Return an iterator to the beginning

    Synopsis

    iterator begin() noexcept;

    Declared in file <src/segments_base.cpp> at line 90

    Description

    Complexity

    Linear in `this->front().size()` or constant if `this->empty()`.

    Exception Safety

    Throws nothing.

    end

    Return an iterator to the end

    Synopsis

    iterator end() noexcept;

    Declared in file <src/segments_base.cpp> at line 98

    Description

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    operator<<

    Format to an output stream

    Synopsis

    ostream& operator<<( ostream& os, const segments_base& ps);

    Declared in file <src/segments_base.cpp> at line 108

    Description

    Any percent-escapes are emitted as-is; no decoding is performed.

    Complexity

    Linear in `ps.buffer().size()`.

    Effects

    return os << ps.buffer();

    segments_view

    A view representing path segments in a URL

    Synopsis

    class segments_view : public segments_base;

    Declared in file <boost/url/segments_view.hpp> at line 55

    Types

    Name Description
    iterator

    Types

    Name Description
    const_iterator

    iterator

    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    An unsigned integer type used to represent size.

    difference_type

    A signed integer type used to represent differences.

    Member Functions

    Name Description
    buffer

    Return the referenced character buffer.

    is_absolute

    Returns true if this references an absolute path.

    empty

    Return true if there are no segments

    size

    Return the number of segments

    front

    Return the first segment

    back

    Return the last segment

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    segments_view

    Constructor

    segments_view

    Constructor

    segments_view

    Constructor

    operator=

    Assignment

    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.

    segments_view

    Constructor

    Synopsis

    void segments_view();

    Declared in file <boost/url/segments_view.hpp> at line 87

    Description

    Default-constructed segments have zero elements.

    Example

    segments_view ps;

    Effects

    return segments_view( "" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    segments_view

    Constructor

    Synopsis

    void segments_view( const segments_view& other);

    Declared in file <boost/url/segments_view.hpp> at line 111

    Description

    After construction, viewss 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

    segments_view

    Constructor

    Synopsis

    void segments_view( string_view s);

    Declared in file <src/segments_view.cpp> at line 28

    Description

    This function constructs segments from a valid path string, which can contain percent escapes. Upon construction, the view references the character buffer pointed to by `s`. caller is responsible for ensuring that the lifetime of the buffer extends until the view is destroyed.

    Example

    segments_view ps( "/path/to/file.txt" );

    Effects

    return parse_path( s ).value();

    Postconditions

    this->buffer().data() == s.data()

    Complexity

    Linear in `s`.

    Exception Safety

    Exceptions thrown on invalid input.

    BNF

    path = [ "/" ] [ segment *( "/" segment ) ] segment = *pchar

    Specification

  • 3.3. Path
  • operator=

    Assignment

    Synopsis

    segments_view& operator=( const segments_view& other);

    Declared in file <boost/url/segments_view.hpp> at line 188

    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

    segments_encoded_view

    A view representing path segments in a URL

    Synopsis

    class segments_encoded_view : public segments_encoded_base;

    Declared in file <boost/url/segments_encoded_view.hpp> at line 61

    Types

    Name Description
    iterator

    Types

    Name Description
    const_iterator

    iterator

    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    An unsigned integer type used to represent size.

    difference_type

    A signed integer type used to represent differences.

    Member Functions

    Name Description
    buffer

    Return the referenced character buffer.

    is_absolute

    Returns true if this references an absolute path.

    empty

    Return true if there are no segments

    size

    Return the number of segments

    front

    Return the first segment

    back

    Return the last segment

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    segments_encoded_view

    Constructor

    segments_encoded_view

    Constructor

    segments_encoded_view

    Constructor

    operator=

    Assignment

    operator segments_view

    Conversion

    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.

    segments_encoded_view

    Constructor

    Synopsis

    void segments_encoded_view();

    Declared in file <boost/url/segments_encoded_view.hpp> at line 92

    Description

    Default-constructed segments have zero elements.

    Example

    segments_encoded_view ps;

    Effects

    return segments_encoded_view( "" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    segments_encoded_view

    Constructor

    Synopsis

    void segments_encoded_view( const segments_encoded_view&) noexcept;

    Declared in file <boost/url/segments_encoded_view.hpp> at line 115

    Description

    After construction, both views reference the same 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

    segments_encoded_view

    Constructor

    Synopsis

    void segments_encoded_view( string_view s);

    Declared in file <src/segments_encoded_view.cpp> at line 28

    Description

    This function constructs segments from a valid path string, which can contain percent escapes. Upon construction, the view references the character buffer pointed to by `s`. caller is responsible for ensuring that the lifetime of the buffer extends until the view is destroyed.

    Example

    segments_encoded_view ps( "/path/to/file.txt" );

    Effects

    return parse_path( s ).value();

    Postconditions

    this->buffer().data() == s.data()

    Complexity

    Linear in `s`.

    Exception Safety

    Exceptions thrown on invalid input.

    BNF

    path = [ "/" ] [ segment *( "/" segment ) ] segment = *pchar

    Specification

  • 3.3. Path
  • operator=

    Assignment

    Synopsis

    segments_encoded_view& operator=( const segments_encoded_view&);

    Declared in file <boost/url/segments_encoded_view.hpp> at line 192

    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

    operator segments_view

    Conversion

    Synopsis

    segments_view operator segments_view() noexcept;

    Declared in file <src/segments_encoded_view.cpp> at line 37

    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

    parse_path

    Parse a string and return an encoded segment view

    Synopsis

    result<segments_encoded_view> parse_path( string_view s) noexcept;

    Declared in file <src/parse_path.cpp> at line 24

    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

  • 3.3. Path (rfc3986)
  • authority_rule_t

    Synopsis

    struct authority_rule_t ;

    Declared in file <boost/url/rfc/authority_rule.hpp> at line 50

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = authority_view ;

    Declared in file <boost/url/rfc/authority_rule.hpp> at line 52

    parse

    Synopsis

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

    Declared in file <src/rfc/authority_rule.cpp> at line 26

    authority_rule

    Synopsis

    const authority_rule_t authority_rule ;

    Declared in file <boost/url/rfc/authority_rule.hpp> at line 63

    pct_encoded_rule_t

    Synopsis

    template< class CharSet> struct pct_encoded_rule_t ;

    Declared in file <boost/url/rfc/pct_encoded_rule.hpp> at line 69

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = pct_string_view ;

    Declared in file <boost/url/rfc/pct_encoded_rule.hpp> at line 71

    parse

    Synopsis

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

    Declared in file <boost/url/rfc/impl/pct_encoded_rule.hpp> at line 88

    pct_encoded_rule

    Synopsis

    template< class CharSet_> pct_encoded_rule_t<CharSet_> pct_encoded_rule( const CharSet_& cs) noexcept;

    Declared in file <boost/url/rfc/pct_encoded_rule.hpp> at line 74

    pct_encoded_rule

    Synopsis

    template< class CharSet> pct_encoded_rule_t<CharSet> pct_encoded_rule( const CharSet& cs) noexcept;

    Declared in file <boost/url/rfc/pct_encoded_rule.hpp> at line 98

    variant

    The type of variant used by the library

    Synopsis

    template< class... Ts> using variant = variant<Ts...> ;

    Declared in file <boost/url/variant.hpp> at line 22

    optional

    Synopsis

    template< class T> using optional = optional<T> ;

    Declared in file <boost/url/optional.hpp> at line 39

    params_encoded_base

    Common functionality for containers

    Synopsis

    class params_encoded_base ;

    Declared in file <boost/url/params_encoded_base.hpp> at line 38

    Types

    Name Description
    iterator

    Types

    Name Description
    const_iterator

    iterator

    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    An unsigned integer type to represent sizes.

    difference_type

    A signed integer type used to represent differences.

    Member Functions

    Name Description
    buffer

    Return the query corresponding to these params

    empty

    Return true if there are no params

    size

    Return the number of params

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    contains

    Return true if a matching key exists

    count

    Return the number of matching keys

    find

    Find a matching key

    find

    Find a matching key

    find_last

    Find a matching key

    find_last

    Find a matching key

    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:

    Containers

  • params_ref
  • params_view
  • params_encoded_ref
  • params_encoded_view
  • iterator

    Synopsis

    class iterator ;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 25

    Types

    Name Description
    value_type
    reference
    pointer
    difference_type
    iterator_category

    Member Functions

    Name Description
    iterator
    iterator
    operator=
    operator++
    operator++
    operator--
    operator--
    operator*
    operator->

    value_type

    Synopsis

    using value_type = params_encoded_base::value_type ;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 41

    reference

    Synopsis

    using reference = params_encoded_base::reference ;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 43

    pointer

    Synopsis

    using pointer = reference ;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 45

    difference_type

    Synopsis

    using difference_type = ptrdiff_t ;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 46

    iterator_category

    Synopsis

    using iterator_category = bidirectional_iterator_tag ;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 47

    iterator

    Synopsis

    void iterator();

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 50

    iterator

    Synopsis

    void iterator( const iterator&);

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 51

    operator=

    Synopsis

    iterator& operator=( const iterator&);

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 52

    operator++

    Synopsis

    iterator& operator++() noexcept;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 55

    operator++

    Synopsis

    iterator operator++( int) noexcept;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 62

    operator--

    Synopsis

    iterator& operator--() noexcept;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 70

    operator--

    Synopsis

    iterator operator--( int) noexcept;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 77

    operator*

    Synopsis

    reference operator*();

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 85

    operator->

    Synopsis

    pointer operator->();

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 91

    const_iterator

    iterator

    Synopsis

    using const_iterator = iterator ;

    Declared in file <boost/url/params_encoded_base.hpp> at line 84

    value_type

    The value type

    Synopsis

    using value_type = param ;

    Declared in file <boost/url/params_encoded_base.hpp> at line 100

    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" ) );

    reference

    The reference type

    Synopsis

    using reference = param_pct_view ;

    Declared in file <boost/url/params_encoded_base.hpp> at line 110

    Description

    This is the type of value returned when iterators of the view are dereferenced.

    const_reference

    The reference type

    Synopsis

    using const_reference = param_pct_view ;

    Declared in file <boost/url/params_encoded_base.hpp> at line 113

    Description

    This is the type of value returned when iterators of the view are dereferenced.

    size_type

    An unsigned integer type to represent sizes.

    Synopsis

    using size_type = size_t ;

    Declared in file <boost/url/params_encoded_base.hpp> at line 117

    difference_type

    A signed integer type used to represent differences.

    Synopsis

    using difference_type = ptrdiff_t ;

    Declared in file <boost/url/params_encoded_base.hpp> at line 121

    max_size

    Return the maximum number of characters possible

    Synopsis

    static size_t max_size() noexcept;

    Declared in file <boost/url/params_encoded_base.hpp> at line 138

    Description

    This represents the largest number of characters that are possible in a path, not including any null terminator.

    Exception Safety

    Throws nothing.

    buffer

    Return the query corresponding to these params

    Synopsis

    pct_string_view buffer() noexcept;

    Declared in file <src/params_encoded_base.cpp> at line 58

    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

  • Query string (Wikipedia)
  • empty

    Return true if there are no params

    Synopsis

    bool empty() noexcept;

    Declared in file <src/params_encoded_base.cpp> at line 65

    Description

    Example

    assert( ! url_view( "?key=value" ).encoded_params().empty() );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    size

    Return the number of params

    Synopsis

    size_t size() noexcept;

    Declared in file <src/params_encoded_base.cpp> at line 72

    Description

    Example

    assert( url_view( "?key=value").encoded_params().size() == 1 );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    begin

    Return an iterator to the beginning

    Synopsis

    iterator begin() noexcept;

    Declared in file <src/params_encoded_base.cpp> at line 79

    Description

    Complexity

    Linear in the size of the first param.

    Exception Safety

    Throws nothing.

    end

    Return an iterator to the end

    Synopsis

    iterator end() noexcept;

    Declared in file <src/params_encoded_base.cpp> at line 87

    Description

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    contains

    Return true if a matching key exists

    Synopsis

    bool contains( pct_string_view key, ignore_case_param ic) noexcept;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 122

    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.

    count

    Return the number of matching keys

    Synopsis

    size_t count( pct_string_view key, ignore_case_param ic) noexcept;

    Declared in file <src/params_encoded_base.cpp> at line 97

    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.

    find

    Find a matching key

    Synopsis

    iterator find( pct_string_view key, ignore_case_param ic) noexcept;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 133

    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.

    The search starts from the first param and proceeds forward until either the key is found or the end of the range is reached, in which case `end()` is returned.

    Example

    assert( url_view( "?first=John&last=Doe" ).encoded_params().find( "First", ignore_case )->value == "John" );

    Effects

    return this->find( this->begin(), key, ic );

    Complexity

    Linear in `this->buffer().size()`.

    Exception Safety

    Exceptions thrown on invalid input.

    find

    Find a matching key

    Synopsis

    iterator find( iterator from, pct_string_view key, ignore_case_param ic) noexcept;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 145

    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.

    The search starts at `from` and proceeds forward until either the key is found or the end of the range is reached, in which case `end()` is returned.

    Example

    url_view u( "?First=John&Last=Doe" ); assert( u.encoded_params().find( "first" ) != u.encoded_params().find( "first", ignore_case ) );

    Complexity

    Linear in `this->buffer().size()`.

    Exception Safety

    Exceptions thrown on invalid input.

    find_last

    Find a matching key

    Synopsis

    iterator find_last( pct_string_view key, ignore_case_param ic) noexcept;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 158

    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.

    The search starts from the last param and proceeds backwards until either the key is found or the beginning of the range is reached, in which case `end()` is returned.

    Example

    assert( url_view( "?first=John&last=Doe" ).encoded_params().find_last( "last" )->value == "Doe" );

    Complexity

    Linear in `this->buffer().size()`.

    Exception Safety

    Exceptions thrown on invalid input.

    find_last

    Find a matching key

    Synopsis

    iterator find_last( iterator before, pct_string_view key, ignore_case_param ic) noexcept;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 170

    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.

    The search starts prior to `before` and proceeds backwards until either the key is found or the beginning of the range is reached, in which case `end()` is returned.

    Example

    url_view u( "?First=John&Last=Doe" ); assert( u.encoded_params().find_last( "last" ) != u.encoded_params().find_last( "last", ignore_case ) );

    Complexity

    Linear in `this->buffer().size()`.

    operator<<

    Format to an output stream

    Synopsis

    ostream& operator<<( ostream& os, const params_encoded_base& qp);

    Declared in file <src/params_encoded_base.cpp> at line 183

    Description

    Any percent-escapes are emitted as-is; no decoding is performed.

    Complexity

    Linear in `ps.buffer().size()`.

    Effects

    return os << ps.buffer();

    params_ref

    A view representing query parameters in a URL

    Synopsis

    class params_ref : public params_base;

    Declared in file <boost/url/params_ref.hpp> at line 80

    Types

    Name Description
    iterator

    Types

    Name Description
    const_iterator

    iterator

    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    An unsigned integer type to represent sizes.

    difference_type

    A signed integer type used to represent differences.

    Member Functions

    Name Description
    buffer

    Return the referenced character buffer.

    empty

    Return true if there are no params

    size

    Return the number of params

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    contains

    Return true if a matching key exists

    count

    Return the number of matching keys

    find

    Find a matching key

    find

    Find a matching key

    find_last

    Find a matching key

    find_last

    Find a matching key

    params_ref

    Constructor

    params_ref

    Constructor

    operator=

    Assignment

    operator=

    Assignment

    operator params_view

    Conversion

    url

    Return the referenced url

    clear

    Clear the contents of the container

    assign

    Assign elements

    assign

    Assign elements

    append

    Append elements

    append

    Append elements

    append

    Append elements

    insert

    Insert elements

    insert

    Insert elements

    insert

    Insert elements

    erase

    Erase elements

    erase

    Erase elements

    erase

    Erase elements

    replace

    Replace elements

    replace

    Replace elements

    replace

    Replace elements

    unset

    Remove the value on an element

    set

    Set a value

    set

    Set a value

    Description

    Objects of this type are used to interpret the query parameters as a bidirectional view of key/value pairs. The view does not retain ownership of the elements and instead references the original url. The caller is responsible for ensuring that the lifetime of the referenced url extends until it is no longer referenced. The view is modifiable; calling non-const members causes changes to the referenced url.

    Percent escapes in strings returned when dereferencing iterators are automatically decoded. Reserved characters in strings supplied to modifier functions are automatically percent-escaped.

    Example

    url u( "?first=John&last=Doe" ); params_ref p = u.params();

    Iterator Invalidation

    Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some or all iterators:

  • append : Only `end()`.
  • assign, clear, `operator=` : All elements.
  • erase : Erased elements and all elements after (including `end()`).
  • insert : All elements at or after the insertion point (including `end()`).
  • replace, set : Modified elements and all elements after (including `end()`).
  • params_ref

    Constructor

    Synopsis

    void params_ref( const params_ref& other);

    Declared in file <boost/url/params_ref.hpp> at line 120

    Description

    After construction, both views reference the same url. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced.

    Postconditions

    &this->url() == &other.url()

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    params_ref

    Constructor

    Synopsis

    void params_ref( const params_ref& other, encoding_opts opt) noexcept;

    Declared in file <boost/url/impl/params_ref.hpp> at line 39

    Description

    After construction, both views will reference the same url but this instance will use the specified encoding_opts when the values are decoded.

    Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced.

    Postconditions

    &this->url() == &other.url()

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    operator=

    Assignment

    Synopsis

    params_ref& operator=( const params_ref& other);

    Declared in file <src/params_ref.cpp> at line 32

    Description

    The previous contents of this are replaced by the contents of `other.

    All iterators are invalidated.

    NOTE

    The strings referenced by `other` must not come from the underlying url, or else the behavior is undefined.

    Effects

    this->assign( other.begin(), other.end() );

    Complexity

    Linear in `other.buffer().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    operator=

    Assignment

    Synopsis

    params_ref& operator=( initializer_list<param_view> init);

    Declared in file <boost/url/impl/params_ref.hpp> at line 48

    Description

    After assignment, the previous contents of the query parameters are replaced by the contents of the initializer-list.

    Preconditions

    None of character buffers referenced by `init` may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Effects

    this->assign( init );

    Complexity

    Linear in `init.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    operator params_view

    Conversion

    Synopsis

    params_view operator params_view() noexcept;

    Declared in file <src/params_ref.cpp> at line 42

    url

    Return the referenced url

    Synopsis

    url_base& url() noexcept;

    Declared in file <boost/url/params_ref.hpp> at line 247

    Description

    This function returns the url referenced by the view.

    Example

    url u( "?key=value" ); assert( &u.segments().url() == &u );

    Exception Safety

    Throws nothing.

    clear

    Clear the contents of the container

    Synopsis

    void clear() noexcept;

    Declared in file <boost/url/impl/params_ref.hpp> at line 65

    Description

    All iterators are invalidated.

    Effects

    this->url().remove_query();

    Postconditions

    this->empty() == true && this->url().has_query() == false

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    assign

    Assign elements

    Synopsis

    void assign( initializer_list<param_view> init);

    Declared in file <src/params_ref.cpp> at line 55

    Description

    This function replaces the entire contents of the view with the params in the initializer-list .

    All iterators are invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Example

    url u; u.params().assign( {{ "first", "John" }, { "last", "Doe" }} );

    Complexity

    Linear in `init.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    assign

    Assign elements

    Synopsis

    template< class FwdIt> void assign( FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/params_ref.hpp> at line 76

    Description

    This function replaces the entire contents of the view with the params in the range.

    All iterators are invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Mandates

    std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_view >::value == true

    Complexity

    Linear in the size of the range.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    append

    Append elements

    Synopsis

    iterator append( const param_view& p);

    Declared in file <boost/url/impl/params_ref.hpp> at line 97

    Description

    This function appends a param to the view.

    The `end()` iterator is invalidated.

    Example

    url u; u.params().append( { "first", "John" } );

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    append

    Append elements

    Synopsis

    iterator append( initializer_list<param_view> init);

    Declared in file <boost/url/impl/params_ref.hpp> at line 107

    Description

    This function appends the params in an initializer-list to the view.

    The `end()` iterator is invalidated.

    Example

    url u; u.params().append({ { "first", "John" }, { "last", "Doe" } });

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    append

    Append elements

    Synopsis

    template< class FwdIt> iterator append( FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/params_ref.hpp> at line 119

    Description

    This function appends a range of params to the view.

    The `end()` iterator is invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Mandates

    std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_view >::value == true

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    insert

    Insert elements

    Synopsis

    iterator insert( iterator before, const param_view& p);

    Declared in file <src/params_ref.cpp> at line 64

    Description

    This function inserts a param before the specified position.

    All iterators that are equal to `before` or come after are invalidated.

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    insert

    Insert elements

    Synopsis

    iterator insert( iterator before, initializer_list<param_view> init);

    Declared in file <src/params_ref.cpp> at line 79

    Description

    This function inserts the params in an initializer-list before the specified position.

    All iterators that are equal to `before` or come after are invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    insert

    Insert elements

    Synopsis

    template< class FwdIt> iterator insert( iterator before, FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/params_ref.hpp> at line 141

    Description

    This function inserts a range of params before the specified position.

    All iterators that are equal to `before` or come after are invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Mandates

    std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_view >::value == true

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    erase

    Erase elements

    Synopsis

    iterator erase( iterator pos) noexcept;

    Declared in file <src/params_ref.cpp> at line 214

    Description

    This function removes an element from the container.

    All iterators that are equal to `pos` or come after are invalidated.

    Example

    url u( "?first=John&last=Doe" ); params_ref::iterator it = u.params().erase( u.params().begin() ); assert( u.encoded_query() == "last=Doe" );

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Throws nothing.

    erase

    Erase elements

    Synopsis

    iterator erase( iterator first, iterator last) noexcept;

    Declared in file <src/params_ref.cpp> at line 225

    Description

    This function removes a range of elements from the container.

    All iterators that are equal to `first` or come after are invalidated.

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Throws nothing.

    erase

    Erase elements

    Synopsis

    size_t erase( string_view key, ignore_case_param ic) noexcept;

    Declared in file <src/params_ref.cpp> at line 93

    Description

    All iterators are invalidated.

    Postconditions

    this->count( key, ic ) == 0

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Throws nothing.

    replace

    Replace elements

    Synopsis

    iterator replace( iterator pos, const param_view& p);

    Declared in file <src/params_ref.cpp> at line 124

    Description

    This function replaces the contents of the element at `pos` with the specified param.

    All iterators that are equal to `pos` or come after are invalidated.

    Example

    url u( "?first=John&last=Doe" ); u.params().replace( u.params().begin(), { "title", "Mr" }); assert( u.encoded_query() == "title=Mr&last=Doe" );

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    replace

    Replace elements

    Synopsis

    iterator replace( iterator from, iterator to, initializer_list<param_view> init);

    Declared in file <src/params_ref.cpp> at line 139

    Description

    This function replaces a range of elements with the params in an initializer-list .

    All iterators that are equal to `from` or come after are invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    replace

    Replace elements

    Synopsis

    template< class FwdIt> iterator replace( iterator from, iterator to, FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/params_ref.hpp> at line 170

    Description

    This function replaces a range of elements with a range of params.

    All iterators that are equal to `from` or come after are invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Mandates

    std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_view >::value == true

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    unset

    Remove the value on an element

    Synopsis

    iterator unset( iterator pos) noexcept;

    Declared in file <src/params_ref.cpp> at line 155

    Description

    This function removes the value of an element at the specified position. After the call returns, `has_value` for the element is false.

    All iterators that are equal to `pos` or come after are invalidated.

    Example

    url u( "?first=John&last=Doe" ); u.params().unset( u.params().begin() ); assert( u.encoded_query() == "first&last=Doe" );

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Throws nothing.

    set

    Set a value

    Synopsis

    iterator set( iterator pos, string_view value);

    Declared in file <src/params_ref.cpp> at line 172

    Description

    This function replaces the value of an element at the specified position.

    All iterators that are equal to `pos` or come after are invalidated.

    Example

    url u( "?id=42&id=69" ); u.params().set( u.params().begin(), "none" ); assert( u.encoded_query() == "id=none&id=69" );

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    set

    Set a value

    Synopsis

    iterator set( string_view key, string_view value, ignore_case_param ic);

    Declared in file <src/params_ref.cpp> at line 189

    Description

    This function performs one of two actions depending on the value of `this->contains( key, ic )`.

  • If key is contained in the view then one of the matching elements has its value changed to the specified value. The remaining elements with a matching key are erased. Otherwise,
  • If `key` is not contained in the view, then the function apppends the param `{ key, value }`.
  • All iterators are invalidated.

    Example

    url u( "?id=42&id=69" ); u.params().set( "id", "none" ); assert( u.params().count( "id" ) == 1 );

    Postconditions

    this->count( key, ic ) == 1 && this->find( key, ic )->value == value

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    operator==

    Synopsis

    bool operator==( const iterator& it0, const iterator& it1) noexcept;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 97

    operator!=

    Synopsis

    bool operator!=( const iterator& it0, const iterator& it1) noexcept;

    Declared in file <boost/url/impl/params_encoded_base.hpp> at line 106

    params_base

    Common functionality for containers

    Synopsis

    class params_base ;

    Declared in file <boost/url/params_base.hpp> at line 39

    Types

    Name Description
    iterator

    Types

    Name Description
    const_iterator

    iterator

    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    An unsigned integer type to represent sizes.

    difference_type

    A signed integer type used to represent differences.

    Member Functions

    Name Description
    buffer

    Return the referenced character buffer.

    empty

    Return true if there are no params

    size

    Return the number of params

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    contains

    Return true if a matching key exists

    count

    Return the number of matching keys

    find

    Find a matching key

    find

    Find a matching key

    find_last

    Find a matching key

    find_last

    Find a matching key

    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:

    Containers

  • params_ref
  • params_view
  • params_encoded_ref
  • params_encoded_view
  • iterator

    Synopsis

    class iterator ;

    Declared in file <boost/url/impl/params_base.hpp> at line 22

    Types

    Name Description
    value_type
    reference
    pointer
    difference_type
    iterator_category

    Member Functions

    Name Description
    iterator
    iterator
    operator=
    operator++
    operator++
    operator--
    operator--
    operator*
    operator->
    operator==
    operator!=

    value_type

    Synopsis

    using value_type = params_base::value_type ;

    Declared in file <boost/url/impl/params_base.hpp> at line 48

    reference

    Synopsis

    using reference = params_base::reference ;

    Declared in file <boost/url/impl/params_base.hpp> at line 49

    pointer

    Synopsis

    using pointer = reference ;

    Declared in file <boost/url/impl/params_base.hpp> at line 50

    difference_type

    Synopsis

    using difference_type = params_base::difference_type ;

    Declared in file <boost/url/impl/params_base.hpp> at line 51

    iterator_category

    Synopsis

    using iterator_category = bidirectional_iterator_tag ;

    Declared in file <boost/url/impl/params_base.hpp> at line 53

    iterator

    Synopsis

    void iterator();

    Declared in file <boost/url/impl/params_base.hpp> at line 56

    iterator

    Synopsis

    void iterator( const iterator&);

    Declared in file <boost/url/impl/params_base.hpp> at line 57

    operator=

    Synopsis

    iterator& operator=( const iterator&) noexcept;

    Declared in file <boost/url/impl/params_base.hpp> at line 58

    operator++

    Synopsis

    iterator& operator++() noexcept;

    Declared in file <boost/url/impl/params_base.hpp> at line 61

    operator++

    Synopsis

    iterator operator++( int) noexcept;

    Declared in file <boost/url/impl/params_base.hpp> at line 68

    operator--

    Synopsis

    iterator& operator--() noexcept;

    Declared in file <boost/url/impl/params_base.hpp> at line 76

    operator--

    Synopsis

    iterator operator--( int) noexcept;

    Declared in file <boost/url/impl/params_base.hpp> at line 83

    operator*

    Synopsis

    reference operator*();

    Declared in file <src/params_base.cpp> at line 47

    operator->

    Synopsis

    pointer operator->() = delete;

    Declared in file <boost/url/impl/params_base.hpp> at line 95

    operator==

    Synopsis

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

    Declared in file <boost/url/impl/params_base.hpp> at line 97

    operator!=

    Synopsis

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

    Declared in file <boost/url/impl/params_base.hpp> at line 104

    const_iterator

    iterator

    Synopsis

    using const_iterator = iterator ;

    Declared in file <boost/url/params_base.hpp> at line 95

    value_type

    The value type

    Synopsis

    using value_type = param ;

    Declared in file <boost/url/params_base.hpp> at line 111

    Description

    Values of this type represent parameters whose strings retain unique ownership by making a copy.

    Example

    params_view::value_type qp( *url_view( "?first=John&last=Doe" ).params().find( "first" ) );

    reference

    The reference type

    Synopsis

    using reference = param ;

    Declared in file <boost/url/params_base.hpp> at line 121

    Description

    This is the type of value returned when iterators of the view are dereferenced.

    const_reference

    The reference type

    Synopsis

    using const_reference = param ;

    Declared in file <boost/url/params_base.hpp> at line 124

    Description

    This is the type of value returned when iterators of the view are dereferenced.

    size_type

    An unsigned integer type to represent sizes.

    Synopsis

    using size_type = size_t ;

    Declared in file <boost/url/params_base.hpp> at line 128

    difference_type

    A signed integer type used to represent differences.

    Synopsis

    using difference_type = ptrdiff_t ;

    Declared in file <boost/url/params_base.hpp> at line 132

    max_size

    Return the maximum number of characters possible

    Synopsis

    static size_t max_size() noexcept;

    Declared in file <boost/url/params_base.hpp> at line 149

    Description

    This represents the largest number of characters that are possible in a path, not including any null terminator.

    Exception Safety

    Throws nothing.

    buffer

    Return the referenced character buffer.

    Synopsis

    pct_string_view buffer() noexcept;

    Declared in file <src/params_base.cpp> at line 151

    Description

    This function returns the character buffer referenced by the view. The returned string may contain percent escapes.

    Example

    assert( url_view( "?first=John&last=Doe" ).params().buffer() == "?first=John&last=Doe" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    empty

    Return true if there are no params

    Synopsis

    bool empty() noexcept;

    Declared in file <src/params_base.cpp> at line 158

    Description

    Example

    assert( ! url_view( "?key=value" ).params().empty() );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    size

    Return the number of params

    Synopsis

    size_t size() noexcept;

    Declared in file <src/params_base.cpp> at line 165

    Description

    Example

    assert( url_view( "?key=value").params().size() == 1 );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    begin

    Return an iterator to the beginning

    Synopsis

    iterator begin() noexcept;

    Declared in file <src/params_base.cpp> at line 172

    Description

    Complexity

    Linear in the size of the first param.

    Exception Safety

    Throws nothing.

    end

    Return an iterator to the end

    Synopsis

    iterator end() noexcept;

    Declared in file <src/params_base.cpp> at line 180

    Description

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    contains

    Return true if a matching key exists

    Synopsis

    bool contains( string_view key, ignore_case_param ic) noexcept;

    Declared in file <src/params_base.cpp> at line 78

    Description

    This function examines the parameters in the container to find a match for the specified key. The comparison is performed as if all escaped characters were decoded first.

    Example

    assert( url_view( "?first=John&last=Doe" ).params().contains( "first" ) );

    Complexity

    Linear in `this->buffer().size()`.

    Exception Safety

    Throws nothing.

    count

    Return the number of matching keys

    Synopsis

    size_t count( string_view key, ignore_case_param ic) noexcept;

    Declared in file <src/params_base.cpp> at line 190

    Description

    This function examines the parameters in the container to find the number of matches for the specified key. The comparison is performed as if all escaped characters were decoded first.

    Example

    assert( url_view( "?first=John&last=Doe" ).params().count( "first" ) == 1 );

    Complexity

    Linear in `this->buffer().size()`.

    Exception Safety

    Throws nothing.

    find

    Find a matching key

    Synopsis

    iterator find( string_view key, ignore_case_param ic) noexcept;

    Declared in file <src/params_base.cpp> at line 88

    Description

    This function examines the parameters in the container to find a match for the specified key. The comparison is performed as if all escaped characters were decoded first.

    The search starts from the first param and proceeds forward until either the key is found or the end of the range is reached, in which case `end()` is returned.

    Example

    assert( (*url_view( "?first=John&last=Doe" ).params().find( "First", ignore_case )).value == "John" );

    Effects

    return this->find( this->begin(), key, ic );

    Complexity

    Linear in `this->buffer().size()`.

    find

    Find a matching key

    Synopsis

    iterator find( iterator from, string_view key, ignore_case_param ic) noexcept;

    Declared in file <src/params_base.cpp> at line 101

    Description

    This function examines the parameters in the container to find a match for the specified key. The comparison is performed as if all escaped characters were decoded first.

    The search starts at `from` and proceeds forward until either the key is found or the end of the range is reached, in which case `end()` is returned.

    Example

    url_view u( "?First=John&Last=Doe" ); assert( u.params().find( "first" ) != u.params().find( "first", ignore_case ) );

    Complexity

    Linear in `this->buffer().size()`.

    find_last

    Find a matching key

    Synopsis

    iterator find_last( string_view key, ignore_case_param ic) noexcept;

    Declared in file <src/params_base.cpp> at line 115

    Description

    This function examines the parameters in the container to find a match for the specified key. The comparison is performed as if all escaped characters were decoded first.

    The search starts from the last param and proceeds backwards until either the key is found or the beginning of the range is reached, in which case `end()` is returned.

    Example

    assert( (*url_view( "?first=John&last=Doe" ).params().find_last( "last" )).value == "Doe" );

    Complexity

    Linear in `this->buffer().size()`.

    find_last

    Find a matching key

    Synopsis

    iterator find_last( iterator before, string_view key, ignore_case_param ic) noexcept;

    Declared in file <src/params_base.cpp> at line 128

    Description

    This function examines the parameters in the container to find a match for the specified key. The comparison is performed as if all escaped characters were decoded first.

    The search starts prior to `before` and proceeds backwards until either the key is found or the beginning of the range is reached, in which case `end()` is returned.

    Example

    url_view u( "?First=John&Last=Doe" ); assert( u.params().find_last( "last" ) != u.params().find_last( "last", ignore_case ) );

    Complexity

    Linear in `this->buffer().size()`.

    operator<<

    Format to an output stream

    Synopsis

    ostream& operator<<( ostream& os, const params_base& qp);

    Declared in file <src/params_base.cpp> at line 276

    Description

    Any percent-escapes are emitted as-is; no decoding is performed.

    Complexity

    Linear in `ps.buffer().size()`.

    Effects

    return os << ps.buffer();

    params_view

    A view representing query parameters in a URL

    Synopsis

    class params_view : public params_base;

    Declared in file <boost/url/params_view.hpp> at line 47

    Types

    Name Description
    iterator

    Types

    Name Description
    const_iterator

    iterator

    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    An unsigned integer type to represent sizes.

    difference_type

    A signed integer type used to represent differences.

    Member Functions

    Name Description
    buffer

    Return the referenced character buffer.

    empty

    Return true if there are no params

    size

    Return the number of params

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    contains

    Return true if a matching key exists

    count

    Return the number of matching keys

    find

    Find a matching key

    find

    Find a matching key

    find_last

    Find a matching key

    find_last

    Find a matching key

    params_view

    Constructor

    params_view

    Constructor

    params_view

    Constructor

    params_view

    Constructor

    params_view

    Constructor

    operator=

    Assignment

    Description

    Objects of this type are used to interpret the query parameters as a bidirectional view of key/value pairs.

    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( "?first=John&last=Doe" ); params_view p = u.params();

    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.

    params_view

    Constructor

    Synopsis

    void params_view();

    Declared in file <boost/url/params_view.hpp> at line 80

    Description

    Default-constructed params have zero elements.

    Example

    params_view qp;

    Effects

    return params_view( "" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    params_view

    Constructor

    Synopsis

    void params_view( const params_view& other);

    Declared in file <boost/url/params_view.hpp> at line 103

    Description

    After construction both views reference the same 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

    params_view

    Constructor

    Synopsis

    void params_view( const params_view& other, encoding_opts opt) noexcept;

    Declared in file <src/params_view.cpp> at line 31

    Description

    After construction both views will reference the same character buffer but this instance will use the specified encoding_opts when the values are decoded.

    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

    params_view

    Constructor

    Synopsis

    void params_view( string_view s);

    Declared in file <src/params_view.cpp> at line 39

    Description

    This function constructs params from a valid query parameter string, which can contain percent escapes. Unlike the parameters in URLs, the string passed here should not start with "?". Upon construction, the view references the character buffer pointed to by `s`. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.

    Example

    params_view qp( "first=John&last=Doe" );

    Effects

    return parse_query( s ).value();

    Postconditions

    this->buffer().data() == s.data()

    Complexity

    Linear in `s`.

    Exception Safety

    Exceptions thrown on invalid input.

    BNF

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

    Specification

  • 3.4. Query
  • params_view

    Constructor

    Synopsis

    void params_view( string_view s, encoding_opts opt);

    Declared in file <src/params_view.cpp> at line 49

    Description

    This function constructs params from a valid query parameter string, which can contain percent escapes.

    This instance will use the specified encoding_opts when the values are decoded.

    Unlike the parameters in URLs, the string passed here should not start with "?". Upon construction, the view will reference the character buffer pointed to by `s`. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.

    Example

    encoding_opts opt; opt.space_as_plus = true; params_view qp( "name=John+Doe", opt );

    Effects

    return params_view(parse_query( s ).value(), opt);

    Postconditions

    this->buffer().data() == s.data()

    Complexity

    Linear in `s`.

    Exception Safety

    Exceptions thrown on invalid input.

    BNF

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

    Specification

  • 3.4. Query
  • operator=

    Assignment

    Synopsis

    params_view& operator=( const params_view&);

    Declared in file <boost/url/params_view.hpp> at line 278

    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

    params_encoded_view

    A view representing query parameters in a URL

    Synopsis

    class params_encoded_view : public params_encoded_base;

    Declared in file <boost/url/params_encoded_view.hpp> at line 54

    Types

    Name Description
    iterator

    Types

    Name Description
    const_iterator

    iterator

    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    An unsigned integer type to represent sizes.

    difference_type

    A signed integer type used to represent differences.

    Member Functions

    Name Description
    buffer

    Return the query corresponding to these params

    empty

    Return true if there are no params

    size

    Return the number of params

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    contains

    Return true if a matching key exists

    count

    Return the number of matching keys

    find

    Find a matching key

    find

    Find a matching key

    find_last

    Find a matching key

    find_last

    Find a matching key

    params_encoded_view

    Constructor

    params_encoded_view

    Constructor

    params_encoded_view

    Constructor

    operator=

    Assignment

    operator params_view

    Conversion

    Description

    Objects of this type are used to interpret the query parameters as a bidirectional view of key/value pairs.

    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( "?first=John&last=Doe" ); params_encoded_view p = u.encoded_params();

    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.

    params_encoded_view

    Constructor

    Synopsis

    void params_encoded_view();

    Declared in file <boost/url/params_encoded_view.hpp> at line 87

    Description

    Default-constructed params have zero elements.

    Example

    params_encoded_view qp;

    Effects

    return params_encoded_view( "" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    params_encoded_view

    Constructor

    Synopsis

    void params_encoded_view( const params_encoded_view& other);

    Declared in file <boost/url/params_encoded_view.hpp> at line 110

    Description

    After construction both views reference the same 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

    params_encoded_view

    Constructor

    Synopsis

    void params_encoded_view( string_view s);

    Declared in file <src/params_encoded_view.cpp> at line 28

    Description

    This function constructs params from a valid query parameter string, which can contain percent escapes. Unlike the parameters in URLs, the string passed here should not start with "?". Upon construction, the view references the character buffer pointed to by `s`. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.

    Example

    params_encoded_view qp( "first=John&last=Doe" );

    Effects

    return parse_query( s ).value();

    Postconditions

    this->buffer().data() == s.data()

    Complexity

    Linear in `s`.

    Exception Safety

    Exceptions thrown on invalid input.

    BNF

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

    Specification

  • 3.4. Query
  • operator=

    Assignment

    Synopsis

    params_encoded_view& operator=( const params_encoded_view&);

    Declared in file <boost/url/params_encoded_view.hpp> at line 190

    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

    operator params_view

    Conversion

    Synopsis

    params_view operator params_view() noexcept;

    Declared in file <src/params_encoded_view.cpp> at line 37

    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

    params_view qp = parse_path( "/path/to/file.txt" ).value();

    Postconditions

    params_view( *this ).buffer().data() == this->buffer().data()

    Complexity

    Constant

    Exception Safety

    Throws nothing

    parse_query

    Parse a string and return an encoded params view

    Synopsis

    result<params_encoded_view> parse_query( string_view s) noexcept;

    Declared in file <src/parse_query.cpp> at line 24

    Description

    This function parses the string and returns the corresponding params object if the string is valid, otherwise returns an error.

    BNF

    Exception Safety

    No-throw guarantee.

    Specification

    url_base

    Common functionality for containers

    Synopsis

    class url_base : public url_view_base;

    Declared in file <boost/url/url_base.hpp> at line 63

    Member Functions

    Name Description
    digest
    size

    Return the number of characters in the url

    empty

    Return true if the url is empty

    data

    Return a pointer to the url's character buffer

    buffer

    Return the url string

    operator string_view

    Return the URL as a core::string_view

    persist

    Return a shared, persistent copy of the url

    has_scheme

    Return true a scheme is present

    scheme

    Return the scheme

    scheme_id

    Return the scheme

    has_authority

    Return true if an authority is present

    authority

    Return the authority

    encoded_authority

    Return the authority.

    has_userinfo

    Return true if a userinfo is present

    has_password

    Return true if a password is present

    userinfo

    Return the userinfo

    encoded_userinfo

    Return the userinfo

    user

    Return the user

    encoded_user

    Return the user

    password

    Return the password

    encoded_password

    Return the password

    host_type

    Return the host type

    host

    Return the host

    encoded_host

    Return the host

    host_address

    Return the host

    encoded_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

    encoded_host_name

    Return the host name

    zone_id

    Return the IPv6 Zone ID

    encoded_zone_id

    Return the IPv6 Zone ID

    has_port

    Return true if a port is present

    port

    Return the port

    port_number

    Return the port

    is_path_absolute

    Return true if the path is absolute

    path

    Return the path

    encoded_path

    Return the path

    segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    has_query

    Return true if a query is present

    query

    Return the query

    encoded_query

    Return the query

    params

    Return the query as a container of parameters

    params
    encoded_params

    Return the query as a container of parameters

    has_fragment

    Return true if a fragment is present

    fragment

    Return the fragment

    encoded_fragment

    Return the fragment

    encoded_host_and_port

    Return the host and port

    encoded_origin

    Return the origin

    encoded_resource

    Return the resource

    encoded_target

    Return the target

    compare

    Return the result of comparing this with another url

    c_str

    Return the url as a null-terminated string

    capacity

    Return the number of characters that can be stored without reallocating

    clear

    Clear the contents while preserving the capacity

    reserve

    Adjust the capacity without changing the size

    set_scheme

    Set the scheme

    set_scheme_id
    remove_scheme

    Remove the scheme

    set_encoded_authority

    Set the authority

    remove_authority

    Remove the authority

    set_userinfo

    Set the userinfo

    set_encoded_userinfo

    Set the userinfo.

    remove_userinfo

    Remove the userinfo

    set_user

    Set the user

    set_encoded_user

    Set the user

    set_password

    Set the password.

    set_encoded_password

    Set the password.

    remove_password

    Remove the password

    set_host

    Set the host

    set_encoded_host

    Set the host

    set_host_address

    Set the host to an address

    set_encoded_host_address

    Set the host to an address

    set_host_ipv4

    Set the host to an address

    set_host_ipv6

    Set the host to an address

    set_host_ipvfuture

    Set the host to an address

    set_host_name

    Set the host to a name

    set_encoded_host_name

    Set the host to a name

    set_port_number

    Set the port

    set_port

    Set the port

    remove_port

    Remove the port

    set_path_absolute

    Set if the path is absolute

    set_path

    Set the path.

    set_encoded_path

    Set the path.

    segments

    Return the path as a container of segments

    segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    set_query

    Set the query

    set_encoded_query

    Set the query

    params

    Return the query as a container of parameters

    params

    url_view_base::params

    params

    Return the query as a container of parameters

    encoded_params

    Return the query as a container of parameters

    encoded_params

    Return the query as a container of parameters

    set_params

    Set the query params

    set_encoded_params

    Set the query params

    remove_query

    Remove the query

    remove_fragment

    Remove the fragment

    set_fragment

    Set the fragment.

    set_encoded_fragment

    Set the fragment.

    remove_origin

    Remove the origin component

    normalize

    Normalize the URL components

    normalize_scheme

    Normalize the URL scheme

    normalize_authority

    Normalize the URL authority

    normalize_path

    Normalize the URL path

    normalize_query

    Normalize the URL query

    normalize_fragment

    Normalize the URL fragment

    resolve

    Resolve a URL reference against this base URL

    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:

    Containers

  • url
  • url_view
  • static_url
  • Functions

  • parse_absolute_uri
  • parse_origin_form
  • parse_relative_ref
  • parse_uri
  • parse_uri_reference
  • c_str

    Return the url as a null-terminated string

    Synopsis

    const char* c_str() noexcept;

    Declared in file <boost/url/url_base.hpp> at line 128

    Description

    This function returns a pointer to a null terminated string representing the url, which may contain percent escapes.

    Example

    assert( std::strlen( url( "http://www.example.com" ).c_str() ) == 22 );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    capacity

    Return the number of characters that can be stored without reallocating

    Synopsis

    size_t capacity() noexcept;

    Declared in file <boost/url/url_base.hpp> at line 145

    Description

    This does not include the null terminator, which is always present.

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    clear

    Clear the contents while preserving the capacity

    Synopsis

    void clear() noexcept;

    Declared in file <boost/url/url_base.hpp> at line 164

    Description

    Postconditions

    this->empty() == true

    Complexity

    Constant.

    Exception Safety

    No-throw guarantee.

    reserve

    Adjust the capacity without changing the size

    Synopsis

    void reserve( size_t n);

    Declared in file <boost/url/url_base.hpp> at line 186

    Description

    This function adjusts the capacity of the container in characters, without affecting the current contents. Has no effect if `n < = this->capacity()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    set_scheme

    Set the scheme

    Synopsis

    url_base& set_scheme( string_view s);

    Declared in file <src/url_base.cpp> at line 148

    Description

    The scheme is set to the specified string, which must contain a valid scheme without any trailing colon (':'). Note that schemes are case-insensitive, and the canonical form is lowercased.

    Example

    assert( url( "http://www.example.com" ).set_scheme( "https" ).scheme_id() == scheme::https );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

    Specification

  • 3.1. Scheme (rfc3986)
  • set_scheme_id

    Synopsis

    url_base& set_scheme_id( scheme id);

    Declared in file <src/url_base.cpp> at line 157

    remove_scheme

    Remove the scheme

    Synopsis

    url_base& remove_scheme();

    Declared in file <src/url_base.cpp> at line 169

    Description

    This function removes the scheme if it is present.

    Example

    assert( url("http://www.example.com/index.htm" ).remove_scheme().buffer() == "//www.example.com/index.htm" );

    Postconditions

    this->has_scheme() == false && this->scheme_id() == scheme::none

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • 3.1. Scheme (rfc3986)
  • set_encoded_authority

    Set the authority

    Synopsis

    url_base& set_encoded_authority( pct_string_view s);

    Declared in file <src/url_base.cpp> at line 282

    Description

    This function sets the authority to the specified string. The string may contain percent-escapes.

    Example

    assert( url().set_encoded_authority( "My%20Computer" ).has_authority() );

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT

    Specification

  • 3.2. Authority (rfc3986)
  • remove_authority

    Remove the authority

    Synopsis

    url_base& remove_authority();

    Declared in file <src/url_base.cpp> at line 312

    Description

    This function removes the authority, which includes the userinfo, host, and a port if present.

    Example

    assert( url( "http://example.com/echo.cgi" ).remove_authority().buffer() == "http:/echo.cgi" );

    Postconditions

    this->has_authority() == false && this->has_userinfo() == false && this->has_port() == false

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT

    Specification

  • 3.2. Authority (rfc3986)
  • set_userinfo

    Set the userinfo

    Synopsis

    url_base& set_userinfo( string_view s);

    Declared in file <src/url_base.cpp> at line 350

    Description

    The userinfo is set to the given string, which may contain percent-escapes. Any special or reserved characters in the string are automatically percent-encoded. The effects on the user and password depend on the presence of a colon (':') in the string:

  • If an unescaped colon exists, the characters up to the colon become the user and the rest of the characters after the colon become the password. In this case has_password returns true. Otherwise,
  • If there is no colon, the user is set to the string. The function has_password returns false.
  • NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url( "http://example.com" ).set_userinfo( "user:pass" ).encoded_user() == "user" );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_encoded_userinfo

    Set the userinfo.

    Synopsis

    url_base& set_encoded_userinfo( pct_string_view s);

    Declared in file <src/url_base.cpp> at line 388

    Description

    The userinfo is set to the given string, which may contain percent-escapes. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The effects on the user and password depend on the presence of a colon (':') in the string:

  • If an unescaped colon exists, the characters up to the colon become the user and the rest of the characters after the colon become the password. In this case has_password returns true. Otherwise,
  • If there is no colon, the user is set to the string. The function has_password returns false.
  • NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • remove_userinfo

    Remove the userinfo

    Synopsis

    url_base& remove_userinfo() noexcept;

    Declared in file <src/url_base.cpp> at line 449

    Description

    This function removes the userinfo if present, without removing any authority.

    Example

    assert( url( "http://user@example.com" ).remove_userinfo().has_userinfo() == false );

    Postconditions

    this->has_userinfo() == false && this->encoded_userinfo().empty == true

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_user

    Set the user

    Synopsis

    url_base& set_user( string_view s);

    Declared in file <src/url_base.cpp> at line 467

    Description

    This function sets the user part of the userinfo to the string. Any special or reserved characters in the string are automatically percent-encoded.

    Example

    assert( url().set_user("john doe").encoded_userinfo() == "john%20doe" );

    Postconditions

    this->has_authority() == true && this->has_userinfo() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_encoded_user

    Set the user

    Synopsis

    url_base& set_encoded_user( pct_string_view s);

    Declared in file <src/url_base.cpp> at line 486

    Description

    This function sets the user part of the userinfo the the string, which may contain percent-escapes. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    Example

    assert( url().set_encoded_user("john%20doe").userinfo() == "john doe" );

    Postconditions

    this->has_authority() == true && this->has_userinfo() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_password

    Set the password.

    Synopsis

    url_base& set_password( string_view s);

    Declared in file <src/url_base.cpp> at line 512

    Description

    This function sets the password in the userinfo to the string. Reserved characters in the string are percent-escaped in the result.

    NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url("http://user@example.com").set_password( "pass" ).encoded_userinfo() == "user:pass" );

    Postconditions

    this->has_password() == true && this->password() == s

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_encoded_password

    Set the password.

    Synopsis

    url_base& set_encoded_password( pct_string_view s);

    Declared in file <src/url_base.cpp> at line 531

    Description

    This function sets the password in the userinfo to the string, which may contain percent-escapes. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url("http://user@example.com").set_encoded_password( "pass" ).encoded_userinfo() == "user:pass" );

    Postconditions

    this->has_password() == true

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • remove_password

    Remove the password

    Synopsis

    url_base& remove_password() noexcept;

    Declared in file <src/url_base.cpp> at line 557

    Description

    This function removes the password from the userinfo if a password exists. If there is no userinfo or no authority, the call has no effect.

    NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url( "http://user:pass@example.com" ).remove_password().authority().buffer() == "user@example.com" );

    Postconditions

    this->has_password() == false && this->encoded_password().empty() == true

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_host

    Set the host

    Synopsis

    url_base& set_host( string_view s);

    Declared in file <src/url_base.cpp> at line 608

    Description

    Depending on the contents of the passed string, this function sets the host:

  • If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4.
  • If the string is a valid IPv6 address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipv6.
  • If the string is a valid IPvFuture address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipvfuture.
  • Otherwise, the host name is set to the string, which may be empty. Reserved characters in the string are percent-escaped in the result. The host type is host_type::name.
  • In all cases, when this function returns, the URL contains an authority.

    Example

    assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );

    Postconditions

    this->has_authority() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • IPv4 (Wikipedia)
  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_encoded_host

    Set the host

    Synopsis

    url_base& set_encoded_host( pct_string_view s);

    Declared in file <src/url_base.cpp> at line 661

    Description

    Depending on the contents of the passed string, this function sets the host:

  • If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4.
  • If the string is a valid IPv6 address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipv6.
  • If the string is a valid IPvFuture address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipvfuture.
  • Otherwise, the host name is set to the string. This string can contain percent escapes, or can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The host type is host_type::name.
  • In all cases, when this function returns, the URL contains an authority.

    Example

    assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );

    Postconditions

    this->has_authority() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • IPv4 (Wikipedia)
  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_host_address

    Set the host to an address

    Synopsis

    url_base& set_host_address( string_view s);

    Declared in file <src/url_base.cpp> at line 715

    Description

    Depending on the contents of the passed string, this function sets the host:

  • If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4.
  • If the string is a valid IPv6 address, then the host is set to that address. The host type is host_type::ipv6.
  • If the string is a valid IPvFuture, then the host is set to that address. The host type is host_type::ipvfuture.
  • Otherwise, the host name is set to the string, which may be empty. Reserved characters in the string are percent-escaped in the result. The host type is host_type::name.
  • In all cases, when this function returns, the URL contains an authority.

    Example

    assert( url( "http://www.example.com" ).set_host_address( "127.0.0.1" ).buffer() == "http://127.0.0.1" );

    Postconditions

    this->has_authority() == true

    Complexity

    Linear in `s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    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 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 IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • IPv4 (Wikipedia)
  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_encoded_host_address

    Set the host to an address

    Synopsis

    url_base& set_encoded_host_address( pct_string_view s);

    Declared in file <src/url_base.cpp> at line 759

    Description

    Depending on the contents of the passed string, this function sets the host:

  • If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4.
  • If the string is a valid IPv6 address, then the host is set to that address. The host type is host_type::ipv6.
  • If the string is a valid IPvFuture, then the host is set to that address. The host type is host_type::ipvfuture.
  • Otherwise, the host name is set to the string. This string can contain percent escapes, or can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The host type is host_type::name.
  • In all cases, when this function returns, the URL contains an authority.

    Example

    assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );

    Postconditions

    this->has_authority() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    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 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 IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • IPv4 (Wikipedia)
  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_host_ipv4

    Set the host to an address

    Synopsis

    url_base& set_host_ipv4( const ipv4_address& addr);

    Declared in file <src/url_base.cpp> at line 805

    Description

    The host is set to the specified IPv4 address. The host type is host_type::ipv4.

    Example

    assert( url("http://www.example.com").set_host_ipv4( ipv4_address( "127.0.0.1" ) ).buffer() == "http://127.0.0.1" );

    Complexity

    Linear in `this->size()`.

    Postconditions

    this->has_authority() == true && this->host_ipv4_address() == addr && this->host_type() == host_type::ipv4

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    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

  • IPv4 (Wikipedia)
  • 3.2.2. Host (rfc3986)
  • set_host_ipv6

    Set the host to an address

    Synopsis

    url_base& set_host_ipv6( const ipv6_address& addr);

    Declared in file <src/url_base.cpp> at line 825

    Description

    The host is set to the specified IPv6 address. The host type is host_type::ipv6.

    Example

    assert( url().set_host_ipv6( ipv6_address( "1::6:c0a8:1" ) ).authority().buffer() == "[1::6:c0a8:1]" );

    Postconditions

    this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::ipv6

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    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

  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_host_ipvfuture

    Set the host to an address

    Synopsis

    url_base& set_host_ipvfuture( string_view s);

    Declared in file <src/url_base.cpp> at line 850

    Description

    The host is set to the specified IPvFuture string. The host type is host_type::ipvfuture.

    Example

    assert( url().set_host_ipvfuture( "v42.bis" ).buffer() == "//[v42.bis]" );

    Complexity

    Linear in `this->size() + s.size()`.

    Postconditions

    this->has_authority() == true && this->host_ipvfuture) == s && this->host_type() == host_type::ipvfuture

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )

    Specification

  • 3.2.2. Host (rfc3986)
  • set_host_name

    Set the host to a name

    Synopsis

    url_base& set_host_name( string_view s);

    Declared in file <src/url_base.cpp> at line 871

    Description

    The host is set to the specified string, which may be empty. Reserved characters in the string are percent-escaped in the result. The host type is host_type::name.

    Example

    assert( url( "http://www.example.com/index.htm").set_host_name( "localhost" ).host_address() == "localhost" );

    Postconditions

    this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • 3.2.2. Host (rfc3986)
  • set_encoded_host_name

    Set the host to a name

    Synopsis

    url_base& set_encoded_host_name( pct_string_view s);

    Declared in file <src/url_base.cpp> at line 904

    Description

    The host is set to the specified string, which may contain percent-escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The host type is host_type::name.

    Example

    assert( url( "http://www.example.com/index.htm").set_encoded_host_name( "localhost" ).host_address() == "localhost" );

    Postconditions

    this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • 3.2.2. Host (rfc3986)
  • set_port_number

    Set the port

    Synopsis

    url_base& set_port_number( uint16_t n);

    Declared in file <src/url_base.cpp> at line 942

    Description

    The port is set to the specified integer.

    Example

    assert( url( "http://www.example.com" ).set_port_number( 8080 ).authority().buffer() == "www.example.com:8080" );

    Postconditions

    this->has_authority() == true && this->has_port() == true && this->port_number() == n

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT

    Specification

  • 3.2.3. Port (rfc3986)
  • set_port

    Set the port

    Synopsis

    url_base& set_port( string_view s);

    Declared in file <src/url_base.cpp> at line 959

    Description

    This port is set to the string, which must contain only digits or be empty. An empty port string is distinct from having no port.

    Example

    assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" );

    Postconditions

    this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n)

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    port = *DIGIT

    Specification

  • 3.2.3. Port (rfc3986)
  • remove_port

    Remove the port

    Synopsis

    url_base& remove_port() noexcept;

    Declared in file <src/url_base.cpp> at line 979

    Description

    If a port exists, it is removed. The rest of the authority is unchanged.

    Example

    assert( url( "http://www.example.com:80" ).remove_port().authority().buffer() == "www.example.com" );

    Postconditions

    this->has_port() == false && this->port_number() == 0 && this->port() == ""

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT

    Specification

  • 3.2.3. Port (rfc3986)
  • set_path_absolute

    Set if the path is absolute

    Synopsis

    bool set_path_absolute( bool absolute);

    Declared in file <src/url_base.cpp> at line 1011

    Description

    This function adjusts the path to make it absolute or not, depending on the parameter.

    NOTE

    If an authority is present, the path is always absolute. In this case, the function has no effect.

    Example

    url u( "path/to/file.txt" ); assert( u.set_path_absolute( true ) ); assert( u.buffer() == "/path/to/file.txt" );

    Postconditions

    this->is_path_absolute() == true && this->encoded_path().front() == '/'

    Complexity

    Linear in `this->size()`.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • set_path

    Set the path.

    Synopsis

    url_base& set_path( string_view s);

    Declared in file <src/url_base.cpp> at line 1092

    Description

    This function sets the path to the string, which may be empty. Reserved characters in the string are percent-escaped in the result.

    NOTE

    The library may adjust the final result to ensure that no other parts of the url is semantically affected.

    NOTE

    This function does not encode '/' chars, which are unreserved for paths but reserved for path segments. If a path segment should include encoded '/'s to differentiate it from path separators, the functions set_encoded_path or segments should be used instead.

    Example

    url u( "http://www.example.com" ); u.set_path( "path/to/file.txt" ); assert( u.path() == "/path/to/file.txt" );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • set_encoded_path

    Set the path.

    Synopsis

    url_base& set_encoded_path( pct_string_view s);

    Declared in file <src/url_base.cpp> at line 1209

    Description

    This function sets the path to the string, which may contain percent-escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    NOTE

    The library may adjust the final result to ensure that no other parts of the url is semantically affected.

    Example

    url u( "http://www.example.com" ); u.set_encoded_path( "path/to/file.txt" ); assert( u.encoded_path() == "/path/to/file.txt" );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • segments

    Return the path as a container of segments

    Synopsis

    segments_ref segments() noexcept;

    Declared in file <src/url_base.cpp> at line 1325

    Description

    This function returns a bidirectional view of segments over the path. The returned view references the same underlying character buffer; ownership is not transferred. Any percent-escapes in strings returned when iterating the view are decoded first. The container is modifiable; changes to the container are reflected in the underlying URL.

    Example

    url u( "http://example.com/path/to/file.txt" ); segments sv = u.segments();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • segments

    Return the path as a container of segments

    Synopsis

    segments_view segments() noexcept;

    Declared in file <boost/url/url_base.hpp> at line 1855

    Description

    This function returns a bidirectional view of strings over the path. The returned view references the same underlying character buffer; ownership is not transferred. Any percent-escapes in strings returned when iterating the view are decoded first.

    Example

    segments_view sv = url_view( "/path/to/file.txt" ).segments();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    path = [ "/" ] segment *( "/" segment )

    Specification

  • 3.3. Path (rfc3986)
  • encoded_segments

    Return the path as a container of segments

    Synopsis

    segments_encoded_ref encoded_segments() noexcept;

    Declared in file <src/url_base.cpp> at line 1332

    Description

    This function returns a bidirectional view of segments over the path. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. The container is modifiable; changes to the container are reflected in the underlying URL.

    Example

    url u( "http://example.com/path/to/file.txt" ); segments_encoded_ref sv = u.encoded_segments();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • encoded_segments

    Return the path as a container of segments

    Synopsis

    segments_encoded_view encoded_segments() noexcept;

    Declared in file <boost/url/url_base.hpp> at line 1916

    Description

    This function returns a bidirectional view of strings over the path. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes.

    Example

    segments_encoded_view sv = url_view( "/path/to/file.txt" ).encoded_segments();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • set_query

    Set the query

    Synopsis

    url_base& set_query( string_view s);

    Declared in file <src/url_base.cpp> at line 1345

    Description

    This sets the query to the string, which can be empty. An empty query is distinct from having no query. Reserved characters in the string are percent-escaped in the result.

    Example

    assert( url( "http://example.com" ).set_query( "id=42" ).query() == "id=42" );

    Postconditions

    this->has_query() == true && this->query() == s

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • set_encoded_query

    Set the query

    Synopsis

    url_base& set_encoded_query( pct_string_view s);

    Declared in file <src/url_base.cpp> at line 1357

    Description

    This sets the query to the string, which may contain percent-escapes and can be empty. An empty query is distinct from having no query. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    Example

    assert( url( "http://example.com" ).set_encoded_query( "id=42" ).encoded_query() == "id=42" );

    Postconditions

    this->has_query() == true && this->query() == decode_view( s );

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • params

    Return the query as a container of parameters

    Synopsis

    params_ref params() noexcept;

    Declared in file <src/url_base.cpp> at line 1414

    Description

    This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Any percent-escapes in strings returned when iterating the view are decoded first. The container is modifiable; changes to the container are reflected in the underlying URL.

    Example

    params_ref pv = url( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).params();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • params

    url_view_base::params

    Synopsis

    params_view params() noexcept;

    Declared in file <boost/url/url_base.hpp> at line 2080

    params

    Return the query as a container of parameters

    Synopsis

    params_ref params( encoding_opts opt) noexcept;

    Declared in file <src/url_base.cpp> at line 1424

    Description

    This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Any percent-escapes in strings returned when iterating the view are decoded first. The container is modifiable; changes to the container are reflected in the underlying URL.

    Example

    encoding_opts opt; opt.space_as_plus = true; params_ref pv = url( "/sql?id=42&name=jane+doe&page+size=20" ).params(opt);

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • encoded_params

    Return the query as a container of parameters

    Synopsis

    params_encoded_view encoded_params() noexcept;

    Declared in file <boost/url/url_base.hpp> at line 2140

    Description

    This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes.

    Example

    params_encoded_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    Specification

  • 3.4. Query (rfc3986)
  • BNF

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

    Specification

  • ://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)
  • encoded_params

    Return the query as a container of parameters

    Synopsis

    params_encoded_ref encoded_params() noexcept;

    Declared in file <src/url_base.cpp> at line 1431

    Description

    This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes. The container is modifiable; changes to the container are reflected in the underlying URL.

    Example

    params_encoded_ref pv = url( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • set_params

    Set the query params

    Synopsis

    url_base& set_params( initializer_list<param_view> ps) noexcept;

    Declared in file <src/url_base.cpp> at line 1438

    Description

    This sets the query params to the list of param_view, which can be empty.

    An empty list of params is distinct from having no params.

    Reserved characters in the string are percent-escaped in the result.

    Example

    assert( url( "http://example.com" ).set_params( {"id", "42"} ).query() == "id=42" );

    Postconditions

    this->has_query() == true

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Complexity

    Linear.

    BNF

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

    Specification

  • ://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)
  • set_encoded_params

    Set the query params

    Synopsis

    url_base& set_encoded_params( initializer_list<param_pct_view> ps) noexcept;

    Declared in file <src/url_base.cpp> at line 1446

    Description

    This sets the query params to the elements in the list, which may contain percent-escapes and can be empty.

    An empty list of params is distinct from having no query.

    Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    Example

    assert( url( "http://example.com" ).set_encoded_params( {"id", "42"} ).encoded_query() == "id=42" );

    Postconditions

    this->has_query() == true

    Complexity

    Linear.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • remove_query

    Remove the query

    Synopsis

    url_base& remove_query() noexcept;

    Declared in file <src/url_base.cpp> at line 1454

    Description

    If a query is present, it is removed. An empty query is distinct from having no query.

    Example

    assert( url( "http://www.example.com?id=42" ).remove_query().buffer() == "http://www.example.com" );

    Postconditions

    this->has_query() == false && this->params().empty()

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • remove_fragment

    Remove the fragment

    Synopsis

    url_base& remove_fragment() noexcept;

    Declared in file <src/url_base.cpp> at line 1471

    Description

    This function removes the fragment. An empty fragment is distinct from having no fragment.

    Example

    assert( url( "?first=john&last=doe#anchor" ).remove_fragment().buffer() == "?first=john&last=doe" );

    Postconditions

    this->has_fragment() == false && this->encoded_fragment() == ""

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    fragment = *( pchar / "/" / "?" )

    Specification

  • 3.5. Fragment
  • set_fragment

    Set the fragment.

    Synopsis

    url_base& set_fragment( string_view s);

    Declared in file <src/url_base.cpp> at line 1481

    Description

    This function sets the fragment to the specified string, which may be empty. An empty fragment is distinct from having no fragment. Reserved characters in the string are percent-escaped in the result.

    Example

    assert( url("?first=john&last=doe" ).set_encoded_fragment( "john doe" ).encoded_fragment() == "john%20doe" );

    Postconditions

    this->has_fragment() == true && this->fragment() == s

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    fragment = *( pchar / "/" / "?" )

    Specification

  • 3.5. Fragment
  • set_encoded_fragment

    Set the fragment.

    Synopsis

    url_base& set_encoded_fragment( pct_string_view s);

    Declared in file <src/url_base.cpp> at line 1504

    Description

    This function sets the fragment to the specified string, which may contain percent-escapes and which may be empty. An empty fragment is distinct from having no fragment. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    Example

    assert( url("?first=john&last=doe" ).set_encoded_fragment( "john%2Ddoe" ).fragment() == "john-doe" );

    Postconditions

    this->has_fragment() == true && this->fragment() == decode_view( s )

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    fragment = *( pchar / "/" / "?" )

    Specification

  • 3.5. Fragment
  • remove_origin

    Remove the origin component

    Synopsis

    url_base& remove_origin();

    Declared in file <src/url_base.cpp> at line 995

    Description

    This function removes the origin, which consists of the scheme and authority.

    Example

    assert( url( "http://www.example.com/index.htm" ).remove_origin().buffer() == "/index.htm" );

    Postconditions

    this->scheme_id() == scheme::none && this->has_authority() == false

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    normalize

    Normalize the URL components

    Synopsis

    url_base& normalize();

    Declared in file <src/url_base.cpp> at line 1926

    Description

    Applies Syntax-based normalization to all components of the URL.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_scheme

    Normalize the URL scheme

    Synopsis

    url_base& normalize_scheme();

    Declared in file <src/url_base.cpp> at line 1711

    Description

    Applies Syntax-based normalization to the URL scheme.

    The scheme is normalized to lowercase.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_authority

    Normalize the URL authority

    Synopsis

    url_base& normalize_authority();

    Declared in file <src/url_base.cpp> at line 1719

    Description

    Applies Syntax-based normalization to the URL authority.

    Percent-encoding triplets are normalized to uppercase letters. Percent-encoded octets that correspond to unreserved characters are decoded.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_path

    Normalize the URL path

    Synopsis

    url_base& normalize_path();

    Declared in file <src/url_base.cpp> at line 1742

    Description

    Applies Syntax-based normalization to the URL path.

    Percent-encoding triplets are normalized to uppercase letters. Percent-encoded octets that correspond to unreserved characters are decoded. Redundant path-segments are removed.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_query

    Normalize the URL query

    Synopsis

    url_base& normalize_query();

    Declared in file <src/url_base.cpp> at line 1906

    Description

    Applies Syntax-based normalization to the URL query.

    Percent-encoding triplets are normalized to uppercase letters. Percent-encoded octets that correspond to unreserved characters are decoded.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_fragment

    Normalize the URL fragment

    Synopsis

    url_base& normalize_fragment();

    Declared in file <src/url_base.cpp> at line 1916

    Description

    Applies Syntax-based normalization to the URL fragment.

    Percent-encoding triplets are normalized to uppercase letters. Percent-encoded octets that correspond to unreserved characters are decoded.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • resolve

    Resolve a URL reference against this base URL

    Synopsis

    result<void> resolve( const url_view_base& ref);

    Declared in file <src/url_base.cpp> at line 1538

    Description

    This function attempts to resolve a URL reference `ref` against this base URL in a manner similar to that of a web browser resolving an anchor tag.

    This URL must satisfy the URI grammar. In other words, it must contain a scheme.

    Relative references are only usable when in the context of a base absolute URI. This process of resolving a relative reference within the context of a base URI is defined in detail in rfc3986 (see below).

    The resolution process works as if the relative reference is appended to the base URI and the result is normalized.

    Given the input base URL, this function resolves the relative reference as if performing the following steps:

  • Ensure the base URI has at least a scheme
  • Normalizing the reference path
  • Merge base and reference paths
  • Normalize the merged path
  • This function places the result of the resolution into this URL in place.

    If an error occurs, the contents of this URL are unspecified and a result with an `system::error_code` is returned.

    Example

    url base1( "/one/two/three" ); base1.resolve("four"); assert( base1.buffer() == "/one/two/four" ); url base2( "http://example.com/" ) base2.resolve("/one"); assert( base2.buffer() == "http://example.com/one" ); url base3( "http://example.com/one" ); base3.resolve("/two"); assert( base3.buffer() == "http://example.com/two" ); url base4( "http://a/b/c/d;p?q" ); base4.resolve("g#s"); assert( base4.buffer() == "http://a/b/c/g#s" );

    BNF

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

    Exception Safety

    Basic guarantee. Calls to allocate may throw.

    Specification

    5. Reference Resolution (rfc3986)

    op_t

    Synopsis

    struct op_t ;

    Declared in file <boost/url/url_base.hpp> at line 78

    Member Functions

    Name Description
    ~op_t
    op_t
    move

    ~op_t

    Synopsis

    void ~op_t();

    Declared in file <src/url_base.cpp> at line 55

    op_t

    Synopsis

    void op_t( url_base& impl_, string_view* s0_, string_view* s1_) noexcept;

    Declared in file <src/url_base.cpp> at line 64

    move

    Synopsis

    void move( char* dest, const char* src, size_t n) noexcept;

    Declared in file <src/url_base.cpp> at line 77

    params_encoded_ref

    A view representing query parameters in a URL

    Synopsis

    class params_encoded_ref : public params_encoded_base;

    Declared in file <boost/url/params_encoded_ref.hpp> at line 73

    Types

    Name Description
    iterator

    Types

    Name Description
    const_iterator

    iterator

    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    An unsigned integer type to represent sizes.

    difference_type

    A signed integer type used to represent differences.

    Member Functions

    Name Description
    buffer

    Return the query corresponding to these params

    empty

    Return true if there are no params

    size

    Return the number of params

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    contains

    Return true if a matching key exists

    count

    Return the number of matching keys

    find

    Find a matching key

    find

    Find a matching key

    find_last

    Find a matching key

    find_last

    Find a matching key

    params_encoded_ref

    Constructor

    operator=

    Assignment

    operator=

    Assignment

    operator params_encoded_view

    Conversion

    url

    Return the referenced url

    clear

    Clear the contents of the container

    assign

    Assign params

    assign

    Assign params

    append

    Append params

    append

    Append params

    append

    Append params

    insert

    Insert params

    insert

    Insert params

    insert

    Insert params

    erase

    Erase params

    erase

    Erase params

    erase

    Erase params

    replace

    Replace params

    replace

    Replace params

    replace

    Replace params

    unset

    Remove the value on an element

    set

    Set a value

    set

    Set a value

    Description

    Objects of this type are used to interpret the query parameters as a bidirectional view of key value pairs.

    The view does not retain ownership of the elements and instead references the original url. The caller is responsible for ensuring that the lifetime of the referenced url extends until it is no longer referenced.

    The view is modifiable; calling non-const members causes changes to the referenced url.

    Example

    url u( "?first=John&last=Doe" ); params_encoded_ref p = u.encoded_params();

    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. Modifications made through the container invalidate some iterators to the underlying character buffer:

  • append : Only `end()`.
  • assign, clear, `operator=` : All params.
  • erase : Erased params and all params after (including `end()`).
  • insert : All params at or after the insertion point (including `end()`).
  • replace, set : Modified params and all params after (including `end()`).
  • params_encoded_ref

    Constructor

    Synopsis

    void params_encoded_ref( const params_encoded_ref& other);

    Declared in file <boost/url/params_encoded_ref.hpp> at line 112

    Description

    After construction, both views reference the same url. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced.

    Postconditions

    &this->url() == &other.url();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    operator=

    Assignment

    Synopsis

    params_encoded_ref& operator=( const params_encoded_ref& other);

    Declared in file <src/params_encoded_ref.cpp> at line 40

    Description

    The previous contents of this are replaced by the contents of `other.

    All iterators are invalidated.

    NOTE

    The strings referenced by `other` must not come from the underlying url, or else the behavior is undefined.

    Effects

    this->assign( other.begin(), other.end() );

    Complexity

    Linear in `other.buffer().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    operator=

    Assignment

    Synopsis

    params_encoded_ref& operator=( initializer_list<param_pct_view> init);

    Declared in file <src/params_encoded_ref.cpp> at line 50

    Description

    After assignment, the previous contents of the query parameters are replaced by the contents of the initializer-list.

    All iterators are invalidated.

    Preconditions

    None of character buffers referenced by `init` may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Effects

    this->assign( init.begin(), init.end() );

    Complexity

    Linear in `init.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    operator params_encoded_view

    Conversion

    Synopsis

    params_encoded_view operator params_encoded_view() noexcept;

    Declared in file <src/params_encoded_ref.cpp> at line 59

    Description

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    url

    Return the referenced url

    Synopsis

    url_base& url() noexcept;

    Declared in file <boost/url/params_encoded_ref.hpp> at line 217

    Description

    This function returns the url referenced by the view.

    Example

    url u( "?key=value" ); assert( &u.encoded_params().url() == &u );

    Exception Safety

    Throws nothing.

    clear

    Clear the contents of the container

    Synopsis

    void clear() noexcept;

    Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 26

    Description

    All iterators are invalidated.

    Effects

    this->url().remove_query();

    Postconditions

    this->empty() == true && this->url().has_query() == false

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    assign

    Assign params

    Synopsis

    void assign( initializer_list<param_pct_view> init);

    Declared in file <src/params_encoded_ref.cpp> at line 72

    Description

    This function replaces the entire contents of the view with the params in the initializer-list .

    All iterators are invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Example

    url u; u.encoded_params().assign({ { "first", "John" }, { "last", "Doe" } });

    Complexity

    Linear in `init.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    assign

    Assign params

    Synopsis

    template< class FwdIt> void assign( FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 35

    Description

    This function replaces the entire contents of the view with the params in the range.

    All iterators are invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Mandates

    std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_pct_view >::value == true

    Complexity

    Linear in the size of the range.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    append

    Append params

    Synopsis

    iterator append( const param_pct_view& p);

    Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 56

    Description

    This function appends a param to the view.

    The `end()` iterator is invalidated.

    Example

    url u; u.encoded_params().append( { "first", "John" } );

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    append

    Append params

    Synopsis

    iterator append( initializer_list<param_pct_view> init);

    Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 66

    Description

    This function appends the params in an initializer-list to the view.

    The `end()` iterator is invalidated.

    Example

    url u; u.encoded_params().append({ {"first", "John"}, {"last", "Doe"} });

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    append

    Append params

    Synopsis

    template< class FwdIt> iterator append( FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 78

    Description

    This function appends a range of params to the view.

    The `end()` iterator is invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Mandates

    std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_pct_view >::value == true

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    insert

    Insert params

    Synopsis

    iterator insert( iterator before, const param_pct_view& p);

    Declared in file <src/params_encoded_ref.cpp> at line 81

    Description

    This function inserts a param before the specified position.

    All iterators that are equal to `before` or come after are invalidated.

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    insert

    Insert params

    Synopsis

    iterator insert( iterator before, initializer_list<param_pct_view> init);

    Declared in file <src/params_encoded_ref.cpp> at line 94

    Description

    This function inserts the params in an initializer-list before the specified position.

    All iterators that are equal to `before` or come after are invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    insert

    Insert params

    Synopsis

    template< class FwdIt> iterator insert( iterator before, FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 101

    Description

    This function inserts a range of params before the specified position.

    All iterators that are equal to `before` or come after are invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Mandates

    std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_pct_view >::value == true

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    erase

    Erase params

    Synopsis

    iterator erase( iterator pos) noexcept;

    Declared in file <src/params_encoded_ref.cpp> at line 222

    Description

    This function removes an element from the container.

    All iterators that are equal to `pos` or come after are invalidated.

    Example

    url u( "?first=John&last=Doe" ); params_encoded_ref::iterator it = u.encoded_params().erase( u.encoded_params().begin() ); assert( u.encoded_query() == "last=Doe" );

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Throws nothing.

    erase

    Erase params

    Synopsis

    iterator erase( iterator first, iterator last) noexcept;

    Declared in file <src/params_encoded_ref.cpp> at line 233

    Description

    This function removes a range of params from the container.

    All iterators that are equal to `first` or come after are invalidated.

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Throws nothing.

    erase

    Erase params

    Synopsis

    size_t erase( pct_string_view key, ignore_case_param ic) noexcept;

    Declared in file <src/params_encoded_ref.cpp> at line 108

    Description

    All iterators are invalidated.

    Postconditions

    this->count( key, ic ) == 0

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Exceptions thrown on invalid input.

    replace

    Replace params

    Synopsis

    iterator replace( iterator pos, const param_pct_view& p);

    Declared in file <src/params_encoded_ref.cpp> at line 139

    Description

    This function replaces the contents of the element at `pos` with the specified param.

    All iterators that are equal to `pos` or come after are invalidated.

    NOTE

    The strings passed in must not come from the element being replaced, or else the behavior is undefined.

    Example

    url u( "?first=John&last=Doe" ); u.encoded_params().replace( u.encoded_params().begin(), { "title", "Mr" }); assert( u.encoded_query() == "title=Mr&last=Doe" );

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    replace

    Replace params

    Synopsis

    iterator replace( iterator from, iterator to, initializer_list<param_pct_view> init);

    Declared in file <src/params_encoded_ref.cpp> at line 152

    Description

    This function replaces a range of params with the params in an initializer-list .

    All iterators that are equal to `from` or come after are invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    replace

    Replace params

    Synopsis

    template< class FwdIt> iterator replace( iterator from, iterator to, FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 130

    Description

    This function replaces a range of params with a range of params.

    All iterators that are equal to `from` or come after are invalidated.

    NOTE

    The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.

    Mandates

    std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_pct_view >::value == true

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    unset

    Remove the value on an element

    Synopsis

    iterator unset( iterator pos) noexcept;

    Declared in file <src/params_encoded_ref.cpp> at line 168

    Description

    This function removes the value of an element at the specified position. After the call returns, `has_value` for the element is false.

    All iterators that are equal to `pos` or come after are invalidated.

    Example

    url u( "?first=John&last=Doe" ); u.encoded_params().unset( u.encoded_params().begin() ); assert( u.encoded_query() == "first&last=Doe" );

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Throws nothing.

    set

    Set a value

    Synopsis

    iterator set( iterator pos, pct_string_view value);

    Declared in file <src/params_encoded_ref.cpp> at line 182

    Description

    This function replaces the value of an element at the specified position.

    All iterators that are equal to `pos` or come after are invalidated.

    NOTE

    The string passed in must not come from the element being replaced, or else the behavior is undefined.

    Example

    url u( "?id=42&id=69" ); u.encoded_params().set( u.encoded_params().begin(), "none" ); assert( u.encoded_query() == "id=none&id=69" );

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    set

    Set a value

    Synopsis

    iterator set( pct_string_view key, pct_string_view value, ignore_case_param ic);

    Declared in file <src/params_encoded_ref.cpp> at line 197

    Description

    This function performs one of two actions depending on the value of `this->contains( key, ic )`.

  • If key is contained in the view then one of the matching params has its value changed to the specified value. The remaining params with a matching key are erased. Otherwise,
  • If `key` is not contained in the view, then the function apppends the param `{ key, value }`.
  • All iterators are invalidated.

    NOTE

    The strings passed in must not come from the element being replaced, or else the behavior is undefined.

    Example

    url u( "?id=42&id=69" ); u.encoded_params().set( "id", "none" ); assert( u.encoded_params().count( "id" ) == 1 );

    Postconditions

    this->count( key, ic ) == 1 && this->find( key, ic )->value == value

    Complexity

    Linear in `this->url().encoded_query().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    segments_encoded_ref

    A view representing path segments in a URL

    Synopsis

    class segments_encoded_ref : public segments_encoded_base;

    Declared in file <boost/url/segments_encoded_ref.hpp> at line 88

    Types

    Name Description
    iterator

    Types

    Name Description
    const_iterator

    iterator

    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    An unsigned integer type used to represent size.

    difference_type

    A signed integer type used to represent differences.

    Member Functions

    Name Description
    buffer

    Return the referenced character buffer.

    is_absolute

    Returns true if this references an absolute path.

    empty

    Return true if there are no segments

    size

    Return the number of segments

    front

    Return the first segment

    back

    Return the last segment

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    segments_encoded_ref

    Constructor

    operator=

    Assignment

    operator=
    operator=

    Assignment

    operator segments_encoded_view

    Conversion

    url

    Return the referenced url

    clear

    Clear the contents of the container

    assign

    Assign segments

    assign

    Assign segments

    insert

    Insert segments

    insert

    Insert segments

    insert

    Insert segments

    erase

    Erase segments

    erase

    Erase segments

    replace

    Replace segments

    replace

    Replace segments

    replace

    Replace segments

    replace

    Replace segments

    push_back

    Append a segment

    pop_back

    Remove the last segment

    Description

    Objects of this type are used to interpret the path as a bidirectional view of segments, where each segment is a string which may contain percent-escapes.

    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.

    The view is modifiable; calling non-const members causes changes to the referenced url.

    Example

    url u( "/path/to/file.txt" ); segments_encoded_ref ps = u.encoded_segments();

    The strings returned when iterators are dereferenced have type pct_string_view and may contain percent-escapes.

    Reserved characters in inputs are automatically escaped. Escapes in inputs are preserved.

    Exceptions are thrown on invalid inputs.

    Iterator Invalidation

    Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some or all iterators:

  • push_back : Only `end()`.
  • assign, clear, operator= : All elements.
  • erase : Erased elements and all elements after (including `end()`).
  • insert : All elements at or after the insertion point (including `end()`).
  • replace : Modified elements and all elements after (including `end()`).
  • segments_encoded_ref

    Constructor

    Synopsis

    void segments_encoded_ref( const segments_encoded_ref& other);

    Declared in file <boost/url/segments_encoded_ref.hpp> at line 127

    Description

    After construction, both views reference the same url. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced.

    Postconditions

    &this->url() == &other.url();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    operator=

    Assignment

    Synopsis

    segments_encoded_ref& operator=( const segments_encoded_ref& other);

    Declared in file <src/segments_encoded_ref.cpp> at line 44

    Description

    The existing contents are replaced by a copy of the other segments.

    All iterators are invalidated.

    NOTE

    None of the character buffers referenced by `other` may overlap the buffer of the underlying url, or else the behavior is undefined.

    Effects

    this->assign( other.begin(), other.end() );

    Complexity

    Linear in `other.buffer().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    @ {

    operator=

    Synopsis

    segments_encoded_ref& operator=( const segments_encoded_view& other);

    Declared in file <src/segments_encoded_ref.cpp> at line 54

    operator=

    Assignment

    Synopsis

    segments_encoded_ref& operator=( initializer_list<pct_string_view> init);

    Declared in file <src/segments_encoded_ref.cpp> at line 63

    Description

    The existing contents are replaced by a copy of the contents of the initializer list. Reserved characters in the list are automatically escaped. Escapes in the list are preserved.

    All iterators are invalidated.

    Example

    url u; u.encoded_segments() = {"path", "to", "file.txt"};

    Preconditions

    None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Effects

    this->assign( init.begin(), init.end() );

    Complexity

    Linear in `init.size() + this->url().encoded_query().size() + this->url().encoded_fragment().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    operator segments_encoded_view

    Conversion

    Synopsis

    segments_encoded_view operator segments_encoded_view() noexcept;

    Declared in file <src/segments_encoded_ref.cpp> at line 37

    url

    Return the referenced url

    Synopsis

    url_base& url() noexcept;

    Declared in file <boost/url/segments_encoded_ref.hpp> at line 246

    Description

    This function returns the url referenced by the view.

    Example

    url u( "/path/to/file.txt" ); assert( &u.encoded_segments().url() == &u );

    Exception Safety

    Throws nothing.

    clear

    Clear the contents of the container

    Synopsis

    void clear() noexcept;

    Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 28

    Description

    All iterators are invalidated.

    Effects

    this->url().set_encoded_path( "" );

    Postconditions

    this->empty() == true

    Complexity

    Linear in `this->url().encoded_query().size() + this->url().encoded_fragment().size()`.

    Exception Safety

    Throws nothing.

    assign

    Assign segments

    Synopsis

    void assign( initializer_list<pct_string_view> init);

    Declared in file <src/segments_encoded_ref.cpp> at line 78

    Description

    The existing contents are replaced by a copy of the contents of the initializer list. Reserved characters in the list are automatically escaped. Escapes in the list are preserved.

    All iterators are invalidated.

    NOTE

    None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Example

    url u; u.segments().assign( {"path", "to", "file.txt"} );

    Complexity

    Linear in `init.size() + this->url().encoded_query().size() + this->url().encoded_fragment().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    assign

    Assign segments

    Synopsis

    template< class FwdIt> void assign( FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 37

    Description

    The existing contents are replaced by a copy of the contents of the range. Reserved characters in the range are automatically escaped. Escapes in the range are preserved.

    All iterators are invalidated.

    NOTE

    None of the character buffers referenced by the range may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Mandates

    std::is_convertible< std::iterator_traits< FwdIt >::reference_type, pct_string_view >::value == true

    Complexity

    Linear in `std::distance( first, last ) + this->url().encoded_query().size() + this->url().encoded_fragment().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    insert

    Insert segments

    Synopsis

    iterator insert( iterator before, pct_string_view s);

    Declared in file <src/segments_encoded_ref.cpp> at line 87

    Description

    This function inserts a segment before the specified position. Reserved characters in the segment are automatically escaped. Escapes in the segment are preserved.

    All iterators that are equal to `before` or come after are invalidated.

    Complexity

    Linear in `s.size() + this->url().encoded_resource().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    insert

    Insert segments

    Synopsis

    iterator insert( iterator before, initializer_list<pct_string_view> init);

    Declared in file <src/segments_encoded_ref.cpp> at line 100

    Description

    This function inserts the segments in an initializer list before the specified position. Reserved characters in the list are automatically escaped. Escapes in the list are preserved.

    All iterators that are equal to `before` or come after are invalidated.

    NOTE

    None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Example

    url u( "/file.txt" ); u.encoded_segments().insert( u.encoded_segments().begin(), { "path", "to" } );

    Complexity

    Linear in `init.size() + this->url().encoded_resource().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    insert

    Insert segments

    Synopsis

    template< class FwdIt> iterator insert( iterator before, FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 62

    Description

    This function inserts the segments in a range before the specified position. Reserved characters in the range are automatically escaped. Escapes in the range are preserved.

    All iterators that are equal to `before` or come after are invalidated.

    NOTE

    None of the character buffers referenced by the range may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Mandates

    std::is_convertible< std::iterator_traits< FwdIt >::reference_type, pct_string_view >::value == true

    Complexity

    Linear in `std::distance( first, last ) + this->url().encoded_resource().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    erase

    Erase segments

    Synopsis

    iterator erase( iterator pos) noexcept;

    Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 90

    Description

    This function removes a segment.

    All iterators that are equal to `pos` or come after are invalidated.

    Complexity

    Linear in `this->url().encoded_resource().size()`.

    Exception Safety

    Throws nothing.

    erase

    Erase segments

    Synopsis

    iterator erase( iterator first, iterator last) noexcept;

    Declared in file <src/segments_encoded_ref.cpp> at line 114

    Description

    This function removes a range of segments from the container.

    All iterators that are equal to `first` or come after are invalidated.

    Complexity

    Linear in `this->url().encoded_resource().size()`.

    Exception Safety

    Throws nothing.

    replace

    Replace segments

    Synopsis

    iterator replace( iterator pos, pct_string_view s);

    Declared in file <src/segments_encoded_ref.cpp> at line 129

    Description

    This function replaces the segment at the specified position. Reserved characters in the string are automatically escaped. Escapes in the string are preserved.

    All iterators that are equal to `pos` or come after are invalidated.

    Complexity

    Linear in `s.size() + this->url().encoded_resouce().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    replace

    Replace segments

    Synopsis

    iterator replace( iterator from, iterator to, pct_string_view s);

    Declared in file <src/segments_encoded_ref.cpp> at line 142

    Description

    This function replaces a range of segments with one segment. Reserved characters in the string are automatically escaped. Escapes in the string are preserved.

    All iterators that are equal to `from` or come after are invalidated.

    Complexity

    Linear in `s.size() + this->url().encoded_resouce().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    replace

    Replace segments

    Synopsis

    iterator replace( iterator from, iterator to, initializer_list<pct_string_view> init);

    Declared in file <src/segments_encoded_ref.cpp> at line 156

    Description

    This function replaces a range of segments with a list of segments in an initializer list. Reserved characters in the list are automatically escaped. Escapes in the list are preserved.

    All iterators that are equal to `from` or come after are invalidated.

    Preconditions

    None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Complexity

    Linear in `init.size() + this->url().encoded_resouce().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    replace

    Replace segments

    Synopsis

    template< class FwdIt> iterator replace( iterator from, iterator to, FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 101

    Description

    This function replaces a range of segments with annother range of segments. Reserved characters in the new range are automatically escaped. Escapes in the new range are preserved.

    All iterators that are equal to `from` or come after are invalidated.

    Preconditions

    None of the character buffers referenced by the new range may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Complexity

    Linear in `std::distance( first, last ) + this->url().encoded_resouce().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    push_back

    Append a segment

    Synopsis

    void push_back( pct_string_view s);

    Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 131

    Description

    This function appends a segment to the end of the path. Reserved characters in the string are automatically escaped. Escapes in the string are preserved.

    All end iterators are invalidated.

    Postconditions

    this->back() == s

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    pop_back

    Remove the last segment

    Synopsis

    void pop_back() noexcept;

    Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 140

    Description

    This function removes the last segment from the container.

    Iterators to the last segment as well as all end iterators are invalidated.

    Preconditions

    not this->empty()

    Exception Safety

    Throws nothing.

    segments_ref

    A view representing path segments in a URL

    Synopsis

    class segments_ref : public segments_base;

    Declared in file <boost/url/segments_ref.hpp> at line 85

    Types

    Name Description
    iterator

    Types

    Name Description
    const_iterator

    iterator

    value_type

    The value type

    reference

    The reference type

    const_reference

    The reference type

    size_type

    An unsigned integer type used to represent size.

    difference_type

    A signed integer type used to represent differences.

    Member Functions

    Name Description
    buffer

    Return the referenced character buffer.

    is_absolute

    Returns true if this references an absolute path.

    empty

    Return true if there are no segments

    size

    Return the number of segments

    front

    Return the first segment

    back

    Return the last segment

    begin

    Return an iterator to the beginning

    end

    Return an iterator to the end

    segments_ref

    Constructor

    operator=

    Assignment

    operator=
    operator=

    Assignment

    operator segments_view

    Conversion

    url

    Return the referenced url

    clear

    Clear the contents of the container

    assign

    Assign segments

    assign

    Assign segments

    insert

    Insert segments

    insert

    Insert segments

    insert

    Insert segments

    erase

    Erase segments

    erase

    Erase segments

    replace

    Replace segments

    replace

    Replace segments

    replace

    Replace segments

    replace

    Replace segments

    push_back

    Append a segment

    pop_back

    Remove the last segment

    Description

    Objects of this type are used to interpret the path as a bidirectional view of segments, where each segment is a string with percent escapes automatically decoded.

    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.

    The view is modifiable; calling non-const members causes changes to the referenced url.

    Example

    url u( "/path/to/file.txt" ); segments_ref ps = u.segments();

    Percent escapes in strings returned when dereferencing iterators are automatically decoded. Reserved characters in strings supplied to modifier functions are automatically percent-escaped.

    Iterator Invalidation

    Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some or all iterators:

  • push_back : Only `end()`.
  • assign, clear, operator= : All elements.
  • erase : Erased elements and all elements after (including `end()`).
  • insert : All elements at or after the insertion point (including `end()`).
  • replace : Modified elements and all elements after (including `end()`).
  • segments_ref

    Constructor

    Synopsis

    void segments_ref( const segments_ref& other);

    Declared in file <boost/url/segments_ref.hpp> at line 124

    Description

    After construction, both views reference the same url. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the url extends until it is no longer referenced.

    Postconditions

    &this->url() == &other.url();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    operator=

    Assignment

    Synopsis

    segments_ref& operator=( const segments_ref& other);

    Declared in file <src/segments_ref.cpp> at line 45

    Description

    The existing contents are replaced by a copy of the other segments.

    All iterators are invalidated.

    NOTE

    None of the character buffers referenced by `other` may overlap the buffer of the underlying url, or else the behavior is undefined.

    Effects

    this->assign( other.begin(), other.end() );

    Complexity

    Linear in `other.buffer().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    @ {

    operator=

    Synopsis

    segments_ref& operator=( const segments_view& other);

    Declared in file <src/segments_ref.cpp> at line 54

    operator=

    Assignment

    Synopsis

    segments_ref& operator=( initializer_list<string_view> init);

    Declared in file <src/segments_ref.cpp> at line 62

    Description

    The existing contents are replaced by a copy of the contents of the initializer list. Reserved characters in the list are automatically escaped.

    All iterators are invalidated.

    Example

    url u; u.segments() = { "path", "to", "file.txt" };

    Preconditions

    None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Effects

    this->assign( init.begin(), init.end() );

    Complexity

    Linear in `init.size() + this->url().encoded_query().size() + this->url().encoded_fragment().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    operator segments_view

    Conversion

    Synopsis

    segments_view operator segments_view() noexcept;

    Declared in file <src/segments_ref.cpp> at line 38

    url

    Return the referenced url

    Synopsis

    url_base& url() noexcept;

    Declared in file <boost/url/segments_ref.hpp> at line 238

    Description

    This function returns the url referenced by the view.

    Example

    url u( "/path/to/file.txt" ); assert( &u.segments().url() == &u );

    Exception Safety

    Throws nothing.

    clear

    Clear the contents of the container

    Synopsis

    void clear() noexcept;

    Declared in file <boost/url/impl/segments_ref.hpp> at line 28

    Description

    All iterators are invalidated.

    Effects

    this->url().set_encoded_path( "" );

    Postconditions

    this->empty() == true

    Complexity

    Linear in `this->url().encoded_query().size() + this->url().encoded_fragment().size()`.

    Exception Safety

    Throws nothing.

    assign

    Assign segments

    Synopsis

    void assign( initializer_list<string_view> init);

    Declared in file <src/segments_ref.cpp> at line 77

    Description

    The existing contents are replaced by a copy of the contents of the initializer list. Reserved characters in the list are automatically escaped.

    All iterators are invalidated.

    NOTE

    None of the character buffers referenced by `init` may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Example

    url u; u.segments().assign( { "path", "to", "file.txt" } );

    Complexity

    Linear in `init.size() + this->url().encoded_query().size() + this->url().encoded_fragment().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    assign

    Assign segments

    Synopsis

    template< class FwdIt> void assign( FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/segments_ref.hpp> at line 37

    Description

    The existing contents are replaced by a copy of the contents of the range. Reserved characters in the range are automatically escaped.

    All iterators are invalidated.

    NOTE

    None of the character buffers referenced by the range may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Mandates

    std::is_convertible< std::iterator_traits< FwdIt >::reference_type, core::string_view >::value == true

    Complexity

    Linear in `std::distance( first, last ) + this->url().encoded_query().size() + this->url().encoded_fragment().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    insert

    Insert segments

    Synopsis

    iterator insert( iterator before, string_view s);

    Declared in file <src/segments_ref.cpp> at line 85

    Description

    This function inserts a segment before the specified position. Reserved characters in the segment are automatically escaped.

    All iterators that are equal to `before` or come after are invalidated.

    Complexity

    Linear in `s.size() + this->url().encoded_resource().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    insert

    Insert segments

    Synopsis

    iterator insert( iterator before, initializer_list<string_view> init);

    Declared in file <src/segments_ref.cpp> at line 98

    Description

    This function inserts the segments in an initializer list before the specified position. Reserved characters in the list are percent-escaped in the result.

    All iterators that are equal to `before` or come after are invalidated.

    NOTE

    None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Example

    url u( "/file.txt" ); u.segments().insert( u.segments().begin(), { "path", "to" } );

    Complexity

    Linear in `init.size() + this->url().encoded_resource().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    insert

    Insert segments

    Synopsis

    template< class FwdIt> iterator insert( iterator before, FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/segments_ref.hpp> at line 61

    Description

    This function inserts the segments in a range before the specified position. Reserved characters in the list are automatically escaped.

    All iterators that are equal to `before` or come after are invalidated.

    NOTE

    None of the character buffers referenced by the range may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Mandates

    std::is_convertible< std::iterator_traits< FwdIt >::reference_type, core::string_view >::value == true

    Complexity

    Linear in `std::distance( first, last ) + this->url().encoded_resource().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    erase

    Erase segments

    Synopsis

    iterator erase( iterator pos) noexcept;

    Declared in file <boost/url/impl/segments_ref.hpp> at line 89

    Description

    This function removes a segment.

    All iterators that are equal to `pos` or come after are invalidated.

    Complexity

    Linear in `this->url().encoded_resource().size()`.

    Exception Safety

    Throws nothing.

    erase

    Erase segments

    Synopsis

    iterator erase( iterator first, iterator last) noexcept;

    Declared in file <src/segments_ref.cpp> at line 112

    Description

    This function removes a range of segments.

    All iterators that are equal to `first` or come after are invalidated.

    Complexity

    Linear in `this->url().encoded_resource().size()`.

    Exception Safety

    Throws nothing.

    replace

    Replace segments

    Synopsis

    iterator replace( iterator pos, string_view s);

    Declared in file <src/segments_ref.cpp> at line 128

    Description

    This function replaces the segment at the specified position. Reserved characters in the string are automatically escaped.

    All iterators that are equal to `pos` or come after are invalidated.

    Complexity

    Linear in `s.size() + this->url().encoded_resouce().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    replace

    Replace segments

    Synopsis

    iterator replace( iterator from, iterator to, string_view s);

    Declared in file <src/segments_ref.cpp> at line 141

    Description

    This function replaces a range of segments with one segment. Reserved characters in the string are automatically escaped.

    All iterators that are equal to `from` or come after are invalidated.

    Complexity

    Linear in `s.size() + this->url().encoded_resouce().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    replace

    Replace segments

    Synopsis

    iterator replace( iterator from, iterator to, initializer_list<string_view> init);

    Declared in file <src/segments_ref.cpp> at line 155

    Description

    This function replaces a range of segments with a list of segments in an initializer list. Reserved characters in the list are automatically escaped.

    All iterators that are equal to `from` or come after are invalidated.

    Preconditions

    None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Complexity

    Linear in `init.size() + this->url().encoded_resouce().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    replace

    Replace segments

    Synopsis

    template< class FwdIt> iterator replace( iterator from, iterator to, FwdIt first, FwdIt last);

    Declared in file <boost/url/impl/segments_ref.hpp> at line 100

    Description

    This function replaces a range of segments with annother range of segments. Reserved characters in the new range are automatically escaped.

    All iterators that are equal to `from` or come after are invalidated.

    Preconditions

    None of the character buffers referenced by the new range may overlap the character buffer of the underlying url, or else the behavior is undefined.

    Complexity

    Linear in `std::distance( first, last ) + this->url().encoded_resouce().size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    push_back

    Append a segment

    Synopsis

    void push_back( string_view s);

    Declared in file <boost/url/impl/segments_ref.hpp> at line 130

    Description

    This function appends a segment to the end of the path. Reserved characters in the string are automatically escaped.

    All end iterators are invalidated.

    Postconditions

    this->back() == s

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    pop_back

    Remove the last segment

    Synopsis

    void pop_back() noexcept;

    Declared in file <boost/url/impl/segments_ref.hpp> at line 139

    Description

    This function removes the last segment from the container.

    Iterators to the last segment as well as all end iterators are invalidated.

    Preconditions

    not this->empty()

    Exception Safety

    Throws nothing.

    url_view_base

    Common functionality for containers

    Synopsis

    class url_view_base ;

    Declared in file <boost/url/url_view_base.hpp> at line 65

    Member Functions

    Name Description
    digest
    size

    Return the number of characters in the url

    empty

    Return true if the url is empty

    data

    Return a pointer to the url's character buffer

    buffer

    Return the url string

    operator string_view

    Return the URL as a core::string_view

    persist

    Return a shared, persistent copy of the url

    has_scheme

    Return true a scheme is present

    scheme

    Return the scheme

    scheme_id

    Return the scheme

    has_authority

    Return true if an authority is present

    authority

    Return the authority

    encoded_authority

    Return the authority.

    has_userinfo

    Return true if a userinfo is present

    has_password

    Return true if a password is present

    userinfo

    Return the userinfo

    encoded_userinfo

    Return the userinfo

    user

    Return the user

    encoded_user

    Return the user

    password

    Return the password

    encoded_password

    Return the password

    host_type

    Return the host type

    host

    Return the host

    encoded_host

    Return the host

    host_address

    Return the host

    encoded_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

    encoded_host_name

    Return the host name

    zone_id

    Return the IPv6 Zone ID

    encoded_zone_id

    Return the IPv6 Zone ID

    has_port

    Return true if a port is present

    port

    Return the port

    port_number

    Return the port

    is_path_absolute

    Return true if the path is absolute

    path

    Return the path

    encoded_path

    Return the path

    segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    has_query

    Return true if a query is present

    query

    Return the query

    encoded_query

    Return the query

    params

    Return the query as a container of parameters

    params
    encoded_params

    Return the query as a container of parameters

    has_fragment

    Return true if a fragment is present

    fragment

    Return the fragment

    encoded_fragment

    Return the fragment

    encoded_host_and_port

    Return the host and port

    encoded_origin

    Return the origin

    encoded_resource

    Return the resource

    encoded_target

    Return the target

    compare

    Return the result of comparing this with another url

    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:

    Containers

  • url
  • url_view
  • static_url
  • Functions

  • parse_absolute_uri
  • parse_origin_form
  • parse_relative_ref
  • parse_uri
  • parse_uri_reference
  • digest

    Synopsis

    size_t digest( size_t) noexcept;

    Declared in file <src/url_view_base.cpp> at line 43

    max_size

    Return the maximum number of characters possible

    Synopsis

    static size_t max_size() noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 139

    Description

    This represents the largest number of characters that are theoretically possible to represent in a url, not including any null terminator. In practice the actual possible size may be lower than this number.

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    size

    Return the number of characters in the url

    Synopsis

    size_t size() noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 165

    Description

    This function returns the number of characters in the url's encoded string, not including any null terminator, if present.

    Example

    assert( url_view( "file:///Program%20Files" ).size() == 23 );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    empty

    Return true if the url is empty

    Synopsis

    bool empty() noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 201

    Description

    The empty string matches the relative-ref grammar.

    Example

    assert( url_view( "" ).empty() );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    relative-ref = relative-part [ "?" query ] [ "#" fragment ] relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-empty

    Specification

  • 4.2. Relative Reference (rfc3986)
  • data

    Return a pointer to the url's character buffer

    Synopsis

    const char* data() noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 219

    Description

    This function returns a pointer to the first character of the url, which is not guaranteed to be null-terminated.

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    buffer

    Return the url string

    Synopsis

    string_view buffer() noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 241

    Description

    This function returns the entire url, which may contain percent escapes.

    Example

    assert( url_view( "http://www.example.com" ).buffer() == "http://www.example.com" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    operator string_view

    Return the URL as a core::string_view

    Synopsis

    string_view operator string_view() noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 257

    Description

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    persist

    Return a shared, persistent copy of the url

    Synopsis

    shared_ptr<const url_view> persist();

    Declared in file <src/url_view_base.cpp> at line 83

    Description

    This function returns a read-only copy of the url, with shared lifetime. The returned value owns (persists) the underlying string. The algorithm used to create the value minimizes the number of individual memory allocations, making it more efficient than when using direct standard library functions.

    Example

    std::shared_ptr< url_view const > sp; { std::string s( "http://example.com" ); url_view u( s ); // u references characters in s assert( u.data() == s.data() ); // same buffer sp = u.persist(); assert( sp->data() != s.data() ); // different buffer assert( sp->buffer() == s); // same contents // s is destroyed and thus u // becomes invalid, but sp remains valid. }

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Calls to allocate may throw.

    has_scheme

    Return true a scheme is present

    Synopsis

    bool has_scheme() noexcept;

    Declared in file <src/url_view_base.cpp> at line 105

    Description

    This function returns true if this contains a scheme.

    Example

    assert( url_view( "http://www.example.com" ).has_scheme() );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

    Specification

  • 3.1. Scheme (rfc3986)
  • scheme

    Return the scheme

    Synopsis

    string_view scheme() noexcept;

    Declared in file <src/url_view_base.cpp> at line 120

    Description

    This function returns the scheme if it exists, without a trailing colon (':'). Otherwise it returns an empty string. Note that schemes are case-insensitive, and the canonical form is lowercased.

    Example

    assert( url_view( "http://www.example.com" ).scheme() == "http" );

    Exception Safety

    Throws nothing.

    BNF

    scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ]

    Specification

  • 3.1. Scheme (rfc3986)
  • scheme_id

    Return the scheme

    Synopsis

    scheme scheme_id() noexcept;

    Declared in file <src/url_view_base.cpp> at line 134

    Description

    This function returns a value which depends on the scheme in the url:

  • If the scheme is a well-known scheme, corresponding value from the enumeration urls::scheme is returned.
  • If a scheme is present but is not a well-known scheme, the value returned is urls::scheme::unknown.
  • Otherwise, if the scheme is absent the value returned is urls::scheme::none.
  • Example

    assert( url_view( "wss://www.example.com/crypto.cgi" ).scheme_id() == scheme::wss );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

    Specification

  • 3.1. Scheme (rfc3986)
  • has_authority

    Return true if an authority is present

    Synopsis

    bool has_authority() noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 480

    Description

    This function returns true if the url contains an authority. The presence of an authority is denoted by a double slash ("//") at the beginning or after the scheme.

    Example

    assert( url_view( "http://www.example.com/index.htm" ).has_authority() );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ] URI-reference = URI / relative-ref relative-ref = relative-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty ; (more...) relative-part = "//" authority path-abempty ; (more...)

    Specification

  • 3.2. Authority (rfc3986)
  • authority

    Return the authority

    Synopsis

    authority_view authority() noexcept;

    Declared in file <src/url_view_base.cpp> at line 147

    Description

    This function returns the authority as an authority_view.

    Example

    authority_view a = url_view( "https://www.example.com:8080/index.htm" ).authority();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ]

    Specification

  • 3.2. Authority (rfc3986)
  • encoded_authority

    Return the authority.

    Synopsis

    pct_string_view encoded_authority() noexcept;

    Declared in file <src/url_view_base.cpp> at line 177

    Description

    If present, this function returns a string representing the authority (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes.

    Example

    assert( url_view( "file://Network%20Drive/My%2DFiles" ).encoded_authority() == "Network%20Drive" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ]

    Specification

  • 3.2. Authority (rfc3986)
  • has_userinfo

    Return true if a userinfo is present

    Synopsis

    bool has_userinfo() noexcept;

    Declared in file <src/url_view_base.cpp> at line 203

    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 ]

    Specification

  • 3.2.1. User Information (rfc3986)
  • has_password

    Return true if a password is present

    Synopsis

    bool has_password() noexcept;

    Declared in file <src/url_view_base.cpp> at line 216

    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 / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • userinfo

    Return the userinfo

    Synopsis

    template< class StringToken = return_string> StringToken::result_type userinfo( StringToken&& token);

    Declared in file <boost/url/url_view_base.hpp> at line 696

    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.

    NOTE

    This function uses the string token return type customization. Depending on the token passed, the return type and behavior of the function can be different. See string_token::return_string for more information.

    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 ]

    Specification

  • 3.2.1. User Information (rfc3986)
  • encoded_userinfo

    Return the userinfo

    Synopsis

    pct_string_view encoded_userinfo() noexcept;

    Declared in file <src/url_view_base.cpp> at line 234

    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 ]

    Specification

  • 3.2.1. User Information (rfc3986)
  • user

    Return the user

    Synopsis

    template< class StringToken = return_string> StringToken::result_type user( StringToken&& token);

    Declared in file <boost/url/url_view_base.hpp> at line 793

    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 / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • encoded_user

    Return the user

    Synopsis

    pct_string_view encoded_user() noexcept;

    Declared in file <src/url_view_base.cpp> at line 258

    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 / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • password

    Return the password

    Synopsis

    template< class StringToken = return_string> StringToken::result_type password( StringToken&& token);

    Declared in file <boost/url/url_view_base.hpp> at line 889

    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 / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • encoded_password

    Return the password

    Synopsis

    pct_string_view encoded_password() noexcept;

    Declared in file <src/url_view_base.cpp> at line 275

    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 / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • host_type

    Return the host type

    Synopsis

    host_type host_type() noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 975

    Description

    This function returns one of the following constants representing the type of host present.

  • host_type::ipv4
  • host_type::ipv6
  • host_type::ipvfuture
  • host_type::name
  • host_type::none
  • When has_authority is false, the host type is host_type::none.

    Example

    assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    Specification

  • 3.2.2. Host (rfc3986)
  • host

    Return the host

    Synopsis

    template< class StringToken = return_string> StringToken::result_type host( StringToken&& token);

    Declared in file <boost/url/url_view_base.hpp> at line 1014

    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

  • 3.2.2. Host (rfc3986)
  • encoded_host

    Return the host

    Synopsis

    pct_string_view encoded_host() noexcept;

    Declared in file <src/url_view_base.cpp> at line 321

    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

  • 3.2.2. Host (rfc3986)
  • host_address

    Return the host

    Synopsis

    template< class StringToken = return_string> StringToken::result_type host_address( StringToken&& token);

    Declared in file <boost/url/url_view_base.hpp> at line 1109

    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

  • 3.2.2. Host (rfc3986)
  • encoded_host_address

    Return the host

    Synopsis

    pct_string_view encoded_host_address() noexcept;

    Declared in file <src/url_view_base.cpp> at line 328

    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

  • 3.2.2. Host (rfc3986)
  • host_ipv4_address

    Return the host IPv4 address

    Synopsis

    ipv4_address host_ipv4_address() noexcept;

    Declared in file <src/url_view_base.cpp> at line 367

    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

  • 3.2.2. Host (rfc3986)
  • host_ipv6_address

    Return the host IPv6 address

    Synopsis

    ipv6_address host_ipv6_address() noexcept;

    Declared in file <src/url_view_base.cpp> at line 380

    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

  • 3.2.2. Host (rfc3986)
  • host_ipvfuture

    Return the host IPvFuture address

    Synopsis

    string_view host_ipvfuture() noexcept;

    Declared in file <src/url_view_base.cpp> at line 393

    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

  • 3.2.2. Host (rfc3986)
  • host_name

    Return the host name

    Synopsis

    template< class StringToken = return_string> StringToken::result_type host_name( StringToken&& token);

    Declared in file <boost/url/url_view_base.hpp> at line 1324

    Description

    If the host type is host_type::name, this function returns the name as a string. Otherwise an empty string is returned. 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

  • 3.2.2. Host (rfc3986)
  • encoded_host_name

    Return the host name

    Synopsis

    pct_string_view encoded_host_name() noexcept;

    Declared in file <src/url_view_base.cpp> at line 408

    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

  • 3.2.2. Host (rfc3986)
  • zone_id

    Return the IPv6 Zone ID

    Synopsis

    template< class StringToken = return_string> StringToken::result_type zone_id( StringToken&& token);

    Declared in file <boost/url/url_view_base.hpp> at line 1406

    Description

    If the host type is host_type::ipv6, this function returns the Zone ID as a string. Otherwise an empty string is returned. Any percent-escapes in the string are decoded first.

    Example

    assert( url_view( "http://[fe80::1%25eth0]/" ).zone_id() == "eth0" );

    Complexity

    Linear in `this->encoded_zone_id().size()`.

    Exception Safety

    Calls to allocate may throw.

    BNF

    host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]" ZoneID = 1*( unreserved / pct-encoded ) IPv6addrz = IPv6address "%25" ZoneID

    Specification

  • Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers
  • encoded_zone_id

    Return the IPv6 Zone ID

    Synopsis

    pct_string_view encoded_zone_id() noexcept;

    Declared in file <src/url_view_base.cpp> at line 422

    Description

    If the host type is host_type::ipv6, this function returns the Zone ID as a string. Otherwise an empty string is returned. The returned string may contain percent escapes.

    Example

    assert( url_view( "http://[fe80::1%25eth0]/" ).encoded_zone_id() == "eth0" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]" ZoneID = 1*( unreserved / pct-encoded ) IPv6addrz = IPv6address "%25" ZoneID

    Specification

  • Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers
  • has_port

    Return true if a port is present

    Synopsis

    bool has_port() noexcept;

    Declared in file <src/url_view_base.cpp> at line 442

    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

  • 3.2.3. Port (rfc3986)
  • port

    Return the port

    Synopsis

    string_view port() noexcept;

    Declared in file <src/url_view_base.cpp> at line 454

    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

  • 3.2.3. Port (rfc3986)
  • port_number

    Return the port

    Synopsis

    uint16_t port_number() noexcept;

    Declared in file <src/url_view_base.cpp> at line 465

    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

  • 3.2.3. Port (rfc3986)
  • is_path_absolute

    Return true if the path is absolute

    Synopsis

    bool is_path_absolute() noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 1611

    Description

    This function returns true if the path begins with a forward slash ('/').

    Example

    assert( url_view( "/path/to/file.txt" ).is_path_absolute() );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • path

    Return the path

    Synopsis

    template< class StringToken = return_string> StringToken::result_type path( StringToken&& token);

    Declared in file <boost/url/url_view_base.hpp> at line 1663

    Description

    This function returns the path as a string. The path may be empty. Any percent-escapes in the string are decoded first.

    Example

    assert( url_view( "file:///Program%20Files/Games/config.ini" ).path() == "/Program Files/Games/config.ini" );

    Complexity

    Linear in `this->path().size()`.

    Exception Safety

    Calls to allocate may throw.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • encoded_path

    Return the path

    Synopsis

    pct_string_view encoded_path() noexcept;

    Declared in file <src/url_view_base.cpp> at line 481

    Description

    This function returns the path as a string. The path may be empty. Any percent-escapes in the string are decoded first.

    Example

    assert( url_view( "file:///Program%20Files/Games/config.ini" ).encoded_path() == "/Program%20Files/Games/config.ini" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • segments

    Return the path as a container of segments

    Synopsis

    segments_view segments() noexcept;

    Declared in file <src/url_view_base.cpp> at line 488

    Description

    This function returns a bidirectional view of strings over the path. The returned view references the same underlying character buffer; ownership is not transferred. Any percent-escapes in strings returned when iterating the view are decoded first.

    Example

    segments_view sv = url_view( "/path/to/file.txt" ).segments();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    path = [ "/" ] segment *( "/" segment )

    Specification

  • 3.3. Path (rfc3986)
  • encoded_segments

    Return the path as a container of segments

    Synopsis

    segments_encoded_view encoded_segments() noexcept;

    Declared in file <src/url_view_base.cpp> at line 495

    Description

    This function returns a bidirectional view of strings over the path. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes.

    Example

    segments_encoded_view sv = url_view( "/path/to/file.txt" ).encoded_segments();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • has_query

    Return true if a query is present

    Synopsis

    bool has_query() noexcept;

    Declared in file <src/url_view_base.cpp> at line 509

    Description

    This function returns true if this contains a query. An empty query is distinct from having no query.

    Example

    assert( url_view( "/sql?id=42&col=name&page-size=20" ).has_query() );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • ://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)
  • query

    Return the query

    Synopsis

    template< class StringToken = return_string> StringToken::result_type query( StringToken&& token);

    Declared in file <boost/url/url_view_base.hpp> at line 1901

    Description

    If this contains a query, it is returned as a string (which may be empty). Otherwise, an empty string is returned. Any percent-escapes in the string are decoded first. When plus signs appear in the query portion of the url, they are converted to spaces automatically upon decoding. This behavior can be changed by setting decode options.

    Example

    assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).query() == "id=42&name=jane-doe&page size=20" );

    Complexity

    Linear in `this->query().size()`.

    Exception Safety

    Calls to allocate may throw.

    BNF

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

    Specification

  • ://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)
  • encoded_query

    Return the query

    Synopsis

    pct_string_view encoded_query() noexcept;

    Declared in file <src/url_view_base.cpp> at line 523

    Description

    If this contains a query, it is returned as a string (which may be empty). Otherwise, an empty string is returned. The returned string may contain percent escapes.

    Example

    assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_query() == "id=42&name=jane%2Ddoe&page+size=20" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • ://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)
  • params

    Return the query as a container of parameters

    Synopsis

    params_view params() noexcept;

    Declared in file <src/url_view_base.cpp> at line 542

    Description

    This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Any percent-escapes in strings returned when iterating the view are decoded first.

    Example

    params_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).params();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • ://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)
  • params

    Synopsis

    params_view params( encoding_opts opt) noexcept;

    Declared in file <src/url_view_base.cpp> at line 552

    encoded_params

    Return the query as a container of parameters

    Synopsis

    params_encoded_view encoded_params() noexcept;

    Declared in file <src/url_view_base.cpp> at line 535

    Description

    This function returns a bidirectional view of key/value pairs over the query. The returned view references the same underlying character buffer; ownership is not transferred. Strings returned when iterating the range may contain percent escapes.

    Example

    params_encoded_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params();

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    Specification

  • 3.4. Query (rfc3986)
  • BNF

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

    Specification

  • ://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)
  • has_fragment

    Return true if a fragment is present

    Synopsis

    bool has_fragment() noexcept;

    Declared in file <src/url_view_base.cpp> at line 565

    Description

    This function returns true if the url contains a fragment. An empty fragment is distinct from no fragment.

    Example

    assert( url_view( "http://www.example.com/index.htm#anchor" ).has_fragment() );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • 3.5. Fragment (rfc3986)
  • fragment

    Return the fragment

    Synopsis

    template< class StringToken = return_string> StringToken::result_type fragment( StringToken&& token);

    Declared in file <boost/url/url_view_base.hpp> at line 2149

    Description

    This function calculates the fragment of the url, with percent escapes decoded and without the leading pound sign ('#') whose presence indicates that the url contains a fragment.

    This function accepts an optional StringToken parameter which controls the return type and behavior of the function:

  • When called with no arguments, the return type of the function is `std::string`. Otherwise
  • When called with a string token, the behavior and return type of the function depends on the type of string token being passed.
  • Example

    assert( url_view( "http://www.example.com/index.htm#a%2D1" ).fragment() == "a-1" );

    Complexity

    Linear in `this->fragment().size()`.

    Exception Safety

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

    BNF

    fragment = *( pchar / "/" / "?" ) fragment-part = [ "#" fragment ]

    Specification

  • 3.5. Fragment (rfc3986)
  • encoded_fragment

    Return the fragment

    Synopsis

    pct_string_view encoded_fragment() noexcept;

    Declared in file <src/url_view_base.cpp> at line 578

    Description

    This function returns the fragment as a string with percent-escapes. Ownership is not transferred; the string returned references the underlying character buffer, which must remain valid or else undefined behavior occurs.

    Example

    assert( url_view( "http://www.example.com/index.htm#a%2D1" ).encoded_fragment() == "a%2D1" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    fragment = *( pchar / "/" / "?" ) pchar = unreserved / pct-encoded / sub-delims / ":" / "@"

    Specification

  • 3.5. Fragment (rfc3986)
  • encoded_host_and_port

    Return the host and port

    Synopsis

    pct_string_view encoded_host_and_port() noexcept;

    Declared in file <src/url_view_base.cpp> at line 601

    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 ]

    Specification

  • 3.2.2. Host (rfc3986)
  • 3.2.3. Port (rfc3986)
  • encoded_origin

    Return the origin

    Synopsis

    pct_string_view encoded_origin() noexcept;

    Declared in file <src/url_view_base.cpp> at line 608

    Description

    If an authority is present, this function returns the scheme and authority portion of the url. Otherwise, an empty string is returned. The returned string may contain percent escapes.

    Example

    assert( url_view( "http://www.example.com:8080/index.htm?text=none#h1" ).encoded_origin() == "http://www.example.com:8080" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    encoded_resource

    Return the resource

    Synopsis

    pct_string_view encoded_resource() noexcept;

    Declared in file <src/url_view_base.cpp> at line 617

    Description

    This function returns the resource, which is the portion of the url that includes only the path, query, and fragment. The returned string may contain percent escapes.

    Example

    assert( url_view( "http://www.example.com/index.html?query#frag" ).encoded_resource() == "/index.html?query#frag" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    Specification

  • 3.3. Path (rfc3986)
  • 3.4. Query (rfc3986)
  • encoded_target

    Return the target

    Synopsis

    pct_string_view encoded_target() noexcept;

    Declared in file <src/url_view_base.cpp> at line 637

    Description

    This function returns the target, which is the portion of the url that includes only the path and query. The returned string may contain percent escapes.

    Example

    assert( url_view( "http://www.example.com/index.html?query#frag" ).encoded_target() == "/index.html?query" );

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    Specification

  • 3.3. Path (rfc3986)
  • 3.4. Query (rfc3986)
  • compare

    Return the result of comparing this with another url

    Synopsis

    int compare( const url_view_base& other) noexcept;

    Declared in file <src/url_view_base.cpp> at line 660

    Description

    This function compares two URLs according to Syntax-Based comparison algorithm.

    Complexity

    Linear in `min( u0.size(), u1.size() )`

    Exception Safety

    Throws nothing.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • operator==

    Return the result of comparing two URLs

    Synopsis

    bool operator==( const url_view_base& u0, const url_view_base& u1) noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 2413

    Description

    The URLs are compared component by component as if they were first normalized.

    Example

    url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 == u1 );

    Effects

    url a(u0); a.normalize(); url b(u1); b.normalize(); return std::make_tuple( a.scheme(), a.user(), a.password(), a.host(), a.port(), a.path(), a.query(), a.fragment()) == std::make_tuple( b.scheme(), b.user(), b.password(), b.host(), b.port(), b.path(), b.query(), b.fragment());

    Complexity

    Linear in `min( u0.size(), u1.size() )`

    Exception Safety

    Throws nothing

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • operator!=

    Return the result of comparing two URLs

    Synopsis

    bool operator!=( const url_view_base& u0, const url_view_base& u1) noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 2473

    Description

    The URLs are compared component by component as if they were first normalized.

    Example

    url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 != u1 );

    Effects

    url a(u0); a.normalize(); url b(u1); b.normalize(); return std::make_tuple( a.scheme(), a.user(), a.password(), a.host(), a.port(), a.path(), a.query(), a.fragment()) != std::make_tuple( b.scheme(), b.user(), b.password(), b.host(), b.port(), b.path(), b.query(), b.fragment());

    Complexity

    Linear in `min( u0.size(), u1.size() )`

    Exception Safety

    Throws nothing

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • operator<

    Return the result of comparing two URLs

    Synopsis

    bool operator<( const url_view_base& u0, const url_view_base& u1) noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 2533

    Description

    The URLs are compared component by component as if they were first normalized.

    Example

    url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 < u1 );

    Effects

    url a(u0); a.normalize(); url b(u1); b.normalize(); return std::make_tuple( a.scheme(), a.user(), a.password(), a.host(), a.port(), a.path(), a.query(), a.fragment()) < std::make_tuple( b.scheme(), b.user(), b.password(), b.host(), b.port(), b.path(), b.query(), b.fragment());

    Complexity

    Linear in `min( u0.size(), u1.size() )`

    Exception Safety

    Throws nothing

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • operator<=

    Return the result of comparing two URLs

    Synopsis

    bool operator<=( const url_view_base& u0, const url_view_base& u1) noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 2593

    Description

    The URLs are compared component by component as if they were first normalized.

    Example

    url_view u0( "http://www.b.com/index.htm" ); url_view u1( "http://www.b.com/index.htm" ); assert( u0 <= u1 );

    Effects

    url a(u0); a.normalize(); url b(u1); b.normalize(); return std::make_tuple( a.scheme(), a.user(), a.password(), a.host(), a.port(), a.path(), a.query(), a.fragment()) <= std::make_tuple( b.scheme(), b.user(), b.password(), b.host(), b.port(), b.path(), b.query(), b.fragment());

    Complexity

    Linear in `min( u0.size(), u1.size() )`

    Exception Safety

    Throws nothing

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • operator>

    Return the result of comparing two URLs

    Synopsis

    bool operator>( const url_view_base& u0, const url_view_base& u1) noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 2653

    Description

    The URLs are compared component by component as if they were first normalized.

    Example

    url_view u0( "http://www.b.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 > u1 );

    Effects

    url a(u0); a.normalize(); url b(u1); b.normalize(); return std::make_tuple( a.scheme(), a.user(), a.password(), a.host(), a.port(), a.path(), a.query(), a.fragment()) > std::make_tuple( b.scheme(), b.user(), b.password(), b.host(), b.port(), b.path(), b.query(), b.fragment());

    Complexity

    Linear in `min( u0.size(), u1.size() )`

    Exception Safety

    Throws nothing

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • operator>=

    Return the result of comparing two URLs

    Synopsis

    bool operator>=( const url_view_base& u0, const url_view_base& u1) noexcept;

    Declared in file <boost/url/url_view_base.hpp> at line 2713

    Description

    The URLs are compared component by component as if they were first normalized.

    Example

    url_view u0( "http://www.a.com/index.htm" ); url_view u1( "http://www.a.com/index.htm" ); assert( u0 >= u1 );

    Effects

    url a(u0); a.normalize(); url b(u1); b.normalize(); return std::make_tuple( a.scheme(), a.user(), a.password(), a.host(), a.port(), a.path(), a.query(), a.fragment()) >= std::make_tuple( b.scheme(), b.user(), b.password(), b.host(), b.port(), b.path(), b.query(), b.fragment());

    Complexity

    Linear in `min( u0.size(), u1.size() )`

    Exception Safety

    Throws nothing

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • operator<<

    Format the url to the output stream

    Synopsis

    ostream& operator<<( ostream& os, const url_view_base& u);

    Declared in file <boost/url/url_view_base.hpp> at line 2722

    Description

    This function serializes the url to the specified output stream. Any percent-escapes are emitted as-is; no decoding is performed.

    Example

    url_view u( "http://www.example.com/index.htm" ); std::stringstream ss; ss << u; assert( ss.str() == "http://www.example.com/index.htm" );

    Effects

    return os << u.buffer();

    Complexity

    Linear in `u.buffer().size()`

    Exception Safety

    Basic guarantee.

    resolve

    Resolve a URL reference against a base URL

    Synopsis

    result<void> resolve( const url_view_base& base, const url_view_base& ref, url_base& dest);

    Declared in file <boost/url/url_base.hpp> at line 2888

    Description

    This function attempts to resolve a URL reference `ref` against the base URL `base` in a manner similar to that of a web browser resolving an anchor tag.

    The base URL must satisfy the URI grammar. In other words, it must contain a scheme.

    Relative references are only usable when in the context of a base absolute URI. This process of resolving a relative reference within the context of a base URI is defined in detail in rfc3986 (see below).

    The resolution process works as if the relative reference is appended to the base URI and the result is normalized.

    Given the input base URL, this function resolves the relative reference as if performing the following steps:

  • Ensure the base URI has at least a scheme
  • Normalizing the reference path
  • Merge base and reference paths
  • Normalize the merged path
  • This function places the result of the resolution into `dest`, which can be any of the url containers that inherit from url_base.

    If an error occurs, the contents of `dest` is unspecified and `ec` is set.

    Example

    url dest; system::error_code ec; resolve("/one/two/three", "four", dest, ec); assert( dest.str() == "/one/two/four" ); resolve("http://example.com/", "/one", dest, ec); assert( dest.str() == "http://example.com/one" ); resolve("http://example.com/one", "/two", dest, ec); assert( dest.str() == "http://example.com/two" ); resolve("http://a/b/c/d;p?q", "g#s", dest, ec); assert( dest.str() == "http://a/b/c/g#s" );

    BNF

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

    Exception Safety

    Basic guarantee. Calls to allocate may throw.

    Specification

    5. Reference Resolution (rfc3986)

    url

    A modifiable container for a URL.

    Synopsis

    class url : public url_base;

    Declared in file <boost/url/url.hpp> at line 63

    Member Functions

    Name Description
    digest
    size

    Return the number of characters in the url

    empty

    Return true if the url is empty

    data

    Return a pointer to the url's character buffer

    buffer

    Return the url string

    operator string_view

    Return the URL as a core::string_view

    persist

    Return a shared, persistent copy of the url

    has_scheme

    Return true a scheme is present

    scheme

    Return the scheme

    scheme_id

    Return the scheme

    has_authority

    Return true if an authority is present

    authority

    Return the authority

    encoded_authority

    Return the authority.

    has_userinfo

    Return true if a userinfo is present

    has_password

    Return true if a password is present

    userinfo

    Return the userinfo

    encoded_userinfo

    Return the userinfo

    user

    Return the user

    encoded_user

    Return the user

    password

    Return the password

    encoded_password

    Return the password

    host_type

    Return the host type

    host

    Return the host

    encoded_host

    Return the host

    host_address

    Return the host

    encoded_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

    encoded_host_name

    Return the host name

    zone_id

    Return the IPv6 Zone ID

    encoded_zone_id

    Return the IPv6 Zone ID

    has_port

    Return true if a port is present

    port

    Return the port

    port_number

    Return the port

    is_path_absolute

    Return true if the path is absolute

    path

    Return the path

    encoded_path

    Return the path

    segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    has_query

    Return true if a query is present

    query

    Return the query

    encoded_query

    Return the query

    params

    Return the query as a container of parameters

    params
    encoded_params

    Return the query as a container of parameters

    has_fragment

    Return true if a fragment is present

    fragment

    Return the fragment

    encoded_fragment

    Return the fragment

    encoded_host_and_port

    Return the host and port

    encoded_origin

    Return the origin

    encoded_resource

    Return the resource

    encoded_target

    Return the target

    compare

    Return the result of comparing this with another url

    c_str

    Return the url as a null-terminated string

    capacity

    Return the number of characters that can be stored without reallocating

    clear

    Clear the contents while preserving the capacity

    reserve

    Adjust the capacity without changing the size

    set_scheme

    Set the scheme

    set_scheme_id
    remove_scheme

    Remove the scheme

    set_encoded_authority

    Set the authority

    remove_authority

    Remove the authority

    set_userinfo

    Set the userinfo

    set_encoded_userinfo

    Set the userinfo.

    remove_userinfo

    Remove the userinfo

    set_user

    Set the user

    set_encoded_user

    Set the user

    set_password

    Set the password.

    set_encoded_password

    Set the password.

    remove_password

    Remove the password

    set_host

    Set the host

    set_encoded_host

    Set the host

    set_host_address

    Set the host to an address

    set_encoded_host_address

    Set the host to an address

    set_host_ipv4

    Set the host to an address

    set_host_ipv6

    Set the host to an address

    set_host_ipvfuture

    Set the host to an address

    set_host_name

    Set the host to a name

    set_encoded_host_name

    Set the host to a name

    set_port_number

    Set the port

    set_port

    Set the port

    remove_port

    Remove the port

    set_path_absolute

    Set if the path is absolute

    set_path

    Set the path.

    set_encoded_path

    Set the path.

    segments

    Return the path as a container of segments

    segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    set_query

    Set the query

    set_encoded_query

    Set the query

    params

    Return the query as a container of parameters

    params

    url_view_base::params

    params

    Return the query as a container of parameters

    encoded_params

    Return the query as a container of parameters

    encoded_params

    Return the query as a container of parameters

    set_params

    Set the query params

    set_encoded_params

    Set the query params

    remove_query

    Remove the query

    remove_fragment

    Remove the fragment

    set_fragment

    Set the fragment.

    set_encoded_fragment

    Set the fragment.

    remove_origin

    Remove the origin component

    normalize

    Normalize the URL components

    normalize_scheme

    Normalize the URL scheme

    normalize_authority

    Normalize the URL authority

    normalize_path

    Normalize the URL path

    normalize_query

    Normalize the URL query

    normalize_fragment

    Normalize the URL fragment

    resolve

    Resolve a URL reference against this base URL

    ~url

    Destructor

    url

    Constructor

    url

    Constructor

    url

    Constructor

    url

    Constructor

    url

    Constructor

    operator=

    Assignment

    operator=

    Assignment

    operator=

    Assignment

    swap

    Swap the contents.

    set_scheme

    Set the scheme

    set_scheme_id

    url_base::set_scheme_id

    remove_scheme

    Remove the scheme

    set_encoded_authority

    Set the authority

    remove_authority

    Remove the authority

    set_userinfo

    Set the userinfo

    set_encoded_userinfo

    Set the userinfo.

    remove_userinfo

    Remove the userinfo

    set_user

    Set the user

    set_encoded_user

    Set the user

    set_password

    Set the password.

    set_encoded_password

    Set the password.

    remove_password

    Remove the password

    set_host

    Set the host

    set_encoded_host

    Set the host

    set_host_address

    Set the host to an address

    set_encoded_host_address

    Set the host to an address

    set_host_ipv4

    Set the host to an address

    set_host_ipv6

    Set the host to an address

    set_host_ipvfuture

    Set the host to an address

    set_host_name

    Set the host to a name

    set_encoded_host_name

    Set the host to a name

    set_port_number

    Set the port

    set_port

    Set the port

    remove_port

    Remove the port

    set_path

    Set the path.

    set_encoded_path

    Set the path.

    set_query

    Set the query

    set_encoded_query

    Set the query

    set_params

    Set the query params

    set_encoded_params

    Set the query params

    remove_query

    Remove the query

    remove_fragment

    Remove the fragment

    set_fragment

    Set the fragment.

    set_encoded_fragment

    Set the fragment.

    remove_origin

    Remove the origin component

    normalize

    Normalize the URL components

    normalize_scheme

    Normalize the URL scheme

    normalize_authority

    Normalize the URL authority

    normalize_path

    Normalize the URL path

    normalize_query

    Normalize the URL query

    normalize_fragment

    Normalize the URL fragment

    Description

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

    Exception Safety

  • Functions marked `noexcept` provide the no-throw guarantee, otherwise:
  • Functions which throw offer the strong exception safety guarantee.
  • BNF

    URI-reference = URI / relative-ref URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] absolute-URI = scheme ":" hier-part [ "?" query ]

    Specification

  • Uniform Resource Identifier (URI): Generic Syntax (rfc3986)
  • ~url

    Destructor

    Synopsis

    void ~url();

    Declared in file <src/url.cpp> at line 24

    Description

    Any params, segments, iterators, or views which reference this object are invalidated. The underlying character buffer is destroyed, invalidating all references to it.

    url

    Constructor

    Synopsis

    void url() noexcept;

    Declared in file <src/url.cpp> at line 36

    Description

    Default constructed urls contain a zero-length string. This matches the grammar for a relative-ref with an empty path and no query or fragment.

    Example

    url u;

    Postconditions

    this->empty() == true

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

    4.2. Relative Reference (rfc3986)

    url

    Constructor

    Synopsis

    void url( string_view s);

    Declared in file <src/url.cpp> at line 39

    Description

    This function constructs a URL from the string `s`, which must contain a valid URI or relative-ref or else an exception is thrown. The new url retains ownership by allocating a copy of the passed string.

    Example

    url u( "https://www.example.com" );

    Effects

    return url( parse_uri_reference( s ).value() );

    Postconditions

    this->buffer().data() != s.data()

    Complexity

    Linear in `s.size()`.

    Exception Safety

    Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

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

    Specification

  • 4.1. URI Reference
  • url

    Constructor

    Synopsis

    void url( url&& u) noexcept;

    Declared in file <src/url.cpp> at line 46

    Description

    The contents of `u` are transferred to the newly constructed object, which includes the underlying character buffer. After construction, the moved-from object is as if default constructed.

    Postconditions

    u.empty() == true

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    url

    Constructor

    Synopsis

    void url( const url_view_base& u);

    Declared in file <boost/url/url.hpp> at line 217

    Description

    The newly constructed object contains a copy of `u`.

    Postconditions

    this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data()

    Complexity

    Linear in `u.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    url

    Constructor

    Synopsis

    void url( const url& u);

    Declared in file <boost/url/url.hpp> at line 243

    Description

    The newly constructed object contains a copy of `u`.

    Postconditions

    this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data()

    Complexity

    Linear in `u.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    operator=

    Assignment

    Synopsis

    url& operator=( url&& u) noexcept;

    Declared in file <src/url.cpp> at line 57

    Description

    The contents of `u` are transferred to `this`, including the underlying character buffer. The previous contents of `this` are destroyed. After assignment, the moved-from object is as if default constructed.

    Postconditions

    u.empty() == true

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    operator=

    Assignment

    Synopsis

    url& operator=( const url_view_base& u);

    Declared in file <boost/url/url.hpp> at line 297

    Description

    The contents of `u` are copied and the previous contents of `this` are destroyed. Capacity is preserved, or increases.

    Postconditions

    this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data()

    Complexity

    Linear in `u.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    operator=

    Assignment

    Synopsis

    url& operator=( const url& u);

    Declared in file <boost/url/url.hpp> at line 326

    Description

    The contents of `u` are copied and the previous contents of `this` are destroyed. Capacity is preserved, or increases.

    Postconditions

    this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data()

    Complexity

    Linear in `u.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    swap

    Swap the contents.

    Synopsis

    void swap( url& other) noexcept;

    Declared in file <src/url.cpp> at line 154

    Description

    Exchanges the contents of this url with another url. All views, iterators and references remain valid.

    If `this == &other `, this function call has no effect.

    Example

    url u1( "https://www.example.com" ); url u2( "https://www.boost.org" ); u1.swap(u2); assert(u1 == "https://www.boost.org" ); assert(u2 == "https://www.example.com" );

    Complexity

    Constant

    Exception Safety

    Throws nothing.

    set_scheme

    Set the scheme

    Synopsis

    url& set_scheme( string_view s);

    Declared in file <boost/url/url.hpp> at line 409

    Description

    The scheme is set to the specified string, which must contain a valid scheme without any trailing colon (':'). Note that schemes are case-insensitive, and the canonical form is lowercased.

    Example

    assert( url( "http://www.example.com" ).set_scheme( "https" ).scheme_id() == scheme::https );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

    Specification

  • 3.1. Scheme (rfc3986)
  • set_scheme_id

    url_base::set_scheme_id

    Synopsis

    url& set_scheme_id( scheme id);

    Declared in file <boost/url/url.hpp> at line 411

    remove_scheme

    Remove the scheme

    Synopsis

    url& remove_scheme();

    Declared in file <boost/url/url.hpp> at line 413

    Description

    This function removes the scheme if it is present.

    Example

    assert( url("http://www.example.com/index.htm" ).remove_scheme().buffer() == "//www.example.com/index.htm" );

    Postconditions

    this->has_scheme() == false && this->scheme_id() == scheme::none

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • 3.1. Scheme (rfc3986)
  • set_encoded_authority

    Set the authority

    Synopsis

    url& set_encoded_authority( pct_string_view s);

    Declared in file <boost/url/url.hpp> at line 416

    Description

    This function sets the authority to the specified string. The string may contain percent-escapes.

    Example

    assert( url().set_encoded_authority( "My%20Computer" ).has_authority() );

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT

    Specification

  • 3.2. Authority (rfc3986)
  • remove_authority

    Remove the authority

    Synopsis

    url& remove_authority();

    Declared in file <boost/url/url.hpp> at line 418

    Description

    This function removes the authority, which includes the userinfo, host, and a port if present.

    Example

    assert( url( "http://example.com/echo.cgi" ).remove_authority().buffer() == "http:/echo.cgi" );

    Postconditions

    this->has_authority() == false && this->has_userinfo() == false && this->has_port() == false

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT

    Specification

  • 3.2. Authority (rfc3986)
  • set_userinfo

    Set the userinfo

    Synopsis

    url& set_userinfo( string_view s);

    Declared in file <boost/url/url.hpp> at line 421

    Description

    The userinfo is set to the given string, which may contain percent-escapes. Any special or reserved characters in the string are automatically percent-encoded. The effects on the user and password depend on the presence of a colon (':') in the string:

  • If an unescaped colon exists, the characters up to the colon become the user and the rest of the characters after the colon become the password. In this case has_password returns true. Otherwise,
  • If there is no colon, the user is set to the string. The function has_password returns false.
  • NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url( "http://example.com" ).set_userinfo( "user:pass" ).encoded_user() == "user" );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_encoded_userinfo

    Set the userinfo.

    Synopsis

    url& set_encoded_userinfo( pct_string_view s);

    Declared in file <boost/url/url.hpp> at line 423

    Description

    The userinfo is set to the given string, which may contain percent-escapes. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The effects on the user and password depend on the presence of a colon (':') in the string:

  • If an unescaped colon exists, the characters up to the colon become the user and the rest of the characters after the colon become the password. In this case has_password returns true. Otherwise,
  • If there is no colon, the user is set to the string. The function has_password returns false.
  • NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • remove_userinfo

    Remove the userinfo

    Synopsis

    url& remove_userinfo() noexcept;

    Declared in file <boost/url/url.hpp> at line 425

    Description

    This function removes the userinfo if present, without removing any authority.

    Example

    assert( url( "http://user@example.com" ).remove_userinfo().has_userinfo() == false );

    Postconditions

    this->has_userinfo() == false && this->encoded_userinfo().empty == true

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_user

    Set the user

    Synopsis

    url& set_user( string_view s);

    Declared in file <boost/url/url.hpp> at line 427

    Description

    This function sets the user part of the userinfo to the string. Any special or reserved characters in the string are automatically percent-encoded.

    Example

    assert( url().set_user("john doe").encoded_userinfo() == "john%20doe" );

    Postconditions

    this->has_authority() == true && this->has_userinfo() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_encoded_user

    Set the user

    Synopsis

    url& set_encoded_user( pct_string_view s);

    Declared in file <boost/url/url.hpp> at line 429

    Description

    This function sets the user part of the userinfo the the string, which may contain percent-escapes. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    Example

    assert( url().set_encoded_user("john%20doe").userinfo() == "john doe" );

    Postconditions

    this->has_authority() == true && this->has_userinfo() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_password

    Set the password.

    Synopsis

    url& set_password( string_view s);

    Declared in file <boost/url/url.hpp> at line 431

    Description

    This function sets the password in the userinfo to the string. Reserved characters in the string are percent-escaped in the result.

    NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url("http://user@example.com").set_password( "pass" ).encoded_userinfo() == "user:pass" );

    Postconditions

    this->has_password() == true && this->password() == s

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_encoded_password

    Set the password.

    Synopsis

    url& set_encoded_password( pct_string_view s);

    Declared in file <boost/url/url.hpp> at line 433

    Description

    This function sets the password in the userinfo to the string, which may contain percent-escapes. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url("http://user@example.com").set_encoded_password( "pass" ).encoded_userinfo() == "user:pass" );

    Postconditions

    this->has_password() == true

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • remove_password

    Remove the password

    Synopsis

    url& remove_password() noexcept;

    Declared in file <boost/url/url.hpp> at line 435

    Description

    This function removes the password from the userinfo if a password exists. If there is no userinfo or no authority, the call has no effect.

    NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url( "http://user:pass@example.com" ).remove_password().authority().buffer() == "user@example.com" );

    Postconditions

    this->has_password() == false && this->encoded_password().empty() == true

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_host

    Set the host

    Synopsis

    url& set_host( string_view s);

    Declared in file <boost/url/url.hpp> at line 438

    Description

    Depending on the contents of the passed string, this function sets the host:

  • If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4.
  • If the string is a valid IPv6 address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipv6.
  • If the string is a valid IPvFuture address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipvfuture.
  • Otherwise, the host name is set to the string, which may be empty. Reserved characters in the string are percent-escaped in the result. The host type is host_type::name.
  • In all cases, when this function returns, the URL contains an authority.

    Example

    assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );

    Postconditions

    this->has_authority() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • IPv4 (Wikipedia)
  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_encoded_host

    Set the host

    Synopsis

    url& set_encoded_host( pct_string_view s);

    Declared in file <boost/url/url.hpp> at line 440

    Description

    Depending on the contents of the passed string, this function sets the host:

  • If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4.
  • If the string is a valid IPv6 address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipv6.
  • If the string is a valid IPvFuture address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipvfuture.
  • Otherwise, the host name is set to the string. This string can contain percent escapes, or can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The host type is host_type::name.
  • In all cases, when this function returns, the URL contains an authority.

    Example

    assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );

    Postconditions

    this->has_authority() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • IPv4 (Wikipedia)
  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_host_address

    Set the host to an address

    Synopsis

    url& set_host_address( string_view s);

    Declared in file <boost/url/url.hpp> at line 442

    Description

    Depending on the contents of the passed string, this function sets the host:

  • If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4.
  • If the string is a valid IPv6 address, then the host is set to that address. The host type is host_type::ipv6.
  • If the string is a valid IPvFuture, then the host is set to that address. The host type is host_type::ipvfuture.
  • Otherwise, the host name is set to the string, which may be empty. Reserved characters in the string are percent-escaped in the result. The host type is host_type::name.
  • In all cases, when this function returns, the URL contains an authority.

    Example

    assert( url( "http://www.example.com" ).set_host_address( "127.0.0.1" ).buffer() == "http://127.0.0.1" );

    Postconditions

    this->has_authority() == true

    Complexity

    Linear in `s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    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 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 IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • IPv4 (Wikipedia)
  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_encoded_host_address

    Set the host to an address

    Synopsis

    url& set_encoded_host_address( pct_string_view s);

    Declared in file <boost/url/url.hpp> at line 444

    Description

    Depending on the contents of the passed string, this function sets the host:

  • If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4.
  • If the string is a valid IPv6 address, then the host is set to that address. The host type is host_type::ipv6.
  • If the string is a valid IPvFuture, then the host is set to that address. The host type is host_type::ipvfuture.
  • Otherwise, the host name is set to the string. This string can contain percent escapes, or can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The host type is host_type::name.
  • In all cases, when this function returns, the URL contains an authority.

    Example

    assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );

    Postconditions

    this->has_authority() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    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 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 IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • IPv4 (Wikipedia)
  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_host_ipv4

    Set the host to an address

    Synopsis

    url& set_host_ipv4( const ipv4_address& addr);

    Declared in file <boost/url/url.hpp> at line 446

    Description

    The host is set to the specified IPv4 address. The host type is host_type::ipv4.

    Example

    assert( url("http://www.example.com").set_host_ipv4( ipv4_address( "127.0.0.1" ) ).buffer() == "http://127.0.0.1" );

    Complexity

    Linear in `this->size()`.

    Postconditions

    this->has_authority() == true && this->host_ipv4_address() == addr && this->host_type() == host_type::ipv4

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    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

  • IPv4 (Wikipedia)
  • 3.2.2. Host (rfc3986)
  • set_host_ipv6

    Set the host to an address

    Synopsis

    url& set_host_ipv6( const ipv6_address& addr);

    Declared in file <boost/url/url.hpp> at line 448

    Description

    The host is set to the specified IPv6 address. The host type is host_type::ipv6.

    Example

    assert( url().set_host_ipv6( ipv6_address( "1::6:c0a8:1" ) ).authority().buffer() == "[1::6:c0a8:1]" );

    Postconditions

    this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::ipv6

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    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

  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_host_ipvfuture

    Set the host to an address

    Synopsis

    url& set_host_ipvfuture( string_view s);

    Declared in file <boost/url/url.hpp> at line 450

    Description

    The host is set to the specified IPvFuture string. The host type is host_type::ipvfuture.

    Example

    assert( url().set_host_ipvfuture( "v42.bis" ).buffer() == "//[v42.bis]" );

    Complexity

    Linear in `this->size() + s.size()`.

    Postconditions

    this->has_authority() == true && this->host_ipvfuture) == s && this->host_type() == host_type::ipvfuture

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )

    Specification

  • 3.2.2. Host (rfc3986)
  • set_host_name

    Set the host to a name

    Synopsis

    url& set_host_name( string_view s);

    Declared in file <boost/url/url.hpp> at line 452

    Description

    The host is set to the specified string, which may be empty. Reserved characters in the string are percent-escaped in the result. The host type is host_type::name.

    Example

    assert( url( "http://www.example.com/index.htm").set_host_name( "localhost" ).host_address() == "localhost" );

    Postconditions

    this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • 3.2.2. Host (rfc3986)
  • set_encoded_host_name

    Set the host to a name

    Synopsis

    url& set_encoded_host_name( pct_string_view s);

    Declared in file <boost/url/url.hpp> at line 454

    Description

    The host is set to the specified string, which may contain percent-escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The host type is host_type::name.

    Example

    assert( url( "http://www.example.com/index.htm").set_encoded_host_name( "localhost" ).host_address() == "localhost" );

    Postconditions

    this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • 3.2.2. Host (rfc3986)
  • set_port_number

    Set the port

    Synopsis

    url& set_port_number( uint16_t n);

    Declared in file <boost/url/url.hpp> at line 456

    Description

    The port is set to the specified integer.

    Example

    assert( url( "http://www.example.com" ).set_port_number( 8080 ).authority().buffer() == "www.example.com:8080" );

    Postconditions

    this->has_authority() == true && this->has_port() == true && this->port_number() == n

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT

    Specification

  • 3.2.3. Port (rfc3986)
  • set_port

    Set the port

    Synopsis

    url& set_port( string_view s);

    Declared in file <boost/url/url.hpp> at line 458

    Description

    This port is set to the string, which must contain only digits or be empty. An empty port string is distinct from having no port.

    Example

    assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" );

    Postconditions

    this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n)

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    port = *DIGIT

    Specification

  • 3.2.3. Port (rfc3986)
  • remove_port

    Remove the port

    Synopsis

    url& remove_port() noexcept;

    Declared in file <boost/url/url.hpp> at line 460

    Description

    If a port exists, it is removed. The rest of the authority is unchanged.

    Example

    assert( url( "http://www.example.com:80" ).remove_port().authority().buffer() == "www.example.com" );

    Postconditions

    this->has_port() == false && this->port_number() == 0 && this->port() == ""

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT

    Specification

  • 3.2.3. Port (rfc3986)
  • set_path

    Set the path.

    Synopsis

    url& set_path( string_view s);

    Declared in file <boost/url/url.hpp> at line 465

    Description

    This function sets the path to the string, which may be empty. Reserved characters in the string are percent-escaped in the result.

    NOTE

    The library may adjust the final result to ensure that no other parts of the url is semantically affected.

    NOTE

    This function does not encode '/' chars, which are unreserved for paths but reserved for path segments. If a path segment should include encoded '/'s to differentiate it from path separators, the functions set_encoded_path or segments should be used instead.

    Example

    url u( "http://www.example.com" ); u.set_path( "path/to/file.txt" ); assert( u.path() == "/path/to/file.txt" );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • set_encoded_path

    Set the path.

    Synopsis

    url& set_encoded_path( pct_string_view s);

    Declared in file <boost/url/url.hpp> at line 467

    Description

    This function sets the path to the string, which may contain percent-escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    NOTE

    The library may adjust the final result to ensure that no other parts of the url is semantically affected.

    Example

    url u( "http://www.example.com" ); u.set_encoded_path( "path/to/file.txt" ); assert( u.encoded_path() == "/path/to/file.txt" );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • set_query

    Set the query

    Synopsis

    url& set_query( string_view s);

    Declared in file <boost/url/url.hpp> at line 470

    Description

    This sets the query to the string, which can be empty. An empty query is distinct from having no query. Reserved characters in the string are percent-escaped in the result.

    Example

    assert( url( "http://example.com" ).set_query( "id=42" ).query() == "id=42" );

    Postconditions

    this->has_query() == true && this->query() == s

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • set_encoded_query

    Set the query

    Synopsis

    url& set_encoded_query( pct_string_view s);

    Declared in file <boost/url/url.hpp> at line 472

    Description

    This sets the query to the string, which may contain percent-escapes and can be empty. An empty query is distinct from having no query. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    Example

    assert( url( "http://example.com" ).set_encoded_query( "id=42" ).encoded_query() == "id=42" );

    Postconditions

    this->has_query() == true && this->query() == decode_view( s );

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • set_params

    Set the query params

    Synopsis

    url& set_params( initializer_list<param_view> ps);

    Declared in file <boost/url/url.hpp> at line 474

    Description

    This sets the query params to the list of param_view, which can be empty.

    An empty list of params is distinct from having no params.

    Reserved characters in the string are percent-escaped in the result.

    Example

    assert( url( "http://example.com" ).set_params( {"id", "42"} ).query() == "id=42" );

    Postconditions

    this->has_query() == true

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Complexity

    Linear.

    BNF

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

    Specification

  • ://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)
  • set_encoded_params

    Set the query params

    Synopsis

    url& set_encoded_params( initializer_list<param_pct_view> ps);

    Declared in file <boost/url/url.hpp> at line 476

    Description

    This sets the query params to the elements in the list, which may contain percent-escapes and can be empty.

    An empty list of params is distinct from having no query.

    Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    Example

    assert( url( "http://example.com" ).set_encoded_params( {"id", "42"} ).encoded_query() == "id=42" );

    Postconditions

    this->has_query() == true

    Complexity

    Linear.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • remove_query

    Remove the query

    Synopsis

    url& remove_query() noexcept;

    Declared in file <boost/url/url.hpp> at line 478

    Description

    If a query is present, it is removed. An empty query is distinct from having no query.

    Example

    assert( url( "http://www.example.com?id=42" ).remove_query().buffer() == "http://www.example.com" );

    Postconditions

    this->has_query() == false && this->params().empty()

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • remove_fragment

    Remove the fragment

    Synopsis

    url& remove_fragment() noexcept;

    Declared in file <boost/url/url.hpp> at line 481

    Description

    This function removes the fragment. An empty fragment is distinct from having no fragment.

    Example

    assert( url( "?first=john&last=doe#anchor" ).remove_fragment().buffer() == "?first=john&last=doe" );

    Postconditions

    this->has_fragment() == false && this->encoded_fragment() == ""

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    fragment = *( pchar / "/" / "?" )

    Specification

  • 3.5. Fragment
  • set_fragment

    Set the fragment.

    Synopsis

    url& set_fragment( string_view s);

    Declared in file <boost/url/url.hpp> at line 483

    Description

    This function sets the fragment to the specified string, which may be empty. An empty fragment is distinct from having no fragment. Reserved characters in the string are percent-escaped in the result.

    Example

    assert( url("?first=john&last=doe" ).set_encoded_fragment( "john doe" ).encoded_fragment() == "john%20doe" );

    Postconditions

    this->has_fragment() == true && this->fragment() == s

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    fragment = *( pchar / "/" / "?" )

    Specification

  • 3.5. Fragment
  • set_encoded_fragment

    Set the fragment.

    Synopsis

    url& set_encoded_fragment( pct_string_view s);

    Declared in file <boost/url/url.hpp> at line 485

    Description

    This function sets the fragment to the specified string, which may contain percent-escapes and which may be empty. An empty fragment is distinct from having no fragment. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    Example

    assert( url("?first=john&last=doe" ).set_encoded_fragment( "john%2Ddoe" ).fragment() == "john-doe" );

    Postconditions

    this->has_fragment() == true && this->fragment() == decode_view( s )

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    fragment = *( pchar / "/" / "?" )

    Specification

  • 3.5. Fragment
  • remove_origin

    Remove the origin component

    Synopsis

    url& remove_origin();

    Declared in file <boost/url/url.hpp> at line 488

    Description

    This function removes the origin, which consists of the scheme and authority.

    Example

    assert( url( "http://www.example.com/index.htm" ).remove_origin().buffer() == "/index.htm" );

    Postconditions

    this->scheme_id() == scheme::none && this->has_authority() == false

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    normalize

    Normalize the URL components

    Synopsis

    url& normalize();

    Declared in file <boost/url/url.hpp> at line 491

    Description

    Applies Syntax-based normalization to all components of the URL.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_scheme

    Normalize the URL scheme

    Synopsis

    url& normalize_scheme();

    Declared in file <boost/url/url.hpp> at line 493

    Description

    Applies Syntax-based normalization to the URL scheme.

    The scheme is normalized to lowercase.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_authority

    Normalize the URL authority

    Synopsis

    url& normalize_authority();

    Declared in file <boost/url/url.hpp> at line 495

    Description

    Applies Syntax-based normalization to the URL authority.

    Percent-encoding triplets are normalized to uppercase letters. Percent-encoded octets that correspond to unreserved characters are decoded.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_path

    Normalize the URL path

    Synopsis

    url& normalize_path();

    Declared in file <boost/url/url.hpp> at line 497

    Description

    Applies Syntax-based normalization to the URL path.

    Percent-encoding triplets are normalized to uppercase letters. Percent-encoded octets that correspond to unreserved characters are decoded. Redundant path-segments are removed.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_query

    Normalize the URL query

    Synopsis

    url& normalize_query();

    Declared in file <boost/url/url.hpp> at line 499

    Description

    Applies Syntax-based normalization to the URL query.

    Percent-encoding triplets are normalized to uppercase letters. Percent-encoded octets that correspond to unreserved characters are decoded.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_fragment

    Normalize the URL fragment

    Synopsis

    url& normalize_fragment();

    Declared in file <boost/url/url.hpp> at line 501

    Description

    Applies Syntax-based normalization to the URL fragment.

    Percent-encoding triplets are normalized to uppercase letters. Percent-encoded octets that correspond to unreserved characters are decoded.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • swap

    Swap

    Synopsis

    void swap( url& v0, url& v1) noexcept;

    Declared in file <boost/url/url.hpp> at line 396

    Description

    Exchanges the contents of `v0` with another `v1`. All views, iterators and references remain valid.

    If ` &v 0 == &v 1`, this function call has no effect.

    Example

    url u1( "https://www.example.com" ); url u2( "https://www.boost.org" ); std::swap(u1, u2); assert(u1 == "https://www.boost.org" ); assert(u2 == "https://www.example.com" );

    Effects

    v0.swap( v1 );

    Complexity

    Constant

    Exception Safety

    Throws nothing

    ipv4_address_rule_t

    Synopsis

    struct ipv4_address_rule_t ;

    Declared in file <boost/url/rfc/ipv4_address_rule.hpp> at line 58

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = ipv4_address ;

    Declared in file <boost/url/rfc/ipv4_address_rule.hpp> at line 60

    parse

    Synopsis

    result<ipv4_address> parse( const char*& it, const char* end) noexcept;

    Declared in file <src/rfc/ipv4_address_rule.cpp> at line 23

    ipv4_address_rule

    Synopsis

    const ipv4_address_rule_t ipv4_address_rule ;

    Declared in file <boost/url/rfc/ipv4_address_rule.hpp> at line 72

    ipv6_address_rule_t

    Synopsis

    struct ipv6_address_rule_t ;

    Declared in file <boost/url/rfc/ipv6_address_rule.hpp> at line 66

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = ipv6_address ;

    Declared in file <boost/url/rfc/ipv6_address_rule.hpp> at line 68

    parse

    Synopsis

    result<ipv6_address> parse( const char*& it, const char* end) noexcept;

    Declared in file <src/rfc/ipv6_address_rule.cpp> at line 52

    ipv6_address_rule

    Synopsis

    const ipv6_address_rule_t ipv6_address_rule ;

    Declared in file <boost/url/rfc/ipv6_address_rule.hpp> at line 80

    parse_absolute_uri

    Return a reference to a parsed URL string

    Synopsis

    result<url_view> parse_absolute_uri( string_view s);

    Declared in file <src/parse.cpp> at line 26

    Description

    This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed.

    Example

    system::result< url_view > rv = parse_absolute_uri( "http://example.com/index.htm?id=1" );

    BNF

    absolute-URI = scheme ":" hier-part [ "?" query ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty

    Specification

  • 4.3. Absolute URI (rfc3986)
  • parse_origin_form

    Return a reference to a parsed URL string

    Synopsis

    result<url_view> parse_origin_form( string_view s);

    Declared in file <src/parse.cpp> at line 34

    Description

    This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed.

    Example

    system::result< url_view > = parse_origin_form( "/index.htm?layout=mobile" );

    BNF

    origin-form = absolute-path [ "?" query ] absolute-path = 1*( "/" segment )

    Specification

  • 5.3.1. origin-form (rfc7230)
  • parse_relative_ref

    Return a reference to a parsed URL string

    Synopsis

    result<url_view> parse_relative_ref( string_view s);

    Declared in file <src/parse.cpp> at line 42

    Description

    This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed.

    Example

    system::result< url_view > = parse_relative_ref( "images/dot.gif?v=hide#a" );

    BNF

    relative-ref = relative-part [ "?" query ] [ "#" fragment ] relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-abempty / path-empty

    Specification

  • 4.2. Relative Reference (rfc3986)
  • Errata ID: 5428 (rfc3986)
  • parse_uri

    Return a reference to a parsed URL string

    Synopsis

    result<url_view> parse_uri( string_view s);

    Declared in file <src/parse.cpp> at line 49

    Description

    This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed.

    Example

    system::result< url_view > = parse_uri( "https://www.example.com/index.htm?id=guest#s1" );

    BNF

    URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty

    Specification

  • 3. Syntax Components (rfc3986)
  • parse_uri_reference

    Return a reference to a parsed URL string

    Synopsis

    result<url_view> parse_uri_reference( string_view s);

    Declared in file <src/parse.cpp> at line 57

    Description

    This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed.

    Example

    system::result< url_view > = parse_uri_reference( "ws://echo.example.com/?name=boost#demo" );

    BNF

    URI-reference = URI / relative-ref URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty relative-part = "//" authority path-abempty / path-absolute / path-noscheme / path-abempty / path-empty

    Specification

  • 4.1. URI Reference (rfc3986)
  • Errata ID: 5428 (rfc3986)
  • absolute_uri_rule_t

    Synopsis

    struct absolute_uri_rule_t ;

    Declared in file <boost/url/rfc/absolute_uri_rule.hpp> at line 55

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = url_view ;

    Declared in file <boost/url/rfc/absolute_uri_rule.hpp> at line 57

    parse

    Synopsis

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

    Declared in file <src/rfc/absolute_uri_rule.cpp> at line 27

    absolute_uri_rule

    Synopsis

    const absolute_uri_rule_t absolute_uri_rule ;

    Declared in file <boost/url/rfc/absolute_uri_rule.hpp> at line 68

    relative_ref_rule_t

    Synopsis

    struct relative_ref_rule_t ;

    Declared in file <boost/url/rfc/relative_ref_rule.hpp> at line 50

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = url_view ;

    Declared in file <boost/url/rfc/relative_ref_rule.hpp> at line 52

    parse

    Synopsis

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

    Declared in file <src/rfc/relative_ref_rule.cpp> at line 27

    relative_ref_rule

    Synopsis

    const relative_ref_rule_t relative_ref_rule ;

    Declared in file <boost/url/rfc/relative_ref_rule.hpp> at line 63

    uri_rule_t

    Synopsis

    struct uri_rule_t ;

    Declared in file <boost/url/rfc/uri_rule.hpp> at line 50

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = url_view ;

    Declared in file <boost/url/rfc/uri_rule.hpp> at line 52

    parse

    Synopsis

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

    Declared in file <src/rfc/uri_rule.cpp> at line 28

    uri_rule

    Synopsis

    const uri_rule_t uri_rule ;

    Declared in file <boost/url/rfc/uri_rule.hpp> at line 63

    uri_reference_rule_t

    Synopsis

    struct uri_reference_rule_t ;

    Declared in file <boost/url/rfc/uri_reference_rule.hpp> at line 53

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = url_view ;

    Declared in file <boost/url/rfc/uri_reference_rule.hpp> at line 55

    parse

    Synopsis

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

    Declared in file <src/rfc/uri_reference_rule.cpp> at line 24

    uri_reference_rule

    Synopsis

    const uri_reference_rule_t uri_reference_rule ;

    Declared in file <boost/url/rfc/uri_reference_rule.hpp> at line 66

    origin_form_rule_t

    Synopsis

    struct origin_form_rule_t ;

    Declared in file <boost/url/rfc/origin_form_rule.hpp> at line 53

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = url_view ;

    Declared in file <boost/url/rfc/origin_form_rule.hpp> at line 55

    parse

    Synopsis

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

    Declared in file <src/rfc/origin_form_rule.cpp> at line 25

    origin_form_rule

    Synopsis

    const origin_form_rule_t origin_form_rule ;

    Declared in file <boost/url/rfc/origin_form_rule.hpp> at line 66

    query_rule_t

    Synopsis

    struct query_rule_t ;

    Declared in file <boost/url/rfc/query_rule.hpp> at line 60

    Types

    Name Description
    value_type

    Member Functions

    Name Description
    parse

    value_type

    Synopsis

    using value_type = params_encoded_view ;

    Declared in file <boost/url/rfc/query_rule.hpp> at line 62

    parse

    Synopsis

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

    Declared in file <src/rfc/query_rule.cpp> at line 22

    query_rule

    Synopsis

    const query_rule_t query_rule ;

    Declared in file <boost/url/rfc/query_rule.hpp> at line 72

    static_url

    A modifiable container for a URL.

    Synopsis

    template< size_t Capacity> class static_url : public static_url_base;

    Declared in file <boost/url/static_url.hpp> at line 107

    Member Functions

    Name Description
    digest
    size

    Return the number of characters in the url

    empty

    Return true if the url is empty

    data

    Return a pointer to the url's character buffer

    buffer

    Return the url string

    operator string_view

    Return the URL as a core::string_view

    persist

    Return a shared, persistent copy of the url

    has_scheme

    Return true a scheme is present

    scheme

    Return the scheme

    scheme_id

    Return the scheme

    has_authority

    Return true if an authority is present

    authority

    Return the authority

    encoded_authority

    Return the authority.

    has_userinfo

    Return true if a userinfo is present

    has_password

    Return true if a password is present

    userinfo

    Return the userinfo

    encoded_userinfo

    Return the userinfo

    user

    Return the user

    encoded_user

    Return the user

    password

    Return the password

    encoded_password

    Return the password

    host_type

    Return the host type

    host

    Return the host

    encoded_host

    Return the host

    host_address

    Return the host

    encoded_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

    encoded_host_name

    Return the host name

    zone_id

    Return the IPv6 Zone ID

    encoded_zone_id

    Return the IPv6 Zone ID

    has_port

    Return true if a port is present

    port

    Return the port

    port_number

    Return the port

    is_path_absolute

    Return true if the path is absolute

    path

    Return the path

    encoded_path

    Return the path

    segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    has_query

    Return true if a query is present

    query

    Return the query

    encoded_query

    Return the query

    params

    Return the query as a container of parameters

    params
    encoded_params

    Return the query as a container of parameters

    has_fragment

    Return true if a fragment is present

    fragment

    Return the fragment

    encoded_fragment

    Return the fragment

    encoded_host_and_port

    Return the host and port

    encoded_origin

    Return the origin

    encoded_resource

    Return the resource

    encoded_target

    Return the target

    compare

    Return the result of comparing this with another url

    c_str

    Return the url as a null-terminated string

    capacity

    Return the number of characters that can be stored without reallocating

    clear

    Clear the contents while preserving the capacity

    reserve

    Adjust the capacity without changing the size

    set_scheme

    Set the scheme

    set_scheme_id
    remove_scheme

    Remove the scheme

    set_encoded_authority

    Set the authority

    remove_authority

    Remove the authority

    set_userinfo

    Set the userinfo

    set_encoded_userinfo

    Set the userinfo.

    remove_userinfo

    Remove the userinfo

    set_user

    Set the user

    set_encoded_user

    Set the user

    set_password

    Set the password.

    set_encoded_password

    Set the password.

    remove_password

    Remove the password

    set_host

    Set the host

    set_encoded_host

    Set the host

    set_host_address

    Set the host to an address

    set_encoded_host_address

    Set the host to an address

    set_host_ipv4

    Set the host to an address

    set_host_ipv6

    Set the host to an address

    set_host_ipvfuture

    Set the host to an address

    set_host_name

    Set the host to a name

    set_encoded_host_name

    Set the host to a name

    set_port_number

    Set the port

    set_port

    Set the port

    remove_port

    Remove the port

    set_path_absolute

    Set if the path is absolute

    set_path

    Set the path.

    set_encoded_path

    Set the path.

    segments

    Return the path as a container of segments

    segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    set_query

    Set the query

    set_encoded_query

    Set the query

    params

    Return the query as a container of parameters

    params

    url_view_base::params

    params

    Return the query as a container of parameters

    encoded_params

    Return the query as a container of parameters

    encoded_params

    Return the query as a container of parameters

    set_params

    Set the query params

    set_encoded_params

    Set the query params

    remove_query

    Remove the query

    remove_fragment

    Remove the fragment

    set_fragment

    Set the fragment.

    set_encoded_fragment

    Set the fragment.

    remove_origin

    Remove the origin component

    normalize

    Normalize the URL components

    normalize_scheme

    Normalize the URL scheme

    normalize_authority

    Normalize the URL authority

    normalize_path

    Normalize the URL path

    normalize_query

    Normalize the URL query

    normalize_fragment

    Normalize the URL fragment

    resolve

    Resolve a URL reference against this base URL

    ~static_url

    Destructor

    static_url

    Constructor

    static_url

    Constructor

    static_url

    Constructor

    static_url

    Constructor

    operator=

    Assignment

    operator=

    Assignment

    set_scheme

    Set the scheme

    set_scheme_id

    url_base::set_scheme_id

    remove_scheme

    Remove the scheme

    set_encoded_authority

    Set the authority

    remove_authority

    Remove the authority

    set_userinfo

    Set the userinfo

    set_encoded_userinfo

    Set the userinfo.

    remove_userinfo

    Remove the userinfo

    set_user

    Set the user

    set_encoded_user

    Set the user

    set_password

    Set the password.

    set_encoded_password

    Set the password.

    remove_password

    Remove the password

    set_host

    Set the host

    set_encoded_host

    Set the host

    set_host_address

    Set the host to an address

    set_encoded_host_address

    Set the host to an address

    set_host_ipv4

    Set the host to an address

    set_host_ipv6

    Set the host to an address

    set_host_ipvfuture

    Set the host to an address

    set_host_name

    Set the host to a name

    set_encoded_host_name

    Set the host to a name

    set_port_number

    Set the port

    set_port

    Set the port

    remove_port

    Remove the port

    set_path

    Set the path.

    set_encoded_path

    Set the path.

    set_query

    Set the query

    set_encoded_query

    Set the query

    remove_query

    Remove the query

    remove_fragment

    Remove the fragment

    set_fragment

    Set the fragment.

    set_encoded_fragment

    Set the fragment.

    remove_origin

    Remove the origin component

    normalize

    Normalize the URL components

    normalize_scheme

    Normalize the URL scheme

    normalize_authority

    Normalize the URL authority

    normalize_path

    Normalize the URL path

    normalize_query

    Normalize the URL query

    normalize_fragment

    Normalize the URL fragment

    Description

    This container owns a url, represented by an inline, null-terminated character buffer with fixed capacity. The contents may be inspected and modified, and the implementation maintains a useful invariant: changes to the url always leave it in a valid state.

    Example

    static_url< 1024 > u( "https://www.example.com" );

    Invariants

    this->capacity() == Capacity

    ~static_url

    Destructor

    Synopsis

    void ~static_url();

    Declared in file <boost/url/static_url.hpp> at line 130

    Description

    Any params, segments, iterators, or views which reference this object are invalidated. The underlying character buffer is destroyed, invalidating all references to it.

    static_url

    Constructor

    Synopsis

    void static_url() noexcept;

    Declared in file <boost/url/static_url.hpp> at line 165

    Description

    Default constructed urls contain a zero-length string. This matches the grammar for a relative-ref with an empty path and no query or fragment.

    Example

    static_url< 1024 > u;

    Postconditions

    this->empty() == true

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

    4.2. Relative Reference (rfc3986)

    static_url

    Constructor

    Synopsis

    void static_url( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 217

    Description

    This function constructs a url from the string `s`, which must contain a valid URI or relative-ref or else an exception is thrown. The new url retains ownership by making a copy of the passed string.

    Example

    static_url< 1024 > u( "https://www.example.com" );

    Effects

    return static_url( parse_uri_reference( s ).value() );

    Postconditions

    this->buffer().data() != s.data()

    Complexity

    Linear in `s.size()`.

    Exception Safety

    Exceptions thrown on invalid input.

    BNF

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

    Specification

  • 4.1. URI Reference
  • static_url

    Constructor

    Synopsis

    void static_url( const static_url& u) noexcept;

    Declared in file <boost/url/static_url.hpp> at line 243

    Description

    The newly constructed object contains a copy of `u`.

    Postconditions

    this->buffer() == u.buffer() && this->buffer.data() != u.buffer().data()

    Complexity

    Linear in `u.size()`.

    Exception Safety

    Exception thrown if maximum size exceeded.

    static_url

    Constructor

    Synopsis

    void static_url( const url_view_base& u);

    Declared in file <boost/url/static_url.hpp> at line 271

    Description

    The newly constructed object contains a copy of `u`.

    Postconditions

    this->buffer() == u.buffer() && this->buffer.data() != u.buffer().data()

    Complexity

    Linear in `u.size()`.

    Exception Safety

    Exception thrown if capacity exceeded.

    operator=

    Assignment

    Synopsis

    static_url& operator=( const static_url& u) noexcept;

    Declared in file <boost/url/static_url.hpp> at line 298

    Description

    The contents of `u` are copied and the previous contents of `this` are discarded. Capacity remains unchanged.

    Postconditions

    this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data()

    Complexity

    Linear in `u.size()`.

    Exception Safety

    Throws nothing.

    operator=

    Assignment

    Synopsis

    static_url& operator=( const url_view_base& u);

    Declared in file <boost/url/static_url.hpp> at line 330

    Description

    The contents of `u` are copied and the previous contents of `this` are discarded.

    Postconditions

    this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data()

    Complexity

    Linear in `u.size()`.

    Exception Safety

    Strong guarantee. Exception thrown if capacity exceeded.

    set_scheme

    Set the scheme

    Synopsis

    static_url& set_scheme( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 345

    Description

    The scheme is set to the specified string, which must contain a valid scheme without any trailing colon (':'). Note that schemes are case-insensitive, and the canonical form is lowercased.

    Example

    assert( url( "http://www.example.com" ).set_scheme( "https" ).scheme_id() == scheme::https );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

    Specification

  • 3.1. Scheme (rfc3986)
  • set_scheme_id

    url_base::set_scheme_id

    Synopsis

    static_url& set_scheme_id( scheme id);

    Declared in file <boost/url/static_url.hpp> at line 347

    remove_scheme

    Remove the scheme

    Synopsis

    static_url& remove_scheme();

    Declared in file <boost/url/static_url.hpp> at line 349

    Description

    This function removes the scheme if it is present.

    Example

    assert( url("http://www.example.com/index.htm" ).remove_scheme().buffer() == "//www.example.com/index.htm" );

    Postconditions

    this->has_scheme() == false && this->scheme_id() == scheme::none

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • 3.1. Scheme (rfc3986)
  • set_encoded_authority

    Set the authority

    Synopsis

    static_url& set_encoded_authority( pct_string_view s);

    Declared in file <boost/url/static_url.hpp> at line 352

    Description

    This function sets the authority to the specified string. The string may contain percent-escapes.

    Example

    assert( url().set_encoded_authority( "My%20Computer" ).has_authority() );

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT

    Specification

  • 3.2. Authority (rfc3986)
  • remove_authority

    Remove the authority

    Synopsis

    static_url& remove_authority();

    Declared in file <boost/url/static_url.hpp> at line 354

    Description

    This function removes the authority, which includes the userinfo, host, and a port if present.

    Example

    assert( url( "http://example.com/echo.cgi" ).remove_authority().buffer() == "http:/echo.cgi" );

    Postconditions

    this->has_authority() == false && this->has_userinfo() == false && this->has_port() == false

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) host = IP-literal / IPv4address / reg-name port = *DIGIT

    Specification

  • 3.2. Authority (rfc3986)
  • set_userinfo

    Set the userinfo

    Synopsis

    static_url& set_userinfo( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 357

    Description

    The userinfo is set to the given string, which may contain percent-escapes. Any special or reserved characters in the string are automatically percent-encoded. The effects on the user and password depend on the presence of a colon (':') in the string:

  • If an unescaped colon exists, the characters up to the colon become the user and the rest of the characters after the colon become the password. In this case has_password returns true. Otherwise,
  • If there is no colon, the user is set to the string. The function has_password returns false.
  • NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url( "http://example.com" ).set_userinfo( "user:pass" ).encoded_user() == "user" );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_encoded_userinfo

    Set the userinfo.

    Synopsis

    static_url& set_encoded_userinfo( pct_string_view s);

    Declared in file <boost/url/static_url.hpp> at line 359

    Description

    The userinfo is set to the given string, which may contain percent-escapes. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The effects on the user and password depend on the presence of a colon (':') in the string:

  • If an unescaped colon exists, the characters up to the colon become the user and the rest of the characters after the colon become the password. In this case has_password returns true. Otherwise,
  • If there is no colon, the user is set to the string. The function has_password returns false.
  • NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • remove_userinfo

    Remove the userinfo

    Synopsis

    static_url& remove_userinfo() noexcept;

    Declared in file <boost/url/static_url.hpp> at line 361

    Description

    This function removes the userinfo if present, without removing any authority.

    Example

    assert( url( "http://user@example.com" ).remove_userinfo().has_userinfo() == false );

    Postconditions

    this->has_userinfo() == false && this->encoded_userinfo().empty == true

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_user

    Set the user

    Synopsis

    static_url& set_user( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 363

    Description

    This function sets the user part of the userinfo to the string. Any special or reserved characters in the string are automatically percent-encoded.

    Example

    assert( url().set_user("john doe").encoded_userinfo() == "john%20doe" );

    Postconditions

    this->has_authority() == true && this->has_userinfo() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_encoded_user

    Set the user

    Synopsis

    static_url& set_encoded_user( pct_string_view s);

    Declared in file <boost/url/static_url.hpp> at line 365

    Description

    This function sets the user part of the userinfo the the string, which may contain percent-escapes. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    Example

    assert( url().set_encoded_user("john%20doe").userinfo() == "john doe" );

    Postconditions

    this->has_authority() == true && this->has_userinfo() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_password

    Set the password.

    Synopsis

    static_url& set_password( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 367

    Description

    This function sets the password in the userinfo to the string. Reserved characters in the string are percent-escaped in the result.

    NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url("http://user@example.com").set_password( "pass" ).encoded_userinfo() == "user:pass" );

    Postconditions

    this->has_password() == true && this->password() == s

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_encoded_password

    Set the password.

    Synopsis

    static_url& set_encoded_password( pct_string_view s);

    Declared in file <boost/url/static_url.hpp> at line 369

    Description

    This function sets the password in the userinfo to the string, which may contain percent-escapes. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url("http://user@example.com").set_encoded_password( "pass" ).encoded_userinfo() == "user:pass" );

    Postconditions

    this->has_password() == true

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • remove_password

    Remove the password

    Synopsis

    static_url& remove_password() noexcept;

    Declared in file <boost/url/static_url.hpp> at line 371

    Description

    This function removes the password from the userinfo if a password exists. If there is no userinfo or no authority, the call has no effect.

    NOTE

    The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.

    Example

    assert( url( "http://user:pass@example.com" ).remove_password().authority().buffer() == "user@example.com" );

    Postconditions

    this->has_password() == false && this->encoded_password().empty() == true

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

    userinfo = [ [ user ] [ ':' password ] ] user = *( unreserved / pct-encoded / sub-delims ) password = *( unreserved / pct-encoded / sub-delims / ":" )

    Specification

  • 3.2.1. User Information (rfc3986)
  • set_host

    Set the host

    Synopsis

    static_url& set_host( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 374

    Description

    Depending on the contents of the passed string, this function sets the host:

  • If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4.
  • If the string is a valid IPv6 address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipv6.
  • If the string is a valid IPvFuture address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipvfuture.
  • Otherwise, the host name is set to the string, which may be empty. Reserved characters in the string are percent-escaped in the result. The host type is host_type::name.
  • In all cases, when this function returns, the URL contains an authority.

    Example

    assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );

    Postconditions

    this->has_authority() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • IPv4 (Wikipedia)
  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_encoded_host

    Set the host

    Synopsis

    static_url& set_encoded_host( pct_string_view s);

    Declared in file <boost/url/static_url.hpp> at line 376

    Description

    Depending on the contents of the passed string, this function sets the host:

  • If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4.
  • If the string is a valid IPv6 address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipv6.
  • If the string is a valid IPvFuture address enclosed in square brackets, then the host is set to that address. The host type is host_type::ipvfuture.
  • Otherwise, the host name is set to the string. This string can contain percent escapes, or can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The host type is host_type::name.
  • In all cases, when this function returns, the URL contains an authority.

    Example

    assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );

    Postconditions

    this->has_authority() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • IPv4 (Wikipedia)
  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_host_address

    Set the host to an address

    Synopsis

    static_url& set_host_address( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 378

    Description

    Depending on the contents of the passed string, this function sets the host:

  • If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4.
  • If the string is a valid IPv6 address, then the host is set to that address. The host type is host_type::ipv6.
  • If the string is a valid IPvFuture, then the host is set to that address. The host type is host_type::ipvfuture.
  • Otherwise, the host name is set to the string, which may be empty. Reserved characters in the string are percent-escaped in the result. The host type is host_type::name.
  • In all cases, when this function returns, the URL contains an authority.

    Example

    assert( url( "http://www.example.com" ).set_host_address( "127.0.0.1" ).buffer() == "http://127.0.0.1" );

    Postconditions

    this->has_authority() == true

    Complexity

    Linear in `s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    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 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 IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • IPv4 (Wikipedia)
  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_encoded_host_address

    Set the host to an address

    Synopsis

    static_url& set_encoded_host_address( pct_string_view s);

    Declared in file <boost/url/static_url.hpp> at line 380

    Description

    Depending on the contents of the passed string, this function sets the host:

  • If the string is a valid IPv4 address, then the host is set to the address. The host type is host_type::ipv4.
  • If the string is a valid IPv6 address, then the host is set to that address. The host type is host_type::ipv6.
  • If the string is a valid IPvFuture, then the host is set to that address. The host type is host_type::ipvfuture.
  • Otherwise, the host name is set to the string. This string can contain percent escapes, or can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The host type is host_type::name.
  • In all cases, when this function returns, the URL contains an authority.

    Example

    assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );

    Postconditions

    this->has_authority() == true

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    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 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 IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • IPv4 (Wikipedia)
  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_host_ipv4

    Set the host to an address

    Synopsis

    static_url& set_host_ipv4( const ipv4_address& addr);

    Declared in file <boost/url/static_url.hpp> at line 382

    Description

    The host is set to the specified IPv4 address. The host type is host_type::ipv4.

    Example

    assert( url("http://www.example.com").set_host_ipv4( ipv4_address( "127.0.0.1" ) ).buffer() == "http://127.0.0.1" );

    Complexity

    Linear in `this->size()`.

    Postconditions

    this->has_authority() == true && this->host_ipv4_address() == addr && this->host_type() == host_type::ipv4

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    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

  • IPv4 (Wikipedia)
  • 3.2.2. Host (rfc3986)
  • set_host_ipv6

    Set the host to an address

    Synopsis

    static_url& set_host_ipv6( const ipv6_address& addr);

    Declared in file <boost/url/static_url.hpp> at line 384

    Description

    The host is set to the specified IPv6 address. The host type is host_type::ipv6.

    Example

    assert( url().set_host_ipv6( ipv6_address( "1::6:c0a8:1" ) ).authority().buffer() == "[1::6:c0a8:1]" );

    Postconditions

    this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::ipv6

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    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

  • IP Version 6 Addressing Architecture (rfc4291)
  • 3.2.2. Host (rfc3986)
  • set_host_ipvfuture

    Set the host to an address

    Synopsis

    static_url& set_host_ipvfuture( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 386

    Description

    The host is set to the specified IPvFuture string. The host type is host_type::ipvfuture.

    Example

    assert( url().set_host_ipvfuture( "v42.bis" ).buffer() == "//[v42.bis]" );

    Complexity

    Linear in `this->size() + s.size()`.

    Postconditions

    this->has_authority() == true && this->host_ipvfuture) == s && this->host_type() == host_type::ipvfuture

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )

    Specification

  • 3.2.2. Host (rfc3986)
  • set_host_name

    Set the host to a name

    Synopsis

    static_url& set_host_name( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 388

    Description

    The host is set to the specified string, which may be empty. Reserved characters in the string are percent-escaped in the result. The host type is host_type::name.

    Example

    assert( url( "http://www.example.com/index.htm").set_host_name( "localhost" ).host_address() == "localhost" );

    Postconditions

    this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • 3.2.2. Host (rfc3986)
  • set_encoded_host_name

    Set the host to a name

    Synopsis

    static_url& set_encoded_host_name( pct_string_view s);

    Declared in file <boost/url/static_url.hpp> at line 390

    Description

    The host is set to the specified string, which may contain percent-escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result. The host type is host_type::name.

    Example

    assert( url( "http://www.example.com/index.htm").set_encoded_host_name( "localhost" ).host_address() == "localhost" );

    Postconditions

    this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    reg-name = *( unreserved / pct-encoded / "-" / ".")

    Specification

  • 3.2.2. Host (rfc3986)
  • set_port_number

    Set the port

    Synopsis

    static_url& set_port_number( uint16_t n);

    Declared in file <boost/url/static_url.hpp> at line 392

    Description

    The port is set to the specified integer.

    Example

    assert( url( "http://www.example.com" ).set_port_number( 8080 ).authority().buffer() == "www.example.com:8080" );

    Postconditions

    this->has_authority() == true && this->has_port() == true && this->port_number() == n

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT

    Specification

  • 3.2.3. Port (rfc3986)
  • set_port

    Set the port

    Synopsis

    static_url& set_port( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 394

    Description

    This port is set to the string, which must contain only digits or be empty. An empty port string is distinct from having no port.

    Example

    assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" );

    Postconditions

    this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n)

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    port = *DIGIT

    Specification

  • 3.2.3. Port (rfc3986)
  • remove_port

    Remove the port

    Synopsis

    static_url& remove_port() noexcept;

    Declared in file <boost/url/static_url.hpp> at line 396

    Description

    If a port exists, it is removed. The rest of the authority is unchanged.

    Example

    assert( url( "http://www.example.com:80" ).remove_port().authority().buffer() == "www.example.com" );

    Postconditions

    this->has_port() == false && this->port_number() == 0 && this->port() == ""

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    BNF

    authority = [ userinfo "@" ] host [ ":" port ] port = *DIGIT

    Specification

  • 3.2.3. Port (rfc3986)
  • set_path

    Set the path.

    Synopsis

    static_url& set_path( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 401

    Description

    This function sets the path to the string, which may be empty. Reserved characters in the string are percent-escaped in the result.

    NOTE

    The library may adjust the final result to ensure that no other parts of the url is semantically affected.

    NOTE

    This function does not encode '/' chars, which are unreserved for paths but reserved for path segments. If a path segment should include encoded '/'s to differentiate it from path separators, the functions set_encoded_path or segments should be used instead.

    Example

    url u( "http://www.example.com" ); u.set_path( "path/to/file.txt" ); assert( u.path() == "/path/to/file.txt" );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • set_encoded_path

    Set the path.

    Synopsis

    static_url& set_encoded_path( pct_string_view s);

    Declared in file <boost/url/static_url.hpp> at line 403

    Description

    This function sets the path to the string, which may contain percent-escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    NOTE

    The library may adjust the final result to ensure that no other parts of the url is semantically affected.

    Example

    url u( "http://www.example.com" ); u.set_encoded_path( "path/to/file.txt" ); assert( u.encoded_path() == "/path/to/file.txt" );

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    path = path-abempty ; begins with "/" or is empty / path-absolute ; begins with "/" but not "//" / path-noscheme ; begins with a non-colon segment / path-rootless ; begins with a segment / path-empty ; zero characters path-abempty = *( "/" segment ) path-absolute = "/" [ segment-nz *( "/" segment ) ] path-noscheme = segment-nz-nc *( "/" segment ) path-rootless = segment-nz *( "/" segment ) path-empty = 0

    Specification

  • 3.3. Path (rfc3986)
  • set_query

    Set the query

    Synopsis

    static_url& set_query( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 406

    Description

    This sets the query to the string, which can be empty. An empty query is distinct from having no query. Reserved characters in the string are percent-escaped in the result.

    Example

    assert( url( "http://example.com" ).set_query( "id=42" ).query() == "id=42" );

    Postconditions

    this->has_query() == true && this->query() == s

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • set_encoded_query

    Set the query

    Synopsis

    static_url& set_encoded_query( pct_string_view s);

    Declared in file <boost/url/static_url.hpp> at line 408

    Description

    This sets the query to the string, which may contain percent-escapes and can be empty. An empty query is distinct from having no query. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    Example

    assert( url( "http://example.com" ).set_encoded_query( "id=42" ).encoded_query() == "id=42" );

    Postconditions

    this->has_query() == true && this->query() == decode_view( s );

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • remove_query

    Remove the query

    Synopsis

    static_url& remove_query() noexcept;

    Declared in file <boost/url/static_url.hpp> at line 410

    Description

    If a query is present, it is removed. An empty query is distinct from having no query.

    Example

    assert( url( "http://www.example.com?id=42" ).remove_query().buffer() == "http://www.example.com" );

    Postconditions

    this->has_query() == false && this->params().empty()

    Exception Safety

    Throws nothing.

    BNF

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

    Specification

  • 3.4. Query (rfc3986)
  • Query string (Wikipedia)
  • remove_fragment

    Remove the fragment

    Synopsis

    static_url& remove_fragment() noexcept;

    Declared in file <boost/url/static_url.hpp> at line 413

    Description

    This function removes the fragment. An empty fragment is distinct from having no fragment.

    Example

    assert( url( "?first=john&last=doe#anchor" ).remove_fragment().buffer() == "?first=john&last=doe" );

    Postconditions

    this->has_fragment() == false && this->encoded_fragment() == ""

    Complexity

    Constant.

    Exception Safety

    Throws nothing.

    BNF

    fragment = *( pchar / "/" / "?" )

    Specification

  • 3.5. Fragment
  • set_fragment

    Set the fragment.

    Synopsis

    static_url& set_fragment( string_view s);

    Declared in file <boost/url/static_url.hpp> at line 415

    Description

    This function sets the fragment to the specified string, which may be empty. An empty fragment is distinct from having no fragment. Reserved characters in the string are percent-escaped in the result.

    Example

    assert( url("?first=john&last=doe" ).set_encoded_fragment( "john doe" ).encoded_fragment() == "john%20doe" );

    Postconditions

    this->has_fragment() == true && this->fragment() == s

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    BNF

    fragment = *( pchar / "/" / "?" )

    Specification

  • 3.5. Fragment
  • set_encoded_fragment

    Set the fragment.

    Synopsis

    static_url& set_encoded_fragment( pct_string_view s);

    Declared in file <boost/url/static_url.hpp> at line 417

    Description

    This function sets the fragment to the specified string, which may contain percent-escapes and which may be empty. An empty fragment is distinct from having no fragment. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

    Example

    assert( url("?first=john&last=doe" ).set_encoded_fragment( "john%2Ddoe" ).fragment() == "john-doe" );

    Postconditions

    this->has_fragment() == true && this->fragment() == decode_view( s )

    Complexity

    Linear in `this->size() + s.size()`.

    Exception Safety

    Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

    BNF

    fragment = *( pchar / "/" / "?" )

    Specification

  • 3.5. Fragment
  • remove_origin

    Remove the origin component

    Synopsis

    static_url& remove_origin();

    Declared in file <boost/url/static_url.hpp> at line 420

    Description

    This function removes the origin, which consists of the scheme and authority.

    Example

    assert( url( "http://www.example.com/index.htm" ).remove_origin().buffer() == "/index.htm" );

    Postconditions

    this->scheme_id() == scheme::none && this->has_authority() == false

    Complexity

    Linear in `this->size()`.

    Exception Safety

    Throws nothing.

    normalize

    Normalize the URL components

    Synopsis

    static_url& normalize();

    Declared in file <boost/url/static_url.hpp> at line 423

    Description

    Applies Syntax-based normalization to all components of the URL.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_scheme

    Normalize the URL scheme

    Synopsis

    static_url& normalize_scheme();

    Declared in file <boost/url/static_url.hpp> at line 425

    Description

    Applies Syntax-based normalization to the URL scheme.

    The scheme is normalized to lowercase.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_authority

    Normalize the URL authority

    Synopsis

    static_url& normalize_authority();

    Declared in file <boost/url/static_url.hpp> at line 427

    Description

    Applies Syntax-based normalization to the URL authority.

    Percent-encoding triplets are normalized to uppercase letters. Percent-encoded octets that correspond to unreserved characters are decoded.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_path

    Normalize the URL path

    Synopsis

    static_url& normalize_path();

    Declared in file <boost/url/static_url.hpp> at line 429

    Description

    Applies Syntax-based normalization to the URL path.

    Percent-encoding triplets are normalized to uppercase letters. Percent-encoded octets that correspond to unreserved characters are decoded. Redundant path-segments are removed.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_query

    Normalize the URL query

    Synopsis

    static_url& normalize_query();

    Declared in file <boost/url/static_url.hpp> at line 431

    Description

    Applies Syntax-based normalization to the URL query.

    Percent-encoding triplets are normalized to uppercase letters. Percent-encoded octets that correspond to unreserved characters are decoded.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • normalize_fragment

    Normalize the URL fragment

    Synopsis

    static_url& normalize_fragment();

    Declared in file <boost/url/static_url.hpp> at line 433

    Description

    Applies Syntax-based normalization to the URL fragment.

    Percent-encoding triplets are normalized to uppercase letters. Percent-encoded octets that correspond to unreserved characters are decoded.

    Exception Safety

    Strong guarantee. Calls to allocate may throw.

    Specification

  • 6.2.2 Syntax-Based Normalization (rfc3986)
  • static_url_base

    Common implementation for all static URLs

    Synopsis

    class static_url_base : public url_base;

    Declared in file <boost/url/static_url.hpp> at line 52

    Member Functions

    Name Description
    digest
    size

    Return the number of characters in the url

    empty

    Return true if the url is empty

    data

    Return a pointer to the url's character buffer

    buffer

    Return the url string

    operator string_view

    Return the URL as a core::string_view

    persist

    Return a shared, persistent copy of the url

    has_scheme

    Return true a scheme is present

    scheme

    Return the scheme

    scheme_id

    Return the scheme

    has_authority

    Return true if an authority is present

    authority

    Return the authority

    encoded_authority

    Return the authority.

    has_userinfo

    Return true if a userinfo is present

    has_password

    Return true if a password is present

    userinfo

    Return the userinfo

    encoded_userinfo

    Return the userinfo

    user

    Return the user

    encoded_user

    Return the user

    password

    Return the password

    encoded_password

    Return the password

    host_type

    Return the host type

    host

    Return the host

    encoded_host

    Return the host

    host_address

    Return the host

    encoded_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

    encoded_host_name

    Return the host name

    zone_id

    Return the IPv6 Zone ID

    encoded_zone_id

    Return the IPv6 Zone ID

    has_port

    Return true if a port is present

    port

    Return the port

    port_number

    Return the port

    is_path_absolute

    Return true if the path is absolute

    path

    Return the path

    encoded_path

    Return the path

    segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    has_query

    Return true if a query is present

    query

    Return the query

    encoded_query

    Return the query

    params

    Return the query as a container of parameters

    params
    encoded_params

    Return the query as a container of parameters

    has_fragment

    Return true if a fragment is present

    fragment

    Return the fragment

    encoded_fragment

    Return the fragment

    encoded_host_and_port

    Return the host and port

    encoded_origin

    Return the origin

    encoded_resource

    Return the resource

    encoded_target

    Return the target

    compare

    Return the result of comparing this with another url

    c_str

    Return the url as a null-terminated string

    capacity

    Return the number of characters that can be stored without reallocating

    clear

    Clear the contents while preserving the capacity

    reserve

    Adjust the capacity without changing the size

    set_scheme

    Set the scheme

    set_scheme_id
    remove_scheme

    Remove the scheme

    set_encoded_authority

    Set the authority

    remove_authority

    Remove the authority

    set_userinfo

    Set the userinfo

    set_encoded_userinfo

    Set the userinfo.

    remove_userinfo

    Remove the userinfo

    set_user

    Set the user

    set_encoded_user

    Set the user

    set_password

    Set the password.

    set_encoded_password

    Set the password.

    remove_password

    Remove the password

    set_host

    Set the host

    set_encoded_host

    Set the host

    set_host_address

    Set the host to an address

    set_encoded_host_address

    Set the host to an address

    set_host_ipv4

    Set the host to an address

    set_host_ipv6

    Set the host to an address

    set_host_ipvfuture

    Set the host to an address

    set_host_name

    Set the host to a name

    set_encoded_host_name

    Set the host to a name

    set_port_number

    Set the port

    set_port

    Set the port

    remove_port

    Remove the port

    set_path_absolute

    Set if the path is absolute

    set_path

    Set the path.

    set_encoded_path

    Set the path.

    segments

    Return the path as a container of segments

    segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    encoded_segments

    Return the path as a container of segments

    set_query

    Set the query

    set_encoded_query

    Set the query

    params

    Return the query as a container of parameters

    params

    url_view_base::params

    params

    Return the query as a container of parameters

    encoded_params

    Return the query as a container of parameters

    encoded_params

    Return the query as a container of parameters

    set_params

    Set the query params

    set_encoded_params

    Set the query params

    remove_query

    Remove the query

    remove_fragment

    Remove the fragment

    set_fragment

    Set the fragment.

    set_encoded_fragment

    Set the fragment.

    remove_origin

    Remove the origin component

    normalize

    Normalize the URL components

    normalize_scheme

    Normalize the URL scheme

    normalize_authority

    Normalize the URL authority

    normalize_path

    Normalize the URL path

    normalize_query

    Normalize the URL query

    normalize_fragment

    Normalize the URL fragment

    resolve

    Resolve a URL reference against this base URL

    Description

    This base class is used by the library to provide common functionality for static URLs. Users should not use this class directly. Instead, construct an instance of one of the containers or call a parsing function.

    Containers

  • url
  • url_view
  • static_url
  • Parsing Functions

  • parse_absolute_uri
  • parse_origin_form
  • parse_relative_ref
  • parse_uri
  • parse_uri_reference
  • Namespace system

    Name Description
    is_error_code_enum
    is_error_code_enum
    is_error_condition_enum

    is_error_code_enum

    Synopsis

    template<> struct is_error_code_enum<error> ;

    Declared in file <boost/url/impl/error.hpp> at line 20

    value

    Synopsis

    const bool value ;

    Declared in file <boost/url/impl/error.hpp> at line 22

    is_error_code_enum

    Synopsis

    template<> struct is_error_code_enum<error> ;

    Declared in file <boost/url/grammar/impl/error.hpp> at line 18

    value

    Synopsis

    const bool value ;

    Declared in file <boost/url/grammar/impl/error.hpp> at line 21

    is_error_condition_enum

    Synopsis

    template<> struct is_error_condition_enum<condition> ;

    Declared in file <boost/url/grammar/impl/error.hpp> at line 24

    value

    Synopsis

    const bool value ;

    Declared in file <boost/url/grammar/impl/error.hpp> at line 27

    Namespace std

    Name Description
    is_nothrow_copy_constructible
    integral_constant
    false_type
    __is_nothrow_constructible_impl
    true_type
    hash
    hash
    hash

    is_nothrow_copy_constructible

    Synopsis

    struct is_nothrow_copy_constructible : __is_nothrow_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>;

    Declared in file <type_traits> at line 1131

    integral_constant

    Synopsis

    struct integral_constant ;

    Declared in file <type_traits> at line 62

    Types

    Name Description
    value_type
    type

    Member Functions

    Name Description
    operator value_type
    operator()

    value

    Synopsis

    const _Tp value ;

    Declared in file <type_traits> at line 64

    value_type

    Synopsis

    typedef _Tp value_type ;

    Declared in file <type_traits> at line 65

    type

    Synopsis

    typedef integral_constant<_Tp, __v> type ;

    Declared in file <type_traits> at line 66

    operator value_type

    Synopsis

    value_type operator value_type() noexcept;

    Declared in file <type_traits> at line 67

    operator()

    Synopsis

    value_type operator()() noexcept;

    Declared in file <type_traits> at line 72

    false_type

    Synopsis

    using false_type = integral_constant<bool, false> ;

    Declared in file <type_traits> at line 85

    __is_nothrow_constructible_impl

    Synopsis

    template< typename _Tp, typename... _Args> using __is_nothrow_constructible_impl = __bool_constant<__is_nothrow_constructible(_Tp, _Args...)> ;

    Declared in file <type_traits> at line 1107

    true_type

    Synopsis

    using true_type = integral_constant<bool, true> ;

    Declared in file <type_traits> at line 82

    hash

    Synopsis

    template<> struct hash<url> ;

    Declared in file <boost/url/url.hpp> at line 523

    Member Functions

    Name Description
    hash
    hash
    operator=
    hash
    operator()

    hash

    Synopsis

    void hash();

    Declared in file <boost/url/url.hpp> at line 525

    hash

    Synopsis

    void hash( const hash<url>&);

    Declared in file <boost/url/url.hpp> at line 526

    operator=

    Synopsis

    hash<url>& operator=( const hash<url>&);

    Declared in file <boost/url/url.hpp> at line 527

    hash

    Synopsis

    void hash( size_t salt) noexcept;

    Declared in file <boost/url/url.hpp> at line 529

    operator()

    Synopsis

    size_t operator()( const url& u) noexcept;

    Declared in file <boost/url/url.hpp> at line 535

    hash

    Synopsis

    template<> struct hash<url_view> ;

    Declared in file <boost/url/url_view.hpp> at line 349

    Member Functions

    Name Description
    hash
    hash
    operator=
    hash
    operator()

    hash

    Synopsis

    void hash();

    Declared in file <boost/url/url_view.hpp> at line 351

    hash

    Synopsis

    void hash( const hash<url_view>&);

    Declared in file <boost/url/url_view.hpp> at line 352

    operator=

    Synopsis

    hash<url_view>& operator=( const hash<url_view>&);

    Declared in file <boost/url/url_view.hpp> at line 353

    hash

    Synopsis

    void hash( size_t salt) noexcept;

    Declared in file <boost/url/url_view.hpp> at line 355

    operator()

    Synopsis

    size_t operator()( const url_view& u) noexcept;

    Declared in file <boost/url/url_view.hpp> at line 361

    hash

    Synopsis

    template< size_t N> struct hash<static_url<N>> ;

    Declared in file <boost/url/static_url.hpp> at line 447

    Member Functions

    Name Description
    hash
    hash
    operator=
    hash
    operator()

    hash

    Synopsis

    void hash();

    Declared in file <boost/url/static_url.hpp> at line 449

    hash

    Synopsis

    void hash( const hash&);

    Declared in file <boost/url/static_url.hpp> at line 450

    operator=

    Synopsis

    hash& operator=( const hash&);

    Declared in file <boost/url/static_url.hpp> at line 451

    hash

    Synopsis

    void hash( size_t salt) noexcept;

    Declared in file <boost/url/static_url.hpp> at line 453

    operator()

    Synopsis

    size_t operator()( const static_url<N>& u) noexcept;

    Declared in file <boost/url/static_url.hpp> at line 459

    Created with MrDocs