boost::urls::params_ref

Mutable decoded query parameter proxy

Synopsis

Declared in <boost/url/params_ref.hpp>

class params_ref
    : public params_base

Description

This container presents the decoded query parameters of a url_base as a bidirectional range whose modifying operations update the underlying URL in‐place. It references (but does not own) the character buffer, so the referenced URL must stay alive while the proxy is used.

Percent escapes in strings returned when dereferencing iterators are automatically decoded. Reserved characters in strings supplied to modifier functions are automatically percent‐escaped.

Example

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

params_ref p = u.params();

Iterator Invalidation

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

  • append : Only `end()`.

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

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

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

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

Reads vs. writes

Although this is a mutable proxy, all observer helpers inherited from params_base (such as contains, find, and get_or) operate in the same way as they do on params_view: they perform their lookup against the current contents of the referenced URL without modifying it.

Base Classes

Name Description

params_base

Decoded query parameter 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_ref [constructor]

Constructor

operator=

Assignment

append

Append elements

assign

Assign elements

begin

Return an iterator to the beginning

buffer

Return the referenced character buffer.

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 elements

find

Find a matching key

find_last

Find a matching key

get_or

Return the value for a key or a fallback

insert

Insert elements

replace

Replace elements

set

Set a value

size

Return the number of params

unset

Remove the value on an element

url

Return the referenced url

operator params_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

Created with MrDocs