boost::urls::params_encoded_ref

Mutable encoded query parameter proxy

Synopsis

class params_encoded_ref
    : public params_encoded_base

Base Classes

Name Description

params_encoded_base

Percent‐encoded query helper base

Types

Name

Description

iterator

A Bidirectional iterator to a query parameter

const_iterator

A Bidirectional iterator to a query parameter

const_reference

The reference type

difference_type

A signed integer type used to represent differences.

reference

The reference type

size_type

An unsigned integer type to represent sizes.

value_type

The value type

Member Functions

Name

Description

params_encoded_ref [constructor]

Constructor

operator=

Assignment

append

Append params

assign

Assign params

begin

Return an iterator to the beginning

buffer

Return the query corresponding to these params

clear

Clear the contents of the container

contains

Return true if a matching key exists

count

Return the number of matching keys

empty

Return true if there are no params

end

Return an iterator to the end

erase

Erase params

find

Find a matching key

find_last

Find a matching key

get_or

Return the value for a key or a fallback

insert

Insert params

replace

Replace params

set

Set a value

size

Return the number of params

unset

Remove the value on an element

url

Return the referenced url

operator params_encoded_view

Conversion

Static Member Functions

Name

Description

max_size

Return the maximum number of characters possible

Friends

Name Description

boost::urls::url_base

Common functionality for containers

Description

This container exposes the percent‐encoded query parameters of a url_base as a bidirectional range while allowing mutation of the underlying URL. It references the URL’s buffer directly, so the url must stay alive for the lifetime of the proxy.

Example

url u( "?first=John&last=Doe" );

params_encoded_ref p = u.encoded_params();

Strings produced when elements are returned have type param_pct_view and represent encoded strings. Strings passed to member functions may contain percent escapes, and throw exceptions on invalid inputs.

Iterator Invalidation

Changes to the underlying character buffer can invalidate iterators which reference it. Modifications made through the container invalidate some iterators to the underlying character buffer:

  • append : Only `end()`.

  • assign, clear, `operator=` : All params.

  • erase : Erased params and all params after (including `end()`).

  • insert : All params at or after the insertion point (including `end()`).

  • replace, set : Modified params and all params after (including `end()`).

Reads vs. writes

Even though this type can be used to mutate the referenced URL, this is still a proxy and every observer function inherited from params_encoded_base (for example contains, find, and get_or) behaves like the corresponding function on params_encoded_view: it inspects the current encoded query and does not perform any modifications.

Created with MrDocs