Boost.URL Logo

PrevUpHomeNext

segments_encoded

A reference-like container to modifiable URL segments.

Synopsis

Defined in header <boost/url/segments_encoded.hpp>

class segments_encoded
Types

Name

Description

const_iterator

A read-only bidirectional iterator to an encoded segment.

const_reference

A type which can represent a segment as a const reference.

difference_type

A signed integer type.

iterator

A read-only bidirectional iterator to an encoded segment.

reference

A type which can represent a segment as a const reference.

size_type

An unsigned integer type.

value_type

A type which can represent a segment as a value.

Member Functions

Name

Description

assign

Replace the contents of the container.

back

Access the last element.

begin

Return a const iterator to the first element.

clear

Remove the contents of the container.

decoded

Return this container as percent-decoded segments.

empty

Return true if the container is empty.

end

Return an iterator to the element following the last element.

erase

Erase an element.

Erase a range of elements.

front

Access the first element.

insert

Insert an element.

Insert a range of segments.

is_absolute

Returns true if this contains an absolute path.

operator=

Assignment.

Replace the contents of the container.

pop_back

Remove the last element.

push_back

Add an element to the end.

replace

segments_encoded [constructor]

Constructor.

size

Return the number of elements in the container.

Description

This class implements a RandomAccessContainer representing the path segments in a url as percent-encoded strings. Ownership of the segments is not transferred; the container references the buffer in the url. Therefore, the lifetime of the url must remain valid until this container no longer exists. Objects of this type are not constructed directly; Instead, call the corresponding non-const member function of url to obtain an instance of the container:

Example
url u = parse_relative_ref( "/path/to/file.txt" );

segments_encoded se = u.encoded_segments();

for( segments_encoded::value_type s : se )
    std::cout << s << std::endl;

The reference and const_reference nested types are defined as publicly accessible nested classes. They proxy the behavior of a reference to a percent-encoded string in the underlying URL. The primary use of these references is to provide l-values that can be returned from element-accessing operations. Any reads or writes which happen through a reference or const_reference potentially read or write the underlying url.

See Also

url.

Convenience header <boost/url.hpp>


PrevUpHomeNext