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 a snapshot of the develop branch, built from commit f5a2dc2871.
PrevUpHomeNext
url::set_encoded_path

Set the path.

Synopsis
url&
set_encoded_path(
    pct_string_view s);
Description

This function sets the path to the string, which may contain percent-escapes and can be empty. Escapes in the string are preserved, and reserved characters in the string are percent-escaped in the result.

Remarks

The library may adjust the final result to ensure that no other parts of the url is semantically affected.

Example
url u( "http://www.example.com" );

u.set_encoded_path( "path/to/file.txt" );

assert( u.encoded_path() == "/path/to/file.txt" );
Complexity

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

Exception Safety

Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input.

Exceptions

Type

Thrown On

system_error

s contains an invalid percent-encoding.

Parameters

Name

Description

s

The string to set.

BNF
path          = path-abempty    ; begins with "/" or is empty
              / path-absolute   ; begins with "/" but not "//"
              / path-noscheme   ; begins with a non-colon segment
              / path-rootless   ; begins with a segment
              / path-empty      ; zero characters

path-abempty  = *( "/" segment )
path-absolute = "/" [ segment-nz *( "/" segment ) ]
path-noscheme = segment-nz-nc *( "/" segment )
path-rootless = segment-nz *( "/" segment )
path-empty    = 0<pchar>
Specification
See Also

encoded_segments, segments, set_path, /root/project/libs/url/include/boost/url/url.hpp


PrevUpHomeNext