Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

http::param_list

A list of parameters in an HTTP extension field value.

Synopsis

Defined in header <boost/beast/http/rfc7230.hpp>

class param_list
Types

Name

Description

const_iterator

A constant iterator to the list.

value_type

The type of each element in the list.

Member Functions

Name

Description

begin

Return a const iterator to the beginning of the list.

cbegin

Return a const iterator to the beginning of the list.

cend

Return a const iterator to the end of the list.

end

Return a const iterator to the end of the list.

param_list [constructor]

Default constructor.

Construct a list.

Description

This container allows iteration of the parameter list in an HTTP extension. The parameter list is a series of name/value pairs with each pair starting with a semicolon. The value is optional.

If a parsing error is encountered while iterating the string, the behavior of the container will be as if a string containing only characters up to but excluding the first invalid character was used to construct the list.

BNF
param-list  = *( OWS ";" OWS param )
param       = token OWS [ "=" OWS ( token / quoted- string ) ]

To use this class, construct with the string to be parsed and then use begin and end, or range-for to iterate each item:

Example
for ( auto const & param : param_list{ ";level=9;no_context_takeover;bits=15" })
{
    std::cout << ";" << param.first;
    if (! param.second.empty())
        std::cout << "=" << param.second;
    std::cout << "\n" ;
}

PrevUpHomeNext