RESTinio
Loading...
Searching...
No Matches
restinio::easy_parser::impl::transformed_value_producer_traits_checker< Producer, Transformer > Struct Template Reference

A metafunction that checks is Result_Type can be used as the result of transformation method. More...

#include <easy_parser.hpp>

Public Types

using producer_result_t
using transformation_result_t
using expected_result_t = typename Transformer::result_type

Static Public Attributes

static constexpr bool is_valid_transformation_result_type

Detailed Description

template<typename Producer, typename Transformer>
struct restinio::easy_parser::impl::transformed_value_producer_traits_checker< Producer, Transformer >

A metafunction that checks is Result_Type can be used as the result of transformation method.

A transformation method can return a value of type T or a value of type expected_t<T, error_reason_t>. But a user can define transformation method that returns an expected_t<T, parse_error_t> just by a mistake. That mistake should be detected.

Metafunction is_appropriate_transformer_result_type serves that purpose: it defines value to true if transformation method returns T or expected_t<T, error_reason_t>. In the case of expected_t<T, parse_error_t> value will be set to `false.

Since
v.0.6.11 */ template< typename Result_Type > struct is_appropriate_transformer_result_type { static constexpr bool value = true; };

template< typename Result_Type > struct is_appropriate_transformer_result_type< expected_t< Result_Type, error_reason_t > > { static constexpr bool value = true; };

template< typename Result_Type > struct is_appropriate_transformer_result_type< expected_t< Result_Type, parse_error_t > > { static constexpr bool value = false; };

transformed_value_producer_traits_checker

/*!

A helper template for checking a possibility to connect a producer with a transformer.

This helper can be seen as a metafunction that defines a boolean value is_valid_transformation_result_type. If that value is true then Transformer::transform method returns allowed type (T or expected_t<T, error_reson_t>).

Since
v.0.6.11

Definition at line 1147 of file easy_parser.hpp.

Member Typedef Documentation

◆ expected_result_t

template<typename Producer, typename Transformer>
using restinio::easy_parser::impl::transformed_value_producer_traits_checker< Producer, Transformer >::expected_result_t = typename Transformer::result_type

Definition at line 1163 of file easy_parser.hpp.

◆ producer_result_t

template<typename Producer, typename Transformer>
using restinio::easy_parser::impl::transformed_value_producer_traits_checker< Producer, Transformer >::producer_result_t
Initial value:
std::decay_t< decltype(
std::declval<Producer &>().try_parse( std::declval<source_t &>() )
) >

Definition at line 1154 of file easy_parser.hpp.

◆ transformation_result_t

template<typename Producer, typename Transformer>
using restinio::easy_parser::impl::transformed_value_producer_traits_checker< Producer, Transformer >::transformation_result_t
Initial value:
std::decay_t< decltype(
std::declval<Transformer &>().transform(
std::move(*(std::declval<producer_result_t>())) )
) >

Definition at line 1158 of file easy_parser.hpp.

Member Data Documentation

◆ is_valid_transformation_result_type

template<typename Producer, typename Transformer>
bool restinio::easy_parser::impl::transformed_value_producer_traits_checker< Producer, Transformer >::is_valid_transformation_result_type
staticconstexpr
Initial value:
=
is_appropriate_transformer_result_type< expected_result_t >::value

Definition at line 1165 of file easy_parser.hpp.


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