Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
url_base::set_user

Set the user.

Synopsis
url_base&
set_user(
    core::string_view s);
Description

This function sets the user part of the userinfo to the string. Any special or reserved characters in the string are automatically percent-encoded.

Example
assert( [link url.ref.boost__urls__url_base.url `url`]().[link url.ref.boost__urls__url_base.set_user `set_user`]( "john doe" ).[link url.ref.boost__urls__url_base.encoded_userinfo `encoded_userinfo`]() == "john%20doe" );
Postconditions
this->[link url.ref.boost__urls__url_base.has_authority `has_authority`]() == true && this->[link url.ref.boost__urls__url_base.has_userinfo `has_userinfo`]() == true
Complexity

Linear in this->size() + s.size().

Exception Safety

Strong guarantee. Calls to allocate may throw.

Parameters

Name

Description

s

The string to set.

BNF
[link url.ref.boost__urls__url_base.userinfo `userinfo`]      = [ [ [link url.ref.boost__urls__url_base.user `user`] ] [ ':' [link url.ref.boost__urls__url_base.password `password`] ] ]

[link url.ref.boost__urls__url_base.user `user`]          = *( unreserved / pct-encoded / sub-delims )
[link url.ref.boost__urls__url_base.password `password`]      = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also

remove_password, set_encoded_password, set_encoded_user, set_password.


PrevUpHomeNext