Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
static_url::set_port_number

Set the port.

Synopsis
static_url&
set_port_number(
    std::uint16_t n);
Description

The port is set to the specified integer.

Example
assert( url( "http://www.example.com" ).[link url.ref.boost__urls__static_url.set_port_number `set_port_number`]( 8080 ).[link url.ref.boost__urls__static_url.authority `authority`]().[link url.ref.boost__urls__static_url.buffer `buffer`]() == "www.example.com:8080" );
Postconditions
this->[link url.ref.boost__urls__static_url.has_authority `has_authority`]() == true && this->[link url.ref.boost__urls__static_url.has_port `has_port`]() == true && this->[link url.ref.boost__urls__static_url.port_number `port_number`]() == n
Complexity

Linear in this->size().

Exception Safety

Strong guarantee. Calls to allocate may throw.

Parameters

Name

Description

n

The port number to set.

BNF
[link url.ref.boost__urls__static_url.authority `authority`]     = [ [link url.ref.boost__urls__static_url.userinfo `userinfo`] "@" ] [link url.ref.boost__urls__static_url.host `host`] [ ":" [link url.ref.boost__urls__static_url.port `port`] ]

[link url.ref.boost__urls__static_url.port `port`]          = *DIGIT
Specification
See Also

remove_port, /root/project/libs/url/include/boost/url/static_url.hpp


PrevUpHomeNext