Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
url::set_user

Set the user.

Synopsis
url&
set_user(
    string_view s);
Description

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

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

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

Exception Safety

Strong guarantee. Calls to allocate may throw.

Parameters

Name

Description

s

The string to set.

BNF
userinfo      = [ [ user ] [ ':' password ] ]

user          = *( unreserved / pct-encoded / sub-delims )
password      = *( unreserved / pct-encoded / sub-delims / ":" )
Specification
See Also

remove_password, set_encoded_password, set_encoded_user, set_password.


PrevUpHomeNext