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_toperator= (query_string_params_t &&)=default
 
 query_string_params_t (const query_string_params_t &)=delete
 
query_string_params_toperator= (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_tget_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_tm_tag
 Tag (or web beacon) part. More...
 

Detailed Description

Parameters container for query strings parameters.

Definition at line 43 of file uri_helpers.hpp.

Member Typedef Documentation

◆ parameters_container_t

Definition at line 46 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 50 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 59 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
inlinenoexcept

Definition at line 108 of file uri_helpers.hpp.

◆ empty()

bool restinio::query_string_params_t::empty ( ) const
inlinenoexcept

Is there any parameters?

Since
v.0.4.8

Definition at line 103 of file uri_helpers.hpp.

◆ end()

parameters_container_t::const_iterator restinio::query_string_params_t::end ( ) const
inlinenoexcept

Definition at line 114 of file uri_helpers.hpp.

◆ find_parameter()

parameters_container_t::const_iterator restinio::query_string_params_t::find_parameter ( string_view_t  key) const
inlineprivatenoexcept

Definition at line 136 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
inlineprivate

Definition at line 148 of file uri_helpers.hpp.

◆ get_param()

optional_t< string_view_t > restinio::query_string_params_t::get_param ( string_view_t  key) const
inlinenoexcept

Get the value of a parameter if it exists.

Since
v.0.4.4

Definition at line 89 of file uri_helpers.hpp.

◆ has()

bool restinio::query_string_params_t::has ( string_view_t  key) const
inlinenoexcept

Check parameter.

Definition at line 81 of file uri_helpers.hpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ operator[]()

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

Get parameter.

Definition at line 74 of file uri_helpers.hpp.

◆ size()

auto restinio::query_string_params_t::size ( ) const
inlinenoexcept

Get the size of parameters.

Examples:
sample/express_router_tutorial/main.cpp, and sample/query_string_params/main.cpp.

Definition at line 99 of file uri_helpers.hpp.

◆ tag()

auto restinio::query_string_params_t::tag ( ) const
inlinenoexcept

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 132 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 164 of file uri_helpers.hpp.

◆ m_parameters

parameters_container_t restinio::query_string_params_t::m_parameters
private

Definition at line 165 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 169 of file uri_helpers.hpp.


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