boost::urls::decode_view :: Boost Libraries Documentation

# boost::urls::decode_view

A reference to a valid, percent‐encoded string

## Synopsis

Declared in `<boost/url/decode_view.hpp>`

    class decode_view;

## 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.

## Types

Name | Description
`iterator` | An iterator of constant, decoded characters.

## Type Aliases

Name | Description
`const_iterator` | An iterator of constant, decoded characters.
`const_reference` | The reference type
`difference_type` | The signed integer type
`reference` | The reference type
`size_type` | The unsigned integer type
`value_type` | The value type

## Member Functions

Name | Description
`decode_view` [constructor] | Constructor
`back` | Return the last character
`begin` | Return an iterator to the beginning
`compare` | Return the result of comparing to another string
`empty` | Return true if the string is empty
`end` | Return an iterator to the end
`ends_with` | Checks if the string ends with the given prefix
`find` | Finds the first occurrence of character in this view
`front` | Return the first character
`options` | Return the decoding options
`remove_prefix` | Remove the first characters
`remove_suffix` | Remove the last characters
`rfind` | Finds the first occurrence of character in this view
`size` | Return the number of decoded characters
`starts_with` | Checks if the string begins with the given prefix

## Friends

Name | Description
`boost::urls::operator<<` | Format the string with percent‐decoding applied to the output stream
`boost::urls::operator>=` | Compare two decode views for greater than or equal
`boost::urls::operator>=` | Compare two decode views for greater than or equal
`boost::urls::operator>=` | Compare two decode views for greater than or equal
`boost::urls::operator>` | Compare two decode views for greater than
`boost::urls::operator>` | Compare two decode views for greater than
`boost::urls::operator>` | Compare two decode views for greater than
`boost::urls::operator<=` | Compare two decode views for less than or equal
`boost::urls::operator<=` | Compare two decode views for less than or equal
`boost::urls::operator<=` | Compare two decode views for less than or equal
`boost::urls::operator<` | Compare two decode views for less than
`boost::urls::operator<` | Compare two decode views for less than
`boost::urls::operator<` | Compare two decode views for less than
`boost::urls::operator!=` | Compare two decode views for inequality
`boost::urls::operator!=` | Compare two decode views for inequality
`boost::urls::operator!=` | Compare two decode views for inequality
`boost::urls::operator==` | Compare two decode views for equality
`boost::urls::operator==` | Compare two decode views for equality
`boost::urls::operator==` | Compare two decode views for equality

Created with MrDocs