Global namespace
boost
boost::urls
Namespaces
Name |
Description |
Types
Name |
Description |
A non-owning reference to a valid authority |
|
A reference to a valid, percent-encoded string |
|
Percent-encoding options |
|
An optional parameter to determine case-sensitivity |
|
An IP version 4 style address. |
|
An IP version 6 style address. |
|
The type of no_value |
|
A query parameter |
|
A query parameter |
|
A query parameter |
|
Common functionality for containers |
|
Common functionality for containers |
|
A view representing query parameters in a URL |
|
A view representing query parameters in a URL |
|
A view representing query parameters in a URL |
|
A view representing query parameters in a URL |
|
A reference to a valid percent-encoded string |
|
Common functionality for containers |
|
Common functionality for containers |
|
A view representing path segments in a URL |
|
A view representing path segments in a URL |
|
A view representing path segments in a URL |
|
A view representing path segments in a URL |
|
A modifiable container for a URL. |
|
Common implementation for all static URLs |
|
The type of string_view used by the library |
|
A modifiable container for a URL. |
|
Common functionality for containers |
|
A non-owning reference to a valid URL |
|
Common functionality for containers |
|
The type of variant used by the library |
|
Enums
Functions
Name |
Description |
Return the default port for a known scheme |
|
Apply percent-encoding to a string Return a percent-encoded string |
|
Return the buffer size needed for percent-encoding |
|
Format arguments into a URL |
|
Format arguments into a URL |
|
Return a valid percent-encoded string |
|
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 |
|
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. |
|
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 |
|
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 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 |
|
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 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 a reference to a parsed URL string |
|
Parse an authority |
|
Return an IPv4 address from an IP address string in dotted decimal form |
|
Parse a string containing an IPv6 address. |
|
Return a reference to a parsed URL string |
|
Parse a string and return an encoded segment view |
|
Parse a string and return an encoded params view |
|
Return a reference to a parsed URL string |
|
Return a reference to a parsed URL string |
|
Return a reference to a parsed URL string |
|
Resolve a URL reference against a base URL |
|
Return the known scheme for a non-normalized string, if known |
|
Swap |
|
Return the normalized string for a known scheme |
Variables
Name |
Description |
The gen-delims character set |
|
Constant indicating no value in a param |
|
The path character set |
|
The reserved character set |
|
The sub-delims character set |
|
The unreserved character set |
|
Using Directives
Name |
Description |
boost::urls::make_void
Synopsis
Declared in header <boost/url/detail/config.hpp>
template<class...>
struct make_void;
Types
Name |
Description |
boost::urls::make_void::type
Synopsis
Declared in header <boost/url/detail/config.hpp>
typedef void type;
boost::urls::void_t
Synopsis
Declared in header <boost/url/detail/config.hpp>
template<class... Ts>
using void_t = make_void<Ts...>::type;
boost::urls::no_value_t
Synopsis
Declared in header <boost/url/param.hpp>
struct no_value_t;
boost::urls::encoding_opts
Synopsis
Declared in header <boost/url/encoding_opts.hpp>
struct encoding_opts;
Member Functions
Name |
Description |
|
Data Members
Name |
Description |
True if nulls are not allowed |
|
True if hexadecimal digits are emitted as lower case |
|
True if spaces encode to and from plus signs |
Description
These options are used to customize the behavior of algorithms which use percent escapes, such as encoding or decoding.
See Also
boost::urls::encoding_opts::space_as_plus
Synopsis
Declared in header <boost/url/encoding_opts.hpp>
bool space_as_plus = false;
Description
This option controls whether or not the PLUS character ("+") is used to represent the SP character (" ") when encoding or decoding. Although not prescribed by the RFC, plus signs are commonly treated as spaces upon decoding when used in the query of URLs using well known schemes such as HTTP.
Specification
boost::urls::encoding_opts::lower_case
Synopsis
Declared in header <boost/url/encoding_opts.hpp>
bool lower_case = false;
Description
By default, percent-encoding algorithms
emit hexadecimal digits A through F as
uppercase letters. When this option is
true
, lowercase letters are used.
boost::urls::encoding_opts::disallow_null
Synopsis
Declared in header <boost/url/encoding_opts.hpp>
bool disallow_null = false;
Description
Normally all possible character values (from 0 to 255) are allowed, with reserved characters being replaced with escapes upon encoding. When this option is true, attempting to decode a null will result in an error.
boost::urls::encoding_opts::encoding_opts
Synopsis
Declared in header <boost/url/encoding_opts.hpp>
encoding_opts(
bool space_as_plus_ = false,
bool lower_case_ = false,
bool disallow_null_ = false) noexcept;
boost::urls::error_types
Types
Name |
Description |
The type of error category used by the library |
|
The type of error code used by the library |
|
The type of error condition used by the library |
|
The type of result returned by library functions |
|
The type of system error thrown by the library |
boost::urls::error_types::error_category
Synopsis
Declared in header <boost/url/error_types.hpp>
Description
Warning
|
This alias is no longer supported and
should not be used in new code. Please use
system::error_category instead.
|
This alias is included for backwards compatibility with earlier versions of the library.
However, it will be removed in future releases, and using it in new code is not recommended.
Please use the updated version instead to ensure compatibility with future versions of the library.
boost::urls::error_types::error_code
Synopsis
Declared in header <boost/url/error_types.hpp>
Description
Warning
|
This alias is no longer supported and
should not be used in new code. Please use
system::error_code instead.
|
This alias is included for backwards compatibility with earlier versions of the library.
However, it will be removed in future releases, and using it in new code is not recommended.
Please use the updated version instead to ensure compatibility with future versions of the library.
boost::urls::error_types::error_condition
Synopsis
Declared in header <boost/url/error_types.hpp>
Description
Warning
|
This alias is no longer supported and
should not be used in new code. Please use
system::error_condition instead.
|
This alias is included for backwards compatibility with earlier versions of the library.
However, it will be removed in future releases, and using it in new code is not recommended.
Please use the updated version instead to ensure compatibility with future versions of the library.
boost::urls::error_types::system_error
Synopsis
Declared in header <boost/url/error_types.hpp>
Description
Warning
|
This alias is no longer supported and
should not be used in new code. Please use
system::system_error instead.
|
This alias is included for backwards compatibility with earlier versions of the library.
However, it will be removed in future releases, and using it in new code is not recommended.
Please use the updated version instead to ensure compatibility with future versions of the library.
boost::urls::error_types::generic_category
Synopsis
Declared in header <boost/url/error_types.hpp>
boost::urls::error_types::system_category
Synopsis
Declared in header <boost/url/error_types.hpp>
boost::urls::error_types::errc
Synopsis
Declared in header <boost/url/error_types.hpp>
boost::urls::error_types::result
Synopsis
Declared in header <boost/url/error_types.hpp>
Description
Warning
|
This alias is no longer supported and
should not be used in new code. Please use
system::result instead.
|
This alias is included for backwards compatibility with earlier versions of the library.
However, it will be removed in future releases, and using it in new code is not recommended.
Please use the updated version instead to ensure compatibility with future versions of the library.
This is an alias template used as the return type for functions that can either return a container, or fail with an error code. This is a brief synopsis of the type:
Declaration
template< class T >
class result
{
public:
//
// Return true if the result contains an error
//
constexpr bool has_error() const noexcept;
//
// Return the error
//
constexpr system::error_code error() const noexcept;
//
// Return true if the result contains a value
//
constexpr bool has_value() const noexcept;
constexpr explicit operator bool() const noexcept;
//
// Return the value, or throw an exception
//
constexpr T& value();
constexpr T const& value() const;
// Return the value.
// Precondition: has_value()==true
//
constexpr T& operator*() noexcept;
constexpr T* operator->() noexcept;
constexpr T const& operator*() const noexcept;
constexpr T const* operator->() const noexcept;
...more
Usage
Given the function parse_uri with this signature:
system::result< url_view > parse_uri( core::string_view s ) noexcept;
The following statement captures the value in a variable upon success, otherwise throws:
url_view u = parse_uri( "http://example.com/path/to/file.txt" ).value();
This statement captures the result in a local variable and inspects the error condition:
system::result< url_view > rv = parse_uri( "http://example.com/path/to/file.txt" );
if(! rv )
std::cout << rv.error();
else
std::cout << *rv;
See Also
boost::urls::string_token
Types
Name |
Description |
Base class for string tokens, and algorithm parameters |
|
Functions
Name |
Description |
boost::urls::string_token::arg
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
struct arg;
Member Functions
Description
This abstract interface provides a means for an algorithm to generically obtain a modifiable, contiguous character buffer of prescribed size. As the author of an algorithm simply declare an rvalue reference as a parameter type.
Instances of this type are intended only to be used once and then destroyed.
Example
The declared function accepts any
temporary instance of arg
to be
used for writing:
void algorithm( string_token::arg&& dest );
To implement the interface for your type or use-case, derive from the class and implement the prepare function.
boost::urls::string_token::arg::prepare
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
virtual
char*
prepare(std::size_t n) = 0;
Description
This function attempts to obtain a
character buffer with space for at
least n
characters. Upon success,
a pointer to the beginning of the
buffer is returned. Ownership is not
transferred; the caller should not
attempt to free the storage. The
buffer shall remain valid until
this
is destroyed.
Note
|
This function may only be called once. After invoking the function, the only valid operation is destruction. |
boost::urls::string_token::arg::~arg
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
virtual
~arg() = default;
boost::urls::string_token::arg::arg
Members
constexpr
arg() = default;
» more...
constexpr
arg(arg&&) = default;
» more...
arg(arg const&) = delete;
» more...
boost::urls::string_token::arg::operator=
Members
arg&
operator=(arg&&) = delete;
» more...
arg&
operator=(arg const&) = delete;
» more...
boost::urls::string_token::is_token
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
template<
class T,
class = void>
struct is_token
: std::false_type;
boost::urls::string_token::is_token
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
template<class T>
struct is_token<T, void_t<decltype(std::declval<T&>().prepare(
std::declval<std::size_t>())), decltype(std::declval<T&>().result())>>
: std::integral_constant<bool, std::is_convertible<decltype(std::declval<T &>().result()), typename T::result_type>::value && std::is_same<decltype(std::declval<T &>().prepare(0)), char *>::value && std::is_base_of<arg, T>::value && std::is_convertible<const volatile T *, const volatile arg *>::value>;
boost::urls::string_token::return_string
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
struct return_string
: arg;
Types
Name |
Description |
boost::urls::string_token::return_string::result_type
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
using result_type = std::string;
boost::urls::string_token::return_string::prepare
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
virtual
char*
prepare(std::size_t n) override;
boost::urls::string_token::return_string::result
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
result_type
result() noexcept;
boost::urls::string_token::append_to_t
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
template<class Alloc>
struct append_to_t
: arg;
Types
Name |
Description |
Member Functions
Name |
Description |
|
|
Return a modifiable character buffer |
|
boost::urls::string_token::append_to_t::string_type
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
boost::urls::string_token::append_to_t::result_type
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
using result_type = string_type&;
boost::urls::string_token::append_to_t::append_to_t
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
explicit
append_to_t(string_type& s) noexcept;
boost::urls::string_token::append_to_t::prepare
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
virtual
char*
prepare(std::size_t n) override;
boost::urls::string_token::append_to_t::result
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
result_type
result() noexcept;
boost::urls::string_token::append_to
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
template<class Alloc = std::allocator<char>>
append_to_t<Alloc>
append_to(std::basic_string<char, std::char_traits<char>, Alloc>& s);
boost::urls::string_token::assign_to_t
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
template<class Alloc>
struct assign_to_t
: arg;
Types
Name |
Description |
Member Functions
Name |
Description |
|
|
Return a modifiable character buffer |
|
boost::urls::string_token::assign_to_t::string_type
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
boost::urls::string_token::assign_to_t::result_type
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
using result_type = string_type&;
boost::urls::string_token::assign_to_t::assign_to_t
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
explicit
assign_to_t(string_type& s) noexcept;
boost::urls::string_token::assign_to_t::prepare
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
virtual
char*
prepare(std::size_t n) override;
boost::urls::string_token::assign_to_t::result
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
result_type
result() noexcept;
boost::urls::string_token::assign_to
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
template<class Alloc = std::allocator<char>>
assign_to_t<Alloc>
assign_to(std::basic_string<char, std::char_traits<char>, Alloc>& s);
boost::urls::string_token::preserve_size_t
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
template<class Alloc>
struct preserve_size_t
: arg;
Types
Name |
Description |
Member Functions
Name |
Description |
Return a modifiable character buffer |
|
|
|
boost::urls::string_token::preserve_size_t::result_type
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
using result_type = core::string_view;
boost::urls::string_token::preserve_size_t::string_type
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
boost::urls::string_token::preserve_size_t::preserve_size_t
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
explicit
preserve_size_t(string_type& s) noexcept;
boost::urls::string_token::preserve_size_t::prepare
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
virtual
char*
prepare(std::size_t n) override;
boost::urls::string_token::preserve_size_t::result
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
result_type
result() noexcept;
boost::urls::string_token::preserve_size
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
template<class Alloc = std::allocator<char>>
preserve_size_t<Alloc>
preserve_size(std::basic_string<char, std::char_traits<char>, Alloc>& s);
boost::urls::grammar
Types
Name |
Description |
A set of characters |
|
A forward range of parsed elements |
|
A thread-safe collection of instances of T |
|
A pointer to shared instance of T |
|
Common functionality for string views |
|
Enums
Functions
Name |
Description |
Return the case-insensitive comparison of s0 and s1 |
|
Return the case-insensitive digest of a string |
|
Return true if s0 is less than s1 using case-insensitive comparison |
|
Find the first character in the string that is in the set. |
|
Find the first character in the string that is not in CharSet |
|
Return the hash of this value |
|
Return the decimal value of a hex character |
|
Return the union of two character sets. |
|
Return a new character set by subtracting |
|
Format a string to an output stream |
|
Parse a character buffer using a rule |
|
Return c converted to lowercase |
|
Return c converted to uppercase |
|
Variables
Name |
Description |
A character set containing all characters. |
|
A character set containing the alphabetical characters. |
|
boost::urls::grammar::string_token
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
namespace string_token = boost::urls::string_token;
boost::urls::grammar::string_view_base
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
class string_view_base;
Types
Name |
Description |
The const iterator type |
|
The const pointer type |
|
The const reference type |
|
The const reverse iterator type |
|
The difference type |
|
The iterator type |
|
The pointer type |
|
The reference type |
|
The reverse iterator type |
|
The size type |
|
The character traits |
|
The value type |
Member Functions
Name |
Description |
Access a character |
|
Return the last character |
|
Return an iterator to the beginning |
|
Return an iterator to the beginning |
|
Return an iterator to the end |
|
Return the result of comparing to another string |
|
Return true if matching characters are found |
|
Copy the characters to another buffer |
|
Return a pointer to the character buffer |
|
Return true if the string is empty |
|
Return an iterator to the end |
|
Return true if a matching suffix exists |
|
Return the position of matching characters |
|
Return the position of the first non-match |
|
Return the position of the first match |
|
Return the position of the last non-match |
|
Return the position of the last match |
|
Return the first character |
|
Return the size |
|
Return the maximum allowed size |
|
Conversion |
|
Conversion |
|
Access a character |
|
Return the position of matching characters |
|
Return the size |
|
Return true if a matching prefix exists |
|
Return a view to part of the string |
Static Data Members
Name |
Description |
A constant used to represent "no position" |
Friends
Name |
Description |
Return the hash of this value |
|
Description
This base class is used to provide common member functions for reference types that behave like string views. This cannot be instantiated directly; Instead, derive from the type and provide constructors which offer any desired preconditions and invariants.
boost::urls::grammar::string_view_base::traits_type
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
typedef std::char_traits<char> traits_type;
boost::urls::grammar::string_view_base::value_type
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
typedef char value_type;
boost::urls::grammar::string_view_base::pointer
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
typedef char* pointer;
boost::urls::grammar::string_view_base::const_pointer
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
typedef char const* const_pointer;
boost::urls::grammar::string_view_base::reference
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
typedef char& reference;
boost::urls::grammar::string_view_base::const_reference
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
typedef char const& const_reference;
boost::urls::grammar::string_view_base::const_iterator
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
typedef char const* const_iterator;
boost::urls::grammar::string_view_base::iterator
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
typedef const_iterator iterator;
boost::urls::grammar::string_view_base::const_reverse_iterator
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
boost::urls::grammar::string_view_base::reverse_iterator
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
typedef const_reverse_iterator reverse_iterator;
boost::urls::grammar::string_view_base::size_type
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
typedef std::size_t size_type;
boost::urls::grammar::string_view_base::difference_type
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
typedef std::ptrdiff_t difference_type;
boost::urls::grammar::string_view_base::npos
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
static
std::size_t const npos = core::string_view::npos;
boost::urls::grammar::string_view_base::operator core::string_view
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
operator core::string_view() const noexcept;
boost::urls::grammar::string_view_base::operator std::string
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
explicit
operator std::string() const noexcept;
Description
Conversion to std::string is explicit because assigning to string using an implicit constructor does not preserve capacity.
boost::urls::grammar::string_view_base::begin
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_iterator
begin() const noexcept;
Description
See core::string_view::begin
boost::urls::grammar::string_view_base::end
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_iterator
end() const noexcept;
Description
See core::string_view::end
boost::urls::grammar::string_view_base::cbegin
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_iterator
cbegin() const noexcept;
Description
See core::string_view::cbegin
boost::urls::grammar::string_view_base::cend
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_iterator
cend() const noexcept;
Description
See core::string_view::cend
boost::urls::grammar::string_view_base::rbegin
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_reverse_iterator
rbegin() const noexcept;
boost::urls::grammar::string_view_base::rend
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_reverse_iterator
rend() const noexcept;
boost::urls::grammar::string_view_base::crbegin
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_reverse_iterator
crbegin() const noexcept;
boost::urls::grammar::string_view_base::crend
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_reverse_iterator
crend() const noexcept;
boost::urls::grammar::string_view_base::size
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
size_type
size() const noexcept;
Description
See core::string_view::size
boost::urls::grammar::string_view_base::length
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
size_type
length() const noexcept;
Description
See core::string_view::length
boost::urls::grammar::string_view_base::max_size
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
size_type
max_size() const noexcept;
Description
See core::string_view::max_size
boost::urls::grammar::string_view_base::empty
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
bool
empty() const noexcept;
Description
See core::string_view::size
boost::urls::grammar::string_view_base::operator[]
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_reference
operator[](size_type pos) const noexcept;
Description
See core::string_view::operator[]
boost::urls::grammar::string_view_base::at
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_reference
at(size_type pos) const;
Description
See core::string_view::at
boost::urls::grammar::string_view_base::front
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_reference
front() const noexcept;
Description
See core::string_view::front
boost::urls::grammar::string_view_base::back
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_reference
back() const noexcept;
Description
See core::string_view::back
boost::urls::grammar::string_view_base::data
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
const_pointer
data() const noexcept;
Description
See core::string_view::data
boost::urls::grammar::string_view_base::copy
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::copy
boost::urls::grammar::string_view_base::substr
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::substr
boost::urls::grammar::string_view_base::compare
Members
Return the result of comparing to another string
constexpr
int
compare(core::string_view str) const noexcept;
» more...
Return the result of comparing to another string
constexpr
int
compare(
size_type pos1,
size_type n1,
core::string_view str) const;
» more...
Return the result of comparing to another string
Return the result of comparing to another string
constexpr
int
compare(char const* s) const noexcept;
» more...
Return the result of comparing to another string
constexpr
int
compare(
size_type pos1,
size_type n1,
char const* s) const;
» more...
Return the result of comparing to another string
constexpr
int
compare(
size_type pos1,
size_type n1,
char const* s,
size_type n2) const;
» more...
boost::urls::grammar::string_view_base::starts_with
Members
Return true if a matching prefix exists
constexpr
bool
starts_with(core::string_view x) const noexcept;
» more...
Return true if a matching prefix exists
constexpr
bool
starts_with(char x) const noexcept;
» more...
Return true if a matching prefix exists
constexpr
bool
starts_with(char const* x) const noexcept;
» more...
boost::urls::grammar::string_view_base::ends_with
Members
Return true if a matching suffix exists
constexpr
bool
ends_with(core::string_view x) const noexcept;
» more...
Return true if a matching suffix exists
constexpr
bool
ends_with(char x) const noexcept;
» more...
Return true if a matching suffix exists
constexpr
bool
ends_with(char const* x) const noexcept;
» more...
boost::urls::grammar::string_view_base::find
Members
Return the position of matching characters
constexpr
size_type
find(
core::string_view str,
size_type pos = 0) const noexcept;
» more...
Return the position of matching characters
constexpr
size_type
find(
char c,
size_type pos = 0) const noexcept;
» more...
Return the position of matching characters
constexpr
size_type
find(
char const* s,
size_type pos,
size_type n) const noexcept;
» more...
Return the position of matching characters
constexpr
size_type
find(
char const* s,
size_type pos = 0) const noexcept;
» more...
boost::urls::grammar::string_view_base::rfind
Members
Return the position of matching characters
constexpr
size_type
rfind(
core::string_view str,
size_type pos = core::string_view::npos) const noexcept;
» more...
Return the position of matching characters
constexpr
size_type
rfind(
char c,
size_type pos = core::string_view::npos) const noexcept;
» more...
Return the position of matching characters
constexpr
size_type
rfind(
char const* s,
size_type pos,
size_type n) const noexcept;
» more...
Return the position of matching characters
constexpr
size_type
rfind(
char const* s,
size_type pos = core::string_view::npos) const noexcept;
» more...
boost::urls::grammar::string_view_base::find_first_of
Members
Return the position of the first match
constexpr
size_type
find_first_of(
core::string_view str,
size_type pos = 0) const noexcept;
» more...
Return the position of the first match
constexpr
size_type
find_first_of(
char c,
size_type pos = 0) const noexcept;
» more...
Return the position of the first match
constexpr
size_type
find_first_of(
char const* s,
size_type pos,
size_type n) const noexcept;
» more...
Return the position of the first match
constexpr
size_type
find_first_of(
char const* s,
size_type pos = 0) const noexcept;
» more...
boost::urls::grammar::string_view_base::find_last_of
Members
Return the position of the last match
constexpr
size_type
find_last_of(
core::string_view str,
size_type pos = core::string_view::npos) const noexcept;
» more...
Return the position of the last match
constexpr
size_type
find_last_of(
char c,
size_type pos = core::string_view::npos) const noexcept;
» more...
Return the position of the last match
constexpr
size_type
find_last_of(
char const* s,
size_type pos,
size_type n) const noexcept;
» more...
Return the position of the last match
constexpr
size_type
find_last_of(
char const* s,
size_type pos = core::string_view::npos) const noexcept;
» more...
boost::urls::grammar::string_view_base::find_first_not_of
Members
Return the position of the first non-match
constexpr
size_type
find_first_not_of(
core::string_view str,
size_type pos = 0) const noexcept;
» more...
Return the position of the first non-match
constexpr
size_type
find_first_not_of(
char c,
size_type pos = 0) const noexcept;
» more...
Return the position of the first non-match
constexpr
size_type
find_first_not_of(
char const* s,
size_type pos,
size_type n) const noexcept;
» more...
Return the position of the first non-match
constexpr
size_type
find_first_not_of(
char const* s,
size_type pos = 0) const noexcept;
» more...
boost::urls::grammar::string_view_base::find_last_not_of
Members
Return the position of the last non-match
constexpr
size_type
find_last_not_of(
core::string_view str,
size_type pos = core::string_view::npos) const noexcept;
» more...
Return the position of the last non-match
constexpr
size_type
find_last_not_of(
char c,
size_type pos = core::string_view::npos) const noexcept;
» more...
Return the position of the last non-match
constexpr
size_type
find_last_not_of(
char const* s,
size_type pos,
size_type n) const noexcept;
» more...
Return the position of the last non-match
constexpr
size_type
find_last_not_of(
char const* s,
size_type pos = core::string_view::npos) const noexcept;
» more...
boost::urls::grammar::string_view_base::contains
Members
Return true if matching characters are found
constexpr
bool
contains(core::string_view sv) const noexcept;
» more...
Return true if matching characters are found
constexpr
bool
contains(char c) const noexcept;
» more...
Return true if matching characters are found
constexpr
bool
contains(char const* s) const noexcept;
» more...
boost::urls::grammar::operator==
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
template<
class S0,
class S1>
friend
constexpr
bool
operator==(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::grammar::operator!=
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
template<
class S0,
class S1>
friend
constexpr
bool
operator!=(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::grammar::operator<
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
template<
class S0,
class S1>
friend
constexpr
bool
operator<(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::grammar::operator⇐
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
template<
class S0,
class S1>
friend
constexpr
bool
operator<=(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::grammar::operator>
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
template<
class S0,
class S1>
friend
constexpr
bool
operator>(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::grammar::operator>=
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
template<
class S0,
class S1>
friend
constexpr
bool
operator>=(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::grammar::hash_value
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
friend
std::size_t
hash_value(string_view_base const& s) noexcept;
boost::urls::grammar::operator<<
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
friend
std::ostream&
operator<<(
std::ostream& os,
string_view_base const& s);
boost::urls::grammar::operator==
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
template<
class S0,
class S1>
constexpr
bool
operator==(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::grammar::operator!=
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
template<
class S0,
class S1>
constexpr
bool
operator!=(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::grammar::operator<
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
template<
class S0,
class S1>
constexpr
bool
operator<(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::grammar::operator⇐
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
template<
class S0,
class S1>
constexpr
bool
operator<=(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::grammar::operator>
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
template<
class S0,
class S1>
constexpr
bool
operator>(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::grammar::operator>=
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
template<
class S0,
class S1>
constexpr
bool
operator>=(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::grammar::hash_value
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
std::size_t
hash_value(string_view_base const& s) noexcept;
boost::urls::grammar::operator<<
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
std::ostream&
operator<<(
std::ostream& os,
string_view_base const& s);
boost::urls::grammar::all_chars_t
Synopsis
Declared in header <boost/url/grammar/all_chars.hpp>
struct all_chars_t;
Member Functions
Name |
Description |
|
|
boost::urls::grammar::all_chars_t::all_chars_t
Synopsis
Declared in header <boost/url/grammar/all_chars.hpp>
constexpr
all_chars_t() noexcept = default;
boost::urls::grammar::all_chars_t::operator()
Synopsis
Declared in header <boost/url/grammar/all_chars.hpp>
constexpr
bool
operator()(char) const noexcept;
boost::urls::grammar::all_chars_t::find_if
Synopsis
Declared in header <boost/url/grammar/all_chars.hpp>
char const*
find_if(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::all_chars_t::find_if_not
Synopsis
Declared in header <boost/url/grammar/all_chars.hpp>
char const*
find_if_not(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::all_chars
Synopsis
Declared in header <boost/url/grammar/all_chars.hpp>
constexpr
all_chars_t const all_chars = {};
See Also
boost::urls::grammar::hexdig_chars_t
Synopsis
Declared in header <boost/url/grammar/hexdig_chars.hpp>
struct hexdig_chars_t;
Member Functions
Name |
Description |
Return true if c is in the character set. |
boost::urls::grammar::hexdig_chars_t::operator()
Synopsis
Declared in header <boost/url/grammar/hexdig_chars.hpp>
constexpr
bool
operator()(char c) const noexcept;
boost::urls::grammar::hexdig_chars_t::find_if
Synopsis
Declared in header <boost/url/grammar/hexdig_chars.hpp>
char const*
find_if(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::hexdig_chars_t::find_if_not
Synopsis
Declared in header <boost/url/grammar/hexdig_chars.hpp>
char const*
find_if_not(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::hexdig_chars
Synopsis
Declared in header <boost/url/grammar/hexdig_chars.hpp>
constexpr
hexdig_chars_t const hexdig_chars = {};
boost::urls::grammar::hexdig_value
Synopsis
Declared in header <boost/url/grammar/hexdig_chars.hpp>
signed char
hexdig_value(char ch) noexcept;
Description
This function returns the decimal value of a hexadecimal character, or -1 if the argument is not a valid hexadecimal digit.
BNF
HEXDIG = DIGIT
/ "A" / "B" / "C" / "D" / "E" / "F"
/ "a" / "b" / "c" / "d" / "e" / "f"
Return Value
The decimal value or -1
Parameters
Name | Description |
---|---|
ch |
The character to check |
boost::urls::grammar::is_charset
Synopsis
Declared in header <boost/url/grammar/charset.hpp>
template<
class T,
class = void>
struct is_charset
: std::false_type;
boost::urls::grammar::is_charset
Synopsis
Declared in header <boost/url/grammar/charset.hpp>
template<class T>
struct is_charset<T, void_t<decltype(std::declval<bool&>() =
std::declval<T const&>().operator()(
std::declval<char>()))>>
: std::true_type;
boost::urls::grammar::find_if
Synopsis
Declared in header <boost/url/grammar/charset.hpp>
template<class CharSet>
char const*
find_if(
char const const* first,
char const const* last,
CharSet const& cs) noexcept;
Description
Exception Safety
Throws nothing.
Return Value
A pointer to the found character,
otherwise the value last
.
Parameters
Name | Description |
---|---|
first |
A pointer to the first character in the string to search. |
last |
A pointer to one past the last character in the string to search. |
cs |
The character set to use. |
See Also
boost::urls::grammar::find_if_not
Synopsis
Declared in header <boost/url/grammar/charset.hpp>
template<class CharSet>
char const*
find_if_not(
char const const* first,
char const const* last,
CharSet const& cs) noexcept;
Description
Exception Safety
Throws nothing.
Return Value
A pointer to the found character,
otherwise the value last
.
Parameters
Name | Description |
---|---|
first |
A pointer to the first character in the string to search. |
last |
A pointer to one past the last character in the string to search. |
cs |
The character set to use. |
See Also
boost::urls::grammar::ref
Members
template<class CharSet>
constexpr
detail::charset_ref<CharSet>
ref(CharSet const& cs) noexcept;
» more...
template<class Rule>
constexpr
detail::rule_ref<Rule>
ref(Rule const& r) noexcept;
» more...
constexpr
void
ref(...) = delete;
» more...
boost::urls::grammar::is_rule
Synopsis
Declared in header <boost/url/grammar/type_traits.hpp>
template<
class T,
class = void>
struct is_rule
: std::false_type;
boost::urls::grammar::is_rule
Synopsis
Declared in header <boost/url/grammar/type_traits.hpp>
boost::urls::grammar::lut_chars
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
class lut_chars;
Member Functions
Name |
Description |
|
Constructor |
Return true if ch is in the character set. |
|
Return a new character set which is the complement of another character set. |
Friends
Description
The characters defined by instances of
this set are provided upon construction.
The constexpr
implementation allows
these to become compile-time constants.
Example
Character sets are used with rules and the functions find_if and find_if_not .
constexpr lut_chars vowel_chars = "AEIOU" "aeiou";
system::result< core::string_view > rv = parse( "Aiea", token_rule( vowel_chars ) );
See Also
find_if , find_if_not , parse , token_rule .
boost::urls::grammar::lut_chars::lut_chars
Members
Constructor
constexpr
lut_chars(char ch) noexcept;
» more...
Constructor
constexpr
lut_chars(char const* s) noexcept;
» more...
template<
class Pred,
class = void>
constexpr
lut_chars(Pred const& pred) noexcept;
» more...
boost::urls::grammar::lut_chars::operator()
Members
Return true if ch is in the character set.
constexpr
bool
operator()(unsigned char ch) const noexcept;
» more...
Return true if ch is in the character set.
constexpr
bool
operator()(char ch) const noexcept;
» more...
boost::urls::grammar::operator+
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
Description
This function returns a new character
set which contains all of the characters
in cs0
as well as all of the characters
in cs
.
Example
This creates a character set which includes all letters and numbers
constexpr lut_chars alpha_chars(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz");
constexpr lut_chars alnum_chars = alpha_chars + "0123456789";
Complexity
Constant.
boost::urls::grammar::operator-
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
Description
This function returns a new character
set which is formed from all of the
characters in cs0
which are not in cs
.
Example
This statement declares a character set containing all the lowercase letters which are not vowels:
constexpr lut_chars consonants = lut_chars("abcdefghijklmnopqrstuvwxyz") - "aeiou";
Complexity
Constant.
boost::urls::grammar::lut_chars::operator~
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
constexpr
lut_chars
operator~() const noexcept;
Description
This function returns a new character
set which contains all of the characters
that are not in *this
.
Example
This statement declares a character set containing everything but vowels:
constexpr lut_chars not_vowels = ~lut_chars( "AEIOU" "aeiou" );
Complexity
Constant.
Exception Safety
Throws nothing.
Return Value
The new character set.
boost::urls::grammar::lut_chars::find_if
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
char const*
find_if(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::lut_chars::find_if_not
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
char const*
find_if_not(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::operator+
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
Description
This function returns a new character
set which contains all of the characters
in cs0
as well as all of the characters
in cs
.
Example
This creates a character set which includes all letters and numbers
constexpr lut_chars alpha_chars(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz");
constexpr lut_chars alnum_chars = alpha_chars + "0123456789";
Complexity
Constant.
Return Value
The new character set.
Parameters
Name | Description |
---|---|
cs0 |
A character to join |
cs1 |
A character to join |
boost::urls::grammar::operator-
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
Description
This function returns a new character
set which is formed from all of the
characters in cs0
which are not in cs
.
Example
This statement declares a character set containing all the lowercase letters which are not vowels:
constexpr lut_chars consonants = lut_chars("abcdefghijklmnopqrstuvwxyz") - "aeiou";
Complexity
Constant.
Return Value
The new character set.
Parameters
Name | Description |
---|---|
cs0 |
A character set to join. |
cs1 |
A character set to join. |
boost::urls::grammar::parse
Members
Parse a character buffer using a rule
template<class Rule>
system::result<Rule::value_type>
parse(
char const*& it,
char const* end,
Rule const& r);
» more...
Parse a character buffer using a rule
template<class Rule>
system::result<Rule::value_type>
parse(
core::string_view s,
Rule const& r);
» more...
boost::urls::grammar::error
Synopsis
Declared in header <boost/url/grammar/error.hpp>
enum error : int;
Members
Name |
Description |
More input is needed to match the rule |
|
The rule did not match the input. |
|
A rule reached the end of a range |
|
Leftover input remaining after match. |
|
A rule encountered unrecoverable invalid input. |
|
An integer overflowed during parsing. |
|
An unspecified syntax error was found. |
boost::urls::grammar::error::need_more
Synopsis
Declared in header <boost/url/grammar/error.hpp>
need_more = 1
Description
A rule reached the end of the input, resulting in a partial match. The error is recoverable; the caller may obtain more input if possible and attempt to parse the character buffer again. Custom rules should only return this error if it is completely unambiguous that the rule cannot be matched without more input.
boost::urls::grammar::error::mismatch
Synopsis
Declared in header <boost/url/grammar/error.hpp>
mismatch
Description
This error is returned when a rule fails to match the input. The error is recoverable; the caller may rewind the input pointer and attempt to parse again using a different rule.
boost::urls::grammar::error::end_of_range
Synopsis
Declared in header <boost/url/grammar/error.hpp>
end_of_range
Description
This indicates that the input was consumed when parsing a range . The range_rule avoids rewinding the input buffer when this error is returned. Thus the consumed characters are be considered part of the range without contributing additional elements.
boost::urls::grammar::error::leftover
Synopsis
Declared in header <boost/url/grammar/error.hpp>
leftover
boost::urls::grammar::error::invalid
Synopsis
Declared in header <boost/url/grammar/error.hpp>
invalid
Description
This error is returned when input is matching but one of the requirements is violated. For example if a percent escape is found, but one or both characters that follow are not valid hexadecimal digits. This is usually an unrecoverable error.
boost::urls::grammar::error::out_of_range
Synopsis
Declared in header <boost/url/grammar/error.hpp>
out_of_range
boost::urls::grammar::error::syntax
Synopsis
Declared in header <boost/url/grammar/error.hpp>
syntax
boost::urls::grammar::condition
Synopsis
Declared in header <boost/url/grammar/error.hpp>
enum condition : int;
Members
Name |
Description |
A fatal error in syntax was encountered. |
boost::urls::grammar::condition::fatal
Synopsis
Declared in header <boost/url/grammar/error.hpp>
fatal = 1
Description
This indicates that parsing cannot continue.
boost::urls::grammar::make_error_code
Synopsis
Declared in header <boost/url/grammar/impl/error.hpp>
boost::urls::grammar::make_error_condition
Synopsis
Declared in header <boost/url/grammar/impl/error.hpp>
boost::urls::grammar::to_lower
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
constexpr
char
to_lower(char c) noexcept;
Description
This function returns the character, converting it to lowercase if it is uppercase. The function is defined only for low-ASCII characters.
Example
assert( to_lower( 'A' ) == 'a' );
Exception Safety
Throws nothing.
Return Value
The converted character
Parameters
Name | Description |
---|---|
c |
The character to convert |
See Also
to_upper .
boost::urls::grammar::to_upper
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
constexpr
char
to_upper(char c) noexcept;
Description
This function returns the character, converting it to uppercase if it is lowercase. The function is defined only for low-ASCII characters.
Example
assert( to_upper( 'a' ) == 'A' );
Exception Safety
Throws nothing.
Return Value
The converted character
Parameters
Name | Description |
---|---|
c |
The character to convert |
See Also
to_lower .
boost::urls::grammar::ci_compare
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
int
ci_compare(
core::string_view s0,
core::string_view s1) noexcept;
Description
This returns the lexicographical comparison of two strings, ignoring case. The function is defined only for strings containing low-ASCII characters.
Example
assert( ci_compare( "boost", "Boost" ) == 0 );
Exception Safety
Throws nothing.
Return Value
0 if the strings are equal, -1 if
s0
is less than s1
, or 1 if s0
is
greater than s1.
Parameters
Name | Description |
---|---|
s0 |
The first string |
s1 |
The second string |
See Also
boost::urls::grammar::ci_digest
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
std::size_t
ci_digest(core::string_view s) noexcept;
Description
The hash function is non-cryptographic and not hardened against algorithmic complexity attacks. Returned digests are suitable for usage in unordered containers. The function is defined only for strings containing low-ASCII characters.
Return Value
The digest
Parameters
Name | Description |
---|---|
s |
The string |
boost::urls::grammar::ci_is_equal
Members
template<
class String0,
class String1>
bool
ci_is_equal(
String0 const& s0,
String1 const& s1);
» more...
bool
ci_is_equal(
core::string_view s0,
core::string_view s1) noexcept;
» more...
boost::urls::grammar::ci_is_less
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
bool
ci_is_less(
core::string_view s0,
core::string_view s1) noexcept;
Description
The comparison algorithm implements a case-insensitive total order on the set of all strings; however, it is not a lexicographical comparison. The function is defined only for strings containing low-ASCII characters.
Example
assert( ! ci_is_less( "Boost", "boost" ) );
See Also
boost::urls::grammar::ci_hash
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
struct ci_hash;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::grammar::ci_hash::is_transparent
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
using is_transparent = void;
boost::urls::grammar::ci_hash::operator()
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
std::size_t
operator()(core::string_view s) const noexcept;
boost::urls::grammar::ci_equal
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
struct ci_equal;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::grammar::ci_equal::is_transparent
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
using is_transparent = void;
boost::urls::grammar::ci_equal::operator()
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
template<
class String0,
class String1>
bool
operator()(
String0 s0,
String1 s1) const noexcept;
boost::urls::grammar::ci_less
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
struct ci_less;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::grammar::ci_less::is_transparent
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
using is_transparent = void;
boost::urls::grammar::ci_less::operator()
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
std::size_t
operator()(
core::string_view s0,
core::string_view s1) const noexcept;
boost::urls::grammar::variant_rule_t
Synopsis
Declared in header <boost/url/grammar/variant_rule.hpp>
template<
class R0,
class... Rn>
class variant_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
Friends
Name |
Description |
boost::urls::grammar::variant_rule_t::value_type
Synopsis
Declared in header <boost/url/grammar/variant_rule.hpp>
using value_type = variant<R0::value_type, Rn::value_type...>;
boost::urls::grammar::variant_rule_t::parse
Synopsis
Declared in header <boost/url/grammar/variant_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const;
boost::urls::grammar::variant_rule
Synopsis
Declared in header <boost/url/grammar/variant_rule.hpp>
template<
class R0_,
class... Rn_>
friend
constexpr
variant_rule_t<R0_, Rn_...>
variant_rule(
R0_ const& r0,
Rn_ const&... rn) noexcept;
boost::urls::grammar::variant_rule
Members
template<
class R0_,
class... Rn_>
constexpr
variant_rule_t<R0_, Rn_...>
variant_rule(
R0_ const& r0,
Rn_ const&... rn) noexcept;
» more...
template<
class R0,
class... Rn>
constexpr
variant_rule_t<R0, Rn...>
variant_rule(
R0 const& r0,
Rn const&... rn) noexcept;
» more...
boost::urls::grammar::unsigned_rule
Synopsis
Declared in header <boost/url/grammar/unsigned_rule.hpp>
template<class Unsigned>
struct unsigned_rule;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::grammar::unsigned_rule::value_type
Synopsis
Declared in header <boost/url/grammar/unsigned_rule.hpp>
using value_type = Unsigned;
boost::urls::grammar::unsigned_rule::parse
Synopsis
Declared in header <boost/url/grammar/unsigned_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::grammar::digit_chars_t
Synopsis
Declared in header <boost/url/grammar/digit_chars.hpp>
struct digit_chars_t;
Member Functions
Name |
Description |
boost::urls::grammar::digit_chars_t::operator()
Synopsis
Declared in header <boost/url/grammar/digit_chars.hpp>
constexpr
bool
operator()(char c) const noexcept;
boost::urls::grammar::digit_chars_t::find_if
Synopsis
Declared in header <boost/url/grammar/digit_chars.hpp>
char const*
find_if(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::digit_chars_t::find_if_not
Synopsis
Declared in header <boost/url/grammar/digit_chars.hpp>
char const*
find_if_not(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::digit_chars
Synopsis
Declared in header <boost/url/grammar/digit_chars.hpp>
constexpr
digit_chars_t const digit_chars = {};
boost::urls::grammar::ch_delim_rule
Synopsis
Declared in header <boost/url/grammar/delim_rule.hpp>
struct ch_delim_rule;
Types
Name |
Description |
Member Functions
Name |
Description |
|
|
boost::urls::grammar::ch_delim_rule::value_type
Synopsis
Declared in header <boost/url/grammar/delim_rule.hpp>
using value_type = core::string_view;
boost::urls::grammar::ch_delim_rule::ch_delim_rule
Synopsis
Declared in header <boost/url/grammar/delim_rule.hpp>
constexpr
ch_delim_rule(char ch) noexcept;
boost::urls::grammar::ch_delim_rule::parse
Synopsis
Declared in header <boost/url/grammar/delim_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::grammar::delim_rule
Members
constexpr
ch_delim_rule
delim_rule(char ch) noexcept;
» more...
template<class CharSet>
constexpr
cs_delim_rule<CharSet>
delim_rule(CharSet const& cs) noexcept;
» more...
boost::urls::grammar::cs_delim_rule
Synopsis
Declared in header <boost/url/grammar/delim_rule.hpp>
template<class CharSet>
struct cs_delim_rule;
Types
Name |
Description |
Member Functions
Name |
Description |
|
|
boost::urls::grammar::cs_delim_rule::value_type
Synopsis
Declared in header <boost/url/grammar/delim_rule.hpp>
using value_type = core::string_view;
boost::urls::grammar::cs_delim_rule::cs_delim_rule
Synopsis
Declared in header <boost/url/grammar/delim_rule.hpp>
constexpr
cs_delim_rule(CharSet const& cs) noexcept;
boost::urls::grammar::cs_delim_rule::parse
Synopsis
Declared in header <boost/url/grammar/delim_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::grammar::optional_rule_t
Synopsis
Declared in header <boost/url/grammar/optional_rule.hpp>
template<class Rule>
struct optional_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
Friends
Name |
Description |
boost::urls::grammar::optional_rule_t::value_type
Synopsis
Declared in header <boost/url/grammar/optional_rule.hpp>
using value_type = boost::optional<Rule::value_type>;
boost::urls::grammar::optional_rule_t::parse
Synopsis
Declared in header <boost/url/grammar/optional_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const;
boost::urls::grammar::optional_rule
Synopsis
Declared in header <boost/url/grammar/optional_rule.hpp>
template<class R_>
friend
constexpr
optional_rule_t<R_>
optional_rule(R_ const& r);
boost::urls::grammar::optional_rule
Members
template<class R_>
constexpr
optional_rule_t<R_>
optional_rule(R_ const& r);
» more...
template<class Rule>
constexpr
optional_rule_t<Rule>
optional_rule(Rule const& r);
» more...
boost::urls::grammar::tuple_rule_t
Synopsis
Declared in header <boost/url/grammar/tuple_rule.hpp>
template<
class R0,
class... Rn>
class tuple_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
Friends
Name |
Description |
boost::urls::grammar::tuple_rule_t::value_type
Synopsis
Declared in header <boost/url/grammar/tuple_rule.hpp>
using value_type = mp11::mp_eval_if_c<IsList, T, mp_first, T>;
boost::urls::grammar::tuple_rule
Synopsis
Declared in header <boost/url/grammar/tuple_rule.hpp>
template<
class R0_,
class... Rn_>
friend
constexpr
tuple_rule_t<R0_, Rn_...>
tuple_rule(
R0_ const& r0,
Rn_ const&... rn) noexcept;
boost::urls::grammar::tuple_rule_t::parse
Synopsis
Declared in header <boost/url/grammar/tuple_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const;
boost::urls::grammar::tuple_rule
Members
template<
class R0_,
class... Rn_>
constexpr
tuple_rule_t<R0_, Rn_...>
tuple_rule(
R0_ const& r0,
Rn_ const&... rn) noexcept;
» more...
template<
class R0,
class... Rn>
constexpr
tuple_rule_t<R0, Rn...>
tuple_rule(
R0 const& r0,
Rn const&... rn) noexcept;
» more...
boost::urls::grammar::squelch
Synopsis
Declared in header <boost/url/grammar/tuple_rule.hpp>
template<class Rule>
constexpr
detail::squelch_rule_t<Rule>
squelch(Rule const& r) noexcept;
boost::urls::grammar::aligned_storage
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
template<class T>
using aligned_storage = detail::aligned_storage_impl<detail::nearest_pow2(sizeof(T), 64), (alignof(::max_align_t) > alignof(T)) ? alignof(::max_align_t) : alignof(T)>;
boost::urls::grammar::recycled
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
template<class T>
class recycled;
Member Functions
Description
Instances of this type may be used to control where recycled instances of T come from when used with recycled_ptr .
Example
static recycled< std::string > bin;
recycled_ptr< std::string > ps( bin );
// Put the string into a known state
ps->clear();
See Also
boost::urls::grammar::recycled::~recycled
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
~recycled();
Description
All recycled instances of T are destroyed. Undefined behavior results if there are any recycled_ptr which reference this recycle bin.
boost::urls::grammar::recycled::recycled
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
constexpr
recycled() = default;
boost::urls::grammar::recycled_ptr
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
template<class T>
class recycled_ptr;
Member Functions
Name |
Description |
Return the referenced object |
|
Return the referenced recycle bin |
|
Return true if this does not reference an object |
|
Return the referenced object |
|
Return true if this references an object |
|
Return the referenced object |
|
Return the referenced object |
|
Assignment |
|
|
Constructor |
Release the referenced object |
|
|
Destructor |
Description
This is a smart pointer container which can
acquire shared ownership of an instance of
T
upon or after construction. The instance
is guaranteed to be in a valid, but unknown
state. Every recycled pointer references
a valid recycle bin.
Example
static recycled< std::string > bin;
recycled_ptr< std::string > ps( bin );
// Put the string into a known state
ps->clear();
boost::urls::grammar::recycled_ptr::~recycled_ptr
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
~recycled_ptr();
Description
If this is not empty, shared ownership of the pointee is released. If this was the last reference, the object is returned to the original recycle bin.
Effects
this->release();
boost::urls::grammar::recycled_ptr::recycled_ptr
Members
Constructor
explicit
recycled_ptr(recycled<T>& bin);
» more...
Constructor
recycled_ptr(
recycled<T>& bin,
std::nullptr_t) noexcept;
» more...
Constructor
Constructor
recycled_ptr(std::nullptr_t) noexcept;
» more...
Constructor
recycled_ptr(recycled_ptr const& other) noexcept;
» more...
Constructor
recycled_ptr(recycled_ptr&& other) noexcept;
» more...
boost::urls::grammar::recycled_ptr::operator=
Members
Assignment
recycled_ptr&
operator=(recycled_ptr&& other) noexcept;
» more...
Assignment
recycled_ptr&
operator=(recycled_ptr const& other) noexcept;
» more...
boost::urls::grammar::recycled_ptr::empty
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
bool
empty() const noexcept;
Description
Exception Safety
Throws nothing.
boost::urls::grammar::recycled_ptr::operator bool
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
explicit
operator bool() const noexcept;
Description
Effects
return ! this->empty();
Exception Safety
Throws nothing.
boost::urls::grammar::recycled_ptr::bin
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
recycled<T>&
bin() const noexcept;
Description
Exception Safety
Throws nothing.
boost::urls::grammar::recycled_ptr::get
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
T*
get() const noexcept;
Description
If this is empty, nullptr
is returned.
Exception Safety
Throws nothing.
boost::urls::grammar::recycled_ptr::operator→
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
T*
operator->() const noexcept;
Description
If this is empty, nullptr
is returned.
Exception Safety
Throws nothing.
boost::urls::grammar::recycled_ptr::operator*
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
T&
operator*() const noexcept;
Description
Preconditions
not this->empty()
boost::urls::grammar::recycled_ptr::acquire
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
T&
acquire();
Description
If this references an object, it is
returned. Otherwise, exclusive ownership
of a new object of type T
is acquired
and returned.
Postconditions
not this->empty()
boost::urls::grammar::recycled_ptr::release
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
void
release() noexcept;
Description
If this references an object, it is released to the referenced recycle bin. The pointer continues to reference the same recycle bin.
Postconditions
this->empty()
Exception Safety
Throws nothing.
boost::urls::grammar::alpha_chars_t
Synopsis
Declared in header <boost/url/grammar/alpha_chars.hpp>
struct alpha_chars_t;
Member Functions
Name |
Description |
|
|
boost::urls::grammar::alpha_chars_t::alpha_chars_t
Synopsis
Declared in header <boost/url/grammar/alpha_chars.hpp>
constexpr
alpha_chars_t() noexcept = default;
boost::urls::grammar::alpha_chars_t::operator()
Synopsis
Declared in header <boost/url/grammar/alpha_chars.hpp>
constexpr
bool
operator()(char c) const noexcept;
boost::urls::grammar::alpha_chars_t::find_if
Synopsis
Declared in header <boost/url/grammar/alpha_chars.hpp>
char const*
find_if(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::alpha_chars_t::find_if_not
Synopsis
Declared in header <boost/url/grammar/alpha_chars.hpp>
char const*
find_if_not(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::alpha_chars
Synopsis
Declared in header <boost/url/grammar/alpha_chars.hpp>
constexpr
alpha_chars_t const alpha_chars = {};
See Also
boost::urls::grammar::token_rule_t
Synopsis
Declared in header <boost/url/grammar/token_rule.hpp>
template<class CharSet>
struct token_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::grammar::token_rule_t::value_type
Synopsis
Declared in header <boost/url/grammar/token_rule.hpp>
using value_type = core::string_view;
boost::urls::grammar::token_rule_t::parse
Synopsis
Declared in header <boost/url/grammar/token_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::grammar::token_rule
Synopsis
Declared in header <boost/url/grammar/token_rule.hpp>
template<class CharSet>
constexpr
token_rule_t<CharSet>
token_rule(CharSet const& cs) noexcept;
boost::urls::grammar::range
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
template<class T>
class range;
Types
Name |
Description |
A constant, forward iterator to elements of the range |
|
The type of each element of the range |
|
The type used to represent signed integers |
|
A constant, forward iterator to elements of the range |
|
Provided for compatibility, unused |
|
The type of each element of the range |
|
The type used to represent unsigned integers |
|
The type of each element of the range |
Member Functions
Description
Objects of this type are forward ranges returned when parsing using the range_rule . Iteration is performed by re-parsing the underlying character buffer. Ownership of the buffer is not transferred; the caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced by the range.
Note
|
The implementation may use temporary,
recycled storage for type-erasure. Objects
of type range are intended to be used
ephemerally. That is, for short durations
such as within a function scope. If it is
necessary to store the range for a long
period of time or with static storage
duration, it is necessary to copy the
contents to an object of a different type.
|
See Also
parse , range_rule .
boost::urls::grammar::range::value_type
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
using value_type = T;
boost::urls::grammar::range::reference
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
using reference = T const&;
boost::urls::grammar::range::const_reference
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
using const_reference = T const&;
boost::urls::grammar::range::pointer
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
using pointer = void const*;
boost::urls::grammar::range::size_type
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
using size_type = std::size_t;
boost::urls::grammar::range::difference_type
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
using difference_type = std::ptrdiff_t;
boost::urls::grammar::range::iterator
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
class iterator;
Types
Name |
Description |
Member Functions
Name |
Description |
|
|
boost::urls::grammar::range::iterator::value_type
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
using value_type = T;
boost::urls::grammar::range::iterator::reference
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
using reference = T const&;
boost::urls::grammar::range::iterator::pointer
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
using pointer = void const*;
boost::urls::grammar::range::iterator::difference_type
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
using difference_type = std::ptrdiff_t;
boost::urls::grammar::range::iterator::iterator_category
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
using iterator_category = std::forward_iterator_tag;
boost::urls::grammar::range::iterator::iterator
Members
iterator() = default;
» more...
iterator(iterator const&) = default;
» more...
boost::urls::grammar::range::iterator::operator=
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
boost::urls::grammar::range::iterator::operator*
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
reference
operator*() const noexcept;
boost::urls::grammar::range::iterator::operator==
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
bool
operator==(iterator const& other) const noexcept;
boost::urls::grammar::range::iterator::operator!=
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
bool
operator!=(iterator const& other) const noexcept;
boost::urls::grammar::range::iterator::operator++
Members
iterator&
operator++() noexcept;
» more...
iterator
operator++(int) noexcept;
» more...
boost::urls::grammar::range::const_iterator
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
using const_iterator = iterator;
boost::urls::grammar::range::~range
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
~range();
boost::urls::grammar::range::range
Members
Constructor
range() noexcept;
» more...
Constructor
range(range&& other) noexcept;
» more...
Constructor
range(range const& other) noexcept;
» more...
boost::urls::grammar::range::operator=
Members
Assignment
range&
operator=(range&& other) noexcept;
» more...
Assignment
range&
operator=(range const& other) noexcept;
» more...
boost::urls::grammar::range::begin
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
iterator
begin() const noexcept;
boost::urls::grammar::range::end
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
iterator
end() const noexcept;
boost::urls::grammar::range::empty
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
bool
empty() const noexcept;
boost::urls::grammar::range::size
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
std::size_t
size() const noexcept;
boost::urls::grammar::range::string
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
core::string_view
string() const noexcept;
boost::urls::grammar::range_rule_t
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
template<
class R0,
class R1 = void>
struct range_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::grammar::range_rule_t::value_type
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
using value_type = range<R0::value_type>;
boost::urls::grammar::range_rule_t::parse
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const;
boost::urls::grammar::range_rule_t
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
template<class R>
struct range_rule_t<R>;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::grammar::range_rule_t<R>::value_type
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
using value_type = range<R::value_type>;
boost::urls::grammar::range_rule_t<R>::parse
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const;
boost::urls::grammar::range_rule
Members
template<class Rule>
constexpr
range_rule_t<Rule>
range_rule(
Rule const& next,
std::size_t N = 0,
std::size_t M = std::size_t(-1)) noexcept;
» more...
template<
class Rule1,
class Rule2>
constexpr
range_rule_t<Rule1, Rule2>
range_rule(
Rule1 const& first,
Rule2 const& next,
std::size_t N = 0,
std::size_t M = std::size_t(-1)) noexcept;
» more...
boost::urls::grammar::alnum_chars_t
Synopsis
Declared in header <boost/url/grammar/alnum_chars.hpp>
struct alnum_chars_t;
Member Functions
Name |
Description |
boost::urls::grammar::alnum_chars_t::operator()
Synopsis
Declared in header <boost/url/grammar/alnum_chars.hpp>
constexpr
bool
operator()(char c) const noexcept;
boost::urls::grammar::alnum_chars_t::find_if
Synopsis
Declared in header <boost/url/grammar/alnum_chars.hpp>
char const*
find_if(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::alnum_chars_t::find_if_not
Synopsis
Declared in header <boost/url/grammar/alnum_chars.hpp>
char const*
find_if_not(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::alnum_chars
Synopsis
Declared in header <boost/url/grammar/alnum_chars.hpp>
constexpr
alnum_chars_t const alnum_chars = {};
boost::urls::grammar::vchars_t
Synopsis
Declared in header <boost/url/grammar/vchars.hpp>
struct vchars_t;
Member Functions
Name |
Description |
boost::urls::grammar::vchars_t::operator()
Synopsis
Declared in header <boost/url/grammar/vchars.hpp>
constexpr
bool
operator()(char c) const noexcept;
boost::urls::grammar::vchars_t::find_if
Synopsis
Declared in header <boost/url/grammar/vchars.hpp>
char const*
find_if(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::vchars_t::find_if_not
Synopsis
Declared in header <boost/url/grammar/vchars.hpp>
char const*
find_if_not(
char const* first,
char const* last) const noexcept;
boost::urls::grammar::vchars
Synopsis
Declared in header <boost/url/grammar/vchars.hpp>
constexpr
vchars_t const vchars = {};
boost::urls::grammar::dec_octet_rule_t
Synopsis
Declared in header <boost/url/grammar/dec_octet_rule.hpp>
struct dec_octet_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::grammar::dec_octet_rule_t::value_type
Synopsis
Declared in header <boost/url/grammar/dec_octet_rule.hpp>
using value_type = unsigned char;
boost::urls::grammar::dec_octet_rule_t::parse
Synopsis
Declared in header <boost/url/grammar/dec_octet_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::grammar::dec_octet_rule
Synopsis
Declared in header <boost/url/grammar/dec_octet_rule.hpp>
constexpr
dec_octet_rule_t const dec_octet_rule = {};
boost::urls::grammar::literal_rule
Synopsis
Declared in header <boost/url/grammar/literal_rule.hpp>
class literal_rule;
Types
Name |
Description |
Member Functions
Name |
Description |
|
|
boost::urls::grammar::literal_rule::value_type
Synopsis
Declared in header <boost/url/grammar/literal_rule.hpp>
using value_type = core::string_view;
boost::urls::grammar::literal_rule::literal_rule
Synopsis
Declared in header <boost/url/grammar/literal_rule.hpp>
constexpr
explicit
literal_rule(char const* s) noexcept;
boost::urls::grammar::literal_rule::parse
Synopsis
Declared in header <boost/url/grammar/literal_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::grammar::not_empty_rule_t
Synopsis
Declared in header <boost/url/grammar/not_empty_rule.hpp>
template<class R>
struct not_empty_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
Friends
Name |
Description |
boost::urls::grammar::not_empty_rule_t::value_type
Synopsis
Declared in header <boost/url/grammar/not_empty_rule.hpp>
using value_type = R::value_type;
boost::urls::grammar::not_empty_rule_t::parse
Synopsis
Declared in header <boost/url/grammar/not_empty_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const;
boost::urls::grammar::not_empty_rule
Synopsis
Declared in header <boost/url/grammar/not_empty_rule.hpp>
template<class R_>
friend
constexpr
not_empty_rule_t<R_>
not_empty_rule(R_ const& r);
boost::urls::grammar::not_empty_rule
Members
template<class R_>
constexpr
not_empty_rule_t<R_>
not_empty_rule(R_ const& r);
» more...
template<class Rule>
constexpr
not_empty_rule_t<Rule>
not_empty_rule(Rule const& r);
» more...
boost::urls::decode_view
Synopsis
Declared in header <boost/url/decode_view.hpp>
class decode_view;
Types
Name |
Description |
The reference type |
|
The signed integer type |
|
The reference type |
|
The unsigned integer type |
|
The value type |
Member Functions
Name |
Description |
Return the last character |
|
Return an iterator to the beginning |
|
Return the result of comparing to another string |
|
|
Constructor |
Return true if the string is empty |
|
Return an iterator to the end |
|
Checks if the string ends with the given prefix |
|
Finds the first occurrence of character in this view |
|
Return the first character |
|
Return the decoding options |
|
Remove the first characters |
|
Remove the last characters |
|
Finds the first occurrence of character in this view |
|
Return the number of decoded characters |
|
Checks if the string begins with the given prefix |
Friends
Name |
Description |
Description
These views reference strings in parts of URLs or other components that are percent-encoded. The special characters (those not in the allowed character set) are stored as three character escapes that consist of a percent sign ('%%') followed by a two-digit hexadecimal number of the corresponding unescaped character code, which may be part of a UTF-8 code point depending on the context.
The view refers to the original character buffer and only decodes escaped sequences when needed. In particular these operations perform percent-decoding automatically without the need to allocate memory:
-
Iteration of the string
-
Accessing the encoded character buffer
-
Comparison to encoded or plain strings
These objects can only be constructed from strings that have a valid percent-encoding, otherwise construction fails. The caller is responsible for ensuring that the lifetime of the character buffer from which the view is constructed extends unmodified until the view is no longer accessed.
Operators
The following operators are supported between
decode_view
and any object that is convertible
to core::string_view
bool operator==( decode_view, decode_view ) noexcept;
bool operator!=( decode_view, decode_view ) noexcept;
bool operator<=( decode_view, decode_view ) noexcept;
bool operator< ( decode_view, decode_view ) noexcept;
bool operator> ( decode_view, decode_view ) noexcept;
bool operator>=( decode_view, decode_view ) noexcept;
boost::urls::decode_view::value_type
Synopsis
Declared in header <boost/url/decode_view.hpp>
using value_type = char;
boost::urls::decode_view::reference
Synopsis
Declared in header <boost/url/decode_view.hpp>
using reference = char;
boost::urls::decode_view::const_reference
Synopsis
Declared in header <boost/url/decode_view.hpp>
using const_reference = char;
boost::urls::decode_view::size_type
Synopsis
Declared in header <boost/url/decode_view.hpp>
using size_type = std::size_t;
boost::urls::decode_view::difference_type
Synopsis
Declared in header <boost/url/decode_view.hpp>
using difference_type = std::ptrdiff_t;
boost::urls::decode_view::iterator
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
class iterator;
Types
Name |
Description |
Member Functions
Name |
Description |
|
|
boost::urls::decode_view::iterator::value_type
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
using value_type = char;
boost::urls::decode_view::iterator::reference
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
using reference = char;
boost::urls::decode_view::iterator::pointer
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
using pointer = void const*;
boost::urls::decode_view::iterator::const_reference
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
using const_reference = char;
boost::urls::decode_view::iterator::size_type
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
using size_type = std::size_t;
boost::urls::decode_view::iterator::difference_type
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
using difference_type = std::ptrdiff_t;
boost::urls::decode_view::iterator::iterator_category
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
using iterator_category = std::bidirectional_iterator_tag;
boost::urls::decode_view::iterator::iterator
Members
constexpr
iterator() = default;
» more...
constexpr
iterator(iterator const&) = default;
» more...
boost::urls::decode_view::iterator::operator=
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
boost::urls::decode_view::iterator::operator*
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
reference
operator*() const noexcept;
boost::urls::decode_view::iterator::operator++
Members
iterator&
operator++() noexcept;
» more...
iterator
operator++(int) noexcept;
» more...
boost::urls::decode_view::iterator::operator--
Members
iterator&
operator--() noexcept;
» more...
iterator
operator--(int) noexcept;
» more...
boost::urls::decode_view::iterator::base
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
char const*
base();
boost::urls::decode_view::iterator::operator==
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
bool
operator==(iterator const& other) const noexcept;
boost::urls::decode_view::iterator::operator!=
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
bool
operator!=(iterator const& other) const noexcept;
boost::urls::decode_view::const_iterator
Synopsis
Declared in header <boost/url/decode_view.hpp>
using const_iterator = iterator;
boost::urls::decode_view::decode_view
Members
Constructor
constexpr
decode_view() noexcept = default;
» more...
Constructor
explicit
decode_view(
pct_string_view s,
encoding_opts opt = = {}) noexcept;
» more...
boost::urls::decode_view::empty
Synopsis
Declared in header <boost/url/decode_view.hpp>
bool
empty() const noexcept;
Description
Example
assert( decode_view( "" ).empty() );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::decode_view::size
Synopsis
Declared in header <boost/url/decode_view.hpp>
size_type
size() const noexcept;
Description
Example
assert( decode_view( "Program%20Files" ).size() == 13 );
Effects
return std::distance( this->begin(), this->end() );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::decode_view::begin
Synopsis
Declared in header <boost/url/decode_view.hpp>
iterator
begin() const noexcept;
Description
Example
auto it = this->begin();
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::decode_view::end
Synopsis
Declared in header <boost/url/decode_view.hpp>
iterator
end() const noexcept;
Description
Example
auto it = this->end();
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::decode_view::front
Synopsis
Declared in header <boost/url/decode_view.hpp>
reference
front() const noexcept;
Description
Example
assert( decode_view( "Program%20Files" ).front() == 'P' );
Preconditions
not this->empty()
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::decode_view::back
Synopsis
Declared in header <boost/url/decode_view.hpp>
reference
back() const noexcept;
Description
Example
assert( decode_view( "Program%20Files" ).back() == 's' );
Preconditions
not this->empty()
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::decode_view::starts_with
Members
Checks if the string begins with the given prefix
bool
starts_with(core::string_view s) const noexcept;
» more...
Checks if the string begins with the given prefix
bool
starts_with(char ch) const noexcept;
» more...
boost::urls::decode_view::ends_with
Members
Checks if the string ends with the given prefix
bool
ends_with(core::string_view s) const noexcept;
» more...
Checks if the string ends with the given prefix
bool
ends_with(char ch) const noexcept;
» more...
boost::urls::decode_view::find
Synopsis
Declared in header <boost/url/decode_view.hpp>
const_iterator
find(char ch) const noexcept;
Description
Complexity
Linear.
Exception Safety
Throws nothing.
boost::urls::decode_view::rfind
Synopsis
Declared in header <boost/url/decode_view.hpp>
const_iterator
rfind(char ch) const noexcept;
Description
Complexity
Linear.
Exception Safety
Throws nothing.
boost::urls::decode_view::remove_prefix
Synopsis
Declared in header <boost/url/decode_view.hpp>
void
remove_prefix(size_type n);
Description
Example
decode_view d( "Program%20Files" );
d.remove_prefix( 8 );
assert( d == "Files" );
Preconditions
not this->empty()
Complexity
Linear.
boost::urls::decode_view::remove_suffix
Synopsis
Declared in header <boost/url/decode_view.hpp>
void
remove_suffix(size_type n);
Description
Example
decode_view d( "Program%20Files" );
d.remove_prefix( 6 );
assert( d == "Program" );
Preconditions
not this->empty()
Complexity
Linear.
boost::urls::decode_view::options
Synopsis
Declared in header <boost/url/decode_view.hpp>
encoding_opts
options() const noexcept;
boost::urls::decode_view::compare
Members
Return the result of comparing to another string
int
compare(core::string_view other) const noexcept;
» more...
Return the result of comparing to another string
int
compare(decode_view other) const noexcept;
» more...
boost::urls::operator==
Synopsis
Declared in header <boost/url/decode_view.hpp>
template<
class S0,
class S1>
friend
constexpr
bool
operator==(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::operator!=
Synopsis
Declared in header <boost/url/decode_view.hpp>
template<
class S0,
class S1>
friend
constexpr
bool
operator!=(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::operator<
Synopsis
Declared in header <boost/url/decode_view.hpp>
template<
class S0,
class S1>
friend
constexpr
bool
operator<(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::operator⇐
Synopsis
Declared in header <boost/url/decode_view.hpp>
template<
class S0,
class S1>
friend
constexpr
bool
operator<=(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::operator>
Synopsis
Declared in header <boost/url/decode_view.hpp>
template<
class S0,
class S1>
friend
constexpr
bool
operator>(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::operator>=
Synopsis
Declared in header <boost/url/decode_view.hpp>
template<
class S0,
class S1>
friend
constexpr
bool
operator>=(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::operator<<
Synopsis
Declared in header <boost/url/decode_view.hpp>
friend
std::ostream&
operator<<(
std::ostream& os,
decode_view const& s);
boost::urls::pct_string_view
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
class pct_string_view
: public grammar::string_view_base;
Types
Name |
Description |
The const iterator type |
|
The const pointer type |
|
The const reference type |
|
The const reverse iterator type |
|
The difference type |
|
The iterator type |
|
The pointer type |
|
The reference type |
|
The reverse iterator type |
|
The size type |
|
The character traits |
|
The value type |
Member Functions
Name |
Description |
Access a character |
|
Return the last character |
|
Return an iterator to the beginning |
|
Return an iterator to the beginning |
|
Return an iterator to the end |
|
Return the result of comparing to another string |
|
Return true if matching characters are found |
|
Copy the characters to another buffer |
|
Return a pointer to the character buffer |
|
Return the string with percent-decoding |
|
Return the decoded size |
|
Return true if the string is empty |
|
Return an iterator to the end |
|
Return true if a matching suffix exists |
|
Return the position of matching characters |
|
Return the position of the first non-match |
|
Return the position of the first match |
|
Return the position of the last non-match |
|
Return the position of the last match |
|
Return the first character |
|
Return the size |
|
Return the maximum allowed size |
|
Conversion |
|
Conversion |
|
Return the string as a range of decoded characters |
|
Assignment |
|
Access a character |
|
|
Constructor Constructor (deleted) |
Return the position of matching characters |
|
Return the size |
|
Return true if a matching prefix exists |
|
Return a view to part of the string |
|
Swap |
Static Data Members
Name |
Description |
A constant used to represent "no position" |
Friends
Name |
Description |
Return the hash of this value |
|
Description
Objects of this type behave like a
core::string_view
and have the same interface,
but offer an additional invariant: they can
only be constructed from strings containing
valid percent-escapes.
Attempting construction from a string containing invalid or malformed percent escapes results in an exception.
Operators
The following operators are supported between
pct_string_view
and any object that is
convertible to core::string_view
bool operator==( pct_string_view, pct_string_view ) noexcept;
bool operator!=( pct_string_view, pct_string_view ) noexcept;
bool operator<=( pct_string_view, pct_string_view ) noexcept;
bool operator< ( pct_string_view, pct_string_view ) noexcept;
bool operator> ( pct_string_view, pct_string_view ) noexcept;
bool operator>=( pct_string_view, pct_string_view ) noexcept;
boost::urls::pct_string_view::pct_string_view
Members
Constructor
constexpr
pct_string_view() = default;
» more...
Constructor
constexpr
pct_string_view(pct_string_view const& other) = default;
» more...
template<
class String,
class = void>
pct_string_view(String const& s);
» more...
Constructor (deleted)
pct_string_view(std::nullptr_t) = delete;
» more...
Constructor
pct_string_view(
char const* s,
std::size_t len);
» more...
Constructor
pct_string_view(core::string_view s);
» more...
boost::urls::pct_string_view::operator=
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
constexpr
pct_string_view&
operator=(pct_string_view const& other) = default;
Description
The copy references the same underlying character buffer. Ownership is not transferred.
Postconditions
this->data() == other.data()
Complexity
Constant.
Exception Safety
Throws nothing.
other The string to copy.
boost::urls::make_pct_string_view
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
friend
system::result<pct_string_view>
make_pct_string_view(core::string_view s) noexcept;
boost::urls::pct_string_view::decoded_size
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
std::size_t
decoded_size() const noexcept;
Description
This function returns the number of characters in the resulting string if percent escapes were converted into ordinary characters.
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::pct_string_view::operator*
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
decode_view
operator*() const noexcept;
Description
Complexity
Constant.
Exception Safety
Throws nothing.
See Also
boost::urls::pct_string_view::decode
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
decode(
encoding_opts opt = = {},
StringToken&& token) const;
Description
This function converts percent escapes
in the string into ordinary characters
and returns the result.
When called with no arguments, the
return type is std::string
.
Otherwise, the return type and style
of output is determined by which string
token is passed.
Example
assert( pct_string_view( "Program%20Files" ).decode() == "Program Files" );
Complexity
Linear in this->size()
.
Exception Safety
Calls to allocate may throw. String tokens may throw exceptions.
Parameters
Name | Description |
---|---|
opt |
The options for encoding. If this parameter is omitted, the default options are used. |
token |
An optional string token.
If this parameter is omitted, then
a new |
See Also
boost::urls::pct_string_view::operator→
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
pct_string_view const*
operator->() const noexcept;
boost::urls::pct_string_view::swap
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
void
swap(pct_string_view& s) noexcept;
boost::urls::make_pct_string_view_unsafe
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
pct_string_view
make_pct_string_view_unsafe(
char const* data,
std::size_t size,
std::size_t decoded_size) noexcept;
boost::urls::make_pct_string_view
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
system::result<pct_string_view>
make_pct_string_view(core::string_view s) noexcept;
Description
If s
is a valid percent-encoded string,
the function returns the buffer as a valid
view which may be used to perform decoding
or measurements.
Otherwise the result contains an error code.
Upon success, the returned view references
the original character buffer;
Ownership is not transferred.
Complexity
Linear in s.size()
.
Exception Safety
Throws nothing.
Parameters
Name | Description |
---|---|
s |
The string to validate. |
boost::urls::param_pct_view
Synopsis
Declared in header <boost/url/param.hpp>
struct param_pct_view;
Member Functions
Name |
Description |
Conversion |
|
|
Construction Constructor |
Description
Objects of this type represent a single key and value pair in a query string where a key is always present and may be empty, while the presence of a value is indicated by has_value equal to true. An empty value is distinct from no value.
The strings may have percent escapes, and offer an additional invariant: they never contain an invalid percent-encoding.
For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.
Keys and values in this object reference external character buffers. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced.
BNF
query-params = query-param *( "&" query-param )
query-param = key [ "=" value ]
key = *qpchar
value = *( qpchar / "=" )
Specification
See Also
param , param_view .
boost::urls::param_pct_view::key
Synopsis
Declared in header <boost/url/param.hpp>
pct_string_view key;
Description
For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.
boost::urls::param_pct_view::value
Synopsis
Declared in header <boost/url/param.hpp>
pct_string_view value;
Description
The presence of a value is indicated by has_value equal to true. An empty value is distinct from no value.
boost::urls::param_pct_view::has_value
Synopsis
Declared in header <boost/url/param.hpp>
bool has_value = false;
Description
The presence of a value is indicated by
has_value == true
.
An empty value is distinct from no value.
boost::urls::param_pct_view::param_pct_view
Members
Constructor
constexpr
param_pct_view() = default;
» more...
Constructor
param_pct_view(
pct_string_view key,
pct_string_view value) noexcept;
» more...
Constructor
template<class OptionalString>
param_pct_view(
pct_string_view key,
OptionalString const& value);
» more...
Construction
explicit
param_pct_view(param_view const& p);
» more...
param_pct_view(
pct_string_view key,
pct_string_view value,
bool has_value) noexcept;
» more...
boost::urls::param_pct_view::operator param
Synopsis
Declared in header <boost/url/param.hpp>
explicit
operator param() const;
Description
This function performs a conversion from a reference-like query parameter to one retaining ownership of the strings by making a copy.
Complexity
Linear in this->key.size() + this->value.size()
.
Exception Safety
Calls to allocate may throw.
boost::urls::param_pct_view::operator param_view
Synopsis
Declared in header <boost/url/param.hpp>
operator param_view() const noexcept;
boost::urls::param_pct_view::operator→
Synopsis
Declared in header <boost/url/param.hpp>
param_pct_view const*
operator->() const noexcept;
boost::urls::param_view
Synopsis
Declared in header <boost/url/param.hpp>
struct param_view;
Member Functions
Name |
Description |
Conversion |
|
|
Constructor |
Description
Objects of this type represent a single key and value pair in a query string where a key is always present and may be empty, while the presence of a value is indicated by has_value equal to true. An empty value is distinct from no value.
Depending on where the object was obtained, the strings may or may not contain percent escapes.
For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.
Keys and values in this object reference external character buffers. Ownership of the buffers is not transferred; the caller is responsible for ensuring that the assigned buffers remain valid until they are no longer referenced.
BNF
query-params = query-param *( "&" query-param )
query-param = key [ "=" value ]
key = *qpchar
value = *( qpchar / "=" )
Specification
See Also
param , param_pct_view .
boost::urls::param_view::key
Synopsis
Declared in header <boost/url/param.hpp>
core::string_view key;
Description
For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.
boost::urls::param_view::value
Synopsis
Declared in header <boost/url/param.hpp>
core::string_view value;
Description
The presence of a value is indicated by has_value equal to true. An empty value is distinct from no value.
boost::urls::param_view::has_value
Synopsis
Declared in header <boost/url/param.hpp>
bool has_value = false;
Description
The presence of a value is indicated by
has_value == true
.
An empty value is distinct from no value.
boost::urls::param_view::param_view
Members
Constructor
constexpr
param_view() = default;
» more...
Constructor
template<class OptionalString>
param_view(
core::string_view key,
OptionalString const& value) noexcept;
» more...
Constructor
param_view(param const& other) noexcept;
» more...
param_view(
core::string_view key_,
core::string_view value_,
bool has_value_) noexcept;
» more...
boost::urls::param_view::operator param
Synopsis
Declared in header <boost/url/param.hpp>
explicit
operator param();
Description
This function performs a conversion from a reference-like query parameter to one retaining ownership of the strings by making a copy. No validation is performed on the strings.
Complexity
Linear in this->key.size() + this->value.size()
.
Exception Safety
Calls to allocate may throw.
boost::urls::param_view::operator→
Synopsis
Declared in header <boost/url/param.hpp>
param_view const*
operator->() const noexcept;
boost::urls::no_value
Synopsis
Declared in header <boost/url/param.hpp>
constexpr
no_value_t const no_value = {};
boost::urls::param
Synopsis
Declared in header <boost/url/param.hpp>
struct param;
Description
Objects of this type represent a single key and value pair in a query string where a key is always present and may be empty, while the presence of a value is indicated by has_value equal to true. An empty value is distinct from no value.
Depending on where the object was obtained, the strings may or may not contain percent escapes.
For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.
BNF
query-params = query-param *( "&" query-param )
query-param = key [ "=" value ]
key = *qpchar
value = *( qpchar / "=" )
Specification
See Also
boost::urls::param::key
Synopsis
Declared in header <boost/url/param.hpp>
std::string key;
Description
For most usages, key comparisons are case-sensitive and duplicate keys in a query are possible. However, it is the authority that has final control over how the query is interpreted.
boost::urls::param::value
Synopsis
Declared in header <boost/url/param.hpp>
std::string value;
Description
The presence of a value is indicated by has_value equal to true. An empty value is distinct from no value.
boost::urls::param::has_value
Synopsis
Declared in header <boost/url/param.hpp>
bool has_value = false;
Description
The presence of a value is indicated by
has_value == true
.
An empty value is distinct from no value.
boost::urls::param::param
Members
Constructor
param() = default;
» more...
Constructor
param(param&& other) noexcept;
» more...
Constructor
param(param const& other) = default;
» more...
Constructor
template<class OptionalString>
param(
core::string_view key,
OptionalString const& value);
» more...
param(
core::string_view key,
core::string_view value,
bool has_value) noexcept;
» more...
boost::urls::param::operator=
Members
Assignment
param&
operator=(param&& other) noexcept;
» more...
Assignment
param&
operator=(param const&) = default;
» more...
Assignment
param&
operator=(param_view const& other);
» more...
Assignment
param&
operator=(param_pct_view const& other);
» more...
boost::urls::param::operator→
Synopsis
Declared in header <boost/url/param.hpp>
param const*
operator->() const noexcept;
boost::urls::encoded_size
Synopsis
Declared in header <boost/url/encode.hpp>
template<class CharSet>
std::size_t
encoded_size(
core::string_view s,
CharSet const& unreserved,
encoding_opts opt = = {}) noexcept;
Description
This function returns the exact number of bytes necessary to store the result of applying percent-encoding to the string using the given options and character set. No encoding is actually performed.
Example
assert( encoded_size( "My Stuff", pchars ) == 10 );
Exception Safety
Throws nothing.
Specification
Return Value
The number of bytes needed, excluding any null terminator.
Parameters
Name | Description |
---|---|
s |
The string to measure. |
unreserved |
The set of characters that is not percent-encoded. |
opt |
The options for encoding. If this parameter is omitted, the default options are be used. |
See Also
boost::urls::encode
Members
Apply percent-encoding to a string
template<class CharSet>
std::size_t
encode(
char* dest,
std::size_t size,
core::string_view s,
CharSet const& unreserved,
encoding_opts opt = = {});
» more...
Return a percent-encoded string
template<
class StringToken = string_token::return_string,
class CharSet>
StringToken::result_type
encode(
core::string_view s,
CharSet const& unreserved,
encoding_opts opt = = {},
StringToken&& token) noexcept;
» more...
boost::urls::encode_unsafe
Synopsis
Declared in header <boost/url/encode.hpp>
template<class CharSet>
std::size_t
encode_unsafe(
char* dest,
std::size_t size,
core::string_view s,
CharSet const& unreserved,
encoding_opts opt);
boost::urls::sub_delim_chars
Synopsis
Declared in header <boost/url/rfc/sub_delim_chars.hpp>
Description
Example
Character sets are used with rules and the functions grammar::find_if and grammar::find_if_not .
system::result< decode_view > = grammar::parse( "Program%20Files", pct_encoded_rule( sub_delim_chars ) );
BNF
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
Specification
See Also
boost::urls::unreserved_chars
Synopsis
Declared in header <boost/url/rfc/unreserved_chars.hpp>
Description
Example
Character sets are used with rules and the functions grammar::find_if and grammar::find_if_not .
system::result< decode_view > rv = grammar::parse( "Program%20Files", pct_encoded_rule( unreserved_chars ) );
BNF
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
Specification
See Also
boost::urls::pchars
Synopsis
Declared in header <boost/url/rfc/pchars.hpp>
constexpr
lut_chars const pchars = unreserved_chars + sub_delim_chars + ':' + '@';
Description
Example
Character sets are used with rules and the functions grammar::find_if and grammar::find_if_not .
system::result< decode_view > rv = grammar::parse( "Program%20Files", pchars );
BNF
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
Specification
See Also
boost::urls::operator==
Members
template<
class S0,
class S1>
constexpr
bool
operator==(
S0 const& s0,
S1 const& s1) noexcept;
» more...
Return true if two addresses are equal
bool
operator==(
ipv4_address const& a1,
ipv4_address const& a2) noexcept;
» more...
Return true if two addresses are equal
bool
operator==(
ipv6_address const& a1,
ipv6_address const& a2) noexcept;
» more...
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.
bool
operator==(
authority_view const& a0,
authority_view const& a1) noexcept;
» more...
bool
operator==(
iterator const& it0,
iterator const& it1) noexcept;
» more...
Return the result of comparing two URLs
bool
operator==(
url_view_base const& u0,
url_view_base const& u1) noexcept;
» more...
boost::urls::operator!=
Members
template<
class S0,
class S1>
constexpr
bool
operator!=(
S0 const& s0,
S1 const& s1) noexcept;
» more...
Return true if two addresses are not equal
bool
operator!=(
ipv4_address const& a1,
ipv4_address const& a2) noexcept;
» more...
Return true if two addresses are not equal
bool
operator!=(
ipv6_address const& a1,
ipv6_address const& a2) noexcept;
» more...
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.
bool
operator!=(
authority_view const& a0,
authority_view const& a1) noexcept;
» more...
bool
operator!=(
iterator const& it0,
iterator const& it1) noexcept;
» more...
Return the result of comparing two URLs
bool
operator!=(
url_view_base const& u0,
url_view_base const& u1) noexcept;
» more...
boost::urls::operator<
Members
template<
class S0,
class S1>
constexpr
bool
operator<(
S0 const& s0,
S1 const& s1) noexcept;
» more...
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.
bool
operator<(
authority_view const& a0,
authority_view const& a1) noexcept;
» more...
Return the result of comparing two URLs
bool
operator<(
url_view_base const& u0,
url_view_base const& u1) noexcept;
» more...
boost::urls::operator⇐
Members
template<
class S0,
class S1>
constexpr
bool
operator<=(
S0 const& s0,
S1 const& s1) noexcept;
» more...
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.
bool
operator<=(
authority_view const& a0,
authority_view const& a1) noexcept;
» more...
Return the result of comparing two URLs
bool
operator<=(
url_view_base const& u0,
url_view_base const& u1) noexcept;
» more...
boost::urls::operator>
Members
template<
class S0,
class S1>
constexpr
bool
operator>(
S0 const& s0,
S1 const& s1) noexcept;
» more...
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.
bool
operator>(
authority_view const& a0,
authority_view const& a1) noexcept;
» more...
Return the result of comparing two URLs
bool
operator>(
url_view_base const& u0,
url_view_base const& u1) noexcept;
» more...
boost::urls::operator>=
Members
template<
class S0,
class S1>
constexpr
bool
operator>=(
S0 const& s0,
S1 const& s1) noexcept;
» more...
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.
bool
operator>=(
authority_view const& a0,
authority_view const& a1) noexcept;
» more...
Return the result of comparing two URLs
bool
operator>=(
url_view_base const& u0,
url_view_base const& u1) noexcept;
» more...
boost::urls::operator<<
Members
Format the string with percent-decoding applied to the output stream
std::ostream&
operator<<(
std::ostream& os,
decode_view const& s);
» more...
Format the address to an output stream.
std::ostream&
operator<<(
std::ostream& os,
ipv4_address const& addr);
» more...
Format the address to an output stream
std::ostream&
operator<<(
std::ostream& os,
ipv6_address const& addr);
» more...
Format the encoded authority to the output stream
std::ostream&
operator<<(
std::ostream& os,
authority_view const& a);
» more...
Format to an output stream
std::ostream&
operator<<(
std::ostream& os,
segments_encoded_base const& ps);
» more...
Format to an output stream
std::ostream&
operator<<(
std::ostream& os,
segments_base const& ps);
» more...
Format to an output stream
std::ostream&
operator<<(
std::ostream& os,
params_encoded_base const& qp);
» more...
Format to an output stream
std::ostream&
operator<<(
std::ostream& os,
params_base const& qp);
» more...
Format the url to the output stream
std::ostream&
operator<<(
std::ostream& os,
url_view_base const& u);
» more...
boost::urls::host_type
Synopsis
Declared in header <boost/url/host_type.hpp>
enum host_type : int;
Members
Name |
Description |
No host is specified. |
|
A host is specified by reg-name. |
|
A host is specified by ipv4_address . |
|
A host is specified by ipv6_address . |
|
A host is specified by IPvFuture. |
Description
Values of this type are returned by URL views and containers to indicate the type of host present in a URL.
boost::urls::host_type::none
Synopsis
Declared in header <boost/url/host_type.hpp>
none
boost::urls::host_type::name
Synopsis
Declared in header <boost/url/host_type.hpp>
name
boost::urls::host_type::ipv4
Synopsis
Declared in header <boost/url/host_type.hpp>
ipv4
boost::urls::host_type::ipv6
Synopsis
Declared in header <boost/url/host_type.hpp>
ipv6
boost::urls::host_type::ipvfuture
Synopsis
Declared in header <boost/url/host_type.hpp>
ipvfuture
boost::urls::error
Synopsis
Declared in header <boost/url/error.hpp>
enum error : int;
Members
Name |
Description |
The operation completed successfully. |
|
Null encountered in pct-encoded. |
|
Illegal reserved character in encoded string. |
|
A grammar element was not in canonical form. |
|
Bad hexadecimal digit. |
|
The percent-encoded sequence is incomplete. |
|
Missing hexadecimal digit. |
|
No space in output buffer |
|
The URL is not a base URL |
boost::urls::error::success
Synopsis
Declared in header <boost/url/error.hpp>
success = 0
boost::urls::error::illegal_null
Synopsis
Declared in header <boost/url/error.hpp>
illegal_null
boost::urls::error::illegal_reserved_char
Synopsis
Declared in header <boost/url/error.hpp>
illegal_reserved_char
boost::urls::error::non_canonical
Synopsis
Declared in header <boost/url/error.hpp>
non_canonical
boost::urls::error::bad_pct_hexdig
Synopsis
Declared in header <boost/url/error.hpp>
bad_pct_hexdig
Description
This error condition is fatal.
boost::urls::error::incomplete_encoding
Synopsis
Declared in header <boost/url/error.hpp>
incomplete_encoding
Description
This error condition is fatal.
boost::urls::error::missing_pct_hexdig
Synopsis
Declared in header <boost/url/error.hpp>
missing_pct_hexdig
Description
This error condition is fatal.
boost::urls::error::no_space
Synopsis
Declared in header <boost/url/error.hpp>
no_space
Description
This error is returned when a provided output buffer was too small to hold the complete result of an algorithm.
boost::urls::error::not_a_base
Synopsis
Declared in header <boost/url/error.hpp>
not_a_base
boost::urls::make_error_code
Synopsis
Declared in header <boost/url/impl/error.hpp>
boost::urls::ipv4_address
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
class ipv4_address;
Types
Name |
Description |
The type used to represent an address as an array of bytes |
|
The type used to represent an address as an unsigned integer |
Member Functions
Name |
Description |
|
Construct from a string. Construct from an array of bytes. Construct from an unsigned integer. Constructor. |
Return true if the address is a loopback address |
|
Return true if the address is a multicast address |
|
Return true if the address is unspecified |
|
Copy Assignment. |
|
Write a dotted decimal string representing the address to a buffer |
|
Return the address as bytes, in network byte order. |
|
Return the address as a string in dotted decimal format |
|
Return the address as an unsigned integer. |
Static Member Functions
Static Data Members
Name |
Description |
The number of characters in the longest possible IPv4 string. |
Friends
Name |
Description |
Return true if two addresses are not equal |
|
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
Specification
See Also
boost::urls::ipv4_address::max_str_len
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
constexpr
static
std::size_t const max_str_len = 15;
Description
The longest ipv4 address string is "255.255.255.255".
boost::urls::ipv4_address::uint_type
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
using uint_type = std::uint_least32_t;
boost::urls::ipv4_address::bytes_type
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
using bytes_type = std::array<unsigned char, 4>;
boost::urls::ipv4_address::ipv4_address
Members
Constructor.
constexpr
ipv4_address() = default;
» more...
Constructor.
constexpr
ipv4_address(ipv4_address const&) = default;
» more...
Construct from an unsigned integer.
explicit
ipv4_address(uint_type u) noexcept;
» more...
Construct from an array of bytes.
explicit
ipv4_address(bytes_type const& bytes) noexcept;
» more...
Construct from a string.
explicit
ipv4_address(core::string_view s);
» more...
boost::urls::ipv4_address::operator=
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
constexpr
ipv4_address&
operator=(ipv4_address const&) = default;
boost::urls::ipv4_address::to_bytes
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
bytes_type
to_bytes() const noexcept;
boost::urls::ipv4_address::to_uint
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
uint_type
to_uint() const noexcept;
boost::urls::ipv4_address::to_string
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
to_string(StringToken&& token) const;
Description
When called with no arguments, the
return type is std::string
.
Otherwise, the return type and style
of output is determined by which string
token is passed.
Example
assert( ipv4_address(0x01020304).to_string() == "1.2.3.4" );
Complexity
Constant.
Exception Safety
Strong guarantee. Calls to allocate may throw. String tokens may throw exceptions.
Specification
Return Value
The return type of the string token.
If the token parameter is omitted, then
a new std::string
is returned.
Otherwise, the function return type
is the result type of the token.
Parameters
Name | Description |
---|---|
token |
An optional string token. |
boost::urls::ipv4_address::to_buffer
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
core::string_view
to_buffer(
char* dest,
std::size_t dest_size) const;
Description
The resulting buffer is not null-terminated.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
The formatted string
Parameters
Name | Description |
---|---|
dest |
The buffer in which to write,
which must have at least |
dest_size |
The size of the output buffer. |
boost::urls::ipv4_address::is_loopback
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
bool
is_loopback() const noexcept;
boost::urls::ipv4_address::is_unspecified
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
bool
is_unspecified() const noexcept;
boost::urls::ipv4_address::is_multicast
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
bool
is_multicast() const noexcept;
boost::urls::operator==
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
friend
bool
operator==(
ipv4_address const& a1,
ipv4_address const& a2) noexcept;
boost::urls::operator!=
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
friend
bool
operator!=(
ipv4_address const& a1,
ipv4_address const& a2) noexcept;
boost::urls::ipv4_address::any
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
static
ipv4_address
any() noexcept;
boost::urls::ipv4_address::loopback
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
static
ipv4_address
loopback() noexcept;
boost::urls::ipv4_address::broadcast
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
static
ipv4_address
broadcast() noexcept;
boost::urls::operator<<
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
friend
std::ostream&
operator<<(
std::ostream& os,
ipv4_address const& addr);
boost::urls::parse_ipv4_address
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
system::result<ipv4_address>
parse_ipv4_address(core::string_view s) noexcept;
boost::urls::ipv6_address
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
class ipv6_address;
Types
Name |
Description |
The type used to represent an address as an array of bytes. |
Member Functions
Name |
Description |
|
Construct from a string. Construct from an IPv4 address. Construct from an array of bytes. Constructor. |
Return true if the address is a loopback address |
|
Return true if the address is unspecified |
|
Return true if the address is a mapped IPv4 address |
|
Copy Assignment |
|
Write a dotted decimal string representing the address to a buffer |
|
Return the address as bytes, in network byte order |
|
Return the address as a string. |
Static Member Functions
Name |
Description |
Return an address object that represents the loopback address |
Static Data Members
Name |
Description |
The number of characters in the longest possible IPv6 string. |
Friends
Name |
Description |
Return true if two addresses are not equal |
|
Return true if two addresses are equal |
Description
Objects of this type are used to construct, parse, and manipulate IP version 6 addresses.
BNF
IPv6address = 6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32
/ [ h16 ] "::" 4( h16 ":" ) ls32
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
/ [ *4( h16 ":" ) h16 ] "::" ls32
/ [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::"
ls32 = ( h16 ":" h16 ) / IPv4address
; least-significant 32 bits of address
h16 = 1*4HEXDIG
; 16 bits of address represented in hexadecimal
See Also
boost::urls::ipv6_address::max_str_len
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
constexpr
static
std::size_t const max_str_len = 49;
Description
The longest IPv6 address is:
ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
See Also
boost::urls::ipv6_address::bytes_type
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
using bytes_type = std::array<unsigned char, 16>;
Description
Octets are stored in network byte order.
boost::urls::ipv6_address::ipv6_address
Members
Constructor.
constexpr
ipv6_address() = default;
» more...
Constructor.
constexpr
ipv6_address(ipv6_address const&) = default;
» more...
Construct from an array of bytes.
ipv6_address(bytes_type const& bytes) noexcept;
» more...
Construct from an IPv4 address.
ipv6_address(ipv4_address const& addr) noexcept;
» more...
Construct from a string.
ipv6_address(core::string_view s);
» more...
boost::urls::ipv6_address::operator=
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
constexpr
ipv6_address&
operator=(ipv6_address const&) = default;
boost::urls::ipv6_address::to_bytes
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
bytes_type
to_bytes() const noexcept;
boost::urls::ipv6_address::to_string
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
to_string(StringToken&& token) const;
Description
The returned string does not contain surrounding square brackets.
When called with no arguments, the
return type is std::string
.
Otherwise, the return type and style
of output is determined by which string
token is passed.
Example
ipv6_address::bytes_type b = {{
0, 1, 0, 2, 0, 3, 0, 4,
0, 5, 0, 6, 0, 7, 0, 8 }};
ipv6_address a(b);
assert(a.to_string() == "1:2:3:4:5:6:7:8");
assert( ipv4_address(0x01020304).to_string() == "1.2.3.4" );
Complexity
Constant.
Exception Safety
Strong guarantee. Calls to allocate may throw. String tokens may throw exceptions.
Specification
Return Value
The return type of the string token.
If the token parameter is omitted, then
a new std::string
is returned.
Otherwise, the function return type
is the result type of the token.
Parameters
Name | Description |
---|---|
token |
An optional string token. |
boost::urls::ipv6_address::to_buffer
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
core::string_view
to_buffer(
char* dest,
std::size_t dest_size) const;
Description
The resulting buffer is not null-terminated.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
The formatted string
Parameters
Name | Description |
---|---|
dest |
The buffer in which to write,
which must have at least |
dest_size |
The size of the output buffer. |
boost::urls::ipv6_address::is_unspecified
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
bool
is_unspecified() const noexcept;
Description
The address 0:0:0:0:0:0:0:0 is called the unspecified address. It indicates the absence of an address.
Specification
boost::urls::ipv6_address::is_loopback
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
bool
is_loopback() const noexcept;
Description
The unicast address 0:0:0:0:0:0:0:1 is called the loopback address. It may be used by a node to send an IPv6 packet to itself.
Specification
boost::urls::ipv6_address::is_v4_mapped
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
bool
is_v4_mapped() const noexcept;
Description
This address type is used to represent the addresses of IPv4 nodes as IPv6 addresses.
Specification
boost::urls::operator==
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
friend
bool
operator==(
ipv6_address const& a1,
ipv6_address const& a2) noexcept;
boost::urls::operator!=
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
friend
bool
operator!=(
ipv6_address const& a1,
ipv6_address const& a2) noexcept;
boost::urls::ipv6_address::loopback
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
static
ipv6_address
loopback() noexcept;
Description
The unicast address 0:0:0:0:0:0:0:1 is called the loopback address. It may be used by a node to send an IPv6 packet to itself.
Specification
boost::urls::operator<<
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
friend
std::ostream&
operator<<(
std::ostream& os,
ipv6_address const& addr);
boost::urls::parse_ipv6_address
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
system::result<ipv6_address>
parse_ipv6_address(core::string_view s) noexcept;
Description
This function attempts to parse the string as an IPv6 address and returns a result containing the address upon success, or an error code if the string does not contain a valid IPv6 address.
Exception Safety
Throws nothing.
Return Value
A result containing the address.
Parameters
Name | Description |
---|---|
s |
The string to parse. |
boost::urls::scheme
Synopsis
Declared in header <boost/url/scheme.hpp>
enum scheme : unsigned short;
Members
Name |
Description |
Indicates that no scheme is present |
|
Indicates the scheme is not a well-known scheme |
|
File Transfer Protocol (FTP) |
|
File URI Scheme |
|
The Hypertext Transfer Protocol URI Scheme |
|
The Secure Hypertext Transfer Protocol URI Scheme |
|
The WebSocket URI Scheme |
|
The Secure WebSocket URI Scheme |
Description
Specification
boost::urls::scheme::none
Synopsis
Declared in header <boost/url/scheme.hpp>
none = 0
boost::urls::scheme::unknown
Synopsis
Declared in header <boost/url/scheme.hpp>
unknown
boost::urls::scheme::ftp
Synopsis
Declared in header <boost/url/scheme.hpp>
ftp
Description
FTP is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network.
Specification
boost::urls::scheme::file
Synopsis
Declared in header <boost/url/scheme.hpp>
file
Description
The File URI Scheme is typically used to retrieve files from within one’s own computer.
Specification
boost::urls::scheme::http
Synopsis
Declared in header <boost/url/scheme.hpp>
http
Description
URLs of this type indicate a resource which is interacted with using the HTTP protocol.
Specification
boost::urls::scheme::https
Synopsis
Declared in header <boost/url/scheme.hpp>
https
Description
URLs of this type indicate a resource which is interacted with using the Secure HTTP protocol.
Specification
boost::urls::scheme::ws
Synopsis
Declared in header <boost/url/scheme.hpp>
ws
Description
URLs of this type indicate a resource which is interacted with using the WebSocket protocol.
Specification
boost::urls::scheme::wss
Synopsis
Declared in header <boost/url/scheme.hpp>
wss
Description
URLs of this type indicate a resource which is interacted with using the Secure WebSocket protocol.
Specification
boost::urls::string_to_scheme
Synopsis
Declared in header <boost/url/scheme.hpp>
scheme
string_to_scheme(core::string_view s) noexcept;
Description
If the string does not identify a known scheme, the value scheme::unknown is returned.
BNF
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
Specification
Return Value
The known scheme
Parameters
Name | Description |
---|---|
s |
The string holding the scheme |
boost::urls::to_string
Synopsis
Declared in header <boost/url/scheme.hpp>
core::string_view
to_string(scheme s) noexcept;
Return Value
A string representing the known scheme
Parameters
Name | Description |
---|---|
s |
The known scheme constant |
boost::urls::default_port
Synopsis
Declared in header <boost/url/scheme.hpp>
Description
This function returns the default port for the known schemes. If the value does not represent a known scheme or the scheme does not represent a protocol, the function returns zero.
The following ports are returned by the function:
-
scheme::ftp = 21
-
scheme::http , scheme::ws = 80
-
scheme::https , scheme::wss = 443
Return Value
An integer with the default port number
Parameters
Name | Description |
---|---|
s |
The known scheme constant |
boost::urls::url_view
Synopsis
Declared in header <boost/url/url_view.hpp>
class url_view
: public url_view_base;
Member Functions
Name |
Description |
Return the authority |
|
Return the url string |
|
Return the result of comparing this with another url |
|
Return a pointer to the url’s character buffer |
|
Return true if the url is empty |
|
Return the authority. |
|
Return the fragment |
|
Return the host |
|
Return the host |
|
Return the host and port |
|
Return the host name |
|
Return the origin |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return the query |
|
Return the resource |
|
Return the path as a container of segments |
|
Return the target |
|
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
|
Return the fragment |
|
Return true if an authority is present |
|
Return true if a fragment is present |
|
Return true if a password is present |
|
Return true if a port is present |
|
Return true if a query is present |
|
Return true a scheme is present |
|
Return true if a userinfo is present |
|
Return the host |
|
Return the host |
|
Return the host IPv4 address |
|
Return the host IPv6 address |
|
Return the host IPvFuture address |
|
Return the host name |
|
Return the host type |
|
Return true if the path is absolute |
|
Return the URL as a core::string_view |
|
Assignment |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return a shared, persistent copy of the url |
|
Return the port |
|
Return the port |
|
Return the query |
|
Return the scheme |
|
Return the scheme |
|
Return the path as a container of segments |
|
Return the number of characters in the url |
|
|
Constructor |
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
|
|
Destructor |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Friends
Name |
Description |
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
Description
Objects of this type represent valid URL
strings constructed from a parsed, external
character buffer whose storage is managed
by the caller. That is, it acts like a
core::string_view
in terms of ownership.
The caller is responsible for ensuring
that the lifetime of the underlying
character buffer extends until it is no
longer referenced.
Example 1
Construction from a string parses the input as a URI-reference and throws an exception on error. Upon success, the constructed object points to the passed character buffer; ownership is not transferred.
url_view u( "https://www.example.com/index.htm?text=none#a1" );
Example 2
Parsing functions like parse_uri_reference return a result containing either a valid url_view upon succcess, otherwise they contain an error. The error can be converted to an exception by the caller if desired:
system::result< url_view > rv = parse_uri_reference( "https://www.example.com/index.htm?text=none#a1" );
BNF
URI-reference = URI / relative-ref
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
See Also
boost::urls::url_view::~url_view
Synopsis
Declared in header <boost/url/url_view.hpp>
~url_view() = default;
Description
Any params, segments, iterators, or other views which reference the same underlying character buffer remain valid.
boost::urls::url_view::url_view
Members
Constructor
url_view() noexcept;
» more...
Constructor
url_view(core::string_view s);
» more...
template<
class String,
class = void>
url_view(String const& s);
» more...
Constructor
url_view(url_view const& other) noexcept;
» more...
Constructor
url_view(url_view_base const& other) noexcept;
» more...
boost::urls::url_view::operator=
Members
Assignment
url_view&
operator=(url_view const& other) noexcept;
» more...
Assignment
url_view&
operator=(url_view_base const& other) noexcept;
» more...
boost::urls::url_view::max_size
Synopsis
Declared in header <boost/url/url_view.hpp>
constexpr
static
std::size_t
max_size() noexcept;
Description
This represents the largest number of characters that are possible in a url, not including any null terminator.
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::authority_view
Synopsis
Declared in header <boost/url/authority_view.hpp>
class authority_view;
Member Functions
Name |
Description |
|
Construct from a string. Constructor |
Return the complete authority |
|
Return the result of comparing this with another authority |
|
Return a pointer to the first character |
|
Return true if the authority is empty |
|
Return the host |
|
Return the host |
|
Return the host and port |
|
Return the host name |
|
Return the password |
|
Return the user |
|
Return the userinfo |
|
Return true if a password is present |
|
Return true if a port is present |
|
Return true if a userinfo is present |
|
Return the host |
|
Return the host |
|
Return the host IPv4 address |
|
Return the host IPv6 address |
|
Return the host IPvFuture address |
|
Return the host name |
|
Return the host type |
|
Assignment |
|
Return the password |
|
Return the port |
|
Return the port |
|
Return the number of characters in the authority |
|
Return the user |
|
Return the userinfo |
|
|
Destructor |
Friends
Name |
Description |
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |
|
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |
|
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |
|
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |
|
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |
|
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |
Description
Objects of this type represent valid authority
strings constructed from a parsed, external
character buffer whose storage is managed
by the caller. That is, it acts like a
core::string_view
in terms of ownership.
The caller is responsible for ensuring
that the lifetime of the underlying
character buffer extends until it is no
longer referenced.
Example 1
Construction from a string parses the input as an authority and throws an exception on error. Upon success, the constructed object points to the passed character buffer; ownership is not transferred.
authority_view a( "user:pass@www.example.com:8080" );
Example 2
The parsing function parse_authority returns a result containing either a valid authority_view upon succcess, otherwise it contain an error. The error can be converted to an exception by the caller if desired:
system::result< authority_view > rv = parse_authority( "user:pass@www.example.com:8080" );
BNF
authority = [ userinfo "@" ] host [ ":" port ]
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
host = IP-literal / IPv4address / reg-name
port = *DIGIT
Specification
See Also
boost::urls::authority_view::~authority_view
Synopsis
Declared in header <boost/url/authority_view.hpp>
virtual
~authority_view();
boost::urls::authority_view::authority_view
Members
Constructor
authority_view() noexcept;
» more...
Construct from a string.
explicit
authority_view(core::string_view s);
» more...
Constructor
authority_view(authority_view const&) noexcept;
» more...
boost::urls::authority_view::operator=
Synopsis
Declared in header <boost/url/authority_view.hpp>
authority_view&
operator=(authority_view const&) noexcept;
boost::urls::authority_view::size
Synopsis
Declared in header <boost/url/authority_view.hpp>
std::size_t
size() const noexcept;
Description
This function returns the number of characters in the authority.
Example
assert( authority_view( "user:pass@www.example.com:8080" ).size() == 30 );
Exception Safety
Throws nothing.
boost::urls::authority_view::empty
Synopsis
Declared in header <boost/url/authority_view.hpp>
bool
empty() const noexcept;
Description
An empty authority has an empty host, no userinfo, and no port.
Example
assert( authority_view( "" ).empty() );
Exception Safety
Throws nothing.
boost::urls::authority_view::data
Synopsis
Declared in header <boost/url/authority_view.hpp>
char const*
data() const noexcept;
Description
This function returns a pointer to the beginning of the view, which is not guaranteed to be null-terminated.
Exception Safety
Throws nothing.
boost::urls::authority_view::buffer
Synopsis
Declared in header <boost/url/authority_view.hpp>
core::string_view
buffer() const noexcept;
Description
This function returns the authority as a percent-encoded string.
Example
assert( parse_authority( "www.example.com" ).value().buffer() == "www.example.com" );
BNF
authority = [ userinfo "@" ] host [ ":" port ]
Exception Safety
Throws nothing.
Specification
boost::urls::authority_view::has_userinfo
Synopsis
Declared in header <boost/url/authority_view.hpp>
bool
has_userinfo() const noexcept;
Description
This function returns true if this contains a userinfo.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
userinfo = user [ ":" [ password ] ]
authority = [ userinfo "@" ] host [ ":" port ]
Specification
See Also
has_password , encoded_password , encoded_user , encoded_userinfo , password , user , userinfo .
boost::urls::authority_view::userinfo
Synopsis
Declared in header <boost/url/authority_view.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
userinfo(StringToken&& token) const;
Description
If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" );
Complexity
Linear in this->userinfo().size()
.
Exception Safety
Calls to allocate may throw.
BNF
userinfo = user [ ":" [ password ] ]
authority = [ userinfo "@" ] host [ ":" port ]
Specification
See Also
has_password , has_userinfo , encoded_password , encoded_user , encoded_userinfo , password , user .
boost::urls::authority_view::encoded_userinfo
Synopsis
Declared in header <boost/url/authority_view.hpp>
pct_string_view
encoded_userinfo() const noexcept;
Description
If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" );
Complexity
Constant.
Exception Safety
Throws nothing
BNF
userinfo = user [ ":" [ password ] ]
authority = [ userinfo "@" ] host [ ":" port ]
Specification
See Also
has_password , has_userinfo , encoded_password , encoded_user , password , user , userinfo .
boost::urls::authority_view::user
Synopsis
Declared in header <boost/url/authority_view.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
user(StringToken&& token) const;
Description
If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );
Complexity
Linear in this->user().size()
.
Exception Safety
Calls to allocate may throw.
BNF
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also
boost::urls::authority_view::encoded_user
Synopsis
Declared in header <boost/url/authority_view.hpp>
pct_string_view
encoded_user() const noexcept;
Description
If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also
has_password , has_userinfo , encoded_password , encoded_userinfo , password , user , userinfo .
boost::urls::authority_view::has_password
Synopsis
Declared in header <boost/url/authority_view.hpp>
bool
has_password() const noexcept;
Description
This function returns true if the userinfo is present and contains a password.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also
has_userinfo , encoded_password , encoded_user , encoded_userinfo , password , user , userinfo .
boost::urls::authority_view::password
Synopsis
Declared in header <boost/url/authority_view.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
password(StringToken&& token) const;
Description
If present, this function returns a string representing the password (which may be an empty string). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" );
Complexity
Linear in this->password().size()
.
Exception Safety
Calls to allocate may throw.
BNF
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also
has_password , has_userinfo , encoded_password , encoded_user , encoded_userinfo , user , userinfo .
boost::urls::authority_view::encoded_password
Synopsis
Declared in header <boost/url/authority_view.hpp>
pct_string_view
encoded_password() const noexcept;
Description
This function returns the password portion of the userinfo as a percent-encoded string.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also
has_password , has_userinfo , encoded_user , encoded_userinfo , password , user , userinfo .
boost::urls::authority_view::host_type
Synopsis
Declared in header <boost/url/authority_view.hpp>
Description
This function returns one of the following constants representing the type of host present.
Example
assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );
Complexity
Constant.
Exception Safety
Throws nothing.
Specification
boost::urls::authority_view::host
Synopsis
Declared in header <boost/url/authority_view.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
host(StringToken&& token) const;
Description
This function returns the host portion of the authority as a string, or the empty string if there is no authority. Any percent-escapes in the string are decoded first.
Example
assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" );
Complexity
Linear in this->host().size()
.
Exception Safety
Calls to allocate may throw.
BNF
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Specification
boost::urls::authority_view::encoded_host
Synopsis
Declared in header <boost/url/authority_view.hpp>
pct_string_view
encoded_host() const noexcept;
Description
This function returns the host portion of the authority as a string, or the empty string if there is no authority. The returned string may contain percent escapes.
Example
assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Specification
boost::urls::authority_view::host_address
Synopsis
Declared in header <boost/url/authority_view.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
host_address(StringToken&& token) const;
Description
The value returned by this function depends on the type of host returned from the function host_type .
-
If the type is host_type::ipv4 , then the IPv4 address string is returned.
-
If the type is host_type::ipv6 , then the IPv6 address string is returned, without any enclosing brackets.
-
If the type is host_type::ipvfuture , then the IPvFuture address string is returned, without any enclosing brackets.
-
If the type is host_type::name , then the host name string is returned. Any percent-escapes in the string are decoded first.
-
If the type is host_type::none , then an empty string is returned.
Example
assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" );
Complexity
Linear in this->host_address().size()
.
Exception Safety
Calls to allocate may throw.
BNF
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Specification
boost::urls::authority_view::encoded_host_address
Synopsis
Declared in header <boost/url/authority_view.hpp>
pct_string_view
encoded_host_address() const noexcept;
Description
The value returned by this function depends on the type of host returned from the function host_type .
-
If the type is host_type::ipv4 , then the IPv4 address string is returned.
-
If the type is host_type::ipv6 , then the IPv6 address string is returned, without any enclosing brackets.
-
If the type is host_type::ipvfuture , then the IPvFuture address string is returned, without any enclosing brackets.
-
If the type is host_type::name , then the host name string is returned. Any percent-escapes in the string are decoded first.
-
If the type is host_type::none , then an empty string is returned. The returned string may contain percent escapes.
Example
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Specification
boost::urls::authority_view::host_ipv4_address
Synopsis
Declared in header <boost/url/authority_view.hpp>
ipv4_address
host_ipv4_address() const noexcept;
Description
If the host type is host_type::ipv4 , this function returns the address as a value of type ipv4_address . Otherwise, if the host type is not an IPv4 address, it returns a default-constructed value which is equal to the unspecified address "0.0.0.0".
Example
assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
dec-octet = DIGIT ; 0-9
/ %x31-39 DIGIT ; 10-99
/ "1" 2DIGIT ; 100-199
/ "2" %x30-34 DIGIT ; 200-249
/ "25" %x30-35 ; 250-255
Specification
boost::urls::authority_view::host_ipv6_address
Synopsis
Declared in header <boost/url/authority_view.hpp>
ipv6_address
host_ipv6_address() const noexcept;
Description
If the host type is host_type::ipv6 , this function returns the address as a value of type ipv6_address . Otherwise, if the host type is not an IPv6 address, it returns a default-constructed value which is equal to the unspecified address "0:0:0:0:0:0:0:0".
Example
assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
IPv6address = 6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32
/ [ h16 ] "::" 4( h16 ":" ) ls32
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
/ [ *4( h16 ":" ) h16 ] "::" ls32
/ [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::"
ls32 = ( h16 ":" h16 ) / IPv4address
; least-significant 32 bits of address
h16 = 1*4HEXDIG
; 16 bits of address represented in hexadecimal
Specification
boost::urls::authority_view::host_ipvfuture
Synopsis
Declared in header <boost/url/authority_view.hpp>
core::string_view
host_ipvfuture() const noexcept;
Description
If the host type is host_type::ipvfuture , this function returns the address as a string. Otherwise, if the host type is not an IPvFuture address, it returns an empty string.
Example
assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
Specification
boost::urls::authority_view::host_name
Synopsis
Declared in header <boost/url/authority_view.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
host_name(StringToken&& token) const;
Description
If the host type is host_type::name , this function returns the name as a string. Otherwise, if the host type is not an name, it returns an empty string. Any percent-escapes in the string are decoded first.
Example
assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" );
Complexity
Linear in this->host_name().size()
.
Exception Safety
Calls to allocate may throw.
BNF
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Specification
boost::urls::authority_view::encoded_host_name
Synopsis
Declared in header <boost/url/authority_view.hpp>
pct_string_view
encoded_host_name() const noexcept;
Description
If the host type is host_type::name , this function returns the name as a string. Otherwise, if the host type is not an name, it returns an empty string. The returned string may contain percent escapes.
Example
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Specification
boost::urls::authority_view::has_port
Synopsis
Declared in header <boost/url/authority_view.hpp>
bool
has_port() const noexcept;
Description
This function returns true if an authority is present and contains a port.
Example
assert( url_view( "wss://www.example.com:443" ).has_port() );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
authority = [ userinfo "@" ] host [ ":" port ]
port = *DIGIT
Specification
See Also
boost::urls::authority_view::port
Synopsis
Declared in header <boost/url/authority_view.hpp>
core::string_view
port() const noexcept;
Description
If present, this function returns a string representing the port (which may be empty). Otherwise it returns an empty string.
Example
assert( url_view( "http://localhost.com:8080" ).port() == "8080" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
port = *DIGIT
Specification
See Also
boost::urls::authority_view::port_number
Synopsis
Declared in header <boost/url/authority_view.hpp>
std::uint16_t
port_number() const noexcept;
Description
If a port is present and the numerical value is representable, it is returned as an unsigned integer. Otherwise, the number zero is returned.
Example
assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
port = *DIGIT
Specification
See Also
boost::urls::authority_view::encoded_host_and_port
Synopsis
Declared in header <boost/url/authority_view.hpp>
pct_string_view
encoded_host_and_port() const noexcept;
Description
If an authority is present, this function returns the host and optional port as a string, which may be empty. Otherwise it returns an empty string. The returned string may contain percent escapes.
Example
assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
authority = [ userinfo "@" ] host [ ":" port ]
Specification
See Also
has_port , port , port_number .
boost::urls::authority_view::compare
Synopsis
Declared in header <boost/url/authority_view.hpp>
int
compare(authority_view const& other) const noexcept;
Description
This function compares two authorities according to Syntax-Based comparison algorithm.
Exception Safety
Throws nothing.
Specification
Return Value
-1 if *this < other
, 0 if
this == other
, and 1 if this > other
.
boost::urls::operator==
Synopsis
Declared in header <boost/url/authority_view.hpp>
friend
bool
operator==(
authority_view const& a0,
authority_view const& a1) noexcept;
Description
Complexity
Linear in min( a0.size(), a1.size() )
Exception Safety
Throws nothing
boost::urls::operator!=
Synopsis
Declared in header <boost/url/authority_view.hpp>
friend
bool
operator!=(
authority_view const& a0,
authority_view const& a1) noexcept;
Description
Complexity
Linear in min( a0.size(), a1.size() )
Exception Safety
Throws nothing
boost::urls::operator<
Synopsis
Declared in header <boost/url/authority_view.hpp>
friend
bool
operator<(
authority_view const& a0,
authority_view const& a1) noexcept;
Description
Complexity
Linear in min( a0.size(), a1.size() )
Exception Safety
Throws nothing
boost::urls::operator⇐
Synopsis
Declared in header <boost/url/authority_view.hpp>
friend
bool
operator<=(
authority_view const& a0,
authority_view const& a1) noexcept;
Description
Complexity
Linear in min( a0.size(), a1.size() )
Exception Safety
Throws nothing
boost::urls::operator>
Synopsis
Declared in header <boost/url/authority_view.hpp>
friend
bool
operator>(
authority_view const& a0,
authority_view const& a1) noexcept;
Description
Complexity
Linear in min( a0.size(), a1.size() )
Exception Safety
Throws nothing
boost::urls::operator>=
Synopsis
Declared in header <boost/url/authority_view.hpp>
friend
bool
operator>=(
authority_view const& a0,
authority_view const& a1) noexcept;
Description
Complexity
Linear in min( a0.size(), a1.size() )
Exception Safety
Throws nothing
boost::urls::operator<<
Synopsis
Declared in header <boost/url/authority_view.hpp>
friend
std::ostream&
operator<<(
std::ostream& os,
authority_view const& a);
boost::urls::parse_authority
Synopsis
Declared in header <boost/url/authority_view.hpp>
system::result<authority_view>
parse_authority(core::string_view s) noexcept;
Description
This function parses a string according to the authority grammar below, and returns an authority_view referencing the string. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the string extends until the view is no longer being accessed.
BNF
authority = [ userinfo "@" ] host [ ":" port ]
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
host = IP-literal / IPv4address / reg-name
port = *DIGIT
Exception Safety
Throws nothing.
Specification
Return Value
A view to the parsed authority
Parameters
Name | Description |
---|---|
s |
The string to parse |
See Also
boost::urls::ignore_case_t
Synopsis
Declared in header <boost/url/ignore_case.hpp>
struct ignore_case_t;
boost::urls::ignore_case
Synopsis
Declared in header <boost/url/ignore_case.hpp>
constexpr
ignore_case_t const ignore_case = {};
boost::urls::ignore_case_param
Synopsis
Declared in header <boost/url/ignore_case.hpp>
class ignore_case_param;
Member Functions
Name |
Description |
|
Constructor |
True if an algorithm should ignore case |
Description
Functions may use parameters of this type to allow the user to optionally indicate that comparisons should be case-insensitive when the value ignore_case is passed.
boost::urls::ignore_case_param::ignore_case_param
Members
Constructor
constexpr
ignore_case_param() noexcept = default;
» more...
Constructor
constexpr
ignore_case_param(ignore_case_t) noexcept;
» more...
boost::urls::ignore_case_param::operator bool
Synopsis
Declared in header <boost/url/ignore_case.hpp>
operator bool() const noexcept;
Description
Values of type ignore_case_param
evaluate to true when constructed
with the constant
ignore_case
. Otherwise, they are default-constructed
and evaluate to false
.
boost::urls::segments_encoded_base
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
class segments_encoded_base;
Types
Name |
Description |
The reference type |
|
A signed integer type used to represent differences. |
|
The reference type |
|
An unsigned integer type used to represent size. |
|
The value type |
Member Functions
Name |
Description |
Return the last segment |
|
Return an iterator to the beginning |
|
Return the referenced character buffer. |
|
Return true if there are no segments |
|
Return an iterator to the end |
|
Return the first segment |
|
Returns true if this references an absolute path. |
|
Return the number of segments |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Description
This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:
boost::urls::segments_encoded_base::iterator
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
class iterator;
Types
Name |
Description |
Member Functions
Name |
Description |
|
|
boost::urls::segments_encoded_base::iterator::value_type
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
using value_type = segments_encoded_base::value_type;
boost::urls::segments_encoded_base::iterator::reference
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
using reference = segments_encoded_base::reference;
boost::urls::segments_encoded_base::iterator::pointer
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
using pointer = reference;
boost::urls::segments_encoded_base::iterator::difference_type
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
using difference_type = std::ptrdiff_t;
boost::urls::segments_encoded_base::iterator::iterator_category
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
using iterator_category = std::bidirectional_iterator_tag;
boost::urls::segments_encoded_base::iterator::iterator
Members
constexpr
iterator() = default;
» more...
constexpr
iterator(iterator const&) = default;
» more...
boost::urls::segments_encoded_base::iterator::operator=
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
boost::urls::segments_encoded_base::iterator::operator*
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
reference
operator*() const noexcept;
boost::urls::segments_encoded_base::iterator::operator→
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
pointer
operator->() const noexcept;
boost::urls::segments_encoded_base::iterator::operator++
Members
iterator&
operator++() noexcept;
» more...
iterator
operator++(int) noexcept;
» more...
boost::urls::segments_encoded_base::iterator::operator--
Members
iterator&
operator--() noexcept;
» more...
iterator
operator--(int) noexcept;
» more...
boost::urls::segments_encoded_base::iterator::operator==
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
bool
operator==(iterator const& other) const noexcept;
boost::urls::segments_encoded_base::iterator::operator!=
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
bool
operator!=(iterator const& other) const noexcept;
boost::urls::segments_encoded_base::const_iterator
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
using const_iterator = iterator;
boost::urls::segments_encoded_base::value_type
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
using value_type = std::string;
Description
Values of this type represent a segment where unique ownership is retained by making a copy.
Example
segments_encoded_base::value_type ps( url_view( "/path/to/file.txt" ).encoded_segments().back() );
boost::urls::segments_encoded_base::reference
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
using reference = pct_string_view;
Description
This is the type of value returned when iterators of the view are dereferenced.
boost::urls::segments_encoded_base::const_reference
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
using const_reference = pct_string_view;
Description
This is the type of value returned when iterators of the view are dereferenced.
boost::urls::segments_encoded_base::size_type
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
using size_type = std::size_t;
boost::urls::segments_encoded_base::difference_type
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
using difference_type = std::ptrdiff_t;
boost::urls::segments_encoded_base::max_size
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
constexpr
static
std::size_t
max_size() noexcept;
Description
This represents the largest number of characters that are possible in a path, not including any null terminator.
Exception Safety
Throws nothing.
boost::urls::segments_encoded_base::buffer
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
pct_string_view
buffer() const noexcept;
Description
This function returns the character buffer referenced by the view. The returned string may contain percent escapes.
Example
assert( url_view( "/path/to/file.txt" ).encoded_segments().buffer() == "/path/to/file.txt" );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::segments_encoded_base::is_absolute
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
bool
is_absolute() const noexcept;
Description
Absolute paths always start with a forward slash ('/').
Example
assert( url_view( "/path/to/file.txt" ).encoded_segments().is_absolute() == true );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::segments_encoded_base::empty
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
bool
empty() const noexcept;
Description
Example
assert( ! url_view( "/index.htm" ).encoded_segments().empty() );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::segments_encoded_base::size
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
std::size_t
size() const noexcept;
Description
Example
assert( url_view( "/path/to/file.txt" ).encoded_segments().size() == 3 );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::segments_encoded_base::front
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
pct_string_view
front() const noexcept;
Description
This function returns a string with the first segment of the path without any leading or trailing '/' separators. The returned string may contain percent escapes.
Preconditions
this->empty() == false
Effects
return *begin();
Example
assert( url_view( "/path/to/file.txt" ).encoded_segments().front() == "path" );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::segments_encoded_base::back
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
pct_string_view
back() const noexcept;
Description
This function returns a string with the last segment of the path without any leading or trailing '/' separators. The returned string may contain percent escapes.
Preconditions
this->empty() == false
Example
assert( url_view( "/path/to/file.txt" ).encoded_segments().back() == "file.txt" );
Preconditions
this->empty() == false
Effects
return *--end();
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::segments_encoded_base::begin
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
iterator
begin() const noexcept;
Description
Complexity
Linear in this->front().size()
or
constant if this->empty()
.
Exception Safety
Throws nothing.
boost::urls::segments_encoded_base::end
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
iterator
end() const noexcept;
Description
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::segments_base
Synopsis
Declared in header <boost/url/segments_base.hpp>
class segments_base;
Types
Name |
Description |
The reference type |
|
A signed integer type used to represent differences. |
|
The reference type |
|
An unsigned integer type used to represent size. |
|
The value type |
Member Functions
Name |
Description |
Return the last segment |
|
Return an iterator to the beginning |
|
Return the referenced character buffer. |
|
Return true if there are no segments |
|
Return an iterator to the end |
|
Return the first segment |
|
Returns true if this references an absolute path. |
|
Return the number of segments |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Description
This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:
boost::urls::segments_base::iterator
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
class iterator;
Types
Name |
Description |
Member Functions
Name |
Description |
|
|
boost::urls::segments_base::iterator::value_type
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
using value_type = segments_base::value_type;
boost::urls::segments_base::iterator::reference
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
using reference = segments_base::reference;
boost::urls::segments_base::iterator::pointer
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
using pointer = reference;
boost::urls::segments_base::iterator::difference_type
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
using difference_type = segments_base::difference_type;
boost::urls::segments_base::iterator::iterator_category
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
using iterator_category = std::bidirectional_iterator_tag;
boost::urls::segments_base::iterator::iterator
Members
constexpr
iterator() = default;
» more...
constexpr
iterator(iterator const&) = default;
» more...
boost::urls::segments_base::iterator::operator=
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
boost::urls::segments_base::iterator::operator*
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
reference
operator*() const;
boost::urls::segments_base::iterator::operator→
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
pointer
operator->() const = delete;
boost::urls::segments_base::iterator::operator++
Members
iterator&
operator++() noexcept;
» more...
iterator
operator++(int) noexcept;
» more...
boost::urls::segments_base::iterator::operator--
Members
iterator&
operator--() noexcept;
» more...
iterator
operator--(int) noexcept;
» more...
boost::urls::segments_base::iterator::operator==
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
bool
operator==(iterator const& other) const noexcept;
boost::urls::segments_base::iterator::operator!=
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
bool
operator!=(iterator const& other) const noexcept;
boost::urls::segments_base::const_iterator
Synopsis
Declared in header <boost/url/segments_base.hpp>
using const_iterator = iterator;
boost::urls::segments_base::value_type
Synopsis
Declared in header <boost/url/segments_base.hpp>
using value_type = std::string;
Description
Values of this type represent a segment where unique ownership is retained by making a copy.
Example
segments_base::value_type ps( url_view( "/path/to/file.txt" ).segments().back() );
boost::urls::segments_base::reference
Synopsis
Declared in header <boost/url/segments_base.hpp>
using reference = std::string;
Description
This is the type of value returned when iterators of the view are dereferenced.
boost::urls::segments_base::const_reference
Synopsis
Declared in header <boost/url/segments_base.hpp>
using const_reference = std::string;
Description
This is the type of value returned when iterators of the view are dereferenced.
boost::urls::segments_base::size_type
Synopsis
Declared in header <boost/url/segments_base.hpp>
using size_type = std::size_t;
boost::urls::segments_base::difference_type
Synopsis
Declared in header <boost/url/segments_base.hpp>
using difference_type = std::ptrdiff_t;
boost::urls::segments_base::max_size
Synopsis
Declared in header <boost/url/segments_base.hpp>
constexpr
static
std::size_t
max_size() noexcept;
Description
This represents the largest number of characters that are possible in a path, not including any null terminator.
Exception Safety
Throws nothing.
boost::urls::segments_base::buffer
Synopsis
Declared in header <boost/url/segments_base.hpp>
pct_string_view
buffer() const noexcept;
Description
This function returns the character buffer referenced by the view. The returned string may contain percent escapes.
Example
assert( url_view( "/path/to/file.txt" ).segments().buffer() == "/path/to/file.txt" );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::segments_base::is_absolute
Synopsis
Declared in header <boost/url/segments_base.hpp>
bool
is_absolute() const noexcept;
Description
Absolute paths always start with a forward slash ('/').
Example
assert( url_view( "/path/to/file.txt" ).segments().is_absolute() == true );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::segments_base::empty
Synopsis
Declared in header <boost/url/segments_base.hpp>
bool
empty() const noexcept;
Description
Example
assert( ! url_view( "/index.htm" ).segments().empty() );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::segments_base::size
Synopsis
Declared in header <boost/url/segments_base.hpp>
std::size_t
size() const noexcept;
Description
Example
assert( url_view( "/path/to/file.txt" ).segments().size() == 3 );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::segments_base::front
Synopsis
Declared in header <boost/url/segments_base.hpp>
std::string
front() const noexcept;
Description
This function returns a string with the first segment of the path without any leading or trailing '/' separators. Any percent-escapes in the string are decoded first.
Preconditions
this->empty() == false
Effects
return *begin();
Example
assert( url_view( "/path/to/file.txt" ).segments().front() == "path" );
Complexity
Linear in this->front().size()
.
Exception Safety
Calls to allocate may throw.
boost::urls::segments_base::back
Synopsis
Declared in header <boost/url/segments_base.hpp>
std::string
back() const noexcept;
Description
Preconditions
this->empty() == false
Example
assert( url_view( "/path/to/file.txt" ).segments().back() == "file.txt" );
Preconditions
this->empty() == false
Effects
return *--end();
Complexity
Linear in this->back().size()
.
Exception Safety
Calls to allocate may throw.
boost::urls::segments_base::begin
Synopsis
Declared in header <boost/url/segments_base.hpp>
iterator
begin() const noexcept;
Description
Complexity
Linear in this->front().size()
or
constant if this->empty()
.
Exception Safety
Throws nothing.
boost::urls::segments_base::end
Synopsis
Declared in header <boost/url/segments_base.hpp>
iterator
end() const noexcept;
Description
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::segments_view
Synopsis
Declared in header <boost/url/segments_view.hpp>
class segments_view
: public segments_base;
Types
Name |
Description |
The reference type |
|
A signed integer type used to represent differences. |
|
The reference type |
|
An unsigned integer type used to represent size. |
|
The value type |
Member Functions
Name |
Description |
Return the last segment |
|
Return an iterator to the beginning |
|
Return the referenced character buffer. |
|
Return true if there are no segments |
|
Return an iterator to the end |
|
Return the first segment |
|
Returns true if this references an absolute path. |
|
Assignment |
|
|
Constructor |
Return the number of segments |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Description
Objects of this type are used to interpret the path as a bidirectional view of segment strings.
The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.
Example
url_view u( "/path/to/file.txt" );
segments_view ps = u.segments();
assert( ps.buffer().data() == u.buffer().data() );
Percent escapes in strings returned when dereferencing iterators are automatically decoded.
Iterator Invalidation
Changes to the underlying character buffer can invalidate iterators which reference it.
See Also
boost::urls::segments_view::segments_view
Members
Constructor
constexpr
segments_view() = default;
» more...
Constructor
constexpr
segments_view(segments_view const& other) = default;
» more...
Constructor
segments_view(core::string_view s);
» more...
boost::urls::segments_view::operator=
Synopsis
Declared in header <boost/url/segments_view.hpp>
constexpr
segments_view&
operator=(segments_view const& other) = default;
Description
After assignment, both views reference the same underlying character buffer.
Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.
Postconditions
this->buffer().data() == other.buffer().data()
Complexity
Constant
Exception Safety
Throws nothing
boost::urls::segments_encoded_view
Synopsis
Declared in header <boost/url/segments_encoded_view.hpp>
class segments_encoded_view
: public segments_encoded_base;
Types
Name |
Description |
The reference type |
|
A signed integer type used to represent differences. |
|
The reference type |
|
An unsigned integer type used to represent size. |
|
The value type |
Member Functions
Name |
Description |
Return the last segment |
|
Return an iterator to the beginning |
|
Return the referenced character buffer. |
|
Return true if there are no segments |
|
Return an iterator to the end |
|
Return the first segment |
|
Returns true if this references an absolute path. |
|
Conversion |
|
Assignment |
|
|
Constructor |
Return the number of segments |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Friends
Name |
Description |
Description
Objects of this type are used to interpret the path as a bidirectional view of segment strings.
The view does not retain ownership of the elements and instead references the original character buffer. The caller is responsible for ensuring that the lifetime of the buffer extends until it is no longer referenced.
Example
url_view u( "/path/to/file.txt" );
segments_encoded_view ps = u.encoded_segments();
assert( ps.buffer().data() == u.buffer().data() );
Strings produced when elements are returned have type param_pct_view and represent encoded strings. Strings passed to member functions may contain percent escapes, and throw exceptions on invalid inputs.
Iterator Invalidation
Changes to the underlying character buffer can invalidate iterators which reference it.
See Also
boost::urls::segments_encoded_view::segments_encoded_view
Members
Constructor
constexpr
segments_encoded_view() = default;
» more...
Constructor
constexpr
segments_encoded_view(segments_encoded_view const&) noexcept = default;
» more...
Constructor
segments_encoded_view(core::string_view s);
» more...
boost::urls::segments_encoded_view::operator=
Synopsis
Declared in header <boost/url/segments_encoded_view.hpp>
constexpr
segments_encoded_view&
operator=(segments_encoded_view const&) = default;
Description
After assignment, both views reference the same underlying character buffer.
Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.
Postconditions
this->buffer().data() == other.buffer().data()
Complexity
Constant
Exception Safety
Throws nothing
boost::urls::segments_encoded_view::operator segments_view
Synopsis
Declared in header <boost/url/segments_encoded_view.hpp>
operator segments_view() const noexcept;
Description
This conversion returns a new view which references the same underlying character buffer, and whose iterators and members return ordinary strings with decoding applied to any percent escapes.
Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.
Example
segments_view ps = parse_path( "/path/to/file.txt" ).value();
Postconditions
segments_view( *this ).buffer().data() == this->buffer().data()
Complexity
Constant
Exception Safety
Throws nothing
boost::urls::parse_path
Synopsis
Declared in header <boost/url/segments_encoded_view.hpp>
friend
system::result<segments_encoded_view>
parse_path(core::string_view s) noexcept;
boost::urls::parse_path
Synopsis
Declared in header <boost/url/parse_path.hpp>
system::result<segments_encoded_view>
parse_path(core::string_view s) noexcept;
Description
This function parses the string and returns the corresponding path object if the string is valid, otherwise returns an error.
BNF
path = [ "/" ] segment *( "/" segment )
Exception Safety
No-throw guarantee.
Specification
Return Value
A valid view on success, otherwise an error code.
Parameters
Name | Description |
---|---|
s |
The string to parse |
See Also
boost::urls::authority_rule_t
Synopsis
Declared in header <boost/url/rfc/authority_rule.hpp>
struct authority_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::authority_rule_t::value_type
Synopsis
Declared in header <boost/url/rfc/authority_rule.hpp>
using value_type = authority_view;
boost::urls::authority_rule_t::parse
Synopsis
Declared in header <boost/url/rfc/authority_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::authority_rule
Synopsis
Declared in header <boost/url/rfc/authority_rule.hpp>
constexpr
authority_rule_t const authority_rule = {};
boost::urls::pct_encoded_rule_t
Synopsis
Declared in header <boost/url/rfc/pct_encoded_rule.hpp>
template<class CharSet>
struct pct_encoded_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
Friends
Name |
Description |
boost::urls::pct_encoded_rule_t::value_type
Synopsis
Declared in header <boost/url/rfc/pct_encoded_rule.hpp>
using value_type = pct_string_view;
boost::urls::pct_encoded_rule
Synopsis
Declared in header <boost/url/rfc/pct_encoded_rule.hpp>
template<class CharSet_>
friend
constexpr
pct_encoded_rule_t<CharSet_>
pct_encoded_rule(CharSet_ const& cs) noexcept;
boost::urls::pct_encoded_rule_t::parse
Synopsis
Declared in header <boost/url/rfc/pct_encoded_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::pct_encoded_rule
Members
template<class CharSet_>
constexpr
pct_encoded_rule_t<CharSet_>
pct_encoded_rule(CharSet_ const& cs) noexcept;
» more...
template<class CharSet>
constexpr
pct_encoded_rule_t<CharSet>
pct_encoded_rule(CharSet const& cs) noexcept;
» more...
boost::urls::variant
Synopsis
Declared in header <boost/url/variant.hpp>
template<class... Ts>
using variant = boost::variant2::variant<Ts...>;
Description
Warning
|
This alias is no longer supported and
should not be used in new code. Please use
boost::variant2::variant instead.
|
This alias is included for backwards compatibility with earlier versions of the library.
However, it will be removed in future releases, and using it in new code is not recommended.
Please use the updated version instead to ensure compatibility with future versions of the library.
boost::urls::optional
Synopsis
Declared in header <boost/url/optional.hpp>
template<class T>
using optional = boost::optional<T>;
boost::urls::params_encoded_base
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
class params_encoded_base;
Types
Name |
Description |
The reference type |
|
A signed integer type used to represent differences. |
|
The reference type |
|
An unsigned integer type to represent sizes. |
|
The value type |
Member Functions
Name |
Description |
Return an iterator to the beginning |
|
Return the query corresponding to these params |
|
Return true if a matching key exists |
|
Return the number of matching keys |
|
Return true if there are no params |
|
Return an iterator to the end |
|
Find a matching key |
|
Find a matching key |
|
Return the number of params |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Description
This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:
boost::urls::params_encoded_base::iterator
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
class iterator;
Types
Name |
Description |
Member Functions
Name |
Description |
|
|
Friends
Name |
Description |
boost::urls::params_encoded_base::iterator::value_type
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
using value_type = params_encoded_base::value_type;
boost::urls::params_encoded_base::iterator::reference
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
using reference = params_encoded_base::reference;
boost::urls::params_encoded_base::iterator::pointer
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
using pointer = reference;
boost::urls::params_encoded_base::iterator::difference_type
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
using difference_type = std::ptrdiff_t;
boost::urls::params_encoded_base::iterator::iterator_category
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
using iterator_category = std::bidirectional_iterator_tag;
boost::urls::params_encoded_base::iterator::iterator
Members
iterator() = default;
» more...
constexpr
iterator(iterator const&) = default;
» more...
boost::urls::params_encoded_base::iterator::operator=
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
boost::urls::params_encoded_base::iterator::operator++
Members
iterator&
operator++() noexcept;
» more...
iterator
operator++(int) noexcept;
» more...
boost::urls::params_encoded_base::iterator::operator--
Members
iterator&
operator--() noexcept;
» more...
iterator
operator--(int) noexcept;
» more...
boost::urls::params_encoded_base::iterator::operator*
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
reference
operator*() const;
boost::urls::params_encoded_base::iterator::operator→
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
pointer
operator->() const;
boost::urls::operator==
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
boost::urls::operator!=
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
boost::urls::params_encoded_base::const_iterator
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
using const_iterator = iterator;
boost::urls::params_encoded_base::value_type
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
using value_type = param;
Description
Values of this type represent parameters whose strings retain unique ownership by making a copy.
Example
params_encoded_view::value_type qp( *url_view( "?first=John&last=Doe" ).params().find( "first" ) );
See Also
param .
boost::urls::params_encoded_base::reference
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
using reference = param_pct_view;
Description
This is the type of value returned when iterators of the view are dereferenced.
See Also
boost::urls::params_encoded_base::const_reference
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
using const_reference = param_pct_view;
Description
This is the type of value returned when iterators of the view are dereferenced.
See Also
boost::urls::params_encoded_base::size_type
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
using size_type = std::size_t;
boost::urls::params_encoded_base::difference_type
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
using difference_type = std::ptrdiff_t;
boost::urls::params_encoded_base::max_size
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
constexpr
static
std::size_t
max_size() noexcept;
Description
This represents the largest number of characters that are possible in a path, not including any null terminator.
Exception Safety
Throws nothing.
boost::urls::params_encoded_base::buffer
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
pct_string_view
buffer() const noexcept;
Description
This function returns the query string referenced by the container. The returned string may contain percent escapes.
Example
assert( url_view( "?first=John&last=Doe" ).encoded_params().buffer() == "first=John&last=Doe" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
query-params = query-param *( "&" query-param )
query-param = key [ "=" value ]
key = *qpchar
value = *( qpchar / "=" )
Specification
boost::urls::params_encoded_base::empty
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
bool
empty() const noexcept;
Description
Example
assert( ! url_view( "?key=value" ).encoded_params().empty() );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::params_encoded_base::size
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
std::size_t
size() const noexcept;
Description
Example
assert( url_view( "?key=value").encoded_params().size() == 1 );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::params_encoded_base::begin
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
iterator
begin() const noexcept;
Description
Complexity
Linear in the size of the first param.
Exception Safety
Throws nothing.
boost::urls::params_encoded_base::end
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
iterator
end() const noexcept;
Description
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::params_encoded_base::contains
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
bool
contains(
pct_string_view key,
ignore_case_param ic = = {}) const noexcept;
Description
This function examines the parameters in the container to find a match for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first.
Example
assert( url_view( "?first=John&last=Doe" ).encoded_params().contains( "first" ) );
Complexity
Linear in this->buffer().size()
.
Exception Safety
Exceptions thrown on invalid input.
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_encoded_base::count
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
std::size_t
count(
pct_string_view key,
ignore_case_param ic = = {}) const noexcept;
Description
This function examines the parameters in the container to find the number of matches for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first.
Example
assert( url_view( "?first=John&last=Doe" ).encoded_params().count( "first" ) == 1 );
Complexity
Linear in this->buffer().size()
.
Exception Safety
Exceptions thrown on invalid input.
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_encoded_base::find
Members
Find a matching key
iterator
find(
pct_string_view key,
ignore_case_param ic = = {}) const noexcept;
» more...
Find a matching key
iterator
find(
iterator from,
pct_string_view key,
ignore_case_param ic = = {}) const noexcept;
» more...
boost::urls::params_encoded_base::find_last
Members
Find a matching key
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...
boost::urls::params_ref
Synopsis
Declared in header <boost/url/params_ref.hpp>
class params_ref
: public params_base;
Types
Name |
Description |
The reference type |
|
A signed integer type used to represent differences. |
|
The reference type |
|
An unsigned integer type to represent sizes. |
|
The value type |
Member Functions
Name |
Description |
Append elements |
|
Assign elements |
|
Return an iterator to the beginning |
|
Return the referenced character buffer. |
|
Clear the contents of the container |
|
Return true if a matching key exists |
|
Return the number of matching keys |
|
Return true if there are no params |
|
Return an iterator to the end |
|
Erase elements |
|
Find a matching key |
|
Find a matching key |
|
Insert elements |
|
Conversion |
|
Assignment |
|
|
Constructor |
Replace elements |
|
Set a value |
|
Return the number of params |
|
Remove the value on an element |
|
Return the referenced url |
Static Member Functions
Name |
Description |
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:
boost::urls::params_ref::params_ref
Members
Constructor
constexpr
params_ref(params_ref const& other) = default;
» more...
Constructor
params_ref(
params_ref const& other,
encoding_opts opt) noexcept;
» more...
boost::urls::params_ref::operator=
Members
Assignment
params_ref&
operator=(params_ref const& other);
» more...
Assignment
params_ref&
operator=(std::initializer_list<param_view> init);
» more...
boost::urls::params_ref::operator params_view
Synopsis
Declared in header <boost/url/params_ref.hpp>
operator params_view() const noexcept;
boost::urls::params_ref::url
Synopsis
Declared in header <boost/url/params_ref.hpp>
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.
boost::urls::params_ref::clear
Synopsis
Declared in header <boost/url/params_ref.hpp>
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.
boost::urls::params_ref::assign
Members
Assign elements
void
assign(std::initializer_list<param_view> init);
» more...
Assign elements
template<class FwdIt>
void
assign(
FwdIt first,
FwdIt last);
» more...
boost::urls::params_ref::append
Members
Append elements
iterator
append(param_view const& p);
» more...
Append elements
iterator
append(std::initializer_list<param_view> init);
» more...
Append elements
template<class FwdIt>
iterator
append(
FwdIt first,
FwdIt last);
» more...
boost::urls::params_ref::insert
Members
Insert elements
iterator
insert(
iterator before,
param_view const& p);
» more...
Insert elements
iterator
insert(
iterator before,
std::initializer_list<param_view> init);
» more...
Insert elements
template<class FwdIt>
iterator
insert(
iterator before,
FwdIt first,
FwdIt last);
» more...
boost::urls::params_ref::erase
Members
Erase elements
iterator
erase(iterator pos) noexcept;
» more...
Erase elements
iterator
erase(
iterator first,
iterator last) noexcept;
» more...
Erase elements
std::size_t
erase(
core::string_view key,
ignore_case_param ic = = {}) noexcept;
» more...
boost::urls::params_ref::replace
Members
Replace elements
iterator
replace(
iterator pos,
param_view const& p);
» more...
Replace elements
iterator
replace(
iterator from,
iterator to,
std::initializer_list<param_view> init);
» more...
Replace elements
template<class FwdIt>
iterator
replace(
iterator from,
iterator to,
FwdIt first,
FwdIt last);
» more...
boost::urls::params_ref::unset
Synopsis
Declared in header <boost/url/params_ref.hpp>
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
An iterator to the element.
Parameters
Name | Description |
---|---|
pos |
An iterator to the element. |
boost::urls::params_ref::set
Members
Set a value
iterator
set(
iterator pos,
core::string_view value);
» more...
Set a value
iterator
set(
core::string_view key,
core::string_view value,
ignore_case_param ic = = {});
» more...
boost::urls::params_base
Synopsis
Declared in header <boost/url/params_base.hpp>
class params_base;
Types
Name |
Description |
The reference type |
|
A signed integer type used to represent differences. |
|
The reference type |
|
An unsigned integer type to represent sizes. |
|
The value type |
Member Functions
Name |
Description |
Return an iterator to the beginning |
|
Return the referenced character buffer. |
|
Return true if a matching key exists |
|
Return the number of matching keys |
|
Return true if there are no params |
|
Return an iterator to the end |
|
Find a matching key |
|
Find a matching key |
|
Return the number of params |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Description
This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:
boost::urls::params_base::iterator
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
class iterator;
Types
Name |
Description |
Member Functions
Name |
Description |
|
|
boost::urls::params_base::iterator::value_type
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
using value_type = params_base::value_type;
boost::urls::params_base::iterator::reference
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
using reference = params_base::reference;
boost::urls::params_base::iterator::pointer
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
using pointer = reference;
boost::urls::params_base::iterator::difference_type
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
using difference_type = params_base::difference_type;
boost::urls::params_base::iterator::iterator_category
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
using iterator_category = std::bidirectional_iterator_tag;
boost::urls::params_base::iterator::iterator
Members
iterator() = default;
» more...
constexpr
iterator(iterator const&) = default;
» more...
boost::urls::params_base::iterator::operator=
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
boost::urls::params_base::iterator::operator++
Members
iterator&
operator++() noexcept;
» more...
iterator
operator++(int) noexcept;
» more...
boost::urls::params_base::iterator::operator--
Members
iterator&
operator--() noexcept;
» more...
iterator
operator--(int) noexcept;
» more...
boost::urls::params_base::iterator::operator*
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
reference
operator*() const;
boost::urls::params_base::iterator::operator→
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
pointer
operator->() const = delete;
boost::urls::params_base::iterator::operator==
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
bool
operator==(iterator const& other) const noexcept;
boost::urls::params_base::iterator::operator!=
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
bool
operator!=(iterator const& other) const noexcept;
boost::urls::params_base::const_iterator
Synopsis
Declared in header <boost/url/params_base.hpp>
using const_iterator = iterator;
boost::urls::params_base::value_type
Synopsis
Declared in header <boost/url/params_base.hpp>
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" ) );
See Also
param .
boost::urls::params_base::reference
Synopsis
Declared in header <boost/url/params_base.hpp>
using reference = param;
Description
This is the type of value returned when iterators of the view are dereferenced.
See Also
boost::urls::params_base::const_reference
Synopsis
Declared in header <boost/url/params_base.hpp>
using const_reference = param;
Description
This is the type of value returned when iterators of the view are dereferenced.
See Also
boost::urls::params_base::size_type
Synopsis
Declared in header <boost/url/params_base.hpp>
using size_type = std::size_t;
boost::urls::params_base::difference_type
Synopsis
Declared in header <boost/url/params_base.hpp>
using difference_type = std::ptrdiff_t;
boost::urls::params_base::max_size
Synopsis
Declared in header <boost/url/params_base.hpp>
constexpr
static
std::size_t
max_size() noexcept;
Description
This represents the largest number of characters that are possible in a path, not including any null terminator.
Exception Safety
Throws nothing.
boost::urls::params_base::buffer
Synopsis
Declared in header <boost/url/params_base.hpp>
pct_string_view
buffer() const noexcept;
Description
This function returns the character buffer referenced by the view. The returned string may contain percent escapes.
Example
assert( url_view( "?first=John&last=Doe" ).params().buffer() == "?first=John&last=Doe" );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::params_base::empty
Synopsis
Declared in header <boost/url/params_base.hpp>
bool
empty() const noexcept;
Description
Example
assert( ! url_view( "?key=value" ).params().empty() );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::params_base::size
Synopsis
Declared in header <boost/url/params_base.hpp>
std::size_t
size() const noexcept;
Description
Example
assert( url_view( "?key=value").params().size() == 1 );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::params_base::begin
Synopsis
Declared in header <boost/url/params_base.hpp>
iterator
begin() const noexcept;
Description
Complexity
Linear in the size of the first param.
Exception Safety
Throws nothing.
boost::urls::params_base::end
Synopsis
Declared in header <boost/url/params_base.hpp>
iterator
end() const noexcept;
Description
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::params_base::contains
Synopsis
Declared in header <boost/url/params_base.hpp>
bool
contains(
core::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.
Parameters
Name | Description |
---|---|
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_base::count
Synopsis
Declared in header <boost/url/params_base.hpp>
std::size_t
count(
core::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.
Parameters
Name | Description |
---|---|
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_base::find
Members
Find a matching key
iterator
find(
core::string_view key,
ignore_case_param ic = = {}) const noexcept;
» more...
Find a matching key
iterator
find(
iterator from,
core::string_view key,
ignore_case_param ic = = {}) const noexcept;
» more...
boost::urls::params_base::find_last
Members
Find a matching key
iterator
find_last(
core::string_view key,
ignore_case_param ic = = {}) const noexcept;
» more...
Find a matching key
iterator
find_last(
iterator before,
core::string_view key,
ignore_case_param ic = = {}) const noexcept;
» more...
boost::urls::params_view
Synopsis
Declared in header <boost/url/params_view.hpp>
class params_view
: public params_base;
Types
Name |
Description |
The reference type |
|
A signed integer type used to represent differences. |
|
The reference type |
|
An unsigned integer type to represent sizes. |
|
The value type |
Member Functions
Name |
Description |
Return an iterator to the beginning |
|
Return the referenced character buffer. |
|
Return true if a matching key exists |
|
Return the number of matching keys |
|
Return true if there are no params |
|
Return an iterator to the end |
|
Find a matching key |
|
Find a matching key |
|
Assignment |
|
|
Constructor |
Return the number of params |
Static Member Functions
Name |
Description |
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.
boost::urls::params_view::params_view
Members
Constructor
params_view() = default;
» more...
Constructor
constexpr
params_view(params_view const& other) = default;
» more...
Constructor
params_view(
params_view const& other,
encoding_opts opt) noexcept;
» more...
Constructor
params_view(core::string_view s);
» more...
Constructor
params_view(
core::string_view s,
encoding_opts opt);
» more...
boost::urls::params_view::operator=
Synopsis
Declared in header <boost/url/params_view.hpp>
params_view&
operator=(params_view const&) = default;
Description
After assignment, both views reference the same underlying character buffer.
Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.
Postconditions
this->buffer().data() == other.buffer().data()
Complexity
Constant
Exception Safety
Throws nothing
boost::urls::params_encoded_view
Synopsis
Declared in header <boost/url/params_encoded_view.hpp>
class params_encoded_view
: public params_encoded_base;
Types
Name |
Description |
The reference type |
|
A signed integer type used to represent differences. |
|
The reference type |
|
An unsigned integer type to represent sizes. |
|
The value type |
Member Functions
Name |
Description |
Return an iterator to the beginning |
|
Return the query corresponding to these params |
|
Return true if a matching key exists |
|
Return the number of matching keys |
|
Return true if there are no params |
|
Return an iterator to the end |
|
Find a matching key |
|
Find a matching key |
|
Conversion |
|
Assignment |
|
|
Constructor |
Return the number of params |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Friends
Name |
Description |
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.
boost::urls::params_encoded_view::params_encoded_view
Members
Constructor
constexpr
params_encoded_view() = default;
» more...
Constructor
constexpr
params_encoded_view(params_encoded_view const& other) = default;
» more...
Constructor
params_encoded_view(core::string_view s);
» more...
boost::urls::params_encoded_view::operator=
Synopsis
Declared in header <boost/url/params_encoded_view.hpp>
constexpr
params_encoded_view&
operator=(params_encoded_view const&) = default;
Description
After assignment, both views reference the same underlying character buffer.
Ownership is not transferred; the caller is responsible for ensuring the lifetime of the buffer extends until it is no longer referenced.
Postconditions
this->buffer().data() == other.buffer().data()
Complexity
Constant
Exception Safety
Throws nothing
boost::urls::params_encoded_view::operator params_view
Synopsis
Declared in header <boost/url/params_encoded_view.hpp>
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
boost::urls::parse_query
Synopsis
Declared in header <boost/url/params_encoded_view.hpp>
friend
system::result<params_encoded_view>
parse_query(core::string_view s) noexcept;
boost::urls::parse_query
Synopsis
Declared in header <boost/url/parse_query.hpp>
system::result<params_encoded_view>
parse_query(core::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
A valid view on success, otherwise an error code.
Parameters
Name | Description |
---|---|
s |
The string to parse |
See Also
boost::urls::url_base
Synopsis
Declared in header <boost/url/url_base.hpp>
class url_base
: public url_view_base;
Member Functions
Name |
Description |
Return the authority |
|
Return the url string |
|
Return the url as a null-terminated string |
|
Return the number of characters that can be stored without reallocating |
|
Clear the contents while preserving the capacity |
|
Return the result of comparing this with another url |
|
Return a pointer to the url’s character buffer |
|
Return true if the url is empty |
|
Return the authority. |
|
Return the fragment |
|
Return the host |
|
Return the host |
|
Return the host and port |
|
Return the host name |
|
Return the origin |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return the query |
|
Return the resource |
|
Return the path as a container of segments |
|
Return the target |
|
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
|
Return the fragment |
|
Return true if an authority is present |
|
Return true if a fragment is present |
|
Return true if a password is present |
|
Return true if a port is present |
|
Return true if a query is present |
|
Return true a scheme is present |
|
Return true if a userinfo is present |
|
Return the host |
|
Return the host |
|
Return the host IPv4 address |
|
Return the host IPv6 address |
|
Return the host IPvFuture address |
|
Return the host name |
|
Return the host type |
|
Return true if the path is absolute |
|
Normalize the URL components |
|
Normalize the URL authority |
|
Normalize the URL fragment |
|
Normalize the URL path |
|
Normalize the URL query |
|
Normalize the URL scheme |
|
Return the URL as a core::string_view |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return a shared, persistent copy of the url |
|
Return the port |
|
Return the port |
|
Return the query |
|
Remove the authority |
|
Remove the fragment |
|
Remove the origin component |
|
Remove the password |
|
Remove the port |
|
Remove the query |
|
Remove the scheme |
|
Remove the userinfo |
|
Adjust the capacity without changing the size |
|
Resolve a URL reference against this base URL |
|
Return the scheme |
|
Return the scheme |
|
Return the path as a container of segments |
|
Set the authority |
|
Set the fragment. |
|
Set the host |
|
Set the host to an address |
|
Set the host to a name |
|
Set the query params |
|
Set the password. |
|
Set the path. |
|
Set the query |
|
Set the user |
|
Set the userinfo. |
|
Set the fragment. |
|
Set the host |
|
Set the host to an address |
|
Set the host to an address |
|
Set the host to an address |
|
Set the host to an address |
|
Set the host to a name |
|
Set the query params |
|
Set the password. |
|
Set the path. |
|
Set if the path is absolute |
|
Set the port |
|
Set the port |
|
Set the query |
|
Set the scheme |
|
Set the user |
|
Set the userinfo |
|
Return the number of characters in the url |
|
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Friends
Name |
Description |
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
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
boost::urls::url_base::c_str
Synopsis
Declared in header <boost/url/url_base.hpp>
char const*
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.
boost::urls::url_base::capacity
Synopsis
Declared in header <boost/url/url_base.hpp>
std::size_t
capacity() const noexcept;
Description
This does not include the null terminator, which is always present.
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::url_base::clear
Synopsis
Declared in header <boost/url/url_base.hpp>
void
clear() noexcept;
Description
Postconditions
this->empty() == true
Complexity
Constant.
Exception Safety
No-throw guarantee.
boost::urls::url_base::reserve
Synopsis
Declared in header <boost/url/url_base.hpp>
void
reserve(std::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.
Exceptions
Name | Thrown on |
---|---|
|
Allocation failure |
Parameters
Name | Description |
---|---|
n |
The capacity in characters, excluding any null terminator. |
boost::urls::url_base::set_scheme
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_scheme(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The scheme to set. |
See Also
boost::urls::url_base::set_scheme_id
Synopsis
Declared in header <boost/url/url_base.hpp>
boost::urls::url_base::remove_scheme
Synopsis
Declared in header <boost/url/url_base.hpp>
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
See Also
boost::urls::url_base::set_encoded_authority
Synopsis
Declared in header <boost/url/url_base.hpp>
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
Specification
Exceptions
Name | Thrown on |
---|---|
|
The string contains an invalid percent-encoding. |
Parameters
Name | Description |
---|---|
s |
The authority string to set. |
See Also
boost::urls::url_base::remove_authority
Synopsis
Declared in header <boost/url/url_base.hpp>
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
Specification
See Also
boost::urls::url_base::set_userinfo
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_userinfo(core::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.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
Example
assert( url( "http://example.com" ).set_userinfo( "user:pass" ).encoded_user() == "user" );
Complexity
Linear in this->size() + s.size()
.
Exception Safety
Strong guarantee. Calls to allocate may throw.
BNF
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_encoded_userinfo
Synopsis
Declared in header <boost/url/url_base.hpp>
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.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
Example
assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" );
Complexity
Linear in this->size() + s.size()
.
Exception Safety
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
BNF
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::remove_userinfo
Synopsis
Declared in header <boost/url/url_base.hpp>
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 / ":" )
Specification
See Also
boost::urls::url_base::set_user
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_user(core::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 / ":" )
Specification
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_encoded_user
Synopsis
Declared in header <boost/url/url_base.hpp>
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 / ":" )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_password
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_password(core::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 / ":" )
Specification
Parameters
Name | Description |
---|---|
s |
The string to set. This string may contain any characters, including nulls. |
See Also
boost::urls::url_base::set_encoded_password
Synopsis
Declared in header <boost/url/url_base.hpp>
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 / ":" )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. This string may contain any characters, including nulls. |
See Also
boost::urls::url_base::remove_password
Synopsis
Declared in header <boost/url/url_base.hpp>
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 / ":" )
Specification
See Also
boost::urls::url_base::set_host
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_host(core::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 / "-" / ".")
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_encoded_host
Synopsis
Declared in header <boost/url/url_base.hpp>
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 / "-" / ".")
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_host_address
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_host_address(core::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 / "-" / ".")
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_encoded_host_address
Synopsis
Declared in header <boost/url/url_base.hpp>
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 / "-" / ".")
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_host_ipv4
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_host_ipv4(ipv4_address const& 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
Specification
Parameters
Name | Description |
---|---|
addr |
The address to set. |
See Also
boost::urls::url_base::set_host_ipv6
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_host_ipv6(ipv6_address const& 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
Parameters
Name | Description |
---|---|
addr |
The address to set. |
See Also
boost::urls::url_base::set_host_ipvfuture
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_host_ipvfuture(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_host_name
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_host_name(core::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
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_encoded_host_name
Synopsis
Declared in header <boost/url/url_base.hpp>
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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_port_number
Synopsis
Declared in header <boost/url/url_base.hpp>
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
Parameters
Name | Description |
---|---|
n |
The port number to set. |
See Also
remove_port , set_port .
boost::urls::url_base::set_port
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_port(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The port string to set. |
See Also
remove_port , set_port .
boost::urls::url_base::remove_port
Synopsis
Declared in header <boost/url/url_base.hpp>
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
See Also
set_port .
boost::urls::url_base::set_path_absolute
Synopsis
Declared in header <boost/url/url_base.hpp>
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
true on success.
See Also
boost::urls::url_base::set_path
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_path(core::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
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_encoded_path
Synopsis
Declared in header <boost/url/url_base.hpp>
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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::segments
Members
Return the path as a container of segments
urls::segments_ref
segments() noexcept;
» more...
Return the path as a container of segments
segments_view
segments() const noexcept;
» more...
boost::urls::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...
boost::urls::url_base::set_query
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_query(core::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 )
Specification
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_encoded_query
Synopsis
Declared in header <boost/url/url_base.hpp>
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 )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
encoded_params , params , remove_query , set_query .
boost::urls::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...
boost::urls::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...
boost::urls::url_base::set_params
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_params(std::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
-
link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 >3.4. Query (rfc3986)</a> @li <a href=[://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)]
Parameters
Name | Description |
---|---|
ps |
The params to set. |
See Also
boost::urls::url_base::set_encoded_params
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_encoded_params(std::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 )
Specification
Exceptions
Name | Thrown on |
---|---|
|
some element in |
Parameters
Name | Description |
---|---|
ps |
The params to set. |
See Also
set_params , params , remove_query , set_encoded_query , set_query .
boost::urls::url_base::remove_query
Synopsis
Declared in header <boost/url/url_base.hpp>
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 )
Specification
See Also
boost::urls::url_base::remove_fragment
Synopsis
Declared in header <boost/url/url_base.hpp>
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
See Also
boost::urls::url_base::set_fragment
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
set_fragment(core::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
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::set_encoded_fragment
Synopsis
Declared in header <boost/url/url_base.hpp>
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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url_base::remove_origin
Synopsis
Declared in header <boost/url/url_base.hpp>
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.
boost::urls::url_base::normalize
Synopsis
Declared in header <boost/url/url_base.hpp>
url_base&
normalize();
Description
Applies Syntax-based normalization to all components of the URL.
Exception Safety
Strong guarantee. Calls to allocate may throw.
Specification
boost::urls::url_base::normalize_scheme
Synopsis
Declared in header <boost/url/url_base.hpp>
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.
Specification
boost::urls::url_base::normalize_authority
Synopsis
Declared in header <boost/url/url_base.hpp>
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.
Specification
boost::urls::url_base::normalize_path
Synopsis
Declared in header <boost/url/url_base.hpp>
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.
Specification
boost::urls::url_base::normalize_query
Synopsis
Declared in header <boost/url/url_base.hpp>
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.
Specification
boost::urls::url_base::normalize_fragment
Synopsis
Declared in header <boost/url/url_base.hpp>
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.
Specification
boost::urls::url_base::resolve
Synopsis
Declared in header <boost/url/url_base.hpp>
system::result<void>
resolve(url_view_base const& 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.
Note
|
Abnormal hrefs where the number of ".." segments exceeds the number of segments in the base path are handled by including the unmatched ".." segments in the result, as described in Errata 4547 . |
Example
url base1( "/one/two/three" );
base1.resolve("four");
assert( base1.buffer() == "/one/two/four" );
url base2( "http://example.com/" )
base2.resolve("/one");
assert( base2.buffer() == "http://example.com/one" );
url base3( "http://example.com/one" );
base3.resolve("/two");
assert( base3.buffer() == "http://example.com/two" );
url base4( "http://a/b/c/d;p?q" );
base4.resolve("g#s");
assert( base4.buffer() == "http://a/b/c/g#s" );
BNF
absolute-URI = scheme ":" hier-part [ "?" query ]
Exception Safety
Basic guarantee. Calls to allocate may throw.
Specification
Return Value
An empty
result
upon success,
otherwise an error code if !base.has_scheme()
.
Parameters
Name | Description |
---|---|
ref |
The URL reference to resolve. |
boost::urls::resolve
Synopsis
Declared in header <boost/url/url_base.hpp>
friend
system::result<void>
resolve(
url_view_base const& base,
url_view_base const& ref,
url_base& dest);
boost::urls::params_encoded_ref
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
class params_encoded_ref
: public params_encoded_base;
Types
Name |
Description |
The reference type |
|
A signed integer type used to represent differences. |
|
The reference type |
|
An unsigned integer type to represent sizes. |
|
The value type |
Member Functions
Name |
Description |
Append params |
|
Assign params |
|
Return an iterator to the beginning |
|
Return the query corresponding to these params |
|
Clear the contents of the container |
|
Return true if a matching key exists |
|
Return the number of matching keys |
|
Return true if there are no params |
|
Return an iterator to the end |
|
Erase params |
|
Find a matching key |
|
Find a matching key |
|
Insert params |
|
Conversion |
|
Assignment |
|
|
Constructor |
Replace params |
|
Set a value |
|
Return the number of params |
|
Remove the value on an element |
|
Return the referenced url |
Static Member Functions
Name |
Description |
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:
boost::urls::params_encoded_ref::params_encoded_ref
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
constexpr
params_encoded_ref(params_encoded_ref const& 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.
Parameters
Name | Description |
---|---|
other |
The other view. |
boost::urls::params_encoded_ref::operator=
Members
Assignment
params_encoded_ref&
operator=(params_encoded_ref const& other);
» more...
Assignment
params_encoded_ref&
operator=(std::initializer_list<param_pct_view> init);
» more...
boost::urls::params_encoded_ref::operator params_encoded_view
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
operator params_encoded_view() const noexcept;
Description
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::params_encoded_ref::url
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
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.
boost::urls::params_encoded_ref::clear
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
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.
boost::urls::params_encoded_ref::assign
Members
Assign params
void
assign(std::initializer_list<param_pct_view> init);
» more...
Assign params
template<class FwdIt>
void
assign(
FwdIt first,
FwdIt last);
» more...
boost::urls::params_encoded_ref::append
Members
Append params
iterator
append(param_pct_view const& p);
» more...
Append params
iterator
append(std::initializer_list<param_pct_view> init);
» more...
Append params
template<class FwdIt>
iterator
append(
FwdIt first,
FwdIt last);
» more...
boost::urls::params_encoded_ref::insert
Members
Insert params
iterator
insert(
iterator before,
param_pct_view const& p);
» more...
Insert params
iterator
insert(
iterator before,
std::initializer_list<param_pct_view> init);
» more...
Insert params
template<class FwdIt>
iterator
insert(
iterator before,
FwdIt first,
FwdIt last);
» more...
boost::urls::params_encoded_ref::erase
Members
Erase params
iterator
erase(iterator pos) noexcept;
» more...
Erase params
iterator
erase(
iterator first,
iterator last) noexcept;
» more...
Erase params
std::size_t
erase(
pct_string_view key,
ignore_case_param ic = = {}) noexcept;
» more...
boost::urls::params_encoded_ref::replace
Members
Replace params
iterator
replace(
iterator pos,
param_pct_view const& p);
» more...
Replace params
iterator
replace(
iterator from,
iterator to,
std::initializer_list<param_pct_view> init);
» more...
Replace params
template<class FwdIt>
iterator
replace(
iterator from,
iterator to,
FwdIt first,
FwdIt last);
» more...
boost::urls::params_encoded_ref::unset
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
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
An iterator to the element.
Parameters
Name | Description |
---|---|
pos |
An iterator to the element. |
boost::urls::params_encoded_ref::set
Members
Set a value
iterator
set(
iterator pos,
pct_string_view value);
» more...
Set a value
iterator
set(
pct_string_view key,
pct_string_view value,
ignore_case_param ic = = {});
» more...
boost::urls::segments_encoded_ref
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
class segments_encoded_ref
: public segments_encoded_base;
Types
Name |
Description |
The reference type |
|
A signed integer type used to represent differences. |
|
The reference type |
|
An unsigned integer type used to represent size. |
|
The value type |
Member Functions
Name |
Description |
Assign segments |
|
Return the last segment |
|
Return an iterator to the beginning |
|
Return the referenced character buffer. |
|
Clear the contents of the container |
|
Return true if there are no segments |
|
Return an iterator to the end |
|
Erase segments |
|
Return the first segment |
|
Insert segments |
|
Returns true if this references an absolute path. |
|
Conversion |
|
Assignment |
|
Remove the last segment |
|
Append a segment |
|
Replace segments |
|
|
Constructor |
Return the number of segments |
|
Return the referenced url |
Static Member Functions
Name |
Description |
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:
See Also
boost::urls::segments_encoded_ref::segments_encoded_ref
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
constexpr
segments_encoded_ref(segments_encoded_ref const& 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.
Parameters
Name | Description |
---|---|
other |
The other view. |
boost::urls::segments_encoded_ref::operator=
Members
Assignment
segments_encoded_ref&
operator=(segments_encoded_ref const& other);
» more...
segments_encoded_ref&
operator=(segments_encoded_view const& other);
» more...
Assignment
segments_encoded_ref&
operator=(std::initializer_list<pct_string_view> init);
» more...
boost::urls::segments_encoded_ref::operator segments_encoded_view
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
operator segments_encoded_view() const noexcept;
See Also
boost::urls::segments_encoded_ref::url
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
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.
boost::urls::segments_encoded_ref::clear
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
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.
boost::urls::segments_encoded_ref::assign
Members
Assign segments
void
assign(std::initializer_list<pct_string_view> init);
» more...
Assign segments
template<class FwdIt>
void
assign(
FwdIt first,
FwdIt last);
» more...
boost::urls::segments_encoded_ref::insert
Members
Insert segments
iterator
insert(
iterator before,
pct_string_view s);
» more...
Insert segments
iterator
insert(
iterator before,
std::initializer_list<pct_string_view> init);
» more...
Insert segments
template<class FwdIt>
iterator
insert(
iterator before,
FwdIt first,
FwdIt last);
» more...
boost::urls::segments_encoded_ref::erase
Members
Erase segments
iterator
erase(iterator pos) noexcept;
» more...
Erase segments
iterator
erase(
iterator first,
iterator last) noexcept;
» more...
boost::urls::segments_encoded_ref::replace
Members
Replace segments
iterator
replace(
iterator pos,
pct_string_view s);
» more...
Replace segments
iterator
replace(
iterator from,
iterator to,
pct_string_view s);
» more...
Replace segments
iterator
replace(
iterator from,
iterator to,
std::initializer_list<pct_string_view> init);
» more...
Replace segments
template<class FwdIt>
iterator
replace(
iterator from,
iterator to,
FwdIt first,
FwdIt last);
» more...
boost::urls::segments_encoded_ref::push_back
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
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.
Exceptions
Name | Thrown on |
---|---|
|
The string contains an invalid percent-encoding. |
Parameters
Name | Description |
---|---|
s |
The segment to append. |
boost::urls::segments_encoded_ref::pop_back
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
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.
boost::urls::segments_ref
Synopsis
Declared in header <boost/url/segments_ref.hpp>
class segments_ref
: public segments_base;
Types
Name |
Description |
The reference type |
|
A signed integer type used to represent differences. |
|
The reference type |
|
An unsigned integer type used to represent size. |
|
The value type |
Member Functions
Name |
Description |
Assign segments |
|
Return the last segment |
|
Return an iterator to the beginning |
|
Return the referenced character buffer. |
|
Clear the contents of the container |
|
Return true if there are no segments |
|
Return an iterator to the end |
|
Erase segments |
|
Return the first segment |
|
Insert segments |
|
Returns true if this references an absolute path. |
|
Conversion |
|
Assignment |
|
Remove the last segment |
|
Append a segment |
|
Replace segments |
|
|
Constructor |
Return the number of segments |
|
Return the referenced url |
Static Member Functions
Name |
Description |
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:
See Also
boost::urls::segments_ref::segments_ref
Synopsis
Declared in header <boost/url/segments_ref.hpp>
constexpr
segments_ref(segments_ref const& 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.
Parameters
Name | Description |
---|---|
other |
The other view. |
boost::urls::segments_ref::operator=
Members
Assignment
segments_ref&
operator=(segments_ref const& other);
» more...
segments_ref&
operator=(segments_view const& other);
» more...
Assignment
segments_ref&
operator=(std::initializer_list<core::string_view> init);
» more...
boost::urls::segments_ref::operator segments_view
Synopsis
Declared in header <boost/url/segments_ref.hpp>
operator segments_view() const noexcept;
See Also
boost::urls::segments_ref::url
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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.
boost::urls::segments_ref::clear
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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.
boost::urls::segments_ref::assign
Members
Assign segments
void
assign(std::initializer_list<core::string_view> init);
» more...
Assign segments
template<class FwdIt>
void
assign(
FwdIt first,
FwdIt last);
» more...
boost::urls::segments_ref::insert
Members
Insert segments
iterator
insert(
iterator before,
core::string_view s);
» more...
Insert segments
iterator
insert(
iterator before,
std::initializer_list<core::string_view> init);
» more...
Insert segments
template<class FwdIt>
iterator
insert(
iterator before,
FwdIt first,
FwdIt last);
» more...
boost::urls::segments_ref::erase
Members
Erase segments
iterator
erase(iterator pos) noexcept;
» more...
Erase segments
iterator
erase(
iterator first,
iterator last) noexcept;
» more...
boost::urls::segments_ref::replace
Members
Replace segments
iterator
replace(
iterator pos,
core::string_view s);
» more...
Replace segments
iterator
replace(
iterator from,
iterator to,
core::string_view s);
» more...
Replace segments
Replace segments
template<class FwdIt>
iterator
replace(
iterator from,
iterator to,
FwdIt first,
FwdIt last);
» more...
boost::urls::segments_ref::push_back
Synopsis
Declared in header <boost/url/segments_ref.hpp>
void
push_back(core::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.
Parameters
Name | Description |
---|---|
s |
The segment to append. |
boost::urls::segments_ref::pop_back
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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.
boost::urls::url_view_base
Synopsis
Declared in header <boost/url/url_view_base.hpp>
class url_view_base;
Member Functions
Name |
Description |
Return the authority |
|
Return the url string |
|
Return the result of comparing this with another url |
|
Return a pointer to the url’s character buffer |
|
Return true if the url is empty |
|
Return the authority. |
|
Return the fragment |
|
Return the host |
|
Return the host |
|
Return the host and port |
|
Return the host name |
|
Return the origin |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return the query |
|
Return the resource |
|
Return the path as a container of segments |
|
Return the target |
|
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
|
Return the fragment |
|
Return true if an authority is present |
|
Return true if a fragment is present |
|
Return true if a password is present |
|
Return true if a port is present |
|
Return true if a query is present |
|
Return true a scheme is present |
|
Return true if a userinfo is present |
|
Return the host |
|
Return the host |
|
Return the host IPv4 address |
|
Return the host IPv6 address |
|
Return the host IPvFuture address |
|
Return the host name |
|
Return the host type |
|
Return true if the path is absolute |
|
Return the URL as a core::string_view |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return a shared, persistent copy of the url |
|
Return the port |
|
Return the port |
|
Return the query |
|
Return the scheme |
|
Return the scheme |
|
Return the path as a container of segments |
|
Return the number of characters in the url |
|
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Friends
Name |
Description |
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
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
boost::urls::url_view_base::digest
Synopsis
Declared in header <boost/url/url_view_base.hpp>
boost::urls::url_view_base::max_size
Synopsis
Declared in header <boost/url/url_view_base.hpp>
constexpr
static
std::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.
boost::urls::url_view_base::size
Synopsis
Declared in header <boost/url/url_view_base.hpp>
std::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.
boost::urls::url_view_base::empty
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
Specification
boost::urls::url_view_base::data
Synopsis
Declared in header <boost/url/url_view_base.hpp>
char const*
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.
boost::urls::url_view_base::buffer
Synopsis
Declared in header <boost/url/url_view_base.hpp>
core::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.
boost::urls::url_view_base::operator core::string_view
Synopsis
Declared in header <boost/url/url_view_base.hpp>
operator core::string_view() const noexcept;
Description
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::url_view_base::persist
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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.
boost::urls::url_view_base::has_scheme
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
boost::urls::url_view_base::scheme
Synopsis
Declared in header <boost/url/url_view_base.hpp>
core::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
See Also
has_scheme , scheme_id .
boost::urls::url_view_base::scheme_id
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
See Also
has_scheme , scheme .
boost::urls::url_view_base::has_authority
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
See Also
boost::urls::url_view_base::authority
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
See Also
boost::urls::url_view_base::encoded_authority
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
See Also
boost::urls::url_view_base::has_userinfo
Synopsis
Declared in header <boost/url/url_view_base.hpp>
bool
has_userinfo() const noexcept;
Description
This function returns true if this contains a userinfo.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
userinfo = user [ ":" [ password ] ]
authority = [ userinfo "@" ] host [ ":" port ]
Specification
See Also
has_password , encoded_password , encoded_user , encoded_userinfo , password , user , userinfo .
boost::urls::url_view_base::has_password
Synopsis
Declared in header <boost/url/url_view_base.hpp>
bool
has_password() const noexcept;
Description
This function returns true if the userinfo is present and contains a password.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also
has_userinfo , encoded_password , encoded_user , encoded_userinfo , password , user , userinfo .
boost::urls::url_view_base::userinfo
Synopsis
Declared in header <boost/url/url_view_base.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
userinfo(StringToken&& token) const;
Description
If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.
Note
|
This function uses the string token return type customization. Depending on the token passed, the return type and behavior of the function can be different. See string_token::return_string for more information. |
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" );
Complexity
Linear in this->userinfo().size()
.
Exception Safety
Calls to allocate may throw.
BNF
userinfo = user [ ":" [ password ] ]
authority = [ userinfo "@" ] host [ ":" port ]
Specification
Return Value
When called with no arguments,
a value of type std::string
is
returned. Otherwise, the return type
and meaning depends on the string token
passed to the function.
See Also
has_password , has_userinfo , encoded_password , encoded_user , encoded_userinfo , password , user .
boost::urls::url_view_base::encoded_userinfo
Synopsis
Declared in header <boost/url/url_view_base.hpp>
pct_string_view
encoded_userinfo() const noexcept;
Description
If present, this function returns a string representing the userinfo (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" );
Complexity
Constant.
Exception Safety
Throws nothing
BNF
userinfo = user [ ":" [ password ] ]
authority = [ userinfo "@" ] host [ ":" port ]
Specification
See Also
has_password , has_userinfo , encoded_password , encoded_user , password , user , userinfo .
boost::urls::url_view_base::user
Synopsis
Declared in header <boost/url/url_view_base.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
user(StringToken&& token) const;
Description
If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );
Complexity
Linear in this->user().size()
.
Exception Safety
Calls to allocate may throw.
BNF
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also
boost::urls::url_view_base::encoded_user
Synopsis
Declared in header <boost/url/url_view_base.hpp>
pct_string_view
encoded_user() const noexcept;
Description
If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. The returned string may contain percent escapes.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also
has_password , has_userinfo , encoded_password , encoded_userinfo , password , user , userinfo .
boost::urls::url_view_base::password
Synopsis
Declared in header <boost/url/url_view_base.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
password(StringToken&& token) const;
Description
If present, this function returns a string representing the password (which may be an empty string). Otherwise it returns an empty string. Any percent-escapes in the string are decoded first.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" );
Complexity
Linear in this->password().size()
.
Exception Safety
Calls to allocate may throw.
BNF
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also
has_password , has_userinfo , encoded_password , encoded_user , encoded_userinfo , user , userinfo .
boost::urls::url_view_base::encoded_password
Synopsis
Declared in header <boost/url/url_view_base.hpp>
pct_string_view
encoded_password() const noexcept;
Description
This function returns the password portion of the userinfo as a percent-encoded string.
Example
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also
has_password , has_userinfo , encoded_user , encoded_userinfo , password , user , userinfo .
boost::urls::url_view_base::host_type
Synopsis
Declared in header <boost/url/url_view_base.hpp>
Description
This function returns one of the following constants representing the type of host present.
When has_authority is false, the host type is host_type::none .
Example
assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );
Complexity
Constant.
Exception Safety
Throws nothing.
Specification
boost::urls::url_view_base::host
Synopsis
Declared in header <boost/url/url_view_base.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
host(StringToken&& token) const;
Description
This function returns the host portion of the authority as a string, or the empty string if there is no authority. Any percent-escapes in the string are decoded first.
Example
assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" );
Complexity
Linear in this->host().size()
.
Exception Safety
Calls to allocate may throw.
BNF
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Specification
boost::urls::url_view_base::encoded_host
Synopsis
Declared in header <boost/url/url_view_base.hpp>
pct_string_view
encoded_host() const noexcept;
Description
This function returns the host portion of the authority as a string, or the empty string if there is no authority. The returned string may contain percent escapes.
Example
assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Specification
boost::urls::url_view_base::host_address
Synopsis
Declared in header <boost/url/url_view_base.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
host_address(StringToken&& token) const;
Description
The value returned by this function depends on the type of host returned from the function host_type .
-
If the type is host_type::ipv4 , then the IPv4 address string is returned.
-
If the type is host_type::ipv6 , then the IPv6 address string is returned, without any enclosing brackets.
-
If the type is host_type::ipvfuture , then the IPvFuture address string is returned, without any enclosing brackets.
-
If the type is host_type::name , then the host name string is returned. Any percent-escapes in the string are decoded first.
-
If the type is host_type::none , then an empty string is returned.
Example
assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" );
Complexity
Linear in this->host_address().size()
.
Exception Safety
Calls to allocate may throw.
BNF
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Specification
boost::urls::url_view_base::encoded_host_address
Synopsis
Declared in header <boost/url/url_view_base.hpp>
pct_string_view
encoded_host_address() const noexcept;
Description
The value returned by this function depends on the type of host returned from the function host_type .
-
If the type is host_type::ipv4 , then the IPv4 address string is returned.
-
If the type is host_type::ipv6 , then the IPv6 address string is returned, without any enclosing brackets.
-
If the type is host_type::ipvfuture , then the IPvFuture address string is returned, without any enclosing brackets.
-
If the type is host_type::name , then the host name string is returned. Any percent-escapes in the string are decoded first.
-
If the type is host_type::none , then an empty string is returned. The returned string may contain percent escapes.
Example
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Specification
boost::urls::url_view_base::host_ipv4_address
Synopsis
Declared in header <boost/url/url_view_base.hpp>
ipv4_address
host_ipv4_address() const noexcept;
Description
If the host type is host_type::ipv4 , this function returns the address as a value of type ipv4_address . Otherwise, if the host type is not an IPv4 address, it returns a default-constructed value which is equal to the unspecified address "0.0.0.0".
Example
assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
dec-octet = DIGIT ; 0-9
/ %x31-39 DIGIT ; 10-99
/ "1" 2DIGIT ; 100-199
/ "2" %x30-34 DIGIT ; 200-249
/ "25" %x30-35 ; 250-255
Specification
boost::urls::url_view_base::host_ipv6_address
Synopsis
Declared in header <boost/url/url_view_base.hpp>
ipv6_address
host_ipv6_address() const noexcept;
Description
If the host type is host_type::ipv6 , this function returns the address as a value of type ipv6_address . Otherwise, if the host type is not an IPv6 address, it returns a default-constructed value which is equal to the unspecified address "0:0:0:0:0:0:0:0".
Example
assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
IPv6address = 6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32
/ [ h16 ] "::" 4( h16 ":" ) ls32
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
/ [ *4( h16 ":" ) h16 ] "::" ls32
/ [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::"
ls32 = ( h16 ":" h16 ) / IPv4address
; least-significant 32 bits of address
h16 = 1*4HEXDIG
; 16 bits of address represented in hexadecimal
Specification
boost::urls::url_view_base::host_ipvfuture
Synopsis
Declared in header <boost/url/url_view_base.hpp>
core::string_view
host_ipvfuture() const noexcept;
Description
If the host type is host_type::ipvfuture , this function returns the address as a string. Otherwise, if the host type is not an IPvFuture address, it returns an empty string.
Example
assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
Specification
boost::urls::url_view_base::host_name
Synopsis
Declared in header <boost/url/url_view_base.hpp>
template<class StringToken = string_token::return_string>
StringToken::result_type
host_name(StringToken&& token) const;
Description
If the host type is host_type::name , this function returns the name as a string. Otherwise 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
boost::urls::url_view_base::encoded_host_name
Synopsis
Declared in header <boost/url/url_view_base.hpp>
pct_string_view
encoded_host_name() const noexcept;
Description
If the host type is host_type::name , this function returns the name as a string. Otherwise, if the host type is not an name, it returns an empty string. The returned string may contain percent escapes.
Example
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Specification
boost::urls::url_view_base::zone_id
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
boost::urls::url_view_base::encoded_zone_id
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
boost::urls::url_view_base::has_port
Synopsis
Declared in header <boost/url/url_view_base.hpp>
bool
has_port() const noexcept;
Description
This function returns true if an authority is present and contains a port.
Example
assert( url_view( "wss://www.example.com:443" ).has_port() );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
authority = [ userinfo "@" ] host [ ":" port ]
port = *DIGIT
Specification
See Also
boost::urls::url_view_base::port
Synopsis
Declared in header <boost/url/url_view_base.hpp>
core::string_view
port() const noexcept;
Description
If present, this function returns a string representing the port (which may be empty). Otherwise it returns an empty string.
Example
assert( url_view( "http://localhost.com:8080" ).port() == "8080" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
port = *DIGIT
Specification
See Also
boost::urls::url_view_base::port_number
Synopsis
Declared in header <boost/url/url_view_base.hpp>
std::uint16_t
port_number() const noexcept;
Description
If a port is present and the numerical value is representable, it is returned as an unsigned integer. Otherwise, the number zero is returned.
Example
assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
port = *DIGIT
Specification
See Also
boost::urls::url_view_base::is_path_absolute
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
See Also
encoded_path , encoded_segments . path , segments .
boost::urls::url_view_base::path
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
See Also
boost::urls::url_view_base::encoded_path
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
See Also
is_path_absolute , encoded_segments . path , segments .
boost::urls::url_view_base::segments
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
See Also
boost::urls::url_view_base::encoded_segments
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
See Also
boost::urls::url_view_base::has_query
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
-
link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 >3.4. Query (rfc3986)</a> @li <a href=[://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)]
See Also
encoded_params , encoded_query , params , query .
boost::urls::url_view_base::query
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
-
link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 >3.4. Query (rfc3986)</a> @li <a href=[://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)]
See Also
encoded_params , encoded_query , has_query , params .
boost::urls::url_view_base::encoded_query
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
-
link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 >3.4. Query (rfc3986)</a> @li <a href=[://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)]
See Also
encoded_params , has_query , params , query .
boost::urls::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...
boost::urls::url_view_base::encoded_params
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
-
link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 >3.4. Query (rfc3986)</a> @li <a href=[://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)]
See Also
encoded_query , has_query , params , query .
boost::urls::url_view_base::has_fragment
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
See Also
boost::urls::url_view_base::fragment
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
Parameters
Name | Description |
---|---|
token |
An optional string token to
use. If this parameter is omitted, the
function returns a new |
See Also
boost::urls::url_view_base::encoded_fragment
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
See Also
fragment , has_fragment .
boost::urls::url_view_base::encoded_host_and_port
Synopsis
Declared in header <boost/url/url_view_base.hpp>
pct_string_view
encoded_host_and_port() const noexcept;
Description
If an authority is present, this function returns the host and optional port as a string, which may be empty. Otherwise it returns an empty string. The returned string may contain percent escapes.
Example
assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" );
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
authority = [ userinfo "@" ] host [ ":" port ]
Specification
See Also
has_port , port , port_number .
boost::urls::url_view_base::encoded_origin
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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.
See Also
boost::urls::url_view_base::encoded_resource
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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.
Specification
See Also
boost::urls::url_view_base::encoded_target
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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.
Specification
See Also
boost::urls::url_view_base::compare
Synopsis
Declared in header <boost/url/url_view_base.hpp>
int
compare(url_view_base const& 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.
Specification
Return Value
-1 if *this < other
, 0 if
this == other
, and 1 if this > other
.
boost::urls::operator==
Synopsis
Declared in header <boost/url/url_view_base.hpp>
friend
bool
operator==(
url_view_base const& u0,
url_view_base const& 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
Specification
boost::urls::operator!=
Synopsis
Declared in header <boost/url/url_view_base.hpp>
friend
bool
operator!=(
url_view_base const& u0,
url_view_base const& 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
Specification
boost::urls::operator<
Synopsis
Declared in header <boost/url/url_view_base.hpp>
friend
bool
operator<(
url_view_base const& u0,
url_view_base const& 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
Specification
boost::urls::operator⇐
Synopsis
Declared in header <boost/url/url_view_base.hpp>
friend
bool
operator<=(
url_view_base const& u0,
url_view_base const& 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
Specification
boost::urls::operator>
Synopsis
Declared in header <boost/url/url_view_base.hpp>
friend
bool
operator>(
url_view_base const& u0,
url_view_base const& 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
Specification
boost::urls::operator>=
Synopsis
Declared in header <boost/url/url_view_base.hpp>
friend
bool
operator>=(
url_view_base const& u0,
url_view_base const& 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
Specification
boost::urls::operator<<
Synopsis
Declared in header <boost/url/url_view_base.hpp>
friend
std::ostream&
operator<<(
std::ostream& os,
url_view_base const& u);
boost::urls::resolve
Synopsis
Declared in header <boost/url/url_base.hpp>
system::result<void>
resolve(
url_view_base const& base,
url_view_base const& 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.
Note
|
Abnormal hrefs where the number of ".." segments exceeds the number of segments in the base path are handled by including the unmatched ".." segments in the result, as described in Errata 4547 . |
Example
url dest;
system::error_code ec;
resolve("/one/two/three", "four", dest, ec);
assert( dest.str() == "/one/two/four" );
resolve("http://example.com/", "/one", dest, ec);
assert( dest.str() == "http://example.com/one" );
resolve("http://example.com/one", "/two", dest, ec);
assert( dest.str() == "http://example.com/two" );
resolve("http://a/b/c/d;p?q", "g#s", dest, ec);
assert( dest.str() == "http://a/b/c/g#s" );
BNF
absolute-URI = scheme ":" hier-part [ "?" query ]
Exception Safety
Basic guarantee. Calls to allocate may throw.
Specification
Return Value
An empty
result
upon success,
otherwise an error code if !base.has_scheme()
.
Parameters
Name | Description |
---|---|
base |
The base URL to resolve against. |
ref |
The URL reference to resolve. |
dest |
The container where the result is written, upon success. |
boost::urls::url
Synopsis
Declared in header <boost/url/url.hpp>
class url
: public url_base;
Member Functions
Name |
Description |
Return the authority |
|
Return the url string |
|
Return the url as a null-terminated string |
|
Return the number of characters that can be stored without reallocating |
|
Clear the contents while preserving the capacity |
|
Return the result of comparing this with another url |
|
Return a pointer to the url’s character buffer |
|
Return true if the url is empty |
|
Return the authority. |
|
Return the fragment |
|
Return the host |
|
Return the host |
|
Return the host and port |
|
Return the host name |
|
Return the origin |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return the query |
|
Return the resource |
|
Return the path as a container of segments |
|
Return the target |
|
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
|
Return the fragment |
|
Return true if an authority is present |
|
Return true if a fragment is present |
|
Return true if a password is present |
|
Return true if a port is present |
|
Return true if a query is present |
|
Return true a scheme is present |
|
Return true if a userinfo is present |
|
Return the host |
|
Return the host |
|
Return the host IPv4 address |
|
Return the host IPv6 address |
|
Return the host IPvFuture address |
|
Return the host name |
|
Return the host type |
|
Return true if the path is absolute |
|
Normalize the URL components |
|
Normalize the URL authority |
|
Normalize the URL fragment |
|
Normalize the URL path |
|
Normalize the URL query |
|
Normalize the URL scheme |
|
Return the URL as a core::string_view |
|
Assignment |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return a shared, persistent copy of the url |
|
Return the port |
|
Return the port |
|
Return the query |
|
Remove the authority |
|
Remove the fragment |
|
Remove the origin component |
|
Remove the password |
|
Remove the port |
|
Remove the query |
|
Remove the scheme |
|
Remove the userinfo |
|
Adjust the capacity without changing the size |
|
Resolve a URL reference against this base URL |
|
Return the scheme |
|
Return the scheme |
|
Return the path as a container of segments |
|
Set the authority |
|
Set the fragment. |
|
Set the host |
|
Set the host to an address |
|
Set the host to a name |
|
Set the query params |
|
Set the password. |
|
Set the path. |
|
Set the query |
|
Set the user |
|
Set the userinfo. |
|
Set the fragment. |
|
Set the host |
|
Set the host to an address |
|
Set the host to an address |
|
Set the host to an address |
|
Set the host to an address |
|
Set the host to a name |
|
Set the query params |
|
Set the password. |
|
Set the path. |
|
Set if the path is absolute |
|
Set the port |
|
Set the port |
|
Set the query |
|
Set the scheme |
|
Set the user |
|
Set the userinfo |
|
Return the number of characters in the url |
|
Swap the contents. |
|
|
Constructor |
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
|
|
Destructor |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Friends
Name |
Description |
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Swap |
Description
This container owns a url, represented by a null-terminated character buffer which is managed by performing dymamic memory allocations as needed. The contents may be inspected and modified, and the implementation maintains a useful invariant: changes to the url always leave it in a valid state.
Exception Safety
-
Functions marked
noexcept
provide the no-throw guarantee, otherwise: -
Functions which throw offer the strong exception safety guarantee.
BNF
URI-reference = URI / relative-ref
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
absolute-URI = scheme ":" hier-part [ "?" query ]
See Also
boost::urls::url::~url
Synopsis
Declared in header <boost/url/url.hpp>
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.
boost::urls::url::url
Members
Constructor
url() noexcept;
» more...
Constructor
explicit
url(core::string_view s);
» more...
Constructor
url(url&& u) noexcept;
» more...
Constructor
url(url_view_base const& u);
» more...
Constructor
url(url const& u);
» more...
boost::urls::url::operator=
Members
Assignment
url&
operator=(url&& u) noexcept;
» more...
Assignment
url&
operator=(url_view_base const& u);
» more...
Assignment
url&
operator=(url const& u);
» more...
boost::urls::url::swap
Synopsis
Declared in header <boost/url/url.hpp>
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.
Parameters
Name | Description |
---|---|
other |
The object to swap with |
boost::urls::swap
Synopsis
Declared in header <boost/url/url.hpp>
Description
Exchanges the contents of v0
with another v1
.
All views, iterators and references remain
valid.
If &v0 ==&v1
, 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
See Also
boost::urls::url::set_scheme
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_scheme(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The scheme to set. |
See Also
boost::urls::url::set_scheme_id
Synopsis
Declared in header <boost/url/url.hpp>
boost::urls::url::remove_scheme
Synopsis
Declared in header <boost/url/url.hpp>
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
See Also
boost::urls::url::set_encoded_authority
Synopsis
Declared in header <boost/url/url.hpp>
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
Specification
Exceptions
Name | Thrown on |
---|---|
|
The string contains an invalid percent-encoding. |
Parameters
Name | Description |
---|---|
s |
The authority string to set. |
See Also
boost::urls::url::remove_authority
Synopsis
Declared in header <boost/url/url.hpp>
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
Specification
See Also
boost::urls::url::set_userinfo
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_userinfo(core::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.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
Example
assert( url( "http://example.com" ).set_userinfo( "user:pass" ).encoded_user() == "user" );
Complexity
Linear in this->size() + s.size()
.
Exception Safety
Strong guarantee. Calls to allocate may throw.
BNF
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_encoded_userinfo
Synopsis
Declared in header <boost/url/url.hpp>
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.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
Example
assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" );
Complexity
Linear in this->size() + s.size()
.
Exception Safety
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
BNF
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::remove_userinfo
Synopsis
Declared in header <boost/url/url.hpp>
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 / ":" )
Specification
See Also
boost::urls::url::set_user
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_user(core::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 / ":" )
Specification
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_encoded_user
Synopsis
Declared in header <boost/url/url.hpp>
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 / ":" )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_password
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_password(core::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 / ":" )
Specification
Parameters
Name | Description |
---|---|
s |
The string to set. This string may contain any characters, including nulls. |
See Also
boost::urls::url::set_encoded_password
Synopsis
Declared in header <boost/url/url.hpp>
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 / ":" )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. This string may contain any characters, including nulls. |
See Also
boost::urls::url::remove_password
Synopsis
Declared in header <boost/url/url.hpp>
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 / ":" )
Specification
See Also
boost::urls::url::set_host
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_host(core::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 / "-" / ".")
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_encoded_host
Synopsis
Declared in header <boost/url/url.hpp>
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 / "-" / ".")
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_host_address
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_host_address(core::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 / "-" / ".")
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_encoded_host_address
Synopsis
Declared in header <boost/url/url.hpp>
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 / "-" / ".")
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_host_ipv4
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_host_ipv4(ipv4_address const& 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
Specification
Parameters
Name | Description |
---|---|
addr |
The address to set. |
See Also
boost::urls::url::set_host_ipv6
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_host_ipv6(ipv6_address const& 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
Parameters
Name | Description |
---|---|
addr |
The address to set. |
See Also
boost::urls::url::set_host_ipvfuture
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_host_ipvfuture(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_host_name
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_host_name(core::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
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_encoded_host_name
Synopsis
Declared in header <boost/url/url.hpp>
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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_port_number
Synopsis
Declared in header <boost/url/url.hpp>
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
Parameters
Name | Description |
---|---|
n |
The port number to set. |
See Also
remove_port , set_port .
boost::urls::url::set_port
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_port(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The port string to set. |
See Also
remove_port , set_port .
boost::urls::url::remove_port
Synopsis
Declared in header <boost/url/url.hpp>
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
See Also
set_port .
boost::urls::url::set_path
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_path(core::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
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_encoded_path
Synopsis
Declared in header <boost/url/url.hpp>
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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_query
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_query(core::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 )
Specification
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_encoded_query
Synopsis
Declared in header <boost/url/url.hpp>
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 )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
encoded_params , params , remove_query , set_query .
boost::urls::url::set_params
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_params(std::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
-
link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 >3.4. Query (rfc3986)</a> @li <a href=[://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)]
Parameters
Name | Description |
---|---|
ps |
The params to set. |
See Also
boost::urls::url::set_encoded_params
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_encoded_params(std::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 )
Specification
Exceptions
Name | Thrown on |
---|---|
|
some element in |
Parameters
Name | Description |
---|---|
ps |
The params to set. |
See Also
set_params , params , remove_query , set_encoded_query , set_query .
boost::urls::url::remove_query
Synopsis
Declared in header <boost/url/url.hpp>
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 )
Specification
See Also
boost::urls::url::remove_fragment
Synopsis
Declared in header <boost/url/url.hpp>
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
See Also
boost::urls::url::set_fragment
Synopsis
Declared in header <boost/url/url.hpp>
url&
set_fragment(core::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
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::set_encoded_fragment
Synopsis
Declared in header <boost/url/url.hpp>
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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::url::remove_origin
Synopsis
Declared in header <boost/url/url.hpp>
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.
boost::urls::url::normalize
Synopsis
Declared in header <boost/url/url.hpp>
url&
normalize();
Description
Applies Syntax-based normalization to all components of the URL.
Exception Safety
Strong guarantee. Calls to allocate may throw.
Specification
boost::urls::url::normalize_scheme
Synopsis
Declared in header <boost/url/url.hpp>
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.
Specification
boost::urls::url::normalize_authority
Synopsis
Declared in header <boost/url/url.hpp>
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.
Specification
boost::urls::url::normalize_path
Synopsis
Declared in header <boost/url/url.hpp>
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.
Specification
boost::urls::url::normalize_query
Synopsis
Declared in header <boost/url/url.hpp>
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.
Specification
boost::urls::url::normalize_fragment
Synopsis
Declared in header <boost/url/url.hpp>
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.
Specification
boost::urls::swap
Synopsis
Declared in header <boost/url/url.hpp>
Description
Exchanges the contents of v0
with another v1
.
All views, iterators and references remain
valid.
If &v0 ==&v1
, 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
Parameters
Name | Description |
---|---|
v0, |
v1 The objects to swap |
See Also
boost::urls::ipv4_address_rule_t
Synopsis
Declared in header <boost/url/rfc/ipv4_address_rule.hpp>
struct ipv4_address_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::ipv4_address_rule_t::value_type
Synopsis
Declared in header <boost/url/rfc/ipv4_address_rule.hpp>
using value_type = ipv4_address;
boost::urls::ipv4_address_rule_t::parse
Synopsis
Declared in header <boost/url/rfc/ipv4_address_rule.hpp>
system::result<ipv4_address>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::ipv4_address_rule
Synopsis
Declared in header <boost/url/rfc/ipv4_address_rule.hpp>
constexpr
ipv4_address_rule_t const ipv4_address_rule = {};
boost::urls::ipv6_address_rule_t
Synopsis
Declared in header <boost/url/rfc/ipv6_address_rule.hpp>
struct ipv6_address_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::ipv6_address_rule_t::value_type
Synopsis
Declared in header <boost/url/rfc/ipv6_address_rule.hpp>
using value_type = ipv6_address;
boost::urls::ipv6_address_rule_t::parse
Synopsis
Declared in header <boost/url/rfc/ipv6_address_rule.hpp>
system::result<ipv6_address>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::ipv6_address_rule
Synopsis
Declared in header <boost/url/rfc/ipv6_address_rule.hpp>
constexpr
ipv6_address_rule_t const ipv6_address_rule = {};
boost::urls::parse_absolute_uri
Synopsis
Declared in header <boost/url/parse.hpp>
Description
This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed.
Example
system::result< url_view > rv = parse_absolute_uri( "http://example.com/index.htm?id=1" );
BNF
absolute-URI = scheme ":" hier-part [ "?" query ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
A result containing a value or an error
Parameters
Name | Description |
---|---|
s |
The string to parse |
See Also
boost::urls::parse_origin_form
Synopsis
Declared in header <boost/url/parse.hpp>
Description
This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed.
Example
system::result< url_view > = parse_origin_form( "/index.htm?layout=mobile" );
BNF
origin-form = absolute-path [ "?" query ]
absolute-path = 1*( "/" segment )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
A result containing a value or an error
Parameters
Name | Description |
---|---|
s |
The string to parse |
See Also
boost::urls::parse_relative_ref
Synopsis
Declared in header <boost/url/parse.hpp>
Description
This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed.
Example
system::result< url_view > = parse_relative_ref( "images/dot.gif?v=hide#a" );
BNF
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-abempty
/ path-empty
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
A result containing a value or an error
Parameters
Name | Description |
---|---|
s |
The string to parse |
See Also
boost::urls::parse_uri
Synopsis
Declared in header <boost/url/parse.hpp>
Description
This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed.
Example
system::result< url_view > = parse_uri( "https://www.example.com/index.htm?id=guest#s1" );
BNF
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
A result containing a value or an error
Parameters
Name | Description |
---|---|
s |
The string to parse |
See Also
boost::urls::parse_uri_reference
Synopsis
Declared in header <boost/url/parse.hpp>
Description
This function parses a string according to the grammar below and returns a view referencing the passed string upon success, else returns an error. Ownership of the string is not transferred; the caller is responsible for ensuring that the lifetime of the character buffer extends until the view is no longer being accessed.
Example
system::result< url_view > = parse_uri_reference( "ws://echo.example.com/?name=boost#demo" );
BNF
URI-reference = URI / relative-ref
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-abempty
/ path-empty
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
A result containing a value or an error
Parameters
Name | Description |
---|---|
s |
The string to parse |
See Also
boost::urls::absolute_uri_rule_t
Synopsis
Declared in header <boost/url/rfc/absolute_uri_rule.hpp>
struct absolute_uri_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::absolute_uri_rule_t::value_type
Synopsis
Declared in header <boost/url/rfc/absolute_uri_rule.hpp>
using value_type = url_view;
boost::urls::absolute_uri_rule_t::parse
Synopsis
Declared in header <boost/url/rfc/absolute_uri_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::absolute_uri_rule
Synopsis
Declared in header <boost/url/rfc/absolute_uri_rule.hpp>
constexpr
absolute_uri_rule_t const absolute_uri_rule = {};
boost::urls::relative_ref_rule_t
Synopsis
Declared in header <boost/url/rfc/relative_ref_rule.hpp>
struct relative_ref_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::relative_ref_rule_t::value_type
Synopsis
Declared in header <boost/url/rfc/relative_ref_rule.hpp>
using value_type = url_view;
boost::urls::relative_ref_rule_t::parse
Synopsis
Declared in header <boost/url/rfc/relative_ref_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::relative_ref_rule
Synopsis
Declared in header <boost/url/rfc/relative_ref_rule.hpp>
constexpr
relative_ref_rule_t const relative_ref_rule = {};
boost::urls::uri_rule_t
Synopsis
Declared in header <boost/url/rfc/uri_rule.hpp>
struct uri_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::uri_rule_t::value_type
Synopsis
Declared in header <boost/url/rfc/uri_rule.hpp>
using value_type = url_view;
boost::urls::uri_rule_t::parse
Synopsis
Declared in header <boost/url/rfc/uri_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const const* end) const noexcept;
boost::urls::uri_rule
Synopsis
Declared in header <boost/url/rfc/uri_rule.hpp>
constexpr
uri_rule_t const uri_rule = {};
boost::urls::uri_reference_rule_t
Synopsis
Declared in header <boost/url/rfc/uri_reference_rule.hpp>
struct uri_reference_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::uri_reference_rule_t::value_type
Synopsis
Declared in header <boost/url/rfc/uri_reference_rule.hpp>
using value_type = url_view;
boost::urls::uri_reference_rule_t::parse
Synopsis
Declared in header <boost/url/rfc/uri_reference_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::uri_reference_rule
Synopsis
Declared in header <boost/url/rfc/uri_reference_rule.hpp>
constexpr
uri_reference_rule_t const uri_reference_rule = {};
boost::urls::origin_form_rule_t
Synopsis
Declared in header <boost/url/rfc/origin_form_rule.hpp>
struct origin_form_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::origin_form_rule_t::value_type
Synopsis
Declared in header <boost/url/rfc/origin_form_rule.hpp>
using value_type = url_view;
boost::urls::origin_form_rule_t::parse
Synopsis
Declared in header <boost/url/rfc/origin_form_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::origin_form_rule
Synopsis
Declared in header <boost/url/rfc/origin_form_rule.hpp>
constexpr
origin_form_rule_t const origin_form_rule = {};
boost::urls::query_rule_t
Synopsis
Declared in header <boost/url/rfc/query_rule.hpp>
struct query_rule_t;
Types
Name |
Description |
Member Functions
Name |
Description |
boost::urls::query_rule_t::value_type
Synopsis
Declared in header <boost/url/rfc/query_rule.hpp>
using value_type = params_encoded_view;
boost::urls::query_rule_t::parse
Synopsis
Declared in header <boost/url/rfc/query_rule.hpp>
system::result<value_type>
parse(
char const*& it,
char const* end) const noexcept;
boost::urls::query_rule
Synopsis
Declared in header <boost/url/rfc/query_rule.hpp>
constexpr
query_rule_t const query_rule = {};
boost::urls::static_url
Synopsis
Declared in header <boost/url/static_url.hpp>
template<std::size_t Capacity>
class static_url
: public static_url_base;
Member Functions
Name |
Description |
Return the authority |
|
Return the url string |
|
Return the url as a null-terminated string |
|
Return the number of characters that can be stored without reallocating |
|
Clear the contents while preserving the capacity |
|
Return the result of comparing this with another url |
|
Return a pointer to the url’s character buffer |
|
Return true if the url is empty |
|
Return the authority. |
|
Return the fragment |
|
Return the host |
|
Return the host |
|
Return the host and port |
|
Return the host name |
|
Return the origin |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return the query |
|
Return the resource |
|
Return the path as a container of segments |
|
Return the target |
|
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
|
Return the fragment |
|
Return true if an authority is present |
|
Return true if a fragment is present |
|
Return true if a password is present |
|
Return true if a port is present |
|
Return true if a query is present |
|
Return true a scheme is present |
|
Return true if a userinfo is present |
|
Return the host |
|
Return the host |
|
Return the host IPv4 address |
|
Return the host IPv6 address |
|
Return the host IPvFuture address |
|
Return the host name |
|
Return the host type |
|
Return true if the path is absolute |
|
Normalize the URL components |
|
Normalize the URL authority |
|
Normalize the URL fragment |
|
Normalize the URL path |
|
Normalize the URL query |
|
Normalize the URL scheme |
|
Return the URL as a core::string_view |
|
Assignment |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return a shared, persistent copy of the url |
|
Return the port |
|
Return the port |
|
Return the query |
|
Remove the authority |
|
Remove the fragment |
|
Remove the origin component |
|
Remove the password |
|
Remove the port |
|
Remove the query |
|
Remove the scheme |
|
Remove the userinfo |
|
Adjust the capacity without changing the size |
|
Resolve a URL reference against this base URL |
|
Return the scheme |
|
Return the scheme |
|
Return the path as a container of segments |
|
Set the authority |
|
Set the fragment. |
|
Set the host |
|
Set the host to an address |
|
Set the host to a name |
|
Set the query params |
|
Set the password. |
|
Set the path. |
|
Set the query |
|
Set the user |
|
Set the userinfo. |
|
Set the fragment. |
|
Set the host |
|
Set the host to an address |
|
Set the host to an address |
|
Set the host to an address |
|
Set the host to an address |
|
Set the host to a name |
|
Set the query params |
|
Set the password. |
|
Set the path. |
|
Set if the path is absolute |
|
Set the port |
|
Set the port |
|
Set the query |
|
Set the scheme |
|
Set the user |
|
Set the userinfo |
|
Return the number of characters in the url |
|
|
Constructor |
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
|
|
Destructor |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Friends
Name |
Description |
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
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 + 1
boost::urls::static_url::~static_url
Synopsis
Declared in header <boost/url/static_url.hpp>
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.
boost::urls::static_url::static_url
Members
Constructor
static_url() noexcept;
» more...
Constructor
explicit
static_url(core::string_view s);
» more...
Constructor
static_url(static_url const& u) noexcept;
» more...
Constructor
static_url(url_view_base const& u);
» more...
boost::urls::static_url::operator=
Members
Assignment
static_url&
operator=(static_url const& u) noexcept;
» more...
Assignment
static_url&
operator=(url_view_base const& u);
» more...
boost::urls::static_url::set_scheme
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_scheme(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The scheme to set. |
See Also
boost::urls::static_url::set_scheme_id
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_scheme_id(urls::scheme id);
boost::urls::static_url::remove_scheme
Synopsis
Declared in header <boost/url/static_url.hpp>
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
See Also
boost::urls::static_url::set_encoded_authority
Synopsis
Declared in header <boost/url/static_url.hpp>
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
Specification
Exceptions
Name | Thrown on |
---|---|
|
The string contains an invalid percent-encoding. |
Parameters
Name | Description |
---|---|
s |
The authority string to set. |
See Also
boost::urls::static_url::remove_authority
Synopsis
Declared in header <boost/url/static_url.hpp>
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
Specification
See Also
boost::urls::static_url::set_userinfo
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_userinfo(core::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.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
Example
assert( url( "http://example.com" ).set_userinfo( "user:pass" ).encoded_user() == "user" );
Complexity
Linear in this->size() + s.size()
.
Exception Safety
Strong guarantee. Calls to allocate may throw.
BNF
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_encoded_userinfo
Synopsis
Declared in header <boost/url/static_url.hpp>
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.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
Example
assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" );
Complexity
Linear in this->size() + s.size()
.
Exception Safety
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
BNF
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::remove_userinfo
Synopsis
Declared in header <boost/url/static_url.hpp>
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 / ":" )
Specification
See Also
boost::urls::static_url::set_user
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_user(core::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 / ":" )
Specification
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_encoded_user
Synopsis
Declared in header <boost/url/static_url.hpp>
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 / ":" )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_password
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_password(core::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 / ":" )
Specification
Parameters
Name | Description |
---|---|
s |
The string to set. This string may contain any characters, including nulls. |
See Also
boost::urls::static_url::set_encoded_password
Synopsis
Declared in header <boost/url/static_url.hpp>
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 / ":" )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. This string may contain any characters, including nulls. |
See Also
boost::urls::static_url::remove_password
Synopsis
Declared in header <boost/url/static_url.hpp>
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 / ":" )
Specification
See Also
boost::urls::static_url::set_host
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_host(core::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 / "-" / ".")
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_encoded_host
Synopsis
Declared in header <boost/url/static_url.hpp>
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 / "-" / ".")
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_host_address
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_host_address(core::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 / "-" / ".")
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_encoded_host_address
Synopsis
Declared in header <boost/url/static_url.hpp>
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 / "-" / ".")
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_host_ipv4
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_host_ipv4(ipv4_address const& 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
Specification
Parameters
Name | Description |
---|---|
addr |
The address to set. |
See Also
boost::urls::static_url::set_host_ipv6
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_host_ipv6(ipv6_address const& 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
Parameters
Name | Description |
---|---|
addr |
The address to set. |
See Also
boost::urls::static_url::set_host_ipvfuture
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_host_ipvfuture(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_host_name
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_host_name(core::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
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_encoded_host_name
Synopsis
Declared in header <boost/url/static_url.hpp>
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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_port_number
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_port_number(std::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
Parameters
Name | Description |
---|---|
n |
The port number to set. |
See Also
remove_port , set_port .
boost::urls::static_url::set_port
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_port(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The port string to set. |
See Also
remove_port , set_port .
boost::urls::static_url::remove_port
Synopsis
Declared in header <boost/url/static_url.hpp>
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
See Also
set_port .
boost::urls::static_url::set_path
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_path(core::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
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_encoded_path
Synopsis
Declared in header <boost/url/static_url.hpp>
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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_query
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_query(core::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 )
Specification
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_encoded_query
Synopsis
Declared in header <boost/url/static_url.hpp>
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 )
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
encoded_params , params , remove_query , set_query .
boost::urls::static_url::remove_query
Synopsis
Declared in header <boost/url/static_url.hpp>
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 )
Specification
See Also
boost::urls::static_url::remove_fragment
Synopsis
Declared in header <boost/url/static_url.hpp>
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
See Also
boost::urls::static_url::set_fragment
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
set_fragment(core::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
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::set_encoded_fragment
Synopsis
Declared in header <boost/url/static_url.hpp>
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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to set. |
See Also
boost::urls::static_url::remove_origin
Synopsis
Declared in header <boost/url/static_url.hpp>
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.
boost::urls::static_url::normalize
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
normalize();
Description
Applies Syntax-based normalization to all components of the URL.
Exception Safety
Strong guarantee. Calls to allocate may throw.
Specification
boost::urls::static_url::normalize_scheme
Synopsis
Declared in header <boost/url/static_url.hpp>
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.
Specification
boost::urls::static_url::normalize_authority
Synopsis
Declared in header <boost/url/static_url.hpp>
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.
Specification
boost::urls::static_url::normalize_path
Synopsis
Declared in header <boost/url/static_url.hpp>
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.
Specification
boost::urls::static_url::normalize_query
Synopsis
Declared in header <boost/url/static_url.hpp>
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.
Specification
boost::urls::static_url::normalize_fragment
Synopsis
Declared in header <boost/url/static_url.hpp>
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.
Specification
boost::urls::static_url_base
Synopsis
Declared in header <boost/url/static_url.hpp>
class static_url_base
: public url_base;
Member Functions
Name |
Description |
Return the authority |
|
Return the url string |
|
Return the url as a null-terminated string |
|
Return the number of characters that can be stored without reallocating |
|
Clear the contents while preserving the capacity |
|
Return the result of comparing this with another url |
|
Return a pointer to the url’s character buffer |
|
Return true if the url is empty |
|
Return the authority. |
|
Return the fragment |
|
Return the host |
|
Return the host |
|
Return the host and port |
|
Return the host name |
|
Return the origin |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return the query |
|
Return the resource |
|
Return the path as a container of segments |
|
Return the target |
|
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
|
Return the fragment |
|
Return true if an authority is present |
|
Return true if a fragment is present |
|
Return true if a password is present |
|
Return true if a port is present |
|
Return true if a query is present |
|
Return true a scheme is present |
|
Return true if a userinfo is present |
|
Return the host |
|
Return the host |
|
Return the host IPv4 address |
|
Return the host IPv6 address |
|
Return the host IPvFuture address |
|
Return the host name |
|
Return the host type |
|
Return true if the path is absolute |
|
Normalize the URL components |
|
Normalize the URL authority |
|
Normalize the URL fragment |
|
Normalize the URL path |
|
Normalize the URL query |
|
Normalize the URL scheme |
|
Return the URL as a core::string_view |
|
Return the query as a container of parameters |
|
Return the password |
|
Return the path |
|
Return a shared, persistent copy of the url |
|
Return the port |
|
Return the port |
|
Return the query |
|
Remove the authority |
|
Remove the fragment |
|
Remove the origin component |
|
Remove the password |
|
Remove the port |
|
Remove the query |
|
Remove the scheme |
|
Remove the userinfo |
|
Adjust the capacity without changing the size |
|
Resolve a URL reference against this base URL |
|
Return the scheme |
|
Return the scheme |
|
Return the path as a container of segments |
|
Set the authority |
|
Set the fragment. |
|
Set the host |
|
Set the host to an address |
|
Set the host to a name |
|
Set the query params |
|
Set the password. |
|
Set the path. |
|
Set the query |
|
Set the user |
|
Set the userinfo. |
|
Set the fragment. |
|
Set the host |
|
Set the host to an address |
|
Set the host to an address |
|
Set the host to an address |
|
Set the host to an address |
|
Set the host to a name |
|
Set the query params |
|
Set the password. |
|
Set the path. |
|
Set if the path is absolute |
|
Set the port |
|
Set the port |
|
Set the query |
|
Set the scheme |
|
Set the user |
|
Set the userinfo |
|
Return the number of characters in the url |
|
Return the user |
|
Return the userinfo |
|
Return the IPv6 Zone ID |
Static Member Functions
Name |
Description |
Return the maximum number of characters possible |
Friends
Name |
Description |
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
Return the result of comparing two URLs |
|
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
Parsing Functions
boost::urls::string_view
Synopsis
Declared in header <boost/url/string_view.hpp>
using string_view = boost::core::string_view;
Description
String views are used to pass character buffers into or out of functions. Ownership of the underlying character buffer is not transferred; the caller is responsible for ensuring that the lifetime of character buffer extends until it is no longer referenced.
Warning
|
This alias is no longer supported and
should not be used in new code. Please use
core::string_view instead.
|
This alias is included for backwards compatibility with earlier versions of the library.
However, it will be removed in future releases, and using it in new code is not recommended.
Please use the updated version instead to ensure compatibility with future versions of the library.
boost::urls::format
Members
Format arguments into a URL
template<class... Args>
url
format(
core::string_view fmt,
Args&&... args);
» more...
Format arguments into a URL
url
format(
core::string_view fmt,
std::initializer_list<detail::format_arg> args);
» more...
boost::urls::format_to
Members
Format arguments into a URL
template<class... Args>
void
format_to(
url_base& u,
core::string_view fmt,
Args&&... args);
» more...
Format arguments into a URL
void
format_to(
url_base& u,
core::string_view fmt,
std::initializer_list<detail::format_arg> args);
» more...
boost::urls::arg
Synopsis
Declared in header <boost/url/format.hpp>
template<class T>
detail::named_arg<T>
arg(
core::string_view name,
T const& arg);
boost::urls::gen_delim_chars
Synopsis
Declared in header <boost/url/rfc/gen_delim_chars.hpp>
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( gen_delim_chars ) );
BNF
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
Specification
See Also
boost::urls::reserved_chars
Synopsis
Declared in header <boost/url/rfc/reserved_chars.hpp>
constexpr
lut_chars const reserved_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( reserved_chars ) );
Specification
See Also
boost::system
Types
boost::system::is_error_code_enum
Synopsis
Declared in header <boost/url/impl/error.hpp>
Static Data Members
Name |
Description |
boost::system::is_error_code_enum<boost::urls::error>::value
Synopsis
Declared in header <boost/url/impl/error.hpp>
static
bool const value = true;
boost::system::is_error_code_enum
Synopsis
Declared in header <boost/url/grammar/impl/error.hpp>
Static Data Members
Name |
Description |
boost::system::is_error_code_enum<boost::urls::grammar::error>::value
Synopsis
Declared in header <boost/url/grammar/impl/error.hpp>
static
bool const value = true;
boost::system::is_error_condition_enum
Synopsis
Declared in header <boost/url/grammar/impl/error.hpp>
Static Data Members
Name |
Description |
boost::system::is_error_condition_enum<boost::urls::grammar::condition>::value
Synopsis
Declared in header <boost/url/grammar/impl/error.hpp>
static
bool const value = true;
boost::url
Synopsis
Declared in header <boost/url/urls.hpp>
using urls::url;
Introduced Symbols
Name |
url |
boost::url_view
Synopsis
Declared in header <boost/url/urls.hpp>
using urls::url_view;
Introduced Symbols
Name |
url_view |
std
Types
std::hash
Synopsis
Declared in header <boost/url/url.hpp>
Member Functions
Name |
Description |
|
|
std::hash<boost::urls::url>::hash
Members
constexpr
hash() = default;
» more...
constexpr
hash(hash<url> const&) = default;
» more...
explicit
hash(std::size_t salt) noexcept;
» more...
std::hash<boost::urls::url>::operator=
Synopsis
Declared in header <boost/url/url.hpp>
std::hash<boost::urls::url>::operator()
Synopsis
Declared in header <boost/url/url.hpp>
std::hash
Synopsis
Declared in header <boost/url/url_view.hpp>
Member Functions
Name |
Description |
|
|
std::hash<boost::urls::url_view>::hash
Members
constexpr
hash() = default;
» more...
constexpr
hash(hash<url_view> const&) = default;
» more...
explicit
hash(std::size_t salt) noexcept;
» more...
std::hash<boost::urls::url_view>::operator=
Synopsis
Declared in header <boost/url/url_view.hpp>
std::hash<boost::urls::url_view>::operator()
Synopsis
Declared in header <boost/url/url_view.hpp>
std::hash
Synopsis
Declared in header <boost/url/static_url.hpp>
template<std::size_t N>
struct hash<boost::urls::static_url<N>>;
Member Functions
Name |
Description |
|
|
std::hash<boost::urls::static_url<N>>::hash
Members
hash() = default;
» more...
hash(hash const&) = default;
» more...
explicit
hash(std::size_t salt) noexcept;
» more...
std::hash<boost::urls::static_url<N>>::operator=
Synopsis
Declared in header <boost/url/static_url.hpp>
std::hash<boost::urls::static_url<N>>::operator()
Synopsis
Declared in header <boost/url/static_url.hpp>
std::size_t
operator()(boost::urls::static_url<N> const& u) const noexcept;
boost::urls::string_token::arg::arg
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
constexpr
arg() = default;
boost::urls::string_token::arg::arg
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
constexpr
arg(arg&&) = default;
boost::urls::string_token::arg::arg
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
arg(arg const&) = delete;
boost::urls::string_token::arg::operator=
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
boost::urls::string_token::arg::operator=
Synopsis
Declared in header <boost/url/grammar/string_token.hpp>
boost::urls::grammar::string_view_base::starts_with
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
bool
starts_with(core::string_view x) const noexcept;
Description
See core::string_view::starts_with
boost::urls::grammar::string_view_base::starts_with
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
bool
starts_with(char x) const noexcept;
Description
See core::string_view::starts_with
boost::urls::grammar::string_view_base::starts_with
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
bool
starts_with(char const* x) const noexcept;
Description
See core::string_view::starts_with
boost::urls::grammar::string_view_base::ends_with
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
bool
ends_with(core::string_view x) const noexcept;
Description
See core::string_view::ends_with
boost::urls::grammar::string_view_base::ends_with
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
bool
ends_with(char x) const noexcept;
Description
See core::string_view::ends_with
boost::urls::grammar::string_view_base::ends_with
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
bool
ends_with(char const* x) const noexcept;
Description
See core::string_view::ends_with
boost::urls::grammar::string_view_base::find
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find
boost::urls::grammar::string_view_base::find
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find
boost::urls::grammar::string_view_base::find
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find
boost::urls::grammar::string_view_base::find
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find
boost::urls::grammar::string_view_base::compare
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
int
compare(core::string_view str) const noexcept;
Description
See core::string_view::compare
boost::urls::grammar::string_view_base::compare
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::compare
boost::urls::grammar::string_view_base::compare
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::compare
boost::urls::grammar::string_view_base::compare
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
int
compare(char const* s) const noexcept;
Description
See core::string_view::compare
boost::urls::grammar::string_view_base::compare
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::compare
boost::urls::grammar::string_view_base::compare
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::compare
boost::urls::grammar::string_view_base::rfind
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::rfind
boost::urls::grammar::string_view_base::rfind
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::rfind
boost::urls::grammar::string_view_base::rfind
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::rfind
boost::urls::grammar::string_view_base::rfind
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::rfind
boost::urls::grammar::string_view_base::find_first_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_first_of
boost::urls::grammar::string_view_base::find_first_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_first_of
boost::urls::grammar::string_view_base::find_first_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_first_of
boost::urls::grammar::string_view_base::find_first_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_first_of
boost::urls::grammar::string_view_base::find_last_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_last_of
boost::urls::grammar::string_view_base::find_last_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_last_of
boost::urls::grammar::string_view_base::find_last_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_last_of
boost::urls::grammar::string_view_base::find_last_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_last_of
boost::urls::grammar::string_view_base::contains
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
bool
contains(core::string_view sv) const noexcept;
Description
See core::string_view::contains
boost::urls::grammar::string_view_base::contains
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
bool
contains(char c) const noexcept;
Description
See core::string_view::contains
boost::urls::grammar::string_view_base::contains
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
constexpr
bool
contains(char const* s) const noexcept;
Description
See core::string_view::contains
boost::urls::grammar::string_view_base::find_first_not_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_first_not_of
boost::urls::grammar::string_view_base::find_first_not_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_first_not_of
boost::urls::grammar::string_view_base::find_first_not_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_first_not_of
boost::urls::grammar::string_view_base::find_first_not_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_first_not_of
boost::urls::grammar::string_view_base::find_last_not_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_last_not_of
boost::urls::grammar::string_view_base::find_last_not_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_last_not_of
boost::urls::grammar::string_view_base::find_last_not_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_last_not_of
boost::urls::grammar::string_view_base::find_last_not_of
Synopsis
Declared in header <boost/url/grammar/string_view_base.hpp>
Description
See core::string_view::find_last_not_of
boost::urls::grammar::ref
Synopsis
Declared in header <boost/url/grammar/charset.hpp>
template<class CharSet>
constexpr
detail::charset_ref<CharSet>
ref(CharSet const& cs) noexcept;
boost::urls::grammar::ref
Synopsis
Declared in header <boost/url/grammar/parse.hpp>
template<class Rule>
constexpr
detail::rule_ref<Rule>
ref(Rule const& r) noexcept;
boost::urls::grammar::ref
Synopsis
Declared in header <boost/url/grammar/parse.hpp>
constexpr
void
ref(...) = delete;
boost::urls::grammar::lut_chars::operator()
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
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.
Parameters
Name | Description |
---|---|
ch |
The character to test. |
boost::urls::grammar::lut_chars::operator()
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
constexpr
bool
operator()(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.
Parameters
Name | Description |
---|---|
ch |
The character to test. |
boost::urls::grammar::lut_chars::lut_chars
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
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.
Parameters
Name | Description |
---|---|
ch |
A character. |
boost::urls::grammar::lut_chars::lut_chars
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
constexpr
lut_chars(char const* 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.
Parameters
Name | Description |
---|---|
s |
A null-terminated string. |
boost::urls::grammar::lut_chars::lut_chars
Synopsis
Declared in header <boost/url/grammar/lut_chars.hpp>
template<
class Pred,
class = void>
constexpr
lut_chars(Pred const& pred) noexcept;
boost::urls::grammar::parse
Synopsis
Declared in header <boost/url/grammar/parse.hpp>
template<class Rule>
system::result<Rule::value_type>
parse(
char const*& it,
char const* end,
Rule const& r);
Return Value
The parsed value upon success, otherwise an error.
Parameters
Name | Description |
---|---|
it |
A pointer to the start. The caller’s variable is changed to reflect the amount of input consumed. |
end |
A pointer to the end. |
r |
The rule to use |
See Also
result .
boost::urls::grammar::parse
Synopsis
Declared in header <boost/url/grammar/parse.hpp>
template<class Rule>
system::result<Rule::value_type>
parse(
core::string_view s,
Rule const& 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
The parsed value upon success, otherwise an error.
Parameters
Name | Description |
---|---|
s |
The input string |
r |
The rule to use |
See Also
result .
boost::urls::grammar::ci_is_equal
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
template<
class String0,
class String1>
bool
ci_is_equal(
String0 const& s0,
String1 const& s1);
boost::urls::grammar::ci_is_equal
Synopsis
Declared in header <boost/url/grammar/ci_string.hpp>
bool
ci_is_equal(
core::string_view s0,
core::string_view s1) noexcept;
boost::urls::grammar::variant_rule
Synopsis
Declared in header <boost/url/grammar/variant_rule.hpp>
template<
class R0_,
class... Rn_>
constexpr
variant_rule_t<R0_, Rn_...>
variant_rule(
R0_ const& r0,
Rn_ const&... rn) noexcept;
boost::urls::grammar::variant_rule
Synopsis
Declared in header <boost/url/grammar/variant_rule.hpp>
template<
class R0,
class... Rn>
constexpr
variant_rule_t<R0, Rn...>
variant_rule(
R0 const& r0,
Rn const&... rn) noexcept;
boost::urls::grammar::delim_rule
Synopsis
Declared in header <boost/url/grammar/delim_rule.hpp>
constexpr
ch_delim_rule
delim_rule(char ch) noexcept;
boost::urls::grammar::delim_rule
Synopsis
Declared in header <boost/url/grammar/delim_rule.hpp>
template<class CharSet>
constexpr
cs_delim_rule<CharSet>
delim_rule(CharSet const& cs) noexcept;
boost::urls::grammar::optional_rule
Synopsis
Declared in header <boost/url/grammar/optional_rule.hpp>
template<class R_>
constexpr
optional_rule_t<R_>
optional_rule(R_ const& r);
boost::urls::grammar::optional_rule
Synopsis
Declared in header <boost/url/grammar/optional_rule.hpp>
template<class Rule>
constexpr
optional_rule_t<Rule>
optional_rule(Rule const& r);
boost::urls::grammar::tuple_rule
Synopsis
Declared in header <boost/url/grammar/tuple_rule.hpp>
template<
class R0_,
class... Rn_>
constexpr
tuple_rule_t<R0_, Rn_...>
tuple_rule(
R0_ const& r0,
Rn_ const&... rn) noexcept;
boost::urls::grammar::tuple_rule
Synopsis
Declared in header <boost/url/grammar/tuple_rule.hpp>
template<
class R0,
class... Rn>
constexpr
tuple_rule_t<R0, Rn...>
tuple_rule(
R0 const& r0,
Rn const&... rn) noexcept;
boost::urls::grammar::recycled_ptr::operator=
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
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.
Parameters
Name | Description |
---|---|
other |
The pointer to move from |
boost::urls::grammar::recycled_ptr::operator=
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
recycled_ptr&
operator=(recycled_ptr const& 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.
Parameters
Name | Description |
---|---|
other |
The pointer to copy from |
boost::urls::grammar::recycled_ptr::recycled_ptr
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
explicit
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()
Parameters
Name | Description |
---|---|
bin |
The recycle bin to use |
See Also
recycled .
boost::urls::grammar::recycled_ptr::recycled_ptr
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
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.
Parameters
Name | Description |
---|---|
bin |
The recycle bin to use |
boost::urls::grammar::recycled_ptr::recycled_ptr
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
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()
See Also
recycled .
boost::urls::grammar::recycled_ptr::recycled_ptr
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
recycled_ptr(std::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.
boost::urls::grammar::recycled_ptr::recycled_ptr
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
recycled_ptr(recycled_ptr const& 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.
Parameters
Name | Description |
---|---|
other |
The pointer to copy |
boost::urls::grammar::recycled_ptr::recycled_ptr
Synopsis
Declared in header <boost/url/grammar/recycled.hpp>
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.
Parameters
Name | Description |
---|---|
other |
The pointer to move from |
boost::urls::grammar::range::iterator::iterator
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
iterator() = default;
boost::urls::grammar::range::iterator::iterator
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
iterator(iterator const&) = default;
boost::urls::grammar::range::iterator::operator++
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
iterator&
operator++() noexcept;
boost::urls::grammar::range::iterator::operator++
Synopsis
Declared in header <boost/url/grammar/impl/range_rule.hpp>
iterator
operator++(int) noexcept;
boost::urls::grammar::range::range
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
range() noexcept;
Description
Default-constructed ranges have zero elements.
Exception Safety
Throws nothing.
boost::urls::grammar::range::range
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
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.
boost::urls::grammar::range::range
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
range(range const& 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.
boost::urls::grammar::range::operator=
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
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.
boost::urls::grammar::range::operator=
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
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.
boost::urls::grammar::range_rule
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
template<class Rule>
constexpr
range_rule_t<Rule>
range_rule(
Rule const& next,
std::size_t N = 0,
std::size_t M = std::size_t(-1)) noexcept;
boost::urls::grammar::range_rule
Synopsis
Declared in header <boost/url/grammar/range_rule.hpp>
template<
class Rule1,
class Rule2>
constexpr
range_rule_t<Rule1, Rule2>
range_rule(
Rule1 const& first,
Rule2 const& next,
std::size_t N = 0,
std::size_t M = std::size_t(-1)) noexcept;
boost::urls::grammar::not_empty_rule
Synopsis
Declared in header <boost/url/grammar/not_empty_rule.hpp>
template<class R_>
constexpr
not_empty_rule_t<R_>
not_empty_rule(R_ const& r);
boost::urls::grammar::not_empty_rule
Synopsis
Declared in header <boost/url/grammar/not_empty_rule.hpp>
template<class Rule>
constexpr
not_empty_rule_t<Rule>
not_empty_rule(Rule const& r);
boost::urls::decode_view::iterator::iterator
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
constexpr
iterator() = default;
boost::urls::decode_view::iterator::iterator
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
constexpr
iterator(iterator const&) = default;
boost::urls::decode_view::iterator::operator++
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
iterator&
operator++() noexcept;
boost::urls::decode_view::iterator::operator++
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
iterator
operator++(int) noexcept;
boost::urls::decode_view::iterator::operator--
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
iterator&
operator--() noexcept;
boost::urls::decode_view::iterator::operator--
Synopsis
Declared in header <boost/url/impl/decode_view.hpp>
iterator
operator--(int) noexcept;
boost::urls::decode_view::decode_view
Synopsis
Declared in header <boost/url/decode_view.hpp>
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.
boost::urls::decode_view::decode_view
Synopsis
Declared in header <boost/url/decode_view.hpp>
explicit
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.
Exceptions
Name | Thrown on |
---|---|
|
The string contains an invalid percent encoding. |
Parameters
Name | Description |
---|---|
s |
A percent-encoded string that has already been validated. |
opt |
The options for decoding. If this parameter is omitted, the default options are used. |
boost::urls::decode_view::starts_with
Synopsis
Declared in header <boost/url/decode_view.hpp>
bool
starts_with(core::string_view s) const noexcept;
Description
Example
assert( decode_view( "Program%20Files" ).starts_with("Program") );
Complexity
Linear.
Exception Safety
Throws nothing.
boost::urls::decode_view::starts_with
Synopsis
Declared in header <boost/url/decode_view.hpp>
bool
starts_with(char ch) const noexcept;
Description
Example
assert( decode_view( "Program%20Files" ).starts_with('P') );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::decode_view::ends_with
Synopsis
Declared in header <boost/url/decode_view.hpp>
bool
ends_with(core::string_view s) const noexcept;
Description
Example
assert( decode_view( "Program%20Files" ).ends_with("Files") );
Complexity
Linear.
Exception Safety
Throws nothing.
boost::urls::decode_view::ends_with
Synopsis
Declared in header <boost/url/decode_view.hpp>
bool
ends_with(char ch) const noexcept;
Description
Example
assert( decode_view( "Program%20Files" ).ends_with('s') );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::decode_view::compare
Synopsis
Declared in header <boost/url/decode_view.hpp>
int
compare(core::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
Negative value if this string is less than the other character sequence, zero if the both character sequences are equal, positive value if this string is greater than the other character sequence
Parameters
Name | Description |
---|---|
other |
string to compare |
boost::urls::decode_view::compare
Synopsis
Declared in header <boost/url/decode_view.hpp>
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
Negative value if this string is less than the other character sequence, zero if the both character sequences are equal, positive value if this string is greater than the other character sequence
Parameters
Name | Description |
---|---|
other |
string to compare |
boost::urls::pct_string_view::pct_string_view
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
constexpr
pct_string_view() = default;
Description
Default constructed string are empty.
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::pct_string_view::pct_string_view
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
constexpr
pct_string_view(pct_string_view const& other) = default;
Description
The copy references the same underlying character buffer. Ownership is not transferred.
Postconditions
this->data() == other.data()
Complexity
Constant.
Exception Safety
Throws nothing.
other The string to copy.
boost::urls::pct_string_view::pct_string_view
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
template<
class String,
class = void>
pct_string_view(String const& s);
boost::urls::pct_string_view::pct_string_view
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
pct_string_view(std::nullptr_t) = delete;
boost::urls::pct_string_view::pct_string_view
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
pct_string_view(
char const* s,
std::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.
Exceptions
Name | Thrown on |
---|---|
|
The string contains an invalid percent encoding. |
Parameters
Name | Description |
---|---|
s, |
len The string to construct from. |
boost::urls::pct_string_view::pct_string_view
Synopsis
Declared in header <boost/url/pct_string_view.hpp>
pct_string_view(core::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.
Exceptions
Name | Thrown on |
---|---|
|
The string contains an invalid percent encoding. |
Parameters
Name | Description |
---|---|
s |
The string to construct from. |
boost::urls::param_pct_view::param_pct_view
Synopsis
Declared in header <boost/url/param.hpp>
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.
boost::urls::param_pct_view::param_pct_view
Synopsis
Declared in header <boost/url/param.hpp>
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.
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
key, |
value The key and value to set. |
boost::urls::param_pct_view::param_pct_view
Synopsis
Declared in header <boost/url/param.hpp>
template<class OptionalString>
param_pct_view(
pct_string_view key,
OptionalString const& 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.
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
key, |
value The key and value to set. |
boost::urls::param_pct_view::param_pct_view
Synopsis
Declared in header <boost/url/param.hpp>
explicit
param_pct_view(param_view const& 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.
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
p |
The param to construct from. |
boost::urls::param_pct_view::param_pct_view
Synopsis
Declared in header <boost/url/param.hpp>
param_pct_view(
pct_string_view key,
pct_string_view value,
bool has_value) noexcept;
boost::urls::param_view::param_view
Synopsis
Declared in header <boost/url/param.hpp>
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.
boost::urls::param_view::param_view
Synopsis
Declared in header <boost/url/param.hpp>
template<class OptionalString>
param_view(
core::string_view key,
OptionalString const& 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.
Parameters
Name | Description |
---|---|
key, |
value The key and value to set. |
boost::urls::param_view::param_view
Synopsis
Declared in header <boost/url/param.hpp>
param_view(param const& 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.
Parameters
Name | Description |
---|---|
other |
The param to reference |
boost::urls::param_view::param_view
Synopsis
Declared in header <boost/url/param.hpp>
param_view(
core::string_view key_,
core::string_view value_,
bool has_value_) noexcept;
boost::urls::param::param
Synopsis
Declared in header <boost/url/param.hpp>
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.
boost::urls::param::param
Synopsis
Declared in header <boost/url/param.hpp>
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.
boost::urls::param::param
Synopsis
Declared in header <boost/url/param.hpp>
param(param const& 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.
boost::urls::param::param
Synopsis
Declared in header <boost/url/param.hpp>
template<class OptionalString>
param(
core::string_view key,
OptionalString const& 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.
Parameters
Name | Description |
---|---|
key, |
value The key and value to set. |
boost::urls::param::param
Synopsis
Declared in header <boost/url/param.hpp>
param(
core::string_view key,
core::string_view value,
bool has_value) noexcept;
boost::urls::param::operator=
Synopsis
Declared in header <boost/url/param.hpp>
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.
boost::urls::param::operator=
Synopsis
Declared in header <boost/url/param.hpp>
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.
boost::urls::param::operator=
Synopsis
Declared in header <boost/url/param.hpp>
param&
operator=(param_view const& 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.
Parameters
Name | Description |
---|---|
other |
The parameter to copy. |
boost::urls::param::operator=
Synopsis
Declared in header <boost/url/param.hpp>
param&
operator=(param_pct_view const& 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.
Parameters
Name | Description |
---|---|
other |
The parameter to copy. |
boost::urls::encode
Synopsis
Declared in header <boost/url/encode.hpp>
template<class CharSet>
std::size_t
encode(
char* dest,
std::size_t size,
core::string_view s,
CharSet const& 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.
Specification
Return Value
The number of characters written to the destination buffer.
Parameters
Name | Description |
---|---|
dest |
The destination buffer to write to. |
size |
The number of writable
characters pointed to by |
s |
The string to encode. |
unreserved |
The set of characters that is not percent-encoded. |
opt |
The options for encoding. If this parameter is omitted, the default options are used. |
See Also
boost::urls::encode
Synopsis
Declared in header <boost/url/encode.hpp>
template<
class StringToken = string_token::return_string,
class CharSet>
StringToken::result_type
encode(
core::string_view s,
CharSet const& unreserved,
encoding_opts opt = = {},
StringToken&& token) noexcept;
Description
This function applies percent-encoding to the string using the given options and character set, and returns the result as a string when called with default arguments.
Example
encoding_opts opt;
opt.space_as_plus = true;
std::string s = encode( "My Stuff", opt, pchars );
assert( s == "My+Stuff" );
Exception Safety
Calls to allocate may throw.
Specification
Return Value
The string
Parameters
Name | Description |
---|---|
s |
The string to encode. |
unreserved |
The set of characters that is not percent-encoded. |
opt |
The options for encoding. If this parameter is omitted, the default options are used. |
token |
A string token. |
See Also
encode , encoded_size , encoding_opts ,
boost::urls::operator<
Synopsis
Declared in header <boost/url/decode_view.hpp>
template<
class S0,
class S1>
constexpr
bool
operator<(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::operator<
Synopsis
Declared in header <boost/url/authority_view.hpp>
bool
operator<(
authority_view const& a0,
authority_view const& a1) noexcept;
Description
Complexity
Linear in min( a0.size(), a1.size() )
Exception Safety
Throws nothing
boost::urls::operator<
Synopsis
Declared in header <boost/url/url_view_base.hpp>
bool
operator<(
url_view_base const& u0,
url_view_base const& 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
Specification
Return Value
true
if u0 < u1
boost::urls::operator⇐
Synopsis
Declared in header <boost/url/decode_view.hpp>
template<
class S0,
class S1>
constexpr
bool
operator<=(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::operator⇐
Synopsis
Declared in header <boost/url/authority_view.hpp>
bool
operator<=(
authority_view const& a0,
authority_view const& a1) noexcept;
Description
Complexity
Linear in min( a0.size(), a1.size() )
Exception Safety
Throws nothing
boost::urls::operator⇐
Synopsis
Declared in header <boost/url/url_view_base.hpp>
bool
operator<=(
url_view_base const& u0,
url_view_base const& 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
Specification
Return Value
true
if u0 <= u1
boost::urls::operator==
Synopsis
Declared in header <boost/url/decode_view.hpp>
template<
class S0,
class S1>
constexpr
bool
operator==(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::operator==
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
bool
operator==(
ipv4_address const& a1,
ipv4_address const& a2) noexcept;
boost::urls::operator==
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
bool
operator==(
ipv6_address const& a1,
ipv6_address const& a2) noexcept;
boost::urls::operator==
Synopsis
Declared in header <boost/url/authority_view.hpp>
bool
operator==(
authority_view const& a0,
authority_view const& a1) noexcept;
Description
Complexity
Linear in min( a0.size(), a1.size() )
Exception Safety
Throws nothing
boost::urls::operator==
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
boost::urls::operator==
Synopsis
Declared in header <boost/url/url_view_base.hpp>
bool
operator==(
url_view_base const& u0,
url_view_base const& 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
Specification
Return Value
true
if u0 == u1
boost::urls::operator!=
Synopsis
Declared in header <boost/url/decode_view.hpp>
template<
class S0,
class S1>
constexpr
bool
operator!=(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::operator!=
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
bool
operator!=(
ipv4_address const& a1,
ipv4_address const& a2) noexcept;
boost::urls::operator!=
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
bool
operator!=(
ipv6_address const& a1,
ipv6_address const& a2) noexcept;
boost::urls::operator!=
Synopsis
Declared in header <boost/url/authority_view.hpp>
bool
operator!=(
authority_view const& a0,
authority_view const& a1) noexcept;
Description
Complexity
Linear in min( a0.size(), a1.size() )
Exception Safety
Throws nothing
boost::urls::operator!=
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
boost::urls::operator!=
Synopsis
Declared in header <boost/url/url_view_base.hpp>
bool
operator!=(
url_view_base const& u0,
url_view_base const& 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
Specification
Return Value
true
if u0 != u1
boost::urls::operator>
Synopsis
Declared in header <boost/url/decode_view.hpp>
template<
class S0,
class S1>
constexpr
bool
operator>(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::operator>
Synopsis
Declared in header <boost/url/authority_view.hpp>
bool
operator>(
authority_view const& a0,
authority_view const& a1) noexcept;
Description
Complexity
Linear in min( a0.size(), a1.size() )
Exception Safety
Throws nothing
boost::urls::operator>
Synopsis
Declared in header <boost/url/url_view_base.hpp>
bool
operator>(
url_view_base const& u0,
url_view_base const& 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
Specification
Return Value
true
if u0 > u1
boost::urls::operator>=
Synopsis
Declared in header <boost/url/decode_view.hpp>
template<
class S0,
class S1>
constexpr
bool
operator>=(
S0 const& s0,
S1 const& s1) noexcept;
boost::urls::operator>=
Synopsis
Declared in header <boost/url/authority_view.hpp>
bool
operator>=(
authority_view const& a0,
authority_view const& a1) noexcept;
Description
Complexity
Linear in min( a0.size(), a1.size() )
Exception Safety
Throws nothing
boost::urls::operator>=
Synopsis
Declared in header <boost/url/url_view_base.hpp>
bool
operator>=(
url_view_base const& u0,
url_view_base const& 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
Specification
Return Value
true
if u0 >= u1
boost::urls::ipv4_address::ipv4_address
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
constexpr
ipv4_address() = default;
boost::urls::ipv4_address::ipv4_address
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
constexpr
ipv4_address(ipv4_address const&) = default;
boost::urls::ipv4_address::ipv4_address
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
explicit
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.
Parameters
Name | Description |
---|---|
u |
The integer to construct from. |
boost::urls::ipv4_address::ipv4_address
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
explicit
ipv4_address(bytes_type const& bytes) noexcept;
Description
This function constructs an address
from the array in bytes
, which is
interpreted in big-endian.
Parameters
Name | Description |
---|---|
bytes |
The value to construct from. |
boost::urls::ipv4_address::ipv4_address
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
explicit
ipv4_address(core::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
Exceptions
Name | Thrown on |
---|---|
|
The input failed to parse correctly. |
Parameters
Name | Description |
---|---|
s |
The string to parse. |
See Also
boost::urls::operator<<
Synopsis
Declared in header <boost/url/decode_view.hpp>
std::ostream&
operator<<(
std::ostream& os,
decode_view const& s);
Description
This function serializes the decoded view to the output stream.
Return Value
A reference to the output stream, for chaining
Parameters
Name | Description |
---|---|
os |
The output stream to write to |
s |
The decoded view to write |
boost::urls::operator<<
Synopsis
Declared in header <boost/url/ipv4_address.hpp>
std::ostream&
operator<<(
std::ostream& os,
ipv4_address const& addr);
Description
IPv4 addresses written to output streams are written in their dotted decimal format.
Parameters
Name | Description |
---|---|
os |
The output stream. |
addr |
The address to format. |
boost::urls::operator<<
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
std::ostream&
operator<<(
std::ostream& os,
ipv6_address const& addr);
Description
This function writes the address to an output stream using standard notation.
Return Value
The output stream, for chaining.
Parameters
Name | Description |
---|---|
os |
The output stream to write to. |
addr |
The address to write. |
boost::urls::operator<<
Synopsis
Declared in header <boost/url/authority_view.hpp>
std::ostream&
operator<<(
std::ostream& os,
authority_view const& 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
A reference to the output stream, for chaining
Parameters
Name | Description |
---|---|
os |
The output stream to write to |
a |
The URL to write |
boost::urls::operator<<
Synopsis
Declared in header <boost/url/segments_encoded_base.hpp>
std::ostream&
operator<<(
std::ostream& os,
segments_encoded_base const& ps);
Description
Any percent-escapes are emitted as-is; no decoding is performed.
Complexity
Linear in ps.buffer().size()
.
Effects
return os << ps.buffer();
boost::urls::operator<<
Synopsis
Declared in header <boost/url/segments_base.hpp>
std::ostream&
operator<<(
std::ostream& os,
segments_base const& ps);
Description
Any percent-escapes are emitted as-is; no decoding is performed.
Complexity
Linear in ps.buffer().size()
.
Effects
return os << ps.buffer();
boost::urls::operator<<
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
std::ostream&
operator<<(
std::ostream& os,
params_encoded_base const& qp);
Description
Any percent-escapes are emitted as-is; no decoding is performed.
Complexity
Linear in ps.buffer().size()
.
Effects
return os << ps.buffer();
boost::urls::operator<<
Synopsis
Declared in header <boost/url/params_base.hpp>
std::ostream&
operator<<(
std::ostream& os,
params_base const& qp);
Description
Any percent-escapes are emitted as-is; no decoding is performed.
Complexity
Linear in ps.buffer().size()
.
Effects
return os << ps.buffer();
boost::urls::operator<<
Synopsis
Declared in header <boost/url/url_view_base.hpp>
std::ostream&
operator<<(
std::ostream& os,
url_view_base const& 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
A reference to the output stream, for chaining
Parameters
Name | Description |
---|---|
os |
The output stream to write to. |
u |
The url to write. |
boost::urls::ipv6_address::ipv6_address
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
constexpr
ipv6_address() = default;
Description
Default constructed objects represent the unspecified address.
See Also
boost::urls::ipv6_address::ipv6_address
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
constexpr
ipv6_address(ipv6_address const&) = default;
boost::urls::ipv6_address::ipv6_address
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
ipv6_address(bytes_type const& bytes) noexcept;
Description
This function constructs an address
from the array in bytes
, which is
interpreted in big-endian.
Parameters
Name | Description |
---|---|
bytes |
The value to construct from. |
boost::urls::ipv6_address::ipv6_address
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
ipv6_address(ipv4_address const& addr) noexcept;
Description
This function constructs an IPv6 address
from the IPv4 address addr
. The resulting
address is an IPv4-Mapped IPv6 Address.
Specification
Parameters
Name | Description |
---|---|
addr |
The address to construct from. |
boost::urls::ipv6_address::ipv6_address
Synopsis
Declared in header <boost/url/ipv6_address.hpp>
ipv6_address(core::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
Exceptions
Name | Thrown on |
---|---|
|
The input failed to parse correctly. |
Parameters
Name | Description |
---|---|
s |
The string to parse. |
See Also
boost::urls::url_view::operator=
Synopsis
Declared in header <boost/url/url_view.hpp>
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.
boost::urls::url_view::operator=
Synopsis
Declared in header <boost/url/url_view.hpp>
url_view&
operator=(url_view_base const& 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.
boost::urls::url_view::url_view
Synopsis
Declared in header <boost/url/url_view.hpp>
url_view() noexcept;
Description
Default constructed views refer to a string with zero length, which always remains valid. This matches the grammar for a relative-ref with an empty path and no query or fragment.
Example
url_view u;
Postconditions
this->empty() == true
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
Specification
boost::urls::url_view::url_view
Synopsis
Declared in header <boost/url/url_view.hpp>
url_view(core::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
Exceptions
Name | Thrown on |
---|---|
|
The input failed to parse correctly. |
Parameters
Name | Description |
---|---|
s |
The string to parse. |
See Also
boost::urls::url_view::url_view
Synopsis
Declared in header <boost/url/url_view.hpp>
template<
class String,
class = void>
url_view(String const& s);
boost::urls::url_view::url_view
Synopsis
Declared in header <boost/url/url_view.hpp>
url_view(url_view const& 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.
boost::urls::url_view::url_view
Synopsis
Declared in header <boost/url/url_view.hpp>
url_view(url_view_base const& 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.
boost::urls::authority_view::authority_view
Synopsis
Declared in header <boost/url/authority_view.hpp>
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
boost::urls::authority_view::authority_view
Synopsis
Declared in header <boost/url/authority_view.hpp>
explicit
authority_view(core::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
See Also
boost::urls::authority_view::authority_view
Synopsis
Declared in header <boost/url/authority_view.hpp>
authority_view(authority_view const&) noexcept;
boost::urls::ignore_case_param::ignore_case_param
Synopsis
Declared in header <boost/url/ignore_case.hpp>
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 = {} );
boost::urls::ignore_case_param::ignore_case_param
Synopsis
Declared in header <boost/url/ignore_case.hpp>
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 = {} );
boost::urls::segments_encoded_base::iterator::iterator
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
constexpr
iterator() = default;
boost::urls::segments_encoded_base::iterator::iterator
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
constexpr
iterator(iterator const&) = default;
boost::urls::segments_encoded_base::iterator::operator++
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
iterator&
operator++() noexcept;
boost::urls::segments_encoded_base::iterator::operator++
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
iterator
operator++(int) noexcept;
boost::urls::segments_encoded_base::iterator::operator--
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
iterator&
operator--() noexcept;
boost::urls::segments_encoded_base::iterator::operator--
Synopsis
Declared in header <boost/url/impl/segments_encoded_base.hpp>
iterator
operator--(int) noexcept;
boost::urls::segments_base::iterator::iterator
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
constexpr
iterator() = default;
boost::urls::segments_base::iterator::iterator
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
constexpr
iterator(iterator const&) = default;
boost::urls::segments_base::iterator::operator++
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
iterator&
operator++() noexcept;
boost::urls::segments_base::iterator::operator++
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
iterator
operator++(int) noexcept;
boost::urls::segments_base::iterator::operator--
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
iterator&
operator--() noexcept;
boost::urls::segments_base::iterator::operator--
Synopsis
Declared in header <boost/url/impl/segments_base.hpp>
iterator
operator--(int) noexcept;
boost::urls::segments_view::segments_view
Synopsis
Declared in header <boost/url/segments_view.hpp>
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.
boost::urls::segments_view::segments_view
Synopsis
Declared in header <boost/url/segments_view.hpp>
constexpr
segments_view(segments_view const& 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
boost::urls::segments_view::segments_view
Synopsis
Declared in header <boost/url/segments_view.hpp>
segments_view(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to parse. |
boost::urls::segments_encoded_view::segments_encoded_view
Synopsis
Declared in header <boost/url/segments_encoded_view.hpp>
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.
boost::urls::segments_encoded_view::segments_encoded_view
Synopsis
Declared in header <boost/url/segments_encoded_view.hpp>
constexpr
segments_encoded_view(segments_encoded_view const&) 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
boost::urls::segments_encoded_view::segments_encoded_view
Synopsis
Declared in header <boost/url/segments_encoded_view.hpp>
segments_encoded_view(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to parse. |
boost::urls::pct_encoded_rule
Synopsis
Declared in header <boost/url/rfc/pct_encoded_rule.hpp>
template<class CharSet_>
constexpr
pct_encoded_rule_t<CharSet_>
pct_encoded_rule(CharSet_ const& cs) noexcept;
boost::urls::pct_encoded_rule
Synopsis
Declared in header <boost/url/rfc/pct_encoded_rule.hpp>
template<class CharSet>
constexpr
pct_encoded_rule_t<CharSet>
pct_encoded_rule(CharSet const& cs) noexcept;
boost::urls::params_encoded_base::iterator::iterator
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
iterator() = default;
boost::urls::params_encoded_base::iterator::iterator
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
constexpr
iterator(iterator const&) = default;
boost::urls::params_encoded_base::iterator::operator++
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
iterator&
operator++() noexcept;
boost::urls::params_encoded_base::iterator::operator++
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
iterator
operator++(int) noexcept;
boost::urls::params_encoded_base::iterator::operator--
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
iterator&
operator--() noexcept;
boost::urls::params_encoded_base::iterator::operator--
Synopsis
Declared in header <boost/url/impl/params_encoded_base.hpp>
iterator
operator--(int) noexcept;
boost::urls::params_encoded_base::find
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
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.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
an iterator to the param
Parameters
Name | Description |
---|---|
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_encoded_base::find
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
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.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
an iterator to the param
Parameters
Name | Description |
---|---|
from |
The position to begin the
search from. This can be |
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_encoded_base::find_last
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
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.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
an iterator to the param
Parameters
Name | Description |
---|---|
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_encoded_base::find_last
Synopsis
Declared in header <boost/url/params_encoded_base.hpp>
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
an iterator to the param
Parameters
Name | Description |
---|---|
before |
One past the position
to begin the search from. This can
be |
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_ref::params_ref
Synopsis
Declared in header <boost/url/params_ref.hpp>
constexpr
params_ref(params_ref const& 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.
Parameters
Name | Description |
---|---|
other |
The other view. |
boost::urls::params_ref::params_ref
Synopsis
Declared in header <boost/url/params_ref.hpp>
params_ref(
params_ref const& 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.
Parameters
Name | Description |
---|---|
other |
The other view. |
opt |
The options for decoding. If
this parameter is omitted, |
boost::urls::params_ref::operator=
Synopsis
Declared in header <boost/url/params_ref.hpp>
params_ref&
operator=(params_ref const& 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.
Parameters
Name | Description |
---|---|
other |
The params to assign. |
boost::urls::params_ref::operator=
Synopsis
Declared in header <boost/url/params_ref.hpp>
params_ref&
operator=(std::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.
Parameters
Name | Description |
---|---|
init |
The list of params to assign. |
boost::urls::params_ref::assign
Synopsis
Declared in header <boost/url/params_ref.hpp>
void
assign(std::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.
Parameters
Name | Description |
---|---|
init |
The list of params to assign. |
boost::urls::params_ref::assign
Synopsis
Declared in header <boost/url/params_ref.hpp>
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.
Parameters
Name | Description |
---|---|
first, |
last The range of params to assign. |
boost::urls::params_ref::append
Synopsis
Declared in header <boost/url/params_ref.hpp>
iterator
append(param_view const& 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
An iterator to the new element.
Parameters
Name | Description |
---|---|
p |
The param to append. |
boost::urls::params_ref::append
Synopsis
Declared in header <boost/url/params_ref.hpp>
iterator
append(std::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
An iterator to the first new element.
Parameters
Name | Description |
---|---|
init |
The list of params to append. |
boost::urls::params_ref::append
Synopsis
Declared in header <boost/url/params_ref.hpp>
template<class FwdIt>
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
An iterator to the first new element.
Parameters
Name | Description |
---|---|
first, |
last The range of params to append. |
boost::urls::params_ref::insert
Synopsis
Declared in header <boost/url/params_ref.hpp>
iterator
insert(
iterator before,
param_view const& 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
An iterator to the inserted element.
Parameters
Name | Description |
---|---|
before |
An iterator before which
the param is inserted. This may
be equal to |
p |
The param to insert. |
boost::urls::params_ref::insert
Synopsis
Declared in header <boost/url/params_ref.hpp>
iterator
insert(
iterator before,
std::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
An iterator to the first
element inserted, or before
if
init.size() == 0
.
Parameters
Name | Description |
---|---|
before |
An iterator before which
the element is inserted. This may
be equal to |
init |
The list of params to insert. |
boost::urls::params_ref::insert
Synopsis
Declared in header <boost/url/params_ref.hpp>
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
An iterator to the first
element inserted, or before
if
first == last
.
Parameters
Name | Description |
---|---|
before |
An iterator before which
the element is inserted. This may
be equal to |
first, |
last The range of params to insert. |
boost::urls::params_ref::erase
Synopsis
Declared in header <boost/url/params_ref.hpp>
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
An iterator to one past the removed element.
Parameters
Name | Description |
---|---|
pos |
An iterator to the element. |
boost::urls::params_ref::erase
Synopsis
Declared in header <boost/url/params_ref.hpp>
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
An iterator to one past the removed range.
Parameters
Name | Description |
---|---|
first, |
last The range of elements to erase. |
boost::urls::params_ref::erase
Synopsis
Declared in header <boost/url/params_ref.hpp>
std::size_t
erase(
core::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
The number of elements removed from the container.
Parameters
Name | Description |
---|---|
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_ref::replace
Synopsis
Declared in header <boost/url/params_ref.hpp>
iterator
replace(
iterator pos,
param_view const& 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
An iterator to the element.
Parameters
Name | Description |
---|---|
pos |
An iterator to the element. |
p |
The param to assign. |
boost::urls::params_ref::replace
Synopsis
Declared in header <boost/url/params_ref.hpp>
iterator
replace(
iterator from,
iterator to,
std::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
An iterator to the first
element inserted, or one past to
if
init.size() == 0
.
Parameters
Name | Description |
---|---|
from,to |
The range of elements to replace. |
init |
The list of params to assign. |
boost::urls::params_ref::replace
Synopsis
Declared in header <boost/url/params_ref.hpp>
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
An iterator to the first
element inserted, or one past to
if
first == last
.
Parameters
Name | Description |
---|---|
from,to |
The range of elements to replace. |
first, |
last The range of params to assign. |
boost::urls::params_ref::set
Synopsis
Declared in header <boost/url/params_ref.hpp>
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
An iterator to the element.
Parameters
Name | Description |
---|---|
pos |
An iterator to the element. |
value |
The value to assign. The
empty string still counts as a value.
That is, |
boost::urls::params_ref::set
Synopsis
Declared in header <boost/url/params_ref.hpp>
iterator
set(
core::string_view key,
core::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
An iterator to the appended or modified element.
Parameters
Name | Description |
---|---|
key |
The key to match. By default, a case-sensitive comparison is used. |
value |
The value to assign. The
empty string still counts as a value.
That is, |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_base::iterator::iterator
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
iterator() = default;
boost::urls::params_base::iterator::iterator
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
constexpr
iterator(iterator const&) = default;
boost::urls::params_base::iterator::operator++
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
iterator&
operator++() noexcept;
boost::urls::params_base::iterator::operator++
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
iterator
operator++(int) noexcept;
boost::urls::params_base::iterator::operator--
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
iterator&
operator--() noexcept;
boost::urls::params_base::iterator::operator--
Synopsis
Declared in header <boost/url/impl/params_base.hpp>
iterator
operator--(int) noexcept;
boost::urls::params_base::find
Synopsis
Declared in header <boost/url/params_base.hpp>
iterator
find(
core::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
an iterator to the param
Parameters
Name | Description |
---|---|
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_base::find
Synopsis
Declared in header <boost/url/params_base.hpp>
iterator
find(
iterator from,
core::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
an iterator to the param
Parameters
Name | Description |
---|---|
from |
The position to begin the
search from. This can be |
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_base::find_last
Synopsis
Declared in header <boost/url/params_base.hpp>
iterator
find_last(
core::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
an iterator to the param
Parameters
Name | Description |
---|---|
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_base::find_last
Synopsis
Declared in header <boost/url/params_base.hpp>
iterator
find_last(
iterator before,
core::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
an iterator to the param
Parameters
Name | Description |
---|---|
before |
One past the position
to begin the search from. This can
be |
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_view::params_view
Synopsis
Declared in header <boost/url/params_view.hpp>
params_view() = default;
Description
Default-constructed params have zero elements.
Example
params_view qp;
Effects
return params_view( "" );
Complexity
Constant.
Exception Safety
Throws nothing.
boost::urls::params_view::params_view
Synopsis
Declared in header <boost/url/params_view.hpp>
constexpr
params_view(params_view const& 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
boost::urls::params_view::params_view
Synopsis
Declared in header <boost/url/params_view.hpp>
params_view(
params_view const& 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
boost::urls::params_view::params_view
Synopsis
Declared in header <boost/url/params_view.hpp>
params_view(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to parse. |
boost::urls::params_view::params_view
Synopsis
Declared in header <boost/url/params_view.hpp>
params_view(
core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to parse. |
opt |
The options for decoding. If
this parameter is omitted, |
boost::urls::params_encoded_view::params_encoded_view
Synopsis
Declared in header <boost/url/params_encoded_view.hpp>
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.
boost::urls::params_encoded_view::params_encoded_view
Synopsis
Declared in header <boost/url/params_encoded_view.hpp>
constexpr
params_encoded_view(params_encoded_view const& 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
boost::urls::params_encoded_view::params_encoded_view
Synopsis
Declared in header <boost/url/params_encoded_view.hpp>
params_encoded_view(core::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
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
s |
The string to parse. |
boost::urls::url_base::segments
Synopsis
Declared in header <boost/url/url_base.hpp>
urls::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
See Also
boost::urls::url_base::segments
Synopsis
Declared in header <boost/url/url_base.hpp>
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
See Also
boost::urls::url_base::encoded_segments
Synopsis
Declared in header <boost/url/url_base.hpp>
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
See Also
boost::urls::url_base::encoded_segments
Synopsis
Declared in header <boost/url/url_base.hpp>
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
See Also
boost::urls::url_base::encoded_params
Synopsis
Declared in header <boost/url/url_base.hpp>
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
-
link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 >3.4. Query (rfc3986)</a> @li <a href=[://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)]
See Also
encoded_query , has_query , params , query .
boost::urls::url_base::encoded_params
Synopsis
Declared in header <boost/url/url_base.hpp>
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 )
Specification
See Also
params , remove_query , set_encoded_query , set_query .
boost::urls::url_base::params
Synopsis
Declared in header <boost/url/url_base.hpp>
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 )
Specification
See Also
boost::urls::url_base::params
Synopsis
Declared in header <boost/url/url_base.hpp>
params_view
params() const noexcept;
boost::urls::url_base::params
Synopsis
Declared in header <boost/url/url_base.hpp>
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 )
Specification
Parameters
Name | Description |
---|---|
opt |
The options for decoding. If
this parameter is omitted, the |
See Also
boost::urls::params_encoded_ref::operator=
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
params_encoded_ref&
operator=(params_encoded_ref const& 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.
Parameters
Name | Description |
---|---|
other |
The params to assign. |
boost::urls::params_encoded_ref::operator=
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
params_encoded_ref&
operator=(std::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.
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
init |
The list of params to assign. |
boost::urls::params_encoded_ref::assign
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
void
assign(std::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.
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
init |
The list of params to assign. |
boost::urls::params_encoded_ref::assign
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
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.
Exceptions
Name | Thrown on |
---|---|
|
The range contains an invalid percent-encoding. |
Parameters
Name | Description |
---|---|
first, |
last The range of params to assign. |
boost::urls::params_encoded_ref::append
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
iterator
append(param_pct_view const& p);
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.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
An iterator to the new element.
Parameters
Name | Description |
---|---|
p |
The param to append. |
boost::urls::params_encoded_ref::append
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
iterator
append(std::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.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
An iterator to the first new element.
Parameters
Name | Description |
---|---|
init |
The list of params to append. |
boost::urls::params_encoded_ref::append
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
template<class FwdIt>
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.
Exceptions
Name | Thrown on |
---|---|
|
The range contains an invalid percent-encoding. |
Return Value
An iterator to the first new element.
Parameters
Name | Description |
---|---|
first, |
last The range of params to append. |
boost::urls::params_encoded_ref::insert
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
iterator
insert(
iterator before,
param_pct_view const& 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. Exceptions thrown on invalid input.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
An iterator to the inserted element.
Parameters
Name | Description |
---|---|
before |
An iterator before which
the param is inserted. This may
be equal to |
p |
The param to insert. |
boost::urls::params_encoded_ref::insert
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
iterator
insert(
iterator before,
std::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.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
An iterator to the first
element inserted, or before
if
init.size() == 0
.
Parameters
Name | Description |
---|---|
before |
An iterator before which
the element is inserted. This may
be equal to |
init |
The list of params to insert. |
boost::urls::params_encoded_ref::insert
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
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.
Exceptions
Name | Thrown on |
---|---|
|
The range contains an invalid percent-encoding. |
Return Value
An iterator to the first
element inserted, or before
if
first == last
.
Parameters
Name | Description |
---|---|
before |
An iterator before which
the element is inserted. This may
be equal to |
first, |
last The range of params to insert. |
boost::urls::params_encoded_ref::erase
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
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
An iterator to one past the removed element.
Parameters
Name | Description |
---|---|
pos |
An iterator to the element. |
boost::urls::params_encoded_ref::erase
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
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
An iterator to one past the removed range.
Parameters
Name | Description |
---|---|
first, |
last The range of params to erase. |
boost::urls::params_encoded_ref::erase
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
std::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.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
The number of params removed from the container.
Parameters
Name | Description |
---|---|
key |
The key to match. By default, a case-sensitive comparison is used. |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_encoded_ref::set
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
iterator
set(
iterator pos,
pct_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.
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.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
An iterator to the element.
Parameters
Name | Description |
---|---|
pos |
An iterator to the element. |
value |
The value to assign. The
empty string still counts as a value.
That is, |
boost::urls::params_encoded_ref::set
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
iterator
set(
pct_string_view key,
pct_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 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.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
An iterator to the appended or modified element.
Parameters
Name | Description |
---|---|
key |
The key to match. By default, a case-sensitive comparison is used. |
value |
The value to assign. The
empty string still counts as a value.
That is, |
ic |
An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive. |
boost::urls::params_encoded_ref::replace
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
iterator
replace(
iterator pos,
param_pct_view const& 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.
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.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
An iterator to the element.
Parameters
Name | Description |
---|---|
pos |
An iterator to the element. |
p |
The param to assign. |
boost::urls::params_encoded_ref::replace
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
iterator
replace(
iterator from,
iterator to,
std::initializer_list<param_pct_view> init);
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.
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
An iterator to the first
element inserted, or one past to
if
init.size() == 0
.
Parameters
Name | Description |
---|---|
from,to |
The range of params to replace. |
init |
The list of params to assign. |
boost::urls::params_encoded_ref::replace
Synopsis
Declared in header <boost/url/params_encoded_ref.hpp>
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.
Exceptions
Name | Thrown on |
---|---|
|
The range contains an invalid percent-encoding. |
Return Value
An iterator to the first
element inserted, or one past to
if
first == last
.
Parameters
Name | Description |
---|---|
from,to |
The range of params to replace. |
first, |
last The range of params to assign. |
boost::urls::segments_encoded_ref::operator=
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
segments_encoded_ref&
operator=(segments_encoded_ref const& 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.
@{
Parameters
Name | Description |
---|---|
other |
The segments to assign. |
boost::urls::segments_encoded_ref::operator=
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
segments_encoded_ref&
operator=(segments_encoded_view const& other);
boost::urls::segments_encoded_ref::operator=
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
segments_encoded_ref&
operator=(std::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.
Exceptions
Name | Thrown on |
---|---|
|
The list contains an invalid percent-encoding. |
Parameters
Name | Description |
---|---|
init |
The list of segments to assign. |
boost::urls::segments_encoded_ref::assign
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
void
assign(std::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.
Exceptions
Name | Thrown on |
---|---|
|
The list contains an invalid percent-encoding. |
Parameters
Name | Description |
---|---|
init |
The list of segments to assign. |
boost::urls::segments_encoded_ref::assign
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
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.
Exceptions
Name | Thrown on |
---|---|
|
The range contains an invalid percent-encoding. |
Parameters
Name | Description |
---|---|
first, |
last The range of segments to assign. |
boost::urls::segments_encoded_ref::erase
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
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
An iterator to one past the removed segment.
Parameters
Name | Description |
---|---|
pos |
An iterator to the element. |
boost::urls::segments_encoded_ref::erase
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
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
An iterator to one past the removed range.
Parameters
Name | Description |
---|---|
first, |
last The range of segments to erase. |
boost::urls::segments_encoded_ref::insert
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
iterator
insert(
iterator before,
pct_string_view s);
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.
Exceptions
Name | Thrown on |
---|---|
|
The segment contains an invalid percent-encoding. |
Return Value
An iterator to the inserted segment.
Parameters
Name | Description |
---|---|
before |
An iterator before which
the segment is inserted. This may
be equal to |
s |
The segment to insert. |
boost::urls::segments_encoded_ref::insert
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
iterator
insert(
iterator before,
std::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.
Exceptions
Name | Thrown on |
---|---|
|
The list contains an invalid percent-encoding. |
Return Value
An iterator to the first
element inserted, or before
if
init.size() == 0
.
Parameters
Name | Description |
---|---|
before |
An iterator before which
the list is inserted. This may
be equal to |
init |
The list of segments to insert. |
boost::urls::segments_encoded_ref::insert
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
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.
Exceptions
Name | Thrown on |
---|---|
|
The range contains an invalid percent-encoding. |
Return Value
An iterator to the first
segment inserted, or before
if
init.empty()
.
Parameters
Name | Description |
---|---|
before |
An iterator before which
the range is inserted. This may
be equal to |
first, |
last The range of segments to insert. |
boost::urls::segments_encoded_ref::replace
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
iterator
replace(
iterator pos,
pct_string_view s);
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
An iterator to the replaced segment.
Parameters
Name | Description |
---|---|
pos |
An iterator to the segment. |
s |
The string to assign. |
boost::urls::segments_encoded_ref::replace
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
iterator
replace(
iterator from,
iterator to,
pct_string_view s);
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.
Exceptions
Name | Thrown on |
---|---|
|
The string contains an invalid percent-encoding. |
Return Value
An iterator to the new segment.
Parameters
Name | Description |
---|---|
from, |
to The range of segments to replace. |
s |
The string to assign. |
boost::urls::segments_encoded_ref::replace
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
iterator
replace(
iterator from,
iterator to,
std::initializer_list<pct_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. 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.
Exceptions
Name | Thrown on |
---|---|
|
The list contains an invalid percent-encoding. |
Return Value
An iterator to the first
segment inserted, or one past to
if
init.size() == 0
.
Parameters
Name | Description |
---|---|
from, |
to The range of segments to replace. |
init |
The list of segments to assign. |
boost::urls::segments_encoded_ref::replace
Synopsis
Declared in header <boost/url/segments_encoded_ref.hpp>
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.
Exceptions
Name | Thrown on |
---|---|
|
The range contains an invalid percent-encoding. |
Return Value
An iterator to the first
segment inserted, or one past to
if
init.size() == 0
.
Parameters
Name | Description |
---|---|
from, |
to The range of segments to replace. |
first, |
last The range of segments to assign. |
boost::urls::segments_ref::operator=
Synopsis
Declared in header <boost/url/segments_ref.hpp>
segments_ref&
operator=(segments_ref const& 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.
@{
Parameters
Name | Description |
---|---|
other |
The segments to assign. |
boost::urls::segments_ref::operator=
Synopsis
Declared in header <boost/url/segments_ref.hpp>
segments_ref&
operator=(segments_view const& other);
boost::urls::segments_ref::operator=
Synopsis
Declared in header <boost/url/segments_ref.hpp>
segments_ref&
operator=(std::initializer_list<core::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.
Parameters
Name | Description |
---|---|
init |
The list of segments to assign. |
boost::urls::segments_ref::assign
Synopsis
Declared in header <boost/url/segments_ref.hpp>
void
assign(std::initializer_list<core::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.
Parameters
Name | Description |
---|---|
init |
The list of segments to assign. |
boost::urls::segments_ref::assign
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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.
Parameters
Name | Description |
---|---|
first, |
last The range of segments to assign. |
boost::urls::segments_ref::erase
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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
An iterator to one past the removed segment.
Parameters
Name | Description |
---|---|
pos |
An iterator to the segment. |
boost::urls::segments_ref::erase
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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
An iterator to one past the removed range.
Parameters
Name | Description |
---|---|
first, |
last The range of segments to erase. |
boost::urls::segments_ref::insert
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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
An iterator to the inserted segment.
Parameters
Name | Description |
---|---|
before |
An iterator before which
the segment is inserted. This may
be equal to |
s |
The segment to insert. |
boost::urls::segments_ref::insert
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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
An iterator to the first
element inserted, or before
if
init.size() == 0
.
Parameters
Name | Description |
---|---|
before |
An iterator before which
the list is inserted. This may
be equal to |
init |
The list of segments to insert. |
boost::urls::segments_ref::insert
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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
An iterator to the first
segment inserted, or before
if
init.empty()
.
Parameters
Name | Description |
---|---|
before |
An iterator before which
the range is inserted. This may
be equal to |
first, |
last The range of segments to insert. |
boost::urls::segments_ref::replace
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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
An iterator to the replaced segment.
Parameters
Name | Description |
---|---|
pos |
An iterator to the segment. |
s |
The string to assign. |
boost::urls::segments_ref::replace
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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
An iterator to the new segment.
Parameters
Name | Description |
---|---|
from, |
to The range of segments to replace. |
s |
The string to assign. |
boost::urls::segments_ref::replace
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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
An iterator to the first
segment inserted, or one past to
if
init.size() == 0
.
Parameters
Name | Description |
---|---|
from, |
to The range of segments to replace. |
init |
The list of segments to assign. |
boost::urls::segments_ref::replace
Synopsis
Declared in header <boost/url/segments_ref.hpp>
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
An iterator to the first
segment inserted, or one past to
if
init.size() == 0
.
Parameters
Name | Description |
---|---|
from, |
to The range of segments to replace. |
first, |
last The range of segments to assign. |
boost::urls::url_view_base::params
Synopsis
Declared in header <boost/url/url_view_base.hpp>
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
-
link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 >3.4. Query (rfc3986)</a> @li <a href=[://en.wikipedia.org/wiki/Query_string" >Query string (Wikipedia)]
See Also
encoded_params , encoded_query , has_query , query .
boost::urls::url_view_base::params
Synopsis
Declared in header <boost/url/url_view_base.hpp>
params_view
params(encoding_opts opt) const noexcept;
boost::urls::url::url
Synopsis
Declared in header <boost/url/url.hpp>
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
url u;
Postconditions
this->empty() == true
Complexity
Constant.
Exception Safety
Throws nothing.
BNF
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
Specification
boost::urls::url::url
Synopsis
Declared in header <boost/url/url.hpp>
explicit
url(core::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
Exceptions
Name | Thrown on |
---|---|
|
The input does not contain a valid url. |
Parameters
Name | Description |
---|---|
s |
The string to parse. |
boost::urls::url::url
Synopsis
Declared in header <boost/url/url.hpp>
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.
Parameters
Name | Description |
---|---|
u |
The url to move from. |
boost::urls::url::url
Synopsis
Declared in header <boost/url/url.hpp>
url(url_view_base const& 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.
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
u |
The url to copy. |
boost::urls::url::url
Synopsis
Declared in header <boost/url/url.hpp>
url(url const& 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.
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
u |
The url to copy. |
boost::urls::url::operator=
Synopsis
Declared in header <boost/url/url.hpp>
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.
Parameters
Name | Description |
---|---|
u |
The url to assign from. |
boost::urls::url::operator=
Synopsis
Declared in header <boost/url/url.hpp>
url&
operator=(url_view_base const& 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.
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
u |
The url to copy. |
boost::urls::url::operator=
Synopsis
Declared in header <boost/url/url.hpp>
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.
Parameters
Name | Description |
---|---|
u |
The url to copy. |
boost::urls::static_url::static_url
Synopsis
Declared in header <boost/url/static_url.hpp>
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 ]
Specification
boost::urls::static_url::static_url
Synopsis
Declared in header <boost/url/static_url.hpp>
explicit
static_url(core::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
Exceptions
Name | Thrown on |
---|---|
|
The input does not contain a valid url. |
Parameters
Name | Description |
---|---|
s |
The string to parse. |
boost::urls::static_url::static_url
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url(static_url const& 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.
Parameters
Name | Description |
---|---|
u |
The url to copy. |
boost::urls::static_url::static_url
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url(url_view_base const& 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.
Exceptions
Name | Thrown on |
---|---|
|
Capacity would be exceeded. |
Parameters
Name | Description |
---|---|
u |
The url to copy. |
boost::urls::static_url::operator=
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
operator=(static_url const& 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.
Parameters
Name | Description |
---|---|
u |
The url to copy. |
boost::urls::static_url::operator=
Synopsis
Declared in header <boost/url/static_url.hpp>
static_url&
operator=(url_view_base const& 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.
Exceptions
Name | Thrown on |
---|---|
|
Capacity would be exceeded. |
Parameters
Name | Description |
---|---|
u |
The url to copy. |
boost::urls::format
Synopsis
Declared in header <boost/url/format.hpp>
template<class... Args>
url
format(
core::string_view fmt,
Args&&... args);
Description
Format arguments according to the format URL string into a url .
The rules for a format URL string are the same
as for a std::format_string
, where replacement
fields are delimited by curly braces.
The URL components to which replacement fields belong are identified before replacement is applied and any invalid characters for that formatted argument are percent-escaped.
Hence, the delimiters between URL components,
such as :
, //
, ?
, and #
, should be
included in the URL format string. Likewise,
a format string with a single "{}"
is
interpreted as a path and any replacement
characters invalid in this component will be
encoded to form a valid URL.
Example
assert(format("{}", "Hello world!").buffer() == "Hello%20world%21");
Preconditions
All replacement fields must be valid and the resulting URL should be valid after arguments are formatted into the URL.
Because any invalid characters for a URL component are encoded by this function, only replacements in the scheme and port components might be invalid, as these components do not allow percent-encoding of arbitrary characters.
BNF
replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}"
arg_id ::= integer | identifier
integer ::= digit+
digit ::= "0"..."9"
identifier ::= id_start id_continue*
id_start ::= "a"..."z" | "A"..."Z" | "_"
id_continue ::= id_start | digit
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
A URL holding the formatted result.
Parameters
Name | Description |
---|---|
fmt |
The format URL string. |
args |
Arguments to be formatted. |
See Also
boost::urls::format
Synopsis
Declared in header <boost/url/format.hpp>
Description
Format arguments according to the format URL string into a url .
This overload allows type-erased arguments to be passed as an initializer_list, which is mostly convenient for named parameters.
All arguments must be convertible to a implementation defined type able to store a type-erased reference to any valid format argument.
The rules for a format URL string are the same
as for a std::format_string
, where replacement
fields are delimited by curly braces.
The URL components to which replacement fields belong are identified before replacement is applied and any invalid characters for that formatted argument are percent-escaped.
Hence, the delimiters between URL components,
such as :
, //
, ?
, and #
, should be
included in the URL format string. Likewise,
a format string with a single "{}"
is
interpreted as a path and any replacement
characters invalid in this component will be
encoded to form a valid URL.
Example
assert(format("user/{id}", {{"id", 1}}).buffer() == "user/1");
Preconditions
All replacement fields must be valid and the resulting URL should be valid after arguments are formatted into the URL.
Because any invalid characters for a URL component are encoded by this function, only replacements in the scheme and port components might be invalid, as these components do not allow percent-encoding of arbitrary characters.
BNF
replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}"
arg_id ::= integer | identifier
integer ::= digit+
digit ::= "0"..."9"
identifier ::= id_start id_continue*
id_start ::= "a"..."z" | "A"..."Z" | "_"
id_continue ::= id_start | digit
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Return Value
A URL holding the formatted result.
Parameters
Name | Description |
---|---|
fmt |
The format URL string. |
args |
Arguments to be formatted. |
See Also
boost::urls::format_to
Synopsis
Declared in header <boost/url/format.hpp>
template<class... Args>
void
format_to(
url_base& u,
core::string_view fmt,
Args&&... args);
Description
Format arguments according to the format URL string into a url_base .
The rules for a format URL string are the same
as for a std::format_string
, where replacement
fields are delimited by curly braces.
The URL components to which replacement fields belong are identified before replacement is applied and any invalid characters for that formatted argument are percent-escaped.
Hence, the delimiters between URL components,
such as :
, //
, ?
, and #
, should be
included in the URL format string. Likewise,
a format string with a single "{}"
is
interpreted as a path and any replacement
characters invalid in this component will be
encoded to form a valid URL.
Example
static_url<30> u;
format(u, "{}", "Hello world!");
assert(u.buffer() == "Hello%20world%21");
Preconditions
All replacement fields must be valid and the resulting URL should be valid after arguments are formatted into the URL.
Because any invalid characters for a URL component are encoded by this function, only replacements in the scheme and port components might be invalid, as these components do not allow percent-encoding of arbitrary characters.
Exception Safety
Strong guarantee.
BNF
replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}"
arg_id ::= integer | identifier
integer ::= digit+
digit ::= "0"..."9"
identifier ::= id_start id_continue*
id_start ::= "a"..."z" | "A"..."Z" | "_"
id_continue ::= id_start | digit
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
u |
An object that derives from url_base . |
fmt |
The format URL string. |
args |
Arguments to be formatted. |
See Also
format .
boost::urls::format_to
Synopsis
Declared in header <boost/url/format.hpp>
Description
Format arguments according to the format URL string into a url_base .
This overload allows type-erased arguments to be passed as an initializer_list, which is mostly convenient for named parameters.
All arguments must be convertible to a implementation defined type able to store a type-erased reference to any valid format argument.
The rules for a format URL string are the same
as for a std::format_string
, where replacement
fields are delimited by curly braces.
The URL components to which replacement fields belong are identified before replacement is applied and any invalid characters for that formatted argument are percent-escaped.
Hence, the delimiters between URL components,
such as :
, //
, ?
, and #
, should be
included in the URL format string. Likewise,
a format string with a single "{}"
is
interpreted as a path and any replacement
characters invalid in this component will be
encoded to form a valid URL.
Example
static_url<30> u;
format_to(u, "user/{id}", {{"id", 1}})
assert(u.buffer() == "user/1");
Preconditions
All replacement fields must be valid and the resulting URL should be valid after arguments are formatted into the URL.
Because any invalid characters for a URL component are encoded by this function, only replacements in the scheme and port components might be invalid, as these components do not allow percent-encoding of arbitrary characters.
Exception Safety
Strong guarantee.
BNF
replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}"
arg_id ::= integer | identifier
integer ::= digit+
digit ::= "0"..."9"
identifier ::= id_start id_continue*
id_start ::= "a"..."z" | "A"..."Z" | "_"
id_continue ::= id_start | digit
Specification
Exceptions
Name | Thrown on |
---|---|
|
|
Parameters
Name | Description |
---|---|
u |
An object that derives from url_base . |
fmt |
The format URL string. |
args |
Arguments to be formatted. |
See Also
format .
std::hash<boost::urls::url>::hash
Synopsis
Declared in header <boost/url/url.hpp>
constexpr
hash() = default;
std::hash<boost::urls::url>::hash
Synopsis
Declared in header <boost/url/url.hpp>
std::hash<boost::urls::url>::hash
Synopsis
Declared in header <boost/url/url.hpp>
explicit
hash(std::size_t salt) noexcept;
std::hash<boost::urls::url_view>::hash
Synopsis
Declared in header <boost/url/url_view.hpp>
constexpr
hash() = default;
std::hash<boost::urls::url_view>::hash
Synopsis
Declared in header <boost/url/url_view.hpp>
std::hash<boost::urls::url_view>::hash
Synopsis
Declared in header <boost/url/url_view.hpp>
explicit
hash(std::size_t salt) noexcept;
std::hash<boost::urls::static_url<N>>::hash
Synopsis
Declared in header <boost/url/static_url.hpp>
hash() = default;
std::hash<boost::urls::static_url<N>>::hash
Synopsis
Declared in header <boost/url/static_url.hpp>
hash(hash const&) = default;
std::hash<boost::urls::static_url<N>>::hash
Synopsis
Declared in header <boost/url/static_url.hpp>
explicit
hash(std::size_t salt) noexcept;
Created with MrDocs