Name | Description |
---|---|
make_void | |
void_t | |
encoding_opts | Percent-encoding options |
error_types | |
string_token | |
grammar | |
decode_view | A reference to a valid, percent-encoded string |
pct_string_view | A reference to a valid percent-encoded string |
make_pct_string_view_unsafe | |
make_pct_string_view | Return a valid percent-encoded string |
operator== | |
operator!= | |
operator< | |
operator<= | |
operator> | |
operator>= | |
operator<< | Format the string with percent-decoding applied to the output stream |
sub_delim_chars | The sub-delims character set |
unreserved_chars | The unreserved character set |
pchars | The path character set |
encoded_size | Return the buffer size needed for percent-encoding |
encode | Apply percent-encoding to a string |
encode_unsafe | |
encode | Return a percent-encoded string |
no_value_t | The type of no_value |
param_pct_view | A query parameter |
param_view | A query parameter |
no_value | Constant indicating no value in a param |
param | A query parameter |
host_type | Identifies the type of host in a URL. |
error | Error codes returned the library |
make_error_code | |
ipv4_address | An IP version 4 style address. |
operator== | Return true if two addresses are equal |
operator!= | Return true if two addresses are not equal |
operator<< | Format the address to an output stream. |
parse_ipv4_address | Return an IPv4 address from an IP address string in dotted decimal form |
ipv6_address | An IP version 6 style address. |
operator== | Return true if two addresses are equal |
operator!= | Return true if two addresses are not equal |
operator<< | Format the address to an output stream |
parse_ipv6_address | Parse a string containing an IPv6 address. |
scheme | Identifies a known URL scheme |
string_to_scheme | Return the known scheme for a non-normalized string, if known |
to_string | Return the normalized string for a known scheme |
default_port | Return the default port for a known scheme |
url_view | A non-owning reference to a valid URL |
authority_view | A non-owning reference to a valid authority |
operator== | Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |
operator!= | Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |
operator< | Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |
operator<= | Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |
operator> | Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |
operator>= | Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized. |
operator<< | Format the encoded authority to the output stream |
parse_authority | Parse an authority |
ignore_case_t | |
ignore_case | |
ignore_case_param | An optional parameter to determine case-sensitivity |
segments_encoded_base | Common functionality for containers |
operator<< | Format to an output stream |
segments_base | Common functionality for containers |
operator<< | Format to an output stream |
segments_view | A view representing path segments in a URL |
segments_encoded_view | A view representing path segments in a URL |
parse_path | Parse a string and return an encoded segment view |
authority_rule_t | |
authority_rule | |
pct_encoded_rule_t | |
pct_encoded_rule | |
pct_encoded_rule | |
variant | The type of variant used by the library |
optional | |
params_encoded_base | Common functionality for containers |
operator<< | Format to an output stream |
params_ref | A view representing query parameters in a URL |
operator== | |
operator!= | |
params_base | Common functionality for containers |
operator<< | Format to an output stream |
params_view | A view representing query parameters in a URL |
params_encoded_view | A view representing query parameters in a URL |
parse_query | Parse a string and return an encoded params view |
url_base | Common functionality for containers |
params_encoded_ref | A view representing query parameters in a URL |
segments_encoded_ref | A view representing path segments in a URL |
segments_ref | A view representing path segments in a URL |
url_view_base | Common functionality for containers |
operator== | Return the result of comparing two URLs |
operator!= | Return the result of comparing two URLs |
operator< | Return the result of comparing two URLs |
operator<= | Return the result of comparing two URLs |
operator> | Return the result of comparing two URLs |
operator>= | Return the result of comparing two URLs |
operator<< | Format the url to the output stream |
resolve | Resolve a URL reference against a base URL |
url | A modifiable container for a URL. |
swap | Swap |
ipv4_address_rule_t | |
ipv4_address_rule | |
ipv6_address_rule_t | |
ipv6_address_rule | |
parse_absolute_uri | Return a reference to a parsed URL string |
parse_origin_form | Return a reference to a parsed URL string |
parse_relative_ref | Return a reference to a parsed URL string |
parse_uri | Return a reference to a parsed URL string |
parse_uri_reference | Return a reference to a parsed URL string |
absolute_uri_rule_t | |
absolute_uri_rule | |
relative_ref_rule_t | |
relative_ref_rule | |
uri_rule_t | |
uri_rule | |
uri_reference_rule_t | |
uri_reference_rule | |
origin_form_rule_t | |
origin_form_rule | |
query_rule_t | |
query_rule | |
static_url | A modifiable container for a URL. |
static_url_base | Common implementation for all static URLs |
template<
class...>
struct make_void ;
Declared in file <boost/url/detail/config.hpp> at line 138
Name | Description |
---|---|
type |
typedef void type ;
Declared in file <boost/url/detail/config.hpp> at line 138
template<
class... Ts>
using void_t = make_void<Ts...>::type ;
Declared in file <boost/url/detail/config.hpp> at line 139
Percent-encoding options
struct encoding_opts ;
Declared in file <boost/url/encoding_opts.hpp> at line 31
Name | Description |
---|---|
encoding_opts |
Name | Description |
---|---|
space_as_plus | True if spaces encode to and from plus signs |
lower_case | True if hexadecimal digits are emitted as lower case |
disallow_null | True if nulls are not allowed |
These options are used to customize the behavior of algorithms which use percent escapes, such as encoding or decoding.
void
encoding_opts(
bool space_as_plus_,
bool lower_case_,
bool disallow_null_) noexcept;
Declared in file <src/encoding_opts.cpp> at line 19
Name | Description |
---|---|
error_category | The type of error category used by the library |
error_code | The type of error code used by the library |
error_condition | The type of error condition used by the library |
system_error | The type of system error thrown by the library |
result | The type of result returned by library functions |
The type of error category used by the library
using error_category = error_category ;
Declared in file <boost/url/error_types.hpp> at line 43
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.
The type of error code used by the library
using error_code = error_code ;
Declared in file <boost/url/error_types.hpp> at line 65
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.
The type of error condition used by the library
using error_condition = error_condition ;
Declared in file <boost/url/error_types.hpp> at line 87
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.
The type of system error thrown by the library
using system_error = system_error ;
Declared in file <boost/url/error_types.hpp> at line 109
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.
The type of result returned by library functions
template<
class T>
using result = result<T, error_code> ;
Declared in file <boost/url/error_types.hpp> at line 280
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.
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
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;
Name | Description |
---|---|
arg | Base class for string tokens, and algorithm parameters |
is_token | |
is_token | |
return_string | |
append_to_t | |
append_to | |
assign_to_t | |
assign_to | |
preserve_size_t | |
preserve_size |
Base class for string tokens, and algorithm parameters
struct arg ;
Declared in file <boost/url/grammar/string_token.hpp> at line 49
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.
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.
Return a modifiable character buffer
char*
prepare(
size_t n);
Declared in file <boost/url/grammar/string_token.hpp> at line 68
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.
This function may only be called once. After invoking the function, the only valid operation is destruction.
void
~arg();
Declared in file <boost/url/grammar/string_token.hpp> at line 71
void
arg();
Declared in file <boost/url/grammar/string_token.hpp> at line 72
void
arg(
const arg&) = delete;
Declared in file <boost/url/grammar/string_token.hpp> at line 74
template<
class T,
class = void>
struct is_token
: false_type;
Declared in file <boost/url/grammar/string_token.hpp> at line 88
Name | Description |
---|---|
value_type | |
type |
Name | Description |
---|---|
operator value_type | |
operator() |
template<
class T>
struct is_token<T, void_t<, >>
: integral_constant<bool, std::is_convertible().result()), typename T::result_type>::value && std::is_same().prepare(0)), char *>::value && std::is_base_of::value && std::is_convertible::value> ;
Declared in file <boost/url/grammar/string_token.hpp> at line 91
Name | Description |
---|---|
value_type | |
type |
Name | Description |
---|---|
operator value_type | |
operator() |
using result_type = string ;
Declared in file <boost/url/grammar/string_token.hpp> at line 120
char*
prepare(
size_t n);
Declared in file <boost/url/grammar/string_token.hpp> at line 122
result_type
result() noexcept;
Declared in file <boost/url/grammar/string_token.hpp> at line 129
template<
class Alloc>
struct append_to_t
: arg;
Declared in file <boost/url/grammar/string_token.hpp> at line 156
Name | Description |
---|---|
string_type | |
result_type |
using string_type = basic_string<char, char_traits<char>, Alloc> ;
Declared in file <boost/url/grammar/string_token.hpp> at line 159
using result_type = string_type& ;
Declared in file <boost/url/grammar/string_token.hpp> at line 163
void
append_to_t(
string_type& s) noexcept;
Declared in file <boost/url/grammar/string_token.hpp> at line 165
char*
prepare(
size_t n);
Declared in file <boost/url/grammar/string_token.hpp> at line 172
result_type
result() noexcept;
Declared in file <boost/url/grammar/string_token.hpp> at line 182
template<
class Alloc = allocator<char>>
append_to_t<Alloc>
append_to(
basic_string<char, char_traits<char>, Alloc>& s);
Declared in file <boost/url/grammar/string_token.hpp> at line 195
template<
class Alloc>
struct assign_to_t
: arg;
Declared in file <boost/url/grammar/string_token.hpp> at line 222
Name | Description |
---|---|
string_type | |
result_type |
using string_type = basic_string<char, char_traits<char>, Alloc> ;
Declared in file <boost/url/grammar/string_token.hpp> at line 225
using result_type = string_type& ;
Declared in file <boost/url/grammar/string_token.hpp> at line 229
void
assign_to_t(
string_type& s) noexcept;
Declared in file <boost/url/grammar/string_token.hpp> at line 231
char*
prepare(
size_t n);
Declared in file <boost/url/grammar/string_token.hpp> at line 238
result_type
result() noexcept;
Declared in file <boost/url/grammar/string_token.hpp> at line 245
template<
class Alloc = allocator<char>>
assign_to_t<Alloc>
assign_to(
basic_string<char, char_traits<char>, Alloc>& s);
Declared in file <boost/url/grammar/string_token.hpp> at line 258
template<
class Alloc>
struct preserve_size_t
: arg;
Declared in file <boost/url/grammar/string_token.hpp> at line 285
Name | Description |
---|---|
result_type | |
string_type |
using result_type = string_view ;
Declared in file <boost/url/grammar/string_token.hpp> at line 288
using string_type = basic_string<char, char_traits<char>, Alloc> ;
Declared in file <boost/url/grammar/string_token.hpp> at line 290
void
preserve_size_t(
string_type& s) noexcept;
Declared in file <boost/url/grammar/string_token.hpp> at line 294
char*
prepare(
size_t n);
Declared in file <boost/url/grammar/string_token.hpp> at line 301
result_type
result() noexcept;
Declared in file <boost/url/grammar/string_token.hpp> at line 312
template<
class Alloc = allocator<char>>
preserve_size_t<Alloc>
preserve_size(
basic_string<char, char_traits<char>, Alloc>& s);
Declared in file <boost/url/grammar/string_token.hpp> at line 327
Name | Description |
---|---|
string_view_base | Common functionality for string views |
operator== | |
operator!= | |
operator< | |
operator<= | |
operator> | |
operator>= | |
hash_value | Return the hash of this value |
operator<< | Format a string to an output stream |
is_rule | |
is_rule | |
hexdig_chars_t | |
hexdig_chars | |
hexdig_value | Return the decimal value of a hex character |
lut_chars | A set of characters |
operator+ | Return the union of two character sets. |
operator- | Return a new character set by subtracting |
all_chars_t | |
all_chars | A character set containing all characters. |
is_charset | |
is_charset | |
find_if | Find the first character in the string that is in the set. |
find_if_not | Find the first character in the string that is not in CharSet |
ref | |
parse | Parse a character buffer using a rule |
parse | Parse a character buffer using a rule |
ref | |
ref | |
error | Error codes returned when using rules |
condition | Error conditions for errors received from rules |
make_error_code | |
make_error_condition | |
to_lower | Return c converted to lowercase |
to_upper | Return c converted to uppercase |
ci_compare | Return the case-insensitive comparison of s0 and s1 |
ci_digest | Return the case-insensitive digest of a string |
ci_is_equal | |
ci_is_equal | |
ci_is_less | Return true if s0 is less than s1 using case-insensitive comparison |
ci_hash | |
ci_equal | |
ci_less | |
variant_rule_t | |
variant_rule | |
variant_rule | |
unsigned_rule | |
digit_chars_t | |
digit_chars | |
ch_delim_rule | |
delim_rule | |
cs_delim_rule | |
delim_rule | |
optional_rule_t | |
optional_rule | |
optional_rule | |
tuple_rule_t | |
tuple_rule | |
tuple_rule | |
squelch | |
aligned_storage | |
recycled | A thread-safe collection of instances of T |
recycled_ptr | A pointer to shared instance of T |
alpha_chars_t | |
alpha_chars | A character set containing the alphabetical characters. |
token_rule_t | |
token_rule | |
range | A forward range of parsed elements |
range_rule_t | |
range_rule_t | |
range_rule | |
range_rule | |
alnum_chars_t | |
alnum_chars | |
vchars_t | |
vchars | |
dec_octet_rule_t | |
dec_octet_rule | |
literal_rule |
Common functionality for string views
class string_view_base ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 36
Name | Description |
---|---|
traits_type | The character traits |
value_type | The value type |
pointer | The pointer type |
const_pointer | The const pointer type |
reference | The reference type |
const_reference | The const reference type |
const_iterator | The const iterator type |
iterator | The iterator type |
const_reverse_iterator | The const reverse iterator type |
reverse_iterator | The reverse iterator type |
size_type | The size type |
difference_type | The difference type |
Name | Description |
---|---|
operator string_view | Conversion |
operator string | Conversion |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
cbegin | Return an iterator to the beginning |
cend | Return an iterator to the end |
rbegin | |
rend | |
crbegin | |
crend | |
size | Return the size |
length | Return the size |
max_size | Return the maximum allowed size |
empty | Return true if the string is empty |
operator[] | Access a character |
at | Access a character |
front | Return the first character |
back | Return the last character |
data | Return a pointer to the character buffer |
copy | Copy the characters to another buffer |
substr | Return a view to part of the string |
compare | Return the result of comparing to another string |
compare | Return the result of comparing to another string |
compare | Return the result of comparing to another string |
compare | Return the result of comparing to another string |
compare | Return the result of comparing to another string |
compare | Return the result of comparing to another string |
starts_with | Return true if a matching prefix exists |
starts_with | Return true if a matching prefix exists |
starts_with | Return true if a matching prefix exists |
ends_with | Return true if a matching suffix exists |
ends_with | Return true if a matching suffix exists |
ends_with | Return true if a matching suffix exists |
find | Return the position of matching characters |
find | Return the position of matching characters |
find | Return the position of matching characters |
find | Return the position of matching characters |
rfind | Return the position of matching characters |
rfind | Return the position of matching characters |
rfind | Return the position of matching characters |
rfind | Return the position of matching characters |
find_first_of | Return the position of the first match |
find_first_of | Return the position of the first match |
find_first_of | Return the position of the first match |
find_first_of | Return the position of the first match |
find_last_of | Return the position of the last match |
find_last_of | Return the position of the last match |
find_last_of | Return the position of the last match |
find_last_of | Return the position of the last match |
find_first_not_of | Return the position of the first non-match |
find_first_not_of | Return the position of the first non-match |
find_first_not_of | Return the position of the first non-match |
find_first_not_of | Return the position of the first non-match |
find_last_not_of | Return the position of the last non-match |
find_last_not_of | Return the position of the last non-match |
find_last_not_of | Return the position of the last non-match |
find_last_not_of | Return the position of the last non-match |
contains | Return true if matching characters are found |
contains | Return true if matching characters are found |
contains | Return true if matching characters are found |
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.
The character traits
typedef char_traits<char> traits_type ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 87
The value type
typedef char value_type ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 89
The pointer type
typedef char* pointer ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 91
The const pointer type
typedef const char* const_pointer ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 93
The reference type
typedef char& reference ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 95
The const reference type
typedef const char& const_reference ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 97
The const iterator type
typedef const char* const_iterator ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 99
The iterator type
typedef const_iterator iterator ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 101
The const reverse iterator type
typedef reverse_iterator<const_iterator> const_reverse_iterator ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 103
The reverse iterator type
typedef const_reverse_iterator reverse_iterator ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 106
The size type
typedef size_t size_type ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 108
The difference type
typedef ptrdiff_t difference_type ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 110
A constant used to represent "no position"
const size_t npos ;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 113
Conversion
string_view
operator string_view() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 119
Conversion
string
operator string() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 142
Conversion to std::string is explicit because assigning to string using an implicit constructor does not preserve capacity.
Return an iterator to the beginning
const_iterator
begin() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 157
See `core::string_view::begin`
Return an iterator to the end
const_iterator
end() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 166
See `core::string_view::end`
Return an iterator to the beginning
const_iterator
cbegin() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 175
See `core::string_view::cbegin`
Return an iterator to the end
const_iterator
cend() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 184
See `core::string_view::cend`
const_reverse_iterator
rbegin() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 194
const_reverse_iterator
rend() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 206
const_reverse_iterator
crbegin() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 218
const_reverse_iterator
crend() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 230
Return the size
size_type
size() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 243
See `core::string_view::size`
Return the size
size_type
length() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 252
See `core::string_view::length`
Return the maximum allowed size
size_type
max_size() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 261
See `core::string_view::max_size`
Return true if the string is empty
bool
empty() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 270
See `core::string_view::size`
Access a character
const_reference
operator[](
size_type pos) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 281
See `core::string_view::operator[]`
Access a character
const_reference
at(
size_type pos);
Declared in file <boost/url/grammar/string_view_base.hpp> at line 291
See `core::string_view::at`
Return the first character
const_reference
front() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 301
See `core::string_view::front`
Return the last character
const_reference
back() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 311
See `core::string_view::back`
Return a pointer to the character buffer
const_pointer
data() noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 321
See `core::string_view::data`
Copy the characters to another buffer
Declared in file <boost/url/grammar/string_view_base.hpp> at line 333
See `core::string_view::copy`
Return a view to part of the string
Declared in file <boost/url/grammar/string_view_base.hpp> at line 343
See `core::string_view::substr`
Return the result of comparing to another string
int
compare(
string_view str) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 355
See `core::string_view::compare`
Return the result of comparing to another string
Declared in file <boost/url/grammar/string_view_base.hpp> at line 365
See `core::string_view::compare`
Return the result of comparing to another string
Declared in file <boost/url/grammar/string_view_base.hpp> at line 375
See `core::string_view::compare`
Return the result of comparing to another string
int
compare(
const char* s) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 386
See `core::string_view::compare`
Return the result of comparing to another string
Declared in file <boost/url/grammar/string_view_base.hpp> at line 396
See `core::string_view::compare`
Return the result of comparing to another string
Declared in file <boost/url/grammar/string_view_base.hpp> at line 406
See `core::string_view::compare`
Return true if a matching prefix exists
bool
starts_with(
string_view x) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 419
See `core::string_view::starts_with`
Return true if a matching prefix exists
bool
starts_with(
char x) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 429
See `core::string_view::starts_with`
Return true if a matching prefix exists
bool
starts_with(
const char* x) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 439
See `core::string_view::starts_with`
Return true if a matching suffix exists
bool
ends_with(
string_view x) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 451
See `core::string_view::ends_with`
Return true if a matching suffix exists
bool
ends_with(
char x) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 461
See `core::string_view::ends_with`
Return true if a matching suffix exists
bool
ends_with(
const char* x) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 471
See `core::string_view::ends_with`
Return the position of matching characters
Declared in file <boost/url/grammar/string_view_base.hpp> at line 483
See `core::string_view::find`
Return the position of matching characters
Declared in file <boost/url/grammar/string_view_base.hpp> at line 493
See `core::string_view::find`
Return the position of matching characters
Declared in file <boost/url/grammar/string_view_base.hpp> at line 503
See `core::string_view::find`
Return the position of matching characters
Declared in file <boost/url/grammar/string_view_base.hpp> at line 513
See `core::string_view::find`
Return the position of matching characters
Declared in file <boost/url/grammar/string_view_base.hpp> at line 525
See `core::string_view::rfind`
Return the position of matching characters
Declared in file <boost/url/grammar/string_view_base.hpp> at line 535
See `core::string_view::rfind`
Return the position of matching characters
Declared in file <boost/url/grammar/string_view_base.hpp> at line 545
See `core::string_view::rfind`
Return the position of matching characters
Declared in file <boost/url/grammar/string_view_base.hpp> at line 555
See `core::string_view::rfind`
Return the position of the first match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 567
See `core::string_view::find_first_of`
Return the position of the first match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 577
See `core::string_view::find_first_of`
Return the position of the first match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 587
See `core::string_view::find_first_of`
Return the position of the first match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 597
See `core::string_view::find_first_of`
Return the position of the last match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 609
See `core::string_view::find_last_of`
Return the position of the last match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 619
See `core::string_view::find_last_of`
Return the position of the last match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 629
See `core::string_view::find_last_of`
Return the position of the last match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 639
See `core::string_view::find_last_of`
Return the position of the first non-match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 651
See `core::string_view::find_first_not_of`
Return the position of the first non-match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 661
See `core::string_view::find_first_not_of`
Return the position of the first non-match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 671
See `core::string_view::find_first_not_of`
Return the position of the first non-match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 681
See `core::string_view::find_first_not_of`
Return the position of the last non-match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 693
See `core::string_view::find_last_not_of`
Return the position of the last non-match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 703
See `core::string_view::find_last_not_of`
Return the position of the last non-match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 713
See `core::string_view::find_last_not_of`
Return the position of the last non-match
Declared in file <boost/url/grammar/string_view_base.hpp> at line 723
See `core::string_view::find_last_not_of`
Return true if matching characters are found
bool
contains(
string_view sv) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 735
See `core::string_view::contains`
Return true if matching characters are found
bool
contains(
char c) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 744
See `core::string_view::contains`
Return true if matching characters are found
bool
contains(
const char* s) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 753
See `core::string_view::contains`
template<
class S0,
class S1>
enable_if<is_match::value, bool> ::type
operator==(
const S0& s0,
const S1& s1) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 776
template<
class S0,
class S1>
enable_if<is_match::value, bool> ::type
operator!=(
const S0& s0,
const S1& s1) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 785
template<
class S0,
class S1>
enable_if<is_match::value, bool> ::type
operator<(
const S0& s0,
const S1& s1) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 794
template<
class S0,
class S1>
enable_if<is_match::value, bool> ::type
operator<=(
const S0& s0,
const S1& s1) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 803
template<
class S0,
class S1>
enable_if<is_match::value, bool> ::type
operator>(
const S0& s0,
const S1& s1) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 812
template<
class S0,
class S1>
enable_if<is_match::value, bool> ::type
operator>=(
const S0& s0,
const S1& s1) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 821
Return the hash of this value
size_t
hash_value(
const string_view_base& s) noexcept;
Declared in file <boost/url/grammar/string_view_base.hpp> at line 834
Format a string to an output stream
ostream&
operator<<(
ostream& os,
const string_view_base& s);
Declared in file <src/grammar/string_view_base.cpp> at line 21
template<
class T,
class = void>
struct is_rule
: false_type;
Declared in file <boost/url/grammar/type_traits.hpp> at line 51
Name | Description |
---|---|
value_type | |
type |
Name | Description |
---|---|
operator value_type | |
operator() |
template<
class T>
struct is_rule<T, void_t<>>
: is_nothrow_copy_constructible<T>;
Declared in file <boost/url/grammar/type_traits.hpp> at line 54
struct hexdig_chars_t ;
Declared in file <boost/url/grammar/hexdig_chars.hpp> at line 61
Name | Description |
---|---|
operator() | Return true if c is in the character set. |
find_if | |
find_if_not |
Return true if c is in the character set.
bool
operator()(
char c) noexcept;
Declared in file <boost/url/grammar/hexdig_chars.hpp> at line 65
const char*
find_if(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/hexdig_chars.hpp> at line 76
const char*
find_if_not(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/hexdig_chars.hpp> at line 85
const hexdig_chars_t hexdig_chars ;
Declared in file <boost/url/grammar/hexdig_chars.hpp> at line 96
Return the decimal value of a hex character
signed char
hexdig_value(
char ch) noexcept;
Declared in file <boost/url/grammar/hexdig_chars.hpp> at line 123
This function returns the decimal value of a hexadecimal character, or -1 if the argument is not a valid hexadecimal digit.
HEXDIG = DIGIT
/ "A" / "B" / "C" / "D" / "E" / "F"
/ "a" / "b" / "c" / "d" / "e" / "f"
A set of characters
class lut_chars ;
Declared in file <boost/url/grammar/lut_chars.hpp> at line 64
Name | Description |
---|---|
lut_chars | Constructor |
lut_chars | Constructor |
lut_chars | |
operator() | Return true if ch is in the character set. |
operator~ | Return a new character set which is the complement of another character set. |
find_if | |
find_if_not |
The characters defined by instances of this set are provided upon construction. The `constexpr` implementation allows these to become compile-time constants.
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 ) );
Constructor
void
lut_chars(
char ch) noexcept;
Declared in file <boost/url/grammar/lut_chars.hpp> at line 157
This function constructs a character set which has as a single member, the character `ch`.
constexpr lut_chars asterisk( '*' );
Constant.
Throws nothing.
Constructor
void
lut_chars(
const char* s) noexcept;
Declared in file <boost/url/grammar/lut_chars.hpp> at line 188
This function constructs a character set which has as members, all of the characters present in the null-terminated string `s`.
constexpr lut_chars digits = "0123456789";
Linear in `::strlen(s)`, or constant if `s` is a constant expression.
Throws nothing.
template<
class Pred,
class = enable_if<detail::is_pred::value && !std::is_base_of::value> ::type>
void
lut_chars(
const Pred& pred) noexcept;
Declared in file <boost/url/grammar/lut_chars.hpp> at line 235
Return true if ch is in the character set.
bool
operator()(
unsigned char ch) noexcept;
Declared in file <boost/url/grammar/lut_chars.hpp> at line 256
This function returns true if the character `ch` is in the set, otherwise it returns false.
Constant.
Throws nothing.
Return a new character set which is the complement of another character set.
lut_chars
operator~() noexcept;
Declared in file <boost/url/grammar/lut_chars.hpp> at line 363
This function returns a new character set which contains all of the characters that are not in `*this`.
This statement declares a character set containing everything but vowels:
constexpr lut_chars not_vowels = ~lut_chars( "AEIOU" "aeiou" );
Constant.
Throws nothing.
const char*
find_if(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/lut_chars.hpp> at line 377
const char*
find_if_not(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/lut_chars.hpp> at line 386
Return the union of two character sets.
Declared in file <boost/url/grammar/lut_chars.hpp> at line 291
This function returns a new character set which contains all of the characters in `cs0` as well as all of the characters in `cs`.
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";
Constant.
Return a new character set by subtracting
Declared in file <boost/url/grammar/lut_chars.hpp> at line 328
This function returns a new character set which is formed from all of the characters in `cs0` which are not in `cs`.
This statement declares a character set containing all the lowercase letters which are not vowels:
constexpr lut_chars consonants = lut_chars("abcdefghijklmnopqrstuvwxyz") - "aeiou";
Constant.
struct all_chars_t ;
Declared in file <boost/url/grammar/all_chars.hpp> at line 43
Name | Description |
---|---|
all_chars_t | |
operator() | |
find_if | |
find_if_not |
void
all_chars_t() noexcept;
Declared in file <boost/url/grammar/all_chars.hpp> at line 45
bool
operator()(
char) noexcept;
Declared in file <boost/url/grammar/all_chars.hpp> at line 48
const char*
find_if(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/all_chars.hpp> at line 56
const char*
find_if_not(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/all_chars.hpp> at line 65
A character set containing all characters.
const all_chars_t all_chars ;
Declared in file <boost/url/grammar/all_chars.hpp> at line 81
template<
class T,
class = void>
struct is_charset
: false_type;
Declared in file <boost/url/grammar/charset.hpp> at line 51
Name | Description |
---|---|
value_type | |
type |
Name | Description |
---|---|
operator value_type | |
operator() |
Declared in file <boost/url/grammar/charset.hpp> at line 54
Name | Description |
---|---|
value_type | |
type |
Name | Description |
---|---|
operator value_type | |
operator() |
Find the first character in the string that is in the set.
template<
class CharSet>
const char*
find_if(
const char* const first,
const char* const last,
const CharSet& cs) noexcept;
Declared in file <boost/url/grammar/charset.hpp> at line 86
Throws nothing.
Find the first character in the string that is not in CharSet
template<
class CharSet>
const char*
find_if_not(
const char* const first,
const char* const last,
const CharSet& cs) noexcept;
Declared in file <boost/url/grammar/charset.hpp> at line 124
Throws nothing.
template<
class CharSet>
enable_if<is_charset::value && !std::is_same>::value, charset_ref<CharSet>> ::type
ref(
const CharSet& cs) noexcept;
Declared in file <boost/url/grammar/charset.hpp> at line 197
Parse a character buffer using a rule
template<
class R>
result<Rule::value_type>
parse(
const char*& it,
const char* end,
const Rule& r);
Declared in file <boost/url/grammar/impl/parse.hpp> at line 22
Parse a character buffer using a rule
template<
class R>
result<Rule::value_type>
parse(
string_view s,
const Rule& r);
Declared in file <boost/url/grammar/impl/parse.hpp> at line 41
This function parses a complete string into the specified sequence of rules. If the string is not completely consumed, an error is returned instead.
template<
class Rule>
enable_if<is_rule::value && !std::is_same>::value, rule_ref<Rule>> ::type
ref(
const Rule& r) noexcept;
Declared in file <boost/url/grammar/parse.hpp> at line 113
void
ref() = delete;
Declared in file <boost/url/grammar/parse.hpp> at line 133
Error codes returned when using rules
enum error;
Declared in file <boost/url/grammar/error.hpp> at line 26
Name | Description |
---|---|
need_more | More input is needed to match the rule |
mismatch | The rule did not match the input. |
end_of_range | A rule reached the end of a range |
leftover | Leftover input remaining after match. |
invalid | A rule encountered unrecoverable invalid input. |
out_of_range | An integer overflowed during parsing. |
syntax | An unspecified syntax error was found. |
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.
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.
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.
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.
Error conditions for errors received from rules
enum condition;
Declared in file <boost/url/grammar/error.hpp> at line 114
Name | Description |
---|---|
fatal | A fatal error in syntax was encountered. |
This indicates that parsing cannot continue.
error_code
make_error_code(
error ev) noexcept;
Declared in file <boost/url/grammar/impl/error.hpp> at line 97
error_condition
make_error_condition(
condition c) noexcept;
Declared in file <boost/url/grammar/impl/error.hpp> at line 108
Return c converted to lowercase
char
to_lower(
char c) noexcept;
Declared in file <boost/url/grammar/ci_string.hpp> at line 53
This function returns the character, converting it to lowercase if it is uppercase. The function is defined only for low-ASCII characters.
assert( to_lower( 'A' ) == 'a' );
Throws nothing.
Return c converted to uppercase
char
to_upper(
char c) noexcept;
Declared in file <boost/url/grammar/ci_string.hpp> at line 83
This function returns the character, converting it to uppercase if it is lowercase. The function is defined only for low-ASCII characters.
assert( to_upper( 'a' ) == 'A' );
Throws nothing.
Return the case-insensitive comparison of s0 and s1
int
ci_compare(
string_view s0,
string_view s1) noexcept;
Declared in file <src/grammar/ci_string.cpp> at line 82
This returns the lexicographical comparison of two strings, ignoring case. The function is defined only for strings containing low-ASCII characters.
assert( ci_compare( "boost", "Boost" ) == 0 );
Throws nothing.
Return the case-insensitive digest of a string
size_t
ci_digest(
string_view s) noexcept;
Declared in file <src/grammar/ci_string.cpp> at line 123
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.
template<
class String0,
class String1>
enable_if<!std::is_convertible::value || !std::is_convertible::value, bool> ::type
ci_is_equal(
const String0& s0,
const String1& s1);
Declared in file <boost/url/grammar/ci_string.hpp> at line 173
bool
ci_is_equal(
string_view s0,
string_view s1) noexcept;
Declared in file <boost/url/grammar/ci_string.hpp> at line 192
Return true if s0 is less than s1 using case-insensitive comparison
bool
ci_is_less(
string_view s0,
string_view s1) noexcept;
Declared in file <boost/url/grammar/ci_string.hpp> at line 224
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.
assert( ! ci_is_less( "Boost", "boost" ) );
struct ci_hash ;
Declared in file <boost/url/grammar/ci_string.hpp> at line 261
Name | Description |
---|---|
is_transparent |
Name | Description |
---|---|
operator() |
using is_transparent = void ;
Declared in file <boost/url/grammar/ci_string.hpp> at line 263
size_t
operator()(
string_view s) noexcept;
Declared in file <boost/url/grammar/ci_string.hpp> at line 265
struct ci_equal ;
Declared in file <boost/url/grammar/ci_string.hpp> at line 297
Name | Description |
---|---|
is_transparent |
Name | Description |
---|---|
operator() |
using is_transparent = void ;
Declared in file <boost/url/grammar/ci_string.hpp> at line 299
template<
class String0,
class String1>
bool
operator()(
String0 s0,
String1 s1) noexcept;
Declared in file <boost/url/grammar/ci_string.hpp> at line 303
struct ci_less ;
Declared in file <boost/url/grammar/ci_string.hpp> at line 338
Name | Description |
---|---|
is_transparent |
Name | Description |
---|---|
operator() |
using is_transparent = void ;
Declared in file <boost/url/grammar/ci_string.hpp> at line 340
size_t
operator()(
string_view s0,
string_view s1) noexcept;
Declared in file <boost/url/grammar/ci_string.hpp> at line 342
template<
class R0,
class... Rn>
class variant_rule_t ;
Declared in file <boost/url/grammar/variant_rule.hpp> at line 78
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = variant<R0::value_type, Rn::value_type...> ;
Declared in file <boost/url/grammar/variant_rule.hpp> at line 81
result<value_type>
parse(
const char*& it,
const char* end);
Declared in file <boost/url/grammar/impl/variant_rule.hpp> at line 84
template<
class R0_,
class... Rn_>
variant_rule_t<R0_, Rn_...>
variant_rule(
const R0_& r0,
const Rn_&... rn) noexcept;
Declared in file <boost/url/grammar/variant_rule.hpp> at line 94
template<
class R0,
class... Rn>
variant_rule_t<R0, Rn...>
variant_rule(
const R0& r0,
const Rn&... rn) noexcept;
Declared in file <boost/url/grammar/impl/variant_rule.hpp> at line 102
template<
class Unsigned>
struct unsigned_rule ;
Declared in file <boost/url/grammar/unsigned_rule.hpp> at line 57
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = Unsigned ;
Declared in file <boost/url/grammar/unsigned_rule.hpp> at line 65
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <boost/url/grammar/impl/unsigned_rule.hpp> at line 21
struct digit_chars_t ;
Declared in file <boost/url/grammar/digit_chars.hpp> at line 48
Name | Description |
---|---|
operator() | |
find_if | |
find_if_not |
bool
operator()(
char c) noexcept;
Declared in file <boost/url/grammar/digit_chars.hpp> at line 50
const char*
find_if(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/digit_chars.hpp> at line 58
const char*
find_if_not(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/digit_chars.hpp> at line 67
const digit_chars_t digit_chars ;
Declared in file <boost/url/grammar/digit_chars.hpp> at line 78
struct ch_delim_rule ;
Declared in file <boost/url/grammar/delim_rule.hpp> at line 61
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
ch_delim_rule | |
parse |
using value_type = string_view ;
Declared in file <boost/url/grammar/delim_rule.hpp> at line 63
void
ch_delim_rule(
char ch) noexcept;
Declared in file <boost/url/grammar/delim_rule.hpp> at line 65
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <src/grammar/delim_rule.cpp> at line 21
ch_delim_rule
delim_rule(
char ch) noexcept;
Declared in file <boost/url/grammar/delim_rule.hpp> at line 81
template<
class CharSet>
struct cs_delim_rule ;
Declared in file <boost/url/grammar/delim_rule.hpp> at line 127
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
cs_delim_rule | |
parse |
using value_type = string_view ;
Declared in file <boost/url/grammar/delim_rule.hpp> at line 129
void
cs_delim_rule(
const CharSet& cs) noexcept;
Declared in file <boost/url/grammar/delim_rule.hpp> at line 131
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <boost/url/grammar/delim_rule.hpp> at line 138
template<
class CharSet>
enable_if<!std::is_convertible::value, cs_delim_rule<CharSet>> ::type
delim_rule(
const CharSet& cs) noexcept;
Declared in file <boost/url/grammar/delim_rule.hpp> at line 164
template<
class Rule>
struct optional_rule_t ;
Declared in file <boost/url/grammar/optional_rule.hpp> at line 65
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = optional<Rule::value_type> ;
Declared in file <boost/url/grammar/optional_rule.hpp> at line 68
result<value_type>
parse(
const char*& it,
const char* end);
Declared in file <boost/url/grammar/impl/optional_rule.hpp> at line 19
template<
class R_>
optional_rule_t<R_>
optional_rule(
const R_& r);
Declared in file <boost/url/grammar/optional_rule.hpp> at line 77
template<
class Rule>
optional_rule_t<Rule>
optional_rule(
const Rule& r);
Declared in file <boost/url/grammar/optional_rule.hpp> at line 96
template<
class R0,
class... Rn>
class tuple_rule_t ;
Declared in file <boost/url/grammar/tuple_rule.hpp> at line 89
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = mp_eval_if_c<IsList, T, mp_first, T> ;
Declared in file <boost/url/grammar/tuple_rule.hpp> at line 102
result<value_type>
parse(
const char*& it,
const char* end);
Declared in file <boost/url/grammar/impl/tuple_rule.hpp> at line 265
template<
class R0_,
class... Rn_>
tuple_rule_t<R0_, Rn_...>
tuple_rule(
const R0_& r0,
const Rn_&... rn) noexcept;
Declared in file <boost/url/grammar/tuple_rule.hpp> at line 109
template<
class R0,
class... Rn>
tuple_rule_t<R0, Rn...>
tuple_rule(
const R0& r0,
const Rn&... rn) noexcept;
Declared in file <boost/url/grammar/tuple_rule.hpp> at line 138
template<
class Rule>
squelch_rule_t<Rule>
squelch(
const Rule& r) noexcept;
Declared in file <boost/url/grammar/tuple_rule.hpp> at line 231
template<
class T>
using aligned_storage = aligned_storage_impl<detail::nearest_pow2(sizeof(T), 64), (alignof(::max_align_t) > alignof(T)) ? alignof(::max_align_t) : alignof(T)> ;
Declared in file <boost/url/grammar/recycled.hpp> at line 44
A thread-safe collection of instances of T
template<
class T>
class recycled ;
Declared in file <boost/url/grammar/recycled.hpp> at line 73
Instances of this type may be used to control where recycled instances of T come from when used with recycled_ptr.
static recycled< std::string > bin;
recycled_ptr< std::string > ps( bin );
// Put the string into a known state
ps->clear();
Destructor
void
~recycled();
Declared in file <boost/url/grammar/impl/recycled.hpp> at line 21
All recycled instances of T are destroyed. Undefined behavior results if there are any recycled_ptr which reference this recycle bin.
Constructor
void
recycled();
Declared in file <boost/url/grammar/recycled.hpp> at line 87
A pointer to shared instance of T
template<
class T>
class recycled_ptr ;
Declared in file <boost/url/grammar/recycled.hpp> at line 150
Name | Description |
---|---|
~recycled_ptr | Destructor |
recycled_ptr | Constructor |
recycled_ptr | Constructor |
recycled_ptr | Constructor |
recycled_ptr | Constructor |
recycled_ptr | Constructor |
recycled_ptr | Constructor |
operator= | Assignment |
operator= | Assignment |
empty | Return true if this does not reference an object |
operator bool | Return true if this references an object |
bin | Return the referenced recycle bin |
get | Return the referenced object |
operator-> | Return the referenced object |
operator* | Return the referenced object |
acquire | Return the referenced object |
release | Release the referenced object |
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.
static recycled< std::string > bin;
recycled_ptr< std::string > ps( bin );
// Put the string into a known state
ps->clear();
Destructor
void
~recycled_ptr();
Declared in file <boost/url/grammar/impl/recycled.hpp> at line 94
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.
this->release();
Constructor
void
recycled_ptr(
recycled<T>& bin);
Declared in file <boost/url/grammar/impl/recycled.hpp> at line 102
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.
static recycled< std::string > bin;
recycled_ptr< std::string > ps( bin );
// Put the string into a known state
ps->clear();
&this->bin() == &bin && ! this->empty()
Constructor
void
recycled_ptr(
recycled<T>& bin,
nullptr_t) noexcept;
Declared in file <boost/url/grammar/impl/recycled.hpp> at line 111
After construction, this is empty and refers to the specified recycle bin.
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();
&this->bin() == &bin && this->empty()
Throws nothing.
Constructor
void
recycled_ptr();
Declared in file <boost/url/grammar/impl/recycled.hpp> at line 120
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.
recycled_ptr< std::string > ps;
// Put the string into a known state
ps->clear();
&this->bin() != nullptr && ! this->empty()
Constructor
void
recycled_ptr(
nullptr_t) noexcept;
Declared in file <boost/url/grammar/impl/recycled.hpp> at line 128
After construction, this is empty and refers to a global recycle bin.
recycled_ptr< std::string > ps( nullptr );
// Acquire a string and put it into a known state
ps->acquire();
ps->clear();
&this->bin() != nullptr && this->empty()
Throws nothing.
Constructor
void
recycled_ptr(
const recycled_ptr& other) noexcept;
Declared in file <boost/url/grammar/impl/recycled.hpp> at line 141
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`.
&this->bin() == &other->bin() && this->get() == other.get()
Throws nothing.
Constructor
void
recycled_ptr(
recycled_ptr&& other) noexcept;
Declared in file <boost/url/grammar/impl/recycled.hpp> at line 152
If `other` references an object, ownership is transferred including a reference to the recycle bin. After the move, the moved-from object is empty.
&this->bin() == &other->bin() && ! this->empty() && other.empty()
Throws nothing.
Assignment
recycled_ptr&
operator=(
recycled_ptr&& other) noexcept;
Declared in file <boost/url/grammar/impl/recycled.hpp> at line 162
If `other` references an object, ownership is transferred including a reference to the recycle bin. After the move, the moved-from object is empty.
this->release()
&this->bin() == &other->bin()
Throws nothing.
Assignment
recycled_ptr&
operator=(
const recycled_ptr& other) noexcept;
Declared in file <boost/url/grammar/impl/recycled.hpp> at line 178
If `other` references an object, this acquires shared ownership and references the same recycle bin as `other`. The previous object if any is released.
this->release()
&this->bin() == &other->bin() && this->get() == other.get()
Throws nothing.
Return true if this does not reference an object
bool
empty() noexcept;
Declared in file <boost/url/grammar/recycled.hpp> at line 403
Throws nothing.
Return true if this references an object
bool
operator bool() noexcept;
Declared in file <boost/url/grammar/recycled.hpp> at line 419
return ! this->empty();
Throws nothing.
Return the referenced recycle bin
Throws nothing.
Return the referenced object
T*
get() noexcept;
Declared in file <boost/url/grammar/recycled.hpp> at line 443
If this is empty, `nullptr` is returned.
Throws nothing.
Return the referenced object
T*
operator->() noexcept;
Declared in file <boost/url/grammar/recycled.hpp> at line 455
If this is empty, `nullptr` is returned.
Throws nothing.
Return the referenced object
T&
operator*() noexcept;
Declared in file <boost/url/grammar/recycled.hpp> at line 467
not this->empty()
Return the referenced object
T&
acquire();
Declared in file <boost/url/grammar/impl/recycled.hpp> at line 195
If this references an object, it is returned. Otherwise, exclusive ownership of a new object of type `T` is acquired and returned.
not this->empty()
Release the referenced object
void
release() noexcept;
Declared in file <boost/url/grammar/impl/recycled.hpp> at line 205
If this references an object, it is released to the referenced recycle bin. The pointer continues to reference the same recycle bin.
this->empty()
Throws nothing.
struct alpha_chars_t ;
Declared in file <boost/url/grammar/alpha_chars.hpp> at line 48
Name | Description |
---|---|
alpha_chars_t | |
operator() | |
find_if | |
find_if_not |
void
alpha_chars_t() noexcept;
Declared in file <boost/url/grammar/alpha_chars.hpp> at line 50
bool
operator()(
char c) noexcept;
Declared in file <boost/url/grammar/alpha_chars.hpp> at line 53
const char*
find_if(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/alpha_chars.hpp> at line 63
const char*
find_if_not(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/alpha_chars.hpp> at line 72
A character set containing the alphabetical characters.
const alpha_chars_t alpha_chars ;
Declared in file <boost/url/grammar/alpha_chars.hpp> at line 88
template<
class CharSet>
struct token_rule_t ;
Declared in file <boost/url/grammar/token_rule.hpp> at line 57
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = string_view ;
Declared in file <boost/url/grammar/token_rule.hpp> at line 59
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <boost/url/grammar/impl/token_rule.hpp> at line 19
template<
class CharSet>
token_rule_t<CharSet>
token_rule(
const CharSet& cs) noexcept;
Declared in file <boost/url/grammar/token_rule.hpp> at line 92
A forward range of parsed elements
template<
class T>
class range ;
Declared in file <boost/url/grammar/range_rule.hpp> at line 60
Name | Description |
---|---|
iterator | A constant, forward iterator to elements of the range |
Name | Description |
---|---|
value_type | The type of each element of the range |
reference | The type of each element of the range |
const_reference | The type of each element of the range |
pointer | Provided for compatibility, unused |
size_type | The type used to represent unsigned integers |
difference_type | The type used to represent signed integers |
const_iterator | A constant, forward iterator to elements of the range |
Name | Description |
---|---|
~range | Destructor |
range | Constructor |
range | Constructor |
range | Constructor |
operator= | Constructor |
operator= | Assignment |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
empty | Return true if the range is empty |
size | Return the number of elements in the range |
string | Return the matching part of the string |
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.
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.
The type of each element of the range
using value_type = T ;
Declared in file <boost/url/grammar/range_rule.hpp> at line 133
The type of each element of the range
using reference = const T& ;
Declared in file <boost/url/grammar/range_rule.hpp> at line 137
The type of each element of the range
using const_reference = const T& ;
Declared in file <boost/url/grammar/range_rule.hpp> at line 141
Provided for compatibility, unused
using pointer = const void* ;
Declared in file <boost/url/grammar/range_rule.hpp> at line 145
The type used to represent unsigned integers
using size_type = size_t ;
Declared in file <boost/url/grammar/range_rule.hpp> at line 149
The type used to represent signed integers
using difference_type = ptrdiff_t ;
Declared in file <boost/url/grammar/range_rule.hpp> at line 153
A constant, forward iterator to elements of the range
class iterator ;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 361
Name | Description |
---|---|
value_type | |
reference | |
pointer | |
difference_type | |
iterator_category |
Name | Description |
---|---|
iterator | |
iterator | |
operator= | |
operator* | |
operator== | |
operator!= | |
operator++ | |
operator++ |
using value_type = T ;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 365
using reference = const T& ;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 366
using pointer = const void* ;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 367
using difference_type = ptrdiff_t ;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 368
using iterator_category = forward_iterator_tag ;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 370
void
iterator();
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 373
void
iterator(
const iterator&);
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 374
reference
operator*() noexcept;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 379
bool
operator==(
const iterator& other) noexcept;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 385
bool
operator!=(
const iterator& other) noexcept;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 396
iterator&
operator++() noexcept;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 403
iterator
operator++(
int) noexcept;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 417
A constant, forward iterator to elements of the range
using const_iterator = iterator ;
Declared in file <boost/url/grammar/range_rule.hpp> at line 161
Destructor
void
~range();
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 502
Constructor
void
range() noexcept;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 509
Default-constructed ranges have zero elements.
Throws nothing.
Constructor
void
range(
range&& other) noexcept;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 519
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.
Throws nothing.
Constructor
void
range(
const range& other) noexcept;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 533
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.
Throws nothing.
Constructor
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 543
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.
Throws nothing.
Assignment
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 564
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.
Throws nothing.
Return an iterator to the beginning
iterator
begin() noexcept;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 581
Return an iterator to the end
iterator
end() noexcept;
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 590
Return true if the range is empty
bool
empty() noexcept;
Declared in file <boost/url/grammar/range_rule.hpp> at line 250
Return the number of elements in the range
size_t
size() noexcept;
Declared in file <boost/url/grammar/range_rule.hpp> at line 258
Return the matching part of the string
string_view
string() noexcept;
Declared in file <boost/url/grammar/range_rule.hpp> at line 266
template<
class R0,
class R1 = void>
struct range_rule_t ;
Declared in file <boost/url/grammar/range_rule.hpp> at line 504
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = range<R0::value_type> ;
Declared in file <boost/url/grammar/range_rule.hpp> at line 506
result<value_type>
parse(
const char*& it,
const char* end);
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 670
template<
class R>
struct range_rule_t<R> ;
Declared in file <boost/url/grammar/range_rule.hpp> at line 359
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = range<R::value_type> ;
Declared in file <boost/url/grammar/range_rule.hpp> at line 361
result<value_type>
parse(
const char*& it,
const char* end);
Declared in file <boost/url/grammar/impl/range_rule.hpp> at line 601
template<
class Rule>
range_rule_t<Rule>
range_rule(
const Rule& next,
size_t N,
size_t M) noexcept;
Declared in file <boost/url/grammar/range_rule.hpp> at line 396
template<
class Rule1,
class Rule2>
enable_if<!std::is_integral::value, range_rule_t<Rule1, Rule2>> ::type
range_rule(
const Rule1& first,
const Rule2& next,
size_t N,
size_t M) noexcept;
Declared in file <boost/url/grammar/range_rule.hpp> at line 554
struct alnum_chars_t ;
Declared in file <boost/url/grammar/alnum_chars.hpp> at line 53
Name | Description |
---|---|
operator() | |
find_if | |
find_if_not |
bool
operator()(
char c) noexcept;
Declared in file <boost/url/grammar/alnum_chars.hpp> at line 55
const char*
find_if(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/alnum_chars.hpp> at line 66
const char*
find_if_not(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/alnum_chars.hpp> at line 75
const alnum_chars_t alnum_chars ;
Declared in file <boost/url/grammar/alnum_chars.hpp> at line 86
struct vchars_t ;
Declared in file <boost/url/grammar/vchars.hpp> at line 48
Name | Description |
---|---|
operator() | |
find_if | |
find_if_not |
bool
operator()(
char c) noexcept;
Declared in file <boost/url/grammar/vchars.hpp> at line 50
const char*
find_if(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/vchars.hpp> at line 58
const char*
find_if_not(
const char* first,
const char* last) noexcept;
Declared in file <boost/url/grammar/vchars.hpp> at line 67
struct dec_octet_rule_t ;
Declared in file <boost/url/grammar/dec_octet_rule.hpp> at line 56
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = unsigned char ;
Declared in file <boost/url/grammar/dec_octet_rule.hpp> at line 58
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <src/grammar/dec_octet_rule.cpp> at line 23
const dec_octet_rule_t dec_octet_rule ;
Declared in file <boost/url/grammar/dec_octet_rule.hpp> at line 69
class literal_rule ;
Declared in file <boost/url/grammar/literal_rule.hpp> at line 49
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
literal_rule | |
parse |
using value_type = string_view ;
Declared in file <boost/url/grammar/literal_rule.hpp> at line 65
void
literal_rule(
const char* s) noexcept;
Declared in file <boost/url/grammar/literal_rule.hpp> at line 67
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <src/grammar/literal_rule.cpp> at line 23
A reference to a valid, percent-encoded string
class decode_view ;
Declared in file <boost/url/decode_view.hpp> at line 87
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | The unsigned integer type |
difference_type | The signed integer type |
const_iterator | iterator |
Name | Description |
---|---|
decode_view | Constructor |
decode_view | Constructor |
empty | Return true if the string is empty |
size | Return the number of decoded characters |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
front | Return the first character |
back | Return the last character |
starts_with | Checks if the string begins with the given prefix |
ends_with | Checks if the string ends with the given prefix |
starts_with | Checks if the string begins with the given prefix |
ends_with | Checks if the string ends with the given prefix |
find | Finds the first occurrence of character in this view |
rfind | Finds the first occurrence of character in this view |
remove_prefix | Remove the first characters |
remove_suffix | Remove the last characters |
options | Return the decoding options |
compare | Return the result of comparing to another string |
compare | Return the result of comparing to another string |
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:
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.
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;
The value type
using value_type = char ;
Declared in file <boost/url/decode_view.hpp> at line 113
The reference type
using reference = char ;
Declared in file <boost/url/decode_view.hpp> at line 117
The reference type
using const_reference = char ;
Declared in file <boost/url/decode_view.hpp> at line 120
The unsigned integer type
using size_type = size_t ;
Declared in file <boost/url/decode_view.hpp> at line 124
The signed integer type
using difference_type = ptrdiff_t ;
Declared in file <boost/url/decode_view.hpp> at line 128
class iterator ;
Declared in file <boost/url/impl/decode_view.hpp> at line 19
Name | Description |
---|---|
value_type | |
reference | |
pointer | |
const_reference | |
size_type | |
difference_type | |
iterator_category |
Name | Description |
---|---|
iterator | |
iterator | |
operator= | |
operator* | |
operator++ | |
operator-- | |
operator++ | |
operator-- | |
base | |
operator== | |
operator!= |
using value_type = char ;
Declared in file <boost/url/impl/decode_view.hpp> at line 49
using reference = char ;
Declared in file <boost/url/impl/decode_view.hpp> at line 50
using pointer = const void* ;
Declared in file <boost/url/impl/decode_view.hpp> at line 51
using const_reference = char ;
Declared in file <boost/url/impl/decode_view.hpp> at line 52
using size_type = size_t ;
Declared in file <boost/url/impl/decode_view.hpp> at line 53
using difference_type = ptrdiff_t ;
Declared in file <boost/url/impl/decode_view.hpp> at line 54
using iterator_category = bidirectional_iterator_tag ;
Declared in file <boost/url/impl/decode_view.hpp> at line 55
void
iterator();
Declared in file <boost/url/impl/decode_view.hpp> at line 58
void
iterator(
const iterator&);
Declared in file <boost/url/impl/decode_view.hpp> at line 60
iterator&
operator++() noexcept;
Declared in file <boost/url/impl/decode_view.hpp> at line 69
iterator&
operator--() noexcept;
Declared in file <boost/url/impl/decode_view.hpp> at line 80
iterator
operator++(
int) noexcept;
Declared in file <boost/url/impl/decode_view.hpp> at line 92
iterator
operator--(
int) noexcept;
Declared in file <boost/url/impl/decode_view.hpp> at line 100
const char*
base();
Declared in file <boost/url/impl/decode_view.hpp> at line 108
bool
operator==(
const iterator& other) noexcept;
Declared in file <boost/url/impl/decode_view.hpp> at line 114
bool
operator!=(
const iterator& other) noexcept;
Declared in file <boost/url/impl/decode_view.hpp> at line 121
iterator
Constructor
void
decode_view() noexcept;
Declared in file <boost/url/decode_view.hpp> at line 174
Default-constructed views represent empty strings.
decode_view ds;
this->empty() == true
Constant.
Throws nothing.
Constructor
void
decode_view(
pct_string_view s,
encoding_opts opt) noexcept;
Declared in file <boost/url/decode_view.hpp> at line 209
This constructs a view from the character buffer `s`, which must remain valid and unmodified until the view is no longer accessed.
decode_view ds( "Program%20Files" );
this->encoded() == s
Linear in `s.size()`.
Exceptions thrown on invalid input.
Return true if the string is empty
bool
empty() noexcept;
Declared in file <boost/url/decode_view.hpp> at line 239
assert( decode_view( "" ).empty() );
Constant.
Throws nothing.
Return the number of decoded characters
assert( decode_view( "Program%20Files" ).size() == 13 );
return std::distance( this->begin(), this->end() );
Constant.
Throws nothing.
Return an iterator to the beginning
auto it = this->begin();
Constant.
Throws nothing.
Return an iterator to the end
auto it = this->end();
Constant.
Throws nothing.
Return the first character
assert( decode_view( "Program%20Files" ).front() == 'P' );
not this->empty()
Constant.
Throws nothing.
Return the last character
assert( decode_view( "Program%20Files" ).back() == 's' );
not this->empty()
Constant.
Throws nothing.
Checks if the string begins with the given prefix
bool
starts_with(
string_view s) noexcept;
Declared in file <src/decode_view.cpp> at line 137
assert( decode_view( "Program%20Files" ).starts_with("Program") );
Linear.
Throws nothing.
Checks if the string ends with the given prefix
bool
ends_with(
string_view s) noexcept;
Declared in file <src/decode_view.cpp> at line 157
assert( decode_view( "Program%20Files" ).ends_with("Files") );
Linear.
Throws nothing.
Checks if the string begins with the given prefix
bool
starts_with(
char ch) noexcept;
Declared in file <src/decode_view.cpp> at line 179
assert( decode_view( "Program%20Files" ).starts_with('P') );
Constant.
Throws nothing.
Checks if the string ends with the given prefix
bool
ends_with(
char ch) noexcept;
Declared in file <src/decode_view.cpp> at line 188
assert( decode_view( "Program%20Files" ).ends_with('s') );
Constant.
Throws nothing.
Finds the first occurrence of character in this view
Linear.
Throws nothing.
Finds the first occurrence of character in this view
const_iterator
rfind(
char ch) noexcept;
Declared in file <src/decode_view.cpp> at line 212
Linear.
Throws nothing.
Remove the first characters
decode_view d( "Program%20Files" );
d.remove_prefix( 8 );
assert( d == "Files" );
not this->empty()
Linear.
Remove the last characters
decode_view d( "Program%20Files" );
d.remove_prefix( 6 );
assert( d == "Program" );
not this->empty()
Linear.
Return the decoding options
Return the result of comparing to another string
int
compare(
string_view other) noexcept;
Declared in file <src/decode_view.cpp> at line 82
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
Return the result of comparing to another string
int
compare(
decode_view other) noexcept;
Declared in file <src/decode_view.cpp> at line 89
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
A reference to a valid percent-encoded string
class pct_string_view
: public string_view_base;
Declared in file <boost/url/pct_string_view.hpp> at line 73
Name | Description |
---|---|
traits_type | The character traits |
value_type | The value type |
pointer | The pointer type |
const_pointer | The const pointer type |
reference | The reference type |
const_reference | The const reference type |
const_iterator | The const iterator type |
iterator | The iterator type |
const_reverse_iterator | The const reverse iterator type |
reverse_iterator | The reverse iterator type |
size_type | The size type |
difference_type | The difference type |
Name | Description |
---|---|
operator string_view | Conversion |
operator string | Conversion |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
cbegin | Return an iterator to the beginning |
cend | Return an iterator to the end |
rbegin | |
rend | |
crbegin | |
crend | |
size | Return the size |
length | Return the size |
max_size | Return the maximum allowed size |
empty | Return true if the string is empty |
operator[] | Access a character |
at | Access a character |
front | Return the first character |
back | Return the last character |
data | Return a pointer to the character buffer |
copy | Copy the characters to another buffer |
substr | Return a view to part of the string |
compare | Return the result of comparing to another string |
compare | Return the result of comparing to another string |
compare | Return the result of comparing to another string |
compare | Return the result of comparing to another string |
compare | Return the result of comparing to another string |
compare | Return the result of comparing to another string |
starts_with | Return true if a matching prefix exists |
starts_with | Return true if a matching prefix exists |
starts_with | Return true if a matching prefix exists |
ends_with | Return true if a matching suffix exists |
ends_with | Return true if a matching suffix exists |
ends_with | Return true if a matching suffix exists |
find | Return the position of matching characters |
find | Return the position of matching characters |
find | Return the position of matching characters |
find | Return the position of matching characters |
rfind | Return the position of matching characters |
rfind | Return the position of matching characters |
rfind | Return the position of matching characters |
rfind | Return the position of matching characters |
find_first_of | Return the position of the first match |
find_first_of | Return the position of the first match |
find_first_of | Return the position of the first match |
find_first_of | Return the position of the first match |
find_last_of | Return the position of the last match |
find_last_of | Return the position of the last match |
find_last_of | Return the position of the last match |
find_last_of | Return the position of the last match |
find_first_not_of | Return the position of the first non-match |
find_first_not_of | Return the position of the first non-match |
find_first_not_of | Return the position of the first non-match |
find_first_not_of | Return the position of the first non-match |
find_last_not_of | Return the position of the last non-match |
find_last_not_of | Return the position of the last non-match |
find_last_not_of | Return the position of the last non-match |
find_last_not_of | Return the position of the last non-match |
contains | Return true if matching characters are found |
contains | Return true if matching characters are found |
contains | Return true if matching characters are found |
pct_string_view | Constructor |
pct_string_view | Constructor |
pct_string_view | |
pct_string_view | Constructor (deleted) |
pct_string_view | Constructor |
pct_string_view | Constructor |
operator= | Assignment |
decoded_size | Return the decoded size |
operator* | Return the string as a range of decoded characters |
decode | Return the string with percent-decoding |
operator-> | |
swap | Swap |
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.
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;
Constructor
void
pct_string_view();
Declared in file <boost/url/pct_string_view.hpp> at line 117
Default constructed string are empty.
Constant.
Throws nothing.
Constructor
void
pct_string_view(
const pct_string_view& other);
Declared in file <boost/url/pct_string_view.hpp> at line 138
The copy references the same underlying character buffer. Ownership is not transferred.
this->data() == other.data()
Constant.
Throws nothing.
template<
class String,
class = enable_if<std::is_convertible::value> ::type>
void
pct_string_view(
const String& s);
Declared in file <boost/url/pct_string_view.hpp> at line 176
Constructor (deleted)
void
pct_string_view(
nullptr_t) = delete;
Declared in file <boost/url/pct_string_view.hpp> at line 185
Constructor
void
pct_string_view(
const char* s,
size_t len);
Declared in file <boost/url/pct_string_view.hpp> at line 210
The newly constructed string references the specified character buffer. Ownership is not transferred.
this->data() == s && this->size() == len
Linear in `len`.
Exceptions thrown on invalid input.
Constructor
void
pct_string_view(
string_view s);
Declared in file <src/pct_string_view.cpp> at line 37
The newly constructed string references the specified character buffer. Ownership is not transferred.
this->data() == s.data() && this->size() == s.size()
Linear in `s.size()`.
Exceptions thrown on invalid input.
Assignment
pct_string_view&
operator=(
const pct_string_view& other);
Declared in file <boost/url/pct_string_view.hpp> at line 263
The copy references the same underlying character buffer. Ownership is not transferred.
this->data() == other.data()
Constant.
Throws nothing.
Return the decoded size
size_t
decoded_size() noexcept;
Declared in file <boost/url/pct_string_view.hpp> at line 287
This function returns the number of characters in the resulting string if percent escapes were converted into ordinary characters.
Constant.
Throws nothing.
Return the string as a range of decoded characters
Constant.
Throws nothing.
Return the string with percent-decoding
template<
class StringToken = return_string>
StringToken::result_type
decode(
encoding_opts opt,
StringToken&& token);
Declared in file <boost/url/pct_string_view.hpp> at line 345
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.
assert( pct_string_view( "Program%20Files" ).decode() == "Program Files" );
Linear in `this->size()`.
Calls to allocate may throw. String tokens may throw exceptions.
const pct_string_view*
operator->() noexcept;
Declared in file <boost/url/pct_string_view.hpp> at line 366
Swap
void
swap(
pct_string_view& s) noexcept;
Declared in file <boost/url/pct_string_view.hpp> at line 378
pct_string_view
make_pct_string_view_unsafe(
const char* data,
size_t size,
size_t decoded_size) noexcept;
Declared in file <boost/url/pct_string_view.hpp> at line 431
Return a valid percent-encoded string
result<pct_string_view>
make_pct_string_view(
string_view s) noexcept;
Declared in file <src/pct_string_view.cpp> at line 48
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.
Linear in `s.size()`.
Throws nothing.
template<
class S0,
class S1>
enable_if<is_match::value, bool> ::type
operator==(
const S0& s0,
const S1& s1) noexcept;
Declared in file <boost/url/decode_view.hpp> at line 579
template<
class S0,
class S1>
enable_if<is_match::value, bool> ::type
operator!=(
const S0& s0,
const S1& s1) noexcept;
Declared in file <boost/url/decode_view.hpp> at line 588
template<
class S0,
class S1>
enable_if<is_match::value, bool> ::type
operator<(
const S0& s0,
const S1& s1) noexcept;
Declared in file <boost/url/decode_view.hpp> at line 597
template<
class S0,
class S1>
enable_if<is_match::value, bool> ::type
operator<=(
const S0& s0,
const S1& s1) noexcept;
Declared in file <boost/url/decode_view.hpp> at line 606
template<
class S0,
class S1>
enable_if<is_match::value, bool> ::type
operator>(
const S0& s0,
const S1& s1) noexcept;
Declared in file <boost/url/decode_view.hpp> at line 615
template<
class S0,
class S1>
enable_if<is_match::value, bool> ::type
operator>=(
const S0& s0,
const S1& s1) noexcept;
Declared in file <boost/url/decode_view.hpp> at line 624
Format the string with percent-decoding applied to the output stream
ostream&
operator<<(
ostream& os,
const decode_view& s);
Declared in file <boost/url/decode_view.hpp> at line 634
This function serializes the decoded view to the output stream.
The sub-delims character set
const lut_chars sub_delim_chars ;
Declared in file <boost/url/rfc/sub_delim_chars.hpp> at line 45
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 ) );
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
The unreserved character set
const lut_chars unreserved_chars ;
Declared in file <boost/url/rfc/unreserved_chars.hpp> at line 44
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 ) );
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
The path character set
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 );
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
Return the buffer size needed for percent-encoding
template<
class CharSet>
size_t
encoded_size(
string_view s,
const CharSet& unreserved,
encoding_opts opt) noexcept;
Declared in file <boost/url/impl/encode.hpp> at line 28
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.
assert( encoded_size( "My Stuff", pchars ) == 10 );
Throws nothing.
Apply percent-encoding to a string
template<
class CharSet>
size_t
encode(
char* dest,
size_t size,
string_view s,
const CharSet& unreserved,
encoding_opts opt);
Declared in file <boost/url/impl/encode.hpp> at line 79
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.
char buf[100];
assert( encode( buf, sizeof(buf), "Program Files", pchars ) == 15 );
Throws nothing.
template<
class CharSet>
size_t
encode_unsafe(
char* dest,
size_t size,
string_view s,
const CharSet& unreserved,
encoding_opts opt);
Declared in file <boost/url/impl/encode.hpp> at line 173
Return a percent-encoded string
template<
class StringToken = return_string,
class CharSet>
StringToken::result_type
encode(
string_view s,
const CharSet& unreserved,
encoding_opts opt,
StringToken&& token) noexcept;
Declared in file <boost/url/impl/encode.hpp> at line 250
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.
encoding_opts opt;
opt.space_as_plus = true;
std::string s = encode( "My Stuff", opt, pchars );
assert( s == "My+Stuff" );
Calls to allocate may throw.
The type of no_value
struct no_value_t ;
Declared in file <boost/url/param.hpp> at line 30
A query parameter
struct param_pct_view ;
Declared in file <boost/url/param.hpp> at line 638
Name | Description |
---|---|
param_pct_view | Constructor |
param_pct_view | Constructor |
param_pct_view | Constructor |
param_pct_view | Construction |
operator param | Conversion |
operator param_view | |
operator-> | |
param_pct_view |
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.
query-params = query-param *( "&" query-param )
query-param = key [ "=" value ]
key = *qpchar
value = *( qpchar / "=" )
Constructor
void
param_pct_view();
Declared in file <boost/url/param.hpp> at line 689
Default constructed query parameters have an empty key and no value.
param_pct_view qp;
this->key == "" && this->value == "" && this->has_value == false
Constant.
Throws nothing.
Constructor
void
param_pct_view(
pct_string_view key,
pct_string_view value) noexcept;
Declared in file <boost/url/param.hpp> at line 725
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.
param_pct_view qp( "key", "value" );
this->key.data() == key.data() && this->value.data() == value.data() && this->has_value == true
Linear in `key.size() + value.size()`.
Exceptions thrown on invalid input.
Constructor
template<
class OptionalString>
void
param_pct_view(
pct_string_view key,
const OptionalString& value);
Declared in file <boost/url/param.hpp> at line 776
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.
param_pct_view qp( "key", optional("value") );
this->key.data() == key.data() && this->value->data() == value->data() && this->has_value == true
Linear in `key.size() + value->size()`.
Exceptions thrown on invalid input.
Construction
void
param_pct_view(
const param_view& p);
Declared in file <boost/url/param.hpp> at line 816
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.
param_pct_view qp( param_view( "key", "value" ) );
Linear in `key.size() + value.size()`.
Exceptions thrown on invalid input.
Conversion
This function performs a conversion from a reference-like query parameter to one retaining ownership of the strings by making a copy.
Linear in `this->key.size() + this->value.size()`.
Calls to allocate may throw.
param_view
operator param_view() noexcept;
Declared in file <boost/url/param.hpp> at line 850
const param_pct_view*
operator->() noexcept;
Declared in file <boost/url/param.hpp> at line 859
void
param_pct_view(
pct_string_view key,
pct_string_view value,
bool has_value) noexcept;
Declared in file <boost/url/param.hpp> at line 866
A query parameter
struct param_view ;
Declared in file <boost/url/param.hpp> at line 404
Name | Description |
---|---|
param_view | Constructor |
param_view | Constructor |
param_view | Constructor |
operator param | Conversion |
operator-> | |
param_view |
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.
query-params = query-param *( "&" query-param )
query-param = key [ "=" value ]
key = *qpchar
value = *( qpchar / "=" )
Constructor
void
param_view();
Declared in file <boost/url/param.hpp> at line 455
Default constructed query parameters have an empty key and no value.
param_view qp;
this->key == "" && this->value == "" && this->has_value == false
Constant.
Throws nothing.
Constructor
template<
class OptionalString>
void
param_view(
string_view key,
const OptionalString& value) noexcept;
Declared in file <boost/url/param.hpp> at line 494
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.
param_view qp( "key", "value" );
this->key.data() == key.data() && this->value.data() == value.data() && this->has_value == true
Constant.
Throws nothing.
Constructor
void
param_view(
const param& other) noexcept;
Declared in file <boost/url/param.hpp> at line 531
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.
param qp( "key", "value" );
param_view qpv( qp );
this->key == key && this->value == value && this->has_value == other.has_value
Constant.
Throws nothing.
Conversion
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.
Linear in `this->key.size() + this->value.size()`.
Calls to allocate may throw.
const param_view*
operator->() noexcept;
Declared in file <boost/url/param.hpp> at line 563
void
param_view(
string_view key_,
string_view value_,
bool has_value_) noexcept;
Declared in file <boost/url/param.hpp> at line 570
Constant indicating no value in a param
A query parameter
struct param ;
Declared in file <boost/url/param.hpp> at line 75
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.
query-params = query-param *( "&" query-param )
query-param = key [ "=" value ]
key = *qpchar
value = *( qpchar / "=" )
Constructor
void
param();
Declared in file <boost/url/param.hpp> at line 124
Default constructed query parameters have an empty key and no value.
param qp;
this->key == "" && this->value == "" && this->has_value == false
Constant.
Throws nothing.
Constructor
Upon construction, this acquires ownership of the members of other via move construction. The moved from object is as if default constructed.
Constant.
Throws nothing.
Constructor
Upon construction, this becomes a copy of `other`.
this->key == other.key && this->value == other.value && this->has_value == other.has_value
Linear in `other.key.size() + other.value.size()`.
Calls to allocate may throw.
Assignment
Declared in file <boost/url/param.hpp> at line 191
Upon assignment, this acquires ownership of the members of other via move assignment. The moved from object is as if default constructed.
Constant.
Throws nothing.
Assignment
Upon assignment, this becomes a copy of `other`.
this->key == other.key && this->value == other.value && this->has_value == other.has_value
Linear in `other.key.size() + other.value.size()`.
Calls to allocate may throw.
Constructor
template<
class OptionalString>
void
param(
string_view key,
const OptionalString& value);
Declared in file <boost/url/param.hpp> at line 278
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.
param qp( "key", "value" );
param qp( "key", optional("value") );
param qp( "key", boost::none );
param qp( "key", nullptr );
param qp( "key", no_value );
this->key == key && this->value == value && this->has_value == true
Linear in `key.size() + value.size()`.
Calls to allocate may throw.
Assignment
param&
operator=(
const param_view& other);
Declared in file <boost/url/param.hpp> at line 890
The members of `other` are copied, re-using already existing string capacity.
this->key == other.key && this->value == other.value && this->has_value == other.has_value
Linear in `other.key.size() + other.value.size()`.
Calls to allocate may throw.
Assignment
param&
operator=(
const param_pct_view& other);
Declared in file <boost/url/param.hpp> at line 914
The members of `other` are copied, re-using already existing string capacity.
this->key == other.key && this->value == other.value && this->has_value == other.has_value
Linear in `other.key.size() + other.value.size()`.
Calls to allocate may throw.
void
param(
string_view key,
string_view value,
bool has_value) noexcept;
Declared in file <boost/url/param.hpp> at line 336
Identifies the type of host in a URL.
enum host_type;
Declared in file <boost/url/host_type.hpp> at line 24
Name | Description |
---|---|
none | No host is specified. |
name | A host is specified by reg-name. |
ipv4 | A host is specified by ipv4_address. |
ipv6 | A host is specified by ipv6_address. |
ipvfuture | A host is specified by IPvFuture. |
Values of this type are returned by URL views and containers to indicate the type of host present in a URL.
Error codes returned the library
enum error;
Declared in file <boost/url/error.hpp> at line 22
Name | Description |
---|---|
success | The operation completed successfully. |
illegal_null | Null encountered in pct-encoded. |
illegal_reserved_char | Illegal reserved character in encoded string. |
non_canonical | A grammar element was not in canonical form. |
bad_pct_hexdig | Bad hexadecimal digit. |
incomplete_encoding | The percent-encoded sequence is incomplete. |
missing_pct_hexdig | Missing hexadecimal digit. |
no_space | No space in output buffer |
not_a_base | The URL is not a base URL |
This error condition is fatal.
This error condition is fatal.
This error condition is fatal.
This error is returned when a provided output buffer was too small to hold the complete result of an algorithm.
error_code
make_error_code(
error ev) noexcept;
Declared in file <boost/url/impl/error.hpp> at line 64
An IP version 4 style address.
class ipv4_address ;
Declared in file <boost/url/ipv4_address.hpp> at line 53
Name | Description |
---|---|
uint_type | The type used to represent an address as an unsigned integer |
bytes_type | The type used to represent an address as an array of bytes |
Name | Description |
---|---|
ipv4_address | Constructor. |
ipv4_address | Constructor. |
operator= | Copy Assignment. |
ipv4_address | Construct from an unsigned integer. |
ipv4_address | Construct from an array of bytes. |
ipv4_address | Construct from a string. |
to_bytes | Return the address as bytes, in network byte order. |
to_uint | Return the address as an unsigned integer. |
to_string | Return the address as a string in dotted decimal format |
to_buffer | Write a dotted decimal string representing the address to a buffer |
is_loopback | Return true if the address is a loopback address |
is_unspecified | Return true if the address is unspecified |
is_multicast | Return true if the address is a multicast address |
Objects of this type are used to construct, parse, and manipulate IP version 6 addresses.
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
The number of characters in the longest possible IPv4 string.
const size_t max_str_len ;
Declared in file <boost/url/ipv4_address.hpp> at line 60
The longest ipv4 address string is "255.255.255.255".
The type used to represent an address as an unsigned integer
using uint_type = uint_least32_t ;
Declared in file <boost/url/ipv4_address.hpp> at line 66
The type used to represent an address as an array of bytes
using bytes_type = array<unsigned char, 4> ;
Declared in file <boost/url/ipv4_address.hpp> at line 71
Constructor.
void
ipv4_address();
Declared in file <boost/url/ipv4_address.hpp> at line 76
Constructor.
void
ipv4_address(
const ipv4_address&);
Declared in file <boost/url/ipv4_address.hpp> at line 80
Copy Assignment.
ipv4_address&
operator=(
const ipv4_address&);
Declared in file <boost/url/ipv4_address.hpp> at line 85
Construct from an unsigned integer.
void
ipv4_address(
uint_type u) noexcept;
Declared in file <src/ipv4_address.cpp> at line 23
This function constructs an address from the unsigned integer `u`, where the most significant byte forms the first octet of the resulting address.
Construct from an array of bytes.
void
ipv4_address(
const bytes_type& bytes) noexcept;
Declared in file <src/ipv4_address.cpp> at line 30
This function constructs an address from the array in `bytes`, which is interpreted in big-endian.
Construct from a string.
void
ipv4_address(
string_view s);
Declared in file <src/ipv4_address.cpp> at line 41
This function constructs an address from the string `s`, which must contain a valid IPv4 address string or else an exception is thrown.
For a non-throwing parse function, use parse_ipv4_address.
Exceptions thrown on invalid input.
Return the address as bytes, in network byte order.
Return the address as an unsigned integer.
Return the address as a string in dotted decimal format
template<
class StringToken = return_string>
StringToken::result_type
to_string(
StringToken&& token);
Declared in file <boost/url/ipv4_address.hpp> at line 196
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.
assert( ipv4_address(0x01020304).to_string() == "1.2.3.4" );
Constant.
Strong guarantee. Calls to allocate may throw. String tokens may throw exceptions.
Write a dotted decimal string representing the address to a buffer
string_view
to_buffer(
char* dest,
size_t dest_size);
Declared in file <src/ipv4_address.cpp> at line 71
The resulting buffer is not null-terminated.
Return true if the address is a loopback address
bool
is_loopback() noexcept;
Declared in file <src/ipv4_address.cpp> at line 83
Return true if the address is unspecified
bool
is_unspecified() noexcept;
Declared in file <src/ipv4_address.cpp> at line 91
Return true if the address is a multicast address
bool
is_multicast() noexcept;
Declared in file <src/ipv4_address.cpp> at line 98
Return an address object that represents any address
static
ipv4_address
any() noexcept;
Declared in file <boost/url/ipv4_address.hpp> at line 265
Return an address object that represents the loopback address
static
ipv4_address
loopback() noexcept;
Declared in file <boost/url/ipv4_address.hpp> at line 274
Return an address object that represents the broadcast address
static
ipv4_address
broadcast() noexcept;
Declared in file <boost/url/ipv4_address.hpp> at line 283
Return true if two addresses are equal
bool
operator==(
const ipv4_address& a1,
const ipv4_address& a2) noexcept;
Declared in file <boost/url/ipv4_address.hpp> at line 243
Return true if two addresses are not equal
bool
operator!=(
const ipv4_address& a1,
const ipv4_address& a2) noexcept;
Declared in file <boost/url/ipv4_address.hpp> at line 254
Format the address to an output stream.
ostream&
operator<<(
ostream& os,
const ipv4_address& addr);
Declared in file <boost/url/ipv4_address.hpp> at line 291
IPv4 addresses written to output streams are written in their dotted decimal format.
Return an IPv4 address from an IP address string in dotted decimal form
result<ipv4_address>
parse_ipv4_address(
string_view s) noexcept;
Declared in file <src/ipv4_address.cpp> at line 157
An IP version 6 style address.
class ipv6_address ;
Declared in file <boost/url/ipv6_address.hpp> at line 64
Name | Description |
---|---|
bytes_type | The type used to represent an address as an array of bytes. |
Name | Description |
---|---|
ipv6_address | Constructor. |
ipv6_address | Constructor. |
operator= | Copy Assignment |
ipv6_address | Construct from an array of bytes. |
ipv6_address | Construct from an IPv4 address. |
ipv6_address | Construct from a string. |
to_bytes | Return the address as bytes, in network byte order |
to_string | Return the address as a string. |
to_buffer | Write a dotted decimal string representing the address to a buffer |
is_unspecified | Return true if the address is unspecified |
is_loopback | Return true if the address is a loopback address |
is_v4_mapped | Return true if the address is a mapped IPv4 address |
Objects of this type are used to construct, parse, and manipulate IP version 6 addresses.
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
The number of characters in the longest possible IPv6 string.
const size_t max_str_len ;
Declared in file <boost/url/ipv6_address.hpp> at line 81
The longest IPv6 address is:
ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
The type used to represent an address as an array of bytes.
using bytes_type = array<unsigned char, 16> ;
Declared in file <boost/url/ipv6_address.hpp> at line 89
Octets are stored in network byte order.
Constructor.
void
ipv6_address();
Declared in file <boost/url/ipv6_address.hpp> at line 103
Default constructed objects represent the unspecified address.
Constructor.
void
ipv6_address(
const ipv6_address&);
Declared in file <boost/url/ipv6_address.hpp> at line 107
Copy Assignment
ipv6_address&
operator=(
const ipv6_address&);
Declared in file <boost/url/ipv6_address.hpp> at line 112
Construct from an array of bytes.
void
ipv6_address(
const bytes_type& bytes) noexcept;
Declared in file <src/ipv6_address.cpp> at line 24
This function constructs an address from the array in `bytes`, which is interpreted in big-endian.
Construct from an IPv4 address.
void
ipv6_address(
const ipv4_address& addr) noexcept;
Declared in file <src/ipv6_address.cpp> at line 32
This function constructs an IPv6 address from the IPv4 address `addr`. The resulting address is an IPv4-Mapped IPv6 Address.
Construct from a string.
void
ipv6_address(
string_view s);
Declared in file <src/ipv6_address.cpp> at line 43
This function constructs an address from the string `s`, which must contain a valid IPv6 address string or else an exception is thrown.
For a non-throwing parse function, use parse_ipv6_address.
Exceptions thrown on invalid input.
Return the address as bytes, in network byte order
Return the address as a string.
template<
class StringToken = return_string>
StringToken::result_type
to_string(
StringToken&& token);
Declared in file <boost/url/ipv6_address.hpp> at line 223
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.
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" );
Constant.
Strong guarantee. Calls to allocate may throw. String tokens may throw exceptions.
Write a dotted decimal string representing the address to a buffer
string_view
to_buffer(
char* dest,
size_t dest_size);
Declared in file <src/ipv6_address.cpp> at line 52
The resulting buffer is not null-terminated.
Return true if the address is unspecified
bool
is_unspecified() noexcept;
Declared in file <src/ipv6_address.cpp> at line 71
The address 0:0:0:0:0:0:0:0 is called the unspecified address. It indicates the absence of an address.
Return true if the address is a loopback address
bool
is_loopback() noexcept;
Declared in file <src/ipv6_address.cpp> at line 64
The unicast address 0:0:0:0:0:0:0:1 is called the loopback address. It may be used by a node to send an IPv6 packet to itself.
Return true if the address is a mapped IPv4 address
bool
is_v4_mapped() noexcept;
Declared in file <src/ipv6_address.cpp> at line 78
This address type is used to represent the addresses of IPv4 nodes as IPv6 addresses.
Return an address object that represents the loopback address
static
ipv6_address
loopback() noexcept;
Declared in file <src/ipv6_address.cpp> at line 92
The unicast address 0:0:0:0:0:0:0:1 is called the loopback address. It may be used by a node to send an IPv6 packet to itself.
Return true if two addresses are equal
bool
operator==(
const ipv6_address& a1,
const ipv6_address& a2) noexcept;
Declared in file <boost/url/ipv6_address.hpp> at line 293
Return true if two addresses are not equal
bool
operator!=(
const ipv6_address& a1,
const ipv6_address& a2) noexcept;
Declared in file <boost/url/ipv6_address.hpp> at line 304
Format the address to an output stream
ostream&
operator<<(
ostream& os,
const ipv6_address& addr);
Declared in file <boost/url/ipv6_address.hpp> at line 329
This function writes the address to an output stream using standard notation.
Parse a string containing an IPv6 address.
result<ipv6_address>
parse_ipv6_address(
string_view s) noexcept;
Declared in file <src/ipv6_address.cpp> at line 242
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.
Throws nothing.
Identifies a known URL scheme
enum scheme;
Declared in file <boost/url/scheme.hpp> at line 33
Name | Description |
---|---|
none | Indicates that no scheme is present |
unknown | Indicates the scheme is not a well-known scheme |
ftp | File Transfer Protocol (FTP) |
file | File URI Scheme |
http | The Hypertext Transfer Protocol URI Scheme |
https | The Secure Hypertext Transfer Protocol URI Scheme |
ws | The WebSocket URI Scheme |
wss | The Secure WebSocket URI Scheme |
FTP is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network.
The File URI Scheme is typically used to retrieve files from within one's own computer.
URLs of this type indicate a resource which is interacted with using the HTTP protocol.
URLs of this type indicate a resource which is interacted with using the Secure HTTP protocol.
URLs of this type indicate a resource which is interacted with using the WebSocket protocol.
URLs of this type indicate a resource which is interacted with using the Secure WebSocket protocol.
Return the known scheme for a non-normalized string, if known
scheme
string_to_scheme(
string_view s) noexcept;
Declared in file <src/scheme.cpp> at line 20
If the string does not identify a known scheme, the value scheme::unknown is returned.
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
Return the normalized string for a known scheme
Return the default port for a known scheme
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:
A non-owning reference to a valid URL
class url_view
: public url_view_base;
Declared in file <boost/url/url_view.hpp> at line 74
Name | Description |
---|---|
digest | |
size | Return the number of characters in the url |
empty | Return true if the url is empty |
data | Return a pointer to the url's character buffer |
buffer | Return the url string |
operator string_view | Return the URL as a core::string_view |
persist | Return a shared, persistent copy of the url |
has_scheme | Return true a scheme is present |
scheme | Return the scheme |
scheme_id | Return the scheme |
has_authority | Return true if an authority is present |
authority | Return the authority |
encoded_authority | Return the authority. |
has_userinfo | Return true if a userinfo is present |
has_password | Return true if a password is present |
userinfo | Return the userinfo |
encoded_userinfo | Return the userinfo |
user | Return the user |
encoded_user | Return the user |
password | Return the password |
encoded_password | Return the password |
host_type | Return the host type |
host | Return the host |
encoded_host | Return the host |
host_address | Return the host |
encoded_host_address | Return the host |
host_ipv4_address | Return the host IPv4 address |
host_ipv6_address | Return the host IPv6 address |
host_ipvfuture | Return the host IPvFuture address |
host_name | Return the host name |
encoded_host_name | Return the host name |
zone_id | Return the IPv6 Zone ID |
encoded_zone_id | Return the IPv6 Zone ID |
has_port | Return true if a port is present |
port | Return the port |
port_number | Return the port |
is_path_absolute | Return true if the path is absolute |
path | Return the path |
encoded_path | Return the path |
segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
has_query | Return true if a query is present |
query | Return the query |
encoded_query | Return the query |
params | Return the query as a container of parameters |
params | |
encoded_params | Return the query as a container of parameters |
has_fragment | Return true if a fragment is present |
fragment | Return the fragment |
encoded_fragment | Return the fragment |
encoded_host_and_port | Return the host and port |
encoded_origin | Return the origin |
encoded_resource | Return the resource |
encoded_target | Return the target |
compare | Return the result of comparing this with another url |
~url_view | Destructor |
url_view | Constructor |
url_view | Constructor |
url_view | |
url_view | Constructor |
url_view | Constructor |
operator= | Assignment |
operator= | Assignment |
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.
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" );
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" );
URI-reference = URI / relative-ref
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
Destructor
void
~url_view();
Declared in file <boost/url/url_view.hpp> at line 110
Any params, segments, iterators, or other views which reference the same underlying character buffer remain valid.
Constructor
void
url_view() noexcept;
Declared in file <src/url_view.cpp> at line 35
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.
url_view u;
this->empty() == true
Constant.
Throws nothing.
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
Constructor
void
url_view(
string_view s);
Declared in file <src/url_view.cpp> at line 38
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.
url_view u( "http://www.example.com/index.htm" );
return parse_uri_reference( s ).value();
Linear in `s.size()`.
Exceptions thrown on invalid input.
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
template<
class String,
class = enable_if<std::is_convertible::value && !std::is_convertible::value> ::type>
void
url_view(
const String& s);
Declared in file <boost/url/url_view.hpp> at line 215
Constructor
void
url_view(
const url_view& other) noexcept;
Declared in file <boost/url/url_view.hpp> at line 239
After construction, both views reference the same underlying character buffer. Ownership is not transferred.
this->buffer().data() == other.buffer().data()
Constant.
Throws nothing.
Constructor
void
url_view(
const url_view_base& other) noexcept;
Declared in file <src/url_view.cpp> at line 45
After construction, both views reference the same underlying character buffer. Ownership is not transferred.
this->buffer().data() == other.buffer().data()
Constant.
Throws nothing.
Assignment
Declared in file <boost/url/url_view.hpp> at line 283
After assignment, both views reference the same underlying character buffer. Ownership is not transferred.
this->buffer().data() == other.buffer().data()
Constant.
Throws nothing.
Assignment
url_view&
operator=(
const url_view_base& other) noexcept;
Declared in file <src/url_view.cpp> at line 61
After assignment, both views reference the same underlying character buffer. Ownership is not transferred.
this->buffer().data() == other.buffer().data()
Constant.
Throws nothing.
Return the maximum number of characters possible
static
size_t
max_size() noexcept;
Declared in file <boost/url/url_view.hpp> at line 331
This represents the largest number of characters that are possible in a url, not including any null terminator.
Constant.
Throws nothing.
A non-owning reference to a valid authority
class authority_view ;
Declared in file <boost/url/authority_view.hpp> at line 82
Name | Description |
---|---|
~authority_view | Destructor |
authority_view | Constructor |
authority_view | Construct from a string. |
authority_view | Constructor |
operator= | Assignment |
size | Return the number of characters in the authority |
empty | Return true if the authority is empty |
data | Return a pointer to the first character |
buffer | Return the complete authority |
has_userinfo | Return true if a userinfo is present |
userinfo | Return the userinfo |
encoded_userinfo | Return the userinfo |
user | Return the user |
encoded_user | Return the user |
has_password | Return true if a password is present |
password | Return the password |
encoded_password | Return the password |
host_type | Return the host type |
host | Return the host |
encoded_host | Return the host |
host_address | Return the host |
encoded_host_address | Return the host |
host_ipv4_address | Return the host IPv4 address |
host_ipv6_address | Return the host IPv6 address |
host_ipvfuture | Return the host IPvFuture address |
host_name | Return the host name |
encoded_host_name | Return the host name |
has_port | Return true if a port is present |
port | Return the port |
port_number | Return the port |
encoded_host_and_port | Return the host and port |
compare | Return the result of comparing this with another authority |
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.
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" );
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" );
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
Destructor
void
~authority_view();
Declared in file <src/authority_view.cpp> at line 49
Constructor
void
authority_view() noexcept;
Declared in file <src/authority_view.cpp> at line 54
Default constructed authorities refer to a string with zero length, which is always valid. This matches the grammar for a zero-length host.
Throws nothing.
Construct from a string.
void
authority_view(
string_view s);
Declared in file <src/authority_view.cpp> at line 60
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.
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
Constructor
void
authority_view(
const authority_view&) noexcept;
Declared in file <src/authority_view.cpp> at line 69
Assignment
authority_view&
operator=(
const authority_view&) noexcept;
Declared in file <src/authority_view.cpp> at line 73
Return the number of characters in the authority
size_t
size() noexcept;
Declared in file <boost/url/authority_view.hpp> at line 191
This function returns the number of characters in the authority.
assert( authority_view( "user:pass@www.example.com:8080" ).size() == 30 );
Throws nothing.
Return true if the authority is empty
bool
empty() noexcept;
Declared in file <boost/url/authority_view.hpp> at line 210
An empty authority has an empty host, no userinfo, and no port.
assert( authority_view( "" ).empty() );
Throws nothing.
Return a pointer to the first character
const char*
data() noexcept;
Declared in file <boost/url/authority_view.hpp> at line 225
This function returns a pointer to the beginning of the view, which is not guaranteed to be null-terminated.
Throws nothing.
Return the complete authority
string_view
buffer() noexcept;
Declared in file <boost/url/authority_view.hpp> at line 253
This function returns the authority as a percent-encoded string.
assert( parse_authority( "www.example.com" ).value().buffer() == "www.example.com" );
authority = [ userinfo "@" ] host [ ":" port ]
Throws nothing.
Return true if a userinfo is present
bool
has_userinfo() noexcept;
Declared in file <src/authority_view.cpp> at line 84
This function returns true if this contains a userinfo.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() );
Constant.
Throws nothing.
userinfo = user [ ":" [ password ] ]
authority = [ userinfo "@" ] host [ ":" port ]
Return the userinfo
template<
class StringToken = return_string>
StringToken::result_type
userinfo(
StringToken&& token);
Declared in file <boost/url/authority_view.hpp> at line 346
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.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" );
Linear in `this->userinfo().size()`.
Calls to allocate may throw.
userinfo = user [ ":" [ password ] ]
authority = [ userinfo "@" ] host [ ":" port ]
Return the userinfo
pct_string_view
encoded_userinfo() noexcept;
Declared in file <src/authority_view.cpp> at line 96
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.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" );
Constant.
Throws nothing
userinfo = user [ ":" [ password ] ]
authority = [ userinfo "@" ] host [ ":" port ]
Return the user
template<
class StringToken = return_string>
StringToken::result_type
user(
StringToken&& token);
Declared in file <boost/url/authority_view.hpp> at line 443
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.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );
Linear in `this->user().size()`.
Calls to allocate may throw.
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Return the user
pct_string_view
encoded_user() noexcept;
Declared in file <src/authority_view.cpp> at line 115
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.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" );
Constant.
Throws nothing.
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Return true if a password is present
bool
has_password() noexcept;
Declared in file <src/authority_view.cpp> at line 126
This function returns true if the userinfo is present and contains a password.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() );
Constant.
Throws nothing.
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Return the password
template<
class StringToken = return_string>
StringToken::result_type
password(
StringToken&& token);
Declared in file <boost/url/authority_view.hpp> at line 580
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.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" );
Linear in `this->password().size()`.
Calls to allocate may throw.
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Return the password
pct_string_view
encoded_password() noexcept;
Declared in file <src/authority_view.cpp> at line 144
This function returns the password portion of the userinfo as a percent-encoded string.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" );
Constant.
Throws nothing.
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Return the host type
host_type
host_type() noexcept;
Declared in file <boost/url/authority_view.hpp> at line 662
This function returns one of the following constants representing the type of host present.
assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );
Constant.
Throws nothing.
Return the host
template<
class StringToken = return_string>
StringToken::result_type
host(
StringToken&& token);
Declared in file <boost/url/authority_view.hpp> at line 701
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.
assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" );
Linear in `this->host().size()`.
Calls to allocate may throw.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Return the host
pct_string_view
encoded_host() noexcept;
Declared in file <src/authority_view.cpp> at line 190
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.
assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" );
Constant.
Throws nothing.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Return the host
template<
class StringToken = return_string>
StringToken::result_type
host_address(
StringToken&& token);
Declared in file <boost/url/authority_view.hpp> at line 796
The value returned by this function depends on the type of host returned from the function host_type.
assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" );
Linear in `this->host_address().size()`.
Calls to allocate may throw.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Return the host
pct_string_view
encoded_host_address() noexcept;
Declared in file <src/authority_view.cpp> at line 197
The value returned by this function depends on the type of host returned from the function host_type.
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" );
Constant.
Throws nothing.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Return the host IPv4 address
ipv4_address
host_ipv4_address() noexcept;
Declared in file <src/authority_view.cpp> at line 234
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".
assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) );
Constant.
Throws nothing.
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
dec-octet = DIGIT ; 0-9
/ %x31-39 DIGIT ; 10-99
/ "1" 2DIGIT ; 100-199
/ "2" %x30-34 DIGIT ; 200-249
/ "25" %x30-35 ; 250-255
Return the host IPv6 address
ipv6_address
host_ipv6_address() noexcept;
Declared in file <src/authority_view.cpp> at line 247
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".
assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) );
Constant.
Throws nothing.
IPv6address = 6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32
/ [ h16 ] "::" 4( h16 ":" ) ls32
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
/ [ *4( h16 ":" ) h16 ] "::" ls32
/ [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::"
ls32 = ( h16 ":" h16 ) / IPv4address
; least-significant 32 bits of address
h16 = 1*4HEXDIG
; 16 bits of address represented in hexadecimal
Return the host IPvFuture address
string_view
host_ipvfuture() noexcept;
Declared in file <src/authority_view.cpp> at line 260
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.
assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" );
Constant.
Throws nothing.
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
Return the host name
template<
class StringToken = return_string>
StringToken::result_type
host_name(
StringToken&& token);
Declared in file <boost/url/authority_view.hpp> at line 1013
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.
assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" );
Linear in `this->host_name().size()`.
Calls to allocate may throw.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Return the host name
pct_string_view
encoded_host_name() noexcept;
Declared in file <src/authority_view.cpp> at line 275
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.
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" );
Constant.
Throws nothing.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Return true if a port is present
bool
has_port() noexcept;
Declared in file <src/authority_view.cpp> at line 291
This function returns true if an authority is present and contains a port.
assert( url_view( "wss://www.example.com:443" ).has_port() );
Constant.
Throws nothing.
authority = [ userinfo "@" ] host [ ":" port ]
port = *DIGIT
Return the port
string_view
port() noexcept;
Declared in file <src/authority_view.cpp> at line 303
If present, this function returns a string representing the port (which may be empty). Otherwise it returns an empty string.
assert( url_view( "http://localhost.com:8080" ).port() == "8080" );
Constant.
Throws nothing.
port = *DIGIT
Return the port
uint16_t
port_number() noexcept;
Declared in file <src/authority_view.cpp> at line 314
If a port is present and the numerical value is representable, it is returned as an unsigned integer. Otherwise, the number zero is returned.
assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );
Constant.
Throws nothing.
port = *DIGIT
Return the host and port
pct_string_view
encoded_host_and_port() noexcept;
Declared in file <src/authority_view.cpp> at line 324
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.
assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" );
Constant.
Throws nothing.
authority = [ userinfo "@" ] host [ ":" port ]
Return the result of comparing this with another authority
int
compare(
const authority_view& other) noexcept;
Declared in file <src/authority_view.cpp> at line 350
This function compares two authorities according to Syntax-Based comparison algorithm.
Throws nothing.
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.
bool
operator==(
const authority_view& a0,
const authority_view& a1) noexcept;
Declared in file <boost/url/authority_view.hpp> at line 1246
Linear in `min( a0.size(), a1.size() )`
Throws nothing
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.
bool
operator!=(
const authority_view& a0,
const authority_view& a1) noexcept;
Declared in file <boost/url/authority_view.hpp> at line 1266
Linear in `min( a0.size(), a1.size() )`
Throws nothing
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.
bool
operator<(
const authority_view& a0,
const authority_view& a1) noexcept;
Declared in file <boost/url/authority_view.hpp> at line 1286
Linear in `min( a0.size(), a1.size() )`
Throws nothing
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.
bool
operator<=(
const authority_view& a0,
const authority_view& a1) noexcept;
Declared in file <boost/url/authority_view.hpp> at line 1306
Linear in `min( a0.size(), a1.size() )`
Throws nothing
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.
bool
operator>(
const authority_view& a0,
const authority_view& a1) noexcept;
Declared in file <boost/url/authority_view.hpp> at line 1326
Linear in `min( a0.size(), a1.size() )`
Throws nothing
Return the result of comparing two authorities The authorities are compared component by component as if they were first normalized.
bool
operator>=(
const authority_view& a0,
const authority_view& a1) noexcept;
Declared in file <boost/url/authority_view.hpp> at line 1346
Linear in `min( a0.size(), a1.size() )`
Throws nothing
Format the encoded authority to the output stream
ostream&
operator<<(
ostream& os,
const authority_view& a);
Declared in file <boost/url/authority_view.hpp> at line 1358
This function serializes the encoded URL to the output stream.
authority_view a( "www.example.com" );
std::cout << a << std::endl;
Parse an authority
result<authority_view>
parse_authority(
string_view s) noexcept;
Declared in file <src/authority_view.cpp> at line 337
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.
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
Throws nothing.
struct ignore_case_t ;
Declared in file <boost/url/ignore_case.hpp> at line 19
An optional parameter to determine case-sensitivity
class ignore_case_param ;
Declared in file <boost/url/ignore_case.hpp> at line 46
Name | Description |
---|---|
ignore_case_param | Constructor |
ignore_case_param | Constructor |
operator bool | True if an algorithm should ignore case |
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.
Constructor
void
ignore_case_param() noexcept;
Declared in file <boost/url/ignore_case.hpp> at line 71
By default, comparisons are case-sensitive.
This function performs case-sensitive comparisons when called with no arguments:
void f( ignore_case_param = {} );
Constructor
void
ignore_case_param(
ignore_case_t) noexcept;
Declared in file <boost/url/ignore_case.hpp> at line 88
Construction from ignore_case indicates that comparisons should be case-insensitive.
When ignore_case is passed as an argument, this function ignores case when performing comparisons:
void f( ignore_case_param = {} );
True if an algorithm should ignore case
bool
operator bool() noexcept;
Declared in file <boost/url/ignore_case.hpp> at line 108
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`.
Common functionality for containers
class segments_encoded_base ;
Declared in file <boost/url/segments_encoded_base.hpp> at line 37
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
const_iterator | iterator |
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | An unsigned integer type used to represent size. |
difference_type | A signed integer type used to represent differences. |
Name | Description |
---|---|
buffer | Return the referenced character buffer. |
is_absolute | Returns true if this references an absolute path. |
empty | Return true if there are no segments |
size | Return the number of segments |
front | Return the first segment |
back | Return the last segment |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:
class iterator ;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 20
Name | Description |
---|---|
value_type | |
reference | |
pointer | |
difference_type | |
iterator_category |
Name | Description |
---|---|
iterator | |
iterator | |
operator= | |
operator* | |
operator-> | |
operator++ | |
operator-- | |
operator++ | |
operator-- | |
operator== | |
operator!= |
using value_type = segments_encoded_base::value_type ;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 38
using reference = segments_encoded_base::reference ;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 40
using pointer = reference ;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 42
using difference_type = ptrdiff_t ;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 43
using iterator_category = bidirectional_iterator_tag ;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 44
void
iterator();
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 47
void
iterator(
const iterator&);
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 48
reference
operator*() noexcept;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 52
pointer
operator->() noexcept;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 58
iterator&
operator++() noexcept;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 64
iterator&
operator--() noexcept;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 71
iterator
operator++(
int) noexcept;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 78
iterator
operator--(
int) noexcept;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 86
bool
operator==(
const iterator& other) noexcept;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 94
bool
operator!=(
const iterator& other) noexcept;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 101
iterator
using const_iterator = iterator ;
Declared in file <boost/url/segments_encoded_base.hpp> at line 83
The value type
using value_type = string ;
Declared in file <boost/url/segments_encoded_base.hpp> at line 96
Values of this type represent a segment where unique ownership is retained by making a copy.
segments_encoded_base::value_type ps( url_view( "/path/to/file.txt" ).encoded_segments().back() );
The reference type
using reference = pct_string_view ;
Declared in file <boost/url/segments_encoded_base.hpp> at line 103
This is the type of value returned when iterators of the view are dereferenced.
The reference type
using const_reference = pct_string_view ;
Declared in file <boost/url/segments_encoded_base.hpp> at line 106
This is the type of value returned when iterators of the view are dereferenced.
An unsigned integer type used to represent size.
using size_type = size_t ;
Declared in file <boost/url/segments_encoded_base.hpp> at line 110
A signed integer type used to represent differences.
using difference_type = ptrdiff_t ;
Declared in file <boost/url/segments_encoded_base.hpp> at line 114
Return the maximum number of characters possible
static
size_t
max_size() noexcept;
Declared in file <boost/url/segments_encoded_base.hpp> at line 131
This represents the largest number of characters that are possible in a path, not including any null terminator.
Throws nothing.
Return the referenced character buffer.
pct_string_view
buffer() noexcept;
Declared in file <src/segments_encoded_base.cpp> at line 58
This function returns the character buffer referenced by the view. The returned string may contain percent escapes.
assert( url_view( "/path/to/file.txt" ).encoded_segments().buffer() == "/path/to/file.txt" );
Constant.
Throws nothing.
Returns true if this references an absolute path.
bool
is_absolute() noexcept;
Declared in file <src/segments_encoded_base.cpp> at line 65
Absolute paths always start with a forward slash ('/').
assert( url_view( "/path/to/file.txt" ).encoded_segments().is_absolute() == true );
Constant.
Throws nothing.
Return true if there are no segments
bool
empty() noexcept;
Declared in file <src/segments_encoded_base.cpp> at line 72
assert( ! url_view( "/index.htm" ).encoded_segments().empty() );
Constant.
Throws nothing.
Return the number of segments
size_t
size() noexcept;
Declared in file <src/segments_encoded_base.cpp> at line 79
assert( url_view( "/path/to/file.txt" ).encoded_segments().size() == 3 );
Constant.
Throws nothing.
Return the first segment
pct_string_view
front() noexcept;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 111
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.
this->empty() == false
return *begin();
assert( url_view( "/path/to/file.txt" ).encoded_segments().front() == "path" );
Constant.
Throws nothing.
Return the last segment
pct_string_view
back() noexcept;
Declared in file <boost/url/impl/segments_encoded_base.hpp> at line 120
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.
this->empty() == false
assert( url_view( "/path/to/file.txt" ).encoded_segments().back() == "file.txt" );
this->empty() == false
return *--end();
Constant.
Throws nothing.
Return an iterator to the beginning
Linear in `this->front().size()` or constant if `this->empty()`.
Throws nothing.
Return an iterator to the end
Constant.
Throws nothing.
Format to an output stream
ostream&
operator<<(
ostream& os,
const segments_encoded_base& ps);
Declared in file <src/segments_encoded_base.cpp> at line 104
Any percent-escapes are emitted as-is; no decoding is performed.
Linear in `ps.buffer().size()`.
return os << ps.buffer();
Common functionality for containers
class segments_base ;
Declared in file <boost/url/segments_base.hpp> at line 37
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
const_iterator | iterator |
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | An unsigned integer type used to represent size. |
difference_type | A signed integer type used to represent differences. |
Name | Description |
---|---|
buffer | Return the referenced character buffer. |
is_absolute | Returns true if this references an absolute path. |
empty | Return true if there are no segments |
size | Return the number of segments |
front | Return the first segment |
back | Return the last segment |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:
class iterator ;
Declared in file <boost/url/impl/segments_base.hpp> at line 21
Name | Description |
---|---|
value_type | |
reference | |
pointer | |
difference_type | |
iterator_category |
Name | Description |
---|---|
iterator | |
iterator | |
operator= | |
operator* | |
operator-> | |
operator++ | |
operator-- | |
operator++ | |
operator-- | |
operator== | |
operator!= |
using value_type = segments_base::value_type ;
Declared in file <boost/url/impl/segments_base.hpp> at line 38
using reference = segments_base::reference ;
Declared in file <boost/url/impl/segments_base.hpp> at line 39
using difference_type = segments_base::difference_type ;
Declared in file <boost/url/impl/segments_base.hpp> at line 41
using iterator_category = bidirectional_iterator_tag ;
Declared in file <boost/url/impl/segments_base.hpp> at line 43
void
iterator();
Declared in file <boost/url/impl/segments_base.hpp> at line 46
void
iterator(
const iterator&);
Declared in file <boost/url/impl/segments_base.hpp> at line 47
pointer
operator->() = delete;
Declared in file <boost/url/impl/segments_base.hpp> at line 56
iterator&
operator++() noexcept;
Declared in file <boost/url/impl/segments_base.hpp> at line 58
iterator&
operator--() noexcept;
Declared in file <boost/url/impl/segments_base.hpp> at line 65
iterator
operator++(
int) noexcept;
Declared in file <boost/url/impl/segments_base.hpp> at line 72
iterator
operator--(
int) noexcept;
Declared in file <boost/url/impl/segments_base.hpp> at line 80
bool
operator==(
const iterator& other) noexcept;
Declared in file <boost/url/impl/segments_base.hpp> at line 88
bool
operator!=(
const iterator& other) noexcept;
Declared in file <boost/url/impl/segments_base.hpp> at line 95
iterator
using const_iterator = iterator ;
Declared in file <boost/url/segments_base.hpp> at line 80
The value type
using value_type = string ;
Declared in file <boost/url/segments_base.hpp> at line 93
Values of this type represent a segment where unique ownership is retained by making a copy.
segments_base::value_type ps( url_view( "/path/to/file.txt" ).segments().back() );
The reference type
using reference = string ;
Declared in file <boost/url/segments_base.hpp> at line 100
This is the type of value returned when iterators of the view are dereferenced.
The reference type
using const_reference = string ;
Declared in file <boost/url/segments_base.hpp> at line 103
This is the type of value returned when iterators of the view are dereferenced.
An unsigned integer type used to represent size.
using size_type = size_t ;
Declared in file <boost/url/segments_base.hpp> at line 107
A signed integer type used to represent differences.
using difference_type = ptrdiff_t ;
Declared in file <boost/url/segments_base.hpp> at line 111
Return the maximum number of characters possible
static
size_t
max_size() noexcept;
Declared in file <boost/url/segments_base.hpp> at line 128
This represents the largest number of characters that are possible in a path, not including any null terminator.
Throws nothing.
Return the referenced character buffer.
This function returns the character buffer referenced by the view. The returned string may contain percent escapes.
assert( url_view( "/path/to/file.txt" ).segments().buffer() == "/path/to/file.txt" );
Constant.
Throws nothing.
Returns true if this references an absolute path.
bool
is_absolute() noexcept;
Declared in file <src/segments_base.cpp> at line 69
Absolute paths always start with a forward slash ('/').
assert( url_view( "/path/to/file.txt" ).segments().is_absolute() == true );
Constant.
Throws nothing.
Return true if there are no segments
bool
empty() noexcept;
Declared in file <src/segments_base.cpp> at line 76
assert( ! url_view( "/index.htm" ).segments().empty() );
Constant.
Throws nothing.
Return the number of segments
size_t
size() noexcept;
Declared in file <src/segments_base.cpp> at line 83
assert( url_view( "/path/to/file.txt" ).segments().size() == 3 );
Constant.
Throws nothing.
Return the first segment
string
front() noexcept;
Declared in file <boost/url/impl/segments_base.hpp> at line 105
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.
this->empty() == false
return *begin();
assert( url_view( "/path/to/file.txt" ).segments().front() == "path" );
Linear in `this->front().size()`.
Calls to allocate may throw.
Return the last segment
string
back() noexcept;
Declared in file <boost/url/impl/segments_base.hpp> at line 114
this->empty() == false
assert( url_view( "/path/to/file.txt" ).segments().back() == "file.txt" );
this->empty() == false
return *--end();
Linear in `this->back().size()`.
Calls to allocate may throw.
Return an iterator to the beginning
Linear in `this->front().size()` or constant if `this->empty()`.
Throws nothing.
Return an iterator to the end
Constant.
Throws nothing.
Format to an output stream
ostream&
operator<<(
ostream& os,
const segments_base& ps);
Declared in file <src/segments_base.cpp> at line 108
Any percent-escapes are emitted as-is; no decoding is performed.
Linear in `ps.buffer().size()`.
return os << ps.buffer();
A view representing path segments in a URL
class segments_view
: public segments_base;
Declared in file <boost/url/segments_view.hpp> at line 55
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
const_iterator | iterator |
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | An unsigned integer type used to represent size. |
difference_type | A signed integer type used to represent differences. |
Name | Description |
---|---|
buffer | Return the referenced character buffer. |
is_absolute | Returns true if this references an absolute path. |
empty | Return true if there are no segments |
size | Return the number of segments |
front | Return the first segment |
back | Return the last segment |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
segments_view | Constructor |
segments_view | Constructor |
segments_view | Constructor |
operator= | Assignment |
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.
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.
Changes to the underlying character buffer can invalidate iterators which reference it.
Constructor
void
segments_view();
Declared in file <boost/url/segments_view.hpp> at line 87
Default-constructed segments have zero elements.
segments_view ps;
return segments_view( "" );
Constant.
Throws nothing.
Constructor
void
segments_view(
const segments_view& other);
Declared in file <boost/url/segments_view.hpp> at line 111
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.
this->buffer().data() == other.buffer().data()
Constant
Throws nothing
Constructor
void
segments_view(
string_view s);
Declared in file <src/segments_view.cpp> at line 28
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.
segments_view ps( "/path/to/file.txt" );
return parse_path( s ).value();
this->buffer().data() == s.data()
Linear in `s`.
Exceptions thrown on invalid input.
path = [ "/" ] [ segment *( "/" segment ) ]
segment = *pchar
Assignment
segments_view&
operator=(
const segments_view& other);
Declared in file <boost/url/segments_view.hpp> at line 188
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.
this->buffer().data() == other.buffer().data()
Constant
Throws nothing
A view representing path segments in a URL
class segments_encoded_view
: public segments_encoded_base;
Declared in file <boost/url/segments_encoded_view.hpp> at line 61
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
const_iterator | iterator |
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | An unsigned integer type used to represent size. |
difference_type | A signed integer type used to represent differences. |
Name | Description |
---|---|
buffer | Return the referenced character buffer. |
is_absolute | Returns true if this references an absolute path. |
empty | Return true if there are no segments |
size | Return the number of segments |
front | Return the first segment |
back | Return the last segment |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
segments_encoded_view | Constructor |
segments_encoded_view | Constructor |
segments_encoded_view | Constructor |
operator= | Assignment |
operator segments_view | Conversion |
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.
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.
Changes to the underlying character buffer can invalidate iterators which reference it.
Constructor
void
segments_encoded_view();
Declared in file <boost/url/segments_encoded_view.hpp> at line 92
Default-constructed segments have zero elements.
segments_encoded_view ps;
return segments_encoded_view( "" );
Constant.
Throws nothing.
Constructor
void
segments_encoded_view(
const segments_encoded_view&) noexcept;
Declared in file <boost/url/segments_encoded_view.hpp> at line 115
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.
this->buffer().data() == other.buffer().data()
Constant.
Throws nothing
Constructor
void
segments_encoded_view(
string_view s);
Declared in file <src/segments_encoded_view.cpp> at line 28
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.
segments_encoded_view ps( "/path/to/file.txt" );
return parse_path( s ).value();
this->buffer().data() == s.data()
Linear in `s`.
Exceptions thrown on invalid input.
path = [ "/" ] [ segment *( "/" segment ) ]
segment = *pchar
Assignment
segments_encoded_view&
operator=(
const segments_encoded_view&);
Declared in file <boost/url/segments_encoded_view.hpp> at line 192
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.
this->buffer().data() == other.buffer().data()
Constant
Throws nothing
Conversion
segments_view
operator segments_view() noexcept;
Declared in file <src/segments_encoded_view.cpp> at line 37
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.
segments_view ps = parse_path( "/path/to/file.txt" ).value();
segments_view( *this ).buffer().data() == this->buffer().data()
Constant
Throws nothing
Parse a string and return an encoded segment view
result<segments_encoded_view>
parse_path(
string_view s) noexcept;
Declared in file <src/parse_path.cpp> at line 24
This function parses the string and returns the corresponding path object if the string is valid, otherwise returns an error.
path = [ "/" ] segment *( "/" segment )
No-throw guarantee.
struct authority_rule_t ;
Declared in file <boost/url/rfc/authority_rule.hpp> at line 50
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = authority_view ;
Declared in file <boost/url/rfc/authority_rule.hpp> at line 52
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <src/rfc/authority_rule.cpp> at line 26
const authority_rule_t authority_rule ;
Declared in file <boost/url/rfc/authority_rule.hpp> at line 63
template<
class CharSet>
struct pct_encoded_rule_t ;
Declared in file <boost/url/rfc/pct_encoded_rule.hpp> at line 69
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = pct_string_view ;
Declared in file <boost/url/rfc/pct_encoded_rule.hpp> at line 71
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <boost/url/rfc/impl/pct_encoded_rule.hpp> at line 88
template<
class CharSet_>
pct_encoded_rule_t<CharSet_>
pct_encoded_rule(
const CharSet_& cs) noexcept;
Declared in file <boost/url/rfc/pct_encoded_rule.hpp> at line 74
template<
class CharSet>
pct_encoded_rule_t<CharSet>
pct_encoded_rule(
const CharSet& cs) noexcept;
Declared in file <boost/url/rfc/pct_encoded_rule.hpp> at line 98
The type of variant used by the library
template<
class... Ts>
using variant = variant<Ts...> ;
Declared in file <boost/url/variant.hpp> at line 22
template<
class T>
using optional = optional<T> ;
Declared in file <boost/url/optional.hpp> at line 39
Common functionality for containers
class params_encoded_base ;
Declared in file <boost/url/params_encoded_base.hpp> at line 38
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
const_iterator | iterator |
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | An unsigned integer type to represent sizes. |
difference_type | A signed integer type used to represent differences. |
Name | Description |
---|---|
buffer | Return the query corresponding to these params |
empty | Return true if there are no params |
size | Return the number of params |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
contains | Return true if a matching key exists |
count | Return the number of matching keys |
find | Find a matching key |
find | Find a matching key |
find_last | Find a matching key |
find_last | Find a matching key |
This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:
class iterator ;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 25
Name | Description |
---|---|
value_type | |
reference | |
pointer | |
difference_type | |
iterator_category |
Name | Description |
---|---|
iterator | |
iterator | |
operator= | |
operator++ | |
operator++ | |
operator-- | |
operator-- | |
operator* | |
operator-> |
using value_type = params_encoded_base::value_type ;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 41
using reference = params_encoded_base::reference ;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 43
using pointer = reference ;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 45
using difference_type = ptrdiff_t ;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 46
using iterator_category = bidirectional_iterator_tag ;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 47
void
iterator();
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 50
void
iterator(
const iterator&);
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 51
iterator&
operator++() noexcept;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 55
iterator
operator++(
int) noexcept;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 62
iterator&
operator--() noexcept;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 70
iterator
operator--(
int) noexcept;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 77
reference
operator*();
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 85
iterator
using const_iterator = iterator ;
Declared in file <boost/url/params_encoded_base.hpp> at line 84
The value type
using value_type = param ;
Declared in file <boost/url/params_encoded_base.hpp> at line 100
Values of this type represent parameters whose strings retain unique ownership by making a copy.
params_encoded_view::value_type qp( *url_view( "?first=John&last=Doe" ).params().find( "first" ) );
The reference type
using reference = param_pct_view ;
Declared in file <boost/url/params_encoded_base.hpp> at line 110
This is the type of value returned when iterators of the view are dereferenced.
The reference type
using const_reference = param_pct_view ;
Declared in file <boost/url/params_encoded_base.hpp> at line 113
This is the type of value returned when iterators of the view are dereferenced.
An unsigned integer type to represent sizes.
using size_type = size_t ;
Declared in file <boost/url/params_encoded_base.hpp> at line 117
A signed integer type used to represent differences.
using difference_type = ptrdiff_t ;
Declared in file <boost/url/params_encoded_base.hpp> at line 121
Return the maximum number of characters possible
static
size_t
max_size() noexcept;
Declared in file <boost/url/params_encoded_base.hpp> at line 138
This represents the largest number of characters that are possible in a path, not including any null terminator.
Throws nothing.
Return the query corresponding to these params
pct_string_view
buffer() noexcept;
Declared in file <src/params_encoded_base.cpp> at line 58
This function returns the query string referenced by the container. The returned string may contain percent escapes.
assert( url_view( "?first=John&last=Doe" ).encoded_params().buffer() == "first=John&last=Doe" );
Constant.
Throws nothing.
query-params = query-param *( "&" query-param )
query-param = key [ "=" value ]
key = *qpchar
value = *( qpchar / "=" )
Return true if there are no params
bool
empty() noexcept;
Declared in file <src/params_encoded_base.cpp> at line 65
assert( ! url_view( "?key=value" ).encoded_params().empty() );
Constant.
Throws nothing.
Return the number of params
size_t
size() noexcept;
Declared in file <src/params_encoded_base.cpp> at line 72
assert( url_view( "?key=value").encoded_params().size() == 1 );
Constant.
Throws nothing.
Return an iterator to the beginning
Linear in the size of the first param.
Throws nothing.
Return an iterator to the end
Constant.
Throws nothing.
Return true if a matching key exists
bool
contains(
pct_string_view key,
ignore_case_param ic) noexcept;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 122
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.
assert( url_view( "?first=John&last=Doe" ).encoded_params().contains( "first" ) );
Linear in `this->buffer().size()`.
Exceptions thrown on invalid input.
Return the number of matching keys
size_t
count(
pct_string_view key,
ignore_case_param ic) noexcept;
Declared in file <src/params_encoded_base.cpp> at line 97
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.
assert( url_view( "?first=John&last=Doe" ).encoded_params().count( "first" ) == 1 );
Linear in `this->buffer().size()`.
Exceptions thrown on invalid input.
Find a matching key
iterator
find(
pct_string_view key,
ignore_case_param ic) noexcept;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 133
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.
assert( url_view( "?first=John&last=Doe" ).encoded_params().find( "First", ignore_case )->value == "John" );
return this->find( this->begin(), key, ic );
Linear in `this->buffer().size()`.
Exceptions thrown on invalid input.
Find a matching key
iterator
find(
iterator from,
pct_string_view key,
ignore_case_param ic) noexcept;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 145
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.
url_view u( "?First=John&Last=Doe" );
assert( u.encoded_params().find( "first" ) != u.encoded_params().find( "first", ignore_case ) );
Linear in `this->buffer().size()`.
Exceptions thrown on invalid input.
Find a matching key
iterator
find_last(
pct_string_view key,
ignore_case_param ic) noexcept;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 158
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.
assert( url_view( "?first=John&last=Doe" ).encoded_params().find_last( "last" )->value == "Doe" );
Linear in `this->buffer().size()`.
Exceptions thrown on invalid input.
Find a matching key
iterator
find_last(
iterator before,
pct_string_view key,
ignore_case_param ic) noexcept;
Declared in file <boost/url/impl/params_encoded_base.hpp> at line 170
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.
url_view u( "?First=John&Last=Doe" );
assert( u.encoded_params().find_last( "last" ) != u.encoded_params().find_last( "last", ignore_case ) );
Linear in `this->buffer().size()`.
Format to an output stream
ostream&
operator<<(
ostream& os,
const params_encoded_base& qp);
Declared in file <src/params_encoded_base.cpp> at line 183
Any percent-escapes are emitted as-is; no decoding is performed.
Linear in `ps.buffer().size()`.
return os << ps.buffer();
A view representing query parameters in a URL
class params_ref
: public params_base;
Declared in file <boost/url/params_ref.hpp> at line 80
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
const_iterator | iterator |
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | An unsigned integer type to represent sizes. |
difference_type | A signed integer type used to represent differences. |
Name | Description |
---|---|
buffer | Return the referenced character buffer. |
empty | Return true if there are no params |
size | Return the number of params |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
contains | Return true if a matching key exists |
count | Return the number of matching keys |
find | Find a matching key |
find | Find a matching key |
find_last | Find a matching key |
find_last | Find a matching key |
params_ref | Constructor |
params_ref | Constructor |
operator= | Assignment |
operator= | Assignment |
operator params_view | Conversion |
url | Return the referenced url |
clear | Clear the contents of the container |
assign | Assign elements |
assign | Assign elements |
append | Append elements |
append | Append elements |
append | Append elements |
insert | Insert elements |
insert | Insert elements |
insert | Insert elements |
erase | Erase elements |
erase | Erase elements |
erase | Erase elements |
replace | Replace elements |
replace | Replace elements |
replace | Replace elements |
unset | Remove the value on an element |
set | Set a value |
set | Set a value |
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.
url u( "?first=John&last=Doe" );
params_ref p = u.params();
Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some or all iterators:
Constructor
void
params_ref(
const params_ref& other);
Declared in file <boost/url/params_ref.hpp> at line 120
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.
&this->url() == &other.url()
Constant.
Throws nothing.
Constructor
void
params_ref(
const params_ref& other,
encoding_opts opt) noexcept;
Declared in file <boost/url/impl/params_ref.hpp> at line 39
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.
&this->url() == &other.url()
Constant.
Throws nothing.
Assignment
params_ref&
operator=(
const params_ref& other);
Declared in file <src/params_ref.cpp> at line 32
The previous contents of this are replaced by the contents of `other.
All iterators are invalidated.
The strings referenced by `other` must not come from the underlying url, or else the behavior is undefined.
this->assign( other.begin(), other.end() );
Linear in `other.buffer().size()`.
Strong guarantee. Calls to allocate may throw.
Assignment
params_ref&
operator=(
initializer_list<param_view> init);
Declared in file <boost/url/impl/params_ref.hpp> at line 48
After assignment, the previous contents of the query parameters are replaced by the contents of the initializer-list.
None of character buffers referenced by `init` may overlap the character buffer of the underlying url, or else the behavior is undefined.
this->assign( init );
Linear in `init.size()`.
Strong guarantee. Calls to allocate may throw.
Conversion
params_view
operator params_view() noexcept;
Declared in file <src/params_ref.cpp> at line 42
Return the referenced url
This function returns the url referenced by the view.
url u( "?key=value" );
assert( &u.segments().url() == &u );
Throws nothing.
Clear the contents of the container
void
clear() noexcept;
Declared in file <boost/url/impl/params_ref.hpp> at line 65
All iterators are invalidated.
this->url().remove_query();
this->empty() == true && this->url().has_query() == false
Constant.
Throws nothing.
Assign elements
void
assign(
initializer_list<param_view> init);
Declared in file <src/params_ref.cpp> at line 55
This function replaces the entire contents of the view with the params in the initializer-list .
All iterators are invalidated.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
url u;
u.params().assign( {{ "first", "John" }, { "last", "Doe" }} );
Linear in `init.size()`.
Strong guarantee. Calls to allocate may throw.
Assign elements
template<
class FwdIt>
void
assign(
FwdIt first,
FwdIt last);
Declared in file <boost/url/impl/params_ref.hpp> at line 76
This function replaces the entire contents of the view with the params in the range.
All iterators are invalidated.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_view >::value == true
Linear in the size of the range.
Strong guarantee. Calls to allocate may throw.
Append elements
iterator
append(
const param_view& p);
Declared in file <boost/url/impl/params_ref.hpp> at line 97
This function appends a param to the view.
The `end()` iterator is invalidated.
url u;
u.params().append( { "first", "John" } );
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw.
Append elements
iterator
append(
initializer_list<param_view> init);
Declared in file <boost/url/impl/params_ref.hpp> at line 107
This function appends the params in an initializer-list to the view.
The `end()` iterator is invalidated.
url u;
u.params().append({ { "first", "John" }, { "last", "Doe" } });
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw.
Append elements
template<
class FwdIt>
iterator
append(
FwdIt first,
FwdIt last);
Declared in file <boost/url/impl/params_ref.hpp> at line 119
This function appends a range of params to the view.
The `end()` iterator is invalidated.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_view >::value == true
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw.
Insert elements
iterator
insert(
iterator before,
const param_view& p);
Declared in file <src/params_ref.cpp> at line 64
This function inserts a param before the specified position.
All iterators that are equal to `before` or come after are invalidated.
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw.
Insert elements
iterator
insert(
iterator before,
initializer_list<param_view> init);
Declared in file <src/params_ref.cpp> at line 79
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.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw.
Insert elements
Declared in file <boost/url/impl/params_ref.hpp> at line 141
This function inserts a range of params before the specified position.
All iterators that are equal to `before` or come after are invalidated.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_view >::value == true
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw.
Erase elements
This function removes an element from the container.
All iterators that are equal to `pos` or come after are invalidated.
url u( "?first=John&last=Doe" );
params_ref::iterator it = u.params().erase( u.params().begin() );
assert( u.encoded_query() == "last=Doe" );
Linear in `this->url().encoded_query().size()`.
Throws nothing.
Erase elements
Declared in file <src/params_ref.cpp> at line 225
This function removes a range of elements from the container.
All iterators that are equal to `first` or come after are invalidated.
Linear in `this->url().encoded_query().size()`.
Throws nothing.
Erase elements
size_t
erase(
string_view key,
ignore_case_param ic) noexcept;
Declared in file <src/params_ref.cpp> at line 93
All iterators are invalidated.
this->count( key, ic ) == 0
Linear in `this->url().encoded_query().size()`.
Throws nothing.
Replace elements
iterator
replace(
iterator pos,
const param_view& p);
Declared in file <src/params_ref.cpp> at line 124
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.
url u( "?first=John&last=Doe" );
u.params().replace( u.params().begin(), { "title", "Mr" });
assert( u.encoded_query() == "title=Mr&last=Doe" );
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw.
Replace elements
iterator
replace(
iterator from,
iterator to,
initializer_list<param_view> init);
Declared in file <src/params_ref.cpp> at line 139
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.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw.
Replace elements
Declared in file <boost/url/impl/params_ref.hpp> at line 170
This function replaces a range of elements with a range of params.
All iterators that are equal to `from` or come after are invalidated.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_view >::value == true
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw.
Remove the value on an element
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.
url u( "?first=John&last=Doe" );
u.params().unset( u.params().begin() );
assert( u.encoded_query() == "first&last=Doe" );
Linear in `this->url().encoded_query().size()`.
Throws nothing.
Set a value
Declared in file <src/params_ref.cpp> at line 172
This function replaces the value of an element at the specified position.
All iterators that are equal to `pos` or come after are invalidated.
url u( "?id=42&id=69" );
u.params().set( u.params().begin(), "none" );
assert( u.encoded_query() == "id=none&id=69" );
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw.
Set a value
iterator
set(
string_view key,
string_view value,
ignore_case_param ic);
Declared in file <src/params_ref.cpp> at line 189
This function performs one of two actions depending on the value of `this->contains( key, ic )`.
All iterators are invalidated.
url u( "?id=42&id=69" );
u.params().set( "id", "none" );
assert( u.params().count( "id" ) == 1 );
this->count( key, ic ) == 1 && this->find( key, ic )->value == value
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw.
Common functionality for containers
class params_base ;
Declared in file <boost/url/params_base.hpp> at line 39
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
const_iterator | iterator |
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | An unsigned integer type to represent sizes. |
difference_type | A signed integer type used to represent differences. |
Name | Description |
---|---|
buffer | Return the referenced character buffer. |
empty | Return true if there are no params |
size | Return the number of params |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
contains | Return true if a matching key exists |
count | Return the number of matching keys |
find | Find a matching key |
find | Find a matching key |
find_last | Find a matching key |
find_last | Find a matching key |
This base class is used by the library to provide common member functions for containers. This cannot be instantiated directly; Instead, use one of the containers or functions:
class iterator ;
Declared in file <boost/url/impl/params_base.hpp> at line 22
Name | Description |
---|---|
value_type | |
reference | |
pointer | |
difference_type | |
iterator_category |
Name | Description |
---|---|
iterator | |
iterator | |
operator= | |
operator++ | |
operator++ | |
operator-- | |
operator-- | |
operator* | |
operator-> | |
operator== | |
operator!= |
using value_type = params_base::value_type ;
Declared in file <boost/url/impl/params_base.hpp> at line 48
using reference = params_base::reference ;
Declared in file <boost/url/impl/params_base.hpp> at line 49
using difference_type = params_base::difference_type ;
Declared in file <boost/url/impl/params_base.hpp> at line 51
using iterator_category = bidirectional_iterator_tag ;
Declared in file <boost/url/impl/params_base.hpp> at line 53
void
iterator();
Declared in file <boost/url/impl/params_base.hpp> at line 56
void
iterator(
const iterator&);
Declared in file <boost/url/impl/params_base.hpp> at line 57
iterator&
operator++() noexcept;
Declared in file <boost/url/impl/params_base.hpp> at line 61
iterator
operator++(
int) noexcept;
Declared in file <boost/url/impl/params_base.hpp> at line 68
iterator&
operator--() noexcept;
Declared in file <boost/url/impl/params_base.hpp> at line 76
iterator
operator--(
int) noexcept;
Declared in file <boost/url/impl/params_base.hpp> at line 83
pointer
operator->() = delete;
Declared in file <boost/url/impl/params_base.hpp> at line 95
bool
operator==(
const iterator& other) noexcept;
Declared in file <boost/url/impl/params_base.hpp> at line 97
bool
operator!=(
const iterator& other) noexcept;
Declared in file <boost/url/impl/params_base.hpp> at line 104
iterator
The value type
Values of this type represent parameters whose strings retain unique ownership by making a copy.
params_view::value_type qp( *url_view( "?first=John&last=Doe" ).params().find( "first" ) );
The reference type
This is the type of value returned when iterators of the view are dereferenced.
The reference type
This is the type of value returned when iterators of the view are dereferenced.
An unsigned integer type to represent sizes.
using size_type = size_t ;
Declared in file <boost/url/params_base.hpp> at line 128
A signed integer type used to represent differences.
using difference_type = ptrdiff_t ;
Declared in file <boost/url/params_base.hpp> at line 132
Return the maximum number of characters possible
static
size_t
max_size() noexcept;
Declared in file <boost/url/params_base.hpp> at line 149
This represents the largest number of characters that are possible in a path, not including any null terminator.
Throws nothing.
Return the referenced character buffer.
This function returns the character buffer referenced by the view. The returned string may contain percent escapes.
assert( url_view( "?first=John&last=Doe" ).params().buffer() == "?first=John&last=Doe" );
Constant.
Throws nothing.
Return true if there are no params
bool
empty() noexcept;
Declared in file <src/params_base.cpp> at line 158
assert( ! url_view( "?key=value" ).params().empty() );
Constant.
Throws nothing.
Return the number of params
size_t
size() noexcept;
Declared in file <src/params_base.cpp> at line 165
assert( url_view( "?key=value").params().size() == 1 );
Constant.
Throws nothing.
Return an iterator to the beginning
Linear in the size of the first param.
Throws nothing.
Return an iterator to the end
Constant.
Throws nothing.
Return true if a matching key exists
bool
contains(
string_view key,
ignore_case_param ic) noexcept;
Declared in file <src/params_base.cpp> at line 78
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.
assert( url_view( "?first=John&last=Doe" ).params().contains( "first" ) );
Linear in `this->buffer().size()`.
Throws nothing.
Return the number of matching keys
size_t
count(
string_view key,
ignore_case_param ic) noexcept;
Declared in file <src/params_base.cpp> at line 190
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.
assert( url_view( "?first=John&last=Doe" ).params().count( "first" ) == 1 );
Linear in `this->buffer().size()`.
Throws nothing.
Find a matching key
iterator
find(
string_view key,
ignore_case_param ic) noexcept;
Declared in file <src/params_base.cpp> at line 88
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.
assert( (*url_view( "?first=John&last=Doe" ).params().find( "First", ignore_case )).value == "John" );
return this->find( this->begin(), key, ic );
Linear in `this->buffer().size()`.
Find a matching key
iterator
find(
iterator from,
string_view key,
ignore_case_param ic) noexcept;
Declared in file <src/params_base.cpp> at line 101
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.
url_view u( "?First=John&Last=Doe" );
assert( u.params().find( "first" ) != u.params().find( "first", ignore_case ) );
Linear in `this->buffer().size()`.
Find a matching key
iterator
find_last(
string_view key,
ignore_case_param ic) noexcept;
Declared in file <src/params_base.cpp> at line 115
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.
assert( (*url_view( "?first=John&last=Doe" ).params().find_last( "last" )).value == "Doe" );
Linear in `this->buffer().size()`.
Find a matching key
iterator
find_last(
iterator before,
string_view key,
ignore_case_param ic) noexcept;
Declared in file <src/params_base.cpp> at line 128
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.
url_view u( "?First=John&Last=Doe" );
assert( u.params().find_last( "last" ) != u.params().find_last( "last", ignore_case ) );
Linear in `this->buffer().size()`.
Format to an output stream
ostream&
operator<<(
ostream& os,
const params_base& qp);
Declared in file <src/params_base.cpp> at line 276
Any percent-escapes are emitted as-is; no decoding is performed.
Linear in `ps.buffer().size()`.
return os << ps.buffer();
A view representing query parameters in a URL
class params_view
: public params_base;
Declared in file <boost/url/params_view.hpp> at line 47
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
const_iterator | iterator |
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | An unsigned integer type to represent sizes. |
difference_type | A signed integer type used to represent differences. |
Name | Description |
---|---|
buffer | Return the referenced character buffer. |
empty | Return true if there are no params |
size | Return the number of params |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
contains | Return true if a matching key exists |
count | Return the number of matching keys |
find | Find a matching key |
find | Find a matching key |
find_last | Find a matching key |
find_last | Find a matching key |
params_view | Constructor |
params_view | Constructor |
params_view | Constructor |
params_view | Constructor |
params_view | Constructor |
operator= | Assignment |
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.
url_view u( "?first=John&last=Doe" );
params_view p = u.params();
Percent escapes in strings returned when dereferencing iterators are automatically decoded.
Changes to the underlying character buffer can invalidate iterators which reference it.
Constructor
void
params_view();
Declared in file <boost/url/params_view.hpp> at line 80
Default-constructed params have zero elements.
params_view qp;
return params_view( "" );
Constant.
Throws nothing.
Constructor
void
params_view(
const params_view& other);
Declared in file <boost/url/params_view.hpp> at line 103
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.
this->buffer().data() == other.buffer().data()
Constant.
Throws nothing
Constructor
void
params_view(
const params_view& other,
encoding_opts opt) noexcept;
Declared in file <src/params_view.cpp> at line 31
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.
this->buffer().data() == other.buffer().data()
Constant.
Throws nothing
Constructor
void
params_view(
string_view s);
Declared in file <src/params_view.cpp> at line 39
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.
params_view qp( "first=John&last=Doe" );
return parse_query( s ).value();
this->buffer().data() == s.data()
Linear in `s`.
Exceptions thrown on invalid input.
query-params = [ query-param ] *( "&" query-param )
query-param = key [ "=" value ]
Constructor
void
params_view(
string_view s,
encoding_opts opt);
Declared in file <src/params_view.cpp> at line 49
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.
encoding_opts opt;
opt.space_as_plus = true;
params_view qp( "name=John+Doe", opt );
return params_view(parse_query( s ).value(), opt);
this->buffer().data() == s.data()
Linear in `s`.
Exceptions thrown on invalid input.
query-params = [ query-param ] *( "&" query-param )
query-param = key [ "=" value ]
Assignment
params_view&
operator=(
const params_view&);
Declared in file <boost/url/params_view.hpp> at line 278
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.
this->buffer().data() == other.buffer().data()
Constant
Throws nothing
A view representing query parameters in a URL
class params_encoded_view
: public params_encoded_base;
Declared in file <boost/url/params_encoded_view.hpp> at line 54
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
const_iterator | iterator |
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | An unsigned integer type to represent sizes. |
difference_type | A signed integer type used to represent differences. |
Name | Description |
---|---|
buffer | Return the query corresponding to these params |
empty | Return true if there are no params |
size | Return the number of params |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
contains | Return true if a matching key exists |
count | Return the number of matching keys |
find | Find a matching key |
find | Find a matching key |
find_last | Find a matching key |
find_last | Find a matching key |
params_encoded_view | Constructor |
params_encoded_view | Constructor |
params_encoded_view | Constructor |
operator= | Assignment |
operator params_view | Conversion |
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.
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.
Changes to the underlying character buffer can invalidate iterators which reference it.
Constructor
void
params_encoded_view();
Declared in file <boost/url/params_encoded_view.hpp> at line 87
Default-constructed params have zero elements.
params_encoded_view qp;
return params_encoded_view( "" );
Constant.
Throws nothing.
Constructor
void
params_encoded_view(
const params_encoded_view& other);
Declared in file <boost/url/params_encoded_view.hpp> at line 110
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.
this->buffer().data() == other.buffer().data()
Constant.
Throws nothing
Constructor
void
params_encoded_view(
string_view s);
Declared in file <src/params_encoded_view.cpp> at line 28
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.
params_encoded_view qp( "first=John&last=Doe" );
return parse_query( s ).value();
this->buffer().data() == s.data()
Linear in `s`.
Exceptions thrown on invalid input.
query-params = [ query-param ] *( "&" query-param )
query-param = key [ "=" value ]
Assignment
params_encoded_view&
operator=(
const params_encoded_view&);
Declared in file <boost/url/params_encoded_view.hpp> at line 190
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.
this->buffer().data() == other.buffer().data()
Constant
Throws nothing
Conversion
params_view
operator params_view() noexcept;
Declared in file <src/params_encoded_view.cpp> at line 37
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.
params_view qp = parse_path( "/path/to/file.txt" ).value();
params_view( *this ).buffer().data() == this->buffer().data()
Constant
Throws nothing
Parse a string and return an encoded params view
result<params_encoded_view>
parse_query(
string_view s) noexcept;
Declared in file <src/parse_query.cpp> at line 24
This function parses the string and returns the corresponding params object if the string is valid, otherwise returns an error.
No-throw guarantee.
Common functionality for containers
class url_base
: public url_view_base;
Declared in file <boost/url/url_base.hpp> at line 63
Name | Description |
---|---|
digest | |
size | Return the number of characters in the url |
empty | Return true if the url is empty |
data | Return a pointer to the url's character buffer |
buffer | Return the url string |
operator string_view | Return the URL as a core::string_view |
persist | Return a shared, persistent copy of the url |
has_scheme | Return true a scheme is present |
scheme | Return the scheme |
scheme_id | Return the scheme |
has_authority | Return true if an authority is present |
authority | Return the authority |
encoded_authority | Return the authority. |
has_userinfo | Return true if a userinfo is present |
has_password | Return true if a password is present |
userinfo | Return the userinfo |
encoded_userinfo | Return the userinfo |
user | Return the user |
encoded_user | Return the user |
password | Return the password |
encoded_password | Return the password |
host_type | Return the host type |
host | Return the host |
encoded_host | Return the host |
host_address | Return the host |
encoded_host_address | Return the host |
host_ipv4_address | Return the host IPv4 address |
host_ipv6_address | Return the host IPv6 address |
host_ipvfuture | Return the host IPvFuture address |
host_name | Return the host name |
encoded_host_name | Return the host name |
zone_id | Return the IPv6 Zone ID |
encoded_zone_id | Return the IPv6 Zone ID |
has_port | Return true if a port is present |
port | Return the port |
port_number | Return the port |
is_path_absolute | Return true if the path is absolute |
path | Return the path |
encoded_path | Return the path |
segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
has_query | Return true if a query is present |
query | Return the query |
encoded_query | Return the query |
params | Return the query as a container of parameters |
params | |
encoded_params | Return the query as a container of parameters |
has_fragment | Return true if a fragment is present |
fragment | Return the fragment |
encoded_fragment | Return the fragment |
encoded_host_and_port | Return the host and port |
encoded_origin | Return the origin |
encoded_resource | Return the resource |
encoded_target | Return the target |
compare | Return the result of comparing this with another url |
c_str | Return the url as a null-terminated string |
capacity | Return the number of characters that can be stored without reallocating |
clear | Clear the contents while preserving the capacity |
reserve | Adjust the capacity without changing the size |
set_scheme | Set the scheme |
set_scheme_id | |
remove_scheme | Remove the scheme |
set_encoded_authority | Set the authority |
remove_authority | Remove the authority |
set_userinfo | Set the userinfo |
set_encoded_userinfo | Set the userinfo. |
remove_userinfo | Remove the userinfo |
set_user | Set the user |
set_encoded_user | Set the user |
set_password | Set the password. |
set_encoded_password | Set the password. |
remove_password | Remove the password |
set_host | Set the host |
set_encoded_host | Set the host |
set_host_address | Set the host to an address |
set_encoded_host_address | Set the host to an address |
set_host_ipv4 | Set the host to an address |
set_host_ipv6 | Set the host to an address |
set_host_ipvfuture | Set the host to an address |
set_host_name | Set the host to a name |
set_encoded_host_name | Set the host to a name |
set_port_number | Set the port |
set_port | Set the port |
remove_port | Remove the port |
set_path_absolute | Set if the path is absolute |
set_path | Set the path. |
set_encoded_path | Set the path. |
segments | Return the path as a container of segments |
segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
set_query | Set the query |
set_encoded_query | Set the query |
params | Return the query as a container of parameters |
params | url_view_base::params |
params | Return the query as a container of parameters |
encoded_params | Return the query as a container of parameters |
encoded_params | Return the query as a container of parameters |
set_params | Set the query params |
set_encoded_params | Set the query params |
remove_query | Remove the query |
remove_fragment | Remove the fragment |
set_fragment | Set the fragment. |
set_encoded_fragment | Set the fragment. |
remove_origin | Remove the origin component |
normalize | Normalize the URL components |
normalize_scheme | Normalize the URL scheme |
normalize_authority | Normalize the URL authority |
normalize_path | Normalize the URL path |
normalize_query | Normalize the URL query |
normalize_fragment | Normalize the URL fragment |
resolve | Resolve a URL reference against this base URL |
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:
Return the url as a null-terminated string
const char*
c_str() noexcept;
Declared in file <boost/url/url_base.hpp> at line 128
This function returns a pointer to a null terminated string representing the url, which may contain percent escapes.
assert( std::strlen( url( "http://www.example.com" ).c_str() ) == 22 );
Constant.
Throws nothing.
Return the number of characters that can be stored without reallocating
size_t
capacity() noexcept;
Declared in file <boost/url/url_base.hpp> at line 145
This does not include the null terminator, which is always present.
Constant.
Throws nothing.
Clear the contents while preserving the capacity
void
clear() noexcept;
Declared in file <boost/url/url_base.hpp> at line 164
this->empty() == true
Constant.
No-throw guarantee.
Adjust the capacity without changing the size
void
reserve(
size_t n);
Declared in file <boost/url/url_base.hpp> at line 186
This function adjusts the capacity of the container in characters, without affecting the current contents. Has no effect if `n < = this->capacity()`.
Strong guarantee. Calls to allocate may throw.
Set the scheme
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.
assert( url( "http://www.example.com" ).set_scheme( "https" ).scheme_id() == scheme::https );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
Remove the scheme
This function removes the scheme if it is present.
assert( url("http://www.example.com/index.htm" ).remove_scheme().buffer() == "//www.example.com/index.htm" );
this->has_scheme() == false && this->scheme_id() == scheme::none
Linear in `this->size()`.
Throws nothing.
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
Set the authority
url_base&
set_encoded_authority(
pct_string_view s);
Declared in file <src/url_base.cpp> at line 282
This function sets the authority to the specified string. The string may contain percent-escapes.
assert( url().set_encoded_authority( "My%20Computer" ).has_authority() );
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
authority = [ userinfo "@" ] host [ ":" port ]
userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
host = IP-literal / IPv4address / reg-name
port = *DIGIT
Remove the authority
This function removes the authority, which includes the userinfo, host, and a port if present.
assert( url( "http://example.com/echo.cgi" ).remove_authority().buffer() == "http:/echo.cgi" );
this->has_authority() == false && this->has_userinfo() == false && this->has_port() == false
Linear in `this->size()`.
Throws nothing.
authority = [ userinfo "@" ] host [ ":" port ]
userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
host = IP-literal / IPv4address / reg-name
port = *DIGIT
Set the userinfo
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:
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url( "http://example.com" ).set_userinfo( "user:pass" ).encoded_user() == "user" );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the userinfo.
url_base&
set_encoded_userinfo(
pct_string_view s);
Declared in file <src/url_base.cpp> at line 388
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:
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Remove the userinfo
This function removes the userinfo if present, without removing any authority.
assert( url( "http://user@example.com" ).remove_userinfo().has_userinfo() == false );
this->has_userinfo() == false && this->encoded_userinfo().empty == true
Linear in `this->size()`.
Throws nothing.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the user
This function sets the user part of the userinfo to the string. Any special or reserved characters in the string are automatically percent-encoded.
assert( url().set_user("john doe").encoded_userinfo() == "john%20doe" );
this->has_authority() == true && this->has_userinfo() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the user
url_base&
set_encoded_user(
pct_string_view s);
Declared in file <src/url_base.cpp> at line 486
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.
assert( url().set_encoded_user("john%20doe").userinfo() == "john doe" );
this->has_authority() == true && this->has_userinfo() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the password.
This function sets the password in the userinfo to the string. Reserved characters in the string are percent-escaped in the result.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url("http://user@example.com").set_password( "pass" ).encoded_userinfo() == "user:pass" );
this->has_password() == true && this->password() == s
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the password.
url_base&
set_encoded_password(
pct_string_view s);
Declared in file <src/url_base.cpp> at line 531
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.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url("http://user@example.com").set_encoded_password( "pass" ).encoded_userinfo() == "user:pass" );
this->has_password() == true
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Remove the password
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.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url( "http://user:pass@example.com" ).remove_password().authority().buffer() == "user@example.com" );
this->has_password() == false && this->encoded_password().empty() == true
Linear in `this->size()`.
Throws nothing.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the host
Depending on the contents of the passed string, this function sets the host:
In all cases, when this function returns, the URL contains an authority.
assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );
this->has_authority() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Set the host
url_base&
set_encoded_host(
pct_string_view s);
Declared in file <src/url_base.cpp> at line 661
Depending on the contents of the passed string, this function sets the host:
In all cases, when this function returns, the URL contains an authority.
assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );
this->has_authority() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Set the host to an address
url_base&
set_host_address(
string_view s);
Declared in file <src/url_base.cpp> at line 715
Depending on the contents of the passed string, this function sets the host:
In all cases, when this function returns, the URL contains an authority.
assert( url( "http://www.example.com" ).set_host_address( "127.0.0.1" ).buffer() == "http://127.0.0.1" );
this->has_authority() == true
Linear in `s.size()`.
Strong guarantee. Calls to allocate may throw.
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 / "-" / ".")
Set the host to an address
url_base&
set_encoded_host_address(
pct_string_view s);
Declared in file <src/url_base.cpp> at line 759
Depending on the contents of the passed string, this function sets the host:
In all cases, when this function returns, the URL contains an authority.
assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );
this->has_authority() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
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 / "-" / ".")
Set the host to an address
url_base&
set_host_ipv4(
const ipv4_address& addr);
Declared in file <src/url_base.cpp> at line 805
The host is set to the specified IPv4 address. The host type is host_type::ipv4.
assert( url("http://www.example.com").set_host_ipv4( ipv4_address( "127.0.0.1" ) ).buffer() == "http://127.0.0.1" );
Linear in `this->size()`.
this->has_authority() == true && this->host_ipv4_address() == addr && this->host_type() == host_type::ipv4
Strong guarantee. Calls to allocate may throw.
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
Set the host to an address
url_base&
set_host_ipv6(
const ipv6_address& addr);
Declared in file <src/url_base.cpp> at line 825
The host is set to the specified IPv6 address. The host type is host_type::ipv6.
assert( url().set_host_ipv6( ipv6_address( "1::6:c0a8:1" ) ).authority().buffer() == "[1::6:c0a8:1]" );
this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::ipv6
Linear in `this->size()`.
Strong guarantee. Calls to allocate may throw.
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
Set the host to an address
url_base&
set_host_ipvfuture(
string_view s);
Declared in file <src/url_base.cpp> at line 850
The host is set to the specified IPvFuture string. The host type is host_type::ipvfuture.
assert( url().set_host_ipvfuture( "v42.bis" ).buffer() == "//[v42.bis]" );
Linear in `this->size() + s.size()`.
this->has_authority() == true && this->host_ipvfuture) == s && this->host_type() == host_type::ipvfuture
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
Set the host to a name
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.
assert( url( "http://www.example.com/index.htm").set_host_name( "localhost" ).host_address() == "localhost" );
this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name
Strong guarantee. Calls to allocate may throw.
reg-name = *( unreserved / pct-encoded / "-" / ".")
Set the host to a name
url_base&
set_encoded_host_name(
pct_string_view s);
Declared in file <src/url_base.cpp> at line 904
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.
assert( url( "http://www.example.com/index.htm").set_encoded_host_name( "localhost" ).host_address() == "localhost" );
this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
reg-name = *( unreserved / pct-encoded / "-" / ".")
Set the port
The port is set to the specified integer.
assert( url( "http://www.example.com" ).set_port_number( 8080 ).authority().buffer() == "www.example.com:8080" );
this->has_authority() == true && this->has_port() == true && this->port_number() == n
Linear in `this->size()`.
Strong guarantee. Calls to allocate may throw.
authority = [ userinfo "@" ] host [ ":" port ]
port = *DIGIT
Set the port
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.
assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" );
this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n)
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
port = *DIGIT
Remove the port
If a port exists, it is removed. The rest of the authority is unchanged.
assert( url( "http://www.example.com:80" ).remove_port().authority().buffer() == "www.example.com" );
this->has_port() == false && this->port_number() == 0 && this->port() == ""
Linear in `this->size()`.
Throws nothing.
authority = [ userinfo "@" ] host [ ":" port ]
port = *DIGIT
Set if the path is absolute
bool
set_path_absolute(
bool absolute);
Declared in file <src/url_base.cpp> at line 1011
This function adjusts the path to make it absolute or not, depending on the parameter.
If an authority is present, the path is always absolute. In this case, the function has no effect.
url u( "path/to/file.txt" );
assert( u.set_path_absolute( true ) );
assert( u.buffer() == "/path/to/file.txt" );
this->is_path_absolute() == true && this->encoded_path().front() == '/'
Linear in `this->size()`.
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
Set the path.
This function sets the path to the string, which may be empty. Reserved characters in the string are percent-escaped in the result.
The library may adjust the final result to ensure that no other parts of the url is semantically affected.
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.
url u( "http://www.example.com" );
u.set_path( "path/to/file.txt" );
assert( u.path() == "/path/to/file.txt" );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
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
Set the path.
url_base&
set_encoded_path(
pct_string_view s);
Declared in file <src/url_base.cpp> at line 1209
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.
The library may adjust the final result to ensure that no other parts of the url is semantically affected.
url u( "http://www.example.com" );
u.set_encoded_path( "path/to/file.txt" );
assert( u.encoded_path() == "/path/to/file.txt" );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
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
Return the path as a container of segments
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.
url u( "http://example.com/path/to/file.txt" );
segments sv = u.segments();
Constant.
Throws nothing.
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
Return the path as a container of segments
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.
segments_view sv = url_view( "/path/to/file.txt" ).segments();
Constant.
Throws nothing.
path = [ "/" ] segment *( "/" segment )
Return the path as a container of segments
segments_encoded_ref
encoded_segments() noexcept;
Declared in file <src/url_base.cpp> at line 1332
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.
url u( "http://example.com/path/to/file.txt" );
segments_encoded_ref sv = u.encoded_segments();
Constant.
Throws nothing.
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
Return the path as a container of segments
segments_encoded_view
encoded_segments() noexcept;
Declared in file <boost/url/url_base.hpp> at line 1916
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.
segments_encoded_view sv = url_view( "/path/to/file.txt" ).encoded_segments();
Constant.
Throws nothing.
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
Set the query
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.
assert( url( "http://example.com" ).set_query( "id=42" ).query() == "id=42" );
this->has_query() == true && this->query() == s
Strong guarantee. Calls to allocate may throw.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Set the query
url_base&
set_encoded_query(
pct_string_view s);
Declared in file <src/url_base.cpp> at line 1357
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.
assert( url( "http://example.com" ).set_encoded_query( "id=42" ).encoded_query() == "id=42" );
this->has_query() == true && this->query() == decode_view( s );
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Return the query as a container of parameters
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.
params_ref pv = url( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).params();
Constant.
Throws nothing.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
url_view_base::params
Return the query as a container of parameters
params_ref
params(
encoding_opts opt) noexcept;
Declared in file <src/url_base.cpp> at line 1424
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.
encoding_opts opt;
opt.space_as_plus = true;
params_ref pv = url( "/sql?id=42&name=jane+doe&page+size=20" ).params(opt);
Constant.
Throws nothing.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Return the query as a container of parameters
params_encoded_view
encoded_params() noexcept;
Declared in file <boost/url/url_base.hpp> at line 2140
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.
params_encoded_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params();
Constant.
Throws nothing.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Return the query as a container of parameters
params_encoded_ref
encoded_params() noexcept;
Declared in file <src/url_base.cpp> at line 1431
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.
params_encoded_ref pv = url( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params();
Constant.
Throws nothing.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Set the query params
url_base&
set_params(
initializer_list<param_view> ps) noexcept;
Declared in file <src/url_base.cpp> at line 1438
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.
assert( url( "http://example.com" ).set_params( {"id", "42"} ).query() == "id=42" );
this->has_query() == true
Strong guarantee. Calls to allocate may throw.
Linear.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Set the query params
url_base&
set_encoded_params(
initializer_list<param_pct_view> ps) noexcept;
Declared in file <src/url_base.cpp> at line 1446
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.
assert( url( "http://example.com" ).set_encoded_params( {"id", "42"} ).encoded_query() == "id=42" );
this->has_query() == true
Linear.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Remove the query
If a query is present, it is removed. An empty query is distinct from having no query.
assert( url( "http://www.example.com?id=42" ).remove_query().buffer() == "http://www.example.com" );
this->has_query() == false && this->params().empty()
Throws nothing.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Remove the fragment
This function removes the fragment. An empty fragment is distinct from having no fragment.
assert( url( "?first=john&last=doe#anchor" ).remove_fragment().buffer() == "?first=john&last=doe" );
this->has_fragment() == false && this->encoded_fragment() == ""
Constant.
Throws nothing.
fragment = *( pchar / "/" / "?" )
Set the fragment.
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.
assert( url("?first=john&last=doe" ).set_encoded_fragment( "john doe" ).encoded_fragment() == "john%20doe" );
this->has_fragment() == true && this->fragment() == s
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
fragment = *( pchar / "/" / "?" )
Set the fragment.
url_base&
set_encoded_fragment(
pct_string_view s);
Declared in file <src/url_base.cpp> at line 1504
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.
assert( url("?first=john&last=doe" ).set_encoded_fragment( "john%2Ddoe" ).fragment() == "john-doe" );
this->has_fragment() == true && this->fragment() == decode_view( s )
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
fragment = *( pchar / "/" / "?" )
Remove the origin component
This function removes the origin, which consists of the scheme and authority.
assert( url( "http://www.example.com/index.htm" ).remove_origin().buffer() == "/index.htm" );
this->scheme_id() == scheme::none && this->has_authority() == false
Linear in `this->size()`.
Throws nothing.
Normalize the URL components
Applies Syntax-based normalization to all components of the URL.
Strong guarantee. Calls to allocate may throw.
Normalize the URL scheme
Applies Syntax-based normalization to the URL scheme.
The scheme is normalized to lowercase.
Strong guarantee. Calls to allocate may throw.
Normalize the URL authority
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.
Strong guarantee. Calls to allocate may throw.
Normalize the URL path
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.
Strong guarantee. Calls to allocate may throw.
Normalize the URL query
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.
Strong guarantee. Calls to allocate may throw.
Normalize the URL fragment
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.
Strong guarantee. Calls to allocate may throw.
Resolve a URL reference against this base URL
result<void>
resolve(
const url_view_base& ref);
Declared in file <src/url_base.cpp> at line 1538
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:
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.
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" );
absolute-URI = scheme ":" hier-part [ "?" query ]
Basic guarantee. Calls to allocate may throw.
void
~op_t();
Declared in file <src/url_base.cpp> at line 55
void
op_t(
url_base& impl_,
string_view* s0_,
string_view* s1_) noexcept;
Declared in file <src/url_base.cpp> at line 64
void
move(
char* dest,
const char* src,
size_t n) noexcept;
Declared in file <src/url_base.cpp> at line 77
A view representing query parameters in a URL
class params_encoded_ref
: public params_encoded_base;
Declared in file <boost/url/params_encoded_ref.hpp> at line 73
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
const_iterator | iterator |
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | An unsigned integer type to represent sizes. |
difference_type | A signed integer type used to represent differences. |
Name | Description |
---|---|
buffer | Return the query corresponding to these params |
empty | Return true if there are no params |
size | Return the number of params |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
contains | Return true if a matching key exists |
count | Return the number of matching keys |
find | Find a matching key |
find | Find a matching key |
find_last | Find a matching key |
find_last | Find a matching key |
params_encoded_ref | Constructor |
operator= | Assignment |
operator= | Assignment |
operator params_encoded_view | Conversion |
url | Return the referenced url |
clear | Clear the contents of the container |
assign | Assign params |
assign | Assign params |
append | Append params |
append | Append params |
append | Append params |
insert | Insert params |
insert | Insert params |
insert | Insert params |
erase | Erase params |
erase | Erase params |
erase | Erase params |
replace | Replace params |
replace | Replace params |
replace | Replace params |
unset | Remove the value on an element |
set | Set a value |
set | Set a value |
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.
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.
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:
Constructor
void
params_encoded_ref(
const params_encoded_ref& other);
Declared in file <boost/url/params_encoded_ref.hpp> at line 112
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.
&this->url() == &other.url();
Constant.
Throws nothing.
Assignment
params_encoded_ref&
operator=(
const params_encoded_ref& other);
Declared in file <src/params_encoded_ref.cpp> at line 40
The previous contents of this are replaced by the contents of `other.
All iterators are invalidated.
The strings referenced by `other` must not come from the underlying url, or else the behavior is undefined.
this->assign( other.begin(), other.end() );
Linear in `other.buffer().size()`.
Strong guarantee. Calls to allocate may throw.
Assignment
params_encoded_ref&
operator=(
initializer_list<param_pct_view> init);
Declared in file <src/params_encoded_ref.cpp> at line 50
After assignment, the previous contents of the query parameters are replaced by the contents of the initializer-list.
All iterators are invalidated.
None of character buffers referenced by `init` may overlap the character buffer of the underlying url, or else the behavior is undefined.
this->assign( init.begin(), init.end() );
Linear in `init.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Conversion
params_encoded_view
operator params_encoded_view() noexcept;
Declared in file <src/params_encoded_ref.cpp> at line 59
Constant.
Throws nothing.
Return the referenced url
This function returns the url referenced by the view.
url u( "?key=value" );
assert( &u.encoded_params().url() == &u );
Throws nothing.
Clear the contents of the container
void
clear() noexcept;
Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 26
All iterators are invalidated.
this->url().remove_query();
this->empty() == true && this->url().has_query() == false
Constant.
Throws nothing.
Assign params
void
assign(
initializer_list<param_pct_view> init);
Declared in file <src/params_encoded_ref.cpp> at line 72
This function replaces the entire contents of the view with the params in the initializer-list .
All iterators are invalidated.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
url u;
u.encoded_params().assign({ { "first", "John" }, { "last", "Doe" } });
Linear in `init.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Assign params
template<
class FwdIt>
void
assign(
FwdIt first,
FwdIt last);
Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 35
This function replaces the entire contents of the view with the params in the range.
All iterators are invalidated.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_pct_view >::value == true
Linear in the size of the range.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Append params
iterator
append(
const param_pct_view& p);
Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 56
This function appends a param to the view.
The `end()` iterator is invalidated.
url u;
u.encoded_params().append( { "first", "John" } );
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Append params
iterator
append(
initializer_list<param_pct_view> init);
Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 66
This function appends the params in an initializer-list to the view.
The `end()` iterator is invalidated.
url u;
u.encoded_params().append({ {"first", "John"}, {"last", "Doe"} });
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Append params
template<
class FwdIt>
iterator
append(
FwdIt first,
FwdIt last);
Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 78
This function appends a range of params to the view.
The `end()` iterator is invalidated.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_pct_view >::value == true
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Insert params
iterator
insert(
iterator before,
const param_pct_view& p);
Declared in file <src/params_encoded_ref.cpp> at line 81
This function inserts a param before the specified position.
All iterators that are equal to `before` or come after are invalidated.
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Insert params
iterator
insert(
iterator before,
initializer_list<param_pct_view> init);
Declared in file <src/params_encoded_ref.cpp> at line 94
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.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Insert params
Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 101
This function inserts a range of params before the specified position.
All iterators that are equal to `before` or come after are invalidated.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_pct_view >::value == true
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Erase params
Declared in file <src/params_encoded_ref.cpp> at line 222
This function removes an element from the container.
All iterators that are equal to `pos` or come after are invalidated.
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" );
Linear in `this->url().encoded_query().size()`.
Throws nothing.
Erase params
Declared in file <src/params_encoded_ref.cpp> at line 233
This function removes a range of params from the container.
All iterators that are equal to `first` or come after are invalidated.
Linear in `this->url().encoded_query().size()`.
Throws nothing.
Erase params
size_t
erase(
pct_string_view key,
ignore_case_param ic) noexcept;
Declared in file <src/params_encoded_ref.cpp> at line 108
All iterators are invalidated.
this->count( key, ic ) == 0
Linear in `this->url().encoded_query().size()`.
Exceptions thrown on invalid input.
Replace params
iterator
replace(
iterator pos,
const param_pct_view& p);
Declared in file <src/params_encoded_ref.cpp> at line 139
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.
The strings passed in must not come from the element being replaced, or else the behavior is undefined.
url u( "?first=John&last=Doe" );
u.encoded_params().replace( u.encoded_params().begin(), { "title", "Mr" });
assert( u.encoded_query() == "title=Mr&last=Doe" );
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Replace params
iterator
replace(
iterator from,
iterator to,
initializer_list<param_pct_view> init);
Declared in file <src/params_encoded_ref.cpp> at line 152
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.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Replace params
Declared in file <boost/url/impl/params_encoded_ref.hpp> at line 130
This function replaces a range of params with a range of params.
All iterators that are equal to `from` or come after are invalidated.
The strings referenced by the inputs must not come from the underlying url, or else the behavior is undefined.
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, param_pct_view >::value == true
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Remove the value on an element
Declared in file <src/params_encoded_ref.cpp> at line 168
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.
url u( "?first=John&last=Doe" );
u.encoded_params().unset( u.encoded_params().begin() );
assert( u.encoded_query() == "first&last=Doe" );
Linear in `this->url().encoded_query().size()`.
Throws nothing.
Set a value
iterator
set(
iterator pos,
pct_string_view value);
Declared in file <src/params_encoded_ref.cpp> at line 182
This function replaces the value of an element at the specified position.
All iterators that are equal to `pos` or come after are invalidated.
The string passed in must not come from the element being replaced, or else the behavior is undefined.
url u( "?id=42&id=69" );
u.encoded_params().set( u.encoded_params().begin(), "none" );
assert( u.encoded_query() == "id=none&id=69" );
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Set a value
iterator
set(
pct_string_view key,
pct_string_view value,
ignore_case_param ic);
Declared in file <src/params_encoded_ref.cpp> at line 197
This function performs one of two actions depending on the value of `this->contains( key, ic )`.
All iterators are invalidated.
The strings passed in must not come from the element being replaced, or else the behavior is undefined.
url u( "?id=42&id=69" );
u.encoded_params().set( "id", "none" );
assert( u.encoded_params().count( "id" ) == 1 );
this->count( key, ic ) == 1 && this->find( key, ic )->value == value
Linear in `this->url().encoded_query().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
A view representing path segments in a URL
class segments_encoded_ref
: public segments_encoded_base;
Declared in file <boost/url/segments_encoded_ref.hpp> at line 88
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
const_iterator | iterator |
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | An unsigned integer type used to represent size. |
difference_type | A signed integer type used to represent differences. |
Name | Description |
---|---|
buffer | Return the referenced character buffer. |
is_absolute | Returns true if this references an absolute path. |
empty | Return true if there are no segments |
size | Return the number of segments |
front | Return the first segment |
back | Return the last segment |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
segments_encoded_ref | Constructor |
operator= | Assignment |
operator= | |
operator= | Assignment |
operator segments_encoded_view | Conversion |
url | Return the referenced url |
clear | Clear the contents of the container |
assign | Assign segments |
assign | Assign segments |
insert | Insert segments |
insert | Insert segments |
insert | Insert segments |
erase | Erase segments |
erase | Erase segments |
replace | Replace segments |
replace | Replace segments |
replace | Replace segments |
replace | Replace segments |
push_back | Append a segment |
pop_back | Remove the last segment |
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.
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.
Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some or all iterators:
Constructor
void
segments_encoded_ref(
const segments_encoded_ref& other);
Declared in file <boost/url/segments_encoded_ref.hpp> at line 127
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.
&this->url() == &other.url();
Constant.
Throws nothing.
Assignment
segments_encoded_ref&
operator=(
const segments_encoded_ref& other);
Declared in file <src/segments_encoded_ref.cpp> at line 44
The existing contents are replaced by a copy of the other segments.
All iterators are invalidated.
None of the character buffers referenced by `other` may overlap the buffer of the underlying url, or else the behavior is undefined.
this->assign( other.begin(), other.end() );
Linear in `other.buffer().size()`.
Strong guarantee. Calls to allocate may throw.
@ {
segments_encoded_ref&
operator=(
const segments_encoded_view& other);
Declared in file <src/segments_encoded_ref.cpp> at line 54
Assignment
segments_encoded_ref&
operator=(
initializer_list<pct_string_view> init);
Declared in file <src/segments_encoded_ref.cpp> at line 63
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.
url u;
u.encoded_segments() = {"path", "to", "file.txt"};
None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.
this->assign( init.begin(), init.end() );
Linear in `init.size() + this->url().encoded_query().size() + this->url().encoded_fragment().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Conversion
segments_encoded_view
operator segments_encoded_view() noexcept;
Declared in file <src/segments_encoded_ref.cpp> at line 37
Return the referenced url
url_base&
url() noexcept;
Declared in file <boost/url/segments_encoded_ref.hpp> at line 246
This function returns the url referenced by the view.
url u( "/path/to/file.txt" );
assert( &u.encoded_segments().url() == &u );
Throws nothing.
Clear the contents of the container
void
clear() noexcept;
Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 28
All iterators are invalidated.
this->url().set_encoded_path( "" );
this->empty() == true
Linear in `this->url().encoded_query().size() + this->url().encoded_fragment().size()`.
Throws nothing.
Assign segments
void
assign(
initializer_list<pct_string_view> init);
Declared in file <src/segments_encoded_ref.cpp> at line 78
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.
None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.
url u;
u.segments().assign( {"path", "to", "file.txt"} );
Linear in `init.size() + this->url().encoded_query().size() + this->url().encoded_fragment().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Assign segments
template<
class FwdIt>
void
assign(
FwdIt first,
FwdIt last);
Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 37
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.
None of the character buffers referenced by the range may overlap the character buffer of the underlying url, or else the behavior is undefined.
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, pct_string_view >::value == true
Linear in `std::distance( first, last ) + this->url().encoded_query().size() + this->url().encoded_fragment().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Insert segments
iterator
insert(
iterator before,
pct_string_view s);
Declared in file <src/segments_encoded_ref.cpp> at line 87
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.
Linear in `s.size() + this->url().encoded_resource().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Insert segments
iterator
insert(
iterator before,
initializer_list<pct_string_view> init);
Declared in file <src/segments_encoded_ref.cpp> at line 100
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.
None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.
url u( "/file.txt" );
u.encoded_segments().insert( u.encoded_segments().begin(), { "path", "to" } );
Linear in `init.size() + this->url().encoded_resource().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Insert segments
Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 62
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.
None of the character buffers referenced by the range may overlap the character buffer of the underlying url, or else the behavior is undefined.
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, pct_string_view >::value == true
Linear in `std::distance( first, last ) + this->url().encoded_resource().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Erase segments
Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 90
This function removes a segment.
All iterators that are equal to `pos` or come after are invalidated.
Linear in `this->url().encoded_resource().size()`.
Throws nothing.
Erase segments
Declared in file <src/segments_encoded_ref.cpp> at line 114
This function removes a range of segments from the container.
All iterators that are equal to `first` or come after are invalidated.
Linear in `this->url().encoded_resource().size()`.
Throws nothing.
Replace segments
iterator
replace(
iterator pos,
pct_string_view s);
Declared in file <src/segments_encoded_ref.cpp> at line 129
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.
Linear in `s.size() + this->url().encoded_resouce().size()`.
Strong guarantee. Calls to allocate may throw.
Replace segments
iterator
replace(
iterator from,
iterator to,
pct_string_view s);
Declared in file <src/segments_encoded_ref.cpp> at line 142
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.
Linear in `s.size() + this->url().encoded_resouce().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Replace segments
iterator
replace(
iterator from,
iterator to,
initializer_list<pct_string_view> init);
Declared in file <src/segments_encoded_ref.cpp> at line 156
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.
None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.
Linear in `init.size() + this->url().encoded_resouce().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Replace segments
Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 101
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.
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.
Linear in `std::distance( first, last ) + this->url().encoded_resouce().size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Append a segment
void
push_back(
pct_string_view s);
Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 131
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.
this->back() == s
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
Remove the last segment
void
pop_back() noexcept;
Declared in file <boost/url/impl/segments_encoded_ref.hpp> at line 140
This function removes the last segment from the container.
Iterators to the last segment as well as all end iterators are invalidated.
not this->empty()
Throws nothing.
A view representing path segments in a URL
class segments_ref
: public segments_base;
Declared in file <boost/url/segments_ref.hpp> at line 85
Name | Description |
---|---|
iterator |
Name | Description |
---|---|
const_iterator | iterator |
value_type | The value type |
reference | The reference type |
const_reference | The reference type |
size_type | An unsigned integer type used to represent size. |
difference_type | A signed integer type used to represent differences. |
Name | Description |
---|---|
buffer | Return the referenced character buffer. |
is_absolute | Returns true if this references an absolute path. |
empty | Return true if there are no segments |
size | Return the number of segments |
front | Return the first segment |
back | Return the last segment |
begin | Return an iterator to the beginning |
end | Return an iterator to the end |
segments_ref | Constructor |
operator= | Assignment |
operator= | |
operator= | Assignment |
operator segments_view | Conversion |
url | Return the referenced url |
clear | Clear the contents of the container |
assign | Assign segments |
assign | Assign segments |
insert | Insert segments |
insert | Insert segments |
insert | Insert segments |
erase | Erase segments |
erase | Erase segments |
replace | Replace segments |
replace | Replace segments |
replace | Replace segments |
replace | Replace segments |
push_back | Append a segment |
pop_back | Remove the last segment |
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.
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.
Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some or all iterators:
Constructor
void
segments_ref(
const segments_ref& other);
Declared in file <boost/url/segments_ref.hpp> at line 124
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.
&this->url() == &other.url();
Constant.
Throws nothing.
Assignment
segments_ref&
operator=(
const segments_ref& other);
Declared in file <src/segments_ref.cpp> at line 45
The existing contents are replaced by a copy of the other segments.
All iterators are invalidated.
None of the character buffers referenced by `other` may overlap the buffer of the underlying url, or else the behavior is undefined.
this->assign( other.begin(), other.end() );
Linear in `other.buffer().size()`.
Strong guarantee. Calls to allocate may throw.
@ {
segments_ref&
operator=(
const segments_view& other);
Declared in file <src/segments_ref.cpp> at line 54
Assignment
segments_ref&
operator=(
initializer_list<string_view> init);
Declared in file <src/segments_ref.cpp> at line 62
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.
url u;
u.segments() = { "path", "to", "file.txt" };
None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.
this->assign( init.begin(), init.end() );
Linear in `init.size() + this->url().encoded_query().size() + this->url().encoded_fragment().size()`.
Strong guarantee. Calls to allocate may throw.
Conversion
segments_view
operator segments_view() noexcept;
Declared in file <src/segments_ref.cpp> at line 38
Return the referenced url
This function returns the url referenced by the view.
url u( "/path/to/file.txt" );
assert( &u.segments().url() == &u );
Throws nothing.
Clear the contents of the container
void
clear() noexcept;
Declared in file <boost/url/impl/segments_ref.hpp> at line 28
All iterators are invalidated.
this->url().set_encoded_path( "" );
this->empty() == true
Linear in `this->url().encoded_query().size() + this->url().encoded_fragment().size()`.
Throws nothing.
Assign segments
void
assign(
initializer_list<string_view> init);
Declared in file <src/segments_ref.cpp> at line 77
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.
None of the character buffers referenced by `init` may overlap the character buffer of the underlying url, or else the behavior is undefined.
url u;
u.segments().assign( { "path", "to", "file.txt" } );
Linear in `init.size() + this->url().encoded_query().size() + this->url().encoded_fragment().size()`.
Strong guarantee. Calls to allocate may throw.
Assign segments
template<
class FwdIt>
void
assign(
FwdIt first,
FwdIt last);
Declared in file <boost/url/impl/segments_ref.hpp> at line 37
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.
None of the character buffers referenced by the range may overlap the character buffer of the underlying url, or else the behavior is undefined.
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, core::string_view >::value == true
Linear in `std::distance( first, last ) + this->url().encoded_query().size() + this->url().encoded_fragment().size()`.
Strong guarantee. Calls to allocate may throw.
Insert segments
Declared in file <src/segments_ref.cpp> at line 85
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.
Linear in `s.size() + this->url().encoded_resource().size()`.
Strong guarantee. Calls to allocate may throw.
Insert segments
Declared in file <src/segments_ref.cpp> at line 98
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.
None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.
url u( "/file.txt" );
u.segments().insert( u.segments().begin(), { "path", "to" } );
Linear in `init.size() + this->url().encoded_resource().size()`.
Strong guarantee. Calls to allocate may throw.
Insert segments
Declared in file <boost/url/impl/segments_ref.hpp> at line 61
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.
None of the character buffers referenced by the range may overlap the character buffer of the underlying url, or else the behavior is undefined.
std::is_convertible< std::iterator_traits< FwdIt >::reference_type, core::string_view >::value == true
Linear in `std::distance( first, last ) + this->url().encoded_resource().size()`.
Strong guarantee. Calls to allocate may throw.
Erase segments
Declared in file <boost/url/impl/segments_ref.hpp> at line 89
This function removes a segment.
All iterators that are equal to `pos` or come after are invalidated.
Linear in `this->url().encoded_resource().size()`.
Throws nothing.
Erase segments
Declared in file <src/segments_ref.cpp> at line 112
This function removes a range of segments.
All iterators that are equal to `first` or come after are invalidated.
Linear in `this->url().encoded_resource().size()`.
Throws nothing.
Replace segments
Declared in file <src/segments_ref.cpp> at line 128
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.
Linear in `s.size() + this->url().encoded_resouce().size()`.
Strong guarantee. Calls to allocate may throw.
Replace segments
Declared in file <src/segments_ref.cpp> at line 141
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.
Linear in `s.size() + this->url().encoded_resouce().size()`.
Strong guarantee. Calls to allocate may throw.
Replace segments
Declared in file <src/segments_ref.cpp> at line 155
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.
None of the character buffers referenced by the list may overlap the character buffer of the underlying url, or else the behavior is undefined.
Linear in `init.size() + this->url().encoded_resouce().size()`.
Strong guarantee. Calls to allocate may throw.
Replace segments
Declared in file <boost/url/impl/segments_ref.hpp> at line 100
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.
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.
Linear in `std::distance( first, last ) + this->url().encoded_resouce().size()`.
Strong guarantee. Calls to allocate may throw.
Append a segment
void
push_back(
string_view s);
Declared in file <boost/url/impl/segments_ref.hpp> at line 130
This function appends a segment to the end of the path. Reserved characters in the string are automatically escaped.
All end iterators are invalidated.
this->back() == s
Strong guarantee. Calls to allocate may throw.
Remove the last segment
void
pop_back() noexcept;
Declared in file <boost/url/impl/segments_ref.hpp> at line 139
This function removes the last segment from the container.
Iterators to the last segment as well as all end iterators are invalidated.
not this->empty()
Throws nothing.
Common functionality for containers
class url_view_base ;
Declared in file <boost/url/url_view_base.hpp> at line 65
Name | Description |
---|---|
digest | |
size | Return the number of characters in the url |
empty | Return true if the url is empty |
data | Return a pointer to the url's character buffer |
buffer | Return the url string |
operator string_view | Return the URL as a core::string_view |
persist | Return a shared, persistent copy of the url |
has_scheme | Return true a scheme is present |
scheme | Return the scheme |
scheme_id | Return the scheme |
has_authority | Return true if an authority is present |
authority | Return the authority |
encoded_authority | Return the authority. |
has_userinfo | Return true if a userinfo is present |
has_password | Return true if a password is present |
userinfo | Return the userinfo |
encoded_userinfo | Return the userinfo |
user | Return the user |
encoded_user | Return the user |
password | Return the password |
encoded_password | Return the password |
host_type | Return the host type |
host | Return the host |
encoded_host | Return the host |
host_address | Return the host |
encoded_host_address | Return the host |
host_ipv4_address | Return the host IPv4 address |
host_ipv6_address | Return the host IPv6 address |
host_ipvfuture | Return the host IPvFuture address |
host_name | Return the host name |
encoded_host_name | Return the host name |
zone_id | Return the IPv6 Zone ID |
encoded_zone_id | Return the IPv6 Zone ID |
has_port | Return true if a port is present |
port | Return the port |
port_number | Return the port |
is_path_absolute | Return true if the path is absolute |
path | Return the path |
encoded_path | Return the path |
segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
has_query | Return true if a query is present |
query | Return the query |
encoded_query | Return the query |
params | Return the query as a container of parameters |
params | |
encoded_params | Return the query as a container of parameters |
has_fragment | Return true if a fragment is present |
fragment | Return the fragment |
encoded_fragment | Return the fragment |
encoded_host_and_port | Return the host and port |
encoded_origin | Return the origin |
encoded_resource | Return the resource |
encoded_target | Return the target |
compare | Return the result of comparing this with another url |
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:
size_t
digest(
size_t) noexcept;
Declared in file <src/url_view_base.cpp> at line 43
Return the maximum number of characters possible
static
size_t
max_size() noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 139
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.
Constant.
Throws nothing.
Return the number of characters in the url
size_t
size() noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 165
This function returns the number of characters in the url's encoded string, not including any null terminator, if present.
assert( url_view( "file:///Program%20Files" ).size() == 23 );
Constant.
Throws nothing.
Return true if the url is empty
bool
empty() noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 201
The empty string matches the relative-ref grammar.
assert( url_view( "" ).empty() );
Constant.
Throws nothing.
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-empty
Return a pointer to the url's character buffer
const char*
data() noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 219
This function returns a pointer to the first character of the url, which is not guaranteed to be null-terminated.
Constant.
Throws nothing.
Return the url string
string_view
buffer() noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 241
This function returns the entire url, which may contain percent escapes.
assert( url_view( "http://www.example.com" ).buffer() == "http://www.example.com" );
Constant.
Throws nothing.
Return the URL as a core::string_view
string_view
operator string_view() noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 257
Constant.
Throws nothing.
Return a shared, persistent copy of the url
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.
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.
}
Linear in `this->size()`.
Calls to allocate may throw.
Return true a scheme is present
bool
has_scheme() noexcept;
Declared in file <src/url_view_base.cpp> at line 105
This function returns true if this contains a scheme.
assert( url_view( "http://www.example.com" ).has_scheme() );
Constant.
Throws nothing.
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
absolute-URI = scheme ":" hier-part [ "?" query ]
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
Return the scheme
string_view
scheme() noexcept;
Declared in file <src/url_view_base.cpp> at line 120
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.
assert( url_view( "http://www.example.com" ).scheme() == "http" );
Throws nothing.
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
absolute-URI = scheme ":" hier-part [ "?" query ]
Return the scheme
This function returns a value which depends on the scheme in the url:
assert( url_view( "wss://www.example.com/crypto.cgi" ).scheme_id() == scheme::wss );
Constant.
Throws nothing.
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
absolute-URI = scheme ":" hier-part [ "?" query ]
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
Return true if an authority is present
bool
has_authority() noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 480
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.
assert( url_view( "http://www.example.com/index.htm" ).has_authority() );
Constant.
Throws nothing.
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...)
Return the authority
This function returns the authority as an authority_view.
authority_view a = url_view( "https://www.example.com:8080/index.htm" ).authority();
Constant.
Throws nothing.
authority = [ userinfo "@" ] host [ ":" port ]
Return the authority.
pct_string_view
encoded_authority() noexcept;
Declared in file <src/url_view_base.cpp> at line 177
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.
assert( url_view( "file://Network%20Drive/My%2DFiles" ).encoded_authority() == "Network%20Drive" );
Constant.
Throws nothing.
authority = [ userinfo "@" ] host [ ":" port ]
Return true if a userinfo is present
bool
has_userinfo() noexcept;
Declared in file <src/url_view_base.cpp> at line 203
This function returns true if this contains a userinfo.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_userinfo() );
Constant.
Throws nothing.
userinfo = user [ ":" [ password ] ]
authority = [ userinfo "@" ] host [ ":" port ]
Return true if a password is present
bool
has_password() noexcept;
Declared in file <src/url_view_base.cpp> at line 216
This function returns true if the userinfo is present and contains a password.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).has_password() );
Constant.
Throws nothing.
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Return the userinfo
template<
class StringToken = return_string>
StringToken::result_type
userinfo(
StringToken&& token);
Declared in file <boost/url/url_view_base.hpp> at line 696
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.
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.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).userinfo() == "jane-doe:pass" );
Linear in `this->userinfo().size()`.
Calls to allocate may throw.
userinfo = user [ ":" [ password ] ]
authority = [ userinfo "@" ] host [ ":" port ]
Return the userinfo
pct_string_view
encoded_userinfo() noexcept;
Declared in file <src/url_view_base.cpp> at line 234
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.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_userinfo() == "jane%2Ddoe:pass" );
Constant.
Throws nothing
userinfo = user [ ":" [ password ] ]
authority = [ userinfo "@" ] host [ ":" port ]
Return the user
template<
class StringToken = return_string>
StringToken::result_type
user(
StringToken&& token);
Declared in file <boost/url/url_view_base.hpp> at line 793
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.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );
Linear in `this->user().size()`.
Calls to allocate may throw.
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Return the user
pct_string_view
encoded_user() noexcept;
Declared in file <src/url_view_base.cpp> at line 258
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.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" );
Constant.
Throws nothing.
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Return the password
template<
class StringToken = return_string>
StringToken::result_type
password(
StringToken&& token);
Declared in file <boost/url/url_view_base.hpp> at line 889
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.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" );
Linear in `this->password().size()`.
Calls to allocate may throw.
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Return the password
pct_string_view
encoded_password() noexcept;
Declared in file <src/url_view_base.cpp> at line 275
This function returns the password portion of the userinfo as a percent-encoded string.
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_password() == "pass" );
Constant.
Throws nothing.
userinfo = user [ ":" [ password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Return the host type
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.
assert( url_view( "https://192.168.0.1/local.htm" ).host_type() == host_type::ipv4 );
Constant.
Throws nothing.
Return the host
template<
class StringToken = return_string>
StringToken::result_type
host(
StringToken&& token);
Declared in file <boost/url/url_view_base.hpp> at line 1014
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.
assert( url_view( "https://www%2droot.example.com/" ).host() == "www-root.example.com" );
Linear in `this->host().size()`.
Calls to allocate may throw.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Return the host
pct_string_view
encoded_host() noexcept;
Declared in file <src/url_view_base.cpp> at line 321
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.
assert( url_view( "https://www%2droot.example.com/" ).encoded_host() == "www%2droot.example.com" );
Constant.
Throws nothing.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Return the host
template<
class StringToken = return_string>
StringToken::result_type
host_address(
StringToken&& token);
Declared in file <boost/url/url_view_base.hpp> at line 1109
The value returned by this function depends on the type of host returned from the function host_type.
assert( url_view( "https://[1::6:c0a8:1]/" ).host_address() == "1::6:c0a8:1" );
Linear in `this->host_address().size()`.
Calls to allocate may throw.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Return the host
pct_string_view
encoded_host_address() noexcept;
Declared in file <src/url_view_base.cpp> at line 328
The value returned by this function depends on the type of host returned from the function host_type.
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_address() == "www%2droot.example.com" );
Constant.
Throws nothing.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Return the host IPv4 address
ipv4_address
host_ipv4_address() noexcept;
Declared in file <src/url_view_base.cpp> at line 367
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".
assert( url_view( "http://127.0.0.1/index.htm?user=win95" ).host_ipv4_address() == ipv4_address( "127.0.0.1" ) );
Constant.
Throws nothing.
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
dec-octet = DIGIT ; 0-9
/ %x31-39 DIGIT ; 10-99
/ "1" 2DIGIT ; 100-199
/ "2" %x30-34 DIGIT ; 200-249
/ "25" %x30-35 ; 250-255
Return the host IPv6 address
ipv6_address
host_ipv6_address() noexcept;
Declared in file <src/url_view_base.cpp> at line 380
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".
assert( url_view( "ftp://[::1]/" ).host_ipv6_address() == ipv6_address( "::1" ) );
Constant.
Throws nothing.
IPv6address = 6( h16 ":" ) ls32
/ "::" 5( h16 ":" ) ls32
/ [ h16 ] "::" 4( h16 ":" ) ls32
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
/ [ *4( h16 ":" ) h16 ] "::" ls32
/ [ *5( h16 ":" ) h16 ] "::" h16
/ [ *6( h16 ":" ) h16 ] "::"
ls32 = ( h16 ":" h16 ) / IPv4address
; least-significant 32 bits of address
h16 = 1*4HEXDIG
; 16 bits of address represented in hexadecimal
Return the host IPvFuture address
string_view
host_ipvfuture() noexcept;
Declared in file <src/url_view_base.cpp> at line 393
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.
assert( url_view( "http://[v1fe.d:9]/index.htm" ).host_ipvfuture() == "v1fe.d:9" );
Constant.
Throws nothing.
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
Return the host name
template<
class StringToken = return_string>
StringToken::result_type
host_name(
StringToken&& token);
Declared in file <boost/url/url_view_base.hpp> at line 1324
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.
assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" );
Linear in `this->host_name().size()`.
Calls to allocate may throw.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Return the host name
pct_string_view
encoded_host_name() noexcept;
Declared in file <src/url_view_base.cpp> at line 408
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.
assert( url_view( "https://www%2droot.example.com/" ).encoded_host_name() == "www%2droot.example.com" );
Constant.
Throws nothing.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Return the IPv6 Zone ID
template<
class StringToken = return_string>
StringToken::result_type
zone_id(
StringToken&& token);
Declared in file <boost/url/url_view_base.hpp> at line 1406
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.
assert( url_view( "http://[fe80::1%25eth0]/" ).zone_id() == "eth0" );
Linear in `this->encoded_zone_id().size()`.
Calls to allocate may throw.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]"
ZoneID = 1*( unreserved / pct-encoded )
IPv6addrz = IPv6address "%25" ZoneID
Return the IPv6 Zone ID
pct_string_view
encoded_zone_id() noexcept;
Declared in file <src/url_view_base.cpp> at line 422
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.
assert( url_view( "http://[fe80::1%25eth0]/" ).encoded_zone_id() == "eth0" );
Constant.
Throws nothing.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture ) "]"
ZoneID = 1*( unreserved / pct-encoded )
IPv6addrz = IPv6address "%25" ZoneID
Return true if a port is present
bool
has_port() noexcept;
Declared in file <src/url_view_base.cpp> at line 442
This function returns true if an authority is present and contains a port.
assert( url_view( "wss://www.example.com:443" ).has_port() );
Constant.
Throws nothing.
authority = [ userinfo "@" ] host [ ":" port ]
port = *DIGIT
Return the port
string_view
port() noexcept;
Declared in file <src/url_view_base.cpp> at line 454
If present, this function returns a string representing the port (which may be empty). Otherwise it returns an empty string.
assert( url_view( "http://localhost.com:8080" ).port() == "8080" );
Constant.
Throws nothing.
port = *DIGIT
Return the port
uint16_t
port_number() noexcept;
Declared in file <src/url_view_base.cpp> at line 465
If a port is present and the numerical value is representable, it is returned as an unsigned integer. Otherwise, the number zero is returned.
assert( url_view( "http://localhost.com:8080" ).port_number() == 8080 );
Constant.
Throws nothing.
port = *DIGIT
Return true if the path is absolute
bool
is_path_absolute() noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 1611
This function returns true if the path begins with a forward slash ('/').
assert( url_view( "/path/to/file.txt" ).is_path_absolute() );
Constant.
Throws nothing.
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
Return the path
template<
class StringToken = return_string>
StringToken::result_type
path(
StringToken&& token);
Declared in file <boost/url/url_view_base.hpp> at line 1663
This function returns the path as a string. The path may be empty. Any percent-escapes in the string are decoded first.
assert( url_view( "file:///Program%20Files/Games/config.ini" ).path() == "/Program Files/Games/config.ini" );
Linear in `this->path().size()`.
Calls to allocate may throw.
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
Return the path
pct_string_view
encoded_path() noexcept;
Declared in file <src/url_view_base.cpp> at line 481
This function returns the path as a string. The path may be empty. Any percent-escapes in the string are decoded first.
assert( url_view( "file:///Program%20Files/Games/config.ini" ).encoded_path() == "/Program%20Files/Games/config.ini" );
Constant.
Throws nothing.
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
Return the path as a container of segments
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.
segments_view sv = url_view( "/path/to/file.txt" ).segments();
Constant.
Throws nothing.
path = [ "/" ] segment *( "/" segment )
Return the path as a container of segments
segments_encoded_view
encoded_segments() noexcept;
Declared in file <src/url_view_base.cpp> at line 495
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.
segments_encoded_view sv = url_view( "/path/to/file.txt" ).encoded_segments();
Constant.
Throws nothing.
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
Return true if a query is present
bool
has_query() noexcept;
Declared in file <src/url_view_base.cpp> at line 509
This function returns true if this contains a query. An empty query is distinct from having no query.
assert( url_view( "/sql?id=42&col=name&page-size=20" ).has_query() );
Constant.
Throws nothing.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Return the query
template<
class StringToken = return_string>
StringToken::result_type
query(
StringToken&& token);
Declared in file <boost/url/url_view_base.hpp> at line 1901
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.
assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).query() == "id=42&name=jane-doe&page size=20" );
Linear in `this->query().size()`.
Calls to allocate may throw.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Return the query
pct_string_view
encoded_query() noexcept;
Declared in file <src/url_view_base.cpp> at line 523
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.
assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_query() == "id=42&name=jane%2Ddoe&page+size=20" );
Constant.
Throws nothing.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Return the query as a container of parameters
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.
params_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).params();
Constant.
Throws nothing.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
params_view
params(
encoding_opts opt) noexcept;
Declared in file <src/url_view_base.cpp> at line 552
Return the query as a container of parameters
params_encoded_view
encoded_params() noexcept;
Declared in file <src/url_view_base.cpp> at line 535
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.
params_encoded_view pv = url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_params();
Constant.
Throws nothing.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Return true if a fragment is present
bool
has_fragment() noexcept;
Declared in file <src/url_view_base.cpp> at line 565
This function returns true if the url contains a fragment. An empty fragment is distinct from no fragment.
assert( url_view( "http://www.example.com/index.htm#anchor" ).has_fragment() );
Constant.
Throws nothing.
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
Return the fragment
template<
class StringToken = return_string>
StringToken::result_type
fragment(
StringToken&& token);
Declared in file <boost/url/url_view_base.hpp> at line 2149
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:
assert( url_view( "http://www.example.com/index.htm#a%2D1" ).fragment() == "a-1" );
Linear in `this->fragment().size()`.
Calls to allocate may throw. String tokens may throw exceptions.
fragment = *( pchar / "/" / "?" )
fragment-part = [ "#" fragment ]
Return the fragment
pct_string_view
encoded_fragment() noexcept;
Declared in file <src/url_view_base.cpp> at line 578
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.
assert( url_view( "http://www.example.com/index.htm#a%2D1" ).encoded_fragment() == "a%2D1" );
Constant.
Throws nothing.
fragment = *( pchar / "/" / "?" )
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
Return the host and port
pct_string_view
encoded_host_and_port() noexcept;
Declared in file <src/url_view_base.cpp> at line 601
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.
assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" );
Constant.
Throws nothing.
authority = [ userinfo "@" ] host [ ":" port ]
Return the origin
pct_string_view
encoded_origin() noexcept;
Declared in file <src/url_view_base.cpp> at line 608
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.
assert( url_view( "http://www.example.com:8080/index.htm?text=none#h1" ).encoded_origin() == "http://www.example.com:8080" );
Constant.
Throws nothing.
Return the resource
pct_string_view
encoded_resource() noexcept;
Declared in file <src/url_view_base.cpp> at line 617
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.
assert( url_view( "http://www.example.com/index.html?query#frag" ).encoded_resource() == "/index.html?query#frag" );
Constant.
Throws nothing.
Return the target
pct_string_view
encoded_target() noexcept;
Declared in file <src/url_view_base.cpp> at line 637
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.
assert( url_view( "http://www.example.com/index.html?query#frag" ).encoded_target() == "/index.html?query" );
Constant.
Throws nothing.
Return the result of comparing this with another url
int
compare(
const url_view_base& other) noexcept;
Declared in file <src/url_view_base.cpp> at line 660
This function compares two URLs according to Syntax-Based comparison algorithm.
Linear in `min( u0.size(), u1.size() )`
Throws nothing.
Return the result of comparing two URLs
bool
operator==(
const url_view_base& u0,
const url_view_base& u1) noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 2413
The URLs are compared component by component as if they were first normalized.
url_view u0( "http://www.a.com/index.htm" );
url_view u1( "http://www.a.com/index.htm" );
assert( u0 == u1 );
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());
Linear in `min( u0.size(), u1.size() )`
Throws nothing
Return the result of comparing two URLs
bool
operator!=(
const url_view_base& u0,
const url_view_base& u1) noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 2473
The URLs are compared component by component as if they were first normalized.
url_view u0( "http://www.a.com/index.htm" );
url_view u1( "http://www.b.com/index.htm" );
assert( u0 != u1 );
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());
Linear in `min( u0.size(), u1.size() )`
Throws nothing
Return the result of comparing two URLs
bool
operator<(
const url_view_base& u0,
const url_view_base& u1) noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 2533
The URLs are compared component by component as if they were first normalized.
url_view u0( "http://www.a.com/index.htm" );
url_view u1( "http://www.b.com/index.htm" );
assert( u0 < u1 );
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());
Linear in `min( u0.size(), u1.size() )`
Throws nothing
Return the result of comparing two URLs
bool
operator<=(
const url_view_base& u0,
const url_view_base& u1) noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 2593
The URLs are compared component by component as if they were first normalized.
url_view u0( "http://www.b.com/index.htm" );
url_view u1( "http://www.b.com/index.htm" );
assert( u0 <= u1 );
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());
Linear in `min( u0.size(), u1.size() )`
Throws nothing
Return the result of comparing two URLs
bool
operator>(
const url_view_base& u0,
const url_view_base& u1) noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 2653
The URLs are compared component by component as if they were first normalized.
url_view u0( "http://www.b.com/index.htm" );
url_view u1( "http://www.a.com/index.htm" );
assert( u0 > u1 );
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());
Linear in `min( u0.size(), u1.size() )`
Throws nothing
Return the result of comparing two URLs
bool
operator>=(
const url_view_base& u0,
const url_view_base& u1) noexcept;
Declared in file <boost/url/url_view_base.hpp> at line 2713
The URLs are compared component by component as if they were first normalized.
url_view u0( "http://www.a.com/index.htm" );
url_view u1( "http://www.a.com/index.htm" );
assert( u0 >= u1 );
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());
Linear in `min( u0.size(), u1.size() )`
Throws nothing
Format the url to the output stream
ostream&
operator<<(
ostream& os,
const url_view_base& u);
Declared in file <boost/url/url_view_base.hpp> at line 2722
This function serializes the url to the specified output stream. Any percent-escapes are emitted as-is; no decoding is performed.
url_view u( "http://www.example.com/index.htm" );
std::stringstream ss;
ss << u;
assert( ss.str() == "http://www.example.com/index.htm" );
return os << u.buffer();
Linear in `u.buffer().size()`
Basic guarantee.
Resolve a URL reference against a base URL
result<void>
resolve(
const url_view_base& base,
const url_view_base& ref,
url_base& dest);
Declared in file <boost/url/url_base.hpp> at line 2888
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:
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.
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" );
absolute-URI = scheme ":" hier-part [ "?" query ]
Basic guarantee. Calls to allocate may throw.
A modifiable container for a URL.
class url
: public url_base;
Declared in file <boost/url/url.hpp> at line 63
Name | Description |
---|---|
digest | |
size | Return the number of characters in the url |
empty | Return true if the url is empty |
data | Return a pointer to the url's character buffer |
buffer | Return the url string |
operator string_view | Return the URL as a core::string_view |
persist | Return a shared, persistent copy of the url |
has_scheme | Return true a scheme is present |
scheme | Return the scheme |
scheme_id | Return the scheme |
has_authority | Return true if an authority is present |
authority | Return the authority |
encoded_authority | Return the authority. |
has_userinfo | Return true if a userinfo is present |
has_password | Return true if a password is present |
userinfo | Return the userinfo |
encoded_userinfo | Return the userinfo |
user | Return the user |
encoded_user | Return the user |
password | Return the password |
encoded_password | Return the password |
host_type | Return the host type |
host | Return the host |
encoded_host | Return the host |
host_address | Return the host |
encoded_host_address | Return the host |
host_ipv4_address | Return the host IPv4 address |
host_ipv6_address | Return the host IPv6 address |
host_ipvfuture | Return the host IPvFuture address |
host_name | Return the host name |
encoded_host_name | Return the host name |
zone_id | Return the IPv6 Zone ID |
encoded_zone_id | Return the IPv6 Zone ID |
has_port | Return true if a port is present |
port | Return the port |
port_number | Return the port |
is_path_absolute | Return true if the path is absolute |
path | Return the path |
encoded_path | Return the path |
segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
has_query | Return true if a query is present |
query | Return the query |
encoded_query | Return the query |
params | Return the query as a container of parameters |
params | |
encoded_params | Return the query as a container of parameters |
has_fragment | Return true if a fragment is present |
fragment | Return the fragment |
encoded_fragment | Return the fragment |
encoded_host_and_port | Return the host and port |
encoded_origin | Return the origin |
encoded_resource | Return the resource |
encoded_target | Return the target |
compare | Return the result of comparing this with another url |
c_str | Return the url as a null-terminated string |
capacity | Return the number of characters that can be stored without reallocating |
clear | Clear the contents while preserving the capacity |
reserve | Adjust the capacity without changing the size |
set_scheme | Set the scheme |
set_scheme_id | |
remove_scheme | Remove the scheme |
set_encoded_authority | Set the authority |
remove_authority | Remove the authority |
set_userinfo | Set the userinfo |
set_encoded_userinfo | Set the userinfo. |
remove_userinfo | Remove the userinfo |
set_user | Set the user |
set_encoded_user | Set the user |
set_password | Set the password. |
set_encoded_password | Set the password. |
remove_password | Remove the password |
set_host | Set the host |
set_encoded_host | Set the host |
set_host_address | Set the host to an address |
set_encoded_host_address | Set the host to an address |
set_host_ipv4 | Set the host to an address |
set_host_ipv6 | Set the host to an address |
set_host_ipvfuture | Set the host to an address |
set_host_name | Set the host to a name |
set_encoded_host_name | Set the host to a name |
set_port_number | Set the port |
set_port | Set the port |
remove_port | Remove the port |
set_path_absolute | Set if the path is absolute |
set_path | Set the path. |
set_encoded_path | Set the path. |
segments | Return the path as a container of segments |
segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
set_query | Set the query |
set_encoded_query | Set the query |
params | Return the query as a container of parameters |
params | url_view_base::params |
params | Return the query as a container of parameters |
encoded_params | Return the query as a container of parameters |
encoded_params | Return the query as a container of parameters |
set_params | Set the query params |
set_encoded_params | Set the query params |
remove_query | Remove the query |
remove_fragment | Remove the fragment |
set_fragment | Set the fragment. |
set_encoded_fragment | Set the fragment. |
remove_origin | Remove the origin component |
normalize | Normalize the URL components |
normalize_scheme | Normalize the URL scheme |
normalize_authority | Normalize the URL authority |
normalize_path | Normalize the URL path |
normalize_query | Normalize the URL query |
normalize_fragment | Normalize the URL fragment |
resolve | Resolve a URL reference against this base URL |
~url | Destructor |
url | Constructor |
url | Constructor |
url | Constructor |
url | Constructor |
url | Constructor |
operator= | Assignment |
operator= | Assignment |
operator= | Assignment |
swap | Swap the contents. |
set_scheme | Set the scheme |
set_scheme_id | url_base::set_scheme_id |
remove_scheme | Remove the scheme |
set_encoded_authority | Set the authority |
remove_authority | Remove the authority |
set_userinfo | Set the userinfo |
set_encoded_userinfo | Set the userinfo. |
remove_userinfo | Remove the userinfo |
set_user | Set the user |
set_encoded_user | Set the user |
set_password | Set the password. |
set_encoded_password | Set the password. |
remove_password | Remove the password |
set_host | Set the host |
set_encoded_host | Set the host |
set_host_address | Set the host to an address |
set_encoded_host_address | Set the host to an address |
set_host_ipv4 | Set the host to an address |
set_host_ipv6 | Set the host to an address |
set_host_ipvfuture | Set the host to an address |
set_host_name | Set the host to a name |
set_encoded_host_name | Set the host to a name |
set_port_number | Set the port |
set_port | Set the port |
remove_port | Remove the port |
set_path | Set the path. |
set_encoded_path | Set the path. |
set_query | Set the query |
set_encoded_query | Set the query |
set_params | Set the query params |
set_encoded_params | Set the query params |
remove_query | Remove the query |
remove_fragment | Remove the fragment |
set_fragment | Set the fragment. |
set_encoded_fragment | Set the fragment. |
remove_origin | Remove the origin component |
normalize | Normalize the URL components |
normalize_scheme | Normalize the URL scheme |
normalize_authority | Normalize the URL authority |
normalize_path | Normalize the URL path |
normalize_query | Normalize the URL query |
normalize_fragment | Normalize the URL fragment |
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.
URI-reference = URI / relative-ref
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
absolute-URI = scheme ":" hier-part [ "?" query ]
Destructor
void
~url();
Declared in file <src/url.cpp> at line 24
Any params, segments, iterators, or views which reference this object are invalidated. The underlying character buffer is destroyed, invalidating all references to it.
Constructor
void
url() noexcept;
Declared in file <src/url.cpp> at line 36
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.
url u;
this->empty() == true
Constant.
Throws nothing.
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
Constructor
void
url(
string_view s);
Declared in file <src/url.cpp> at line 39
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.
url u( "https://www.example.com" );
return url( parse_uri_reference( s ).value() );
this->buffer().data() != s.data()
Linear in `s.size()`.
Calls to allocate may throw. Exceptions thrown on invalid input.
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
Constructor
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.
u.empty() == true
Constant.
Throws nothing.
Constructor
The newly constructed object contains a copy of `u`.
this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data()
Linear in `u.size()`.
Strong guarantee. Calls to allocate may throw.
Constructor
The newly constructed object contains a copy of `u`.
this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data()
Linear in `u.size()`.
Strong guarantee. Calls to allocate may throw.
Assignment
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.
u.empty() == true
Constant.
Throws nothing.
Assignment
The contents of `u` are copied and the previous contents of `this` are destroyed. Capacity is preserved, or increases.
this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data()
Linear in `u.size()`.
Strong guarantee. Calls to allocate may throw.
Assignment
The contents of `u` are copied and the previous contents of `this` are destroyed. Capacity is preserved, or increases.
this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data()
Linear in `u.size()`.
Strong guarantee. Calls to allocate may throw.
Swap the contents.
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.
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" );
Constant
Throws nothing.
Set the scheme
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.
assert( url( "http://www.example.com" ).set_scheme( "https" ).scheme_id() == scheme::https );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
url_base::set_scheme_id
Remove the scheme
This function removes the scheme if it is present.
assert( url("http://www.example.com/index.htm" ).remove_scheme().buffer() == "//www.example.com/index.htm" );
this->has_scheme() == false && this->scheme_id() == scheme::none
Linear in `this->size()`.
Throws nothing.
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
Set the authority
url&
set_encoded_authority(
pct_string_view s);
Declared in file <boost/url/url.hpp> at line 416
This function sets the authority to the specified string. The string may contain percent-escapes.
assert( url().set_encoded_authority( "My%20Computer" ).has_authority() );
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
authority = [ userinfo "@" ] host [ ":" port ]
userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
host = IP-literal / IPv4address / reg-name
port = *DIGIT
Remove the authority
This function removes the authority, which includes the userinfo, host, and a port if present.
assert( url( "http://example.com/echo.cgi" ).remove_authority().buffer() == "http:/echo.cgi" );
this->has_authority() == false && this->has_userinfo() == false && this->has_port() == false
Linear in `this->size()`.
Throws nothing.
authority = [ userinfo "@" ] host [ ":" port ]
userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
host = IP-literal / IPv4address / reg-name
port = *DIGIT
Set the userinfo
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:
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url( "http://example.com" ).set_userinfo( "user:pass" ).encoded_user() == "user" );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the userinfo.
url&
set_encoded_userinfo(
pct_string_view s);
Declared in file <boost/url/url.hpp> at line 423
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:
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Remove the userinfo
This function removes the userinfo if present, without removing any authority.
assert( url( "http://user@example.com" ).remove_userinfo().has_userinfo() == false );
this->has_userinfo() == false && this->encoded_userinfo().empty == true
Linear in `this->size()`.
Throws nothing.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the user
This function sets the user part of the userinfo to the string. Any special or reserved characters in the string are automatically percent-encoded.
assert( url().set_user("john doe").encoded_userinfo() == "john%20doe" );
this->has_authority() == true && this->has_userinfo() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the user
url&
set_encoded_user(
pct_string_view s);
Declared in file <boost/url/url.hpp> at line 429
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.
assert( url().set_encoded_user("john%20doe").userinfo() == "john doe" );
this->has_authority() == true && this->has_userinfo() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the password.
This function sets the password in the userinfo to the string. Reserved characters in the string are percent-escaped in the result.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url("http://user@example.com").set_password( "pass" ).encoded_userinfo() == "user:pass" );
this->has_password() == true && this->password() == s
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the password.
url&
set_encoded_password(
pct_string_view s);
Declared in file <boost/url/url.hpp> at line 433
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.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url("http://user@example.com").set_encoded_password( "pass" ).encoded_userinfo() == "user:pass" );
this->has_password() == true
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Remove the password
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.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url( "http://user:pass@example.com" ).remove_password().authority().buffer() == "user@example.com" );
this->has_password() == false && this->encoded_password().empty() == true
Linear in `this->size()`.
Throws nothing.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the host
Depending on the contents of the passed string, this function sets the host:
In all cases, when this function returns, the URL contains an authority.
assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );
this->has_authority() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Set the host
url&
set_encoded_host(
pct_string_view s);
Declared in file <boost/url/url.hpp> at line 440
Depending on the contents of the passed string, this function sets the host:
In all cases, when this function returns, the URL contains an authority.
assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );
this->has_authority() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Set the host to an address
Depending on the contents of the passed string, this function sets the host:
In all cases, when this function returns, the URL contains an authority.
assert( url( "http://www.example.com" ).set_host_address( "127.0.0.1" ).buffer() == "http://127.0.0.1" );
this->has_authority() == true
Linear in `s.size()`.
Strong guarantee. Calls to allocate may throw.
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 / "-" / ".")
Set the host to an address
url&
set_encoded_host_address(
pct_string_view s);
Declared in file <boost/url/url.hpp> at line 444
Depending on the contents of the passed string, this function sets the host:
In all cases, when this function returns, the URL contains an authority.
assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );
this->has_authority() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
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 / "-" / ".")
Set the host to an address
url&
set_host_ipv4(
const ipv4_address& addr);
Declared in file <boost/url/url.hpp> at line 446
The host is set to the specified IPv4 address. The host type is host_type::ipv4.
assert( url("http://www.example.com").set_host_ipv4( ipv4_address( "127.0.0.1" ) ).buffer() == "http://127.0.0.1" );
Linear in `this->size()`.
this->has_authority() == true && this->host_ipv4_address() == addr && this->host_type() == host_type::ipv4
Strong guarantee. Calls to allocate may throw.
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
Set the host to an address
url&
set_host_ipv6(
const ipv6_address& addr);
Declared in file <boost/url/url.hpp> at line 448
The host is set to the specified IPv6 address. The host type is host_type::ipv6.
assert( url().set_host_ipv6( ipv6_address( "1::6:c0a8:1" ) ).authority().buffer() == "[1::6:c0a8:1]" );
this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::ipv6
Linear in `this->size()`.
Strong guarantee. Calls to allocate may throw.
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
Set the host to an address
The host is set to the specified IPvFuture string. The host type is host_type::ipvfuture.
assert( url().set_host_ipvfuture( "v42.bis" ).buffer() == "//[v42.bis]" );
Linear in `this->size() + s.size()`.
this->has_authority() == true && this->host_ipvfuture) == s && this->host_type() == host_type::ipvfuture
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
Set the host to a name
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.
assert( url( "http://www.example.com/index.htm").set_host_name( "localhost" ).host_address() == "localhost" );
this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name
Strong guarantee. Calls to allocate may throw.
reg-name = *( unreserved / pct-encoded / "-" / ".")
Set the host to a name
url&
set_encoded_host_name(
pct_string_view s);
Declared in file <boost/url/url.hpp> at line 454
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.
assert( url( "http://www.example.com/index.htm").set_encoded_host_name( "localhost" ).host_address() == "localhost" );
this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
reg-name = *( unreserved / pct-encoded / "-" / ".")
Set the port
The port is set to the specified integer.
assert( url( "http://www.example.com" ).set_port_number( 8080 ).authority().buffer() == "www.example.com:8080" );
this->has_authority() == true && this->has_port() == true && this->port_number() == n
Linear in `this->size()`.
Strong guarantee. Calls to allocate may throw.
authority = [ userinfo "@" ] host [ ":" port ]
port = *DIGIT
Set the port
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.
assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" );
this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n)
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
port = *DIGIT
Remove the port
If a port exists, it is removed. The rest of the authority is unchanged.
assert( url( "http://www.example.com:80" ).remove_port().authority().buffer() == "www.example.com" );
this->has_port() == false && this->port_number() == 0 && this->port() == ""
Linear in `this->size()`.
Throws nothing.
authority = [ userinfo "@" ] host [ ":" port ]
port = *DIGIT
Set the path.
This function sets the path to the string, which may be empty. Reserved characters in the string are percent-escaped in the result.
The library may adjust the final result to ensure that no other parts of the url is semantically affected.
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.
url u( "http://www.example.com" );
u.set_path( "path/to/file.txt" );
assert( u.path() == "/path/to/file.txt" );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
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
Set the path.
url&
set_encoded_path(
pct_string_view s);
Declared in file <boost/url/url.hpp> at line 467
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.
The library may adjust the final result to ensure that no other parts of the url is semantically affected.
url u( "http://www.example.com" );
u.set_encoded_path( "path/to/file.txt" );
assert( u.encoded_path() == "/path/to/file.txt" );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
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
Set the query
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.
assert( url( "http://example.com" ).set_query( "id=42" ).query() == "id=42" );
this->has_query() == true && this->query() == s
Strong guarantee. Calls to allocate may throw.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Set the query
url&
set_encoded_query(
pct_string_view s);
Declared in file <boost/url/url.hpp> at line 472
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.
assert( url( "http://example.com" ).set_encoded_query( "id=42" ).encoded_query() == "id=42" );
this->has_query() == true && this->query() == decode_view( s );
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Set the query params
url&
set_params(
initializer_list<param_view> ps);
Declared in file <boost/url/url.hpp> at line 474
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.
assert( url( "http://example.com" ).set_params( {"id", "42"} ).query() == "id=42" );
this->has_query() == true
Strong guarantee. Calls to allocate may throw.
Linear.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Set the query params
url&
set_encoded_params(
initializer_list<param_pct_view> ps);
Declared in file <boost/url/url.hpp> at line 476
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.
assert( url( "http://example.com" ).set_encoded_params( {"id", "42"} ).encoded_query() == "id=42" );
this->has_query() == true
Linear.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Remove the query
If a query is present, it is removed. An empty query is distinct from having no query.
assert( url( "http://www.example.com?id=42" ).remove_query().buffer() == "http://www.example.com" );
this->has_query() == false && this->params().empty()
Throws nothing.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Remove the fragment
This function removes the fragment. An empty fragment is distinct from having no fragment.
assert( url( "?first=john&last=doe#anchor" ).remove_fragment().buffer() == "?first=john&last=doe" );
this->has_fragment() == false && this->encoded_fragment() == ""
Constant.
Throws nothing.
fragment = *( pchar / "/" / "?" )
Set the fragment.
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.
assert( url("?first=john&last=doe" ).set_encoded_fragment( "john doe" ).encoded_fragment() == "john%20doe" );
this->has_fragment() == true && this->fragment() == s
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
fragment = *( pchar / "/" / "?" )
Set the fragment.
url&
set_encoded_fragment(
pct_string_view s);
Declared in file <boost/url/url.hpp> at line 485
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.
assert( url("?first=john&last=doe" ).set_encoded_fragment( "john%2Ddoe" ).fragment() == "john-doe" );
this->has_fragment() == true && this->fragment() == decode_view( s )
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
fragment = *( pchar / "/" / "?" )
Remove the origin component
This function removes the origin, which consists of the scheme and authority.
assert( url( "http://www.example.com/index.htm" ).remove_origin().buffer() == "/index.htm" );
this->scheme_id() == scheme::none && this->has_authority() == false
Linear in `this->size()`.
Throws nothing.
Normalize the URL components
Applies Syntax-based normalization to all components of the URL.
Strong guarantee. Calls to allocate may throw.
Normalize the URL scheme
Applies Syntax-based normalization to the URL scheme.
The scheme is normalized to lowercase.
Strong guarantee. Calls to allocate may throw.
Normalize the URL authority
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.
Strong guarantee. Calls to allocate may throw.
Normalize the URL path
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.
Strong guarantee. Calls to allocate may throw.
Normalize the URL query
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.
Strong guarantee. Calls to allocate may throw.
Normalize the URL fragment
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.
Strong guarantee. Calls to allocate may throw.
Swap
Exchanges the contents of `v0` with another `v1`. All views, iterators and references remain valid.
If ` &v 0 == &v 1`, this function call has no effect.
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" );
v0.swap( v1 );
Constant
Throws nothing
struct ipv4_address_rule_t ;
Declared in file <boost/url/rfc/ipv4_address_rule.hpp> at line 58
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = ipv4_address ;
Declared in file <boost/url/rfc/ipv4_address_rule.hpp> at line 60
result<ipv4_address>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <src/rfc/ipv4_address_rule.cpp> at line 23
const ipv4_address_rule_t ipv4_address_rule ;
Declared in file <boost/url/rfc/ipv4_address_rule.hpp> at line 72
struct ipv6_address_rule_t ;
Declared in file <boost/url/rfc/ipv6_address_rule.hpp> at line 66
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = ipv6_address ;
Declared in file <boost/url/rfc/ipv6_address_rule.hpp> at line 68
result<ipv6_address>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <src/rfc/ipv6_address_rule.cpp> at line 52
const ipv6_address_rule_t ipv6_address_rule ;
Declared in file <boost/url/rfc/ipv6_address_rule.hpp> at line 80
Return a reference to a parsed URL string
result<url_view>
parse_absolute_uri(
string_view s);
Declared in file <src/parse.cpp> at line 26
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.
system::result< url_view > rv = parse_absolute_uri( "http://example.com/index.htm?id=1" );
absolute-URI = scheme ":" hier-part [ "?" query ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
Return a reference to a parsed URL string
result<url_view>
parse_origin_form(
string_view s);
Declared in file <src/parse.cpp> at line 34
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.
system::result< url_view > = parse_origin_form( "/index.htm?layout=mobile" );
origin-form = absolute-path [ "?" query ]
absolute-path = 1*( "/" segment )
Return a reference to a parsed URL string
result<url_view>
parse_relative_ref(
string_view s);
Declared in file <src/parse.cpp> at line 42
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.
system::result< url_view > = parse_relative_ref( "images/dot.gif?v=hide#a" );
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-abempty
/ path-empty
Return a reference to a parsed URL string
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.
system::result< url_view > = parse_uri( "https://www.example.com/index.htm?id=guest#s1" );
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-empty
Return a reference to a parsed URL string
result<url_view>
parse_uri_reference(
string_view s);
Declared in file <src/parse.cpp> at line 57
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.
system::result< url_view > = parse_uri_reference( "ws://echo.example.com/?name=boost#demo" );
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
struct absolute_uri_rule_t ;
Declared in file <boost/url/rfc/absolute_uri_rule.hpp> at line 55
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = url_view ;
Declared in file <boost/url/rfc/absolute_uri_rule.hpp> at line 57
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <src/rfc/absolute_uri_rule.cpp> at line 27
const absolute_uri_rule_t absolute_uri_rule ;
Declared in file <boost/url/rfc/absolute_uri_rule.hpp> at line 68
struct relative_ref_rule_t ;
Declared in file <boost/url/rfc/relative_ref_rule.hpp> at line 50
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = url_view ;
Declared in file <boost/url/rfc/relative_ref_rule.hpp> at line 52
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <src/rfc/relative_ref_rule.cpp> at line 27
const relative_ref_rule_t relative_ref_rule ;
Declared in file <boost/url/rfc/relative_ref_rule.hpp> at line 63
struct uri_rule_t ;
Declared in file <boost/url/rfc/uri_rule.hpp> at line 50
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
result<value_type>
parse(
const char*& it,
const char* const end) noexcept;
Declared in file <src/rfc/uri_rule.cpp> at line 28
struct uri_reference_rule_t ;
Declared in file <boost/url/rfc/uri_reference_rule.hpp> at line 53
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = url_view ;
Declared in file <boost/url/rfc/uri_reference_rule.hpp> at line 55
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <src/rfc/uri_reference_rule.cpp> at line 24
const uri_reference_rule_t uri_reference_rule ;
Declared in file <boost/url/rfc/uri_reference_rule.hpp> at line 66
struct origin_form_rule_t ;
Declared in file <boost/url/rfc/origin_form_rule.hpp> at line 53
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = url_view ;
Declared in file <boost/url/rfc/origin_form_rule.hpp> at line 55
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <src/rfc/origin_form_rule.cpp> at line 25
const origin_form_rule_t origin_form_rule ;
Declared in file <boost/url/rfc/origin_form_rule.hpp> at line 66
struct query_rule_t ;
Declared in file <boost/url/rfc/query_rule.hpp> at line 60
Name | Description |
---|---|
value_type |
Name | Description |
---|---|
parse |
using value_type = params_encoded_view ;
Declared in file <boost/url/rfc/query_rule.hpp> at line 62
result<value_type>
parse(
const char*& it,
const char* end) noexcept;
Declared in file <src/rfc/query_rule.cpp> at line 22
A modifiable container for a URL.
template<
size_t Capacity>
class static_url
: public static_url_base;
Declared in file <boost/url/static_url.hpp> at line 107
Name | Description |
---|---|
digest | |
size | Return the number of characters in the url |
empty | Return true if the url is empty |
data | Return a pointer to the url's character buffer |
buffer | Return the url string |
operator string_view | Return the URL as a core::string_view |
persist | Return a shared, persistent copy of the url |
has_scheme | Return true a scheme is present |
scheme | Return the scheme |
scheme_id | Return the scheme |
has_authority | Return true if an authority is present |
authority | Return the authority |
encoded_authority | Return the authority. |
has_userinfo | Return true if a userinfo is present |
has_password | Return true if a password is present |
userinfo | Return the userinfo |
encoded_userinfo | Return the userinfo |
user | Return the user |
encoded_user | Return the user |
password | Return the password |
encoded_password | Return the password |
host_type | Return the host type |
host | Return the host |
encoded_host | Return the host |
host_address | Return the host |
encoded_host_address | Return the host |
host_ipv4_address | Return the host IPv4 address |
host_ipv6_address | Return the host IPv6 address |
host_ipvfuture | Return the host IPvFuture address |
host_name | Return the host name |
encoded_host_name | Return the host name |
zone_id | Return the IPv6 Zone ID |
encoded_zone_id | Return the IPv6 Zone ID |
has_port | Return true if a port is present |
port | Return the port |
port_number | Return the port |
is_path_absolute | Return true if the path is absolute |
path | Return the path |
encoded_path | Return the path |
segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
has_query | Return true if a query is present |
query | Return the query |
encoded_query | Return the query |
params | Return the query as a container of parameters |
params | |
encoded_params | Return the query as a container of parameters |
has_fragment | Return true if a fragment is present |
fragment | Return the fragment |
encoded_fragment | Return the fragment |
encoded_host_and_port | Return the host and port |
encoded_origin | Return the origin |
encoded_resource | Return the resource |
encoded_target | Return the target |
compare | Return the result of comparing this with another url |
c_str | Return the url as a null-terminated string |
capacity | Return the number of characters that can be stored without reallocating |
clear | Clear the contents while preserving the capacity |
reserve | Adjust the capacity without changing the size |
set_scheme | Set the scheme |
set_scheme_id | |
remove_scheme | Remove the scheme |
set_encoded_authority | Set the authority |
remove_authority | Remove the authority |
set_userinfo | Set the userinfo |
set_encoded_userinfo | Set the userinfo. |
remove_userinfo | Remove the userinfo |
set_user | Set the user |
set_encoded_user | Set the user |
set_password | Set the password. |
set_encoded_password | Set the password. |
remove_password | Remove the password |
set_host | Set the host |
set_encoded_host | Set the host |
set_host_address | Set the host to an address |
set_encoded_host_address | Set the host to an address |
set_host_ipv4 | Set the host to an address |
set_host_ipv6 | Set the host to an address |
set_host_ipvfuture | Set the host to an address |
set_host_name | Set the host to a name |
set_encoded_host_name | Set the host to a name |
set_port_number | Set the port |
set_port | Set the port |
remove_port | Remove the port |
set_path_absolute | Set if the path is absolute |
set_path | Set the path. |
set_encoded_path | Set the path. |
segments | Return the path as a container of segments |
segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
set_query | Set the query |
set_encoded_query | Set the query |
params | Return the query as a container of parameters |
params | url_view_base::params |
params | Return the query as a container of parameters |
encoded_params | Return the query as a container of parameters |
encoded_params | Return the query as a container of parameters |
set_params | Set the query params |
set_encoded_params | Set the query params |
remove_query | Remove the query |
remove_fragment | Remove the fragment |
set_fragment | Set the fragment. |
set_encoded_fragment | Set the fragment. |
remove_origin | Remove the origin component |
normalize | Normalize the URL components |
normalize_scheme | Normalize the URL scheme |
normalize_authority | Normalize the URL authority |
normalize_path | Normalize the URL path |
normalize_query | Normalize the URL query |
normalize_fragment | Normalize the URL fragment |
resolve | Resolve a URL reference against this base URL |
~static_url | Destructor |
static_url | Constructor |
static_url | Constructor |
static_url | Constructor |
static_url | Constructor |
operator= | Assignment |
operator= | Assignment |
set_scheme | Set the scheme |
set_scheme_id | url_base::set_scheme_id |
remove_scheme | Remove the scheme |
set_encoded_authority | Set the authority |
remove_authority | Remove the authority |
set_userinfo | Set the userinfo |
set_encoded_userinfo | Set the userinfo. |
remove_userinfo | Remove the userinfo |
set_user | Set the user |
set_encoded_user | Set the user |
set_password | Set the password. |
set_encoded_password | Set the password. |
remove_password | Remove the password |
set_host | Set the host |
set_encoded_host | Set the host |
set_host_address | Set the host to an address |
set_encoded_host_address | Set the host to an address |
set_host_ipv4 | Set the host to an address |
set_host_ipv6 | Set the host to an address |
set_host_ipvfuture | Set the host to an address |
set_host_name | Set the host to a name |
set_encoded_host_name | Set the host to a name |
set_port_number | Set the port |
set_port | Set the port |
remove_port | Remove the port |
set_path | Set the path. |
set_encoded_path | Set the path. |
set_query | Set the query |
set_encoded_query | Set the query |
remove_query | Remove the query |
remove_fragment | Remove the fragment |
set_fragment | Set the fragment. |
set_encoded_fragment | Set the fragment. |
remove_origin | Remove the origin component |
normalize | Normalize the URL components |
normalize_scheme | Normalize the URL scheme |
normalize_authority | Normalize the URL authority |
normalize_path | Normalize the URL path |
normalize_query | Normalize the URL query |
normalize_fragment | Normalize the URL fragment |
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.
static_url< 1024 > u( "https://www.example.com" );
this->capacity() == Capacity
Destructor
void
~static_url();
Declared in file <boost/url/static_url.hpp> at line 130
Any params, segments, iterators, or views which reference this object are invalidated. The underlying character buffer is destroyed, invalidating all references to it.
Constructor
void
static_url() noexcept;
Declared in file <boost/url/static_url.hpp> at line 165
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.
static_url< 1024 > u;
this->empty() == true
Constant.
Throws nothing.
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
Constructor
void
static_url(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 217
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.
static_url< 1024 > u( "https://www.example.com" );
return static_url( parse_uri_reference( s ).value() );
this->buffer().data() != s.data()
Linear in `s.size()`.
Exceptions thrown on invalid input.
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
relative-ref = relative-part [ "?" query ] [ "#" fragment ]
Constructor
void
static_url(
const static_url& u) noexcept;
Declared in file <boost/url/static_url.hpp> at line 243
The newly constructed object contains a copy of `u`.
this->buffer() == u.buffer() && this->buffer.data() != u.buffer().data()
Linear in `u.size()`.
Exception thrown if maximum size exceeded.
Constructor
void
static_url(
const url_view_base& u);
Declared in file <boost/url/static_url.hpp> at line 271
The newly constructed object contains a copy of `u`.
this->buffer() == u.buffer() && this->buffer.data() != u.buffer().data()
Linear in `u.size()`.
Exception thrown if capacity exceeded.
Assignment
static_url&
operator=(
const static_url& u) noexcept;
Declared in file <boost/url/static_url.hpp> at line 298
The contents of `u` are copied and the previous contents of `this` are discarded. Capacity remains unchanged.
this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data()
Linear in `u.size()`.
Throws nothing.
Assignment
static_url&
operator=(
const url_view_base& u);
Declared in file <boost/url/static_url.hpp> at line 330
The contents of `u` are copied and the previous contents of `this` are discarded.
this->buffer() == u.buffer() && this->buffer().data() != u.buffer().data()
Linear in `u.size()`.
Strong guarantee. Exception thrown if capacity exceeded.
Set the scheme
static_url&
set_scheme(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 345
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.
assert( url( "http://www.example.com" ).set_scheme( "https" ).scheme_id() == scheme::https );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
url_base::set_scheme_id
static_url&
set_scheme_id(
scheme id);
Declared in file <boost/url/static_url.hpp> at line 347
Remove the scheme
This function removes the scheme if it is present.
assert( url("http://www.example.com/index.htm" ).remove_scheme().buffer() == "//www.example.com/index.htm" );
this->has_scheme() == false && this->scheme_id() == scheme::none
Linear in `this->size()`.
Throws nothing.
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
Set the authority
static_url&
set_encoded_authority(
pct_string_view s);
Declared in file <boost/url/static_url.hpp> at line 352
This function sets the authority to the specified string. The string may contain percent-escapes.
assert( url().set_encoded_authority( "My%20Computer" ).has_authority() );
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
authority = [ userinfo "@" ] host [ ":" port ]
userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
host = IP-literal / IPv4address / reg-name
port = *DIGIT
Remove the authority
This function removes the authority, which includes the userinfo, host, and a port if present.
assert( url( "http://example.com/echo.cgi" ).remove_authority().buffer() == "http:/echo.cgi" );
this->has_authority() == false && this->has_userinfo() == false && this->has_port() == false
Linear in `this->size()`.
Throws nothing.
authority = [ userinfo "@" ] host [ ":" port ]
userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
host = IP-literal / IPv4address / reg-name
port = *DIGIT
Set the userinfo
static_url&
set_userinfo(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 357
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:
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url( "http://example.com" ).set_userinfo( "user:pass" ).encoded_user() == "user" );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the userinfo.
static_url&
set_encoded_userinfo(
pct_string_view s);
Declared in file <boost/url/static_url.hpp> at line 359
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:
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url( "http://example.com" ).set_encoded_userinfo( "john%20doe" ).user() == "john doe" );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Remove the userinfo
static_url&
remove_userinfo() noexcept;
Declared in file <boost/url/static_url.hpp> at line 361
This function removes the userinfo if present, without removing any authority.
assert( url( "http://user@example.com" ).remove_userinfo().has_userinfo() == false );
this->has_userinfo() == false && this->encoded_userinfo().empty == true
Linear in `this->size()`.
Throws nothing.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the user
static_url&
set_user(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 363
This function sets the user part of the userinfo to the string. Any special or reserved characters in the string are automatically percent-encoded.
assert( url().set_user("john doe").encoded_userinfo() == "john%20doe" );
this->has_authority() == true && this->has_userinfo() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the user
static_url&
set_encoded_user(
pct_string_view s);
Declared in file <boost/url/static_url.hpp> at line 365
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.
assert( url().set_encoded_user("john%20doe").userinfo() == "john doe" );
this->has_authority() == true && this->has_userinfo() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the password.
static_url&
set_password(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 367
This function sets the password in the userinfo to the string. Reserved characters in the string are percent-escaped in the result.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url("http://user@example.com").set_password( "pass" ).encoded_userinfo() == "user:pass" );
this->has_password() == true && this->password() == s
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the password.
static_url&
set_encoded_password(
pct_string_view s);
Declared in file <boost/url/static_url.hpp> at line 369
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.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url("http://user@example.com").set_encoded_password( "pass" ).encoded_userinfo() == "user:pass" );
this->has_password() == true
Strong guarantee. Calls to allocate may throw.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Remove the password
static_url&
remove_password() noexcept;
Declared in file <boost/url/static_url.hpp> at line 371
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.
The interpretation of the userinfo as individual user and password components is scheme-dependent. Transmitting passwords in URLs is deprecated.
assert( url( "http://user:pass@example.com" ).remove_password().authority().buffer() == "user@example.com" );
this->has_password() == false && this->encoded_password().empty() == true
Linear in `this->size()`.
Throws nothing.
userinfo = [ [ user ] [ ':' password ] ]
user = *( unreserved / pct-encoded / sub-delims )
password = *( unreserved / pct-encoded / sub-delims / ":" )
Set the host
static_url&
set_host(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 374
Depending on the contents of the passed string, this function sets the host:
In all cases, when this function returns, the URL contains an authority.
assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );
this->has_authority() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Set the host
static_url&
set_encoded_host(
pct_string_view s);
Declared in file <boost/url/static_url.hpp> at line 376
Depending on the contents of the passed string, this function sets the host:
In all cases, when this function returns, the URL contains an authority.
assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );
this->has_authority() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / "-" / ".")
Set the host to an address
static_url&
set_host_address(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 378
Depending on the contents of the passed string, this function sets the host:
In all cases, when this function returns, the URL contains an authority.
assert( url( "http://www.example.com" ).set_host_address( "127.0.0.1" ).buffer() == "http://127.0.0.1" );
this->has_authority() == true
Linear in `s.size()`.
Strong guarantee. Calls to allocate may throw.
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 / "-" / ".")
Set the host to an address
static_url&
set_encoded_host_address(
pct_string_view s);
Declared in file <boost/url/static_url.hpp> at line 380
Depending on the contents of the passed string, this function sets the host:
In all cases, when this function returns, the URL contains an authority.
assert( url( "http://www.example.com" ).set_host( "127.0.0.1" ).buffer() == "http://127.0.0.1" );
this->has_authority() == true
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
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 / "-" / ".")
Set the host to an address
static_url&
set_host_ipv4(
const ipv4_address& addr);
Declared in file <boost/url/static_url.hpp> at line 382
The host is set to the specified IPv4 address. The host type is host_type::ipv4.
assert( url("http://www.example.com").set_host_ipv4( ipv4_address( "127.0.0.1" ) ).buffer() == "http://127.0.0.1" );
Linear in `this->size()`.
this->has_authority() == true && this->host_ipv4_address() == addr && this->host_type() == host_type::ipv4
Strong guarantee. Calls to allocate may throw.
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
Set the host to an address
static_url&
set_host_ipv6(
const ipv6_address& addr);
Declared in file <boost/url/static_url.hpp> at line 384
The host is set to the specified IPv6 address. The host type is host_type::ipv6.
assert( url().set_host_ipv6( ipv6_address( "1::6:c0a8:1" ) ).authority().buffer() == "[1::6:c0a8:1]" );
this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::ipv6
Linear in `this->size()`.
Strong guarantee. Calls to allocate may throw.
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
Set the host to an address
static_url&
set_host_ipvfuture(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 386
The host is set to the specified IPvFuture string. The host type is host_type::ipvfuture.
assert( url().set_host_ipvfuture( "v42.bis" ).buffer() == "//[v42.bis]" );
Linear in `this->size() + s.size()`.
this->has_authority() == true && this->host_ipvfuture) == s && this->host_type() == host_type::ipvfuture
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
Set the host to a name
static_url&
set_host_name(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 388
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.
assert( url( "http://www.example.com/index.htm").set_host_name( "localhost" ).host_address() == "localhost" );
this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name
Strong guarantee. Calls to allocate may throw.
reg-name = *( unreserved / pct-encoded / "-" / ".")
Set the host to a name
static_url&
set_encoded_host_name(
pct_string_view s);
Declared in file <boost/url/static_url.hpp> at line 390
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.
assert( url( "http://www.example.com/index.htm").set_encoded_host_name( "localhost" ).host_address() == "localhost" );
this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
reg-name = *( unreserved / pct-encoded / "-" / ".")
Set the port
static_url&
set_port_number(
uint16_t n);
Declared in file <boost/url/static_url.hpp> at line 392
The port is set to the specified integer.
assert( url( "http://www.example.com" ).set_port_number( 8080 ).authority().buffer() == "www.example.com:8080" );
this->has_authority() == true && this->has_port() == true && this->port_number() == n
Linear in `this->size()`.
Strong guarantee. Calls to allocate may throw.
authority = [ userinfo "@" ] host [ ":" port ]
port = *DIGIT
Set the port
static_url&
set_port(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 394
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.
assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" );
this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n)
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
port = *DIGIT
Remove the port
static_url&
remove_port() noexcept;
Declared in file <boost/url/static_url.hpp> at line 396
If a port exists, it is removed. The rest of the authority is unchanged.
assert( url( "http://www.example.com:80" ).remove_port().authority().buffer() == "www.example.com" );
this->has_port() == false && this->port_number() == 0 && this->port() == ""
Linear in `this->size()`.
Throws nothing.
authority = [ userinfo "@" ] host [ ":" port ]
port = *DIGIT
Set the path.
static_url&
set_path(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 401
This function sets the path to the string, which may be empty. Reserved characters in the string are percent-escaped in the result.
The library may adjust the final result to ensure that no other parts of the url is semantically affected.
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.
url u( "http://www.example.com" );
u.set_path( "path/to/file.txt" );
assert( u.path() == "/path/to/file.txt" );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
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
Set the path.
static_url&
set_encoded_path(
pct_string_view s);
Declared in file <boost/url/static_url.hpp> at line 403
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.
The library may adjust the final result to ensure that no other parts of the url is semantically affected.
url u( "http://www.example.com" );
u.set_encoded_path( "path/to/file.txt" );
assert( u.encoded_path() == "/path/to/file.txt" );
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
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
Set the query
static_url&
set_query(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 406
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.
assert( url( "http://example.com" ).set_query( "id=42" ).query() == "id=42" );
this->has_query() == true && this->query() == s
Strong guarantee. Calls to allocate may throw.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Set the query
static_url&
set_encoded_query(
pct_string_view s);
Declared in file <boost/url/static_url.hpp> at line 408
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.
assert( url( "http://example.com" ).set_encoded_query( "id=42" ).encoded_query() == "id=42" );
this->has_query() == true && this->query() == decode_view( s );
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Remove the query
static_url&
remove_query() noexcept;
Declared in file <boost/url/static_url.hpp> at line 410
If a query is present, it is removed. An empty query is distinct from having no query.
assert( url( "http://www.example.com?id=42" ).remove_query().buffer() == "http://www.example.com" );
this->has_query() == false && this->params().empty()
Throws nothing.
query = *( pchar / "/" / "?" )
query-param = key [ "=" value ]
query-params = [ query-param ] *( "&" query-param )
Remove the fragment
static_url&
remove_fragment() noexcept;
Declared in file <boost/url/static_url.hpp> at line 413
This function removes the fragment. An empty fragment is distinct from having no fragment.
assert( url( "?first=john&last=doe#anchor" ).remove_fragment().buffer() == "?first=john&last=doe" );
this->has_fragment() == false && this->encoded_fragment() == ""
Constant.
Throws nothing.
fragment = *( pchar / "/" / "?" )
Set the fragment.
static_url&
set_fragment(
string_view s);
Declared in file <boost/url/static_url.hpp> at line 415
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.
assert( url("?first=john&last=doe" ).set_encoded_fragment( "john doe" ).encoded_fragment() == "john%20doe" );
this->has_fragment() == true && this->fragment() == s
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw.
fragment = *( pchar / "/" / "?" )
Set the fragment.
static_url&
set_encoded_fragment(
pct_string_view s);
Declared in file <boost/url/static_url.hpp> at line 417
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.
assert( url("?first=john&last=doe" ).set_encoded_fragment( "john%2Ddoe" ).fragment() == "john-doe" );
this->has_fragment() == true && this->fragment() == decode_view( s )
Linear in `this->size() + s.size()`.
Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.
fragment = *( pchar / "/" / "?" )
Remove the origin component
This function removes the origin, which consists of the scheme and authority.
assert( url( "http://www.example.com/index.htm" ).remove_origin().buffer() == "/index.htm" );
this->scheme_id() == scheme::none && this->has_authority() == false
Linear in `this->size()`.
Throws nothing.
Normalize the URL components
Applies Syntax-based normalization to all components of the URL.
Strong guarantee. Calls to allocate may throw.
Normalize the URL scheme
Applies Syntax-based normalization to the URL scheme.
The scheme is normalized to lowercase.
Strong guarantee. Calls to allocate may throw.
Normalize the URL authority
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.
Strong guarantee. Calls to allocate may throw.
Normalize the URL path
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.
Strong guarantee. Calls to allocate may throw.
Normalize the URL query
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.
Strong guarantee. Calls to allocate may throw.
Normalize the URL fragment
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.
Strong guarantee. Calls to allocate may throw.
Common implementation for all static URLs
class static_url_base
: public url_base;
Declared in file <boost/url/static_url.hpp> at line 52
Name | Description |
---|---|
digest | |
size | Return the number of characters in the url |
empty | Return true if the url is empty |
data | Return a pointer to the url's character buffer |
buffer | Return the url string |
operator string_view | Return the URL as a core::string_view |
persist | Return a shared, persistent copy of the url |
has_scheme | Return true a scheme is present |
scheme | Return the scheme |
scheme_id | Return the scheme |
has_authority | Return true if an authority is present |
authority | Return the authority |
encoded_authority | Return the authority. |
has_userinfo | Return true if a userinfo is present |
has_password | Return true if a password is present |
userinfo | Return the userinfo |
encoded_userinfo | Return the userinfo |
user | Return the user |
encoded_user | Return the user |
password | Return the password |
encoded_password | Return the password |
host_type | Return the host type |
host | Return the host |
encoded_host | Return the host |
host_address | Return the host |
encoded_host_address | Return the host |
host_ipv4_address | Return the host IPv4 address |
host_ipv6_address | Return the host IPv6 address |
host_ipvfuture | Return the host IPvFuture address |
host_name | Return the host name |
encoded_host_name | Return the host name |
zone_id | Return the IPv6 Zone ID |
encoded_zone_id | Return the IPv6 Zone ID |
has_port | Return true if a port is present |
port | Return the port |
port_number | Return the port |
is_path_absolute | Return true if the path is absolute |
path | Return the path |
encoded_path | Return the path |
segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
has_query | Return true if a query is present |
query | Return the query |
encoded_query | Return the query |
params | Return the query as a container of parameters |
params | |
encoded_params | Return the query as a container of parameters |
has_fragment | Return true if a fragment is present |
fragment | Return the fragment |
encoded_fragment | Return the fragment |
encoded_host_and_port | Return the host and port |
encoded_origin | Return the origin |
encoded_resource | Return the resource |
encoded_target | Return the target |
compare | Return the result of comparing this with another url |
c_str | Return the url as a null-terminated string |
capacity | Return the number of characters that can be stored without reallocating |
clear | Clear the contents while preserving the capacity |
reserve | Adjust the capacity without changing the size |
set_scheme | Set the scheme |
set_scheme_id | |
remove_scheme | Remove the scheme |
set_encoded_authority | Set the authority |
remove_authority | Remove the authority |
set_userinfo | Set the userinfo |
set_encoded_userinfo | Set the userinfo. |
remove_userinfo | Remove the userinfo |
set_user | Set the user |
set_encoded_user | Set the user |
set_password | Set the password. |
set_encoded_password | Set the password. |
remove_password | Remove the password |
set_host | Set the host |
set_encoded_host | Set the host |
set_host_address | Set the host to an address |
set_encoded_host_address | Set the host to an address |
set_host_ipv4 | Set the host to an address |
set_host_ipv6 | Set the host to an address |
set_host_ipvfuture | Set the host to an address |
set_host_name | Set the host to a name |
set_encoded_host_name | Set the host to a name |
set_port_number | Set the port |
set_port | Set the port |
remove_port | Remove the port |
set_path_absolute | Set if the path is absolute |
set_path | Set the path. |
set_encoded_path | Set the path. |
segments | Return the path as a container of segments |
segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
encoded_segments | Return the path as a container of segments |
set_query | Set the query |
set_encoded_query | Set the query |
params | Return the query as a container of parameters |
params | url_view_base::params |
params | Return the query as a container of parameters |
encoded_params | Return the query as a container of parameters |
encoded_params | Return the query as a container of parameters |
set_params | Set the query params |
set_encoded_params | Set the query params |
remove_query | Remove the query |
remove_fragment | Remove the fragment |
set_fragment | Set the fragment. |
set_encoded_fragment | Set the fragment. |
remove_origin | Remove the origin component |
normalize | Normalize the URL components |
normalize_scheme | Normalize the URL scheme |
normalize_authority | Normalize the URL authority |
normalize_path | Normalize the URL path |
normalize_query | Normalize the URL query |
normalize_fragment | Normalize the URL fragment |
resolve | Resolve a URL reference against this base URL |
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.
Name | Description |
---|---|
is_error_code_enum | |
is_error_code_enum | |
is_error_condition_enum |
template<>
struct is_error_code_enum<error> ;
Declared in file <boost/url/impl/error.hpp> at line 20
const bool value ;
Declared in file <boost/url/impl/error.hpp> at line 22
template<>
struct is_error_code_enum<error> ;
Declared in file <boost/url/grammar/impl/error.hpp> at line 18
const bool value ;
Declared in file <boost/url/grammar/impl/error.hpp> at line 21
template<>
struct is_error_condition_enum<condition> ;
Declared in file <boost/url/grammar/impl/error.hpp> at line 24
const bool value ;
Declared in file <boost/url/grammar/impl/error.hpp> at line 27
struct is_nothrow_copy_constructible
: __is_nothrow_constructible_impl<_Tp, __add_lval_ref_t<const _Tp>>;
Declared in file <type_traits> at line 1131
struct integral_constant ;
Declared in file <type_traits> at line 62
Name | Description |
---|---|
value_type | |
type |
Name | Description |
---|---|
operator value_type | |
operator() |
const _Tp value ;
Declared in file <type_traits> at line 64
typedef _Tp value_type ;
Declared in file <type_traits> at line 65
using false_type = integral_constant<bool, false> ;
Declared in file <type_traits> at line 85
template<
typename _Tp,
typename... _Args>
using __is_nothrow_constructible_impl = __bool_constant<__is_nothrow_constructible(_Tp, _Args...)> ;
Declared in file <type_traits> at line 1107
using true_type = integral_constant<bool, true> ;
Declared in file <type_traits> at line 82
void
hash();
Declared in file <boost/url/url.hpp> at line 525
void
hash(
size_t salt) noexcept;
Declared in file <boost/url/url.hpp> at line 529
size_t
operator()(
const url& u) noexcept;
Declared in file <boost/url/url.hpp> at line 535
void
hash();
Declared in file <boost/url/url_view.hpp> at line 351
void
hash(
size_t salt) noexcept;
Declared in file <boost/url/url_view.hpp> at line 355
size_t
operator()(
const url_view& u) noexcept;
Declared in file <boost/url/url_view.hpp> at line 361
template<
size_t N>
struct hash<static_url<N>> ;
Declared in file <boost/url/static_url.hpp> at line 447
Name | Description |
---|---|
hash | |
hash | |
operator= | |
hash | |
operator() |
void
hash();
Declared in file <boost/url/static_url.hpp> at line 449
void
hash(
size_t salt) noexcept;
Declared in file <boost/url/static_url.hpp> at line 453
size_t
operator()(
const static_url<N>& u) noexcept;
Declared in file <boost/url/static_url.hpp> at line 459