Global namespace

Namespaces

Name

Description

boost

std

Namespace boost

Namespaces

Name

Description

system

urls

Namespace urls

Namespaces

Name

Description

error_types

grammar

string_token

Types

Name

Description

absolute_uri_rule_t

authority_rule_t

authority_view

A non-owning reference to a valid authority

decode_view

A reference to a valid, percent-encoded string

encoding_opts

Percent-encoding options

ignore_case_param

An optional parameter to determine case-sensitivity

ignore_case_t

ipv4_address

An IP version 4 style address.

ipv4_address_rule_t

ipv6_address

An IP version 6 style address.

ipv6_address_rule_t

make_void

no_value_t

The type of no_value

optional

origin_form_rule_t

param

A query parameter

param_pct_view

A query parameter

param_view

A query parameter

params_base

Common functionality for containers

params_encoded_base

Common functionality for containers

params_encoded_ref

A view representing query parameters in a URL

params_encoded_view

A view representing query parameters in a URL

params_ref

A view representing query parameters in a URL

params_view

A view representing query parameters in a URL

pct_encoded_rule_t

pct_string_view

A reference to a valid percent-encoded string

query_rule_t

relative_ref_rule_t

segments_base

Common functionality for containers

segments_encoded_base

Common functionality for containers

segments_encoded_ref

A view representing path segments in a URL

segments_encoded_view

A view representing path segments in a URL

segments_ref

A view representing path segments in a URL

segments_view

A view representing path segments in a URL

static_url

A modifiable container for a URL.

static_url_base

Common implementation for all static URLs

uri_reference_rule_t

uri_rule_t

url

A modifiable container for a URL.

url_base

Common functionality for containers

url_view

A non-owning reference to a valid URL

url_view_base

Common functionality for containers

variant

The type of variant used by the library

void_t

Enums

Name

Description

error

Error codes returned the library

host_type

Identifies the type of host in a URL.

scheme

Identifies a known URL scheme

Functions

Name

Description

default_port

Return the default port for a known scheme

encode

Apply percent-encoding to a string

Return a percent-encoded string

encode_unsafe

encoded_size

Return the buffer size needed for percent-encoding

make_error_code

make_pct_string_view

Return a valid percent-encoded string

make_pct_string_view_unsafe

operator!=

Return the result of comparing two URLs

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

Return true if two addresses are not equal

operator<

Return the result of comparing two URLs

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

operator<<

Format the address to an output stream.

Format the address to an output stream

Format the encoded authority to the output stream

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

Format the url to the output stream

Format to an output stream

operator<=

Return the result of comparing two URLs

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

operator==

Return the result of comparing two URLs

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

Return true if two addresses are equal

operator>

Return the result of comparing two URLs

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

operator>=

Return the result of comparing two URLs

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

parse_absolute_uri

Return a reference to a parsed URL string

parse_authority

Parse an authority

parse_ipv4_address

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

parse_ipv6_address

Parse a string containing an IPv6 address.

parse_origin_form

Return a reference to a parsed URL string

parse_path

Parse a string and return an encoded segment view

parse_query

Parse a string and return an encoded params view

parse_relative_ref

Return a reference to a parsed URL string

parse_uri

Return a reference to a parsed URL string

parse_uri_reference

Return a reference to a parsed URL string

pct_encoded_rule

resolve

Resolve a URL reference against a base URL

string_to_scheme

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

swap

Swap

to_string

Return the normalized string for a known scheme

Variables

Name

Description

absolute_uri_rule

authority_rule

ignore_case

ipv4_address_rule

ipv6_address_rule

no_value

Constant indicating no value in a param

origin_form_rule

pchars

The path character set

query_rule

relative_ref_rule

sub_delim_chars

The sub-delims character set

unreserved_chars

The unreserved character set

uri_reference_rule

uri_rule

Class make_void

Synopsis

Declared in header </boost/url/detail/config.hpp#L138[boost/url/detail/config.hpp,window=blank_]>

template<class...>
struct make_void;

Types

Name

Description

type

make_void::type

Synopsis

Declared in header </boost/url/detail/config.hpp#L138[boost/url/detail/config.hpp,window=blank_]>

typedef void type;

void_t

Synopsis

Declared in header </boost/url/detail/config.hpp#L139[boost/url/detail/config.hpp,window=blank_]>

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

Namespace grammar

Types

Enums

Name

Description

condition

Error conditions for errors received from rules

error

Error codes returned when using rules

Functions

Name

Description

ci_compare

Return the case-insensitive comparison of s0 and s1

ci_digest

Return the case-insensitive digest of a string

ci_is_equal

ci_is_less

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

delim_rule

find_if

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

find_if_not

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

hash_value

Return the hash of this value

hexdig_value

Return the decimal value of a hex character

make_error_code

make_error_condition

operator!=

operator+

Return the union of two character sets.

operator-

Return a new character set by subtracting

operator<

operator<<

Format a string to an output stream

operator<=

operator==

operator>

operator>=

optional_rule

parse

Parse a character buffer using a rule

range_rule

ref

squelch

to_lower

Return c converted to lowercase

to_upper

Return c converted to uppercase

token_rule

tuple_rule

variant_rule

Variables

Name

Description

all_chars

A character set containing all characters.

alnum_chars

alpha_chars

A character set containing the alphabetical characters.

dec_octet_rule

digit_chars

hexdig_chars

vchars

Class lut_chars

A set of characters

Synopsis

Declared in header </boost/url/grammar/lut_chars.hpp#L64[boost/url/grammar/lut_chars.hpp,window=blank_]>

class lut_chars;

Member Functions

Name

Description

find_if

find_if_not

lut_chars

Constructor

operator()

Return true if ch is in the character set.

operator~

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

Friends

Name

Description

operator+

Return the union of two character sets.

operator-

Return a new character set by subtracting

Description

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

Example

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

constexpr lut_chars vowel_chars = "AEIOU" "aeiou";

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

Overload set lut_chars::lut_chars

Members

Constructor

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

Constructor

constexpr
lut_chars(const char* s) noexcept;
  » more...
template<
    class Pred,
    class = enable_if<detail::is_pred<Pred>::value && !std::is_base_of<lut_chars, Pred>::value>::type>
constexpr
lut_chars(const Pred& pred) noexcept;
  » more...

Function lut_chars::operator()

Return true if ch is in the character set.

Synopsis

Declared in header </boost/url/grammar/lut_chars.hpp#L256[boost/url/grammar/lut_chars.hpp,window=blank_]>

constexpr
bool
operator()(unsigned char ch) const noexcept;

Description

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

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • bool

Parameters

Name Type

ch

unsigned char

Friend operator+

Return the union of two character sets.

Synopsis

Declared in header </boost/url/grammar/lut_chars.hpp#L291[boost/url/grammar/lut_chars.hpp,window=blank_]>

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

Description

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

Example

This creates a character set which includes all letters and numbers

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

constexpr lut_chars alnum_chars = alpha_chars + "0123456789";

Complexity

Constant.

Friend operator-

Return a new character set by subtracting

Synopsis

Declared in header </boost/url/grammar/lut_chars.hpp#L328[boost/url/grammar/lut_chars.hpp,window=blank_]>

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

Description

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

Example

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

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

Complexity

Constant.

Function lut_chars::operator~

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

Synopsis

Declared in header </boost/url/grammar/lut_chars.hpp#L363[boost/url/grammar/lut_chars.hpp,window=blank_]>

constexpr
lut_chars
operator~() const noexcept;

Description

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

Example

This statement declares a character set containing everything but vowels:

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

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • lut_chars

Function lut_chars::find_if

Synopsis

Declared in header </boost/url/grammar/lut_chars.hpp#L377[boost/url/grammar/lut_chars.hpp,window=blank_]>

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

Function lut_chars::find_if_not

Synopsis

Declared in header </boost/url/grammar/lut_chars.hpp#L386[boost/url/grammar/lut_chars.hpp,window=blank_]>

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

Function operator+

Return the union of two character sets.

Synopsis

Declared in header </boost/url/grammar/lut_chars.hpp#L291[boost/url/grammar/lut_chars.hpp,window=blank_]>

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

Description

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

Example

This creates a character set which includes all letters and numbers

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

constexpr lut_chars alnum_chars = alpha_chars + "0123456789";

Complexity

Constant.

Return Value

  • lut_chars

Parameters

Name Type

cs0

``

cs1

``

Function operator-

Return a new character set by subtracting

Synopsis

Declared in header </boost/url/grammar/lut_chars.hpp#L328[boost/url/grammar/lut_chars.hpp,window=blank_]>

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

Description

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

Example

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

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

Complexity

Constant.

Return Value

  • lut_chars

Parameters

Name Type

cs0

``

cs1

``

Class string_view_base

Common functionality for string views

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L36[boost/url/grammar/string_view_base.hpp,window=blank_]>

class string_view_base;

Types

Name

Description

const_iterator

The const iterator type

const_pointer

The const pointer type

const_reference

The const reference type

const_reverse_iterator

The const reverse iterator type

difference_type

The difference type

iterator

The iterator type

pointer

The pointer type

reference

The reference type

reverse_iterator

The reverse iterator type

size_type

The size type

traits_type

The character traits

value_type

The value type

Member Functions

Name

Description

at

Access a character

back

Return the last character

begin

Return an iterator to the beginning

cbegin

Return an iterator to the beginning

cend

Return an iterator to the end

compare

Return the result of comparing to another string

contains

Return true if matching characters are found

copy

Copy the characters to another buffer

crbegin

crend

data

Return a pointer to the character buffer

empty

Return true if the string is empty

end

Return an iterator to the end

ends_with

Return true if a matching suffix exists

find

Return the position of matching characters

find_first_not_of

Return the position of the first non-match

find_first_of

Return the position of the first match

find_last_not_of

Return the position of the last non-match

find_last_of

Return the position of the last match

front

Return the first character

length

Return the size

max_size

Return the maximum allowed size

operator string

Conversion

operator string_view

Conversion

operator[]

Access a character

rbegin

rend

rfind

Return the position of matching characters

size

Return the size

starts_with

Return true if a matching prefix exists

substr

Return a view to part of the string

Static Data Members

Name

Description

npos

A constant used to represent "no position"

Friends

Name

Description

hash_value

Return the hash of this value

operator!=

operator<

operator<<

operator<=

operator==

operator>

operator>=

Description

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

string_view_base::traits_type

The character traits

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L87[boost/url/grammar/string_view_base.hpp,window=blank_]>

typedef char_traits<char> traits_type;

string_view_base::value_type

The value type

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L89[boost/url/grammar/string_view_base.hpp,window=blank_]>

typedef char value_type;

string_view_base::pointer

The pointer type

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L91[boost/url/grammar/string_view_base.hpp,window=blank_]>

typedef char* pointer;

string_view_base::const_pointer

The const pointer type

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L93[boost/url/grammar/string_view_base.hpp,window=blank_]>

typedef const char* const_pointer;

string_view_base::reference

The reference type

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L95[boost/url/grammar/string_view_base.hpp,window=blank_]>

typedef char& reference;

string_view_base::const_reference

The const reference type

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L97[boost/url/grammar/string_view_base.hpp,window=blank_]>

typedef const char& const_reference;

string_view_base::const_iterator

The const iterator type

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L99[boost/url/grammar/string_view_base.hpp,window=blank_]>

typedef const char* const_iterator;

string_view_base::iterator

The iterator type

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L101[boost/url/grammar/string_view_base.hpp,window=blank_]>

typedef const_iterator iterator;

string_view_base::const_reverse_iterator

The const reverse iterator type

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L103[boost/url/grammar/string_view_base.hpp,window=blank_]>

typedef reverse_iterator<const_iterator> const_reverse_iterator;

string_view_base::reverse_iterator

The reverse iterator type

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L106[boost/url/grammar/string_view_base.hpp,window=blank_]>

typedef const_reverse_iterator reverse_iterator;

string_view_base::size_type

The size type

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L108[boost/url/grammar/string_view_base.hpp,window=blank_]>

typedef size_t size_type;

string_view_base::difference_type

The difference type

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L110[boost/url/grammar/string_view_base.hpp,window=blank_]>

typedef ptrdiff_t difference_type;

string_view_base::npos

A constant used to represent "no position"

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L113[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
static
const size_t npos;

Function string_view_base::operator string_view

Conversion

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L119[boost/url/grammar/string_view_base.hpp,window=blank_]>

operator string_view() const noexcept;

Function string_view_base::operator string

Conversion

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L142[boost/url/grammar/string_view_base.hpp,window=blank_]>

operator string() const noexcept;

Description

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

Return Value

  • string

Function string_view_base::begin

Return an iterator to the beginning

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L157[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
const_iterator
begin() const noexcept;

Description

See core::string_view::begin

Return Value

  • const_iterator

Function string_view_base::end

Return an iterator to the end

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L166[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
const_iterator
end() const noexcept;

Description

See core::string_view::end

Return Value

  • const_iterator

Function string_view_base::cbegin

Return an iterator to the beginning

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L175[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
const_iterator
cbegin() const noexcept;

Description

See core::string_view::cbegin

Return Value

  • const_iterator

Function string_view_base::cend

Return an iterator to the end

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L184[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
const_iterator
cend() const noexcept;

Description

See core::string_view::cend

Return Value

  • const_iterator

Function string_view_base::rbegin

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L194[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
const_reverse_iterator
rbegin() const noexcept;

Function string_view_base::rend

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L206[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
const_reverse_iterator
rend() const noexcept;

Function string_view_base::crbegin

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L218[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
const_reverse_iterator
crbegin() const noexcept;

Function string_view_base::crend

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L230[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
const_reverse_iterator
crend() const noexcept;

Function string_view_base::size

Return the size

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L243[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
size_type
size() const noexcept;

Description

See core::string_view::size

Return Value

  • size_type

Function string_view_base::length

Return the size

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L252[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
size_type
length() const noexcept;

Description

See core::string_view::length

Return Value

  • size_type

Function string_view_base::max_size

Return the maximum allowed size

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L261[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
size_type
max_size() const noexcept;

Description

See core::string_view::max_size

Return Value

  • size_type

Function string_view_base::empty

Return true if the string is empty

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L270[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
bool
empty() const noexcept;

Description

See core::string_view::size

Return Value

  • bool

Function string_view_base::operator[]

Access a character

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L281[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

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

Return Value

  • const_reference

Parameters

Name Type

pos

size_type

Function string_view_base::at

Access a character

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L291[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
const_reference
at(size_type pos) const;

Description

See core::string_view::at

Return Value

  • const_reference

Parameters

Name Type

pos

size_type

Function string_view_base::front

Return the first character

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L301[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
const_reference
front() const noexcept;

Description

See core::string_view::front

Return Value

  • const_reference

Function string_view_base::back

Return the last character

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L311[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
const_reference
back() const noexcept;

Description

See core::string_view::back

Return Value

  • const_reference

Function string_view_base::data

Return a pointer to the character buffer

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L321[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
const_pointer
data() const noexcept;

Description

See core::string_view::data

Return Value

  • const_pointer

Function string_view_base::copy

Copy the characters to another buffer

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L333[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::copy

Return Value

  • size_type

Parameters

Name Type

s

``

n

size_type

pos

size_type

Function string_view_base::substr

Return a view to part of the string

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L343[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::substr

Return Value

  • string_view

Parameters

Name Type

pos

size_type

n

size_type

Overload set string_view_base::compare

Members

Return the result of comparing to another string

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

Return the result of comparing to another string

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

Return the result of comparing to another string

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

Return the result of comparing to another string

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

Return the result of comparing to another string

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

Return the result of comparing to another string

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

Overload set string_view_base::starts_with

Members

Return true if a matching prefix exists

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

Return true if a matching prefix exists

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

Return true if a matching prefix exists

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

Overload set string_view_base::ends_with

Members

Return true if a matching suffix exists

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

Return true if a matching suffix exists

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

Return true if a matching suffix exists

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

Overload set string_view_base::find

Members

Return the position of matching characters

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

Return the position of matching characters

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

Return the position of matching characters

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

Return the position of matching characters

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

Overload set string_view_base::rfind

Members

Return the position of matching characters

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

Return the position of matching characters

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

Return the position of matching characters

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

Return the position of matching characters

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

Overload set string_view_base::find_first_of

Members

Return the position of the first match

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

Return the position of the first match

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

Return the position of the first match

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

Return the position of the first match

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

Overload set string_view_base::find_last_of

Members

Return the position of the last match

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

Return the position of the last match

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

Return the position of the last match

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

Return the position of the last match

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

Overload set string_view_base::find_first_not_of

Members

Return the position of the first non-match

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

Return the position of the first non-match

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

Return the position of the first non-match

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

Return the position of the first non-match

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

Overload set string_view_base::find_last_not_of

Members

Return the position of the last non-match

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

Return the position of the last non-match

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

Return the position of the last non-match

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

Return the position of the last non-match

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

Overload set string_view_base::contains

Members

Return true if matching characters are found

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

Return true if matching characters are found

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

Return true if matching characters are found

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

Friend operator==

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L775[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Friend operator!=

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L784[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Friend operator<

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L793[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Friend operator⇐

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L802[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Friend operator>

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L811[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Friend operator>=

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L820[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Friend hash_value

Return the hash of this value

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L834[boost/url/grammar/string_view_base.hpp,window=blank_]>

friend
size_t
hash_value(const string_view_base& s) noexcept;

Friend operator<<

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L843[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Function operator==

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L776[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Function operator!=

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L785[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Function operator<

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L794[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Function operator⇐

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L803[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Function operator>

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L812[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Function operator>=

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L821[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Function hash_value

Return the hash of this value

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L834[boost/url/grammar/string_view_base.hpp,window=blank_]>

size_t
hash_value(const string_view_base& s) noexcept;

Function operator<<

Format a string to an output stream

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L855[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Class all_chars_t

Synopsis

Declared in header </boost/url/grammar/all_chars.hpp#L43[boost/url/grammar/all_chars.hpp,window=blank_]>

struct all_chars_t;

Member Functions

Function all_chars_t::all_chars_t

Synopsis

Declared in header </boost/url/grammar/all_chars.hpp#L45[boost/url/grammar/all_chars.hpp,window=blank_]>

constexpr
all_chars_t() noexcept = default;

Function all_chars_t::operator()

Synopsis

Declared in header </boost/url/grammar/all_chars.hpp#L48[boost/url/grammar/all_chars.hpp,window=blank_]>

constexpr
bool
operator()(char) const noexcept;

Function all_chars_t::find_if

Synopsis

Declared in header </boost/url/grammar/all_chars.hpp#L56[boost/url/grammar/all_chars.hpp,window=blank_]>

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

Function all_chars_t::find_if_not

Synopsis

Declared in header </boost/url/grammar/all_chars.hpp#L65[boost/url/grammar/all_chars.hpp,window=blank_]>

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

all_chars

A character set containing all characters.

Synopsis

Declared in header </boost/url/grammar/all_chars.hpp#L81[boost/url/grammar/all_chars.hpp,window=blank_]>

constexpr
const all_chars_t all_chars;

Class hexdig_chars_t

Synopsis

Declared in header </boost/url/grammar/hexdig_chars.hpp#L61[boost/url/grammar/hexdig_chars.hpp,window=blank_]>

struct hexdig_chars_t;

Member Functions

Name

Description

find_if

find_if_not

operator()

Return true if c is in the character set.

Function hexdig_chars_t::operator()

Return true if c is in the character set.

Synopsis

Declared in header </boost/url/grammar/hexdig_chars.hpp#L65[boost/url/grammar/hexdig_chars.hpp,window=blank_]>

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

Function hexdig_chars_t::find_if

Synopsis

Declared in header </boost/url/grammar/hexdig_chars.hpp#L76[boost/url/grammar/hexdig_chars.hpp,window=blank_]>

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

Function hexdig_chars_t::find_if_not

Synopsis

Declared in header </boost/url/grammar/hexdig_chars.hpp#L85[boost/url/grammar/hexdig_chars.hpp,window=blank_]>

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

hexdig_chars

Synopsis

Declared in header </boost/url/grammar/hexdig_chars.hpp#L96[boost/url/grammar/hexdig_chars.hpp,window=blank_]>

constexpr
const hexdig_chars_t hexdig_chars;

Function hexdig_value

Return the decimal value of a hex character

Synopsis

Declared in header </boost/url/grammar/hexdig_chars.hpp#L123[boost/url/grammar/hexdig_chars.hpp,window=blank_]>

signed char
hexdig_value(char ch) noexcept;

Description

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

BNF

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

Return Value

  • signed char

Parameters

Name Type

ch

char

Class is_charset

Synopsis

Declared in header </boost/url/grammar/charset.hpp#L51[boost/url/grammar/charset.hpp,window=blank_]>

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

Types

Name

Description

type

value_type

Member Functions

Static Data Members

Name

Description

value

Class is_charset

Synopsis

Declared in header </boost/url/grammar/charset.hpp#L54[boost/url/grammar/charset.hpp,window=blank_]>

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

Types

Name

Description

type

value_type

Member Functions

Static Data Members

Name

Description

value

Function find_if

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

Synopsis

Declared in header </boost/url/grammar/charset.hpp#L86[boost/url/grammar/charset.hpp,window=blank_]>

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

Description

Exception Safety

Throws nothing.

Return Value

  • ``

Parameters

Name Type

first

``

last

``

cs

``

Function find_if_not

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

Synopsis

Declared in header </boost/url/grammar/charset.hpp#L124[boost/url/grammar/charset.hpp,window=blank_]>

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

Description

Exception Safety

Throws nothing.

Return Value

  • ``

Parameters

Name Type

first

``

last

``

cs

``

Overload set ref

Members

template<class CharSet>
constexpr
enable_if<is_charset<CharSet>::value && !std::is_same<CharSet, detail::charset_ref<CharSet>>::value, charset_ref<CharSet>>::type
ref(const CharSet& cs) noexcept;
  » more...
template<class Rule>
constexpr
enable_if<is_rule<Rule>::value && !std::is_same<Rule, detail::rule_ref<Rule>>::value, rule_ref<Rule>>::type
ref(const Rule& r) noexcept;
  » more...
constexpr
void
ref() = delete;
  » more...

Class is_rule

Synopsis

Declared in header </boost/url/grammar/type_traits.hpp#L51[boost/url/grammar/type_traits.hpp,window=blank_]>

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

Types

Name

Description

type

value_type

Member Functions

Static Data Members

Name

Description

value

Class is_rule

Synopsis

Declared in header </boost/url/grammar/type_traits.hpp#L54[boost/url/grammar/type_traits.hpp,window=blank_]>

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

Overload set parse

Members

Parse a character buffer using a rule

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

Parse a character buffer using a rule

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

Enum error

Error codes returned when using rules

Synopsis

Declared in header </boost/url/grammar/error.hpp#L26[boost/url/grammar/error.hpp,window=blank_]>

enum error : int;

Members

Name

Description

need_more

More input is needed to match the rule

mismatch

The rule did not match the input.

end_of_range

A rule reached the end of a range

leftover

Leftover input remaining after match.

invalid

A rule encountered unrecoverable invalid input.

out_of_range

An integer overflowed during parsing.

syntax

An unspecified syntax error was found.

Enumerator error::need_more

More input is needed to match the rule

Synopsis

Declared in header </boost/url/grammar/error.hpp#L48[boost/url/grammar/error.hpp,window=blank_]>

need_more = 1

Description

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

Enumerator error::mismatch

The rule did not match the input.

Synopsis

Declared in header </boost/url/grammar/error.hpp#L58[boost/url/grammar/error.hpp,window=blank_]>

mismatch

Description

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

Enumerator error::end_of_range

A rule reached the end of a range

Synopsis

Declared in header </boost/url/grammar/error.hpp#L71[boost/url/grammar/error.hpp,window=blank_]>

end_of_range

Description

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

Enumerator error::leftover

Leftover input remaining after match.

Synopsis

Declared in header </boost/url/grammar/error.hpp#L76[boost/url/grammar/error.hpp,window=blank_]>

leftover

Enumerator error::invalid

A rule encountered unrecoverable invalid input.

Synopsis

Declared in header </boost/url/grammar/error.hpp#L94[boost/url/grammar/error.hpp,window=blank_]>

invalid

Description

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

Enumerator error::out_of_range

An integer overflowed during parsing.

Synopsis

Declared in header </boost/url/grammar/error.hpp#L98[boost/url/grammar/error.hpp,window=blank_]>

out_of_range

Enumerator error::syntax

An unspecified syntax error was found.

Synopsis

Declared in header </boost/url/grammar/error.hpp#L103[boost/url/grammar/error.hpp,window=blank_]>

syntax

Enum condition

Error conditions for errors received from rules

Synopsis

Declared in header </boost/url/grammar/error.hpp#L114[boost/url/grammar/error.hpp,window=blank_]>

enum condition : int;

Members

Name

Description

fatal

A fatal error in syntax was encountered.

Enumerator condition::fatal

A fatal error in syntax was encountered.

Synopsis

Declared in header </boost/url/grammar/error.hpp#L121[boost/url/grammar/error.hpp,window=blank_]>

fatal = 1

Description

This indicates that parsing cannot continue.

Function make_error_code

Synopsis

Declared in header </boost/url/grammar/impl/error.hpp#L97[boost/url/grammar/impl/error.hpp,window=blank_]>

error_code
make_error_code(error ev) noexcept;

Function make_error_condition

Synopsis

Declared in header </boost/url/grammar/impl/error.hpp#L108[boost/url/grammar/impl/error.hpp,window=blank_]>

error_condition
make_error_condition(condition c) noexcept;

Function to_lower

Return c converted to lowercase

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L53[boost/url/grammar/ci_string.hpp,window=blank_]>

constexpr
char
to_lower(char c) noexcept;

Description

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

Example

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

Exception Safety

Throws nothing.

Return Value

  • char

Parameters

Name Type

c

char

Function to_upper

Return c converted to uppercase

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L83[boost/url/grammar/ci_string.hpp,window=blank_]>

constexpr
char
to_upper(char c) noexcept;

Description

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

Example

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

Exception Safety

Throws nothing.

Return Value

  • char

Parameters

Name Type

c

char

Function ci_compare

Return the case-insensitive comparison of s0 and s1

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L120[boost/url/grammar/ci_string.hpp,window=blank_]>

int
ci_compare(
    string_view s0,
    string_view s1) noexcept;

Description

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

Example

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

Exception Safety

Throws nothing.

Return Value

  • int

Parameters

Name Type

s0

string_view

s1

string_view

Function ci_digest

Return the case-insensitive digest of a string

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L140[boost/url/grammar/ci_string.hpp,window=blank_]>

size_t
ci_digest(string_view s) noexcept;

Description

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

Return Value

  • size_t

Parameters

Name Type

s

string_view

Overload set ci_is_equal

Members

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

Function ci_is_less

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

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L224[boost/url/grammar/ci_string.hpp,window=blank_]>

bool
ci_is_less(
    string_view s0,
    string_view s1) noexcept;

Description

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

Example

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

Return Value

  • bool

Parameters

Name Type

s0

string_view

s1

string_view

Class ci_hash

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L261[boost/url/grammar/ci_string.hpp,window=blank_]>

struct ci_hash;

Types

Name

Description

is_transparent

Member Functions

Name

Description

operator()

ci_hash::is_transparent

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L263[boost/url/grammar/ci_string.hpp,window=blank_]>

using is_transparent = void;

Function ci_hash::operator()

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L265[boost/url/grammar/ci_string.hpp,window=blank_]>

size_t
operator()(string_view s) const noexcept;

Class ci_equal

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L297[boost/url/grammar/ci_string.hpp,window=blank_]>

struct ci_equal;

Types

Name

Description

is_transparent

Member Functions

Name

Description

operator()

ci_equal::is_transparent

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L299[boost/url/grammar/ci_string.hpp,window=blank_]>

using is_transparent = void;

Function ci_equal::operator()

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L303[boost/url/grammar/ci_string.hpp,window=blank_]>

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

Class ci_less

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L338[boost/url/grammar/ci_string.hpp,window=blank_]>

struct ci_less;

Types

Name

Description

is_transparent

Member Functions

Name

Description

operator()

ci_less::is_transparent

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L340[boost/url/grammar/ci_string.hpp,window=blank_]>

using is_transparent = void;

Function ci_less::operator()

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L342[boost/url/grammar/ci_string.hpp,window=blank_]>

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

Class variant_rule_t

Synopsis

Declared in header </boost/url/grammar/variant_rule.hpp#L78[boost/url/grammar/variant_rule.hpp,window=blank_]>

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

Types

Name

Description

value_type

Member Functions

Name

Description

parse

Friends

Name

Description

variant_rule

variant_rule_t::value_type

Synopsis

Declared in header </boost/url/grammar/variant_rule.hpp#L81[boost/url/grammar/variant_rule.hpp,window=blank_]>

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

Function variant_rule_t::parse

Synopsis

Declared in header </boost/url/grammar/variant_rule.hpp#L85[boost/url/grammar/variant_rule.hpp,window=blank_]>

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

Friend variant_rule

Synopsis

Declared in header </boost/url/grammar/variant_rule.hpp#L91[boost/url/grammar/variant_rule.hpp,window=blank_]>

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

Overload set variant_rule

Members

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

Class unsigned_rule

Synopsis

Declared in header </boost/url/grammar/unsigned_rule.hpp#L57[boost/url/grammar/unsigned_rule.hpp,window=blank_]>

template<class Unsigned>
struct unsigned_rule;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

unsigned_rule::value_type

Synopsis

Declared in header </boost/url/grammar/unsigned_rule.hpp#L65[boost/url/grammar/unsigned_rule.hpp,window=blank_]>

using value_type = Unsigned;

Function unsigned_rule::parse

Synopsis

Declared in header </boost/url/grammar/unsigned_rule.hpp#L67[boost/url/grammar/unsigned_rule.hpp,window=blank_]>

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

Class digit_chars_t

Synopsis

Declared in header </boost/url/grammar/digit_chars.hpp#L48[boost/url/grammar/digit_chars.hpp,window=blank_]>

struct digit_chars_t;

Member Functions

Name

Description

find_if

find_if_not

operator()

Function digit_chars_t::operator()

Synopsis

Declared in header </boost/url/grammar/digit_chars.hpp#L50[boost/url/grammar/digit_chars.hpp,window=blank_]>

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

Function digit_chars_t::find_if

Synopsis

Declared in header </boost/url/grammar/digit_chars.hpp#L58[boost/url/grammar/digit_chars.hpp,window=blank_]>

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

Function digit_chars_t::find_if_not

Synopsis

Declared in header </boost/url/grammar/digit_chars.hpp#L67[boost/url/grammar/digit_chars.hpp,window=blank_]>

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

digit_chars

Synopsis

Declared in header </boost/url/grammar/digit_chars.hpp#L78[boost/url/grammar/digit_chars.hpp,window=blank_]>

constexpr
const digit_chars_t digit_chars;

Class ch_delim_rule

Synopsis

Declared in header </boost/url/grammar/delim_rule.hpp#L61[boost/url/grammar/delim_rule.hpp,window=blank_]>

struct ch_delim_rule;

Types

Name

Description

value_type

Member Functions

Name

Description

ch_delim_rule

parse

ch_delim_rule::value_type

Synopsis

Declared in header </boost/url/grammar/delim_rule.hpp#L63[boost/url/grammar/delim_rule.hpp,window=blank_]>

using value_type = string_view;

Function ch_delim_rule::ch_delim_rule

Synopsis

Declared in header </boost/url/grammar/delim_rule.hpp#L65[boost/url/grammar/delim_rule.hpp,window=blank_]>

constexpr
ch_delim_rule(char ch) noexcept;

Function ch_delim_rule::parse

Synopsis

Declared in header </boost/url/grammar/delim_rule.hpp#L72[boost/url/grammar/delim_rule.hpp,window=blank_]>

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

Overload set delim_rule

Members

constexpr
ch_delim_rule
delim_rule(char ch) noexcept;
  » more...
template<class CharSet>
constexpr
enable_if<!std::is_convertible<CharSet, char>::value, cs_delim_rule<CharSet>>::type
delim_rule(const CharSet& cs) noexcept;
  » more...

Class cs_delim_rule

Synopsis

Declared in header </boost/url/grammar/delim_rule.hpp#L127[boost/url/grammar/delim_rule.hpp,window=blank_]>

template<class CharSet>
struct cs_delim_rule;

Types

Name

Description

value_type

Member Functions

Name

Description

cs_delim_rule

parse

cs_delim_rule::value_type

Synopsis

Declared in header </boost/url/grammar/delim_rule.hpp#L129[boost/url/grammar/delim_rule.hpp,window=blank_]>

using value_type = string_view;

Function cs_delim_rule::cs_delim_rule

Synopsis

Declared in header </boost/url/grammar/delim_rule.hpp#L131[boost/url/grammar/delim_rule.hpp,window=blank_]>

constexpr
cs_delim_rule(const CharSet& cs) noexcept;

Function cs_delim_rule::parse

Synopsis

Declared in header </boost/url/grammar/delim_rule.hpp#L138[boost/url/grammar/delim_rule.hpp,window=blank_]>

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

Class optional_rule_t

Synopsis

Declared in header </boost/url/grammar/optional_rule.hpp#L65[boost/url/grammar/optional_rule.hpp,window=blank_]>

template<class Rule>
struct optional_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

Friends

Name

Description

optional_rule

optional_rule_t::value_type

Synopsis

Declared in header </boost/url/grammar/optional_rule.hpp#L68[boost/url/grammar/optional_rule.hpp,window=blank_]>

using value_type = optional<Rule::value_type>;

Function optional_rule_t::parse

Synopsis

Declared in header </boost/url/grammar/optional_rule.hpp#L71[boost/url/grammar/optional_rule.hpp,window=blank_]>

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

Friend optional_rule

Synopsis

Declared in header </boost/url/grammar/optional_rule.hpp#L76[boost/url/grammar/optional_rule.hpp,window=blank_]>

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

Overload set optional_rule

Members

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

Class tuple_rule_t

Synopsis

Declared in header </boost/url/grammar/tuple_rule.hpp#L89[boost/url/grammar/tuple_rule.hpp,window=blank_]>

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

Types

Name

Description

value_type

Member Functions

Name

Description

parse

Friends

Name

Description

tuple_rule

tuple_rule_t::value_type

Synopsis

Declared in header </boost/url/grammar/tuple_rule.hpp#L102[boost/url/grammar/tuple_rule.hpp,window=blank_]>

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

Friend tuple_rule

Synopsis

Declared in header </boost/url/grammar/tuple_rule.hpp#L106[boost/url/grammar/tuple_rule.hpp,window=blank_]>

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

Function tuple_rule_t::parse

Synopsis

Declared in header </boost/url/grammar/tuple_rule.hpp#L117[boost/url/grammar/tuple_rule.hpp,window=blank_]>

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

Overload set tuple_rule

Members

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

Function squelch

Synopsis

Declared in header </boost/url/grammar/tuple_rule.hpp#L231[boost/url/grammar/tuple_rule.hpp,window=blank_]>

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

Class alnum_chars_t

Synopsis

Declared in header </boost/url/grammar/alnum_chars.hpp#L53[boost/url/grammar/alnum_chars.hpp,window=blank_]>

struct alnum_chars_t;

Member Functions

Name

Description

find_if

find_if_not

operator()

Function alnum_chars_t::operator()

Synopsis

Declared in header </boost/url/grammar/alnum_chars.hpp#L55[boost/url/grammar/alnum_chars.hpp,window=blank_]>

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

Function alnum_chars_t::find_if

Synopsis

Declared in header </boost/url/grammar/alnum_chars.hpp#L66[boost/url/grammar/alnum_chars.hpp,window=blank_]>

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

Function alnum_chars_t::find_if_not

Synopsis

Declared in header </boost/url/grammar/alnum_chars.hpp#L75[boost/url/grammar/alnum_chars.hpp,window=blank_]>

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

alnum_chars

Synopsis

Declared in header </boost/url/grammar/alnum_chars.hpp#L86[boost/url/grammar/alnum_chars.hpp,window=blank_]>

constexpr
const alnum_chars_t alnum_chars;

Class alpha_chars_t

Synopsis

Declared in header </boost/url/grammar/alpha_chars.hpp#L48[boost/url/grammar/alpha_chars.hpp,window=blank_]>

struct alpha_chars_t;

Member Functions

Function alpha_chars_t::alpha_chars_t

Synopsis

Declared in header </boost/url/grammar/alpha_chars.hpp#L50[boost/url/grammar/alpha_chars.hpp,window=blank_]>

constexpr
alpha_chars_t() noexcept = default;

Function alpha_chars_t::operator()

Synopsis

Declared in header </boost/url/grammar/alpha_chars.hpp#L53[boost/url/grammar/alpha_chars.hpp,window=blank_]>

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

Function alpha_chars_t::find_if

Synopsis

Declared in header </boost/url/grammar/alpha_chars.hpp#L63[boost/url/grammar/alpha_chars.hpp,window=blank_]>

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

Function alpha_chars_t::find_if_not

Synopsis

Declared in header </boost/url/grammar/alpha_chars.hpp#L72[boost/url/grammar/alpha_chars.hpp,window=blank_]>

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

alpha_chars

A character set containing the alphabetical characters.

Synopsis

Declared in header </boost/url/grammar/alpha_chars.hpp#L88[boost/url/grammar/alpha_chars.hpp,window=blank_]>

constexpr
const alpha_chars_t alpha_chars;

Class token_rule_t

Synopsis

Declared in header </boost/url/grammar/token_rule.hpp#L57[boost/url/grammar/token_rule.hpp,window=blank_]>

template<class CharSet>
struct token_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

token_rule_t::value_type

Synopsis

Declared in header </boost/url/grammar/token_rule.hpp#L59[boost/url/grammar/token_rule.hpp,window=blank_]>

using value_type = string_view;

Function token_rule_t::parse

Synopsis

Declared in header </boost/url/grammar/token_rule.hpp#L65[boost/url/grammar/token_rule.hpp,window=blank_]>

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

Function token_rule

Synopsis

Declared in header </boost/url/grammar/token_rule.hpp#L92[boost/url/grammar/token_rule.hpp,window=blank_]>

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

Class vchars_t

Synopsis

Declared in header </boost/url/grammar/vchars.hpp#L48[boost/url/grammar/vchars.hpp,window=blank_]>

struct vchars_t;

Member Functions

Name

Description

find_if

find_if_not

operator()

Function vchars_t::operator()

Synopsis

Declared in header </boost/url/grammar/vchars.hpp#L50[boost/url/grammar/vchars.hpp,window=blank_]>

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

Function vchars_t::find_if

Synopsis

Declared in header </boost/url/grammar/vchars.hpp#L58[boost/url/grammar/vchars.hpp,window=blank_]>

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

Function vchars_t::find_if_not

Synopsis

Declared in header </boost/url/grammar/vchars.hpp#L67[boost/url/grammar/vchars.hpp,window=blank_]>

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

vchars

Synopsis

Declared in header </boost/url/grammar/vchars.hpp#L78[boost/url/grammar/vchars.hpp,window=blank_]>

constexpr
const vchars_t vchars;

aligned_storage

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L44[boost/url/grammar/recycled.hpp,window=blank_]>

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

Class recycled

A thread-safe collection of instances of T

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L73[boost/url/grammar/recycled.hpp,window=blank_]>

template<class T>
class recycled;

Member Functions

Name

Description

recycled

Constructor

~recycled

Destructor

Description

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

Example

static recycled< std::string > bin;

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

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

Function recycled::~recycled

Destructor

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L83[boost/url/grammar/recycled.hpp,window=blank_]>

~recycled();

Description

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

Return Value

  • void

Function recycled::recycled

Constructor

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L87[boost/url/grammar/recycled.hpp,window=blank_]>

constexpr
recycled() = default;

Class recycled_ptr

A pointer to shared instance of T

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L150[boost/url/grammar/recycled.hpp,window=blank_]>

template<class T>
class recycled_ptr;

Member Functions

Name

Description

acquire

Return the referenced object

bin

Return the referenced recycle bin

empty

Return true if this does not reference an object

get

Return the referenced object

operator bool

Return true if this references an object

operator*

Return the referenced object

operator->

Return the referenced object

operator=

Assignment

recycled_ptr

Constructor

release

Release the referenced object

~recycled_ptr

Destructor

Description

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

Example

static recycled< std::string > bin;

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

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

Function recycled_ptr::~recycled_ptr

Destructor

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L178[boost/url/grammar/recycled.hpp,window=blank_]>

~recycled_ptr();

Description

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

Effects

this->release();

Return Value

  • void

Overload set recycled_ptr::recycled_ptr

Members

Constructor

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

Constructor

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

Constructor

recycled_ptr();
  » more...

Constructor

recycled_ptr(nullptr_t) noexcept;
  » more...

Constructor

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

Constructor

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

Overload set recycled_ptr::operator=

Members

Assignment

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

Assignment

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

Function recycled_ptr::empty

Return true if this does not reference an object

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L403[boost/url/grammar/recycled.hpp,window=blank_]>

bool
empty() const noexcept;

Description

Exception Safety

Throws nothing.

Return Value

  • bool

Function recycled_ptr::operator bool

Return true if this references an object

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L419[boost/url/grammar/recycled.hpp,window=blank_]>

operator bool() const noexcept;

Description

Effects

return ! this->empty();

Exception Safety

Throws nothing.

Return Value

  • bool

Function recycled_ptr::bin

Return the referenced recycle bin

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L430[boost/url/grammar/recycled.hpp,window=blank_]>

recycled<T>&
bin() const noexcept;

Description

Exception Safety

Throws nothing.

Return Value

  • ``

Function recycled_ptr::get

Return the referenced object

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L443[boost/url/grammar/recycled.hpp,window=blank_]>

T*
get() const noexcept;

Description

If this is empty, nullptr is returned.

Exception Safety

Throws nothing.

Return Value

  • ``

Function recycled_ptr::operator→

Return the referenced object

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L455[boost/url/grammar/recycled.hpp,window=blank_]>

T*
operator->() const noexcept;

Description

If this is empty, nullptr is returned.

Exception Safety

Throws nothing.

Return Value

  • ``

Function recycled_ptr::operator*

Return the referenced object

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L467[boost/url/grammar/recycled.hpp,window=blank_]>

T&
operator*() const noexcept;

Description

Preconditions

not this->empty()

Return Value

  • ``

Function recycled_ptr::acquire

Return the referenced object

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L484[boost/url/grammar/recycled.hpp,window=blank_]>

T&
acquire();

Description

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

Postconditions

not this->empty()

Return Value

  • ``

Function recycled_ptr::release

Release the referenced object

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L501[boost/url/grammar/recycled.hpp,window=blank_]>

void
release() noexcept;

Description

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

Postconditions

this->empty()

Exception Safety

Throws nothing.

Return Value

  • void

Class range

A forward range of parsed elements

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L60[boost/url/grammar/range_rule.hpp,window=blank_]>

template<class T>
class range;

Types

Name

Description

const_iterator

A constant, forward iterator to elements of the range

const_reference

The type of each element of the range

difference_type

The type used to represent signed integers

iterator

A constant, forward iterator to elements of the range

pointer

Provided for compatibility, unused

reference

The type of each element of the range

size_type

The type used to represent unsigned integers

value_type

The type of each element of the range

Member Functions

Name

Description

begin

Return an iterator to the beginning

empty

Return true if the range is empty

end

Return an iterator to the end

operator=

Assignment

Constructor

range

Constructor

size

Return the number of elements in the range

string

Return the matching part of the string

~range

Destructor

Description

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

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

range::value_type

The type of each element of the range

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L133[boost/url/grammar/range_rule.hpp,window=blank_]>

using value_type = T;

range::reference

The type of each element of the range

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L137[boost/url/grammar/range_rule.hpp,window=blank_]>

using reference = const T&;

range::const_reference

The type of each element of the range

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L141[boost/url/grammar/range_rule.hpp,window=blank_]>

using const_reference = const T&;

range::pointer

Provided for compatibility, unused

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L145[boost/url/grammar/range_rule.hpp,window=blank_]>

using pointer = const void*;

range::size_type

The type used to represent unsigned integers

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L149[boost/url/grammar/range_rule.hpp,window=blank_]>

using size_type = size_t;

range::difference_type

The type used to represent signed integers

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L153[boost/url/grammar/range_rule.hpp,window=blank_]>

using difference_type = ptrdiff_t;

Class range::iterator

A constant, forward iterator to elements of the range

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L361[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

class iterator;

Types

Member Functions

range::iterator::value_type

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L365[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

using value_type = T;

range::iterator::reference

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L366[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

using reference = const T&;

range::iterator::pointer

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L367[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

using pointer = const void*;

range::iterator::difference_type

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L368[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

using difference_type = ptrdiff_t;

range::iterator::iterator_category

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L370[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

using iterator_category = forward_iterator_tag;

Overload set range::iterator::iterator

Members

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

Function range::iterator::operator=

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L376[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

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

Function range::iterator::operator*

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L379[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

reference
operator*() const noexcept;

Function range::iterator::operator==

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L385[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

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

Function range::iterator::operator!=

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L396[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

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

Overload set range::iterator::operator++

Members

iterator&
operator++() noexcept;
  » more...
iterator
operator++(int) noexcept;
  » more...

range::const_iterator

A constant, forward iterator to elements of the range

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L161[boost/url/grammar/range_rule.hpp,window=blank_]>

using const_iterator = iterator;

Function range::~range

Destructor

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L165[boost/url/grammar/range_rule.hpp,window=blank_]>

~range();

Overload set range::range

Members

Constructor

range() noexcept;
  » more...

Constructor

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

Constructor

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

Overload set range::operator=

Members

Constructor

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

Assignment

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

Function range::begin

Return an iterator to the beginning

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L242[boost/url/grammar/range_rule.hpp,window=blank_]>

iterator
begin() const noexcept;

Function range::end

Return an iterator to the end

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L246[boost/url/grammar/range_rule.hpp,window=blank_]>

iterator
end() const noexcept;

Function range::empty

Return true if the range is empty

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L250[boost/url/grammar/range_rule.hpp,window=blank_]>

bool
empty() const noexcept;

Function range::size

Return the number of elements in the range

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L258[boost/url/grammar/range_rule.hpp,window=blank_]>

size_t
size() const noexcept;

Function range::string

Return the matching part of the string

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L266[boost/url/grammar/range_rule.hpp,window=blank_]>

string_view
string() const noexcept;

Class range_rule_t

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L504[boost/url/grammar/range_rule.hpp,window=blank_]>

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

Types

Name

Description

value_type

Member Functions

Name

Description

parse

range_rule_t::value_type

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L506[boost/url/grammar/range_rule.hpp,window=blank_]>

using value_type = range<R0::value_type>;

Function range_rule_t::parse

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L509[boost/url/grammar/range_rule.hpp,window=blank_]>

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

Class range_rule_t

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L359[boost/url/grammar/range_rule.hpp,window=blank_]>

template<class R>
struct range_rule_t<R>;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

range_rule_t::value_type

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L361[boost/url/grammar/range_rule.hpp,window=blank_]>

using value_type = range<R::value_type>;

Function range_rule_t::parse

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L364[boost/url/grammar/range_rule.hpp,window=blank_]>

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

Overload set range_rule

Members

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

Class dec_octet_rule_t

Synopsis

Declared in header </boost/url/grammar/dec_octet_rule.hpp#L56[boost/url/grammar/dec_octet_rule.hpp,window=blank_]>

struct dec_octet_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

dec_octet_rule_t::value_type

Synopsis

Declared in header </boost/url/grammar/dec_octet_rule.hpp#L58[boost/url/grammar/dec_octet_rule.hpp,window=blank_]>

using value_type = unsigned char;

Function dec_octet_rule_t::parse

Synopsis

Declared in header </boost/url/grammar/dec_octet_rule.hpp#L61[boost/url/grammar/dec_octet_rule.hpp,window=blank_]>

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

dec_octet_rule

Synopsis

Declared in header </boost/url/grammar/dec_octet_rule.hpp#L69[boost/url/grammar/dec_octet_rule.hpp,window=blank_]>

constexpr
const dec_octet_rule_t dec_octet_rule;

Class literal_rule

Synopsis

Declared in header </boost/url/grammar/literal_rule.hpp#L49[boost/url/grammar/literal_rule.hpp,window=blank_]>

class literal_rule;

Types

Name

Description

value_type

Member Functions

Name

Description

literal_rule

parse

literal_rule::value_type

Synopsis

Declared in header </boost/url/grammar/literal_rule.hpp#L65[boost/url/grammar/literal_rule.hpp,window=blank_]>

using value_type = string_view;

Function literal_rule::literal_rule

Synopsis

Declared in header </boost/url/grammar/literal_rule.hpp#L67[boost/url/grammar/literal_rule.hpp,window=blank_]>

constexpr
literal_rule(const char* s) noexcept;

Function literal_rule::parse

Synopsis

Declared in header </boost/url/grammar/literal_rule.hpp#L77[boost/url/grammar/literal_rule.hpp,window=blank_]>

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

sub_delim_chars

The sub-delims character set

Synopsis

Declared in header </boost/url/rfc/sub_delim_chars.hpp#L45[boost/url/rfc/sub_delim_chars.hpp,window=blank_]>

constexpr
const grammar::lut_chars sub_delim_chars;

Description

Example

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

system::result< decode_view > = grammar::parse( "Program%20Files", pct_encoded_rule( sub_delim_chars ) );

BNF

sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
              / "*" / "+" / "," / ";" / "="

unreserved_chars

The unreserved character set

Synopsis

Declared in header </boost/url/rfc/unreserved_chars.hpp#L44[boost/url/rfc/unreserved_chars.hpp,window=blank_]>

constexpr
const grammar::lut_chars unreserved_chars;

Description

Example

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

system::result< decode_view > rv = grammar::parse( "Program%20Files", pct_encoded_rule( unreserved_chars ) );

BNF

unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"

pchars

The path character set

Synopsis

Declared in header </boost/url/rfc/pchars.hpp#L45[boost/url/rfc/pchars.hpp,window=blank_]>

constexpr
grammar::lut_chars pchars;

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

Class encoding_opts

Percent-encoding options

Synopsis

Declared in header </boost/url/encoding_opts.hpp#L31[boost/url/encoding_opts.hpp,window=blank_]>

struct encoding_opts;

Member Functions

Name

Description

encoding_opts

Data Members

Name

Description

disallow_null

True if nulls are not allowed

lower_case

True if hexadecimal digits are emitted as lower case

space_as_plus

True if spaces encode to and from plus signs

Description

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

encoding_opts::space_as_plus

True if spaces encode to and from plus signs

Synopsis

Declared in header </boost/url/encoding_opts.hpp#L48[boost/url/encoding_opts.hpp,window=blank_]>

bool space_as_plus;

Description

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

encoding_opts::lower_case

True if hexadecimal digits are emitted as lower case

Synopsis

Declared in header </boost/url/encoding_opts.hpp#L57[boost/url/encoding_opts.hpp,window=blank_]>

bool lower_case;

Description

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

encoding_opts::disallow_null

True if nulls are not allowed

Synopsis

Declared in header </boost/url/encoding_opts.hpp#L68[boost/url/encoding_opts.hpp,window=blank_]>

bool disallow_null;

Description

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

Function encoding_opts::encoding_opts

Synopsis

Declared in header </boost/url/encoding_opts.hpp#L71[boost/url/encoding_opts.hpp,window=blank_]>

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

Namespace error_types

Types

Name

Description

error_category

The type of error category used by the library

error_code

The type of error code used by the library

error_condition

The type of error condition used by the library

result

The type of result returned by library functions

system_error

The type of system error thrown by the library

error_category

The type of error category used by the library

Synopsis

Declared in header </boost/url/error_types.hpp#L43[boost/url/error_types.hpp,window=blank_]>

using error_category = error_category;

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

Declared in header </boost/url/error_types.hpp#L65[boost/url/error_types.hpp,window=blank_]>

using error_code = error_code;

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

Declared in header </boost/url/error_types.hpp#L87[boost/url/error_types.hpp,window=blank_]>

using error_condition = error_condition;

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

Declared in header </boost/url/error_types.hpp#L109[boost/url/error_types.hpp,window=blank_]>

using system_error = system_error;

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

Declared in header </boost/url/error_types.hpp#L280[boost/url/error_types.hpp,window=blank_]>

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

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;

Namespace string_token

Types

Functions

Name

Description

append_to

assign_to

preserve_size

Class arg

Base class for string tokens, and algorithm parameters

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L49[boost/url/grammar/string_token.hpp,window=blank_]>

struct arg;

Member Functions

Name

Description

arg

operator=

prepare

Return a modifiable character buffer

~arg

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.

Function arg::prepare

Return a modifiable character buffer

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L68[boost/url/grammar/string_token.hpp,window=blank_]>

virtual
char*
prepare(size_t n) = 0;

Description

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

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

Return Value

  • ``

Parameters

Name Type

n

size_t

Function arg::~arg

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L71[boost/url/grammar/string_token.hpp,window=blank_]>

virtual
~arg() = default;

Overload set arg::arg

Members

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

Overload set arg::operator=

Members

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

Class is_token

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L88[boost/url/grammar/string_token.hpp,window=blank_]>

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

Types

Name

Description

type

value_type

Member Functions

Static Data Members

Name

Description

value

Class is_token

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L91[boost/url/grammar/string_token.hpp,window=blank_]>

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

Types

Name

Description

type

value_type

Member Functions

Static Data Members

Name

Description

value

Class return_string

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L117[boost/url/grammar/string_token.hpp,window=blank_]>

struct return_string
    : arg;

Types

Name

Description

result_type

Member Functions

Name

Description

operator=

prepare

Return a modifiable character buffer

result

return_string::result_type

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L120[boost/url/grammar/string_token.hpp,window=blank_]>

using result_type = string;

Function return_string::prepare

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L122[boost/url/grammar/string_token.hpp,window=blank_]>

virtual
char*
prepare(size_t n) override;

Function return_string::result

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L129[boost/url/grammar/string_token.hpp,window=blank_]>

result_type
result() noexcept;

Class append_to_t

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L156[boost/url/grammar/string_token.hpp,window=blank_]>

template<class Alloc>
struct append_to_t
    : arg;

Types

Name

Description

result_type

string_type

Member Functions

Name

Description

append_to_t

operator=

prepare

Return a modifiable character buffer

result

append_to_t::string_type

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L159[boost/url/grammar/string_token.hpp,window=blank_]>

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

append_to_t::result_type

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L163[boost/url/grammar/string_token.hpp,window=blank_]>

using result_type = string_type&;

Function append_to_t::append_to_t

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L165[boost/url/grammar/string_token.hpp,window=blank_]>

append_to_t(string_type& s) noexcept;

Function append_to_t::prepare

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L172[boost/url/grammar/string_token.hpp,window=blank_]>

virtual
char*
prepare(size_t n) override;

Function append_to_t::result

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L182[boost/url/grammar/string_token.hpp,window=blank_]>

result_type
result() noexcept;

Function append_to

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L195[boost/url/grammar/string_token.hpp,window=blank_]>

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

Class assign_to_t

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L222[boost/url/grammar/string_token.hpp,window=blank_]>

template<class Alloc>
struct assign_to_t
    : arg;

Types

Name

Description

result_type

string_type

Member Functions

Name

Description

assign_to_t

operator=

prepare

Return a modifiable character buffer

result

assign_to_t::string_type

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L225[boost/url/grammar/string_token.hpp,window=blank_]>

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

assign_to_t::result_type

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L229[boost/url/grammar/string_token.hpp,window=blank_]>

using result_type = string_type&;

Function assign_to_t::assign_to_t

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L231[boost/url/grammar/string_token.hpp,window=blank_]>

assign_to_t(string_type& s) noexcept;

Function assign_to_t::prepare

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L238[boost/url/grammar/string_token.hpp,window=blank_]>

virtual
char*
prepare(size_t n) override;

Function assign_to_t::result

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L245[boost/url/grammar/string_token.hpp,window=blank_]>

result_type
result() noexcept;

Function assign_to

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L258[boost/url/grammar/string_token.hpp,window=blank_]>

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

Class preserve_size_t

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L285[boost/url/grammar/string_token.hpp,window=blank_]>

template<class Alloc>
struct preserve_size_t
    : arg;

Types

Name

Description

result_type

string_type

Member Functions

Name

Description

operator=

prepare

Return a modifiable character buffer

preserve_size_t

result

preserve_size_t::result_type

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L288[boost/url/grammar/string_token.hpp,window=blank_]>

using result_type = string_view;

preserve_size_t::string_type

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L290[boost/url/grammar/string_token.hpp,window=blank_]>

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

Function preserve_size_t::preserve_size_t

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L294[boost/url/grammar/string_token.hpp,window=blank_]>

preserve_size_t(string_type& s) noexcept;

Function preserve_size_t::prepare

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L301[boost/url/grammar/string_token.hpp,window=blank_]>

virtual
char*
prepare(size_t n) override;

Function preserve_size_t::result

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L312[boost/url/grammar/string_token.hpp,window=blank_]>

result_type
result() noexcept;

Function preserve_size

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L327[boost/url/grammar/string_token.hpp,window=blank_]>

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

Class decode_view

A reference to a valid, percent-encoded string

Synopsis

Declared in header </boost/url/decode_view.hpp#L87[boost/url/decode_view.hpp,window=blank_]>

class decode_view;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

The signed integer type

iterator

reference

The reference type

size_type

The unsigned integer type

value_type

The value type

Member Functions

Name

Description

back

Return the last character

begin

Return an iterator to the beginning

compare

Return the result of comparing to another string

decode_view

Constructor

empty

Return true if the string is empty

end

Return an iterator to the end

ends_with

Checks if the string ends with the given prefix

find

Finds the first occurrence of character in this view

front

Return the first character

options

Return the decoding options

remove_prefix

Remove the first characters

remove_suffix

Remove the last characters

rfind

Finds the first occurrence of character in this view

size

Return the number of decoded characters

starts_with

Checks if the string begins with the given prefix

Friends

Description

These views reference strings in parts of URLs or other components that are percent-encoded. The special characters (those not in the allowed character set) are stored as three character escapes that consist of a percent sign ('%%') followed by a two-digit hexadecimal number of the corresponding unescaped character code, which may be part of a UTF-8 code point depending on the context. The view refers to the original character buffer and only decodes escaped sequences when needed. In particular these operations perform percent-decoding automatically without the need to allocate memory:

  • Iteration of the string

  • Accessing the encoded character buffer

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

Operators

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

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

decode_view::value_type

The value type

Synopsis

Declared in header </boost/url/decode_view.hpp#L113[boost/url/decode_view.hpp,window=blank_]>

using value_type = char;

decode_view::reference

The reference type

Synopsis

Declared in header </boost/url/decode_view.hpp#L117[boost/url/decode_view.hpp,window=blank_]>

using reference = char;

decode_view::const_reference

The reference type

Synopsis

Declared in header </boost/url/decode_view.hpp#L120[boost/url/decode_view.hpp,window=blank_]>

using const_reference = char;

decode_view::size_type

The unsigned integer type

Synopsis

Declared in header </boost/url/decode_view.hpp#L124[boost/url/decode_view.hpp,window=blank_]>

using size_type = size_t;

decode_view::difference_type

The signed integer type

Synopsis

Declared in header </boost/url/decode_view.hpp#L128[boost/url/decode_view.hpp,window=blank_]>

using difference_type = ptrdiff_t;

Class decode_view::iterator

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L19[boost/url/impl/decode_view.hpp,window=blank_]>

class iterator;

Types

Member Functions

decode_view::iterator::value_type

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L49[boost/url/impl/decode_view.hpp,window=blank_]>

using value_type = char;

decode_view::iterator::reference

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L50[boost/url/impl/decode_view.hpp,window=blank_]>

using reference = char;

decode_view::iterator::pointer

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L51[boost/url/impl/decode_view.hpp,window=blank_]>

using pointer = const void*;

decode_view::iterator::const_reference

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L52[boost/url/impl/decode_view.hpp,window=blank_]>

using const_reference = char;

decode_view::iterator::size_type

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L53[boost/url/impl/decode_view.hpp,window=blank_]>

using size_type = size_t;

decode_view::iterator::difference_type

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L54[boost/url/impl/decode_view.hpp,window=blank_]>

using difference_type = ptrdiff_t;

decode_view::iterator::iterator_category

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L55[boost/url/impl/decode_view.hpp,window=blank_]>

using iterator_category = bidirectional_iterator_tag;

Overload set decode_view::iterator::iterator

Members

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

Function decode_view::iterator::operator=

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L62[boost/url/impl/decode_view.hpp,window=blank_]>

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

Function decode_view::iterator::operator*

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L66[boost/url/impl/decode_view.hpp,window=blank_]>

reference
operator*() const noexcept;

Overload set decode_view::iterator::operator++

Members

iterator&
operator++() noexcept;
  » more...
iterator
operator++(int) noexcept;
  » more...

Overload set decode_view::iterator::operator--

Members

iterator&
operator--() noexcept;
  » more...
iterator
operator--(int) noexcept;
  » more...

Function decode_view::iterator::base

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L108[boost/url/impl/decode_view.hpp,window=blank_]>

const char*
base();

Function decode_view::iterator::operator==

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L114[boost/url/impl/decode_view.hpp,window=blank_]>

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

Function decode_view::iterator::operator!=

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L121[boost/url/impl/decode_view.hpp,window=blank_]>

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

decode_view::const_iterator

iterator

Synopsis

Declared in header </boost/url/decode_view.hpp#L145[boost/url/decode_view.hpp,window=blank_]>

using const_iterator = iterator;

Overload set decode_view::decode_view

Members

Constructor

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

Constructor

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

Function decode_view::empty

Return true if the string is empty

Synopsis

Declared in header </boost/url/decode_view.hpp#L239[boost/url/decode_view.hpp,window=blank_]>

bool
empty() const noexcept;

Description

Example

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

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • bool

Function decode_view::size

Return the number of decoded characters

Synopsis

Declared in header </boost/url/decode_view.hpp#L263[boost/url/decode_view.hpp,window=blank_]>

size_type
size() const noexcept;

Description

Example

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

Effects

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

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • size_type

Function decode_view::begin

Return an iterator to the beginning

Synopsis

Declared in header </boost/url/decode_view.hpp#L282[boost/url/decode_view.hpp,window=blank_]>

iterator
begin() const noexcept;

Description

Example

auto it = this->begin();

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • iterator

Function decode_view::end

Return an iterator to the end

Synopsis

Declared in header </boost/url/decode_view.hpp#L298[boost/url/decode_view.hpp,window=blank_]>

iterator
end() const noexcept;

Description

Example

auto it = this->end();

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • iterator

Function decode_view::front

Return the first character

Synopsis

Declared in header </boost/url/decode_view.hpp#L319[boost/url/decode_view.hpp,window=blank_]>

reference
front() const noexcept;

Description

Example

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

Preconditions

not this->empty()

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • reference

Function decode_view::back

Return the last character

Synopsis

Declared in header </boost/url/decode_view.hpp#L340[boost/url/decode_view.hpp,window=blank_]>

reference
back() const noexcept;

Description

Example

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

Preconditions

not this->empty()

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • reference

Overload set decode_view::starts_with

Members

Checks if the string begins with the given prefix

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

Checks if the string begins with the given prefix

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

Overload set decode_view::ends_with

Members

Checks if the string ends with the given prefix

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

Checks if the string ends with the given prefix

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

Function decode_view::find

Finds the first occurrence of character in this view

Synopsis

Declared in header </boost/url/decode_view.hpp#L420[boost/url/decode_view.hpp,window=blank_]>

const_iterator
find(char ch) const noexcept;

Description

Complexity

Linear.

Exception Safety

Throws nothing.

Return Value

  • const_iterator

Parameters

Name Type

ch

char

Function decode_view::rfind

Finds the first occurrence of character in this view

Synopsis

Declared in header </boost/url/decode_view.hpp#L432[boost/url/decode_view.hpp,window=blank_]>

const_iterator
rfind(char ch) const noexcept;

Description

Complexity

Linear.

Exception Safety

Throws nothing.

Return Value

  • const_iterator

Parameters

Name Type

ch

char

Function decode_view::remove_prefix

Remove the first characters

Synopsis

Declared in header </boost/url/decode_view.hpp#L453[boost/url/decode_view.hpp,window=blank_]>

void
remove_prefix(size_type n);

Description

Example

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

Preconditions

not this->empty()

Complexity

Linear.

Return Value

  • void

Parameters

Name Type

n

size_type

Function decode_view::remove_suffix

Remove the last characters

Synopsis

Declared in header </boost/url/decode_view.hpp#L474[boost/url/decode_view.hpp,window=blank_]>

void
remove_suffix(size_type n);

Description

Example

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

Preconditions

not this->empty()

Complexity

Linear.

Return Value

  • void

Parameters

Name Type

n

size_type

Function decode_view::options

Return the decoding options

Synopsis

Declared in header </boost/url/decode_view.hpp#L479[boost/url/decode_view.hpp,window=blank_]>

encoding_opts
options() const noexcept;

Overload set decode_view::compare

Members

Return the result of comparing to another string

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

Return the result of comparing to another string

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

Friend operator==

Synopsis

Declared in header </boost/url/decode_view.hpp#L578[boost/url/decode_view.hpp,window=blank_]>

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

Friend operator!=

Synopsis

Declared in header </boost/url/decode_view.hpp#L587[boost/url/decode_view.hpp,window=blank_]>

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

Friend operator<

Synopsis

Declared in header </boost/url/decode_view.hpp#L596[boost/url/decode_view.hpp,window=blank_]>

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

Friend operator⇐

Synopsis

Declared in header </boost/url/decode_view.hpp#L605[boost/url/decode_view.hpp,window=blank_]>

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

Friend operator>

Synopsis

Declared in header </boost/url/decode_view.hpp#L614[boost/url/decode_view.hpp,window=blank_]>

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

Friend operator>=

Synopsis

Declared in header </boost/url/decode_view.hpp#L623[boost/url/decode_view.hpp,window=blank_]>

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

Friend operator<<

Synopsis

Declared in header </boost/url/decode_view.hpp#L634[boost/url/decode_view.hpp,window=blank_]>

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

Class pct_string_view

A reference to a valid percent-encoded string

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L73[boost/url/pct_string_view.hpp,window=blank_]>

class pct_string_view
    : public grammar::string_view_base;

Types

Name

Description

const_iterator

The const iterator type

const_pointer

The const pointer type

const_reference

The const reference type

const_reverse_iterator

The const reverse iterator type

difference_type

The difference type

iterator

The iterator type

pointer

The pointer type

reference

The reference type

reverse_iterator

The reverse iterator type

size_type

The size type

traits_type

The character traits

value_type

The value type

Member Functions

Name

Description

at

Access a character

back

Return the last character

begin

Return an iterator to the beginning

cbegin

Return an iterator to the beginning

cend

Return an iterator to the end

compare

Return the result of comparing to another string

contains

Return true if matching characters are found

copy

Copy the characters to another buffer

crbegin

crend

data

Return a pointer to the character buffer

decode

Return the string with percent-decoding

decoded_size

Return the decoded size

empty

Return true if the string is empty

end

Return an iterator to the end

ends_with

Return true if a matching suffix exists

find

Return the position of matching characters

find_first_not_of

Return the position of the first non-match

find_first_of

Return the position of the first match

find_last_not_of

Return the position of the last non-match

find_last_of

Return the position of the last match

front

Return the first character

length

Return the size

max_size

Return the maximum allowed size

operator string

Conversion

operator string_view

Conversion

operator*

Return the string as a range of decoded characters

operator->

operator=

Assignment

operator[]

Access a character

pct_string_view

Constructor (deleted)

Constructor

rbegin

rend

rfind

Return the position of matching characters

size

Return the size

starts_with

Return true if a matching prefix exists

substr

Return a view to part of the string

swap

Swap

Static Data Members

Name

Description

npos

A constant used to represent "no position"

Friends

Description

Objects of this type behave like a core::string_view and have the same interface, but offer an additional invariant: they can only be constructed from strings containing valid percent-escapes. Attempting construction from a string containing invalid or malformed percent escapes results in an exception.

Operators

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

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

Overload set pct_string_view::pct_string_view

Members

Constructor

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

Constructor

constexpr
pct_string_view(const pct_string_view& other) = default;
  » more...
template<
    class String,
    class = enable_if<std::is_convertible<String, core::string_view>::value>::type>
pct_string_view(const String& s);
  » more...

Constructor (deleted)

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

Constructor

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

Constructor

pct_string_view(string_view s);
  » more...

Function pct_string_view::operator=

Assignment

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L263[boost/url/pct_string_view.hpp,window=blank_]>

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

Description

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

Postconditions

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

Complexity

Constant.

Exception Safety

Throws nothing.

other The string to copy.

Return Value

  • ``

Parameters

Name Type

other

``

Friend make_pct_string_view

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L266[boost/url/pct_string_view.hpp,window=blank_]>

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

Function pct_string_view::decoded_size

Return the decoded size

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L287[boost/url/pct_string_view.hpp,window=blank_]>

size_t
decoded_size() const noexcept;

Description

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

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • size_t

Function pct_string_view::operator*

Return the string as a range of decoded characters

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L304[boost/url/pct_string_view.hpp,window=blank_]>

decode_view
operator*() const noexcept;

Description

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • decode_view

Function pct_string_view::decode

Return the string with percent-decoding

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L345[boost/url/pct_string_view.hpp,window=blank_]>

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

Description

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

Example

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

Complexity

Linear in this->size().

Exception Safety

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

Return Value

  • result_type

Parameters

Name Type

opt

encoding_opts

token

``

Function pct_string_view::operator→

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L366[boost/url/pct_string_view.hpp,window=blank_]>

const pct_string_view*
operator->() const noexcept;

Function pct_string_view::swap

Swap

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L378[boost/url/pct_string_view.hpp,window=blank_]>

void
swap(pct_string_view& s) noexcept;

Function make_pct_string_view_unsafe

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L34[boost/url/pct_string_view.hpp,window=blank_]>

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

Function make_pct_string_view

Return a valid percent-encoded string

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L425[boost/url/pct_string_view.hpp,window=blank_]>

result<pct_string_view>
make_pct_string_view(string_view s) noexcept;

Description

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

Complexity

Linear in s.size().

Exception Safety

Throws nothing.

Return Value

  • result

Parameters

Name Type

s

string_view

Function encoded_size

Return the buffer size needed for percent-encoding

Synopsis

Declared in header </boost/url/encode.hpp#L62[boost/url/encode.hpp,window=blank_]>

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

Description

This function returns the exact number of bytes necessary to store the result of applying percent-encoding to the string using the given options and character set. No encoding is actually performed.

Example

assert( encoded_size( "My Stuff", pchars ) == 10 );

Exception Safety

Throws nothing.

Return Value

  • size_t

Parameters

Name Type

s

string_view

unreserved

``

opt

encoding_opts

Overload set encode

Members

Apply percent-encoding to a string

template<class CharSet>
size_t
encode(
    char* dest,
    size_t size,
    string_view s,
    const CharSet& unreserved,
    encoding_opts opt = = {});
  » more...

Return a percent-encoded string

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

Function encode_unsafe

Synopsis

Declared in header </boost/url/encode.hpp#L129[boost/url/encode.hpp,window=blank_]>

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

Overload set operator==

Members

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

Return true if two addresses are equal

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

Return true if two addresses are equal

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

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

bool
operator==(
    const authority_view& a0,
    const authority_view& a1) noexcept;
  » more...
bool
operator==(
    const params_encoded_base::iterator& it0,
    const params_encoded_base::iterator& it1) noexcept;
  » more...

Return the result of comparing two URLs

bool
operator==(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;
  » more...

Overload set operator!=

Members

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

Return true if two addresses are not equal

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

Return true if two addresses are not equal

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

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

bool
operator!=(
    const authority_view& a0,
    const authority_view& a1) noexcept;
  » more...
bool
operator!=(
    const params_encoded_base::iterator& it0,
    const params_encoded_base::iterator& it1) noexcept;
  » more...

Return the result of comparing two URLs

bool
operator!=(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;
  » more...

Overload set operator<

Members

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

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

bool
operator<(
    const authority_view& a0,
    const authority_view& a1) noexcept;
  » more...

Return the result of comparing two URLs

bool
operator<(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;
  » more...

Overload set operator⇐

Members

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

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

bool
operator<=(
    const authority_view& a0,
    const authority_view& a1) noexcept;
  » more...

Return the result of comparing two URLs

bool
operator<=(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;
  » more...

Overload set operator>

Members

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

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

bool
operator>(
    const authority_view& a0,
    const authority_view& a1) noexcept;
  » more...

Return the result of comparing two URLs

bool
operator>(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;
  » more...

Overload set operator>=

Members

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

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

bool
operator>=(
    const authority_view& a0,
    const authority_view& a1) noexcept;
  » more...

Return the result of comparing two URLs

bool
operator>=(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;
  » more...

Overload set operator<<

Members

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

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

Format the address to an output stream.

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

Format the address to an output stream

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

Format the encoded authority to the output stream

ostream&
operator<<(
    ostream& os,
    const authority_view& a);
  » more...

Format to an output stream

ostream&
operator<<(
    ostream& os,
    const segments_encoded_base& ps);
  » more...

Format to an output stream

ostream&
operator<<(
    ostream& os,
    const segments_base& ps);
  » more...

Format to an output stream

ostream&
operator<<(
    ostream& os,
    const params_encoded_base& qp);
  » more...

Format to an output stream

ostream&
operator<<(
    ostream& os,
    const params_base& qp);
  » more...

Format the url to the output stream

ostream&
operator<<(
    ostream& os,
    const url_view_base& u);
  » more...

Class no_value_t

The type of no_value

Synopsis

Declared in header </boost/url/param.hpp#L30[boost/url/param.hpp,window=blank_]>

struct no_value_t;

Class param_pct_view

A query parameter

Synopsis

Declared in header </boost/url/param.hpp#L638[boost/url/param.hpp,window=blank_]>

struct param_pct_view;

Member Functions

Name

Description

operator param

Conversion

operator param_view

operator->

param_pct_view

Construction

Constructor

Data Members

Name

Description

has_value

True if a value is present

key

The key

value

The value

Description

Objects of this type represent a single key and value pair in a query string where a key is always present and may be empty, while the presence of a value is indicated by has_value equal to true. An empty value is distinct from no value. The strings may have percent escapes, and offer an additional invariant: they never contain an invalid percent-encoding. For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted. Keys and values in this object reference external character buffers. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced.

BNF

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

Specification

param_pct_view::key

The key

Synopsis

Declared in header </boost/url/param.hpp#L648[boost/url/param.hpp,window=blank_]>

Description

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

param_pct_view::value

The value

Synopsis

Declared in header </boost/url/param.hpp#L656[boost/url/param.hpp,window=blank_]>

Description

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

param_pct_view::has_value

True if a value is present

Synopsis

Declared in header </boost/url/param.hpp#L664[boost/url/param.hpp,window=blank_]>

bool has_value;

Description

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

Overload set param_pct_view::param_pct_view

Members

Constructor

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

Constructor

param_pct_view(
    pct_string_view key,
    pct_string_view value) noexcept;
  » more...

Constructor

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

Construction

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

Function param_pct_view::operator param

Conversion

Synopsis

Declared in header </boost/url/param.hpp#L840[boost/url/param.hpp,window=blank_]>

operator param() const;

Description

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

Complexity

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

Exception Safety

Calls to allocate may throw.

Return Value

  • param

Function param_pct_view::operator param_view

Synopsis

Declared in header </boost/url/param.hpp#L850[boost/url/param.hpp,window=blank_]>

operator param_view() const noexcept;

Function param_pct_view::operator→

Synopsis

Declared in header </boost/url/param.hpp#L859[boost/url/param.hpp,window=blank_]>

const param_pct_view*
operator->() const noexcept;

Class param_view

A query parameter

Synopsis

Declared in header </boost/url/param.hpp#L404[boost/url/param.hpp,window=blank_]>

struct param_view;

Member Functions

Name

Description

operator param

Conversion

operator->

param_view

Constructor

Data Members

Name

Description

has_value

True if a value is present

key

The key

value

The value

Description

Objects of this type represent a single key and value pair in a query string where a key is always present and may be empty, while the presence of a value is indicated by has_value equal to true. An empty value is distinct from no value. Depending on where the object was obtained, the strings may or may not contain percent escapes. For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted. Keys and values in this object reference external character buffers. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced.

BNF

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

Specification

param_view::key

The key

Synopsis

Declared in header </boost/url/param.hpp#L414[boost/url/param.hpp,window=blank_]>

string_view key;

Description

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

param_view::value

The value

Synopsis

Declared in header </boost/url/param.hpp#L422[boost/url/param.hpp,window=blank_]>

string_view value;

Description

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

param_view::has_value

True if a value is present

Synopsis

Declared in header </boost/url/param.hpp#L430[boost/url/param.hpp,window=blank_]>

bool has_value;

Description

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

Overload set param_view::param_view

Members

Constructor

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

Constructor

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

Constructor

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

Function param_view::operator param

Conversion

Synopsis

Declared in header </boost/url/param.hpp#L554[boost/url/param.hpp,window=blank_]>

operator param();

Description

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

Complexity

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

Exception Safety

Calls to allocate may throw.

Return Value

  • param

Function param_view::operator→

Synopsis

Declared in header </boost/url/param.hpp#L563[boost/url/param.hpp,window=blank_]>

const param_view*
operator->() const noexcept;

no_value

Constant indicating no value in a param

Synopsis

Declared in header </boost/url/param.hpp#L36[boost/url/param.hpp,window=blank_]>

constexpr
const no_value_t no_value;

Class param

A query parameter

Synopsis

Declared in header </boost/url/param.hpp#L75[boost/url/param.hpp,window=blank_]>

struct param;

Member Functions

Name

Description

operator->

operator=

Assignment

param

Constructor

Data Members

Name

Description

has_value

True if a value is present

key

The key

value

The value

Description

Objects of this type represent a single key and value pair in a query string where a key is always present and may be empty, while the presence of a value is indicated by has_value equal to true. An empty value is distinct from no value. Depending on where the object was obtained, the strings may or may not contain percent escapes. For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.

BNF

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

Specification

param::key

The key

Synopsis

Declared in header </boost/url/param.hpp#L85[boost/url/param.hpp,window=blank_]>

string key;

Description

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

param::value

The value

Synopsis

Declared in header </boost/url/param.hpp#L93[boost/url/param.hpp,window=blank_]>

string value;

Description

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

param::has_value

True if a value is present

Synopsis

Declared in header </boost/url/param.hpp#L101[boost/url/param.hpp,window=blank_]>

bool has_value;

Description

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

Overload set param::param

Members

Constructor

param() = default;
  » more...

Constructor

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

Constructor

param(const param& other) = default;
  » more...

Constructor

template<class OptionalString>
param(
    string_view key,
    const OptionalString& value);
  » more...
param(
    string_view key,
    string_view value,
    bool has_value) noexcept;
  » more...

Overload set param::operator=

Members

Assignment

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

Assignment

param&
operator=(const param&) = default;
  » more...

Assignment

param&
operator=(const param_view& other);
  » more...

Assignment

param&
operator=(const param_pct_view& other);
  » more...

Function param::operator→

Synopsis

Declared in header </boost/url/param.hpp#L329[boost/url/param.hpp,window=blank_]>

const param*
operator->() const noexcept;

Enum host_type

Identifies the type of host in a URL.

Synopsis

Declared in header </boost/url/host_type.hpp#L24[boost/url/host_type.hpp,window=blank_]>

enum host_type : int;

Members

Name

Description

none

No host is specified.

name

A host is specified by reg-name.

ipv4

A host is specified by ipv4_address.

ipv6

A host is specified by ipv6_address.

ipvfuture

A host is specified by IPvFuture.

Description

Values of this type are returned by URL views and containers to indicate the type of host present in a URL.

Enumerator host_type::none

No host is specified.

Synopsis

Declared in header </boost/url/host_type.hpp#L32[boost/url/host_type.hpp,window=blank_]>

none

Enumerator host_type::name

A host is specified by reg-name.

Synopsis

Declared in header </boost/url/host_type.hpp#L37[boost/url/host_type.hpp,window=blank_]>

name

Enumerator host_type::ipv4

A host is specified by ipv4_address.

Synopsis

Declared in header </boost/url/host_type.hpp#L42[boost/url/host_type.hpp,window=blank_]>

ipv4

Enumerator host_type::ipv6

A host is specified by ipv6_address.

Synopsis

Declared in header </boost/url/host_type.hpp#L47[boost/url/host_type.hpp,window=blank_]>

ipv6

Enumerator host_type::ipvfuture

A host is specified by IPvFuture.

Synopsis

Declared in header </boost/url/host_type.hpp#L52[boost/url/host_type.hpp,window=blank_]>

ipvfuture

Enum error

Error codes returned the library

Synopsis

Declared in header </boost/url/error.hpp#L22[boost/url/error.hpp,window=blank_]>

enum error : int;

Members

Name

Description

success

The operation completed successfully.

illegal_null

Null encountered in pct-encoded.

illegal_reserved_char

Illegal reserved character in encoded string.

non_canonical

A grammar element was not in canonical form.

bad_pct_hexdig

Bad hexadecimal digit.

incomplete_encoding

The percent-encoded sequence is incomplete.

missing_pct_hexdig

Missing hexadecimal digit.

no_space

No space in output buffer

not_a_base

The URL is not a base URL

Enumerator error::success

The operation completed successfully.

Synopsis

Declared in header </boost/url/error.hpp#L30[boost/url/error.hpp,window=blank_]>

success = 0

Enumerator error::illegal_null

Null encountered in pct-encoded.

Synopsis

Declared in header </boost/url/error.hpp#L35[boost/url/error.hpp,window=blank_]>

illegal_null

Enumerator error::illegal_reserved_char

Illegal reserved character in encoded string.

Synopsis

Declared in header </boost/url/error.hpp#L40[boost/url/error.hpp,window=blank_]>

illegal_reserved_char

Enumerator error::non_canonical

A grammar element was not in canonical form.

Synopsis

Declared in header </boost/url/error.hpp#L45[boost/url/error.hpp,window=blank_]>

non_canonical

Enumerator error::bad_pct_hexdig

Bad hexadecimal digit.

Synopsis

Declared in header </boost/url/error.hpp#L54[boost/url/error.hpp,window=blank_]>

bad_pct_hexdig

Description

This error condition is fatal.

Enumerator error::incomplete_encoding

The percent-encoded sequence is incomplete.

Synopsis

Declared in header </boost/url/error.hpp#L61[boost/url/error.hpp,window=blank_]>

incomplete_encoding

Description

This error condition is fatal.

Enumerator error::missing_pct_hexdig

Missing hexadecimal digit.

Synopsis

Declared in header </boost/url/error.hpp#L68[boost/url/error.hpp,window=blank_]>

missing_pct_hexdig

Description

This error condition is fatal.

Enumerator error::no_space

No space in output buffer

Synopsis

Declared in header </boost/url/error.hpp#L77[boost/url/error.hpp,window=blank_]>

no_space

Description

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

Enumerator error::not_a_base

The URL is not a base URL

Synopsis

Declared in header </boost/url/error.hpp#L82[boost/url/error.hpp,window=blank_]>

not_a_base

Function make_error_code

Synopsis

Declared in header </boost/url/impl/error.hpp#L64[boost/url/impl/error.hpp,window=blank_]>

constexpr
error_code
make_error_code(error ev) noexcept;

Class ipv4_address

An IP version 4 style address.

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L53[boost/url/ipv4_address.hpp,window=blank_]>

class ipv4_address;

Types

Name

Description

bytes_type

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

uint_type

The type used to represent an address as an unsigned integer

Member Functions

Name

Description

ipv4_address

Construct from a string.

Construct from an array of bytes.

Construct from an unsigned integer.

Constructor.

is_loopback

Return true if the address is a loopback address

is_multicast

Return true if the address is a multicast address

is_unspecified

Return true if the address is unspecified

operator=

Copy Assignment.

to_buffer

Write a dotted decimal string representing the address to a buffer

to_bytes

Return the address as bytes, in network byte order.

to_string

Return the address as a string in dotted decimal format

to_uint

Return the address as an unsigned integer.

Static Member Functions

Name

Description

any

Return an address object that represents any address

broadcast

Return an address object that represents the broadcast address

loopback

Return an address object that represents the loopback address

Static Data Members

Name

Description

max_str_len

The number of characters in the longest possible IPv4 string.

Friends

Name

Description

operator!=

Return true if two addresses are not equal

operator<<

operator==

Return true if two addresses are equal

Description

Objects of this type are used to construct, parse, and manipulate IP version 6 addresses.

BNF

IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet

dec-octet   = DIGIT                 ; 0-9
            / %x31-39 DIGIT         ; 10-99
            / "1" 2DIGIT            ; 100-199
            / "2" %x30-34 DIGIT     ; 200-249
            / "25" %x30-35          ; 250-255

ipv4_address::max_str_len

The number of characters in the longest possible IPv4 string.

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L60[boost/url/ipv4_address.hpp,window=blank_]>

constexpr
static
const size_t max_str_len;

Description

The longest ipv4 address string is "255.255.255.255".

ipv4_address::uint_type

The type used to represent an address as an unsigned integer

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L66[boost/url/ipv4_address.hpp,window=blank_]>

using uint_type = uint_least32_t;

ipv4_address::bytes_type

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

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L71[boost/url/ipv4_address.hpp,window=blank_]>

using bytes_type = array<unsigned char, 4>;

Overload set ipv4_address::ipv4_address

Members

Constructor.

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

Constructor.

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

Construct from an unsigned integer.

ipv4_address(uint_type u) noexcept;
  » more...

Construct from an array of bytes.

ipv4_address(const bytes_type& bytes) noexcept;
  » more...

Construct from a string.

ipv4_address(string_view s);
  » more...

Function ipv4_address::operator=

Copy Assignment.

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L85[boost/url/ipv4_address.hpp,window=blank_]>

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

Function ipv4_address::to_bytes

Return the address as bytes, in network byte order.

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L153[boost/url/ipv4_address.hpp,window=blank_]>

bytes_type
to_bytes() const noexcept;

Function ipv4_address::to_uint

Return the address as an unsigned integer.

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L159[boost/url/ipv4_address.hpp,window=blank_]>

uint_type
to_uint() const noexcept;

Function ipv4_address::to_string

Return the address as a string in dotted decimal format

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L196[boost/url/ipv4_address.hpp,window=blank_]>

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

Description

When called with no arguments, the return type is std::string. Otherwise, the return type and style of output is determined by which string token is passed.

Example

assert( ipv4_address(0x01020304).to_string() == "1.2.3.4" );

Complexity

Constant.

Exception Safety

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

Return Value

  • result_type

Parameters

Name Type

token

``

Function ipv4_address::to_buffer

Write a dotted decimal string representing the address to a buffer

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L218[boost/url/ipv4_address.hpp,window=blank_]>

string_view
to_buffer(
    char* dest,
    size_t dest_size) const;

Description

The resulting buffer is not null-terminated.

Return Value

  • string_view

Parameters

Name Type

dest

``

dest_size

size_t

Function ipv4_address::is_loopback

Return true if the address is a loopback address

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L226[boost/url/ipv4_address.hpp,window=blank_]>

bool
is_loopback() const noexcept;

Function ipv4_address::is_unspecified

Return true if the address is unspecified

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L232[boost/url/ipv4_address.hpp,window=blank_]>

bool
is_unspecified() const noexcept;

Function ipv4_address::is_multicast

Return true if the address is a multicast address

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L238[boost/url/ipv4_address.hpp,window=blank_]>

bool
is_multicast() const noexcept;

Friend operator==

Return true if two addresses are equal

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L243[boost/url/ipv4_address.hpp,window=blank_]>

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

Friend operator!=

Return true if two addresses are not equal

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L254[boost/url/ipv4_address.hpp,window=blank_]>

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

Function ipv4_address::any

Return an address object that represents any address

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L265[boost/url/ipv4_address.hpp,window=blank_]>

static
ipv4_address
any() noexcept;

Function ipv4_address::loopback

Return an address object that represents the loopback address

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L274[boost/url/ipv4_address.hpp,window=blank_]>

static
ipv4_address
loopback() noexcept;

Function ipv4_address::broadcast

Return an address object that represents the broadcast address

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L283[boost/url/ipv4_address.hpp,window=blank_]>

static
ipv4_address
broadcast() noexcept;

Friend operator<<

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L291[boost/url/ipv4_address.hpp,window=blank_]>

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

Function parse_ipv4_address

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

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L337[boost/url/ipv4_address.hpp,window=blank_]>

result<ipv4_address>
parse_ipv4_address(string_view s) noexcept;

Class ipv6_address

An IP version 6 style address.

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L64[boost/url/ipv6_address.hpp,window=blank_]>

class ipv6_address;

Types

Name

Description

bytes_type

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

Member Functions

Name

Description

ipv6_address

Construct from a string.

Construct from an IPv4 address.

Construct from an array of bytes.

Constructor.

is_loopback

Return true if the address is a loopback address

is_unspecified

Return true if the address is unspecified

is_v4_mapped

Return true if the address is a mapped IPv4 address

operator=

Copy Assignment

to_buffer

Write a dotted decimal string representing the address to a buffer

to_bytes

Return the address as bytes, in network byte order

to_string

Return the address as a string.

Static Member Functions

Name

Description

loopback

Return an address object that represents the loopback address

Static Data Members

Name

Description

max_str_len

The number of characters in the longest possible IPv6 string.

Friends

Name

Description

operator!=

Return true if two addresses are not equal

operator<<

operator==

Return true if two addresses are equal

Description

Objects of this type are used to construct, parse, and manipulate IP version 6 addresses.

BNF

IPv6address =                            6( h16 ":" ) ls32
            /                       "::" 5( h16 ":" ) ls32
            / [               h16 ] "::" 4( h16 ":" ) ls32
            / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
            / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
            / [ *3( h16 ":" ) h16 ] "::"    h16 ":"   ls32
            / [ *4( h16 ":" ) h16 ] "::"              ls32
            / [ *5( h16 ":" ) h16 ] "::"              h16
            / [ *6( h16 ":" ) h16 ] "::"

ls32        = ( h16 ":" h16 ) / IPv4address
            ; least-significant 32 bits of address

h16         = 1*4HEXDIG
            ; 16 bits of address represented in hexadecimal

ipv6_address::max_str_len

The number of characters in the longest possible IPv6 string.

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L81[boost/url/ipv6_address.hpp,window=blank_]>

constexpr
static
const size_t max_str_len;

Description

The longest IPv6 address is:

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

ipv6_address::bytes_type

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

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L89[boost/url/ipv6_address.hpp,window=blank_]>

using bytes_type = array<unsigned char, 16>;

Description

Octets are stored in network byte order.

Overload set ipv6_address::ipv6_address

Members

Constructor.

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

Constructor.

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

Construct from an array of bytes.

ipv6_address(const bytes_type& bytes) noexcept;
  » more...

Construct from an IPv4 address.

ipv6_address(const ipv4_address& addr) noexcept;
  » more...

Construct from a string.

ipv6_address(string_view s);
  » more...

Function ipv6_address::operator=

Copy Assignment

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L112[boost/url/ipv6_address.hpp,window=blank_]>

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

Function ipv6_address::to_bytes

Return the address as bytes, in network byte order

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L175[boost/url/ipv6_address.hpp,window=blank_]>

bytes_type
to_bytes() const noexcept;

Function ipv6_address::to_string

Return the address as a string.

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L223[boost/url/ipv6_address.hpp,window=blank_]>

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

Description

The returned string does not contain surrounding square brackets. When called with no arguments, the return type is std::string. Otherwise, the return type and style of output is determined by which string token is passed.

Example

ipv6_address::bytes_type b = {{
        0, 1, 0, 2, 0, 3, 0, 4,
        0, 5, 0, 6, 0, 7, 0, 8 }};
ipv6_address a(b);
assert(a.to_string() == "1:2:3:4:5:6:7:8");
assert( ipv4_address(0x01020304).to_string() == "1.2.3.4" );

Complexity

Constant.

Exception Safety

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

Return Value

  • result_type

Parameters

Name Type

token

``

Function ipv6_address::to_buffer

Write a dotted decimal string representing the address to a buffer

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L245[boost/url/ipv6_address.hpp,window=blank_]>

string_view
to_buffer(
    char* dest,
    size_t dest_size) const;

Description

The resulting buffer is not null-terminated.

Return Value

  • string_view

Parameters

Name Type

dest

``

dest_size

size_t

Function ipv6_address::is_unspecified

Return true if the address is unspecified

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L261[boost/url/ipv6_address.hpp,window=blank_]>

bool
is_unspecified() const noexcept;

Description

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

Return Value

  • bool

Function ipv6_address::is_loopback

Return true if the address is a loopback address

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L275[boost/url/ipv6_address.hpp,window=blank_]>

bool
is_loopback() const noexcept;

Description

The unicast address 0:0:0:0:0:0:0:1 is called the loopback address. It may be used by a node to send an IPv6 packet to itself.

Return Value

  • bool

Function ipv6_address::is_v4_mapped

Return true if the address is a mapped IPv4 address

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L288[boost/url/ipv6_address.hpp,window=blank_]>

bool
is_v4_mapped() const noexcept;

Description

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

Return Value

  • bool

Friend operator==

Return true if two addresses are equal

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L293[boost/url/ipv6_address.hpp,window=blank_]>

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

Friend operator!=

Return true if two addresses are not equal

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L304[boost/url/ipv6_address.hpp,window=blank_]>

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

Function ipv6_address::loopback

Return an address object that represents the loopback address

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L324[boost/url/ipv6_address.hpp,window=blank_]>

static
ipv6_address
loopback() noexcept;

Description

The unicast address 0:0:0:0:0:0:0:1 is called the loopback address. It may be used by a node to send an IPv6 packet to itself.

Return Value

  • ipv6_address

Friend operator<<

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L329[boost/url/ipv6_address.hpp,window=blank_]>

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

Function parse_ipv6_address

Parse a string containing an IPv6 address.

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L391[boost/url/ipv6_address.hpp,window=blank_]>

result<ipv6_address>
parse_ipv6_address(string_view s) noexcept;

Description

This function attempts to parse the string as an IPv6 address and returns a result containing the address upon success, or an error code if the string does not contain a valid IPv6 address.

Exception Safety

Throws nothing.

Return Value

  • result

Parameters

Name Type

s

string_view

Enum scheme

Identifies a known URL scheme

Synopsis

Declared in header </boost/url/scheme.hpp#L33[boost/url/scheme.hpp,window=blank_]>

enum scheme : unsigned short;

Members

Name

Description

none

Indicates that no scheme is present

unknown

Indicates the scheme is not a well-known scheme

ftp

File Transfer Protocol (FTP)

file

File URI Scheme

http

The Hypertext Transfer Protocol URI Scheme

https

The Secure Hypertext Transfer Protocol URI Scheme

ws

The WebSocket URI Scheme

wss

The Secure WebSocket URI Scheme

Description

Specification

Enumerator scheme::none

Indicates that no scheme is present

Synopsis

Declared in header </boost/url/scheme.hpp#L37[boost/url/scheme.hpp,window=blank_]>

none = 0

Enumerator scheme::unknown

Indicates the scheme is not a well-known scheme

Synopsis

Declared in header </boost/url/scheme.hpp#L41[boost/url/scheme.hpp,window=blank_]>

unknown

Enumerator scheme::ftp

File Transfer Protocol (FTP)

Synopsis

Declared in header </boost/url/scheme.hpp#L55[boost/url/scheme.hpp,window=blank_]>

ftp

Description

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

Specification

Enumerator scheme::file

File URI Scheme

Synopsis

Declared in header </boost/url/scheme.hpp#L68[boost/url/scheme.hpp,window=blank_]>

file

Description

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

Enumerator scheme::http

The Hypertext Transfer Protocol URI Scheme

Synopsis

Declared in header </boost/url/scheme.hpp#L80[boost/url/scheme.hpp,window=blank_]>

http

Description

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

Enumerator scheme::https

The Secure Hypertext Transfer Protocol URI Scheme

Synopsis

Declared in header </boost/url/scheme.hpp#L93[boost/url/scheme.hpp,window=blank_]>

https

Description

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

Enumerator scheme::ws

The WebSocket URI Scheme

Synopsis

Declared in header </boost/url/scheme.hpp#L105[boost/url/scheme.hpp,window=blank_]>

ws

Description

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

Enumerator scheme::wss

The Secure WebSocket URI Scheme

Synopsis

Declared in header </boost/url/scheme.hpp#L118[boost/url/scheme.hpp,window=blank_]>

wss

Description

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

Function string_to_scheme

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

Synopsis

Declared in header </boost/url/scheme.hpp#L141[boost/url/scheme.hpp,window=blank_]>

scheme
string_to_scheme(string_view s) noexcept;

Description

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

BNF

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

Specification

Return Value

  • scheme

Parameters

Name Type

s

string_view

Function to_string

Return the normalized string for a known scheme

Synopsis

Declared in header </boost/url/scheme.hpp#L151[boost/url/scheme.hpp,window=blank_]>

string_view
to_string(scheme s) noexcept;

Function default_port

Return the default port for a known scheme

Synopsis

Declared in header </boost/url/scheme.hpp#L174[boost/url/scheme.hpp,window=blank_]>

uint16_t
default_port(scheme s) noexcept;

Description

This function returns the default port for the known schemes. If the value does not represent a known scheme or the scheme does not represent a protocol, the function returns zero. The following ports are returned by the function:

Return Value

  • uint16_t

Parameters

Name Type

s

scheme

Class url_view

A non-owning reference to a valid URL

Synopsis

Declared in header </boost/url/url_view.hpp#L74[boost/url/url_view.hpp,window=blank_]>

class url_view
    : public url_view_base;

Member Functions

Name

Description

authority

Return the authority

buffer

Return the url string

compare

Return the result of comparing this with another url

data

Return a pointer to the url's character buffer

digest

empty

Return true if the url is empty

encoded_authority

Return the authority.

encoded_fragment

Return the fragment

encoded_host

Return the host

encoded_host_address

Return the host

encoded_host_and_port

Return the host and port

encoded_host_name

Return the host name

encoded_origin

Return the origin

encoded_params

Return the query as a container of parameters

encoded_password

Return the password

encoded_path

Return the path

encoded_query

Return the query

encoded_resource

Return the resource

encoded_segments

Return the path as a container of segments

encoded_target

Return the target

encoded_user

Return the user

encoded_userinfo

Return the userinfo

encoded_zone_id

Return the IPv6 Zone ID

fragment

Return the fragment

has_authority

Return true if an authority is present

has_fragment

Return true if a fragment is present

has_password

Return true if a password is present

has_port

Return true if a port is present

has_query

Return true if a query is present

has_scheme

Return true a scheme is present

has_userinfo

Return true if a userinfo is present

host

Return the host

host_address

Return the host

host_ipv4_address

Return the host IPv4 address

host_ipv6_address

Return the host IPv6 address

host_ipvfuture

Return the host IPvFuture address

host_name

Return the host name

host_type

Return the host type

is_path_absolute

Return true if the path is absolute

operator string_view

Return the URL as a core::string_view

operator=

Assignment

params

Return the query as a container of parameters

password

Return the password

path

Return the path

persist

Return a shared, persistent copy of the url

port

Return the port

port_number

Return the port

query

Return the query

scheme

Return the scheme

scheme_id

Return the scheme

segments

Return the path as a container of segments

size

Return the number of characters in the url

url_view

Constructor

user

Return the user

userinfo

Return the userinfo

zone_id

Return the IPv6 Zone ID

~url_view

Destructor

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Friends

Name

Description

operator!=

Return the result of comparing two URLs

operator<

Return the result of comparing two URLs

operator<<

operator<=

Return the result of comparing two URLs

operator==

Return the result of comparing two URLs

operator>

Return the result of comparing two URLs

operator>=

Return the result of comparing two URLs

Description

Objects of this type represent valid URL strings constructed from a parsed, external character buffer whose storage is managed by the caller. That is, it acts like a core::string_view in terms of ownership. The caller is responsible for ensuring that the lifetime of the underlying character buffer extends until it is no longer referenced.

Example 1

Construction from a string parses the input as a URI-reference and throws an exception on error. Upon success, the constructed object points to the passed character buffer; ownership is not transferred.

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

Example 2

Parsing functions like parse_uri_reference return a result containing either a valid url_view upon succcess, otherwise they contain an error. The error can be converted to an exception by the caller if desired:

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

BNF

URI-reference = URI / relative-ref

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

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

Function url_view::~url_view

Destructor

Synopsis

Declared in header </boost/url/url_view.hpp#L110[boost/url/url_view.hpp,window=blank_]>

~url_view() = default;

Description

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

Return Value

  • void

Overload set url_view::url_view

Members

Constructor

url_view() noexcept = default;
  » more...

Constructor

url_view(string_view s);
  » more...
template<
    class String,
    class = enable_if<std::is_convertible<String, core::string_view>::value && !std::is_convertible<String *, url_view_base *>::value>::type>
url_view(const String& s);
  » more...

Constructor

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

Constructor

url_view(const url_view_base& other) noexcept;
  » more...

Overload set url_view::operator=

Members

Assignment

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

Assignment

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

Function url_view::max_size

Return the maximum number of characters possible

Synopsis

Declared in header </boost/url/url_view.hpp#L331[boost/url/url_view.hpp,window=blank_]>

constexpr
static
size_t
max_size() noexcept;

Description

This represents the largest number of characters that are possible in a url, not including any null terminator.

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • size_t

Class authority_view

A non-owning reference to a valid authority

Synopsis

Declared in header </boost/url/authority_view.hpp#L82[boost/url/authority_view.hpp,window=blank_]>

class authority_view;

Member Functions

Name

Description

authority_view

Construct from a string.

Constructor

buffer

Return the complete authority

compare

Return the result of comparing this with another authority

data

Return a pointer to the first character

empty

Return true if the authority is empty

encoded_host

Return the host

encoded_host_address

Return the host

encoded_host_and_port

Return the host and port

encoded_host_name

Return the host name

encoded_password

Return the password

encoded_user

Return the user

encoded_userinfo

Return the userinfo

has_password

Return true if a password is present

has_port

Return true if a port is present

has_userinfo

Return true if a userinfo is present

host

Return the host

host_address

Return the host

host_ipv4_address

Return the host IPv4 address

host_ipv6_address

Return the host IPv6 address

host_ipvfuture

Return the host IPvFuture address

host_name

Return the host name

host_type

Return the host type

operator=

Assignment

password

Return the password

port

Return the port

port_number

Return the port

size

Return the number of characters in the authority

user

Return the user

userinfo

Return the userinfo

~authority_view

Destructor

Friends

Name

Description

operator!=

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

operator<

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

operator<<

operator<=

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

operator==

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

operator>

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

operator>=

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

Description

Objects of this type represent valid authority strings constructed from a parsed, external character buffer whose storage is managed by the caller. That is, it acts like a core::string_view in terms of ownership. The caller is responsible for ensuring that the lifetime of the underlying character buffer extends until it is no longer referenced.

Example 1

Construction from a string parses the input as an authority and throws an exception on error. Upon success, the constructed object points to the passed character buffer; ownership is not transferred.

authority_view a( "user:pass@www.example.com:8080" );

Example 2

The parsing function parse_authority returns a result containing either a valid authority_view upon succcess, otherwise it contain an error. The error can be converted to an exception by the caller if desired:

system::result< authority_view > rv = parse_authority( "user:pass@www.example.com:8080" );

BNF

authority     = [ userinfo "@" ] host [ ":" port ]

userinfo      = user [ ":" [ password ] ]

user          = *( unreserved / pct-encoded / sub-delims )
password      = *( unreserved / pct-encoded / sub-delims / ":" )

host          = IP-literal / IPv4address / reg-name

port          = *DIGIT

Specification

Function authority_view::~authority_view

Destructor

Synopsis

Declared in header </boost/url/authority_view.hpp#L106[boost/url/authority_view.hpp,window=blank_]>

virtual
~authority_view();

Overload set authority_view::authority_view

Members

Constructor

authority_view() noexcept;
  » more...

Construct from a string.

authority_view(string_view s);
  » more...

Constructor

authority_view(const authority_view&) noexcept = default;
  » more...

Function authority_view::operator=

Assignment

Synopsis

Declared in header </boost/url/authority_view.hpp#L168[boost/url/authority_view.hpp,window=blank_]>

authority_view&
operator=(const authority_view&) noexcept = default;

Function authority_view::size

Return the number of characters in the authority

Synopsis

Declared in header </boost/url/authority_view.hpp#L191[boost/url/authority_view.hpp,window=blank_]>

size_t
size() const noexcept;

Description

This function returns the number of characters in the authority.

Example

assert( authority_view( "user:pass@www.example.com:8080" ).size() == 30 );

Exception Safety

Throws nothing.

Return Value

  • size_t

Function authority_view::empty

Return true if the authority is empty

Synopsis

Declared in header </boost/url/authority_view.hpp#L210[boost/url/authority_view.hpp,window=blank_]>

bool
empty() const noexcept;

Description

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

Example

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

Exception Safety

Throws nothing.

Return Value

  • bool

Function authority_view::data

Return a pointer to the first character

Synopsis

Declared in header </boost/url/authority_view.hpp#L225[boost/url/authority_view.hpp,window=blank_]>

const char*
data() const noexcept;

Description

This function returns a pointer to the beginning of the view, which is not guaranteed to be null-terminated.

Exception Safety

Throws nothing.

Return Value

  • ``

Function authority_view::buffer

Return the complete authority

Synopsis

Declared in header </boost/url/authority_view.hpp#L253[boost/url/authority_view.hpp,window=blank_]>

string_view
buffer() const noexcept;

Description

This function returns the authority as a percent-encoded string.

Example

assert( parse_authority( "www.example.com" ).value().buffer() == "www.example.com" );

BNF

authority   = [ userinfo "@" ] host [ ":" port ]

Exception Safety

Throws nothing.

Specification

Return Value

  • string_view

Function authority_view::has_userinfo

Return true if a userinfo is present

Synopsis

Declared in header </boost/url/authority_view.hpp#L302[boost/url/authority_view.hpp,window=blank_]>

bool
has_userinfo() const noexcept;

Description

This function returns true if this contains a userinfo.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

userinfo    = user [ ":" [ password ] ]

authority   = [ userinfo "@" ] host [ ":" port ]

Return Value

  • bool

Function authority_view::userinfo

Return the userinfo

Synopsis

Declared in header </boost/url/authority_view.hpp#L346[boost/url/authority_view.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
userinfo(StringToken&& token) const;

Description

If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" );

Complexity

Linear in this->userinfo().size().

Exception Safety

Calls to allocate may throw.

BNF

userinfo    = user [ ":" [ password ] ]

authority   = [ userinfo "@" ] host [ ":" port ]

Return Value

  • result_type

Parameters

Name Type

token

``

Function authority_view::encoded_userinfo

Return the userinfo

Synopsis

Declared in header </boost/url/authority_view.hpp#L396[boost/url/authority_view.hpp,window=blank_]>

pct_string_view
encoded_userinfo() const noexcept;

Description

If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" );

Complexity

Constant.

Exception Safety

Throws nothing

BNF

userinfo    = user [ ":" [ password ] ]

authority   = [ userinfo "@" ] host [ ":" port ]

Return Value

  • pct_string_view

Function authority_view::user

Return the user

Synopsis

Declared in header </boost/url/authority_view.hpp#L443[boost/url/authority_view.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
user(StringToken&& token) const;

Description

If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );

Complexity

Linear in this->user().size().

Exception Safety

Calls to allocate may throw.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

Return Value

  • result_type

Parameters

Name Type

token

``

Function authority_view::encoded_user

Return the user

Synopsis

Declared in header </boost/url/authority_view.hpp#L494[boost/url/authority_view.hpp,window=blank_]>

pct_string_view
encoded_user() const noexcept;

Description

If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

Return Value

  • pct_string_view

Function authority_view::has_password

Return true if a password is present

Synopsis

Declared in header </boost/url/authority_view.hpp#L535[boost/url/authority_view.hpp,window=blank_]>

bool
has_password() const noexcept;

Description

This function returns true if the userinfo is present and contains a password.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

Return Value

  • bool

Function authority_view::password

Return the password

Synopsis

Declared in header </boost/url/authority_view.hpp#L580[boost/url/authority_view.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
password(StringToken&& token) const;

Description

If present, this function returns a string representing the password (which may be an empty string). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" );

Complexity

Linear in this->password().size().

Exception Safety

Calls to allocate may throw.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

Return Value

  • result_type

Parameters

Name Type

token

``

Function authority_view::encoded_password

Return the password

Synopsis

Declared in header </boost/url/authority_view.hpp#L627[boost/url/authority_view.hpp,window=blank_]>

pct_string_view
encoded_password() const noexcept;

Description

This function returns the password portion of the userinfo as a percent-encoded string.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

Return Value

  • pct_string_view

Function authority_view::host_type

Return the host type

Synopsis

Declared in header </boost/url/authority_view.hpp#L662[boost/url/authority_view.hpp,window=blank_]>

host_type
host_type() const noexcept;

Description

This function returns one of the following constants representing the type of host present.

Example

assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );

Complexity

Constant.

Exception Safety

Throws nothing.

Specification

Return Value

  • host_type

Function authority_view::host

Return the host

Synopsis

Declared in header </boost/url/authority_view.hpp#L701[boost/url/authority_view.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
host(StringToken&& token) const;

Description

This function returns the host portion of the authority as a string, or the empty string if there is no authority. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" );

Complexity

Linear in this->host().size().

Exception Safety

Calls to allocate may throw.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

Return Value

  • result_type

Parameters

Name Type

token

``

Function authority_view::encoded_host

Return the host

Synopsis

Declared in header </boost/url/authority_view.hpp#L743[boost/url/authority_view.hpp,window=blank_]>

pct_string_view
encoded_host() const noexcept;

Description

This function returns the host portion of the authority as a string, or the empty string if there is no authority. The returned string may contain percent escapes.

Example

assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

Return Value

  • pct_string_view

Function authority_view::host_address

Return the host

Synopsis

Declared in header </boost/url/authority_view.hpp#L796[boost/url/authority_view.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
host_address(StringToken&& token) const;

Description

The value returned by this function depends on the type of host returned from the function host_type.

  • If the type is host_type::ipv4, then the IPv4 address string is returned.

  • If the type is host_type::ipv6, then the IPv6 address string is returned, without any enclosing brackets.

  • If the type is host_type::ipvfuture, then the IPvFuture address string is returned, without any enclosing brackets.

  • If the type is host_type::name, then the host name string is returned. Any percent-escapes in the string are decoded first.

  • If the type is host_type::none, then an empty string is returned.

Example

assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" );

Complexity

Linear in this->host_address().size().

Exception Safety

Calls to allocate may throw.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

Return Value

  • result_type

Parameters

Name Type

token

``

Function authority_view::encoded_host_address

Return the host

Synopsis

Declared in header </boost/url/authority_view.hpp#L857[boost/url/authority_view.hpp,window=blank_]>

pct_string_view
encoded_host_address() const noexcept;

Description

The value returned by this function depends on the type of host returned from the function host_type.

  • If the type is host_type::ipv4, then the IPv4 address string is returned.

  • If the type is host_type::ipv6, then the IPv6 address string is returned, without any enclosing brackets.

  • If the type is host_type::ipvfuture, then the IPvFuture address string is returned, without any enclosing brackets.

  • If the type is host_type::name, then the host name string is returned. Any percent-escapes in the string are decoded first.

  • If the type is host_type::none, then an empty string is returned. The returned string may contain percent escapes.

Example

assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

Return Value

  • pct_string_view

Function authority_view::host_ipv4_address

Return the host IPv4 address

Synopsis

Declared in header </boost/url/authority_view.hpp#L896[boost/url/authority_view.hpp,window=blank_]>

ipv4_address
host_ipv4_address() const noexcept;

Description

If the host type is host_type::ipv4, this function returns the address as a value of type ipv4_address. Otherwise, if the host type is not an IPv4 address, it returns a default-constructed value which is equal to the unspecified address "0.0.0.0".

Example

assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet

dec-octet   = DIGIT                 ; 0-9
            / %x31-39 DIGIT         ; 10-99
            / "1" 2DIGIT            ; 100-199
            / "2" %x30-34 DIGIT     ; 200-249
            / "25" %x30-35          ; 250-255

Specification

Return Value

  • ipv4_address

Function authority_view::host_ipv6_address

Return the host IPv6 address

Synopsis

Declared in header </boost/url/authority_view.hpp#L943[boost/url/authority_view.hpp,window=blank_]>

ipv6_address
host_ipv6_address() const noexcept;

Description

If the host type is host_type::ipv6, this function returns the address as a value of type ipv6_address. Otherwise, if the host type is not an IPv6 address, it returns a default-constructed value which is equal to the unspecified address "0:0:0:0:0:0:0:0".

Example

assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

IPv6address =                            6( h16 ":" ) ls32
            /                       "::" 5( h16 ":" ) ls32
            / [               h16 ] "::" 4( h16 ":" ) ls32
            / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
            / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
            / [ *3( h16 ":" ) h16 ] "::"    h16 ":"   ls32
            / [ *4( h16 ":" ) h16 ] "::"              ls32
            / [ *5( h16 ":" ) h16 ] "::"              h16
            / [ *6( h16 ":" ) h16 ] "::"

ls32        = ( h16 ":" h16 ) / IPv4address
            ; least-significant 32 bits of address

h16         = 1*4HEXDIG
            ; 16 bits of address represented in hexadecimal

Specification

Return Value

  • ipv6_address

Function authority_view::host_ipvfuture

Return the host IPvFuture address

Synopsis

Declared in header </boost/url/authority_view.hpp#L975[boost/url/authority_view.hpp,window=blank_]>

string_view
host_ipvfuture() const noexcept;

Description

If the host type is host_type::ipvfuture, this function returns the address as a string. Otherwise, if the host type is not an IPvFuture address, it returns an empty string.

Example

assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

IPvFuture  = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )

Specification

Return Value

  • string_view

Function authority_view::host_name

Return the host name

Synopsis

Declared in header </boost/url/authority_view.hpp#L1013[boost/url/authority_view.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
host_name(StringToken&& token) const;

Description

If the host type is host_type::name, this function returns the name as a string. Otherwise, if the host type is not an name, it returns an empty string. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" );

Complexity

Linear in this->host_name().size().

Exception Safety

Calls to allocate may throw.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

Return Value

  • result_type

Parameters

Name Type

token

``

Function authority_view::encoded_host_name

Return the host name

Synopsis

Declared in header </boost/url/authority_view.hpp#L1057[boost/url/authority_view.hpp,window=blank_]>

pct_string_view
encoded_host_name() const noexcept;

Description

If the host type is host_type::name, this function returns the name as a string. Otherwise, if the host type is not an name, it returns an empty string. The returned string may contain percent escapes.

Example

assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

Return Value

  • pct_string_view

Function authority_view::has_port

Return true if a port is present

Synopsis

Declared in header </boost/url/authority_view.hpp#L1098[boost/url/authority_view.hpp,window=blank_]>

bool
has_port() const noexcept;

Description

This function returns true if an authority is present and contains a port.

Example

assert( url_view( "wss://www.example.com:443" ).has_port() );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

authority   = [ userinfo "@" ] host [ ":" port ]

port        = *DIGIT

Specification

Return Value

  • bool

Function authority_view::port

Return the port

Synopsis

Declared in header </boost/url/authority_view.hpp#L1133[boost/url/authority_view.hpp,window=blank_]>

string_view
port() const noexcept;

Description

If present, this function returns a string representing the port (which may be empty). Otherwise it returns an empty string.

Example

assert( url_view( "http://localhost.com:8080" ).port() == "8080" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

port        = *DIGIT

Specification

Return Value

  • string_view

Function authority_view::port_number

Return the port

Synopsis

Declared in header </boost/url/authority_view.hpp#L1168[boost/url/authority_view.hpp,window=blank_]>

uint16_t
port_number() const noexcept;

Description

If a port is present and the numerical value is representable, it is returned as an unsigned integer. Otherwise, the number zero is returned.

Example

assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

port        = *DIGIT

Specification

Return Value

  • uint16_t

Function authority_view::encoded_host_and_port

Return the host and port

Synopsis

Declared in header </boost/url/authority_view.hpp#L1207[boost/url/authority_view.hpp,window=blank_]>

pct_string_view
encoded_host_and_port() const noexcept;

Description

If an authority is present, this function returns the host and optional port as a string, which may be empty. Otherwise it returns an empty string. The returned string may contain percent escapes.

Example

assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

authority   = [ userinfo "@" ] host [ ":" port ]

Return Value

  • pct_string_view

Function authority_view::compare

Return the result of comparing this with another authority

Synopsis

Declared in header </boost/url/authority_view.hpp#L1232[boost/url/authority_view.hpp,window=blank_]>

int
compare(const authority_view& other) const noexcept;

Description

This function compares two authorities according to Syntax-Based comparison algorithm.

Exception Safety

Throws nothing.

Return Value

  • int

Parameters

Name Type

other

``

Friend operator==

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

Synopsis

Declared in header </boost/url/authority_view.hpp#L1246[boost/url/authority_view.hpp,window=blank_]>

friend
bool
operator==(
    const authority_view& a0,
    const authority_view& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

Friend operator!=

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

Synopsis

Declared in header </boost/url/authority_view.hpp#L1266[boost/url/authority_view.hpp,window=blank_]>

friend
bool
operator!=(
    const authority_view& a0,
    const authority_view& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

Friend operator<

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

Synopsis

Declared in header </boost/url/authority_view.hpp#L1286[boost/url/authority_view.hpp,window=blank_]>

friend
bool
operator<(
    const authority_view& a0,
    const authority_view& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

Friend operator⇐

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

Synopsis

Declared in header </boost/url/authority_view.hpp#L1306[boost/url/authority_view.hpp,window=blank_]>

friend
bool
operator<=(
    const authority_view& a0,
    const authority_view& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

Friend operator>

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

Synopsis

Declared in header </boost/url/authority_view.hpp#L1326[boost/url/authority_view.hpp,window=blank_]>

friend
bool
operator>(
    const authority_view& a0,
    const authority_view& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

Friend operator>=

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

Synopsis

Declared in header </boost/url/authority_view.hpp#L1346[boost/url/authority_view.hpp,window=blank_]>

friend
bool
operator>=(
    const authority_view& a0,
    const authority_view& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

Friend operator<<

Synopsis

Declared in header </boost/url/authority_view.hpp#L1358[boost/url/authority_view.hpp,window=blank_]>

friend
ostream&
operator<<(
    ostream& os,
    const authority_view& a);

Function parse_authority

Parse an authority

Synopsis

Declared in header </boost/url/authority_view.hpp#L1432[boost/url/authority_view.hpp,window=blank_]>

result<authority_view>
parse_authority(string_view s) noexcept;

Description

This function parses a string according to the authority grammar below, and returns an authority_view referencing the string. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the string extends until the view is no longer being accessed.

BNF

authority     = [ userinfo "@" ] host [ ":" port ]

userinfo      = user [ ":" [ password ] ]

user          = *( unreserved / pct-encoded / sub-delims )
password      = *( unreserved / pct-encoded / sub-delims / ":" )

host          = IP-literal / IPv4address / reg-name

port          = *DIGIT

Exception Safety

Throws nothing.

Specification

Return Value

  • result

Parameters

Name Type

s

string_view

Class ignore_case_t

Synopsis

Declared in header </boost/url/ignore_case.hpp#L19[boost/url/ignore_case.hpp,window=blank_]>

struct ignore_case_t;

ignore_case

Synopsis

Declared in header </boost/url/ignore_case.hpp#L31[boost/url/ignore_case.hpp,window=blank_]>

constexpr
const ignore_case_t ignore_case;

Class ignore_case_param

An optional parameter to determine case-sensitivity

Synopsis

Declared in header </boost/url/ignore_case.hpp#L46[boost/url/ignore_case.hpp,window=blank_]>

class ignore_case_param;

Member Functions

Name

Description

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.

Overload set ignore_case_param::ignore_case_param

Members

Constructor

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

Constructor

constexpr
ignore_case_param(ignore_case_t) noexcept;
  » more...

Function ignore_case_param::operator bool

True if an algorithm should ignore case

Synopsis

Declared in header </boost/url/ignore_case.hpp#L108[boost/url/ignore_case.hpp,window=blank_]>

operator bool() const noexcept;

Description

Values of type ignore_case_param evaluate to true when constructed with the constant ignore_case. Otherwise, they are default-constructed and evaluate to false.

Return Value

  • bool

Class segments_encoded_base

Common functionality for containers

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L37[boost/url/segments_encoded_base.hpp,window=blank_]>

class segments_encoded_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type used to represent size.

value_type

The value type

Member Functions

Name

Description

back

Return the last segment

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

empty

Return true if there are no segments

end

Return an iterator to the end

front

Return the first segment

is_absolute

Returns true if this references an absolute path.

size

Return the number of segments

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Description

This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:

Class segments_encoded_base::iterator

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L20[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

class iterator;

Types

Member Functions

segments_encoded_base::iterator::value_type

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L38[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

using value_type = segments_encoded_base::value_type;

segments_encoded_base::iterator::reference

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L40[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

using reference = segments_encoded_base::reference;

segments_encoded_base::iterator::pointer

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L42[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

using pointer = reference;

segments_encoded_base::iterator::difference_type

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L43[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

using difference_type = ptrdiff_t;

segments_encoded_base::iterator::iterator_category

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L44[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

using iterator_category = bidirectional_iterator_tag;

Overload set segments_encoded_base::iterator::iterator

Members

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

Function segments_encoded_base::iterator::operator=

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L49[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

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

Function segments_encoded_base::iterator::operator*

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L52[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

reference
operator*() const noexcept;

Function segments_encoded_base::iterator::operator→

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L58[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

pointer
operator->() const noexcept;

Overload set segments_encoded_base::iterator::operator++

Members

iterator&
operator++() noexcept;
  » more...
iterator
operator++(int) noexcept;
  » more...

Overload set segments_encoded_base::iterator::operator--

Members

iterator&
operator--() noexcept;
  » more...
iterator
operator--(int) noexcept;
  » more...

Function segments_encoded_base::iterator::operator==

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L94[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

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

Function segments_encoded_base::iterator::operator!=

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L101[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

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

segments_encoded_base::const_iterator

iterator

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L83[boost/url/segments_encoded_base.hpp,window=blank_]>

using const_iterator = iterator;

segments_encoded_base::value_type

The value type

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L96[boost/url/segments_encoded_base.hpp,window=blank_]>

using value_type = string;

Description

Values of this type represent a segment where unique ownership is retained by making a copy.

Example

segments_encoded_base::value_type ps( url_view( "/path/to/file.txt" ).encoded_segments().back() );

segments_encoded_base::reference

The reference type

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L103[boost/url/segments_encoded_base.hpp,window=blank_]>

using reference = pct_string_view;

Description

This is the type of value returned when iterators of the view are dereferenced.

segments_encoded_base::const_reference

The reference type

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L106[boost/url/segments_encoded_base.hpp,window=blank_]>

using const_reference = pct_string_view;

Description

This is the type of value returned when iterators of the view are dereferenced.

segments_encoded_base::size_type

An unsigned integer type used to represent size.

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L110[boost/url/segments_encoded_base.hpp,window=blank_]>

using size_type = size_t;

segments_encoded_base::difference_type

A signed integer type used to represent differences.

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L114[boost/url/segments_encoded_base.hpp,window=blank_]>

using difference_type = ptrdiff_t;

Function segments_encoded_base::max_size

Return the maximum number of characters possible

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L131[boost/url/segments_encoded_base.hpp,window=blank_]>

constexpr
static
size_t
max_size() noexcept;

Description

This represents the largest number of characters that are possible in a path, not including any null terminator.

Exception Safety

Throws nothing.

Return Value

  • size_t

Function segments_encoded_base::buffer

Return the referenced character buffer.

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L158[boost/url/segments_encoded_base.hpp,window=blank_]>

pct_string_view
buffer() const noexcept;

Description

This function returns the character buffer referenced by the view. The returned string may contain percent escapes.

Example

assert( url_view( "/path/to/file.txt" ).encoded_segments().buffer() == "/path/to/file.txt" );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • pct_string_view

Function segments_encoded_base::is_absolute

Returns true if this references an absolute path.

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L178[boost/url/segments_encoded_base.hpp,window=blank_]>

bool
is_absolute() const noexcept;

Description

Absolute paths always start with a forward slash ('/').

Example

assert( url_view( "/path/to/file.txt" ).encoded_segments().is_absolute() == true );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • bool

Function segments_encoded_base::empty

Return true if there are no segments

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L195[boost/url/segments_encoded_base.hpp,window=blank_]>

bool
empty() const noexcept;

Description

Example

assert( ! url_view( "/index.htm" ).encoded_segments().empty() );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • bool

Function segments_encoded_base::size

Return the number of segments

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L212[boost/url/segments_encoded_base.hpp,window=blank_]>

size_t
size() const noexcept;

Description

Example

assert( url_view( "/path/to/file.txt" ).encoded_segments().size() == 3 );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • size_t

Function segments_encoded_base::front

Return the first segment

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L244[boost/url/segments_encoded_base.hpp,window=blank_]>

pct_string_view
front() const noexcept;

Description

This function returns a string with the first segment of the path without any leading or trailing '/' separators. The returned string may contain percent escapes.

Preconditions

this->empty() == false

Effects

return *begin();

Example

assert( url_view( "/path/to/file.txt" ).encoded_segments().front() == "path" );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • pct_string_view

Function segments_encoded_base::back

Return the last segment

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L281[boost/url/segments_encoded_base.hpp,window=blank_]>

pct_string_view
back() const noexcept;

Description

This function returns a string with the last segment of the path without any leading or trailing '/' separators. The returned string may contain percent escapes.

Preconditions

this->empty() == false

Example

assert( url_view( "/path/to/file.txt" ).encoded_segments().back() == "file.txt" );

Preconditions

this->empty() == false

Effects

return *--end();

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • pct_string_view

Function segments_encoded_base::begin

Return an iterator to the beginning

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L294[boost/url/segments_encoded_base.hpp,window=blank_]>

iterator
begin() const noexcept;

Description

Complexity

Linear in this->front().size() or constant if this->empty().

Exception Safety

Throws nothing.

Return Value

  • iterator

Function segments_encoded_base::end

Return an iterator to the end

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L306[boost/url/segments_encoded_base.hpp,window=blank_]>

iterator
end() const noexcept;

Description

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • iterator

Class segments_base

Common functionality for containers

Synopsis

Declared in header </boost/url/segments_base.hpp#L37[boost/url/segments_base.hpp,window=blank_]>

class segments_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type used to represent size.

value_type

The value type

Member Functions

Name

Description

back

Return the last segment

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

empty

Return true if there are no segments

end

Return an iterator to the end

front

Return the first segment

is_absolute

Returns true if this references an absolute path.

size

Return the number of segments

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Description

This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:

Class segments_base::iterator

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L21[boost/url/impl/segments_base.hpp,window=blank_]>

class iterator;

Types

Member Functions

segments_base::iterator::value_type

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L38[boost/url/impl/segments_base.hpp,window=blank_]>

using value_type = segments_base::value_type;

segments_base::iterator::reference

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L39[boost/url/impl/segments_base.hpp,window=blank_]>

using reference = segments_base::reference;

segments_base::iterator::pointer

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L40[boost/url/impl/segments_base.hpp,window=blank_]>

using pointer = reference;

segments_base::iterator::difference_type

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L41[boost/url/impl/segments_base.hpp,window=blank_]>

using difference_type = segments_base::difference_type;

segments_base::iterator::iterator_category

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L43[boost/url/impl/segments_base.hpp,window=blank_]>

using iterator_category = bidirectional_iterator_tag;

Overload set segments_base::iterator::iterator

Members

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

Function segments_base::iterator::operator=

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L48[boost/url/impl/segments_base.hpp,window=blank_]>

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

Function segments_base::iterator::operator*

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L52[boost/url/impl/segments_base.hpp,window=blank_]>

reference
operator*() const;

Function segments_base::iterator::operator→

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L56[boost/url/impl/segments_base.hpp,window=blank_]>

pointer
operator->() const = delete;

Overload set segments_base::iterator::operator++

Members

iterator&
operator++() noexcept;
  » more...
iterator
operator++(int) noexcept;
  » more...

Overload set segments_base::iterator::operator--

Members

iterator&
operator--() noexcept;
  » more...
iterator
operator--(int) noexcept;
  » more...

Function segments_base::iterator::operator==

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L88[boost/url/impl/segments_base.hpp,window=blank_]>

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

Function segments_base::iterator::operator!=

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L95[boost/url/impl/segments_base.hpp,window=blank_]>

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

segments_base::const_iterator

iterator

Synopsis

Declared in header </boost/url/segments_base.hpp#L80[boost/url/segments_base.hpp,window=blank_]>

using const_iterator = iterator;

segments_base::value_type

The value type

Synopsis

Declared in header </boost/url/segments_base.hpp#L93[boost/url/segments_base.hpp,window=blank_]>

using value_type = string;

Description

Values of this type represent a segment where unique ownership is retained by making a copy.

Example

segments_base::value_type ps( url_view( "/path/to/file.txt" ).segments().back() );

segments_base::reference

The reference type

Synopsis

Declared in header </boost/url/segments_base.hpp#L100[boost/url/segments_base.hpp,window=blank_]>

using reference = string;

Description

This is the type of value returned when iterators of the view are dereferenced.

segments_base::const_reference

The reference type

Synopsis

Declared in header </boost/url/segments_base.hpp#L103[boost/url/segments_base.hpp,window=blank_]>

using const_reference = string;

Description

This is the type of value returned when iterators of the view are dereferenced.

segments_base::size_type

An unsigned integer type used to represent size.

Synopsis

Declared in header </boost/url/segments_base.hpp#L107[boost/url/segments_base.hpp,window=blank_]>

using size_type = size_t;

segments_base::difference_type

A signed integer type used to represent differences.

Synopsis

Declared in header </boost/url/segments_base.hpp#L111[boost/url/segments_base.hpp,window=blank_]>

using difference_type = ptrdiff_t;

Function segments_base::max_size

Return the maximum number of characters possible

Synopsis

Declared in header </boost/url/segments_base.hpp#L128[boost/url/segments_base.hpp,window=blank_]>

constexpr
static
size_t
max_size() noexcept;

Description

This represents the largest number of characters that are possible in a path, not including any null terminator.

Exception Safety

Throws nothing.

Return Value

  • size_t

Function segments_base::buffer

Return the referenced character buffer.

Synopsis

Declared in header </boost/url/segments_base.hpp#L155[boost/url/segments_base.hpp,window=blank_]>

pct_string_view
buffer() const noexcept;

Description

This function returns the character buffer referenced by the view. The returned string may contain percent escapes.

Example

assert( url_view( "/path/to/file.txt" ).segments().buffer() == "/path/to/file.txt" );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • pct_string_view

Function segments_base::is_absolute

Returns true if this references an absolute path.

Synopsis

Declared in header </boost/url/segments_base.hpp#L175[boost/url/segments_base.hpp,window=blank_]>

bool
is_absolute() const noexcept;

Description

Absolute paths always start with a forward slash ('/').

Example

assert( url_view( "/path/to/file.txt" ).segments().is_absolute() == true );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • bool

Function segments_base::empty

Return true if there are no segments

Synopsis

Declared in header </boost/url/segments_base.hpp#L192[boost/url/segments_base.hpp,window=blank_]>

bool
empty() const noexcept;

Description

Example

assert( ! url_view( "/index.htm" ).segments().empty() );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • bool

Function segments_base::size

Return the number of segments

Synopsis

Declared in header </boost/url/segments_base.hpp#L209[boost/url/segments_base.hpp,window=blank_]>

size_t
size() const noexcept;

Description

Example

assert( url_view( "/path/to/file.txt" ).segments().size() == 3 );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • size_t

Function segments_base::front

Return the first segment

Synopsis

Declared in header </boost/url/segments_base.hpp#L241[boost/url/segments_base.hpp,window=blank_]>

string
front() const noexcept;

Description

This function returns a string with the first segment of the path without any leading or trailing '/' separators. Any percent-escapes in the string are decoded first.

Preconditions

this->empty() == false

Effects

return *begin();

Example

assert( url_view( "/path/to/file.txt" ).segments().front() == "path" );

Complexity

Linear in this->front().size().

Exception Safety

Calls to allocate may throw.

Return Value

  • string

Function segments_base::back

Return the last segment

Synopsis

Declared in header </boost/url/segments_base.hpp#L272[boost/url/segments_base.hpp,window=blank_]>

string
back() const noexcept;

Description

Preconditions

this->empty() == false

Example

assert( url_view( "/path/to/file.txt" ).segments().back() == "file.txt" );

Preconditions

this->empty() == false

Effects

return *--end();

Complexity

Linear in this->back().size().

Exception Safety

Calls to allocate may throw.

Return Value

  • string

Function segments_base::begin

Return an iterator to the beginning

Synopsis

Declared in header </boost/url/segments_base.hpp#L285[boost/url/segments_base.hpp,window=blank_]>

iterator
begin() const noexcept;

Description

Complexity

Linear in this->front().size() or constant if this->empty().

Exception Safety

Throws nothing.

Return Value

  • iterator

Function segments_base::end

Return an iterator to the end

Synopsis

Declared in header </boost/url/segments_base.hpp#L297[boost/url/segments_base.hpp,window=blank_]>

iterator
end() const noexcept;

Description

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • iterator

Class segments_view

A view representing path segments in a URL

Synopsis

Declared in header </boost/url/segments_view.hpp#L55[boost/url/segments_view.hpp,window=blank_]>

class segments_view
    : public segments_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type used to represent size.

value_type

The value type

Member Functions

Name

Description

back

Return the last segment

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

empty

Return true if there are no segments

end

Return an iterator to the end

front

Return the first segment

is_absolute

Returns true if this references an absolute path.

operator=

Assignment

segments_view

Constructor

size

Return the number of segments

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Description

Objects of this type are used to interpret the path as a bidirectional view of segment strings. The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.

Example

url_view u( "/path/to/file.txt" );

segments_view ps = u.segments();

assert( ps.buffer().data() == u.buffer().data() );

Percent escapes in strings returned when dereferencing iterators are automatically decoded.

Iterator Invalidation

Changes to the underlying character buffer can invalidate iterators which reference it.

Overload set segments_view::segments_view

Members

Constructor

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

Constructor

constexpr
segments_view(const segments_view& other) = default;
  » more...

Constructor

segments_view(string_view s);
  » more...

Function segments_view::operator=

Assignment

Synopsis

Declared in header </boost/url/segments_view.hpp#L188[boost/url/segments_view.hpp,window=blank_]>

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

Description

After assignment, both views reference the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.

Postconditions

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

Complexity

Constant

Exception Safety

Throws nothing

Return Value

  • ``

Parameters

Name Type

other

``

Class segments_encoded_view

A view representing path segments in a URL

Synopsis

Declared in header </boost/url/segments_encoded_view.hpp#L61[boost/url/segments_encoded_view.hpp,window=blank_]>

class segments_encoded_view
    : public segments_encoded_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type used to represent size.

value_type

The value type

Member Functions

Name

Description

back

Return the last segment

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

empty

Return true if there are no segments

end

Return an iterator to the end

front

Return the first segment

is_absolute

Returns true if this references an absolute path.

operator segments_view

Conversion

operator=

Assignment

segments_encoded_view

Constructor

size

Return the number of segments

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Friends

Name

Description

parse_path

Description

Objects of this type are used to interpret the path as a bidirectional view of segment strings. The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.

Example

url_view u( "/path/to/file.txt" );

segments_encoded_view ps = u.encoded_segments();

assert( ps.buffer().data() == u.buffer().data() );

Strings produced when elements are returned have type param_pct_view and represent encoded strings. Strings passed to member functions may contain percent escapes, and throw exceptions on invalid inputs.

Iterator Invalidation

Changes to the underlying character buffer can invalidate iterators which reference it.

Overload set segments_encoded_view::segments_encoded_view

Members

Constructor

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

Constructor

constexpr
segments_encoded_view(const segments_encoded_view&) noexcept = default;
  » more...

Constructor

segments_encoded_view(string_view s);
  » more...

Function segments_encoded_view::operator=

Assignment

Synopsis

Declared in header </boost/url/segments_encoded_view.hpp#L192[boost/url/segments_encoded_view.hpp,window=blank_]>

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

Description

After assignment, both views reference the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.

Postconditions

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

Complexity

Constant

Exception Safety

Throws nothing

Return Value

  • ``

Parameters

Name Type

**

``

Function segments_encoded_view::operator segments_view

Conversion

Synopsis

Declared in header </boost/url/segments_encoded_view.hpp#L226[boost/url/segments_encoded_view.hpp,window=blank_]>

operator segments_view() const noexcept;

Description

This conversion returns a new view which references the same underlying character buffer, and whose iterators and members return ordinary strings with decoding applied to any percent escapes. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.

Example

segments_view ps = parse_path( "/path/to/file.txt" ).value();

Postconditions

segments_view( *this ).buffer().data() == this->buffer().data()

Complexity

Constant

Exception Safety

Throws nothing

Return Value

  • segments_view

Friend parse_path

Synopsis

Declared in header </boost/url/segments_encoded_view.hpp#L232[boost/url/segments_encoded_view.hpp,window=blank_]>

friend
result<segments_encoded_view>
parse_path(string_view s) noexcept;

Function parse_path

Parse a string and return an encoded segment view

Synopsis

Declared in header </boost/url/parse_path.hpp#L48[boost/url/parse_path.hpp,window=blank_]>

result<segments_encoded_view>
parse_path(string_view s) noexcept;

Description

This function parses the string and returns the corresponding path object if the string is valid, otherwise returns an error.

BNF

path          = [ "/" ] segment *( "/" segment )

Exception Safety

No-throw guarantee.

Specification

Return Value

  • result

Parameters

Name Type

s

string_view

Class authority_rule_t

Synopsis

Declared in header </boost/url/rfc/authority_rule.hpp#L50[boost/url/rfc/authority_rule.hpp,window=blank_]>

struct authority_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

authority_rule_t::value_type

Synopsis

Declared in header </boost/url/rfc/authority_rule.hpp#L52[boost/url/rfc/authority_rule.hpp,window=blank_]>

using value_type = authority_view;

Function authority_rule_t::parse

Synopsis

Declared in header </boost/url/rfc/authority_rule.hpp#L55[boost/url/rfc/authority_rule.hpp,window=blank_]>

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

authority_rule

Synopsis

Declared in header </boost/url/rfc/authority_rule.hpp#L63[boost/url/rfc/authority_rule.hpp,window=blank_]>

constexpr
const authority_rule_t authority_rule;

Class pct_encoded_rule_t

Synopsis

Declared in header </boost/url/rfc/pct_encoded_rule.hpp#L69[boost/url/rfc/pct_encoded_rule.hpp,window=blank_]>

template<class CharSet>
struct pct_encoded_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

Friends

Name

Description

pct_encoded_rule

pct_encoded_rule_t::value_type

Synopsis

Declared in header </boost/url/rfc/pct_encoded_rule.hpp#L71[boost/url/rfc/pct_encoded_rule.hpp,window=blank_]>

using value_type = pct_string_view;

Friend pct_encoded_rule

Synopsis

Declared in header </boost/url/rfc/pct_encoded_rule.hpp#L73[boost/url/rfc/pct_encoded_rule.hpp,window=blank_]>

template<class CharSet_>
friend
constexpr
pct_encoded_rule_t<CharSet_>
pct_encoded_rule(const CharSet_& cs) noexcept;

Function pct_encoded_rule_t::parse

Synopsis

Declared in header </boost/url/rfc/pct_encoded_rule.hpp#L81[boost/url/rfc/pct_encoded_rule.hpp,window=blank_]>

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

Overload set pct_encoded_rule

Members

template<class CharSet_>
constexpr
pct_encoded_rule_t<CharSet_>
pct_encoded_rule(const CharSet_& cs) noexcept;
  » more...
template<class CharSet>
constexpr
pct_encoded_rule_t<CharSet>
pct_encoded_rule(const CharSet& cs) noexcept;
  » more...

variant

The type of variant used by the library

Synopsis

Declared in header </boost/url/variant.hpp#L22[boost/url/variant.hpp,window=blank_]>

template<class... Ts>
using variant = variant<Ts...>;

optional

Synopsis

Declared in header </boost/url/optional.hpp#L39[boost/url/optional.hpp,window=blank_]>

template<class T>
using optional = optional<T>;

Class params_encoded_base

Common functionality for containers

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L38[boost/url/params_encoded_base.hpp,window=blank_]>

class params_encoded_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type to represent sizes.

value_type

The value type

Member Functions

Name

Description

begin

Return an iterator to the beginning

buffer

Return the query corresponding to these params

contains

Return true if a matching key exists

count

Return the number of matching keys

empty

Return true if there are no params

end

Return an iterator to the end

find

Find a matching key

find_last

Find a matching key

size

Return the number of params

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Description

This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:

Class params_encoded_base::iterator

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L25[boost/url/impl/params_encoded_base.hpp,window=blank_]>

class iterator;

Types

Member Functions

Friends

Name

Description

operator!=

operator==

params_encoded_base::iterator::value_type

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L41[boost/url/impl/params_encoded_base.hpp,window=blank_]>

using value_type = params_encoded_base::value_type;

params_encoded_base::iterator::reference

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L43[boost/url/impl/params_encoded_base.hpp,window=blank_]>

using reference = params_encoded_base::reference;

params_encoded_base::iterator::pointer

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L45[boost/url/impl/params_encoded_base.hpp,window=blank_]>

using pointer = reference;

params_encoded_base::iterator::difference_type

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L46[boost/url/impl/params_encoded_base.hpp,window=blank_]>

using difference_type = ptrdiff_t;

params_encoded_base::iterator::iterator_category

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L47[boost/url/impl/params_encoded_base.hpp,window=blank_]>

using iterator_category = bidirectional_iterator_tag;

Overload set params_encoded_base::iterator::iterator

Members

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

Function params_encoded_base::iterator::operator=

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L52[boost/url/impl/params_encoded_base.hpp,window=blank_]>

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

Overload set params_encoded_base::iterator::operator++

Members

iterator&
operator++() noexcept;
  » more...
iterator
operator++(int) noexcept;
  » more...

Overload set params_encoded_base::iterator::operator--

Members

iterator&
operator--() noexcept;
  » more...
iterator
operator--(int) noexcept;
  » more...

Function params_encoded_base::iterator::operator*

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L85[boost/url/impl/params_encoded_base.hpp,window=blank_]>

reference
operator*() const;

Function params_encoded_base::iterator::operator→

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L91[boost/url/impl/params_encoded_base.hpp,window=blank_]>

pointer
operator->() const;

Friend operator==

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L97[boost/url/impl/params_encoded_base.hpp,window=blank_]>

friend
bool
operator==(
    const iterator& it0,
    const iterator& it1) noexcept;

Friend operator!=

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L106[boost/url/impl/params_encoded_base.hpp,window=blank_]>

friend
bool
operator!=(
    const iterator& it0,
    const iterator& it1) noexcept;

params_encoded_base::const_iterator

iterator

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L84[boost/url/params_encoded_base.hpp,window=blank_]>

using const_iterator = iterator;

params_encoded_base::value_type

The value type

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L100[boost/url/params_encoded_base.hpp,window=blank_]>

using value_type = param;

Description

Values of this type represent parameters whose strings retain unique ownership by making a copy.

Example

params_encoded_view::value_type qp( *url_view( "?first=John&last=Doe" ).params().find( "first" ) );

params_encoded_base::reference

The reference type

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L110[boost/url/params_encoded_base.hpp,window=blank_]>

using reference = param_pct_view;

Description

This is the type of value returned when iterators of the view are dereferenced.

params_encoded_base::const_reference

The reference type

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L113[boost/url/params_encoded_base.hpp,window=blank_]>

using const_reference = param_pct_view;

Description

This is the type of value returned when iterators of the view are dereferenced.

params_encoded_base::size_type

An unsigned integer type to represent sizes.

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L117[boost/url/params_encoded_base.hpp,window=blank_]>

using size_type = size_t;

params_encoded_base::difference_type

A signed integer type used to represent differences.

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L121[boost/url/params_encoded_base.hpp,window=blank_]>

using difference_type = ptrdiff_t;

Function params_encoded_base::max_size

Return the maximum number of characters possible

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L138[boost/url/params_encoded_base.hpp,window=blank_]>

constexpr
static
size_t
max_size() noexcept;

Description

This represents the largest number of characters that are possible in a path, not including any null terminator.

Exception Safety

Throws nothing.

Return Value

  • size_t

Function params_encoded_base::buffer

Return the query corresponding to these params

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L176[boost/url/params_encoded_base.hpp,window=blank_]>

pct_string_view
buffer() const noexcept;

Description

This function returns the query string referenced by the container. The returned string may contain percent escapes.

Example

assert( url_view( "?first=John&last=Doe" ).encoded_params().buffer() == "first=John&last=Doe" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

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

Specification

Return Value

  • pct_string_view

Function params_encoded_base::empty

Return true if there are no params

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L192[boost/url/params_encoded_base.hpp,window=blank_]>

bool
empty() const noexcept;

Description

Example

assert( ! url_view( "?key=value" ).encoded_params().empty() );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • bool

Function params_encoded_base::size

Return the number of params

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L208[boost/url/params_encoded_base.hpp,window=blank_]>

size_t
size() const noexcept;

Description

Example

assert( url_view( "?key=value").encoded_params().size() == 1 );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • size_t

Function params_encoded_base::begin

Return an iterator to the beginning

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L219[boost/url/params_encoded_base.hpp,window=blank_]>

iterator
begin() const noexcept;

Description

Complexity

Linear in the size of the first param.

Exception Safety

Throws nothing.

Return Value

  • iterator

Function params_encoded_base::end

Return an iterator to the end

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L230[boost/url/params_encoded_base.hpp,window=blank_]>

iterator
end() const noexcept;

Description

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • iterator

Function params_encoded_base::contains

Return true if a matching key exists

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L267[boost/url/params_encoded_base.hpp,window=blank_]>

bool
contains(
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first.

Example

assert( url_view( "?first=John&last=Doe" ).encoded_params().contains( "first" ) );

Complexity

Linear in this->buffer().size().

Exception Safety

Exceptions thrown on invalid input.

Return Value

  • bool

Parameters

Name Type

key

pct_string_view

ic

ignore_case_param

Function params_encoded_base::count

Return the number of matching keys

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L304[boost/url/params_encoded_base.hpp,window=blank_]>

size_t
count(
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find the number of matches for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first.

Example

assert( url_view( "?first=John&last=Doe" ).encoded_params().count( "first" ) == 1 );

Complexity

Linear in this->buffer().size().

Exception Safety

Exceptions thrown on invalid input.

Return Value

  • size_t

Parameters

Name Type

key

pct_string_view

ic

ignore_case_param

Overload set params_encoded_base::find

Members

Find a matching key

iterator
find(
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;
  » more...

Find a matching key

iterator
find(
    iterator from,
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;
  » more...

Overload set params_encoded_base::find_last

Members

Find a matching key

iterator
find_last(
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;
  » more...

Find a matching key

iterator
find_last(
    iterator before,
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;
  » more...

Class params_ref

A view representing query parameters in a URL

Synopsis

Declared in header </boost/url/params_ref.hpp#L80[boost/url/params_ref.hpp,window=blank_]>

class params_ref
    : public params_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type to represent sizes.

value_type

The value type

Member Functions

Name

Description

append

Append elements

assign

Assign elements

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

clear

Clear the contents of the container

contains

Return true if a matching key exists

count

Return the number of matching keys

empty

Return true if there are no params

end

Return an iterator to the end

erase

Erase elements

find

Find a matching key

find_last

Find a matching key

insert

Insert elements

operator params_view

Conversion

operator=

Assignment

params_ref

Constructor

replace

Replace elements

set

Set a value

size

Return the number of params

unset

Remove the value on an element

url

Return the referenced url

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

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

Overload set params_ref::params_ref

Members

Constructor

constexpr
params_ref(const params_ref& other) = default;
  » more...

Constructor

params_ref(
    const params_ref& other,
    encoding_opts opt) noexcept;
  » more...

Overload set params_ref::operator=

Members

Assignment

params_ref&
operator=(const params_ref& other);
  » more...

Assignment

params_ref&
operator=(initializer_list<param_view> init);
  » more...

Function params_ref::operator params_view

Conversion

Synopsis

Declared in header </boost/url/params_ref.hpp#L221[boost/url/params_ref.hpp,window=blank_]>

operator params_view() const noexcept;

Function params_ref::url

Return the referenced url

Synopsis

Declared in header </boost/url/params_ref.hpp#L247[boost/url/params_ref.hpp,window=blank_]>

url_base&
url() const noexcept;

Description

This function returns the url referenced by the view.

Example

url u( "?key=value" );

assert( &u.segments().url() == &u );

Exception Safety

Throws nothing.

Return Value

  • ``

Function params_ref::clear

Clear the contents of the container

Synopsis

Declared in header </boost/url/params_ref.hpp#L280[boost/url/params_ref.hpp,window=blank_]>

void
clear() noexcept;

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.

Return Value

  • void

Overload set params_ref::assign

Members

Assign elements

void
assign(initializer_list<param_view> init);
  » more...

Assign elements

template<class FwdIt>
void
assign(
    FwdIt first,
    FwdIt last);
  » more...

Overload set params_ref::append

Members

Append elements

Append elements

params_base::iterator
append(initializer_list<param_view> init);
  » more...

Append elements

template<class FwdIt>
params_base::iterator
append(
    FwdIt first,
    FwdIt last);
  » more...

Overload set params_ref::insert

Members

Insert elements

Insert elements

params_base::iterator
insert(
    params_base::iterator before,
    initializer_list<param_view> init);
  » more...

Insert elements

template<class FwdIt>
params_base::iterator
insert(
    params_base::iterator before,
    FwdIt first,
    FwdIt last);
  » more...

Overload set params_ref::erase

Members

Erase elements

Erase elements

Erase elements

size_t
erase(
    string_view key,
    ignore_case_param ic = = {}) noexcept;
  » more...

Overload set params_ref::replace

Members

Replace elements

Replace elements

params_base::iterator
replace(
    params_base::iterator from,
    params_base::iterator to,
    initializer_list<param_view> init);
  » more...

Replace elements

template<class FwdIt>
params_base::iterator
replace(
    params_base::iterator from,
    params_base::iterator to,
    FwdIt first,
    FwdIt last);
  » more...

Function params_ref::unset

Remove the value on an element

Synopsis

Declared in header </boost/url/params_ref.hpp#L810[boost/url/params_ref.hpp,window=blank_]>

params_base::iterator
unset(params_base::iterator pos) noexcept;

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.

Return Value

  • iterator

Parameters

Name Type

pos

iterator

Overload set params_ref::set

Members

Set a value

params_base::iterator
set(
    params_base::iterator pos,
    string_view value);
  » more...

Set a value

params_base::iterator
set(
    string_view key,
    string_view value,
    ignore_case_param ic = = {});
  » more...

Class params_base

Common functionality for containers

Synopsis

Declared in header </boost/url/params_base.hpp#L39[boost/url/params_base.hpp,window=blank_]>

class params_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type to represent sizes.

value_type

The value type

Member Functions

Name

Description

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

contains

Return true if a matching key exists

count

Return the number of matching keys

empty

Return true if there are no params

end

Return an iterator to the end

find

Find a matching key

find_last

Find a matching key

size

Return the number of params

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Description

This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:

Class params_base::iterator

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L22[boost/url/impl/params_base.hpp,window=blank_]>

class iterator;

Types

Member Functions

params_base::iterator::value_type

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L48[boost/url/impl/params_base.hpp,window=blank_]>

using value_type = params_base::value_type;

params_base::iterator::reference

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L49[boost/url/impl/params_base.hpp,window=blank_]>

using reference = params_base::reference;

params_base::iterator::pointer

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L50[boost/url/impl/params_base.hpp,window=blank_]>

using pointer = reference;

params_base::iterator::difference_type

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L51[boost/url/impl/params_base.hpp,window=blank_]>

using difference_type = params_base::difference_type;

params_base::iterator::iterator_category

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L53[boost/url/impl/params_base.hpp,window=blank_]>

using iterator_category = bidirectional_iterator_tag;

Overload set params_base::iterator::iterator

Members

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

Function params_base::iterator::operator=

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L58[boost/url/impl/params_base.hpp,window=blank_]>

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

Overload set params_base::iterator::operator++

Members

iterator&
operator++() noexcept;
  » more...
iterator
operator++(int) noexcept;
  » more...

Overload set params_base::iterator::operator--

Members

iterator&
operator--() noexcept;
  » more...
iterator
operator--(int) noexcept;
  » more...

Function params_base::iterator::operator*

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L91[boost/url/impl/params_base.hpp,window=blank_]>

reference
operator*() const;

Function params_base::iterator::operator→

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L95[boost/url/impl/params_base.hpp,window=blank_]>

pointer
operator->() const = delete;

Function params_base::iterator::operator==

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L97[boost/url/impl/params_base.hpp,window=blank_]>

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

Function params_base::iterator::operator!=

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L104[boost/url/impl/params_base.hpp,window=blank_]>

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

params_base::const_iterator

iterator

Synopsis

Declared in header </boost/url/params_base.hpp#L95[boost/url/params_base.hpp,window=blank_]>

using const_iterator = iterator;

params_base::value_type

The value type

Synopsis

Declared in header </boost/url/params_base.hpp#L111[boost/url/params_base.hpp,window=blank_]>

using value_type = param;

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

params_base::reference

The reference type

Synopsis

Declared in header </boost/url/params_base.hpp#L121[boost/url/params_base.hpp,window=blank_]>

using reference = param;

Description

This is the type of value returned when iterators of the view are dereferenced.

params_base::const_reference

The reference type

Synopsis

Declared in header </boost/url/params_base.hpp#L124[boost/url/params_base.hpp,window=blank_]>

using const_reference = param;

Description

This is the type of value returned when iterators of the view are dereferenced.

params_base::size_type

An unsigned integer type to represent sizes.

Synopsis

Declared in header </boost/url/params_base.hpp#L128[boost/url/params_base.hpp,window=blank_]>

using size_type = size_t;

params_base::difference_type

A signed integer type used to represent differences.

Synopsis

Declared in header </boost/url/params_base.hpp#L132[boost/url/params_base.hpp,window=blank_]>

using difference_type = ptrdiff_t;

Function params_base::max_size

Return the maximum number of characters possible

Synopsis

Declared in header </boost/url/params_base.hpp#L149[boost/url/params_base.hpp,window=blank_]>

constexpr
static
size_t
max_size() noexcept;

Description

This represents the largest number of characters that are possible in a path, not including any null terminator.

Exception Safety

Throws nothing.

Return Value

  • size_t

Function params_base::buffer

Return the referenced character buffer.

Synopsis

Declared in header </boost/url/params_base.hpp#L175[boost/url/params_base.hpp,window=blank_]>

pct_string_view
buffer() const noexcept;

Description

This function returns the character buffer referenced by the view. The returned string may contain percent escapes.

Example

assert( url_view( "?first=John&last=Doe" ).params().buffer() == "?first=John&last=Doe" );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • pct_string_view

Function params_base::empty

Return true if there are no params

Synopsis

Declared in header </boost/url/params_base.hpp#L191[boost/url/params_base.hpp,window=blank_]>

bool
empty() const noexcept;

Description

Example

assert( ! url_view( "?key=value" ).params().empty() );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • bool

Function params_base::size

Return the number of params

Synopsis

Declared in header </boost/url/params_base.hpp#L207[boost/url/params_base.hpp,window=blank_]>

size_t
size() const noexcept;

Description

Example

assert( url_view( "?key=value").params().size() == 1 );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • size_t

Function params_base::begin

Return an iterator to the beginning

Synopsis

Declared in header </boost/url/params_base.hpp#L218[boost/url/params_base.hpp,window=blank_]>

iterator
begin() const noexcept;

Description

Complexity

Linear in the size of the first param.

Exception Safety

Throws nothing.

Return Value

  • iterator

Function params_base::end

Return an iterator to the end

Synopsis

Declared in header </boost/url/params_base.hpp#L229[boost/url/params_base.hpp,window=blank_]>

iterator
end() const noexcept;

Description

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • iterator

Function params_base::contains

Return true if a matching key exists

Synopsis

Declared in header </boost/url/params_base.hpp#L262[boost/url/params_base.hpp,window=blank_]>

bool
contains(
    string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find a match for the specified key. 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.

Return Value

  • bool

Parameters

Name Type

key

string_view

ic

ignore_case_param

Function params_base::count

Return the number of matching keys

Synopsis

Declared in header </boost/url/params_base.hpp#L296[boost/url/params_base.hpp,window=blank_]>

size_t
count(
    string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find the number of matches for the specified key. 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.

Return Value

  • size_t

Parameters

Name Type

key

string_view

ic

ignore_case_param

Overload set params_base::find

Members

Find a matching key

iterator
find(
    string_view key,
    ignore_case_param ic = = {}) const noexcept;
  » more...

Find a matching key

iterator
find(
    iterator from,
    string_view key,
    ignore_case_param ic = = {}) const noexcept;
  » more...

Overload set params_base::find_last

Members

Find a matching key

iterator
find_last(
    string_view key,
    ignore_case_param ic = = {}) const noexcept;
  » more...

Find a matching key

iterator
find_last(
    iterator before,
    string_view key,
    ignore_case_param ic = = {}) const noexcept;
  » more...

Class params_view

A view representing query parameters in a URL

Synopsis

Declared in header </boost/url/params_view.hpp#L47[boost/url/params_view.hpp,window=blank_]>

class params_view
    : public params_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type to represent sizes.

value_type

The value type

Member Functions

Name

Description

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

contains

Return true if a matching key exists

count

Return the number of matching keys

empty

Return true if there are no params

end

Return an iterator to the end

find

Find a matching key

find_last

Find a matching key

operator=

Assignment

params_view

Constructor

size

Return the number of params

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

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.

Overload set params_view::params_view

Members

Constructor

params_view() = default;
  » more...

Constructor

constexpr
params_view(const params_view& other) = default;
  » more...

Constructor

params_view(
    const params_view& other,
    encoding_opts opt) noexcept;
  » more...

Constructor

params_view(string_view s);
  » more...

Constructor

params_view(
    string_view s,
    encoding_opts opt);
  » more...

Function params_view::operator=

Assignment

Synopsis

Declared in header </boost/url/params_view.hpp#L278[boost/url/params_view.hpp,window=blank_]>

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

Description

After assignment, both views reference the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.

Postconditions

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

Complexity

Constant

Exception Safety

Throws nothing

Return Value

  • ``

Parameters

Name Type

**

``

Class params_encoded_view

A view representing query parameters in a URL

Synopsis

Declared in header </boost/url/params_encoded_view.hpp#L54[boost/url/params_encoded_view.hpp,window=blank_]>

class params_encoded_view
    : public params_encoded_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type to represent sizes.

value_type

The value type

Member Functions

Name

Description

begin

Return an iterator to the beginning

buffer

Return the query corresponding to these params

contains

Return true if a matching key exists

count

Return the number of matching keys

empty

Return true if there are no params

end

Return an iterator to the end

find

Find a matching key

find_last

Find a matching key

operator params_view

Conversion

operator=

Assignment

params_encoded_view

Constructor

size

Return the number of params

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Friends

Name

Description

parse_query

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.

Overload set params_encoded_view::params_encoded_view

Members

Constructor

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

Constructor

constexpr
params_encoded_view(const params_encoded_view& other) = default;
  » more...

Constructor

params_encoded_view(string_view s);
  » more...

Function params_encoded_view::operator=

Assignment

Synopsis

Declared in header </boost/url/params_encoded_view.hpp#L190[boost/url/params_encoded_view.hpp,window=blank_]>

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

Description

After assignment, both views reference the same underlying character buffer. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.

Postconditions

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

Complexity

Constant

Exception Safety

Throws nothing

Return Value

  • ``

Parameters

Name Type

**

``

Function params_encoded_view::operator params_view

Conversion

Synopsis

Declared in header </boost/url/params_encoded_view.hpp#L223[boost/url/params_encoded_view.hpp,window=blank_]>

operator params_view() const noexcept;

Description

This conversion returns a new view which references the same underlying character buffer, and whose iterators and members return ordinary strings with decoding applied to any percent escapes. Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.

Example

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

Return Value

  • params_view

Friend parse_query

Synopsis

Declared in header </boost/url/params_encoded_view.hpp#L228[boost/url/params_encoded_view.hpp,window=blank_]>

friend
result<params_encoded_view>
parse_query(string_view s) noexcept;

Function parse_query

Parse a string and return an encoded params view

Synopsis

Declared in header </boost/url/parse_query.hpp#L46[boost/url/parse_query.hpp,window=blank_]>

result<params_encoded_view>
parse_query(string_view s) noexcept;

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

Return Value

  • result

Parameters

Name Type

s

string_view

Class url_base

Common functionality for containers

Synopsis

Declared in header </boost/url/url_base.hpp#L63[boost/url/url_base.hpp,window=blank_]>

class url_base
    : public url_view_base;

Member Functions

Name

Description

authority

Return the authority

buffer

Return the url string

c_str

Return the url as a null-terminated string

capacity

Return the number of characters that can be stored without reallocating

clear

Clear the contents while preserving the capacity

compare

Return the result of comparing this with another url

data

Return a pointer to the url's character buffer

digest

empty

Return true if the url is empty

encoded_authority

Return the authority.

encoded_fragment

Return the fragment

encoded_host

Return the host

encoded_host_address

Return the host

encoded_host_and_port

Return the host and port

encoded_host_name

Return the host name

encoded_origin

Return the origin

encoded_params

Return the query as a container of parameters

encoded_password

Return the password

encoded_path

Return the path

encoded_query

Return the query

encoded_resource

Return the resource

encoded_segments

Return the path as a container of segments

encoded_target

Return the target

encoded_user

Return the user

encoded_userinfo

Return the userinfo

encoded_zone_id

Return the IPv6 Zone ID

fragment

Return the fragment

has_authority

Return true if an authority is present

has_fragment

Return true if a fragment is present

has_password

Return true if a password is present

has_port

Return true if a port is present

has_query

Return true if a query is present

has_scheme

Return true a scheme is present

has_userinfo

Return true if a userinfo is present

host

Return the host

host_address

Return the host

host_ipv4_address

Return the host IPv4 address

host_ipv6_address

Return the host IPv6 address

host_ipvfuture

Return the host IPvFuture address

host_name

Return the host name

host_type

Return the host type

is_path_absolute

Return true if the path is absolute

normalize

Normalize the URL components

normalize_authority

Normalize the URL authority

normalize_fragment

Normalize the URL fragment

normalize_path

Normalize the URL path

normalize_query

Normalize the URL query

normalize_scheme

Normalize the URL scheme

operator string_view

Return the URL as a core::string_view

params

Return the query as a container of parameters

url_view_base::params

password

Return the password

path

Return the path

persist

Return a shared, persistent copy of the url

port

Return the port

port_number

Return the port

query

Return the query

remove_authority

Remove the authority

remove_fragment

Remove the fragment

remove_origin

Remove the origin component

remove_password

Remove the password

remove_port

Remove the port

remove_query

Remove the query

remove_scheme

Remove the scheme

remove_userinfo

Remove the userinfo

reserve

Adjust the capacity without changing the size

resolve

Resolve a URL reference against this base URL

scheme

Return the scheme

scheme_id

Return the scheme

segments

Return the path as a container of segments

set_encoded_authority

Set the authority

set_encoded_fragment

Set the fragment.

set_encoded_host

Set the host

set_encoded_host_address

Set the host to an address

set_encoded_host_name

Set the host to a name

set_encoded_params

Set the query params

set_encoded_password

Set the password.

set_encoded_path

Set the path.

set_encoded_query

Set the query

set_encoded_user

Set the user

set_encoded_userinfo

Set the userinfo.

set_fragment

Set the fragment.

set_host

Set the host

set_host_address

Set the host to an address

set_host_ipv4

Set the host to an address

set_host_ipv6

Set the host to an address

set_host_ipvfuture

Set the host to an address

set_host_name

Set the host to a name

set_params

Set the query params

set_password

Set the password.

set_path

Set the path.

set_path_absolute

Set if the path is absolute

set_port

Set the port

set_port_number

Set the port

set_query

Set the query

set_scheme

Set the scheme

set_scheme_id

set_user

Set the user

set_userinfo

Set the userinfo

size

Return the number of characters in the url

user

Return the user

userinfo

Return the userinfo

zone_id

Return the IPv6 Zone ID

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Friends

Name

Description

operator!=

Return the result of comparing two URLs

operator<

Return the result of comparing two URLs

operator<<

operator<=

Return the result of comparing two URLs

operator==

Return the result of comparing two URLs

operator>

Return the result of comparing two URLs

operator>=

Return the result of comparing two URLs

resolve

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

Function url_base::c_str

Return the url as a null-terminated string

Synopsis

Declared in header </boost/url/url_base.hpp#L128[boost/url/url_base.hpp,window=blank_]>

const char*
c_str() const noexcept;

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.

Return Value

  • ``

Function url_base::capacity

Return the number of characters that can be stored without reallocating

Synopsis

Declared in header </boost/url/url_base.hpp#L145[boost/url/url_base.hpp,window=blank_]>

size_t
capacity() const noexcept;

Description

This does not include the null terminator, which is always present.

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • size_t

Function url_base::clear

Clear the contents while preserving the capacity

Synopsis

Declared in header </boost/url/url_base.hpp#L164[boost/url/url_base.hpp,window=blank_]>

void
clear() noexcept;

Description

Postconditions

this->empty() == true

Complexity

Constant.

Exception Safety

No-throw guarantee.

Return Value

  • void

Function url_base::reserve

Adjust the capacity without changing the size

Synopsis

Declared in header </boost/url/url_base.hpp#L186[boost/url/url_base.hpp,window=blank_]>

void
reserve(size_t n);

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.

Return Value

  • void

Parameters

Name Type

n

size_t

Function url_base::set_scheme

Set the scheme

Synopsis

Declared in header </boost/url/url_base.hpp#L242[boost/url/url_base.hpp,window=blank_]>

url_base&
set_scheme(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url_base::set_scheme_id

Synopsis

Declared in header </boost/url/url_base.hpp#L276[boost/url/url_base.hpp,window=blank_]>

url_base&
set_scheme_id(scheme id);

Function url_base::remove_scheme

Remove the scheme

Synopsis

Declared in header </boost/url/url_base.hpp#L316[boost/url/url_base.hpp,window=blank_]>

url_base&
remove_scheme();

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

Return Value

  • ``

Function url_base::set_encoded_authority

Set the authority

Synopsis

Declared in header </boost/url/url_base.hpp#L361[boost/url/url_base.hpp,window=blank_]>

url_base&
set_encoded_authority(pct_string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url_base::remove_authority

Remove the authority

Synopsis

Declared in header </boost/url/url_base.hpp#L403[boost/url/url_base.hpp,window=blank_]>

url_base&
remove_authority();

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

Return Value

  • ``

Function url_base::set_userinfo

Set the userinfo

Synopsis

Declared in header </boost/url/url_base.hpp#L469[boost/url/url_base.hpp,window=blank_]>

url_base&
set_userinfo(string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url_base::set_encoded_userinfo

Set the userinfo.

Synopsis

Declared in header </boost/url/url_base.hpp#L535[boost/url/url_base.hpp,window=blank_]>

url_base&
set_encoded_userinfo(pct_string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url_base::remove_userinfo

Remove the userinfo

Synopsis

Declared in header </boost/url/url_base.hpp#L576[boost/url/url_base.hpp,window=blank_]>

url_base&
remove_userinfo() noexcept;

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 / ":" )

Return Value

  • ``

Function url_base::set_user

Set the user

Synopsis

Declared in header </boost/url/url_base.hpp#L625[boost/url/url_base.hpp,window=blank_]>

url_base&
set_user(string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url_base::set_encoded_user

Set the user

Synopsis

Declared in header </boost/url/url_base.hpp#L678[boost/url/url_base.hpp,window=blank_]>

url_base&
set_encoded_user(pct_string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url_base::set_password

Set the password.

Synopsis

Declared in header </boost/url/url_base.hpp#L730[boost/url/url_base.hpp,window=blank_]>

url_base&
set_password(string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url_base::set_encoded_password

Set the password.

Synopsis

Declared in header </boost/url/url_base.hpp#L787[boost/url/url_base.hpp,window=blank_]>

url_base&
set_encoded_password(pct_string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url_base::remove_password

Remove the password

Synopsis

Declared in header </boost/url/url_base.hpp#L838[boost/url/url_base.hpp,window=blank_]>

url_base&
remove_password() noexcept;

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 / ":" )

Return Value

  • ``

Function url_base::set_host

Set the host

Synopsis

Declared in header </boost/url/url_base.hpp#L921[boost/url/url_base.hpp,window=blank_]>

url_base&
set_host(string_view s);

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 / "-" / ".")

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url_base::set_encoded_host

Set the host

Synopsis

Declared in header </boost/url/url_base.hpp#L1005[boost/url/url_base.hpp,window=blank_]>

url_base&
set_encoded_host(pct_string_view s);

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 / "-" / ".")

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url_base::set_host_address

Set the host to an address

Synopsis

Declared in header </boost/url/url_base.hpp#L1103[boost/url/url_base.hpp,window=blank_]>

url_base&
set_host_address(string_view s);

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 / "-" / ".")

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url_base::set_encoded_host_address

Set the host to an address

Synopsis

Declared in header </boost/url/url_base.hpp#L1206[boost/url/url_base.hpp,window=blank_]>

url_base&
set_encoded_host_address(pct_string_view s);

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 / "-" / ".")

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url_base::set_host_ipv4

Set the host to an address

Synopsis

Declared in header </boost/url/url_base.hpp#L1262[boost/url/url_base.hpp,window=blank_]>

url_base&
set_host_ipv4(const ipv4_address& addr);

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

Return Value

  • ``

Parameters

Name Type

addr

``

Function url_base::set_host_ipv6

Set the host to an address

Synopsis

Declared in header </boost/url/url_base.hpp#L1326[boost/url/url_base.hpp,window=blank_]>

url_base&
set_host_ipv6(const ipv6_address& addr);

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

Return Value

  • ``

Parameters

Name Type

addr

``

Function url_base::set_host_ipvfuture

Set the host to an address

Synopsis

Declared in header </boost/url/url_base.hpp#L1378[boost/url/url_base.hpp,window=blank_]>

url_base&
set_host_ipvfuture(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url_base::set_host_name

Set the host to a name

Synopsis

Declared in header </boost/url/url_base.hpp#L1425[boost/url/url_base.hpp,window=blank_]>

url_base&
set_host_name(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url_base::set_encoded_host_name

Set the host to a name

Synopsis

Declared in header </boost/url/url_base.hpp#L1478[boost/url/url_base.hpp,window=blank_]>

url_base&
set_encoded_host_name(pct_string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url_base::set_port_number

Set the port

Synopsis

Declared in header </boost/url/url_base.hpp#L1522[boost/url/url_base.hpp,window=blank_]>

url_base&
set_port_number(uint16_t n);

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

Return Value

  • ``

Parameters

Name Type

n

uint16_t

Function url_base::set_port

Set the port

Synopsis

Declared in header </boost/url/url_base.hpp#L1565[boost/url/url_base.hpp,window=blank_]>

url_base&
set_port(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url_base::remove_port

Remove the port

Synopsis

Declared in header </boost/url/url_base.hpp#L1603[boost/url/url_base.hpp,window=blank_]>

url_base&
remove_port() noexcept;

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

Return Value

  • ``

Function url_base::set_path_absolute

Set if the path is absolute

Synopsis

Declared in header </boost/url/url_base.hpp#L1665[boost/url/url_base.hpp,window=blank_]>

bool
set_path_absolute(bool absolute);

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

Specification

Return Value

  • bool

Parameters

Name Type

absolute

bool

Function url_base::set_path

Set the path.

Synopsis

Declared in header </boost/url/url_base.hpp#L1731[boost/url/url_base.hpp,window=blank_]>

url_base&
set_path(string_view s);

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

Specification

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url_base::set_encoded_path

Set the path.

Synopsis

Declared in header </boost/url/url_base.hpp#L1796[boost/url/url_base.hpp,window=blank_]>

url_base&
set_encoded_path(pct_string_view s);

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

Specification

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Overload set url_base::segments

Members

Return the path as a container of segments

segments_ref
segments() noexcept;
  » more...

Return the path as a container of segments

segments_view
segments() const noexcept;
  » more...

Overload set url_base::encoded_segments

Members

Return the path as a container of segments

segments_encoded_ref
encoded_segments() noexcept;
  » more...

Return the path as a container of segments

segments_encoded_view
encoded_segments() const noexcept;
  » more...

Function url_base::set_query

Set the query

Synopsis

Declared in header </boost/url/url_base.hpp#L1973[boost/url/url_base.hpp,window=blank_]>

url_base&
set_query(string_view s);

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 )

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url_base::set_encoded_query

Set the query

Synopsis

Declared in header </boost/url/url_base.hpp#L2028[boost/url/url_base.hpp,window=blank_]>

url_base&
set_encoded_query(pct_string_view s);

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 )

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Overload set url_base::params

Members

Return the query as a container of parameters

params_ref
params() noexcept;
  » more...
params_view
params() const noexcept;
  » more...

Return the query as a container of parameters

params_ref
params(encoding_opts opt) noexcept;
  » more...

Overload set url_base::encoded_params

Members

Return the query as a container of parameters

params_encoded_view
encoded_params() const noexcept;
  » more...

Return the query as a container of parameters

params_encoded_ref
encoded_params() noexcept;
  » more...

Function url_base::set_params

Set the query params

Synopsis

Declared in header </boost/url/url_base.hpp#L2243[boost/url/url_base.hpp,window=blank_]>

url_base&
set_params(initializer_list<param_view> ps) noexcept;

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)

Return Value

  • ``

Parameters

Name Type

ps

initializer_list

Function url_base::set_encoded_params

Set the query params

Synopsis

Declared in header </boost/url/url_base.hpp#L2303[boost/url/url_base.hpp,window=blank_]>

url_base&
set_encoded_params(initializer_list<param_pct_view> ps) noexcept;

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 )

Return Value

  • ``

Parameters

Name Type

ps

initializer_list

Function url_base::remove_query

Remove the query

Synopsis

Declared in header </boost/url/url_base.hpp#L2345[boost/url/url_base.hpp,window=blank_]>

url_base&
remove_query() noexcept;

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 )

Return Value

  • ``

Function url_base::remove_fragment

Remove the fragment

Synopsis

Declared in header </boost/url/url_base.hpp#L2390[boost/url/url_base.hpp,window=blank_]>

url_base&
remove_fragment() noexcept;

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

Return Value

  • ``

Function url_base::set_fragment

Set the fragment.

Synopsis

Declared in header </boost/url/url_base.hpp#L2434[boost/url/url_base.hpp,window=blank_]>

url_base&
set_fragment(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url_base::set_encoded_fragment

Set the fragment.

Synopsis

Declared in header </boost/url/url_base.hpp#L2485[boost/url/url_base.hpp,window=blank_]>

url_base&
set_encoded_fragment(pct_string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url_base::remove_origin

Remove the origin component

Synopsis

Declared in header </boost/url/url_base.hpp#L2516[boost/url/url_base.hpp,window=blank_]>

url_base&
remove_origin();

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.

Return Value

  • ``

Function url_base::normalize

Normalize the URL components

Synopsis

Declared in header </boost/url/url_base.hpp#L2539[boost/url/url_base.hpp,window=blank_]>

url_base&
normalize();

Description

Applies Syntax-based normalization to all components of the URL.

Exception Safety

Strong guarantee. Calls to allocate may throw.

Return Value

  • ``

Function url_base::normalize_scheme

Normalize the URL scheme

Synopsis

Declared in header </boost/url/url_base.hpp#L2558[boost/url/url_base.hpp,window=blank_]>

url_base&
normalize_scheme();

Description

Applies Syntax-based normalization to the URL scheme. The scheme is normalized to lowercase.

Exception Safety

Strong guarantee. Calls to allocate may throw.

Return Value

  • ``

Function url_base::normalize_authority

Normalize the URL authority

Synopsis

Declared in header </boost/url/url_base.hpp#L2580[boost/url/url_base.hpp,window=blank_]>

url_base&
normalize_authority();

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.

Return Value

  • ``

Function url_base::normalize_path

Normalize the URL path

Synopsis

Declared in header </boost/url/url_base.hpp#L2603[boost/url/url_base.hpp,window=blank_]>

url_base&
normalize_path();

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.

Return Value

  • ``

Function url_base::normalize_query

Normalize the URL query

Synopsis

Declared in header </boost/url/url_base.hpp#L2625[boost/url/url_base.hpp,window=blank_]>

url_base&
normalize_query();

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.

Return Value

  • ``

Function url_base::normalize_fragment

Normalize the URL fragment

Synopsis

Declared in header </boost/url/url_base.hpp#L2647[boost/url/url_base.hpp,window=blank_]>

url_base&
normalize_fragment();

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.

Return Value

  • ``

Function url_base::resolve

Resolve a URL reference against this base URL

Synopsis

Declared in header </boost/url/url_base.hpp#L2740[boost/url/url_base.hpp,window=blank_]>

result<void>
resolve(const url_view_base& ref);

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.

Return Value

  • result

Parameters

Name Type

ref

``

Friend resolve

Synopsis

Declared in header </boost/url/url_base.hpp#L2744[boost/url/url_base.hpp,window=blank_]>

friend
result<void>
resolve(
    const url_view_base& base,
    const url_view_base& ref,
    url_base& dest);

Class url_base::op_t

Synopsis

Declared in header </boost/url/url_base.hpp#L78[boost/url/url_base.hpp,window=blank_]>

struct op_t;

Member Functions

Name

Description

move

op_t

~op_t

Function url_base::op_t::~op_t

Synopsis

Declared in header </src/url_base.cpp#L55[src/url_base.cpp,window=blank_]>

~op_t();

Function url_base::op_t::op_t

Synopsis

Declared in header </src/url_base.cpp#L64[src/url_base.cpp,window=blank_]>

op_t(
    url_base& impl_,
    string_view* s0_ = nullptr,
    string_view* s1_ = nullptr) noexcept;

Function url_base::op_t::move

Synopsis

Declared in header </src/url_base.cpp#L77[src/url_base.cpp,window=blank_]>

void
move(
    char* dest,
    const char* src,
    size_t n) noexcept;

Class params_encoded_ref

A view representing query parameters in a URL

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L73[boost/url/params_encoded_ref.hpp,window=blank_]>

class params_encoded_ref
    : public params_encoded_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type to represent sizes.

value_type

The value type

Member Functions

Name

Description

append

Append params

assign

Assign params

begin

Return an iterator to the beginning

buffer

Return the query corresponding to these params

clear

Clear the contents of the container

contains

Return true if a matching key exists

count

Return the number of matching keys

empty

Return true if there are no params

end

Return an iterator to the end

erase

Erase params

find

Find a matching key

find_last

Find a matching key

insert

Insert params

operator params_encoded_view

Conversion

operator=

Assignment

params_encoded_ref

Constructor

replace

Replace params

set

Set a value

size

Return the number of params

unset

Remove the value on an element

url

Return the referenced url

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

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

Function params_encoded_ref::params_encoded_ref

Constructor

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L112[boost/url/params_encoded_ref.hpp,window=blank_]>

constexpr
params_encoded_ref(const params_encoded_ref& other) = default;

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.

Return Value

  • void

Parameters

Name Type

other

``

Overload set params_encoded_ref::operator=

Members

Assignment

Assignment

params_encoded_ref&
operator=(initializer_list<param_pct_view> init);
  » more...

Function params_encoded_ref::operator params_encoded_view

Conversion

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L191[boost/url/params_encoded_ref.hpp,window=blank_]>

operator params_encoded_view() const noexcept;

Description

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • params_encoded_view

Function params_encoded_ref::url

Return the referenced url

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L217[boost/url/params_encoded_ref.hpp,window=blank_]>

url_base&
url() const noexcept;

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.

Return Value

  • ``

Function params_encoded_ref::clear

Clear the contents of the container

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L250[boost/url/params_encoded_ref.hpp,window=blank_]>

void
clear() noexcept;

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.

Return Value

  • void

Overload set params_encoded_ref::assign

Members

Assign params

void
assign(initializer_list<param_pct_view> init);
  » more...

Assign params

template<class FwdIt>
void
assign(
    FwdIt first,
    FwdIt last);
  » more...

Overload set params_encoded_ref::append

Members

Append params

Append params

params_encoded_base::iterator
append(initializer_list<param_pct_view> init);
  » more...

Append params

template<class FwdIt>
params_encoded_base::iterator
append(
    FwdIt first,
    FwdIt last);
  » more...

Overload set params_encoded_ref::insert

Members

Insert params

Insert params

Insert params

template<class FwdIt>
params_encoded_base::iterator
insert(
    params_encoded_base::iterator before,
    FwdIt first,
    FwdIt last);
  » more...

Overload set params_encoded_ref::erase

Members

Erase params

Erase params

Erase params

size_t
erase(
    pct_string_view key,
    ignore_case_param ic = = {}) noexcept;
  » more...

Overload set params_encoded_ref::replace

Members

Replace params

Replace params

Replace params

template<class FwdIt>
params_encoded_base::iterator
replace(
    params_encoded_base::iterator from,
    params_encoded_base::iterator to,
    FwdIt first,
    FwdIt last);
  » more...

Function params_encoded_ref::unset

Remove the value on an element

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L832[boost/url/params_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

pos

iterator

Overload set params_encoded_ref::set

Members

Class segments_encoded_ref

A view representing path segments in a URL

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L88[boost/url/segments_encoded_ref.hpp,window=blank_]>

class segments_encoded_ref
    : public segments_encoded_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type used to represent size.

value_type

The value type

Member Functions

Name

Description

assign

Assign segments

back

Return the last segment

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

clear

Clear the contents of the container

empty

Return true if there are no segments

end

Return an iterator to the end

erase

Erase segments

front

Return the first segment

insert

Insert segments

is_absolute

Returns true if this references an absolute path.

operator segments_encoded_view

Conversion

operator=

Assignment

pop_back

Remove the last segment

push_back

Append a segment

replace

Replace segments

segments_encoded_ref

Constructor

size

Return the number of segments

url

Return the referenced url

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Description

Objects of this type are used to interpret the path as a bidirectional view of 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:

Function segments_encoded_ref::segments_encoded_ref

Constructor

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L127[boost/url/segments_encoded_ref.hpp,window=blank_]>

constexpr
segments_encoded_ref(const segments_encoded_ref& other) = default;

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.

Return Value

  • void

Parameters

Name Type

other

``

Overload set segments_encoded_ref::operator=

Members

Assignment

Assignment

segments_encoded_ref&
operator=(initializer_list<pct_string_view> init);
  » more...

Function segments_encoded_ref::operator segments_encoded_view

Conversion

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L222[boost/url/segments_encoded_ref.hpp,window=blank_]>

operator segments_encoded_view() const noexcept;

Function segments_encoded_ref::url

Return the referenced url

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L246[boost/url/segments_encoded_ref.hpp,window=blank_]>

url_base&
url() const noexcept;

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.

Return Value

  • ``

Function segments_encoded_ref::clear

Clear the contents of the container

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L279[boost/url/segments_encoded_ref.hpp,window=blank_]>

void
clear() noexcept;

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.

Return Value

  • void

Overload set segments_encoded_ref::assign

Members

Assign segments

void
assign(initializer_list<pct_string_view> init);
  » more...

Assign segments

template<class FwdIt>
void
assign(
    FwdIt first,
    FwdIt last);
  » more...

Overload set segments_encoded_ref::insert

Members

Insert segments

Insert segments

Insert segments

template<class FwdIt>
segments_encoded_base::iterator
insert(
    segments_encoded_base::iterator before,
    FwdIt first,
    FwdIt last);
  » more...

Overload set segments_encoded_ref::erase

Members

Overload set segments_encoded_ref::replace

Members

Function segments_encoded_ref::push_back

Append a segment

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L751[boost/url/segments_encoded_ref.hpp,window=blank_]>

void
push_back(pct_string_view s);

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.

Return Value

  • void

Parameters

Name Type

s

pct_string_view

Function segments_encoded_ref::pop_back

Remove the last segment

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L772[boost/url/segments_encoded_ref.hpp,window=blank_]>

void
pop_back() noexcept;

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.

Return Value

  • void

Class segments_ref

A view representing path segments in a URL

Synopsis

Declared in header </boost/url/segments_ref.hpp#L85[boost/url/segments_ref.hpp,window=blank_]>

class segments_ref
    : public segments_base;

Types

Name

Description

const_iterator

iterator

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

iterator

reference

The reference type

size_type

An unsigned integer type used to represent size.

value_type

The value type

Member Functions

Name

Description

assign

Assign segments

back

Return the last segment

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

clear

Clear the contents of the container

empty

Return true if there are no segments

end

Return an iterator to the end

erase

Erase segments

front

Return the first segment

insert

Insert segments

is_absolute

Returns true if this references an absolute path.

operator segments_view

Conversion

operator=

Assignment

pop_back

Remove the last segment

push_back

Append a segment

replace

Replace segments

segments_ref

Constructor

size

Return the number of segments

url

Return the referenced url

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Description

Objects of this type are used to interpret the path as a bidirectional view of 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:

Function segments_ref::segments_ref

Constructor

Synopsis

Declared in header </boost/url/segments_ref.hpp#L124[boost/url/segments_ref.hpp,window=blank_]>

constexpr
segments_ref(const segments_ref& other) = default;

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.

Return Value

  • void

Parameters

Name Type

other

``

Overload set segments_ref::operator=

Members

Assignment

segments_ref&
operator=(const segments_ref& other);
  » more...
segments_ref&
operator=(const segments_view& other);
  » more...

Assignment

segments_ref&
operator=(initializer_list<string_view> init);
  » more...

Function segments_ref::operator segments_view

Conversion

Synopsis

Declared in header </boost/url/segments_ref.hpp#L214[boost/url/segments_ref.hpp,window=blank_]>

operator segments_view() const noexcept;

Function segments_ref::url

Return the referenced url

Synopsis

Declared in header </boost/url/segments_ref.hpp#L238[boost/url/segments_ref.hpp,window=blank_]>

url_base&
url() const noexcept;

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.

Return Value

  • ``

Function segments_ref::clear

Clear the contents of the container

Synopsis

Declared in header </boost/url/segments_ref.hpp#L271[boost/url/segments_ref.hpp,window=blank_]>

void
clear() noexcept;

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.

Return Value

  • void

Overload set segments_ref::assign

Members

Assign segments

void
assign(initializer_list<string_view> init);
  » more...

Assign segments

template<class FwdIt>
void
assign(
    FwdIt first,
    FwdIt last);
  » more...

Overload set segments_ref::insert

Members

Insert segments

segments_base::iterator
insert(
    segments_base::iterator before,
    string_view s);
  » more...

Insert segments

segments_base::iterator
insert(
    segments_base::iterator before,
    initializer_list<string_view> init);
  » more...

Insert segments

template<class FwdIt>
segments_base::iterator
insert(
    segments_base::iterator before,
    FwdIt first,
    FwdIt last);
  » more...

Overload set segments_ref::erase

Members

Erase segments

Erase segments

Overload set segments_ref::replace

Members

Replace segments

segments_base::iterator
replace(
    segments_base::iterator pos,
    string_view s);
  » more...

Replace segments

Replace segments

segments_base::iterator
replace(
    segments_base::iterator from,
    segments_base::iterator to,
    initializer_list<string_view> init);
  » more...

Replace segments

template<class FwdIt>
segments_base::iterator
replace(
    segments_base::iterator from,
    segments_base::iterator to,
    FwdIt first,
    FwdIt last);
  » more...

Function segments_ref::push_back

Append a segment

Synopsis

Declared in header </boost/url/segments_ref.hpp#L693[boost/url/segments_ref.hpp,window=blank_]>

void
push_back(string_view s);

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.

Return Value

  • void

Parameters

Name Type

s

string_view

Function segments_ref::pop_back

Remove the last segment

Synopsis

Declared in header </boost/url/segments_ref.hpp#L714[boost/url/segments_ref.hpp,window=blank_]>

void
pop_back() noexcept;

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.

Return Value

  • void

Class url_view_base

Common functionality for containers

Synopsis

Declared in header </boost/url/url_view_base.hpp#L65[boost/url/url_view_base.hpp,window=blank_]>

class url_view_base;

Member Functions

Name

Description

authority

Return the authority

buffer

Return the url string

compare

Return the result of comparing this with another url

data

Return a pointer to the url's character buffer

digest

empty

Return true if the url is empty

encoded_authority

Return the authority.

encoded_fragment

Return the fragment

encoded_host

Return the host

encoded_host_address

Return the host

encoded_host_and_port

Return the host and port

encoded_host_name

Return the host name

encoded_origin

Return the origin

encoded_params

Return the query as a container of parameters

encoded_password

Return the password

encoded_path

Return the path

encoded_query

Return the query

encoded_resource

Return the resource

encoded_segments

Return the path as a container of segments

encoded_target

Return the target

encoded_user

Return the user

encoded_userinfo

Return the userinfo

encoded_zone_id

Return the IPv6 Zone ID

fragment

Return the fragment

has_authority

Return true if an authority is present

has_fragment

Return true if a fragment is present

has_password

Return true if a password is present

has_port

Return true if a port is present

has_query

Return true if a query is present

has_scheme

Return true a scheme is present

has_userinfo

Return true if a userinfo is present

host

Return the host

host_address

Return the host

host_ipv4_address

Return the host IPv4 address

host_ipv6_address

Return the host IPv6 address

host_ipvfuture

Return the host IPvFuture address

host_name

Return the host name

host_type

Return the host type

is_path_absolute

Return true if the path is absolute

operator string_view

Return the URL as a core::string_view

params

Return the query as a container of parameters

password

Return the password

path

Return the path

persist

Return a shared, persistent copy of the url

port

Return the port

port_number

Return the port

query

Return the query

scheme

Return the scheme

scheme_id

Return the scheme

segments

Return the path as a container of segments

size

Return the number of characters in the url

user

Return the user

userinfo

Return the userinfo

zone_id

Return the IPv6 Zone ID

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Friends

Name

Description

operator!=

Return the result of comparing two URLs

operator<

Return the result of comparing two URLs

operator<<

operator<=

Return the result of comparing two URLs

operator==

Return the result of comparing two URLs

operator>

Return the result of comparing two URLs

operator>=

Return the result of comparing two URLs

Description

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

Function url_view_base::digest

Synopsis

Declared in header </boost/url/url_view_base.hpp#L114[boost/url/url_view_base.hpp,window=blank_]>

size_t
digest(size_t = 0) const noexcept;

Function url_view_base::max_size

Return the maximum number of characters possible

Synopsis

Declared in header </boost/url/url_view_base.hpp#L139[boost/url/url_view_base.hpp,window=blank_]>

constexpr
static
size_t
max_size() noexcept;

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.

Return Value

  • size_t

Function url_view_base::size

Return the number of characters in the url

Synopsis

Declared in header </boost/url/url_view_base.hpp#L165[boost/url/url_view_base.hpp,window=blank_]>

size_t
size() const noexcept;

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.

Return Value

  • size_t

Function url_view_base::empty

Return true if the url is empty

Synopsis

Declared in header </boost/url/url_view_base.hpp#L201[boost/url/url_view_base.hpp,window=blank_]>

bool
empty() const noexcept;

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

Return Value

  • bool

Function url_view_base::data

Return a pointer to the url's character buffer

Synopsis

Declared in header </boost/url/url_view_base.hpp#L219[boost/url/url_view_base.hpp,window=blank_]>

const char*
data() const noexcept;

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.

Return Value

  • ``

Function url_view_base::buffer

Return the url string

Synopsis

Declared in header </boost/url/url_view_base.hpp#L241[boost/url/url_view_base.hpp,window=blank_]>

string_view
buffer() const noexcept;

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.

Return Value

  • string_view

Function url_view_base::operator string_view

Return the URL as a core::string_view

Synopsis

Declared in header </boost/url/url_view_base.hpp#L257[boost/url/url_view_base.hpp,window=blank_]>

operator string_view() const noexcept;

Description

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • string_view

Function url_view_base::persist

Return a shared, persistent copy of the url

Synopsis

Declared in header </boost/url/url_view_base.hpp#L297[boost/url/url_view_base.hpp,window=blank_]>

shared_ptr<const url_view>
persist() const;

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.

Return Value

  • shared_ptr

Function url_view_base::has_scheme

Return true a scheme is present

Synopsis

Declared in header </boost/url/url_view_base.hpp#L339[boost/url/url_view_base.hpp,window=blank_]>

bool
has_scheme() const noexcept;

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

Return Value

  • bool

Function url_view_base::scheme

Return the scheme

Synopsis

Declared in header </boost/url/url_view_base.hpp#L375[boost/url/url_view_base.hpp,window=blank_]>

string_view
scheme() const noexcept;

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

Return Value

  • string_view

Function url_view_base::scheme_id

Return the scheme

Synopsis

Declared in header </boost/url/url_view_base.hpp#L424[boost/url/url_view_base.hpp,window=blank_]>

scheme
scheme_id() const noexcept;

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

Return Value

  • scheme

Function url_view_base::has_authority

Return true if an authority is present

Synopsis

Declared in header </boost/url/url_view_base.hpp#L480[boost/url/url_view_base.hpp,window=blank_]>

bool
has_authority() const noexcept;

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

Return Value

  • bool

Function url_view_base::authority

Return the authority

Synopsis

Declared in header </boost/url/url_view_base.hpp#L515[boost/url/url_view_base.hpp,window=blank_]>

authority_view
authority() const noexcept;

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

Return Value

  • authority_view

Function url_view_base::encoded_authority

Return the authority.

Synopsis

Declared in header </boost/url/url_view_base.hpp#L551[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_authority() const noexcept;

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

Return Value

  • pct_string_view

Function url_view_base::has_userinfo

Return true if a userinfo is present

Synopsis

Declared in header </boost/url/url_view_base.hpp#L597[boost/url/url_view_base.hpp,window=blank_]>

bool
has_userinfo() const noexcept;

Description

This function returns true if this contains a userinfo.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

userinfo    = user [ ":" [ password ] ]

authority   = [ userinfo "@" ] host [ ":" port ]

Return Value

  • bool

Function url_view_base::has_password

Return true if a password is present

Synopsis

Declared in header </boost/url/url_view_base.hpp#L638[boost/url/url_view_base.hpp,window=blank_]>

bool
has_password() const noexcept;

Description

This function returns true if the userinfo is present and contains a password.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

Return Value

  • bool

Function url_view_base::userinfo

Return the userinfo

Synopsis

Declared in header </boost/url/url_view_base.hpp#L696[boost/url/url_view_base.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
userinfo(StringToken&& token) const;

Description

If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.

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 ]

Return Value

  • result_type

Parameters

Name Type

token

``

Function url_view_base::encoded_userinfo

Return the userinfo

Synopsis

Declared in header </boost/url/url_view_base.hpp#L746[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_userinfo() const noexcept;

Description

If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" );

Complexity

Constant.

Exception Safety

Throws nothing

BNF

userinfo    = user [ ":" [ password ] ]

authority   = [ userinfo "@" ] host [ ":" port ]

Return Value

  • pct_string_view

Function url_view_base::user

Return the user

Synopsis

Declared in header </boost/url/url_view_base.hpp#L793[boost/url/url_view_base.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
user(StringToken&& token) const;

Description

If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );

Complexity

Linear in this->user().size().

Exception Safety

Calls to allocate may throw.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

Return Value

  • result_type

Parameters

Name Type

token

``

Function url_view_base::encoded_user

Return the user

Synopsis

Declared in header </boost/url/url_view_base.hpp#L844[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_user() const noexcept;

Description

If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

Return Value

  • pct_string_view

Function url_view_base::password

Return the password

Synopsis

Declared in header </boost/url/url_view_base.hpp#L889[boost/url/url_view_base.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
password(StringToken&& token) const;

Description

If present, this function returns a string representing the password (which may be an empty string). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" );

Complexity

Linear in this->password().size().

Exception Safety

Calls to allocate may throw.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

Return Value

  • result_type

Parameters

Name Type

token

``

Function url_view_base::encoded_password

Return the password

Synopsis

Declared in header </boost/url/url_view_base.hpp#L936[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_password() const noexcept;

Description

This function returns the password portion of the userinfo as a percent-encoded string.

Example

assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )

Return Value

  • pct_string_view

Function url_view_base::host_type

Return the host type

Synopsis

Declared in header </boost/url/url_view_base.hpp#L975[boost/url/url_view_base.hpp,window=blank_]>

host_type
host_type() const noexcept;

Description

This function returns one of the following constants representing the type of host present.

Example

assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );

Complexity

Constant.

Exception Safety

Throws nothing.

Specification

Return Value

  • host_type

Function url_view_base::host

Return the host

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1014[boost/url/url_view_base.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
host(StringToken&& token) const;

Description

This function returns the host portion of the authority as a string, or the empty string if there is no authority. Any percent-escapes in the string are decoded first.

Example

assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" );

Complexity

Linear in this->host().size().

Exception Safety

Calls to allocate may throw.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

Return Value

  • result_type

Parameters

Name Type

token

``

Function url_view_base::encoded_host

Return the host

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1056[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_host() const noexcept;

Description

This function returns the host portion of the authority as a string, or the empty string if there is no authority. The returned string may contain percent escapes.

Example

assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

Return Value

  • pct_string_view

Function url_view_base::host_address

Return the host

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1109[boost/url/url_view_base.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
host_address(StringToken&& token) const;

Description

The value returned by this function depends on the type of host returned from the function host_type.

  • If the type is host_type::ipv4, then the IPv4 address string is returned.

  • If the type is host_type::ipv6, then the IPv6 address string is returned, without any enclosing brackets.

  • If the type is host_type::ipvfuture, then the IPvFuture address string is returned, without any enclosing brackets.

  • If the type is host_type::name, then the host name string is returned. Any percent-escapes in the string are decoded first.

  • If the type is host_type::none, then an empty string is returned.

Example

assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" );

Complexity

Linear in this->host_address().size().

Exception Safety

Calls to allocate may throw.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

Return Value

  • result_type

Parameters

Name Type

token

``

Function url_view_base::encoded_host_address

Return the host

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1170[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_host_address() const noexcept;

Description

The value returned by this function depends on the type of host returned from the function host_type.

  • If the type is host_type::ipv4, then the IPv4 address string is returned.

  • If the type is host_type::ipv6, then the IPv6 address string is returned, without any enclosing brackets.

  • If the type is host_type::ipvfuture, then the IPvFuture address string is returned, without any enclosing brackets.

  • If the type is host_type::name, then the host name string is returned. Any percent-escapes in the string are decoded first.

  • If the type is host_type::none, then an empty string is returned. The returned string may contain percent escapes.

Example

assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

Return Value

  • pct_string_view

Function url_view_base::host_ipv4_address

Return the host IPv4 address

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1209[boost/url/url_view_base.hpp,window=blank_]>

ipv4_address
host_ipv4_address() const noexcept;

Description

If the host type is host_type::ipv4, this function returns the address as a value of type ipv4_address. Otherwise, if the host type is not an IPv4 address, it returns a default-constructed value which is equal to the unspecified address "0.0.0.0".

Example

assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet

dec-octet   = DIGIT                 ; 0-9
            / %x31-39 DIGIT         ; 10-99
            / "1" 2DIGIT            ; 100-199
            / "2" %x30-34 DIGIT     ; 200-249
            / "25" %x30-35          ; 250-255

Specification

Return Value

  • ipv4_address

Function url_view_base::host_ipv6_address

Return the host IPv6 address

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1256[boost/url/url_view_base.hpp,window=blank_]>

ipv6_address
host_ipv6_address() const noexcept;

Description

If the host type is host_type::ipv6, this function returns the address as a value of type ipv6_address. Otherwise, if the host type is not an IPv6 address, it returns a default-constructed value which is equal to the unspecified address "0:0:0:0:0:0:0:0".

Example

assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

IPv6address =                            6( h16 ":" ) ls32
            /                       "::" 5( h16 ":" ) ls32
            / [               h16 ] "::" 4( h16 ":" ) ls32
            / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
            / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
            / [ *3( h16 ":" ) h16 ] "::"    h16 ":"   ls32
            / [ *4( h16 ":" ) h16 ] "::"              ls32
            / [ *5( h16 ":" ) h16 ] "::"              h16
            / [ *6( h16 ":" ) h16 ] "::"

ls32        = ( h16 ":" h16 ) / IPv4address
            ; least-significant 32 bits of address

h16         = 1*4HEXDIG
            ; 16 bits of address represented in hexadecimal

Specification

Return Value

  • ipv6_address

Function url_view_base::host_ipvfuture

Return the host IPvFuture address

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1288[boost/url/url_view_base.hpp,window=blank_]>

string_view
host_ipvfuture() const noexcept;

Description

If the host type is host_type::ipvfuture, this function returns the address as a string. Otherwise, if the host type is not an IPvFuture address, it returns an empty string.

Example

assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

IPvFuture  = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )

Specification

Return Value

  • string_view

Function url_view_base::host_name

Return the host name

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1324[boost/url/url_view_base.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
host_name(StringToken&& token) const;

Description

If the host type is host_type::name, this function returns the name as a string. Otherwise 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

Return Value

  • result_type

Parameters

Name Type

token

``

Function url_view_base::encoded_host_name

Return the host name

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1368[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_host_name() const noexcept;

Description

If the host type is host_type::name, this function returns the name as a string. Otherwise, if the host type is not an name, it returns an empty string. The returned string may contain percent escapes.

Example

assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

host        = IP-literal / IPv4address / reg-name

IP-literal  = "[" ( IPv6address / IPvFuture  ) "]"

reg-name    = *( unreserved / pct-encoded / "-" / ".")

Specification

Return Value

  • pct_string_view

Function url_view_base::zone_id

Return the IPv6 Zone ID

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1406[boost/url/url_view_base.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
zone_id(StringToken&& token) const;

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

Return Value

  • result_type

Parameters

Name Type

token

``

Function url_view_base::encoded_zone_id

Return the IPv6 Zone ID

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1450[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_zone_id() const noexcept;

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

Return Value

  • pct_string_view

Function url_view_base::has_port

Return true if a port is present

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1491[boost/url/url_view_base.hpp,window=blank_]>

bool
has_port() const noexcept;

Description

This function returns true if an authority is present and contains a port.

Example

assert( url_view( "wss://www.example.com:443" ).has_port() );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

authority   = [ userinfo "@" ] host [ ":" port ]

port        = *DIGIT

Specification

Return Value

  • bool

Function url_view_base::port

Return the port

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1526[boost/url/url_view_base.hpp,window=blank_]>

string_view
port() const noexcept;

Description

If present, this function returns a string representing the port (which may be empty). Otherwise it returns an empty string.

Example

assert( url_view( "http://localhost.com:8080" ).port() == "8080" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

port        = *DIGIT

Specification

Return Value

  • string_view

Function url_view_base::port_number

Return the port

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1561[boost/url/url_view_base.hpp,window=blank_]>

uint16_t
port_number() const noexcept;

Description

If a port is present and the numerical value is representable, it is returned as an unsigned integer. Otherwise, the number zero is returned.

Example

assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

port        = *DIGIT

Specification

Return Value

  • uint16_t

Function url_view_base::is_path_absolute

Return true if the path is absolute

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1611[boost/url/url_view_base.hpp,window=blank_]>

bool
is_path_absolute() const noexcept;

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

Specification

Return Value

  • bool

Function url_view_base::path

Return the path

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1663[boost/url/url_view_base.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
path(StringToken&& token) const;

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

Specification

Return Value

  • result_type

Parameters

Name Type

token

``

Function url_view_base::encoded_path

Return the path

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1716[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_path() const noexcept;

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

Specification

Return Value

  • pct_string_view

Function url_view_base::segments

Return the path as a container of segments

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1756[boost/url/url_view_base.hpp,window=blank_]>

segments_view
segments() const noexcept;

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

Return Value

  • segments_view

Function url_view_base::encoded_segments

Return the path as a container of segments

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1806[boost/url/url_view_base.hpp,window=blank_]>

segments_encoded_view
encoded_segments() const noexcept;

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

Specification

Return Value

  • segments_encoded_view

Function url_view_base::has_query

Return true if a query is present

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1852[boost/url/url_view_base.hpp,window=blank_]>

bool
has_query() const noexcept;

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)

Return Value

  • bool

Function url_view_base::query

Return the query

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1901[boost/url/url_view_base.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
query(StringToken&& token) const;

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)

Return Value

  • result_type

Parameters

Name Type

token

``

Function url_view_base::encoded_query

Return the query

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1953[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_query() const noexcept;

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)

Return Value

  • pct_string_view

Overload set url_view_base::params

Members

Return the query as a container of parameters

params_view
params() const noexcept;
  » more...
params_view
params(encoding_opts opt) const noexcept;
  » more...

Function url_view_base::encoded_params

Return the query as a container of parameters

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2048[boost/url/url_view_base.hpp,window=blank_]>

params_encoded_view
encoded_params() const noexcept;

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

BNF

query           = *( pchar / "/" / "?" )

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

Specification

  • ://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)

Return Value

  • params_encoded_view

Function url_view_base::has_fragment

Return true if a fragment is present

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2090[boost/url/url_view_base.hpp,window=blank_]>

bool
has_fragment() const noexcept;

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

Return Value

  • bool

Function url_view_base::fragment

Return the fragment

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2149[boost/url/url_view_base.hpp,window=blank_]>

template<class StringToken = string_token::return_string>
StringToken::result_type
fragment(StringToken&& token) const;

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

Return Value

  • result_type

Parameters

Name Type

token

``

Function url_view_base::encoded_fragment

Return the fragment

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2194[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_fragment() const noexcept;

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

Return Value

  • pct_string_view

Function url_view_base::encoded_host_and_port

Return the host and port

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2239[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_host_and_port() const noexcept;

Description

If an authority is present, this function returns the host and optional port as a string, which may be empty. Otherwise it returns an empty string. The returned string may contain percent escapes.

Example

assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

authority   = [ userinfo "@" ] host [ ":" port ]

Return Value

  • pct_string_view

Function url_view_base::encoded_origin

Return the origin

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2267[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_origin() const noexcept;

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.

Return Value

  • pct_string_view

Function url_view_base::encoded_resource

Return the resource

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2299[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_resource() const noexcept;

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.

Return Value

  • pct_string_view

Function url_view_base::encoded_target

Return the target

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2331[boost/url/url_view_base.hpp,window=blank_]>

pct_string_view
encoded_target() const noexcept;

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.

Return Value

  • pct_string_view

Function url_view_base::compare

Return the result of comparing this with another url

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2359[boost/url/url_view_base.hpp,window=blank_]>

int
compare(const url_view_base& other) const noexcept;

Description

This function compares two URLs according to Syntax-Based comparison algorithm.

Complexity

Linear in min( u0.size(), u1.size() )

Exception Safety

Throws nothing.

Return Value

  • int

Parameters

Name Type

other

``

Friend operator==

Return the result of comparing two URLs

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2413[boost/url/url_view_base.hpp,window=blank_]>

friend
bool
operator==(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;

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

Friend operator!=

Return the result of comparing two URLs

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2473[boost/url/url_view_base.hpp,window=blank_]>

friend
bool
operator!=(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;

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

Friend operator<

Return the result of comparing two URLs

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2533[boost/url/url_view_base.hpp,window=blank_]>

friend
bool
operator<(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;

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

Friend operator⇐

Return the result of comparing two URLs

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2593[boost/url/url_view_base.hpp,window=blank_]>

friend
bool
operator<=(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;

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

Friend operator>

Return the result of comparing two URLs

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2653[boost/url/url_view_base.hpp,window=blank_]>

friend
bool
operator>(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;

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

Friend operator>=

Return the result of comparing two URLs

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2713[boost/url/url_view_base.hpp,window=blank_]>

friend
bool
operator>=(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;

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

Friend operator<<

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2722[boost/url/url_view_base.hpp,window=blank_]>

friend
ostream&
operator<<(
    ostream& os,
    const url_view_base& u);

Function resolve

Resolve a URL reference against a base URL

Synopsis

Declared in header </boost/url/url_base.hpp#L2744[boost/url/url_base.hpp,window=blank_]>

result<void>
resolve(
    const url_view_base& base,
    const url_view_base& ref,
    url_base& dest);

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.

Return Value

  • result

Parameters

Name Type

base

``

ref

``

dest

``

Class url

A modifiable container for a URL.

Synopsis

Declared in header </boost/url/url.hpp#L63[boost/url/url.hpp,window=blank_]>

class url
    : public url_base;

Member Functions

Name

Description

authority

Return the authority

buffer

Return the url string

c_str

Return the url as a null-terminated string

capacity

Return the number of characters that can be stored without reallocating

clear

Clear the contents while preserving the capacity

compare

Return the result of comparing this with another url

data

Return a pointer to the url's character buffer

digest

empty

Return true if the url is empty

encoded_authority

Return the authority.

encoded_fragment

Return the fragment

encoded_host

Return the host

encoded_host_address

Return the host

encoded_host_and_port

Return the host and port

encoded_host_name

Return the host name

encoded_origin

Return the origin

encoded_params

Return the query as a container of parameters

encoded_password

Return the password

encoded_path

Return the path

encoded_query

Return the query

encoded_resource

Return the resource

encoded_segments

Return the path as a container of segments

encoded_target

Return the target

encoded_user

Return the user

encoded_userinfo

Return the userinfo

encoded_zone_id

Return the IPv6 Zone ID

fragment

Return the fragment

has_authority

Return true if an authority is present

has_fragment

Return true if a fragment is present

has_password

Return true if a password is present

has_port

Return true if a port is present

has_query

Return true if a query is present

has_scheme

Return true a scheme is present

has_userinfo

Return true if a userinfo is present

host

Return the host

host_address

Return the host

host_ipv4_address

Return the host IPv4 address

host_ipv6_address

Return the host IPv6 address

host_ipvfuture

Return the host IPvFuture address

host_name

Return the host name

host_type

Return the host type

is_path_absolute

Return true if the path is absolute

normalize

Normalize the URL components

normalize_authority

Normalize the URL authority

normalize_fragment

Normalize the URL fragment

normalize_path

Normalize the URL path

normalize_query

Normalize the URL query

normalize_scheme

Normalize the URL scheme

operator string_view

Return the URL as a core::string_view

operator=

Assignment

params

Return the query as a container of parameters

url_view_base::params

password

Return the password

path

Return the path

persist

Return a shared, persistent copy of the url

port

Return the port

port_number

Return the port

query

Return the query

remove_authority

Remove the authority

remove_fragment

Remove the fragment

remove_origin

Remove the origin component

remove_password

Remove the password

remove_port

Remove the port

remove_query

Remove the query

remove_scheme

Remove the scheme

remove_userinfo

Remove the userinfo

reserve

Adjust the capacity without changing the size

resolve

Resolve a URL reference against this base URL

scheme

Return the scheme

scheme_id

Return the scheme

segments

Return the path as a container of segments

set_encoded_authority

Set the authority

set_encoded_fragment

Set the fragment.

set_encoded_host

Set the host

set_encoded_host_address

Set the host to an address

set_encoded_host_name

Set the host to a name

set_encoded_params

Set the query params

set_encoded_password

Set the password.

set_encoded_path

Set the path.

set_encoded_query

Set the query

set_encoded_user

Set the user

set_encoded_userinfo

Set the userinfo.

set_fragment

Set the fragment.

set_host

Set the host

set_host_address

Set the host to an address

set_host_ipv4

Set the host to an address

set_host_ipv6

Set the host to an address

set_host_ipvfuture

Set the host to an address

set_host_name

Set the host to a name

set_params

Set the query params

set_password

Set the password.

set_path

Set the path.

set_path_absolute

Set if the path is absolute

set_port

Set the port

set_port_number

Set the port

set_query

Set the query

set_scheme

Set the scheme

set_scheme_id

url_base::set_scheme_id

set_user

Set the user

set_userinfo

Set the userinfo

size

Return the number of characters in the url

swap

Swap the contents.

url

Constructor

user

Return the user

userinfo

Return the userinfo

zone_id

Return the IPv6 Zone ID

~url

Destructor

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Friends

Name

Description

operator!=

Return the result of comparing two URLs

operator<

Return the result of comparing two URLs

operator<<

operator<=

Return the result of comparing two URLs

operator==

Return the result of comparing two URLs

operator>

Return the result of comparing two URLs

operator>=

Return the result of comparing two URLs

resolve

swap

Swap

Description

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

Exception Safety

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

  • Functions which throw offer the strong exception safety guarantee.

BNF

URI-reference = URI / relative-ref

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

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

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

Function url::~url

Destructor

Synopsis

Declared in header </boost/url/url.hpp#L85[boost/url/url.hpp,window=blank_]>

virtual
~url();

Description

Any params, segments, iterators, or views which reference this object are invalidated. The underlying character buffer is destroyed, invalidating all references to it.

Return Value

  • void

Overload set url::url

Members

Constructor

url() noexcept = default;
  » more...

Constructor

url(string_view s);
  » more...

Constructor

url(url&& u) noexcept;
  » more...

Constructor

url(const url_view_base& u);
  » more...

Constructor

url(const url& u);
  » more...

Overload set url::operator=

Members

Assignment

url&
operator=(url&& u) noexcept;
  » more...

Assignment

url&
operator=(const url_view_base& u);
  » more...

Assignment

url&
operator=(const url& u);
  » more...

Function url::swap

Swap the contents.

Synopsis

Declared in header </boost/url/url.hpp#L360[boost/url/url.hpp,window=blank_]>

void
swap(url& other) noexcept;

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.

Return Value

  • void

Parameters

Name Type

other

``

Friend swap

Swap

Synopsis

Declared in header </boost/url/url.hpp#L396[boost/url/url.hpp,window=blank_]>

friend
void
swap(
    url& v0,
    url& v1) noexcept;

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

Function url::set_scheme

Set the scheme

Synopsis

Declared in header </boost/url/url.hpp#L409[boost/url/url.hpp,window=blank_]>

url&
set_scheme(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url::set_scheme_id

url_base::set_scheme_id

Synopsis

Declared in header </boost/url/url.hpp#L411[boost/url/url.hpp,window=blank_]>

url&
set_scheme_id(scheme id);

Function url::remove_scheme

Remove the scheme

Synopsis

Declared in header </boost/url/url.hpp#L413[boost/url/url.hpp,window=blank_]>

url&
remove_scheme();

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

Return Value

  • ``

Function url::set_encoded_authority

Set the authority

Synopsis

Declared in header </boost/url/url.hpp#L416[boost/url/url.hpp,window=blank_]>

url&
set_encoded_authority(pct_string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url::remove_authority

Remove the authority

Synopsis

Declared in header </boost/url/url.hpp#L418[boost/url/url.hpp,window=blank_]>

url&
remove_authority();

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

Return Value

  • ``

Function url::set_userinfo

Set the userinfo

Synopsis

Declared in header </boost/url/url.hpp#L421[boost/url/url.hpp,window=blank_]>

url&
set_userinfo(string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url::set_encoded_userinfo

Set the userinfo.

Synopsis

Declared in header </boost/url/url.hpp#L423[boost/url/url.hpp,window=blank_]>

url&
set_encoded_userinfo(pct_string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url::remove_userinfo

Remove the userinfo

Synopsis

Declared in header </boost/url/url.hpp#L425[boost/url/url.hpp,window=blank_]>

url&
remove_userinfo() noexcept;

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 / ":" )

Return Value

  • ``

Function url::set_user

Set the user

Synopsis

Declared in header </boost/url/url.hpp#L427[boost/url/url.hpp,window=blank_]>

url&
set_user(string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url::set_encoded_user

Set the user

Synopsis

Declared in header </boost/url/url.hpp#L429[boost/url/url.hpp,window=blank_]>

url&
set_encoded_user(pct_string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url::set_password

Set the password.

Synopsis

Declared in header </boost/url/url.hpp#L431[boost/url/url.hpp,window=blank_]>

url&
set_password(string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url::set_encoded_password

Set the password.

Synopsis

Declared in header </boost/url/url.hpp#L433[boost/url/url.hpp,window=blank_]>

url&
set_encoded_password(pct_string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url::remove_password

Remove the password

Synopsis

Declared in header </boost/url/url.hpp#L435[boost/url/url.hpp,window=blank_]>

url&
remove_password() noexcept;

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 / ":" )

Return Value

  • ``

Function url::set_host

Set the host

Synopsis

Declared in header </boost/url/url.hpp#L438[boost/url/url.hpp,window=blank_]>

url&
set_host(string_view s);

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 / "-" / ".")

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url::set_encoded_host

Set the host

Synopsis

Declared in header </boost/url/url.hpp#L440[boost/url/url.hpp,window=blank_]>

url&
set_encoded_host(pct_string_view s);

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 / "-" / ".")

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url::set_host_address

Set the host to an address

Synopsis

Declared in header </boost/url/url.hpp#L442[boost/url/url.hpp,window=blank_]>

url&
set_host_address(string_view s);

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 / "-" / ".")

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url::set_encoded_host_address

Set the host to an address

Synopsis

Declared in header </boost/url/url.hpp#L444[boost/url/url.hpp,window=blank_]>

url&
set_encoded_host_address(pct_string_view s);

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 / "-" / ".")

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url::set_host_ipv4

Set the host to an address

Synopsis

Declared in header </boost/url/url.hpp#L446[boost/url/url.hpp,window=blank_]>

url&
set_host_ipv4(const ipv4_address& addr);

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

Return Value

  • ``

Parameters

Name Type

addr

``

Function url::set_host_ipv6

Set the host to an address

Synopsis

Declared in header </boost/url/url.hpp#L448[boost/url/url.hpp,window=blank_]>

url&
set_host_ipv6(const ipv6_address& addr);

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

Return Value

  • ``

Parameters

Name Type

addr

``

Function url::set_host_ipvfuture

Set the host to an address

Synopsis

Declared in header </boost/url/url.hpp#L450[boost/url/url.hpp,window=blank_]>

url&
set_host_ipvfuture(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url::set_host_name

Set the host to a name

Synopsis

Declared in header </boost/url/url.hpp#L452[boost/url/url.hpp,window=blank_]>

url&
set_host_name(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url::set_encoded_host_name

Set the host to a name

Synopsis

Declared in header </boost/url/url.hpp#L454[boost/url/url.hpp,window=blank_]>

url&
set_encoded_host_name(pct_string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url::set_port_number

Set the port

Synopsis

Declared in header </boost/url/url.hpp#L456[boost/url/url.hpp,window=blank_]>

url&
set_port_number(uint16_t n);

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

Return Value

  • ``

Parameters

Name Type

n

uint16_t

Function url::set_port

Set the port

Synopsis

Declared in header </boost/url/url.hpp#L458[boost/url/url.hpp,window=blank_]>

url&
set_port(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url::remove_port

Remove the port

Synopsis

Declared in header </boost/url/url.hpp#L460[boost/url/url.hpp,window=blank_]>

url&
remove_port() noexcept;

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

Return Value

  • ``

Function url::set_path

Set the path.

Synopsis

Declared in header </boost/url/url.hpp#L465[boost/url/url.hpp,window=blank_]>

url&
set_path(string_view s);

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

Specification

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url::set_encoded_path

Set the path.

Synopsis

Declared in header </boost/url/url.hpp#L467[boost/url/url.hpp,window=blank_]>

url&
set_encoded_path(pct_string_view s);

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

Specification

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url::set_query

Set the query

Synopsis

Declared in header </boost/url/url.hpp#L470[boost/url/url.hpp,window=blank_]>

url&
set_query(string_view s);

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 )

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url::set_encoded_query

Set the query

Synopsis

Declared in header </boost/url/url.hpp#L472[boost/url/url.hpp,window=blank_]>

url&
set_encoded_query(pct_string_view s);

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 )

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url::set_params

Set the query params

Synopsis

Declared in header </boost/url/url.hpp#L474[boost/url/url.hpp,window=blank_]>

url&
set_params(initializer_list<param_view> ps);

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)

Return Value

  • ``

Parameters

Name Type

ps

initializer_list

Function url::set_encoded_params

Set the query params

Synopsis

Declared in header </boost/url/url.hpp#L476[boost/url/url.hpp,window=blank_]>

url&
set_encoded_params(initializer_list<param_pct_view> ps);

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 )

Return Value

  • ``

Parameters

Name Type

ps

initializer_list

Function url::remove_query

Remove the query

Synopsis

Declared in header </boost/url/url.hpp#L478[boost/url/url.hpp,window=blank_]>

url&
remove_query() noexcept;

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 )

Return Value

  • ``

Function url::remove_fragment

Remove the fragment

Synopsis

Declared in header </boost/url/url.hpp#L481[boost/url/url.hpp,window=blank_]>

url&
remove_fragment() noexcept;

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

Return Value

  • ``

Function url::set_fragment

Set the fragment.

Synopsis

Declared in header </boost/url/url.hpp#L483[boost/url/url.hpp,window=blank_]>

url&
set_fragment(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function url::set_encoded_fragment

Set the fragment.

Synopsis

Declared in header </boost/url/url.hpp#L485[boost/url/url.hpp,window=blank_]>

url&
set_encoded_fragment(pct_string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function url::remove_origin

Remove the origin component

Synopsis

Declared in header </boost/url/url.hpp#L488[boost/url/url.hpp,window=blank_]>

url&
remove_origin();

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.

Return Value

  • ``

Function url::normalize

Normalize the URL components

Synopsis

Declared in header </boost/url/url.hpp#L491[boost/url/url.hpp,window=blank_]>

url&
normalize();

Description

Applies Syntax-based normalization to all components of the URL.

Exception Safety

Strong guarantee. Calls to allocate may throw.

Return Value

  • ``

Function url::normalize_scheme

Normalize the URL scheme

Synopsis

Declared in header </boost/url/url.hpp#L493[boost/url/url.hpp,window=blank_]>

url&
normalize_scheme();

Description

Applies Syntax-based normalization to the URL scheme. The scheme is normalized to lowercase.

Exception Safety

Strong guarantee. Calls to allocate may throw.

Return Value

  • ``

Function url::normalize_authority

Normalize the URL authority

Synopsis

Declared in header </boost/url/url.hpp#L495[boost/url/url.hpp,window=blank_]>

url&
normalize_authority();

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.

Return Value

  • ``

Function url::normalize_path

Normalize the URL path

Synopsis

Declared in header </boost/url/url.hpp#L497[boost/url/url.hpp,window=blank_]>

url&
normalize_path();

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.

Return Value

  • ``

Function url::normalize_query

Normalize the URL query

Synopsis

Declared in header </boost/url/url.hpp#L499[boost/url/url.hpp,window=blank_]>

url&
normalize_query();

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.

Return Value

  • ``

Function url::normalize_fragment

Normalize the URL fragment

Synopsis

Declared in header </boost/url/url.hpp#L501[boost/url/url.hpp,window=blank_]>

url&
normalize_fragment();

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.

Return Value

  • ``

Function swap

Swap

Synopsis

Declared in header </boost/url/url.hpp#L396[boost/url/url.hpp,window=blank_]>

void
swap(
    url& v0,
    url& v1) noexcept;

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

Return Value

  • void

Parameters

Name Type

v0

``

v1

``

Class ipv4_address_rule_t

Synopsis

Declared in header </boost/url/rfc/ipv4_address_rule.hpp#L58[boost/url/rfc/ipv4_address_rule.hpp,window=blank_]>

struct ipv4_address_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

ipv4_address_rule_t::value_type

Synopsis

Declared in header </boost/url/rfc/ipv4_address_rule.hpp#L60[boost/url/rfc/ipv4_address_rule.hpp,window=blank_]>

using value_type = ipv4_address;

Function ipv4_address_rule_t::parse

Synopsis

Declared in header </boost/url/rfc/ipv4_address_rule.hpp#L64[boost/url/rfc/ipv4_address_rule.hpp,window=blank_]>

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

ipv4_address_rule

Synopsis

Declared in header </boost/url/rfc/ipv4_address_rule.hpp#L72[boost/url/rfc/ipv4_address_rule.hpp,window=blank_]>

constexpr
const ipv4_address_rule_t ipv4_address_rule;

Class ipv6_address_rule_t

Synopsis

Declared in header </boost/url/rfc/ipv6_address_rule.hpp#L66[boost/url/rfc/ipv6_address_rule.hpp,window=blank_]>

struct ipv6_address_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

ipv6_address_rule_t::value_type

Synopsis

Declared in header </boost/url/rfc/ipv6_address_rule.hpp#L68[boost/url/rfc/ipv6_address_rule.hpp,window=blank_]>

using value_type = ipv6_address;

Function ipv6_address_rule_t::parse

Synopsis

Declared in header </boost/url/rfc/ipv6_address_rule.hpp#L72[boost/url/rfc/ipv6_address_rule.hpp,window=blank_]>

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

ipv6_address_rule

Synopsis

Declared in header </boost/url/rfc/ipv6_address_rule.hpp#L80[boost/url/rfc/ipv6_address_rule.hpp,window=blank_]>

constexpr
const ipv6_address_rule_t ipv6_address_rule;

Function parse_absolute_uri

Return a reference to a parsed URL string

Synopsis

Declared in header </boost/url/parse.hpp#L65[boost/url/parse.hpp,window=blank_]>

result<url_view>
parse_absolute_uri(string_view s);

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

Return Value

  • result

Parameters

Name Type

s

string_view

Function parse_origin_form

Return a reference to a parsed URL string

Synopsis

Declared in header </boost/url/parse.hpp#L112[boost/url/parse.hpp,window=blank_]>

result<url_view>
parse_origin_form(string_view s);

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 )

Return Value

  • result

Parameters

Name Type

s

string_view

Function parse_relative_ref

Return a reference to a parsed URL string

Synopsis

Declared in header </boost/url/parse.hpp#L165[boost/url/parse.hpp,window=blank_]>

result<url_view>
parse_relative_ref(string_view s);

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

Return Value

  • result

Parameters

Name Type

s

string_view

Function parse_uri

Return a reference to a parsed URL string

Synopsis

Declared in header </boost/url/parse.hpp#L215[boost/url/parse.hpp,window=blank_]>

result<url_view>
parse_uri(string_view s);

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

Return Value

  • result

Parameters

Name Type

s

string_view

Function parse_uri_reference

Return a reference to a parsed URL string

Synopsis

Declared in header </boost/url/parse.hpp#L277[boost/url/parse.hpp,window=blank_]>

result<url_view>
parse_uri_reference(string_view s);

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

Return Value

  • result

Parameters

Name Type

s

string_view

Class absolute_uri_rule_t

Synopsis

Declared in header </boost/url/rfc/absolute_uri_rule.hpp#L55[boost/url/rfc/absolute_uri_rule.hpp,window=blank_]>

struct absolute_uri_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

absolute_uri_rule_t::value_type

Synopsis

Declared in header </boost/url/rfc/absolute_uri_rule.hpp#L57[boost/url/rfc/absolute_uri_rule.hpp,window=blank_]>

using value_type = url_view;

Function absolute_uri_rule_t::parse

Synopsis

Declared in header </boost/url/rfc/absolute_uri_rule.hpp#L60[boost/url/rfc/absolute_uri_rule.hpp,window=blank_]>

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

absolute_uri_rule

Synopsis

Declared in header </boost/url/rfc/absolute_uri_rule.hpp#L68[boost/url/rfc/absolute_uri_rule.hpp,window=blank_]>

constexpr
const absolute_uri_rule_t absolute_uri_rule;

Class relative_ref_rule_t

Synopsis

Declared in header </boost/url/rfc/relative_ref_rule.hpp#L50[boost/url/rfc/relative_ref_rule.hpp,window=blank_]>

struct relative_ref_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

relative_ref_rule_t::value_type

Synopsis

Declared in header </boost/url/rfc/relative_ref_rule.hpp#L52[boost/url/rfc/relative_ref_rule.hpp,window=blank_]>

using value_type = url_view;

Function relative_ref_rule_t::parse

Synopsis

Declared in header </boost/url/rfc/relative_ref_rule.hpp#L55[boost/url/rfc/relative_ref_rule.hpp,window=blank_]>

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

relative_ref_rule

Synopsis

Declared in header </boost/url/rfc/relative_ref_rule.hpp#L63[boost/url/rfc/relative_ref_rule.hpp,window=blank_]>

constexpr
const relative_ref_rule_t relative_ref_rule;

Class uri_rule_t

Synopsis

Declared in header </boost/url/rfc/uri_rule.hpp#L50[boost/url/rfc/uri_rule.hpp,window=blank_]>

struct uri_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

uri_rule_t::value_type

Synopsis

Declared in header </boost/url/rfc/uri_rule.hpp#L52[boost/url/rfc/uri_rule.hpp,window=blank_]>

using value_type = url_view;

Function uri_rule_t::parse

Synopsis

Declared in header </boost/url/rfc/uri_rule.hpp#L55[boost/url/rfc/uri_rule.hpp,window=blank_]>

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

uri_rule

Synopsis

Declared in header </boost/url/rfc/uri_rule.hpp#L63[boost/url/rfc/uri_rule.hpp,window=blank_]>

constexpr
const uri_rule_t uri_rule;

Class uri_reference_rule_t

Synopsis

Declared in header </boost/url/rfc/uri_reference_rule.hpp#L53[boost/url/rfc/uri_reference_rule.hpp,window=blank_]>

struct uri_reference_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

uri_reference_rule_t::value_type

Synopsis

Declared in header </boost/url/rfc/uri_reference_rule.hpp#L55[boost/url/rfc/uri_reference_rule.hpp,window=blank_]>

using value_type = url_view;

Function uri_reference_rule_t::parse

Synopsis

Declared in header </boost/url/rfc/uri_reference_rule.hpp#L58[boost/url/rfc/uri_reference_rule.hpp,window=blank_]>

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

uri_reference_rule

Synopsis

Declared in header </boost/url/rfc/uri_reference_rule.hpp#L66[boost/url/rfc/uri_reference_rule.hpp,window=blank_]>

constexpr
const uri_reference_rule_t uri_reference_rule;

Class origin_form_rule_t

Synopsis

Declared in header </boost/url/rfc/origin_form_rule.hpp#L53[boost/url/rfc/origin_form_rule.hpp,window=blank_]>

struct origin_form_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

origin_form_rule_t::value_type

Synopsis

Declared in header </boost/url/rfc/origin_form_rule.hpp#L55[boost/url/rfc/origin_form_rule.hpp,window=blank_]>

using value_type = url_view;

Function origin_form_rule_t::parse

Synopsis

Declared in header </boost/url/rfc/origin_form_rule.hpp#L59[boost/url/rfc/origin_form_rule.hpp,window=blank_]>

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

origin_form_rule

Synopsis

Declared in header </boost/url/rfc/origin_form_rule.hpp#L66[boost/url/rfc/origin_form_rule.hpp,window=blank_]>

constexpr
const origin_form_rule_t origin_form_rule;

Class query_rule_t

Synopsis

Declared in header </boost/url/rfc/query_rule.hpp#L60[boost/url/rfc/query_rule.hpp,window=blank_]>

struct query_rule_t;

Types

Name

Description

value_type

Member Functions

Name

Description

parse

query_rule_t::value_type

Synopsis

Declared in header </boost/url/rfc/query_rule.hpp#L62[boost/url/rfc/query_rule.hpp,window=blank_]>

using value_type = params_encoded_view;

Function query_rule_t::parse

Synopsis

Declared in header </boost/url/rfc/query_rule.hpp#L65[boost/url/rfc/query_rule.hpp,window=blank_]>

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

query_rule

Synopsis

Declared in header </boost/url/rfc/query_rule.hpp#L72[boost/url/rfc/query_rule.hpp,window=blank_]>

constexpr
const query_rule_t query_rule;

Class static_url

A modifiable container for a URL.

Synopsis

Declared in header </boost/url/static_url.hpp#L107[boost/url/static_url.hpp,window=blank_]>

template<size_t Capacity>
class static_url
    : public static_url_base;

Member Functions

Name

Description

authority

Return the authority

buffer

Return the url string

c_str

Return the url as a null-terminated string

capacity

Return the number of characters that can be stored without reallocating

clear

Clear the contents while preserving the capacity

compare

Return the result of comparing this with another url

data

Return a pointer to the url's character buffer

digest

empty

Return true if the url is empty

encoded_authority

Return the authority.

encoded_fragment

Return the fragment

encoded_host

Return the host

encoded_host_address

Return the host

encoded_host_and_port

Return the host and port

encoded_host_name

Return the host name

encoded_origin

Return the origin

encoded_params

Return the query as a container of parameters

encoded_password

Return the password

encoded_path

Return the path

encoded_query

Return the query

encoded_resource

Return the resource

encoded_segments

Return the path as a container of segments

encoded_target

Return the target

encoded_user

Return the user

encoded_userinfo

Return the userinfo

encoded_zone_id

Return the IPv6 Zone ID

fragment

Return the fragment

has_authority

Return true if an authority is present

has_fragment

Return true if a fragment is present

has_password

Return true if a password is present

has_port

Return true if a port is present

has_query

Return true if a query is present

has_scheme

Return true a scheme is present

has_userinfo

Return true if a userinfo is present

host

Return the host

host_address

Return the host

host_ipv4_address

Return the host IPv4 address

host_ipv6_address

Return the host IPv6 address

host_ipvfuture

Return the host IPvFuture address

host_name

Return the host name

host_type

Return the host type

is_path_absolute

Return true if the path is absolute

normalize

Normalize the URL components

normalize_authority

Normalize the URL authority

normalize_fragment

Normalize the URL fragment

normalize_path

Normalize the URL path

normalize_query

Normalize the URL query

normalize_scheme

Normalize the URL scheme

operator string_view

Return the URL as a core::string_view

operator=

Assignment

params

Return the query as a container of parameters

url_view_base::params

password

Return the password

path

Return the path

persist

Return a shared, persistent copy of the url

port

Return the port

port_number

Return the port

query

Return the query

remove_authority

Remove the authority

remove_fragment

Remove the fragment

remove_origin

Remove the origin component

remove_password

Remove the password

remove_port

Remove the port

remove_query

Remove the query

remove_scheme

Remove the scheme

remove_userinfo

Remove the userinfo

reserve

Adjust the capacity without changing the size

resolve

Resolve a URL reference against this base URL

scheme

Return the scheme

scheme_id

Return the scheme

segments

Return the path as a container of segments

set_encoded_authority

Set the authority

set_encoded_fragment

Set the fragment.

set_encoded_host

Set the host

set_encoded_host_address

Set the host to an address

set_encoded_host_name

Set the host to a name

set_encoded_params

Set the query params

set_encoded_password

Set the password.

set_encoded_path

Set the path.

set_encoded_query

Set the query

set_encoded_user

Set the user

set_encoded_userinfo

Set the userinfo.

set_fragment

Set the fragment.

set_host

Set the host

set_host_address

Set the host to an address

set_host_ipv4

Set the host to an address

set_host_ipv6

Set the host to an address

set_host_ipvfuture

Set the host to an address

set_host_name

Set the host to a name

set_params

Set the query params

set_password

Set the password.

set_path

Set the path.

set_path_absolute

Set if the path is absolute

set_port

Set the port

set_port_number

Set the port

set_query

Set the query

set_scheme

Set the scheme

set_scheme_id

url_base::set_scheme_id

set_user

Set the user

set_userinfo

Set the userinfo

size

Return the number of characters in the url

static_url

Constructor

user

Return the user

userinfo

Return the userinfo

zone_id

Return the IPv6 Zone ID

~static_url

Destructor

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Friends

Name

Description

operator!=

Return the result of comparing two URLs

operator<

Return the result of comparing two URLs

operator<<

operator<=

Return the result of comparing two URLs

operator==

Return the result of comparing two URLs

operator>

Return the result of comparing two URLs

operator>=

Return the result of comparing two URLs

resolve

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

Function static_url::~static_url

Destructor

Synopsis

Declared in header </boost/url/static_url.hpp#L130[boost/url/static_url.hpp,window=blank_]>

virtual
~static_url() = default;

Description

Any params, segments, iterators, or views which reference this object are invalidated. The underlying character buffer is destroyed, invalidating all references to it.

Return Value

  • void

Overload set static_url::static_url

Members

Constructor

static_url() noexcept;
  » more...

Constructor

static_url(string_view s);
  » more...

Constructor

static_url(const static_url& u) noexcept;
  » more...

Constructor

static_url(const url_view_base& u);
  » more...

Overload set static_url::operator=

Members

Assignment

static_url&
operator=(const static_url& u) noexcept;
  » more...

Assignment

static_url&
operator=(const url_view_base& u);
  » more...

Function static_url::set_scheme

Set the scheme

Synopsis

Declared in header </boost/url/static_url.hpp#L345[boost/url/static_url.hpp,window=blank_]>

static_url&
set_scheme(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function static_url::set_scheme_id

url_base::set_scheme_id

Synopsis

Declared in header </boost/url/static_url.hpp#L347[boost/url/static_url.hpp,window=blank_]>

static_url&
set_scheme_id(scheme id);

Function static_url::remove_scheme

Remove the scheme

Synopsis

Declared in header </boost/url/static_url.hpp#L349[boost/url/static_url.hpp,window=blank_]>

static_url&
remove_scheme();

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

Return Value

  • ``

Function static_url::set_encoded_authority

Set the authority

Synopsis

Declared in header </boost/url/static_url.hpp#L352[boost/url/static_url.hpp,window=blank_]>

static_url&
set_encoded_authority(pct_string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function static_url::remove_authority

Remove the authority

Synopsis

Declared in header </boost/url/static_url.hpp#L354[boost/url/static_url.hpp,window=blank_]>

static_url&
remove_authority();

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

Return Value

  • ``

Function static_url::set_userinfo

Set the userinfo

Synopsis

Declared in header </boost/url/static_url.hpp#L357[boost/url/static_url.hpp,window=blank_]>

static_url&
set_userinfo(string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

string_view

Function static_url::set_encoded_userinfo

Set the userinfo.

Synopsis

Declared in header </boost/url/static_url.hpp#L359[boost/url/static_url.hpp,window=blank_]>

static_url&
set_encoded_userinfo(pct_string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function static_url::remove_userinfo

Remove the userinfo

Synopsis

Declared in header </boost/url/static_url.hpp#L361[boost/url/static_url.hpp,window=blank_]>

static_url&
remove_userinfo() noexcept;

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 / ":" )

Return Value

  • ``

Function static_url::set_user

Set the user

Synopsis

Declared in header </boost/url/static_url.hpp#L363[boost/url/static_url.hpp,window=blank_]>

static_url&
set_user(string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

string_view

Function static_url::set_encoded_user

Set the user

Synopsis

Declared in header </boost/url/static_url.hpp#L365[boost/url/static_url.hpp,window=blank_]>

static_url&
set_encoded_user(pct_string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function static_url::set_password

Set the password.

Synopsis

Declared in header </boost/url/static_url.hpp#L367[boost/url/static_url.hpp,window=blank_]>

static_url&
set_password(string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

string_view

Function static_url::set_encoded_password

Set the password.

Synopsis

Declared in header </boost/url/static_url.hpp#L369[boost/url/static_url.hpp,window=blank_]>

static_url&
set_encoded_password(pct_string_view s);

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function static_url::remove_password

Remove the password

Synopsis

Declared in header </boost/url/static_url.hpp#L371[boost/url/static_url.hpp,window=blank_]>

static_url&
remove_password() noexcept;

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 / ":" )

Return Value

  • ``

Function static_url::set_host

Set the host

Synopsis

Declared in header </boost/url/static_url.hpp#L374[boost/url/static_url.hpp,window=blank_]>

static_url&
set_host(string_view s);

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 / "-" / ".")

Return Value

  • ``

Parameters

Name Type

s

string_view

Function static_url::set_encoded_host

Set the host

Synopsis

Declared in header </boost/url/static_url.hpp#L376[boost/url/static_url.hpp,window=blank_]>

static_url&
set_encoded_host(pct_string_view s);

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 / "-" / ".")

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function static_url::set_host_address

Set the host to an address

Synopsis

Declared in header </boost/url/static_url.hpp#L378[boost/url/static_url.hpp,window=blank_]>

static_url&
set_host_address(string_view s);

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 / "-" / ".")

Return Value

  • ``

Parameters

Name Type

s

string_view

Function static_url::set_encoded_host_address

Set the host to an address

Synopsis

Declared in header </boost/url/static_url.hpp#L380[boost/url/static_url.hpp,window=blank_]>

static_url&
set_encoded_host_address(pct_string_view s);

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 / "-" / ".")

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function static_url::set_host_ipv4

Set the host to an address

Synopsis

Declared in header </boost/url/static_url.hpp#L382[boost/url/static_url.hpp,window=blank_]>

static_url&
set_host_ipv4(const ipv4_address& addr);

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

Return Value

  • ``

Parameters

Name Type

addr

``

Function static_url::set_host_ipv6

Set the host to an address

Synopsis

Declared in header </boost/url/static_url.hpp#L384[boost/url/static_url.hpp,window=blank_]>

static_url&
set_host_ipv6(const ipv6_address& addr);

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

Return Value

  • ``

Parameters

Name Type

addr

``

Function static_url::set_host_ipvfuture

Set the host to an address

Synopsis

Declared in header </boost/url/static_url.hpp#L386[boost/url/static_url.hpp,window=blank_]>

static_url&
set_host_ipvfuture(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function static_url::set_host_name

Set the host to a name

Synopsis

Declared in header </boost/url/static_url.hpp#L388[boost/url/static_url.hpp,window=blank_]>

static_url&
set_host_name(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function static_url::set_encoded_host_name

Set the host to a name

Synopsis

Declared in header </boost/url/static_url.hpp#L390[boost/url/static_url.hpp,window=blank_]>

static_url&
set_encoded_host_name(pct_string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function static_url::set_port_number

Set the port

Synopsis

Declared in header </boost/url/static_url.hpp#L392[boost/url/static_url.hpp,window=blank_]>

static_url&
set_port_number(uint16_t n);

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

Return Value

  • ``

Parameters

Name Type

n

uint16_t

Function static_url::set_port

Set the port

Synopsis

Declared in header </boost/url/static_url.hpp#L394[boost/url/static_url.hpp,window=blank_]>

static_url&
set_port(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function static_url::remove_port

Remove the port

Synopsis

Declared in header </boost/url/static_url.hpp#L396[boost/url/static_url.hpp,window=blank_]>

static_url&
remove_port() noexcept;

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

Return Value

  • ``

Function static_url::set_path

Set the path.

Synopsis

Declared in header </boost/url/static_url.hpp#L401[boost/url/static_url.hpp,window=blank_]>

static_url&
set_path(string_view s);

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

Specification

Return Value

  • ``

Parameters

Name Type

s

string_view

Function static_url::set_encoded_path

Set the path.

Synopsis

Declared in header </boost/url/static_url.hpp#L403[boost/url/static_url.hpp,window=blank_]>

static_url&
set_encoded_path(pct_string_view s);

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

Specification

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function static_url::set_query

Set the query

Synopsis

Declared in header </boost/url/static_url.hpp#L406[boost/url/static_url.hpp,window=blank_]>

static_url&
set_query(string_view s);

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 )

Return Value

  • ``

Parameters

Name Type

s

string_view

Function static_url::set_encoded_query

Set the query

Synopsis

Declared in header </boost/url/static_url.hpp#L408[boost/url/static_url.hpp,window=blank_]>

static_url&
set_encoded_query(pct_string_view s);

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 )

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function static_url::remove_query

Remove the query

Synopsis

Declared in header </boost/url/static_url.hpp#L410[boost/url/static_url.hpp,window=blank_]>

static_url&
remove_query() noexcept;

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 )

Return Value

  • ``

Function static_url::remove_fragment

Remove the fragment

Synopsis

Declared in header </boost/url/static_url.hpp#L413[boost/url/static_url.hpp,window=blank_]>

static_url&
remove_fragment() noexcept;

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

Return Value

  • ``

Function static_url::set_fragment

Set the fragment.

Synopsis

Declared in header </boost/url/static_url.hpp#L415[boost/url/static_url.hpp,window=blank_]>

static_url&
set_fragment(string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

string_view

Function static_url::set_encoded_fragment

Set the fragment.

Synopsis

Declared in header </boost/url/static_url.hpp#L417[boost/url/static_url.hpp,window=blank_]>

static_url&
set_encoded_fragment(pct_string_view s);

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

Return Value

  • ``

Parameters

Name Type

s

pct_string_view

Function static_url::remove_origin

Remove the origin component

Synopsis

Declared in header </boost/url/static_url.hpp#L420[boost/url/static_url.hpp,window=blank_]>

static_url&
remove_origin();

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.

Return Value

  • ``

Function static_url::normalize

Normalize the URL components

Synopsis

Declared in header </boost/url/static_url.hpp#L423[boost/url/static_url.hpp,window=blank_]>

static_url&
normalize();

Description

Applies Syntax-based normalization to all components of the URL.

Exception Safety

Strong guarantee. Calls to allocate may throw.

Return Value

  • ``

Function static_url::normalize_scheme

Normalize the URL scheme

Synopsis

Declared in header </boost/url/static_url.hpp#L425[boost/url/static_url.hpp,window=blank_]>

static_url&
normalize_scheme();

Description

Applies Syntax-based normalization to the URL scheme. The scheme is normalized to lowercase.

Exception Safety

Strong guarantee. Calls to allocate may throw.

Return Value

  • ``

Function static_url::normalize_authority

Normalize the URL authority

Synopsis

Declared in header </boost/url/static_url.hpp#L427[boost/url/static_url.hpp,window=blank_]>

static_url&
normalize_authority();

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.

Return Value

  • ``

Function static_url::normalize_path

Normalize the URL path

Synopsis

Declared in header </boost/url/static_url.hpp#L429[boost/url/static_url.hpp,window=blank_]>

static_url&
normalize_path();

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.

Return Value

  • ``

Function static_url::normalize_query

Normalize the URL query

Synopsis

Declared in header </boost/url/static_url.hpp#L431[boost/url/static_url.hpp,window=blank_]>

static_url&
normalize_query();

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.

Return Value

  • ``

Function static_url::normalize_fragment

Normalize the URL fragment

Synopsis

Declared in header </boost/url/static_url.hpp#L433[boost/url/static_url.hpp,window=blank_]>

static_url&
normalize_fragment();

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.

Return Value

  • ``

Class static_url_base

Common implementation for all static URLs

Synopsis

Declared in header </boost/url/static_url.hpp#L52[boost/url/static_url.hpp,window=blank_]>

class static_url_base
    : public url_base;

Member Functions

Name

Description

authority

Return the authority

buffer

Return the url string

c_str

Return the url as a null-terminated string

capacity

Return the number of characters that can be stored without reallocating

clear

Clear the contents while preserving the capacity

compare

Return the result of comparing this with another url

data

Return a pointer to the url's character buffer

digest

empty

Return true if the url is empty

encoded_authority

Return the authority.

encoded_fragment

Return the fragment

encoded_host

Return the host

encoded_host_address

Return the host

encoded_host_and_port

Return the host and port

encoded_host_name

Return the host name

encoded_origin

Return the origin

encoded_params

Return the query as a container of parameters

encoded_password

Return the password

encoded_path

Return the path

encoded_query

Return the query

encoded_resource

Return the resource

encoded_segments

Return the path as a container of segments

encoded_target

Return the target

encoded_user

Return the user

encoded_userinfo

Return the userinfo

encoded_zone_id

Return the IPv6 Zone ID

fragment

Return the fragment

has_authority

Return true if an authority is present

has_fragment

Return true if a fragment is present

has_password

Return true if a password is present

has_port

Return true if a port is present

has_query

Return true if a query is present

has_scheme

Return true a scheme is present

has_userinfo

Return true if a userinfo is present

host

Return the host

host_address

Return the host

host_ipv4_address

Return the host IPv4 address

host_ipv6_address

Return the host IPv6 address

host_ipvfuture

Return the host IPvFuture address

host_name

Return the host name

host_type

Return the host type

is_path_absolute

Return true if the path is absolute

normalize

Normalize the URL components

normalize_authority

Normalize the URL authority

normalize_fragment

Normalize the URL fragment

normalize_path

Normalize the URL path

normalize_query

Normalize the URL query

normalize_scheme

Normalize the URL scheme

operator string_view

Return the URL as a core::string_view

params

Return the query as a container of parameters

url_view_base::params

password

Return the password

path

Return the path

persist

Return a shared, persistent copy of the url

port

Return the port

port_number

Return the port

query

Return the query

remove_authority

Remove the authority

remove_fragment

Remove the fragment

remove_origin

Remove the origin component

remove_password

Remove the password

remove_port

Remove the port

remove_query

Remove the query

remove_scheme

Remove the scheme

remove_userinfo

Remove the userinfo

reserve

Adjust the capacity without changing the size

resolve

Resolve a URL reference against this base URL

scheme

Return the scheme

scheme_id

Return the scheme

segments

Return the path as a container of segments

set_encoded_authority

Set the authority

set_encoded_fragment

Set the fragment.

set_encoded_host

Set the host

set_encoded_host_address

Set the host to an address

set_encoded_host_name

Set the host to a name

set_encoded_params

Set the query params

set_encoded_password

Set the password.

set_encoded_path

Set the path.

set_encoded_query

Set the query

set_encoded_user

Set the user

set_encoded_userinfo

Set the userinfo.

set_fragment

Set the fragment.

set_host

Set the host

set_host_address

Set the host to an address

set_host_ipv4

Set the host to an address

set_host_ipv6

Set the host to an address

set_host_ipvfuture

Set the host to an address

set_host_name

Set the host to a name

set_params

Set the query params

set_password

Set the password.

set_path

Set the path.

set_path_absolute

Set if the path is absolute

set_port

Set the port

set_port_number

Set the port

set_query

Set the query

set_scheme

Set the scheme

set_scheme_id

set_user

Set the user

set_userinfo

Set the userinfo

size

Return the number of characters in the url

user

Return the user

userinfo

Return the userinfo

zone_id

Return the IPv6 Zone ID

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Friends

Name

Description

operator!=

Return the result of comparing two URLs

operator<

Return the result of comparing two URLs

operator<<

operator<=

Return the result of comparing two URLs

operator==

Return the result of comparing two URLs

operator>

Return the result of comparing two URLs

operator>=

Return the result of comparing two URLs

resolve

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

Namespace system

Types

Class is_error_code_enum

Synopsis

Declared in header </boost/url/impl/error.hpp#L20[boost/url/impl/error.hpp,window=blank_]>

template<>
struct is_error_code_enum<urls::error>;

Static Data Members

Name

Description

value

is_error_code_enum::value

Synopsis

Declared in header </boost/url/impl/error.hpp#L22[boost/url/impl/error.hpp,window=blank_]>

static
const bool value;

Class is_error_code_enum

Synopsis

Declared in header </boost/url/grammar/impl/error.hpp#L18[boost/url/grammar/impl/error.hpp,window=blank_]>

template<>
struct is_error_code_enum<urls::grammar::error>;

Static Data Members

Name

Description

value

is_error_code_enum::value

Synopsis

Declared in header </boost/url/grammar/impl/error.hpp#L21[boost/url/grammar/impl/error.hpp,window=blank_]>

static
const bool value;

Class is_error_condition_enum

Synopsis

Declared in header </boost/url/grammar/impl/error.hpp#L24[boost/url/grammar/impl/error.hpp,window=blank_]>

template<>
struct is_error_condition_enum<urls::grammar::condition>;

Static Data Members

Name

Description

value

is_error_condition_enum::value

Synopsis

Declared in header </boost/url/grammar/impl/error.hpp#L27[boost/url/grammar/impl/error.hpp,window=blank_]>

static
const bool value;

Namespace std

Types

Class is_nothrow_copy_constructible

Synopsis

Declared in header </type_traits#L1131[type_traits,window=blank_]>

struct is_nothrow_copy_constructible
    : __is_nothrow_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>;

true_type

Synopsis

Declared in header </type_traits#L82[type_traits,window=blank_]>

using true_type = integral_constant<bool, true>;

Class integral_constant

Synopsis

Declared in header </type_traits#L62[type_traits,window=blank_]>

struct integral_constant;

Types

Name

Description

type

value_type

Member Functions

Static Data Members

Name

Description

value

integral_constant::value

Synopsis

Declared in header </type_traits#L64[type_traits,window=blank_]>

constexpr
static
const _Tp value;

integral_constant::value_type

Synopsis

Declared in header </type_traits#L65[type_traits,window=blank_]>

typedef _Tp value_type;

integral_constant::type

Synopsis

Declared in header </type_traits#L66[type_traits,window=blank_]>

typedef integral_constant<_Tp, __v> type;

Function integral_constant::operator value_type

Synopsis

Declared in header </type_traits#L67[type_traits,window=blank_]>

constexpr
operator value_type() const noexcept;

Function integral_constant::operator()

Synopsis

Declared in header </type_traits#L72[type_traits,window=blank_]>

constexpr
value_type
operator()() const noexcept;

false_type

Synopsis

Declared in header </type_traits#L85[type_traits,window=blank_]>

using false_type = integral_constant<bool, false>;

__is_nothrow_constructible_impl

Synopsis

Declared in header </type_traits#L1107[type_traits,window=blank_]>

template<
    typename _Tp,
    typename... _Args>
using __is_nothrow_constructible_impl = __bool_constant<__is_nothrow_constructible(_Tp, _Args...)>;

Class hash

Synopsis

Declared in header </boost/url/url.hpp#L523[boost/url/url.hpp,window=blank_]>

template<>
struct hash<boost::urls::url>;

Member Functions

Name

Description

hash

operator()

operator=

Overload set hash::hash

Members

constexpr
hash() = default;
  » more...
constexpr
hash(const hash<boost::urls::url>&) = default;
  » more...
hash(size_t salt) noexcept;
  » more...

Function hash::operator=

Synopsis

Declared in header </boost/url/url.hpp#L527[boost/url/url.hpp,window=blank_]>

constexpr
hash<boost::urls::url>&
operator=(const hash<boost::urls::url>&) = default;

Function hash::operator()

Synopsis

Declared in header </boost/url/url.hpp#L535[boost/url/url.hpp,window=blank_]>

size_t
operator()(const boost::urls::url& u) const noexcept;

Class hash

Synopsis

Declared in header </boost/url/url_view.hpp#L349[boost/url/url_view.hpp,window=blank_]>

template<>
struct hash<boost::urls::url_view>;

Member Functions

Name

Description

hash

operator()

operator=

Overload set hash::hash

Members

constexpr
hash() = default;
  » more...
constexpr
hash(const hash<boost::urls::url_view>&) = default;
  » more...
hash(size_t salt) noexcept;
  » more...

Function hash::operator=

Synopsis

Declared in header </boost/url/url_view.hpp#L353[boost/url/url_view.hpp,window=blank_]>

constexpr
hash<boost::urls::url_view>&
operator=(const hash<boost::urls::url_view>&) = default;

Function hash::operator()

Synopsis

Declared in header </boost/url/url_view.hpp#L361[boost/url/url_view.hpp,window=blank_]>

size_t
operator()(const boost::urls::url_view& u) const noexcept;

Class hash

Synopsis

Declared in header </boost/url/static_url.hpp#L447[boost/url/static_url.hpp,window=blank_]>

template<size_t N>
struct hash<boost::urls::static_url<N>>;

Member Functions

Name

Description

hash

operator()

operator=

Overload set hash::hash

Members

hash() = default;
  » more...
hash(const hash&) = default;
  » more...
hash(size_t salt) noexcept;
  » more...

Function hash::operator=

Synopsis

Declared in header </boost/url/static_url.hpp#L451[boost/url/static_url.hpp,window=blank_]>

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

Function hash::operator()

Synopsis

Declared in header </boost/url/static_url.hpp#L459[boost/url/static_url.hpp,window=blank_]>

size_t
operator()(const boost::urls::static_url<N>& u) const noexcept;

Function lut_chars::lut_chars

Constructor

Synopsis

Declared in header </boost/url/grammar/lut_chars.hpp#L157[boost/url/grammar/lut_chars.hpp,window=blank_]>

constexpr
lut_chars(char ch) noexcept;

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.

Return Value

  • void

Parameters

Name Type

ch

char

Function lut_chars::lut_chars

Constructor

Synopsis

Declared in header </boost/url/grammar/lut_chars.hpp#L188[boost/url/grammar/lut_chars.hpp,window=blank_]>

constexpr
lut_chars(const char* s) noexcept;

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.

Return Value

  • void

Parameters

Name Type

s

``

Function lut_chars::lut_chars

Synopsis

Declared in header </boost/url/grammar/lut_chars.hpp#L235[boost/url/grammar/lut_chars.hpp,window=blank_]>

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

Function string_view_base::starts_with

Return true if a matching prefix exists

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L419[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
bool
starts_with(string_view x) const noexcept;

Description

See core::string_view::starts_with

Return Value

  • bool

Parameters

Name Type

x

string_view

Function string_view_base::starts_with

Return true if a matching prefix exists

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L429[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
bool
starts_with(char x) const noexcept;

Description

See core::string_view::starts_with

Return Value

  • bool

Parameters

Name Type

x

char

Function string_view_base::starts_with

Return true if a matching prefix exists

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L439[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
bool
starts_with(const char* x) const noexcept;

Description

See core::string_view::starts_with

Return Value

  • bool

Parameters

Name Type

x

``

Function string_view_base::ends_with

Return true if a matching suffix exists

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L451[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
bool
ends_with(string_view x) const noexcept;

Description

See core::string_view::ends_with

Return Value

  • bool

Parameters

Name Type

x

string_view

Function string_view_base::ends_with

Return true if a matching suffix exists

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L461[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
bool
ends_with(char x) const noexcept;

Description

See core::string_view::ends_with

Return Value

  • bool

Parameters

Name Type

x

char

Function string_view_base::ends_with

Return true if a matching suffix exists

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L471[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
bool
ends_with(const char* x) const noexcept;

Description

See core::string_view::ends_with

Return Value

  • bool

Parameters

Name Type

x

``

Function string_view_base::find

Return the position of matching characters

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L483[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
size_type
find(
    string_view str,
    size_type pos = 0) const noexcept;

Description

See core::string_view::find

Return Value

  • size_type

Parameters

Name Type

str

string_view

pos

size_type

Function string_view_base::find

Return the position of matching characters

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L493[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find

Return Value

  • size_type

Parameters

Name Type

c

char

pos

size_type

Function string_view_base::find

Return the position of matching characters

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L503[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find

Return Value

  • size_type

Parameters

Name Type

s

``

pos

size_type

n

size_type

Function string_view_base::find

Return the position of matching characters

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L513[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find

Return Value

  • size_type

Parameters

Name Type

s

``

pos

size_type

Function string_view_base::rfind

Return the position of matching characters

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L525[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::rfind

Return Value

  • size_type

Parameters

Name Type

str

string_view

pos

size_type

Function string_view_base::rfind

Return the position of matching characters

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L535[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::rfind

Return Value

  • size_type

Parameters

Name Type

c

char

pos

size_type

Function string_view_base::rfind

Return the position of matching characters

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L545[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::rfind

Return Value

  • size_type

Parameters

Name Type

s

``

pos

size_type

n

size_type

Function string_view_base::rfind

Return the position of matching characters

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L555[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::rfind

Return Value

  • size_type

Parameters

Name Type

s

``

pos

size_type

Function string_view_base::compare

Return the result of comparing to another string

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L355[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
int
compare(string_view str) const noexcept;

Description

See core::string_view::compare

Return Value

  • int

Parameters

Name Type

str

string_view

Function string_view_base::compare

Return the result of comparing to another string

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L365[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::compare

Return Value

  • int

Parameters

Name Type

pos1

size_type

n1

size_type

str

string_view

Function string_view_base::compare

Return the result of comparing to another string

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L375[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::compare

Return Value

  • int

Parameters

Name Type

pos1

size_type

n1

size_type

str

string_view

pos2

size_type

n2

size_type

Function string_view_base::compare

Return the result of comparing to another string

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L386[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
int
compare(const char* s) const noexcept;

Description

See core::string_view::compare

Return Value

  • int

Parameters

Name Type

s

``

Function string_view_base::compare

Return the result of comparing to another string

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L396[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::compare

Return Value

  • int

Parameters

Name Type

pos1

size_type

n1

size_type

s

``

Function string_view_base::compare

Return the result of comparing to another string

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L406[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::compare

Return Value

  • int

Parameters

Name Type

pos1

size_type

n1

size_type

s

``

n2

size_type

Function string_view_base::find_first_of

Return the position of the first match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L567[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
size_type
find_first_of(
    string_view str,
    size_type pos = 0) const noexcept;

Description

See core::string_view::find_first_of

Return Value

  • size_type

Parameters

Name Type

str

string_view

pos

size_type

Function string_view_base::find_first_of

Return the position of the first match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L577[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_first_of

Return Value

  • size_type

Parameters

Name Type

c

char

pos

size_type

Function string_view_base::find_first_of

Return the position of the first match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L587[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_first_of

Return Value

  • size_type

Parameters

Name Type

s

``

pos

size_type

n

size_type

Function string_view_base::find_first_of

Return the position of the first match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L597[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_first_of

Return Value

  • size_type

Parameters

Name Type

s

``

pos

size_type

Function string_view_base::contains

Return true if matching characters are found

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L735[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
bool
contains(string_view sv) const noexcept;

Description

See core::string_view::contains

Return Value

  • bool

Parameters

Name Type

sv

string_view

Function string_view_base::contains

Return true if matching characters are found

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L744[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
bool
contains(char c) const noexcept;

Description

See core::string_view::contains

Return Value

  • bool

Parameters

Name Type

c

char

Function string_view_base::contains

Return true if matching characters are found

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L753[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
bool
contains(const char* s) const noexcept;

Description

See core::string_view::contains

Return Value

  • bool

Parameters

Name Type

s

``

Function string_view_base::find_last_of

Return the position of the last match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L609[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_last_of

Return Value

  • size_type

Parameters

Name Type

str

string_view

pos

size_type

Function string_view_base::find_last_of

Return the position of the last match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L619[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_last_of

Return Value

  • size_type

Parameters

Name Type

c

char

pos

size_type

Function string_view_base::find_last_of

Return the position of the last match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L629[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_last_of

Return Value

  • size_type

Parameters

Name Type

s

``

pos

size_type

n

size_type

Function string_view_base::find_last_of

Return the position of the last match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L639[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_last_of

Return Value

  • size_type

Parameters

Name Type

s

``

pos

size_type

Function string_view_base::find_first_not_of

Return the position of the first non-match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L651[boost/url/grammar/string_view_base.hpp,window=blank_]>

constexpr
size_type
find_first_not_of(
    string_view str,
    size_type pos = 0) const noexcept;

Description

See core::string_view::find_first_not_of

Return Value

  • size_type

Parameters

Name Type

str

string_view

pos

size_type

Function string_view_base::find_first_not_of

Return the position of the first non-match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L661[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_first_not_of

Return Value

  • size_type

Parameters

Name Type

c

char

pos

size_type

Function string_view_base::find_first_not_of

Return the position of the first non-match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L671[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_first_not_of

Return Value

  • size_type

Parameters

Name Type

s

``

pos

size_type

n

size_type

Function string_view_base::find_first_not_of

Return the position of the first non-match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L681[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_first_not_of

Return Value

  • size_type

Parameters

Name Type

s

``

pos

size_type

Function string_view_base::find_last_not_of

Return the position of the last non-match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L693[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_last_not_of

Return Value

  • size_type

Parameters

Name Type

str

string_view

pos

size_type

Function string_view_base::find_last_not_of

Return the position of the last non-match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L703[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_last_not_of

Return Value

  • size_type

Parameters

Name Type

c

char

pos

size_type

Function string_view_base::find_last_not_of

Return the position of the last non-match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L713[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_last_not_of

Return Value

  • size_type

Parameters

Name Type

s

``

pos

size_type

n

size_type

Function string_view_base::find_last_not_of

Return the position of the last non-match

Synopsis

Declared in header </boost/url/grammar/string_view_base.hpp#L723[boost/url/grammar/string_view_base.hpp,window=blank_]>

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

Description

See core::string_view::find_last_not_of

Return Value

  • size_type

Parameters

Name Type

s

``

pos

size_type

Function ref

Synopsis

Declared in header </boost/url/grammar/charset.hpp#L197[boost/url/grammar/charset.hpp,window=blank_]>

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

Function ref

Synopsis

Declared in header </boost/url/grammar/parse.hpp#L113[boost/url/grammar/parse.hpp,window=blank_]>

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

Function ref

Synopsis

Declared in header </boost/url/grammar/parse.hpp#L133[boost/url/grammar/parse.hpp,window=blank_]>

constexpr
void
ref() = delete;

Function parse

Parse a character buffer using a rule

Synopsis

Declared in header </boost/url/grammar/parse.hpp#L41[boost/url/grammar/parse.hpp,window=blank_]>

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

Function parse

Parse a character buffer using a rule

Synopsis

Declared in header </boost/url/grammar/parse.hpp#L65[boost/url/grammar/parse.hpp,window=blank_]>

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

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.

Return Value

  • result

Parameters

Name Type

s

string_view

r

``

Function ci_is_equal

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L173[boost/url/grammar/ci_string.hpp,window=blank_]>

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

Function ci_is_equal

Synopsis

Declared in header </boost/url/grammar/ci_string.hpp#L192[boost/url/grammar/ci_string.hpp,window=blank_]>

bool
ci_is_equal(
    string_view s0,
    string_view s1) noexcept;

Function variant_rule

Synopsis

Declared in header </boost/url/grammar/variant_rule.hpp#L94[boost/url/grammar/variant_rule.hpp,window=blank_]>

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

Function variant_rule

Synopsis

Declared in header </boost/url/grammar/variant_rule.hpp#L117[boost/url/grammar/variant_rule.hpp,window=blank_]>

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

Function delim_rule

Synopsis

Declared in header </boost/url/grammar/delim_rule.hpp#L81[boost/url/grammar/delim_rule.hpp,window=blank_]>

constexpr
ch_delim_rule
delim_rule(char ch) noexcept;

Function delim_rule

Synopsis

Declared in header </boost/url/grammar/delim_rule.hpp#L164[boost/url/grammar/delim_rule.hpp,window=blank_]>

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

Function optional_rule

Synopsis

Declared in header </boost/url/grammar/optional_rule.hpp#L77[boost/url/grammar/optional_rule.hpp,window=blank_]>

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

Function optional_rule

Synopsis

Declared in header </boost/url/grammar/optional_rule.hpp#L96[boost/url/grammar/optional_rule.hpp,window=blank_]>

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

Function tuple_rule

Synopsis

Declared in header </boost/url/grammar/tuple_rule.hpp#L109[boost/url/grammar/tuple_rule.hpp,window=blank_]>

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

Function tuple_rule

Synopsis

Declared in header </boost/url/grammar/tuple_rule.hpp#L138[boost/url/grammar/tuple_rule.hpp,window=blank_]>

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

Function recycled_ptr::operator=

Assignment

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L367[boost/url/grammar/recycled.hpp,window=blank_]>

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

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.

Return Value

  • ``

Parameters

Name Type

other

``

Function recycled_ptr::operator=

Assignment

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L394[boost/url/grammar/recycled.hpp,window=blank_]>

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

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.

Return Value

  • ``

Parameters

Name Type

other

``

Function recycled_ptr::recycled_ptr

Constructor

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L209[boost/url/grammar/recycled.hpp,window=blank_]>

recycled_ptr(recycled<T>& bin);

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

Return Value

  • void

Parameters

Name Type

bin

``

Function recycled_ptr::recycled_ptr

Constructor

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L243[boost/url/grammar/recycled.hpp,window=blank_]>

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

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.

Return Value

  • void

Parameters

Name Type

bin

``

**

nullptr_t

Function recycled_ptr::recycled_ptr

Constructor

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L272[boost/url/grammar/recycled.hpp,window=blank_]>

recycled_ptr();

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

Return Value

  • void

Function recycled_ptr::recycled_ptr

Constructor

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L301[boost/url/grammar/recycled.hpp,window=blank_]>

recycled_ptr(nullptr_t) noexcept;

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.

Return Value

  • void

Parameters

Name Type

**

nullptr_t

Function recycled_ptr::recycled_ptr

Constructor

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L322[boost/url/grammar/recycled.hpp,window=blank_]>

recycled_ptr(const recycled_ptr& other) noexcept;

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.

Return Value

  • void

Parameters

Name Type

other

``

Function recycled_ptr::recycled_ptr

Constructor

Synopsis

Declared in header </boost/url/grammar/recycled.hpp#L342[boost/url/grammar/recycled.hpp,window=blank_]>

recycled_ptr(recycled_ptr&& other) noexcept;

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.

Return Value

  • void

Parameters

Name Type

other

``

Function range::iterator::iterator

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L373[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

iterator() = default;

Function range::iterator::iterator

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L374[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

iterator(const iterator&) = default;

Function range::iterator::operator++

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L403[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

iterator&
operator++() noexcept;

Function range::iterator::operator++

Synopsis

Declared in header </boost/url/grammar/impl/range_rule.hpp#L417[boost/url/grammar/impl/range_rule.hpp,window=blank_]>

iterator
operator++(int) noexcept;

Function range::range

Constructor

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L175[boost/url/grammar/range_rule.hpp,window=blank_]>

range() noexcept;

Description

Default-constructed ranges have zero elements.

Exception Safety

Throws nothing.

Return Value

  • void

Function range::range

Constructor

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L191[boost/url/grammar/range_rule.hpp,window=blank_]>

range(range&& other) noexcept;

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.

Return Value

  • void

Parameters

Name Type

other

``

Function range::range

Constructor

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L206[boost/url/grammar/range_rule.hpp,window=blank_]>

range(const range& other) noexcept;

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.

Return Value

  • void

Parameters

Name Type

other

``

Function range::operator=

Constructor

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L221[boost/url/grammar/range_rule.hpp,window=blank_]>

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

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.

Return Value

  • ``

Parameters

Name Type

other

``

Function range::operator=

Assignment

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L237[boost/url/grammar/range_rule.hpp,window=blank_]>

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

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.

Return Value

  • ``

Parameters

Name Type

other

``

Function range_rule

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L396[boost/url/grammar/range_rule.hpp,window=blank_]>

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

Function range_rule

Synopsis

Declared in header </boost/url/grammar/range_rule.hpp#L554[boost/url/grammar/range_rule.hpp,window=blank_]>

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

Function arg::arg

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L72[boost/url/grammar/string_token.hpp,window=blank_]>

constexpr
arg() = default;

Function arg::arg

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L73[boost/url/grammar/string_token.hpp,window=blank_]>

constexpr
arg(arg&&) = default;

Function arg::arg

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L74[boost/url/grammar/string_token.hpp,window=blank_]>

arg(const arg&) = delete;

Function arg::operator=

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L75[boost/url/grammar/string_token.hpp,window=blank_]>

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

Function arg::operator=

Synopsis

Declared in header </boost/url/grammar/string_token.hpp#L76[boost/url/grammar/string_token.hpp,window=blank_]>

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

Function decode_view::iterator::iterator

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L58[boost/url/impl/decode_view.hpp,window=blank_]>

constexpr
iterator() = default;

Function decode_view::iterator::iterator

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L60[boost/url/impl/decode_view.hpp,window=blank_]>

constexpr
iterator(const iterator&) = default;

Function decode_view::iterator::operator++

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L69[boost/url/impl/decode_view.hpp,window=blank_]>

iterator&
operator++() noexcept;

Function decode_view::iterator::operator++

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L92[boost/url/impl/decode_view.hpp,window=blank_]>

iterator
operator++(int) noexcept;

Function decode_view::iterator::operator--

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L80[boost/url/impl/decode_view.hpp,window=blank_]>

iterator&
operator--() noexcept;

Function decode_view::iterator::operator--

Synopsis

Declared in header </boost/url/impl/decode_view.hpp#L100[boost/url/impl/decode_view.hpp,window=blank_]>

iterator
operator--(int) noexcept;

Function decode_view::decode_view

Constructor

Synopsis

Declared in header </boost/url/decode_view.hpp#L174[boost/url/decode_view.hpp,window=blank_]>

constexpr
decode_view() noexcept = default;

Description

Default-constructed views represent empty strings.

Example

decode_view ds;

Postconditions

this->empty() == true

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • void

Function decode_view::decode_view

Constructor

Synopsis

Declared in header </boost/url/decode_view.hpp#L209[boost/url/decode_view.hpp,window=blank_]>

decode_view(
    pct_string_view s,
    encoding_opts opt = = {}) noexcept;

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.

Return Value

  • void

Parameters

Name Type

s

pct_string_view

opt

encoding_opts

Function decode_view::starts_with

Checks if the string begins with the given prefix

Synopsis

Declared in header </boost/url/decode_view.hpp#L357[boost/url/decode_view.hpp,window=blank_]>

bool
starts_with(string_view s) const noexcept;

Description

Example

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

Complexity

Linear.

Exception Safety

Throws nothing.

Return Value

  • bool

Parameters

Name Type

s

string_view

Function decode_view::starts_with

Checks if the string begins with the given prefix

Synopsis

Declared in header </boost/url/decode_view.hpp#L391[boost/url/decode_view.hpp,window=blank_]>

bool
starts_with(char ch) const noexcept;

Description

Example

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

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • bool

Parameters

Name Type

ch

char

Function decode_view::ends_with

Checks if the string ends with the given prefix

Synopsis

Declared in header </boost/url/decode_view.hpp#L374[boost/url/decode_view.hpp,window=blank_]>

bool
ends_with(string_view s) const noexcept;

Description

Example

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

Complexity

Linear.

Exception Safety

Throws nothing.

Return Value

  • bool

Parameters

Name Type

s

string_view

Function decode_view::ends_with

Checks if the string ends with the given prefix

Synopsis

Declared in header </boost/url/decode_view.hpp#L408[boost/url/decode_view.hpp,window=blank_]>

bool
ends_with(char ch) const noexcept;

Description

Example

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

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • bool

Parameters

Name Type

ch

char

Function decode_view::compare

Return the result of comparing to another string

Synopsis

Declared in header </boost/url/decode_view.hpp#L511[boost/url/decode_view.hpp,window=blank_]>

int
compare(string_view other) const noexcept;

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 <char >::compare(to_string().data(), v.data(), rlen)`. This means the comparison is performed with percent-decoding applied to the current string.

Return Value

  • int

Parameters

Name Type

other

string_view

Function decode_view::compare

Return the result of comparing to another string

Synopsis

Declared in header </boost/url/decode_view.hpp#L532[boost/url/decode_view.hpp,window=blank_]>

int
compare(decode_view other) const noexcept;

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 <char >::compare(to_string().data(), v.to_string().data(), rlen)`. This means the comparison is performed with percent-decoding applied to the current string.

Return Value

  • int

Parameters

Name Type

other

decode_view

Function pct_string_view::pct_string_view

Constructor

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L117[boost/url/pct_string_view.hpp,window=blank_]>

constexpr
pct_string_view() = default;

Description

Default constructed string are empty.

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • void

Function pct_string_view::pct_string_view

Constructor

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L138[boost/url/pct_string_view.hpp,window=blank_]>

constexpr
pct_string_view(const pct_string_view& other) = default;

Description

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

Postconditions

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

Complexity

Constant.

Exception Safety

Throws nothing.

other The string to copy.

Return Value

  • void

Parameters

Name Type

other

``

Function pct_string_view::pct_string_view

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L176[boost/url/pct_string_view.hpp,window=blank_]>

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

Function pct_string_view::pct_string_view

Constructor (deleted)

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L185[boost/url/pct_string_view.hpp,window=blank_]>

pct_string_view(nullptr_t) = delete;

Function pct_string_view::pct_string_view

Constructor

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L210[boost/url/pct_string_view.hpp,window=blank_]>

pct_string_view(
    const char* s,
    size_t len);

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.

Return Value

  • void

Parameters

Name Type

s

``

len

size_t

Function pct_string_view::pct_string_view

Constructor

Synopsis

Declared in header </boost/url/pct_string_view.hpp#L241[boost/url/pct_string_view.hpp,window=blank_]>

pct_string_view(string_view s);

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.

Return Value

  • void

Parameters

Name Type

s

string_view

Function encode

Apply percent-encoding to a string

Synopsis

Declared in header </boost/url/encode.hpp#L118[boost/url/encode.hpp,window=blank_]>

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

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.

Return Value

  • size_t

Parameters

Name Type

dest

``

size

size_t

s

string_view

unreserved

``

opt

encoding_opts

Function encode

Return a percent-encoded string

Synopsis

Declared in header </boost/url/encode.hpp#L184[boost/url/encode.hpp,window=blank_]>

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

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.

Return Value

  • result_type

Parameters

Name Type

s

string_view

unreserved

``

opt

encoding_opts

token

``

Function operator<

Synopsis

Declared in header </boost/url/decode_view.hpp#L597[boost/url/decode_view.hpp,window=blank_]>

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

Function operator<

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

Synopsis

Declared in header </boost/url/authority_view.hpp#L1286[boost/url/authority_view.hpp,window=blank_]>

bool
operator<(
    const authority_view& a0,
    const authority_view& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

Return Value

  • bool

Parameters

Name Type

a0

``

a1

``

Function operator<

Return the result of comparing two URLs

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2533[boost/url/url_view_base.hpp,window=blank_]>

bool
operator<(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;

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

Return Value

  • bool

Parameters

Name Type

u0

``

u1

``

Function operator⇐

Synopsis

Declared in header </boost/url/decode_view.hpp#L606[boost/url/decode_view.hpp,window=blank_]>

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

Function operator⇐

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

Synopsis

Declared in header </boost/url/authority_view.hpp#L1306[boost/url/authority_view.hpp,window=blank_]>

bool
operator<=(
    const authority_view& a0,
    const authority_view& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

Return Value

  • bool

Parameters

Name Type

a0

``

a1

``

Function operator⇐

Return the result of comparing two URLs

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2593[boost/url/url_view_base.hpp,window=blank_]>

bool
operator<=(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;

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

Return Value

  • bool

Parameters

Name Type

u0

``

u1

``

Function operator==

Synopsis

Declared in header </boost/url/decode_view.hpp#L579[boost/url/decode_view.hpp,window=blank_]>

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

Function operator==

Return true if two addresses are equal

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L243[boost/url/ipv4_address.hpp,window=blank_]>

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

Function operator==

Return true if two addresses are equal

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L293[boost/url/ipv6_address.hpp,window=blank_]>

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

Function operator==

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

Synopsis

Declared in header </boost/url/authority_view.hpp#L1246[boost/url/authority_view.hpp,window=blank_]>

bool
operator==(
    const authority_view& a0,
    const authority_view& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

Return Value

  • bool

Parameters

Name Type

a0

``

a1

``

Function operator==

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L97[boost/url/impl/params_encoded_base.hpp,window=blank_]>

bool
operator==(
    const params_encoded_base::iterator& it0,
    const params_encoded_base::iterator& it1) noexcept;

Function operator==

Return the result of comparing two URLs

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2413[boost/url/url_view_base.hpp,window=blank_]>

bool
operator==(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;

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

Return Value

  • bool

Parameters

Name Type

u0

``

u1

``

Function operator!=

Synopsis

Declared in header </boost/url/decode_view.hpp#L588[boost/url/decode_view.hpp,window=blank_]>

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

Function operator!=

Return true if two addresses are not equal

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L254[boost/url/ipv4_address.hpp,window=blank_]>

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

Function operator!=

Return true if two addresses are not equal

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L304[boost/url/ipv6_address.hpp,window=blank_]>

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

Function operator!=

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

Synopsis

Declared in header </boost/url/authority_view.hpp#L1266[boost/url/authority_view.hpp,window=blank_]>

bool
operator!=(
    const authority_view& a0,
    const authority_view& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

Return Value

  • bool

Parameters

Name Type

a0

``

a1

``

Function operator!=

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L106[boost/url/impl/params_encoded_base.hpp,window=blank_]>

bool
operator!=(
    const params_encoded_base::iterator& it0,
    const params_encoded_base::iterator& it1) noexcept;

Function operator!=

Return the result of comparing two URLs

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2473[boost/url/url_view_base.hpp,window=blank_]>

bool
operator!=(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;

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

Return Value

  • bool

Parameters

Name Type

u0

``

u1

``

Function operator>

Synopsis

Declared in header </boost/url/decode_view.hpp#L615[boost/url/decode_view.hpp,window=blank_]>

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

Function operator>

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

Synopsis

Declared in header </boost/url/authority_view.hpp#L1326[boost/url/authority_view.hpp,window=blank_]>

bool
operator>(
    const authority_view& a0,
    const authority_view& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

Return Value

  • bool

Parameters

Name Type

a0

``

a1

``

Function operator>

Return the result of comparing two URLs

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2653[boost/url/url_view_base.hpp,window=blank_]>

bool
operator>(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;

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

Return Value

  • bool

Parameters

Name Type

u0

``

u1

``

Function operator>=

Synopsis

Declared in header </boost/url/decode_view.hpp#L624[boost/url/decode_view.hpp,window=blank_]>

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

Function operator>=

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

Synopsis

Declared in header </boost/url/authority_view.hpp#L1346[boost/url/authority_view.hpp,window=blank_]>

bool
operator>=(
    const authority_view& a0,
    const authority_view& a1) noexcept;

Description

Complexity

Linear in min( a0.size(), a1.size() )

Exception Safety

Throws nothing

Return Value

  • bool

Parameters

Name Type

a0

``

a1

``

Function operator>=

Return the result of comparing two URLs

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2713[boost/url/url_view_base.hpp,window=blank_]>

bool
operator>=(
    const url_view_base& u0,
    const url_view_base& u1) noexcept;

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

Return Value

  • bool

Parameters

Name Type

u0

``

u1

``

Function param_pct_view::param_pct_view

Constructor

Synopsis

Declared in header </boost/url/param.hpp#L689[boost/url/param.hpp,window=blank_]>

constexpr
param_pct_view() = default;

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.

Return Value

  • void

Function param_pct_view::param_pct_view

Constructor

Synopsis

Declared in header </boost/url/param.hpp#L725[boost/url/param.hpp,window=blank_]>

param_pct_view(
    pct_string_view key,
    pct_string_view value) noexcept;

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.

Return Value

  • void

Parameters

Name Type

key

pct_string_view

value

pct_string_view

Function param_pct_view::param_pct_view

Constructor

Synopsis

Declared in header </boost/url/param.hpp#L776[boost/url/param.hpp,window=blank_]>

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

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<core::string_view>("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.

Return Value

  • void

Parameters

Name Type

key

pct_string_view

value

``

Function param_pct_view::param_pct_view

Construction

Synopsis

Declared in header </boost/url/param.hpp#L816[boost/url/param.hpp,window=blank_]>

param_pct_view(const param_view& p);

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.

Return Value

  • void

Parameters

Name Type

p

``

Function param_pct_view::param_pct_view

Synopsis

Declared in header </boost/url/param.hpp#L866[boost/url/param.hpp,window=blank_]>

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

Function param_view::param_view

Constructor

Synopsis

Declared in header </boost/url/param.hpp#L455[boost/url/param.hpp,window=blank_]>

constexpr
param_view() = default;

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.

Return Value

  • void

Function param_view::param_view

Constructor

Synopsis

Declared in header </boost/url/param.hpp#L494[boost/url/param.hpp,window=blank_]>

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

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.

Return Value

  • void

Parameters

Name Type

key

string_view

value

``

Function param_view::param_view

Constructor

Synopsis

Declared in header </boost/url/param.hpp#L531[boost/url/param.hpp,window=blank_]>

param_view(const param& other) noexcept;

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.

Return Value

  • void

Parameters

Name Type

other

``

Function param_view::param_view

Synopsis

Declared in header </boost/url/param.hpp#L570[boost/url/param.hpp,window=blank_]>

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

Function param::param

Constructor

Synopsis

Declared in header </boost/url/param.hpp#L124[boost/url/param.hpp,window=blank_]>

param() = default;

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.

Return Value

  • void

Function param::param

Constructor

Synopsis

Declared in header </boost/url/param.hpp#L142[boost/url/param.hpp,window=blank_]>

param(param&& other) noexcept;

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.

Return Value

  • void

Parameters

Name Type

other

``

Function param::param

Constructor

Synopsis

Declared in header </boost/url/param.hpp#L173[boost/url/param.hpp,window=blank_]>

param(const param& other) = default;

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.

Return Value

  • void

Parameters

Name Type

other

``

Function param::param

Constructor

Synopsis

Declared in header </boost/url/param.hpp#L278[boost/url/param.hpp,window=blank_]>

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

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<core::string_view>("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.

Return Value

  • void

Parameters

Name Type

key

string_view

value

``

Function param::param

Synopsis

Declared in header </boost/url/param.hpp#L336[boost/url/param.hpp,window=blank_]>

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

Function param::operator=

Assignment

Synopsis

Declared in header </boost/url/param.hpp#L191[boost/url/param.hpp,window=blank_]>

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

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.

Return Value

  • ``

Parameters

Name Type

other

``

Function param::operator=

Assignment

Synopsis

Declared in header </boost/url/param.hpp#L224[boost/url/param.hpp,window=blank_]>

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

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.

Return Value

  • ``

Parameters

Name Type

**

``

Function param::operator=

Assignment

Synopsis

Declared in header </boost/url/param.hpp#L303[boost/url/param.hpp,window=blank_]>

param&
operator=(const param_view& other);

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.

Return Value

  • ``

Parameters

Name Type

other

``

Function param::operator=

Assignment

Synopsis

Declared in header </boost/url/param.hpp#L324[boost/url/param.hpp,window=blank_]>

param&
operator=(const param_pct_view& other);

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.

Return Value

  • ``

Parameters

Name Type

other

``

Function operator<<

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

Synopsis

Declared in header </boost/url/decode_view.hpp#L662[boost/url/decode_view.hpp,window=blank_]>

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

Description

This function serializes the decoded view to the output stream.

Return Value

  • ``

Parameters

Name Type

os

``

s

``

Function operator<<

Format the address to an output stream.

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L327[boost/url/ipv4_address.hpp,window=blank_]>

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

Description

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

Return Value

  • ``

Parameters

Name Type

os

``

addr

``

Function operator<<

Format the address to an output stream

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L368[boost/url/ipv6_address.hpp,window=blank_]>

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

Description

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

Return Value

  • ``

Parameters

Name Type

os

``

addr

``

Function operator<<

Format the encoded authority to the output stream

Synopsis

Declared in header </boost/url/authority_view.hpp#L1386[boost/url/authority_view.hpp,window=blank_]>

ostream&
operator<<(
    ostream& os,
    const authority_view& a);

Description

This function serializes the encoded URL to the output stream.

Example

authority_view a( "www.example.com" );

std::cout << a << std::endl;

Return Value

  • ``

Parameters

Name Type

os

``

a

``

Function operator<<

Format to an output stream

Synopsis

Declared in header </boost/url/segments_encoded_base.hpp#L326[boost/url/segments_encoded_base.hpp,window=blank_]>

ostream&
operator<<(
    ostream& os,
    const segments_encoded_base& ps);

Description

Any percent-escapes are emitted as-is; no decoding is performed.

Complexity

Linear in ps.buffer().size().

Effects

return os << ps.buffer();

Return Value

  • ``

Parameters

Name Type

os

``

ps

``

Function operator<<

Format to an output stream

Synopsis

Declared in header </boost/url/segments_base.hpp#L317[boost/url/segments_base.hpp,window=blank_]>

ostream&
operator<<(
    ostream& os,
    const segments_base& ps);

Description

Any percent-escapes are emitted as-is; no decoding is performed.

Complexity

Linear in ps.buffer().size().

Effects

return os << ps.buffer();

Return Value

  • ``

Parameters

Name Type

os

``

ps

``

Function operator<<

Format to an output stream

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L539[boost/url/params_encoded_base.hpp,window=blank_]>

ostream&
operator<<(
    ostream& os,
    const params_encoded_base& qp);

Description

Any percent-escapes are emitted as-is; no decoding is performed.

Complexity

Linear in ps.buffer().size().

Effects

return os << ps.buffer();

Return Value

  • ``

Parameters

Name Type

os

``

qp

``

Function operator<<

Format to an output stream

Synopsis

Declared in header </boost/url/params_base.hpp#L509[boost/url/params_base.hpp,window=blank_]>

ostream&
operator<<(
    ostream& os,
    const params_base& qp);

Description

Any percent-escapes are emitted as-is; no decoding is performed.

Complexity

Linear in ps.buffer().size().

Effects

return os << ps.buffer();

Return Value

  • ``

Parameters

Name Type

os

``

qp

``

Function operator<<

Format the url to the output stream

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2778[boost/url/url_view_base.hpp,window=blank_]>

ostream&
operator<<(
    ostream& os,
    const url_view_base& u);

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.

Return Value

  • ``

Parameters

Name Type

os

``

u

``

Function ipv4_address::ipv4_address

Constructor.

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L76[boost/url/ipv4_address.hpp,window=blank_]>

constexpr
ipv4_address() = default;

Function ipv4_address::ipv4_address

Constructor.

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L80[boost/url/ipv4_address.hpp,window=blank_]>

constexpr
ipv4_address(const ipv4_address&) = default;

Function ipv4_address::ipv4_address

Construct from an unsigned integer.

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L103[boost/url/ipv4_address.hpp,window=blank_]>

ipv4_address(uint_type u) noexcept;

Description

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

Return Value

  • void

Parameters

Name Type

u

uint_type

Function ipv4_address::ipv4_address

Construct from an array of bytes.

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L116[boost/url/ipv4_address.hpp,window=blank_]>

ipv4_address(const bytes_type& bytes) noexcept;

Description

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

Return Value

  • void

Parameters

Name Type

bytes

``

Function ipv4_address::ipv4_address

Construct from a string.

Synopsis

Declared in header </boost/url/ipv4_address.hpp#L146[boost/url/ipv4_address.hpp,window=blank_]>

ipv4_address(string_view s);

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

Return Value

  • void

Parameters

Name Type

s

string_view

Function ipv6_address::ipv6_address

Constructor.

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L103[boost/url/ipv6_address.hpp,window=blank_]>

constexpr
ipv6_address() = default;

Description

Default constructed objects represent the unspecified address.

Return Value

  • void

Function ipv6_address::ipv6_address

Constructor.

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L107[boost/url/ipv6_address.hpp,window=blank_]>

constexpr
ipv6_address(const ipv6_address&) = default;

Function ipv6_address::ipv6_address

Construct from an array of bytes.

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L125[boost/url/ipv6_address.hpp,window=blank_]>

ipv6_address(const bytes_type& bytes) noexcept;

Description

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

Return Value

  • void

Parameters

Name Type

bytes

``

Function ipv6_address::ipv6_address

Construct from an IPv4 address.

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L141[boost/url/ipv6_address.hpp,window=blank_]>

ipv6_address(const ipv4_address& addr) noexcept;

Description

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

Return Value

  • void

Parameters

Name Type

addr

``

Function ipv6_address::ipv6_address

Construct from a string.

Synopsis

Declared in header </boost/url/ipv6_address.hpp#L170[boost/url/ipv6_address.hpp,window=blank_]>

ipv6_address(string_view s);

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

Return Value

  • void

Parameters

Name Type

s

string_view

Function url_view::operator=

Assignment

Synopsis

Declared in header </boost/url/url_view.hpp#L283[boost/url/url_view.hpp,window=blank_]>

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

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.

Return Value

  • ``

Parameters

Name Type

other

``

Function url_view::operator=

Assignment

Synopsis

Declared in header </boost/url/url_view.hpp#L310[boost/url/url_view.hpp,window=blank_]>

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

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.

Return Value

  • ``

Parameters

Name Type

other

``

Function url_view::url_view

Constructor

Synopsis

Declared in header </boost/url/url_view.hpp#L146[boost/url/url_view.hpp,window=blank_]>

url_view() noexcept = default;

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 ]

Return Value

  • void

Function url_view::url_view

Constructor

Synopsis

Declared in header </boost/url/url_view.hpp#L197[boost/url/url_view.hpp,window=blank_]>

url_view(string_view s);

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

Return Value

  • void

Parameters

Name Type

s

string_view

Function url_view::url_view

Synopsis

Declared in header </boost/url/url_view.hpp#L215[boost/url/url_view.hpp,window=blank_]>

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

Function url_view::url_view

Constructor

Synopsis

Declared in header </boost/url/url_view.hpp#L239[boost/url/url_view.hpp,window=blank_]>

url_view(const url_view& other) noexcept;

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.

Return Value

  • void

Parameters

Name Type

other

``

Function url_view::url_view

Constructor

Synopsis

Declared in header </boost/url/url_view.hpp#L263[boost/url/url_view.hpp,window=blank_]>

url_view(const url_view_base& other) noexcept;

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.

Return Value

  • void

Parameters

Name Type

other

``

Function authority_view::authority_view

Constructor

Synopsis

Declared in header </boost/url/authority_view.hpp#L121[boost/url/authority_view.hpp,window=blank_]>

authority_view() noexcept;

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

Return Value

  • void

Function authority_view::authority_view

Construct from a string.

Synopsis

Declared in header </boost/url/authority_view.hpp#L158[boost/url/authority_view.hpp,window=blank_]>

authority_view(string_view s);

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

Return Value

  • void

Parameters

Name Type

s

string_view

Function authority_view::authority_view

Constructor

Synopsis

Declared in header </boost/url/authority_view.hpp#L163[boost/url/authority_view.hpp,window=blank_]>

authority_view(const authority_view&) noexcept = default;

Function ignore_case_param::ignore_case_param

Constructor

Synopsis

Declared in header </boost/url/ignore_case.hpp#L71[boost/url/ignore_case.hpp,window=blank_]>

constexpr
ignore_case_param() noexcept = default;

Description

By default, comparisons are case-sensitive.

Example

This function performs case-sensitive comparisons when called with no arguments:

void f( ignore_case_param = {} );

Return Value

  • void

Function ignore_case_param::ignore_case_param

Constructor

Synopsis

Declared in header </boost/url/ignore_case.hpp#L88[boost/url/ignore_case.hpp,window=blank_]>

constexpr
ignore_case_param(ignore_case_t) noexcept;

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 = {} );

Return Value

  • void

Parameters

Name Type

**

ignore_case_t

Function segments_encoded_base::iterator::iterator

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L47[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

constexpr
iterator() = default;

Function segments_encoded_base::iterator::iterator

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L48[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

constexpr
iterator(const iterator&) = default;

Function segments_encoded_base::iterator::operator++

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L64[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

iterator&
operator++() noexcept;

Function segments_encoded_base::iterator::operator++

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L78[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

iterator
operator++(int) noexcept;

Function segments_encoded_base::iterator::operator--

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L71[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

iterator&
operator--() noexcept;

Function segments_encoded_base::iterator::operator--

Synopsis

Declared in header </boost/url/impl/segments_encoded_base.hpp#L86[boost/url/impl/segments_encoded_base.hpp,window=blank_]>

iterator
operator--(int) noexcept;

Function segments_base::iterator::iterator

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L46[boost/url/impl/segments_base.hpp,window=blank_]>

constexpr
iterator() = default;

Function segments_base::iterator::iterator

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L47[boost/url/impl/segments_base.hpp,window=blank_]>

constexpr
iterator(const iterator&) = default;

Function segments_base::iterator::operator++

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L58[boost/url/impl/segments_base.hpp,window=blank_]>

iterator&
operator++() noexcept;

Function segments_base::iterator::operator++

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L72[boost/url/impl/segments_base.hpp,window=blank_]>

iterator
operator++(int) noexcept;

Function segments_base::iterator::operator--

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L65[boost/url/impl/segments_base.hpp,window=blank_]>

iterator&
operator--() noexcept;

Function segments_base::iterator::operator--

Synopsis

Declared in header </boost/url/impl/segments_base.hpp#L80[boost/url/impl/segments_base.hpp,window=blank_]>

iterator
operator--(int) noexcept;

Function segments_view::segments_view

Constructor

Synopsis

Declared in header </boost/url/segments_view.hpp#L87[boost/url/segments_view.hpp,window=blank_]>

constexpr
segments_view() = default;

Description

Default-constructed segments have zero elements.

Example

segments_view ps;

Effects

return segments_view( "" );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • void

Function segments_view::segments_view

Constructor

Synopsis

Declared in header </boost/url/segments_view.hpp#L111[boost/url/segments_view.hpp,window=blank_]>

constexpr
segments_view(const segments_view& other) = default;

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

Return Value

  • void

Parameters

Name Type

other

``

Function segments_view::segments_view

Constructor

Synopsis

Declared in header </boost/url/segments_view.hpp#L163[boost/url/segments_view.hpp,window=blank_]>

segments_view(string_view s);

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

Return Value

  • void

Parameters

Name Type

s

string_view

Function segments_encoded_view::segments_encoded_view

Constructor

Synopsis

Declared in header </boost/url/segments_encoded_view.hpp#L92[boost/url/segments_encoded_view.hpp,window=blank_]>

constexpr
segments_encoded_view() = default;

Description

Default-constructed segments have zero elements.

Example

segments_encoded_view ps;

Effects

return segments_encoded_view( "" );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • void

Function segments_encoded_view::segments_encoded_view

Constructor

Synopsis

Declared in header </boost/url/segments_encoded_view.hpp#L115[boost/url/segments_encoded_view.hpp,window=blank_]>

constexpr
segments_encoded_view(const segments_encoded_view&) noexcept = default;

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

Return Value

  • void

Parameters

Name Type

**

``

Function segments_encoded_view::segments_encoded_view

Constructor

Synopsis

Declared in header </boost/url/segments_encoded_view.hpp#L167[boost/url/segments_encoded_view.hpp,window=blank_]>

segments_encoded_view(string_view s);

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

Return Value

  • void

Parameters

Name Type

s

string_view

Function pct_encoded_rule

Synopsis

Declared in header </boost/url/rfc/pct_encoded_rule.hpp#L74[boost/url/rfc/pct_encoded_rule.hpp,window=blank_]>

template<class CharSet_>
constexpr
pct_encoded_rule_t<CharSet_>
pct_encoded_rule(const CharSet_& cs) noexcept;

Function pct_encoded_rule

Synopsis

Declared in header </boost/url/rfc/pct_encoded_rule.hpp#L98[boost/url/rfc/pct_encoded_rule.hpp,window=blank_]>

template<class CharSet>
constexpr
pct_encoded_rule_t<CharSet>
pct_encoded_rule(const CharSet& cs) noexcept;

Function params_encoded_base::iterator::iterator

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L50[boost/url/impl/params_encoded_base.hpp,window=blank_]>

iterator() = default;

Function params_encoded_base::iterator::iterator

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L51[boost/url/impl/params_encoded_base.hpp,window=blank_]>

constexpr
iterator(const iterator&) = default;

Function params_encoded_base::iterator::operator++

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L55[boost/url/impl/params_encoded_base.hpp,window=blank_]>

iterator&
operator++() noexcept;

Function params_encoded_base::iterator::operator++

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L62[boost/url/impl/params_encoded_base.hpp,window=blank_]>

iterator
operator++(int) noexcept;

Function params_encoded_base::iterator::operator--

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L70[boost/url/impl/params_encoded_base.hpp,window=blank_]>

iterator&
operator--() noexcept;

Function params_encoded_base::iterator::operator--

Synopsis

Declared in header </boost/url/impl/params_encoded_base.hpp#L77[boost/url/impl/params_encoded_base.hpp,window=blank_]>

iterator
operator--(int) noexcept;

Function params_ref::params_ref

Constructor

Synopsis

Declared in header </boost/url/params_ref.hpp#L120[boost/url/params_ref.hpp,window=blank_]>

constexpr
params_ref(const params_ref& other) = default;

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.

Return Value

  • void

Parameters

Name Type

other

``

Function params_ref::params_ref

Constructor

Synopsis

Declared in header </boost/url/params_ref.hpp#L153[boost/url/params_ref.hpp,window=blank_]>

params_ref(
    const params_ref& other,
    encoding_opts opt) noexcept;

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.

Return Value

  • void

Parameters

Name Type

other

``

opt

encoding_opts

Function params_encoded_base::find

Find a matching key

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L356[boost/url/params_encoded_base.hpp,window=blank_]>

iterator
find(
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first. 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.

Return Value

  • iterator

Parameters

Name Type

key

pct_string_view

ic

ignore_case_param

Function params_encoded_base::find

Find a matching key

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L408[boost/url/params_encoded_base.hpp,window=blank_]>

iterator
find(
    iterator from,
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first. 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.

Return Value

  • iterator

Parameters

Name Type

from

iterator

key

pct_string_view

ic

ignore_case_param

Function params_encoded_base::find_last

Find a matching key

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L456[boost/url/params_encoded_base.hpp,window=blank_]>

iterator
find_last(
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first. 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.

Return Value

  • iterator

Parameters

Name Type

key

pct_string_view

ic

ignore_case_param

Function params_encoded_base::find_last

Find a matching key

Synopsis

Declared in header </boost/url/params_encoded_base.hpp#L503[boost/url/params_encoded_base.hpp,window=blank_]>

iterator
find_last(
    iterator before,
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first. 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().

Return Value

  • iterator

Parameters

Name Type

before

iterator

key

pct_string_view

ic

ignore_case_param

Function params_ref::operator=

Assignment

Synopsis

Declared in header </boost/url/params_ref.hpp#L184[boost/url/params_ref.hpp,window=blank_]>

params_ref&
operator=(const params_ref& other);

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.

Return Value

  • ``

Parameters

Name Type

other

``

Function params_ref::operator=

Assignment

Synopsis

Declared in header </boost/url/params_ref.hpp#L214[boost/url/params_ref.hpp,window=blank_]>

params_ref&
operator=(initializer_list<param_view> init);

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.

Return Value

  • ``

Parameters

Name Type

init

initializer_list

Function params_ref::assign

Assign elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L315[boost/url/params_ref.hpp,window=blank_]>

void
assign(initializer_list<param_view> init);

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.

Return Value

  • void

Parameters

Name Type

init

initializer_list

Function params_ref::assign

Assign elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L350[boost/url/params_ref.hpp,window=blank_]>

template<class FwdIt>
void
assign(
    FwdIt first,
    FwdIt last);

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.

Return Value

  • void

Parameters

Name Type

first

FwdIt

last

FwdIt

Function params_ref::append

Append elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L380[boost/url/params_ref.hpp,window=blank_]>

params_base::iterator
append(const param_view& p);

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.

Return Value

  • iterator

Parameters

Name Type

p

``

Function params_ref::append

Append elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L410[boost/url/params_ref.hpp,window=blank_]>

params_base::iterator
append(initializer_list<param_view> init);

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.

Return Value

  • iterator

Parameters

Name Type

init

initializer_list

Function params_ref::append

Append elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L446[boost/url/params_ref.hpp,window=blank_]>

template<class FwdIt>
params_base::iterator
append(
    FwdIt first,
    FwdIt last);

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.

Return Value

  • iterator

Parameters

Name Type

first

FwdIt

last

FwdIt

Function params_ref::erase

Erase elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L595[boost/url/params_ref.hpp,window=blank_]>

params_base::iterator
erase(params_base::iterator pos) noexcept;

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.

Return Value

  • iterator

Parameters

Name Type

pos

iterator

Function params_ref::erase

Erase elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L619[boost/url/params_ref.hpp,window=blank_]>

params_base::iterator
erase(
    params_base::iterator first,
    params_base::iterator last) noexcept;

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.

Return Value

  • iterator

Parameters

Name Type

first

iterator

last

iterator

Function params_ref::erase

Erase elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L652[boost/url/params_ref.hpp,window=blank_]>

size_t
erase(
    string_view key,
    ignore_case_param ic = = {}) noexcept;

Description

All iterators are invalidated.

Postconditions

this->count( key, ic ) == 0

Complexity

Linear in this->url().encoded_query().size().

Exception Safety

Throws nothing.

Return Value

  • size_t

Parameters

Name Type

key

string_view

ic

ignore_case_param

Function params_ref::insert

Insert elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L477[boost/url/params_ref.hpp,window=blank_]>

params_base::iterator
insert(
    params_base::iterator before,
    const param_view& p);

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.

Return Value

  • iterator

Parameters

Name Type

before

iterator

p

``

Function params_ref::insert

Insert elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L514[boost/url/params_ref.hpp,window=blank_]>

params_base::iterator
insert(
    params_base::iterator before,
    initializer_list<param_view> init);

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.

Return Value

  • iterator

Parameters

Name Type

before

iterator

init

initializer_list

Function params_ref::insert

Insert elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L558[boost/url/params_ref.hpp,window=blank_]>

template<class FwdIt>
params_base::iterator
insert(
    params_base::iterator before,
    FwdIt first,
    FwdIt last);

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.

Return Value

  • iterator

Parameters

Name Type

before

iterator

first

FwdIt

last

FwdIt

Function params_ref::replace

Replace elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L691[boost/url/params_ref.hpp,window=blank_]>

params_base::iterator
replace(
    params_base::iterator pos,
    const param_view& p);

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.

Return Value

  • iterator

Parameters

Name Type

pos

iterator

p

``

Function params_ref::replace

Replace elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L727[boost/url/params_ref.hpp,window=blank_]>

params_base::iterator
replace(
    params_base::iterator from,
    params_base::iterator to,
    initializer_list<param_view> init);

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.

Return Value

  • iterator

Parameters

Name Type

from

iterator

to

iterator

init

initializer_list

Function params_ref::replace

Replace elements

Synopsis

Declared in header </boost/url/params_ref.hpp#L771[boost/url/params_ref.hpp,window=blank_]>

template<class FwdIt>
params_base::iterator
replace(
    params_base::iterator from,
    params_base::iterator to,
    FwdIt first,
    FwdIt last);

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.

Return Value

  • iterator

Parameters

Name Type

from

iterator

to

iterator

first

FwdIt

last

FwdIt

Function params_ref::set

Set a value

Synopsis

Declared in header </boost/url/params_ref.hpp#L848[boost/url/params_ref.hpp,window=blank_]>

params_base::iterator
set(
    params_base::iterator pos,
    string_view value);

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.

Return Value

  • iterator

Parameters

Name Type

pos

iterator

value

string_view

Function params_ref::set

Set a value

Synopsis

Declared in header </boost/url/params_ref.hpp#L910[boost/url/params_ref.hpp,window=blank_]>

params_base::iterator
set(
    string_view key,
    string_view value,
    ignore_case_param ic = = {});

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.

Return Value

  • iterator

Parameters

Name Type

key

string_view

value

string_view

ic

ignore_case_param

Function params_base::iterator::iterator

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L56[boost/url/impl/params_base.hpp,window=blank_]>

iterator() = default;

Function params_base::iterator::iterator

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L57[boost/url/impl/params_base.hpp,window=blank_]>

constexpr
iterator(const iterator&) = default;

Function params_base::iterator::operator++

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L61[boost/url/impl/params_base.hpp,window=blank_]>

iterator&
operator++() noexcept;

Function params_base::iterator::operator++

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L68[boost/url/impl/params_base.hpp,window=blank_]>

iterator
operator++(int) noexcept;

Function params_base::iterator::operator--

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L76[boost/url/impl/params_base.hpp,window=blank_]>

iterator&
operator--() noexcept;

Function params_base::iterator::operator--

Synopsis

Declared in header </boost/url/impl/params_base.hpp#L83[boost/url/impl/params_base.hpp,window=blank_]>

iterator
operator--(int) noexcept;

Function params_base::find

Find a matching key

Synopsis

Declared in header </boost/url/params_base.hpp#L341[boost/url/params_base.hpp,window=blank_]>

iterator
find(
    string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find a match for the specified key. 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().

Return Value

  • iterator

Parameters

Name Type

key

string_view

ic

ignore_case_param

Function params_base::find

Find a matching key

Synopsis

Declared in header </boost/url/params_base.hpp#L386[boost/url/params_base.hpp,window=blank_]>

iterator
find(
    iterator from,
    string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find a match for the specified key. 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().

Return Value

  • iterator

Parameters

Name Type

from

iterator

key

string_view

ic

ignore_case_param

Function params_base::find_last

Find a matching key

Synopsis

Declared in header </boost/url/params_base.hpp#L427[boost/url/params_base.hpp,window=blank_]>

iterator
find_last(
    string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find a match for the specified key. 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().

Return Value

  • iterator

Parameters

Name Type

key

string_view

ic

ignore_case_param

Function params_base::find_last

Find a matching key

Synopsis

Declared in header </boost/url/params_base.hpp#L473[boost/url/params_base.hpp,window=blank_]>

iterator
find_last(
    iterator before,
    string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find a match for the specified key. 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().

Return Value

  • iterator

Parameters

Name Type

before

iterator

key

string_view

ic

ignore_case_param

Function params_view::params_view

Constructor

Synopsis

Declared in header </boost/url/params_view.hpp#L80[boost/url/params_view.hpp,window=blank_]>

params_view() = default;

Description

Default-constructed params have zero elements.

Example

params_view qp;

Effects

return params_view( "" );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • void

Function params_view::params_view

Constructor

Synopsis

Declared in header </boost/url/params_view.hpp#L103[boost/url/params_view.hpp,window=blank_]>

constexpr
params_view(const params_view& other) = default;

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

Return Value

  • void

Parameters

Name Type

other

``

Function params_view::params_view

Constructor

Synopsis

Declared in header </boost/url/params_view.hpp#L130[boost/url/params_view.hpp,window=blank_]>

params_view(
    const params_view& other,
    encoding_opts opt) noexcept;

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

Return Value

  • void

Parameters

Name Type

other

``

opt

encoding_opts

Function params_view::params_view

Constructor

Synopsis

Declared in header </boost/url/params_view.hpp#L186[boost/url/params_view.hpp,window=blank_]>

params_view(string_view s);

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

Return Value

  • void

Parameters

Name Type

s

string_view

Function params_view::params_view

Constructor

Synopsis

Declared in header </boost/url/params_view.hpp#L253[boost/url/params_view.hpp,window=blank_]>

params_view(
    string_view s,
    encoding_opts opt);

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

Return Value

  • void

Parameters

Name Type

s

string_view

opt

encoding_opts

Function params_encoded_view::params_encoded_view

Constructor

Synopsis

Declared in header </boost/url/params_encoded_view.hpp#L87[boost/url/params_encoded_view.hpp,window=blank_]>

constexpr
params_encoded_view() = default;

Description

Default-constructed params have zero elements.

Example

params_encoded_view qp;

Effects

return params_encoded_view( "" );

Complexity

Constant.

Exception Safety

Throws nothing.

Return Value

  • void

Function params_encoded_view::params_encoded_view

Constructor

Synopsis

Declared in header </boost/url/params_encoded_view.hpp#L110[boost/url/params_encoded_view.hpp,window=blank_]>

constexpr
params_encoded_view(const params_encoded_view& other) = default;

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

Return Value

  • void

Parameters

Name Type

other

``

Function params_encoded_view::params_encoded_view

Constructor

Synopsis

Declared in header </boost/url/params_encoded_view.hpp#L165[boost/url/params_encoded_view.hpp,window=blank_]>

params_encoded_view(string_view s);

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

Return Value

  • void

Parameters

Name Type

s

string_view

Function url_base::segments

Return the path as a container of segments

Synopsis

Declared in header </boost/url/url_base.hpp#L1851[boost/url/url_base.hpp,window=blank_]>

segments_ref
segments() noexcept;

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

Specification

Return Value

  • segments_ref

Function url_base::segments

Return the path as a container of segments

Synopsis

Declared in header </boost/url/url_base.hpp#L1855[boost/url/url_base.hpp,window=blank_]>

segments_view
segments() const noexcept;

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

Return Value

  • segments_view

Function url_base::encoded_segments

Return the path as a container of segments

Synopsis

Declared in header </boost/url/url_base.hpp#L1912[boost/url/url_base.hpp,window=blank_]>

segments_encoded_ref
encoded_segments() noexcept;

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

Specification

Return Value

  • segments_encoded_ref

Function url_base::encoded_segments

Return the path as a container of segments

Synopsis

Declared in header </boost/url/url_base.hpp#L1916[boost/url/url_base.hpp,window=blank_]>

segments_encoded_view
encoded_segments() const noexcept;

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

Specification

Return Value

  • segments_encoded_view

Function url_base::params

Return the query as a container of parameters

Synopsis

Declared in header </boost/url/url_base.hpp#L2076[boost/url/url_base.hpp,window=blank_]>

params_ref
params() noexcept;

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 )

Return Value

  • params_ref

Function url_base::params

url_view_base::params

Synopsis

Declared in header </boost/url/url_base.hpp#L2080[boost/url/url_base.hpp,window=blank_]>

params_view
params() const noexcept;

Function url_base::params

Return the query as a container of parameters

Synopsis

Declared in header </boost/url/url_base.hpp#L2136[boost/url/url_base.hpp,window=blank_]>

params_ref
params(encoding_opts opt) noexcept;

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 )

Return Value

  • params_ref

Parameters

Name Type

opt

encoding_opts

Function url_base::encoded_params

Return the query as a container of parameters

Synopsis

Declared in header </boost/url/url_base.hpp#L2140[boost/url/url_base.hpp,window=blank_]>

params_encoded_view
encoded_params() const noexcept;

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

BNF

query           = *( pchar / "/" / "?" )

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

Specification

  • ://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)

Return Value

  • params_encoded_view

Function url_base::encoded_params

Return the query as a container of parameters

Synopsis

Declared in header </boost/url/url_base.hpp#L2190[boost/url/url_base.hpp,window=blank_]>

params_encoded_ref
encoded_params() noexcept;

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 )

Return Value

  • params_encoded_ref

Function params_encoded_ref::operator=

Assignment

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L142[boost/url/params_encoded_ref.hpp,window=blank_]>

params_encoded_ref&
operator=(const params_encoded_ref& other);

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.

Return Value

  • ``

Parameters

Name Type

other

``

Function params_encoded_ref::operator=

Assignment

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L179[boost/url/params_encoded_ref.hpp,window=blank_]>

params_encoded_ref&
operator=(initializer_list<param_pct_view> init);

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.

Return Value

  • ``

Parameters

Name Type

init

initializer_list

Function params_encoded_ref::assign

Assign params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L289[boost/url/params_encoded_ref.hpp,window=blank_]>

void
assign(initializer_list<param_pct_view> init);

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.

Return Value

  • void

Parameters

Name Type

init

initializer_list

Function params_encoded_ref::assign

Assign params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L328[boost/url/params_encoded_ref.hpp,window=blank_]>

template<class FwdIt>
void
assign(
    FwdIt first,
    FwdIt last);

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.

Return Value

  • void

Parameters

Name Type

first

FwdIt

last

FwdIt

Function params_encoded_ref::append

Append params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L362[boost/url/params_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

p

``

Function params_encoded_ref::append

Append params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L396[boost/url/params_encoded_ref.hpp,window=blank_]>

params_encoded_base::iterator
append(initializer_list<param_pct_view> init);

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.

Return Value

  • iterator

Parameters

Name Type

init

initializer_list

Function params_encoded_ref::append

Append params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L436[boost/url/params_encoded_ref.hpp,window=blank_]>

template<class FwdIt>
params_encoded_base::iterator
append(
    FwdIt first,
    FwdIt last);

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.

Return Value

  • iterator

Parameters

Name Type

first

FwdIt

last

FwdIt

Function params_encoded_ref::erase

Erase params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L597[boost/url/params_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

pos

iterator

Function params_encoded_ref::erase

Erase params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L621[boost/url/params_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

first

iterator

last

iterator

Function params_encoded_ref::erase

Erase params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L657[boost/url/params_encoded_ref.hpp,window=blank_]>

size_t
erase(
    pct_string_view key,
    ignore_case_param ic = = {}) noexcept;

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.

Return Value

  • size_t

Parameters

Name Type

key

pct_string_view

ic

ignore_case_param

Function params_encoded_ref::insert

Insert params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L471[boost/url/params_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

before

iterator

p

``

Function params_encoded_ref::insert

Insert params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L512[boost/url/params_encoded_ref.hpp,window=blank_]>

params_encoded_base::iterator
insert(
    params_encoded_base::iterator before,
    initializer_list<param_pct_view> init);

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.

Return Value

  • iterator

Parameters

Name Type

before

iterator

init

initializer_list

Function params_encoded_ref::insert

Insert params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L560[boost/url/params_encoded_ref.hpp,window=blank_]>

template<class FwdIt>
params_encoded_base::iterator
insert(
    params_encoded_base::iterator before,
    FwdIt first,
    FwdIt last);

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.

Return Value

  • iterator

Parameters

Name Type

before

iterator

first

FwdIt

last

FwdIt

Function params_encoded_ref::set

Set a value

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L879[boost/url/params_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

pos

iterator

value

pct_string_view

Function params_encoded_ref::set

Set a value

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L951[boost/url/params_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

key

pct_string_view

value

pct_string_view

ic

ignore_case_param

Function params_encoded_ref::replace

Replace params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L705[boost/url/params_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

pos

iterator

p

``

Function params_encoded_ref::replace

Replace params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L745[boost/url/params_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

from

iterator

to

iterator

init

initializer_list

Function params_encoded_ref::replace

Replace params

Synopsis

Declared in header </boost/url/params_encoded_ref.hpp#L793[boost/url/params_encoded_ref.hpp,window=blank_]>

template<class FwdIt>
params_encoded_base::iterator
replace(
    params_encoded_base::iterator from,
    params_encoded_base::iterator to,
    FwdIt first,
    FwdIt last);

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.

Return Value

  • iterator

Parameters

Name Type

from

iterator

to

iterator

first

FwdIt

last

FwdIt

Function segments_encoded_ref::operator=

Assignment

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L160[boost/url/segments_encoded_ref.hpp,window=blank_]>

segments_encoded_ref&
operator=(const segments_encoded_ref& other);

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. @ {

Return Value

  • ``

Parameters

Name Type

other

``

Function segments_encoded_ref::operator=

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L164[boost/url/segments_encoded_ref.hpp,window=blank_]>

segments_encoded_ref&
operator=(const segments_encoded_view& other);

Function segments_encoded_ref::operator=

Assignment

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L212[boost/url/segments_encoded_ref.hpp,window=blank_]>

segments_encoded_ref&
operator=(initializer_list<pct_string_view> init);

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.

Return Value

  • ``

Parameters

Name Type

init

initializer_list

Function segments_encoded_ref::assign

Assign segments

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L321[boost/url/segments_encoded_ref.hpp,window=blank_]>

void
assign(initializer_list<pct_string_view> init);

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.

Return Value

  • void

Parameters

Name Type

init

initializer_list

Function segments_encoded_ref::assign

Assign segments

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L362[boost/url/segments_encoded_ref.hpp,window=blank_]>

template<class FwdIt>
void
assign(
    FwdIt first,
    FwdIt last);

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.

Return Value

  • void

Parameters

Name Type

first

FwdIt

last

FwdIt

Function segments_encoded_ref::erase

Erase segments

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L532[boost/url/segments_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

pos

iterator

Function segments_encoded_ref::erase

Erase segments

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L558[boost/url/segments_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

first

iterator

last

iterator

Function segments_encoded_ref::insert

Insert segments

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L400[boost/url/segments_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

before

iterator

s

pct_string_view

Function segments_encoded_ref::insert

Insert segments

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L453[boost/url/segments_encoded_ref.hpp,window=blank_]>

segments_encoded_base::iterator
insert(
    segments_encoded_base::iterator before,
    initializer_list<pct_string_view> init);

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.

Return Value

  • iterator

Parameters

Name Type

before

iterator

init

initializer_list

Function segments_encoded_ref::insert

Insert segments

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L505[boost/url/segments_encoded_ref.hpp,window=blank_]>

template<class FwdIt>
segments_encoded_base::iterator
insert(
    segments_encoded_base::iterator before,
    FwdIt first,
    FwdIt last);

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.

Return Value

  • iterator

Parameters

Name Type

before

iterator

first

FwdIt

last

FwdIt

Function segments_ref::operator=

Assignment

Synopsis

Declared in header </boost/url/segments_ref.hpp#L157[boost/url/segments_ref.hpp,window=blank_]>

segments_ref&
operator=(const segments_ref& other);

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. @ {

Return Value

  • ``

Parameters

Name Type

other

``

Function segments_ref::operator=

Synopsis

Declared in header </boost/url/segments_ref.hpp#L161[boost/url/segments_ref.hpp,window=blank_]>

segments_ref&
operator=(const segments_view& other);

Function segments_ref::operator=

Assignment

Synopsis

Declared in header </boost/url/segments_ref.hpp#L204[boost/url/segments_ref.hpp,window=blank_]>

segments_ref&
operator=(initializer_list<string_view> init);

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.

Return Value

  • ``

Parameters

Name Type

init

initializer_list

Function segments_encoded_ref::replace

Replace segments

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L591[boost/url/segments_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

pos

iterator

s

pct_string_view

Function segments_encoded_ref::replace

Replace segments

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L626[boost/url/segments_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

from

iterator

to

iterator

s

pct_string_view

Function segments_encoded_ref::replace

Replace segments

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L671[boost/url/segments_encoded_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

from

iterator

to

iterator

init

initializer_list

Function segments_encoded_ref::replace

Replace segments

Synopsis

Declared in header </boost/url/segments_encoded_ref.hpp#L716[boost/url/segments_encoded_ref.hpp,window=blank_]>

template<class FwdIt>
segments_encoded_base::iterator
replace(
    segments_encoded_base::iterator from,
    segments_encoded_base::iterator to,
    FwdIt first,
    FwdIt last);

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.

Return Value

  • iterator

Parameters

Name Type

from

iterator

to

iterator

first

FwdIt

last

FwdIt

Function segments_ref::assign

Assign segments

Synopsis

Declared in header </boost/url/segments_ref.hpp#L308[boost/url/segments_ref.hpp,window=blank_]>

void
assign(initializer_list<string_view> init);

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.

Return Value

  • void

Parameters

Name Type

init

initializer_list

Function segments_ref::assign

Assign segments

Synopsis

Declared in header </boost/url/segments_ref.hpp#L344[boost/url/segments_ref.hpp,window=blank_]>

template<class FwdIt>
void
assign(
    FwdIt first,
    FwdIt last);

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.

Return Value

  • void

Parameters

Name Type

first

FwdIt

last

FwdIt

Function segments_ref::erase

Erase segments

Synopsis

Declared in header </boost/url/segments_ref.hpp#L498[boost/url/segments_ref.hpp,window=blank_]>

segments_base::iterator
erase(segments_base::iterator pos) noexcept;

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.

Return Value

  • iterator

Parameters

Name Type

pos

iterator

Function segments_ref::erase

Erase segments

Synopsis

Declared in header </boost/url/segments_ref.hpp#L523[boost/url/segments_ref.hpp,window=blank_]>

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.

Return Value

  • iterator

Parameters

Name Type

first

iterator

last

iterator

Function segments_ref::insert

Insert segments

Synopsis

Declared in header </boost/url/segments_ref.hpp#L377[boost/url/segments_ref.hpp,window=blank_]>

segments_base::iterator
insert(
    segments_base::iterator before,
    string_view s);

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.

Return Value

  • iterator

Parameters

Name Type

before

iterator

s

string_view

Function segments_ref::insert

Insert segments

Synopsis

Declared in header </boost/url/segments_ref.hpp#L425[boost/url/segments_ref.hpp,window=blank_]>

segments_base::iterator
insert(
    segments_base::iterator before,
    initializer_list<string_view> init);

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.

Return Value

  • iterator

Parameters

Name Type

before

iterator

init

initializer_list

Function segments_ref::insert

Insert segments

Synopsis

Declared in header </boost/url/segments_ref.hpp#L471[boost/url/segments_ref.hpp,window=blank_]>

template<class FwdIt>
segments_base::iterator
insert(
    segments_base::iterator before,
    FwdIt first,
    FwdIt last);

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.

Return Value

  • iterator

Parameters

Name Type

before

iterator

first

FwdIt

last

FwdIt

Function segments_ref::replace

Replace segments

Synopsis

Declared in header </boost/url/segments_ref.hpp#L555[boost/url/segments_ref.hpp,window=blank_]>

segments_base::iterator
replace(
    segments_base::iterator pos,
    string_view s);

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.

Return Value

  • iterator

Parameters

Name Type

pos

iterator

s

string_view

Function segments_ref::replace

Replace segments

Synopsis

Declared in header </boost/url/segments_ref.hpp#L585[boost/url/segments_ref.hpp,window=blank_]>

segments_base::iterator
replace(
    segments_base::iterator from,
    segments_base::iterator to,
    string_view s);

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.

Return Value

  • iterator

Parameters

Name Type

from

iterator

to

iterator

s

string_view

Function segments_ref::replace

Replace segments

Synopsis

Declared in header </boost/url/segments_ref.hpp#L625[boost/url/segments_ref.hpp,window=blank_]>

segments_base::iterator
replace(
    segments_base::iterator from,
    segments_base::iterator to,
    initializer_list<string_view> init);

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.

Return Value

  • iterator

Parameters

Name Type

from

iterator

to

iterator

init

initializer_list

Function segments_ref::replace

Replace segments

Synopsis

Declared in header </boost/url/segments_ref.hpp#L665[boost/url/segments_ref.hpp,window=blank_]>

template<class FwdIt>
segments_base::iterator
replace(
    segments_base::iterator from,
    segments_base::iterator to,
    FwdIt first,
    FwdIt last);

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.

Return Value

  • iterator

Parameters

Name Type

from

iterator

to

iterator

first

FwdIt

last

FwdIt

Function url_view_base::params

Return the query as a container of parameters

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1997[boost/url/url_view_base.hpp,window=blank_]>

params_view
params() const noexcept;

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)

Return Value

  • params_view

Function url_view_base::params

Synopsis

Declared in header </boost/url/url_view_base.hpp#L2000[boost/url/url_view_base.hpp,window=blank_]>

params_view
params(encoding_opts opt) const noexcept;

Function url::url

Constructor

Synopsis

Declared in header </boost/url/url.hpp#L120[boost/url/url.hpp,window=blank_]>

url() noexcept = default;

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 ]

Return Value

  • void

Function url::url

Constructor

Synopsis

Declared in header </boost/url/url.hpp#L169[boost/url/url.hpp,window=blank_]>

url(string_view s);

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

Return Value

  • void

Parameters

Name Type

s

string_view

Function url::url

Constructor

Synopsis

Declared in header </boost/url/url.hpp#L194[boost/url/url.hpp,window=blank_]>

url(url&& u) noexcept;

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.

Return Value

  • void

Parameters

Name Type

u

``

Function url::url

Constructor

Synopsis

Declared in header </boost/url/url.hpp#L217[boost/url/url.hpp,window=blank_]>

url(const url_view_base& u);

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.

Return Value

  • void

Parameters

Name Type

u

``

Function url::url

Constructor

Synopsis

Declared in header </boost/url/url.hpp#L243[boost/url/url.hpp,window=blank_]>

url(const url& u);

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.

Return Value

  • void

Parameters

Name Type

u

``

Function url::operator=

Assignment

Synopsis

Declared in header </boost/url/url.hpp#L271[boost/url/url.hpp,window=blank_]>

url&
operator=(url&& u) noexcept;

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.

Return Value

  • ``

Parameters

Name Type

u

``

Function url::operator=

Assignment

Synopsis

Declared in header </boost/url/url.hpp#L297[boost/url/url.hpp,window=blank_]>

url&
operator=(const url_view_base& u);

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.

Return Value

  • ``

Parameters

Name Type

u

``

Function url::operator=

Assignment

Synopsis

Declared in header </boost/url/url.hpp#L326[boost/url/url.hpp,window=blank_]>

url&
operator=(const url& u);

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.

Return Value

  • ``

Parameters

Name Type

u

``

Function static_url::static_url

Constructor

Synopsis

Declared in header </boost/url/static_url.hpp#L165[boost/url/static_url.hpp,window=blank_]>

static_url() noexcept;

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 ]

Return Value

  • void

Function static_url::static_url

Constructor

Synopsis

Declared in header </boost/url/static_url.hpp#L217[boost/url/static_url.hpp,window=blank_]>

static_url(string_view s);

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

Return Value

  • void

Parameters

Name Type

s

string_view

Function static_url::static_url

Constructor

Synopsis

Declared in header </boost/url/static_url.hpp#L243[boost/url/static_url.hpp,window=blank_]>

static_url(const static_url& u) noexcept;

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.

Return Value

  • void

Parameters

Name Type

u

``

Function static_url::static_url

Constructor

Synopsis

Declared in header </boost/url/static_url.hpp#L271[boost/url/static_url.hpp,window=blank_]>

static_url(const url_view_base& u);

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.

Return Value

  • void

Parameters

Name Type

u

``

Function static_url::operator=

Assignment

Synopsis

Declared in header </boost/url/static_url.hpp#L298[boost/url/static_url.hpp,window=blank_]>

static_url&
operator=(const static_url& u) noexcept;

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.

Return Value

  • ``

Parameters

Name Type

u

``

Function static_url::operator=

Assignment

Synopsis

Declared in header </boost/url/static_url.hpp#L330[boost/url/static_url.hpp,window=blank_]>

static_url&
operator=(const url_view_base& u);

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.

Return Value

  • ``

Parameters

Name Type

u

``

Function hash::hash

Synopsis

Declared in header </boost/url/url.hpp#L525[boost/url/url.hpp,window=blank_]>

constexpr
hash() = default;

Function hash::hash

Synopsis

Declared in header </boost/url/url.hpp#L526[boost/url/url.hpp,window=blank_]>

constexpr
hash(const hash<boost::urls::url>&) = default;

Function hash::hash

Synopsis

Declared in header </boost/url/url.hpp#L529[boost/url/url.hpp,window=blank_]>

hash(size_t salt) noexcept;

Function hash::hash

Synopsis

Declared in header </boost/url/url_view.hpp#L351[boost/url/url_view.hpp,window=blank_]>

constexpr
hash() = default;

Function hash::hash

Synopsis

Declared in header </boost/url/url_view.hpp#L352[boost/url/url_view.hpp,window=blank_]>

constexpr
hash(const hash<boost::urls::url_view>&) = default;

Function hash::hash

Synopsis

Declared in header </boost/url/url_view.hpp#L355[boost/url/url_view.hpp,window=blank_]>

hash(size_t salt) noexcept;

Function hash::hash

Synopsis

Declared in header </boost/url/static_url.hpp#L449[boost/url/static_url.hpp,window=blank_]>

hash() = default;

Function hash::hash

Synopsis

Declared in header </boost/url/static_url.hpp#L450[boost/url/static_url.hpp,window=blank_]>

hash(const hash&) = default;

Function hash::hash

Synopsis

Declared in header </boost/url/static_url.hpp#L453[boost/url/static_url.hpp,window=blank_]>

hash(size_t salt) noexcept;

Created with MrDocs