:relfileprefix: ../../
[#boost-urls-decode_view]

== xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::decode_view


A reference to a valid, percent-encoded string


=== Synopsis

Declared in header `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode_view.hpp#L87[boost/url/decode_view.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
class decode_view;
----

===  Types
[cols=2,separator=¦]
|===
¦Name ¦Description
¦xref:boost/urls/decode_view/const_iterator.adoc[`const_iterator`]  ¦

An iterator of constant, decoded characters.

¦xref:boost/urls/decode_view/const_reference.adoc[`const_reference`]  ¦

The reference type

¦xref:boost/urls/decode_view/difference_type.adoc[`difference_type`]  ¦

The signed integer type

¦xref:boost/urls/decode_view/iterator.adoc[`iterator`]  ¦

An iterator of constant, decoded characters.

¦xref:boost/urls/decode_view/reference.adoc[`reference`]  ¦

The reference type

¦xref:boost/urls/decode_view/size_type.adoc[`size_type`]  ¦

The unsigned integer type

¦xref:boost/urls/decode_view/value_type.adoc[`value_type`]  ¦

The value type

|===
===  Member Functions
[cols=2,separator=¦]
|===
¦Name ¦Description
¦xref:boost/urls/decode_view/back.adoc[`back`]  ¦

Return the last character

¦xref:boost/urls/decode_view/begin.adoc[`begin`]  ¦

Return an iterator to the beginning

¦xref:boost/urls/decode_view/compare.adoc[`compare`]  ¦

Return the result of comparing to another string

¦xref:boost/urls/decode_view/2constructor.adoc[`decode_view`] [.small]#[constructor]# ¦

Constructor

¦xref:boost/urls/decode_view/empty.adoc[`empty`]  ¦

Return true if the string is empty

¦xref:boost/urls/decode_view/end.adoc[`end`]  ¦

Return an iterator to the end

¦xref:boost/urls/decode_view/ends_with.adoc[`ends_with`]  ¦

Checks if the string ends with the given prefix

¦xref:boost/urls/decode_view/find.adoc[`find`]  ¦

Finds the first occurrence of character in this view

¦xref:boost/urls/decode_view/front.adoc[`front`]  ¦

Return the first character

¦xref:boost/urls/decode_view/options.adoc[`options`]  ¦

Return the decoding options

¦xref:boost/urls/decode_view/remove_prefix.adoc[`remove_prefix`]  ¦

Remove the first characters

¦xref:boost/urls/decode_view/remove_suffix.adoc[`remove_suffix`]  ¦

Remove the last characters

¦xref:boost/urls/decode_view/rfind.adoc[`rfind`]  ¦

Finds the first occurrence of character in this view

¦xref:boost/urls/decode_view/size.adoc[`size`]  ¦

Return the number of decoded characters

¦xref:boost/urls/decode_view/starts_with.adoc[`starts_with`]  ¦

Checks if the string begins with the given prefix

|===
===  Friends
[cols=2,separator=¦]
|===
¦Name ¦Description
¦xref:boost/urls/decode_view/08friend-04.adoc[`operator!=`]  ¦

Compare two decode views for inequality

¦xref:boost/urls/decode_view/08friend-0e.adoc[`operator<`]  ¦

Compare two decode views for less than

¦xref:boost/urls/decode_view/08friend-08.adoc[`operator<<`]  ¦

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

¦xref:boost/urls/decode_view/08friend-0c.adoc[`operator<=`]  ¦

Compare two decode views for less than or equal

¦xref:boost/urls/decode_view/08friend-0a.adoc[`operator==`]  ¦

Compare two decode views for equality

¦xref:boost/urls/decode_view/08friend-07.adoc[`operator>`]  ¦

Compare two decode views for greater than

¦xref:boost/urls/decode_view/08friend-01.adoc[`operator>=`]  ¦

Compare two decode views for greater than or equal

|===

=== 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:

* Iteration of the string

* Accessing the encoded character buffer

* Comparison to encoded or plain strings

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.

=== The following operators are supported between

xref:boost/urls/decode_view/2constructor-07.adoc[decode_view]
and any object that is convertible
to `core::string_view`
[,cpp]
----
bool operator==( decode_view, decode_view ) noexcept;
bool operator!=( decode_view, decode_view ) noexcept;
bool operator<=( decode_view, decode_view ) noexcept;
bool operator< ( decode_view, decode_view ) noexcept;
bool operator> ( decode_view, decode_view ) noexcept;
bool operator>=( decode_view, decode_view ) noexcept;
----



