ゴミ箱
Classes | Public Types | Public Member Functions | List of all members
boost::beast::http::ext_list Class Reference

#include <rfc7230.hpp>

Classes

class  const_iterator
 

Public Types

using value_type = std::pair< string_view, param_list >
 

Public Member Functions

 ext_list (string_view s)
 
const_iterator begin () const
 Return a const iterator to the beginning of the list. More...
 
const_iterator end () const
 Return a const iterator to the end of the list. More...
 
const_iterator cbegin () const
 Return a const iterator to the beginning of the list. More...
 
const_iterator cend () const
 Return a const iterator to the end of the list. More...
 
template<class T >
const_iterator find (T const &s)
 
template<class T >
bool exists (T const &s)
 
template<class T >
auto find (T const &s) -> const_iterator
 

Detailed Description

A list of extensions in a comma separated HTTP field value.

This container allows iteration of the extensions in an HTTP field value. The extension list is a comma separated list of token parameter list pairs.

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
ext-list = *( "," OWS ) ext *( OWS "," [ OWS ext ] )
ext = token param-list
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& ext : ext_list{"none, 7z;level=9, zip;no_context_takeover;bits=15"})
{
std::cout << ext.first << "\n";
for(auto const& param : ext.second)
{
std::cout << ";" << param.first;
if(! param.second.empty())
std::cout << "=" << param.second;
std::cout << "\n";
}
}

Member Typedef Documentation

The type of each element in the list.

The first element of the pair is the extension token, and the second element of the pair is an iterable container holding the extension's name/value parameters.

Constructor & Destructor Documentation

boost::beast::http::ext_list::ext_list ( string_view  s)
inlineexplicit

Construct a list.

Parameters
sA string containing the list contents. The string must remain valid for the lifetime of the container.

Member Function Documentation

auto boost::beast::http::ext_list::begin ( ) const
inline

Return a const iterator to the beginning of the list.

auto boost::beast::http::ext_list::cbegin ( ) const
inline

Return a const iterator to the beginning of the list.

auto boost::beast::http::ext_list::cend ( ) const
inline

Return a const iterator to the end of the list.

auto boost::beast::http::ext_list::end ( ) const
inline

Return a const iterator to the end of the list.

template<class T >
bool boost::beast::http::ext_list::exists ( T const &  s)

Return true if a token is present in the list.

Parameters
sThe token to find. A case-insensitive comparison is used.
template<class T >
const_iterator boost::beast::http::ext_list::find ( T const &  s)

Find a token in the list.

Parameters
sThe token to find. A case-insensitive comparison is used.
Returns
An iterator to the matching token, or end() if no token exists.
template<class T >
auto boost::beast::http::ext_list::find ( T const &  s) -> const_iterator

The documentation for this class was generated from the following files: