RESTinio

Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
restinio::query_string_params_t Class Referencefinal

Parameters container for query strings parameters. More...

`#include <uri_helpers.hpp>`

## Public Types
using | parameters_container_t = std::vector< std::pair< string_view_t, string_view_t > >

## Public Member Functions
| query_string_params_t (std::unique_ptr< char[] > data_buffer, parameters_container_t parameters)
| Constructor for the case when query string empty of contains a set of key-value pairs. More...
| query_string_params_t (std::unique_ptr< char[] > data_buffer, optional_t< string_view_t > tag)
| Constructor for the case when query string contains only tag (web beacon). More...
| query_string_params_t (query_string_params_t &&)=default
query_string_params_t & | operator= (query_string_params_t &&)=default
| query_string_params_t (const query_string_params_t &)=delete
query_string_params_t & | operator= (const query_string_params_t &)=delete
string_view_t | operator[] (string_view_t key) const
| Get parameter. More...
bool | has (string_view_t key) const noexcept
| Check parameter. More...
optional_t< string_view_t > | get_param (string_view_t key) const noexcept
| Get the value of a parameter if it exists. More...
auto | size () const noexcept
| Get the size of parameters. More...
bool | empty () const noexcept
| Is there any parameters? More...
auto | tag () const noexcept
| Get the tag (web beacon) part. More...
Iterate parameters.
parameters_container_t::const_iterator | begin () const noexcept
parameters_container_t::const_iterator | end () const noexcept

## Private Member Functions
parameters_container_t::const_iterator | find_parameter (string_view_t key) const noexcept
parameters_container_t::const_reference | find_parameter_with_check (string_view_t key) const

## Private Attributes
std::unique_ptr< char[] > | m_data_buffer
| Shared buffer for string_view of named parameterts names. More...
parameters_container_t | m_parameters
optional_t< string_view_t > | m_tag
| Tag (or web beacon) part. More...

## Detailed Description

Parameters container for query strings parameters.

Examples
  sample/try_parse_query_string/main.cpp.

Definition at line 42 of file uri_helpers.hpp.

## Member Typedef Documentation

## ◆ parameters_container_t

using restinio::query_string_params_t::parameters_container_t = std::vector< std::pair< string_view_t, string_view_t > >

Definition at line 45 of file uri_helpers.hpp.

## Constructor & Destructor Documentation

## ◆ query_string_params_t() [1/4]

restinio::query_string_params_t::query_string_params_t | ( | std::unique_ptr< char[] > | data_buffer,
|  | parameters_container_t | parameters
| ) |  |
| inline

Constructor for the case when query string empty of contains a set of key-value pairs.

Definition at line 49 of file uri_helpers.hpp.

## ◆ query_string_params_t() [2/4]

restinio::query_string_params_t::query_string_params_t | ( | std::unique_ptr< char[] > | data_buffer,
|  | optional_t< string_view_t > | tag
| ) |  |
| inline

Constructor for the case when query string contains only tag (web beacon).

Definition at line 58 of file uri_helpers.hpp.

## ◆ query_string_params_t() [3/4]

restinio::query_string_params_t::query_string_params_t | ( | query_string_params_t && |  | ) |
| default

## ◆ query_string_params_t() [4/4]

restinio::query_string_params_t::query_string_params_t | ( | const query_string_params_t & |  | ) |
| delete

## Member Function Documentation

## ◆ begin()

parameters_container_t::const_iterator restinio::query_string_params_t::begin | ( |  | ) | const
| inline noexcept

Definition at line 107 of file uri_helpers.hpp.

## ◆ empty()

bool restinio::query_string_params_t::empty | ( |  | ) | const
| inline noexcept

Is there any parameters?

Since
  v.0.4.8

Definition at line 102 of file uri_helpers.hpp.

## ◆ end()

parameters_container_t::const_iterator restinio::query_string_params_t::end | ( |  | ) | const
| inline noexcept

Definition at line 113 of file uri_helpers.hpp.

## ◆ find_parameter()

parameters_container_t::const_iterator restinio::query_string_params_t::find_parameter | ( | string_view_t | key | ) | const
| inline private noexcept

Definition at line 135 of file uri_helpers.hpp.

## ◆ find_parameter_with_check()

parameters_container_t::const_reference restinio::query_string_params_t::find_parameter_with_check | ( | string_view_t | key | ) | const
| inline private

Definition at line 147 of file uri_helpers.hpp.

## ◆ get_param()

optional_t< string_view_t > restinio::query_string_params_t::get_param | ( | string_view_t | key | ) | const
| inline noexcept

Get the value of a parameter if it exists.

Since
  v.0.4.4

Definition at line 88 of file uri_helpers.hpp.

## ◆ has()

bool restinio::query_string_params_t::has | ( | string_view_t | key | ) | const
| inline noexcept

Check parameter.

Definition at line 80 of file uri_helpers.hpp.

## ◆ operator=() [1/2]

query_string_params_t & restinio::query_string_params_t::operator= | ( | const query_string_params_t & |  | ) |
| delete

## ◆ operator=() [2/2]

query_string_params_t & restinio::query_string_params_t::operator= | ( | query_string_params_t && |  | ) |
| default

## ◆ operator[]()

string_view_t restinio::query_string_params_t::operator[] | ( | string_view_t | key | ) | const
| inline

Get parameter.

Definition at line 73 of file uri_helpers.hpp.

## ◆ size()

auto restinio::query_string_params_t::size | ( |  | ) | const
| inline noexcept

Get the size of parameters.

Definition at line 98 of file uri_helpers.hpp.

## ◆ tag()

auto restinio::query_string_params_t::tag | ( |  | ) | const
| inline noexcept

Get the tag (web beacon) part.

A value of "tag" (also known as web beacon) is available only if URI looks like that:

    http://example.com/resource?value

In that case tag will contain `value`. For URI with different formats tag() will return empty optional.

Since
  v.0.4.9

Definition at line 131 of file uri_helpers.hpp.

## Member Data Documentation

## ◆ m_data_buffer

std::unique_ptr< char[] > restinio::query_string_params_t::m_data_buffer
| private

Shared buffer for string_view of named parameterts names.

Definition at line 163 of file uri_helpers.hpp.

## ◆ m_parameters

parameters_container_t restinio::query_string_params_t::m_parameters
| private

Definition at line 164 of file uri_helpers.hpp.

## ◆ m_tag

optional_t< string_view_t > restinio::query_string_params_t::m_tag
| private

Tag (or web beacon) part.

Since
  v.0.4.9

Definition at line 168 of file uri_helpers.hpp.

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

- restinio/uri_helpers.hpp