Boost.URL Logo

PrevUpHomeNext

segments

A container referencing a random-access range of modifiable, percent-decoded path segments.

Synopsis

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

class segments
Types

Name

Description

const_iterator

A read-only bidirectional iterator to a decoded segment.

const_reference

A type which can represent a segment as a reference.

difference_type

A signed integer type.

iterator

A read-only bidirectional iterator to a decoded segment.

reference

A type which can represent a segment as a 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 an iterator to the first element.

clear

Remove the contents of the container.

empty

Check if the path has no segments.

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 [constructor]

Constructor.

size

Return the number of elements in the array.

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 se = u.segments();

for( segments::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