Boost.URL Logo

PrevUpHomeNext

pct_encoded_view

A reference to a valid, percent-encoded string.

Synopsis

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

class pct_encoded_view
Types

Name

Description

const_iterator

An iterator of constant, decoded characters.

const_reference

Type of a decoded character.

difference_type

The signed integer type used to represent differences.

iterator

An iterator of constant, decoded characters.

reference

Type of a decoded character.

size_type

The unsigned integer type used to represent size.

value_type

Type of a decoded character.

Member Functions

Name

Description

append_to

Append the range with percent-decoded applied to an existing string.

assign_to

Assign the range with percent-decoded applied to an existing string.

back

Return the last decoded character.

begin

Return an iterator to the beginning.

compare

Return the result of comparing to another string.

copy

Copy a decoded substring to another character string.

empty

Return true if the view is empty.

encoded

Return the underlying encoded character buffer.

end

Return an iterator to the end.

front

Return the first decoded character.

operator std::string

Return a std::string with percent-decoding applied.

options

Return the decode options for this view.

pct_encoded_view [constructor]

Constructor.

size

Return the number of decoded characters.

to_string

Return a std::string with percent-decoding applied.

Friends

Name

Description

operator==

Return the result of comparing s0 and s1.

operator!=

Return the result of comparing s0 and s1.

operator<

Return the result of comparing s0 and s1.

operator<=

Return the result of comparing s0 and s1.

operator>

Return the result of comparing s0 and s1.

operator>=

Return the result of comparing s0 and s1.

operator<<

Format the string with percent-decoding applied to the output stream.

Description

These views reference strings in parts of URLs or other components that are percent-encoded. The special characters (those not in the allowed character set) are stored as three character escapes that consist of a percent sign ('%') followed by a two-digit hexadecimal number of the corresponding unescaped character code, which may be part of a UTF-8 code point depending on the context. The view refers to the original character buffer and only decodes escaped sequences when needed. In particular these operations perform percent-decoding automatically without the need to allocate memory:

However, in order to access the string as a as a contiguous character buffer with with percent-decoding applied, the caller must explicitly opt-in to an operation that is potentially allocating. These operations are:

These objects can only be constructed from strings that have a valid percent-encoding, otherwise construction fails. The caller is responsible for ensuring that the lifetime of the character buffer from which the view is constructed extends unmodified until the view is no longer accessed.

Convenience header <boost/url.hpp>


PrevUpHomeNext