restinio::easy_parser::impl Namespace Reference

## Classes

class | alternatives_clause_t
| A template for implementation of clause that selects one of alternative clauses. More...
class | and_clause_t
| A template for implementation of clause that checks the presence of some entity in the input stream. More...
class | any_symbol_if_not_producer_t
| A producer for the case when any character except the specific sentinel character is expected in the input stream. More...
struct | any_symbol_predicate_t
| A predicate that allows extraction of any symbol. More...
struct | any_value_skipper_t
| A special consumer that simply throws any value away. More...
struct | as_result_consumer_t
| A consumer for the case when the current value should be returned as the result for the producer at one level up. More...
class | caseless_exact_fixed_size_fragment_producer_t
| A producer that expects a fragment in the input and produces boolean value if that fragment is found. More...
class | caseless_exact_fragment_producer_t
| A producer that expects a fragment in the input and produces boolean value if that fragment is found. More...
struct | caseless_particular_symbol_predicate_t
| A predicate for cases where the case-insensitive match of expected and actual symbols is required. More...
class | caseless_symbol_producer_t
| A producer for the case when a particual character is expected in the input stream. More...
struct | character_t
| One character extracted from the input stream. More...
struct | clause_tag
| A special base class to be used with clauses. More...
class | consume_value_clause_t
| A template for a clause that binds a value producer with value consumer. More...
struct | consumer_tag
| A special base class to be used with consumers. More...
struct | conversion_result_type_detector
| A helper template for the detection of type to be produced as conversion procedure. More...
struct | conversion_result_type_detector< expected_t< Result_Type, error_reason_t > >
class | convert_transformer_proxy_t
| A proxy for the creation of convert_transformer instances for a specific value producers. More...
class | convert_transformer_t
| A transformator that uses a user supplied function/functor for conversion a value from one type to another. More...
class | custom_consumer_t
| A template for consumers that are released by lambda/functional objects. More...
class | decimal_number_producer_t
| A producer for the case when a signed decimal number is expected in the input stream. More...
class | decimal_number_producer_with_digits_limit_t
| A producer for the case when a signed decimal number is expected in the input stream. More...
class | digit_producer_t
| A producer for the case when a decimal digit is expected in the input stream. More...
class | exact_fixed_size_fragment_producer_t
| A producer that expects a fragment in the input and produces boolean value if that fragment is found. More...
class | exact_fragment_producer_t
| A producer that expects a fragment in the input and produces boolean value if that fragment is found. More...
class | field_setter_consumer_t
| A template for consumers that store a value to the specified field of a target object. More...
class | forced_alternative_clause_t
| An alternative that should be parsed correctly or the parsing of the whole alternatives clause should fail. More...
class | hexadecimal_number_producer_t
| A producer for the case when a number in hexadecimal form is expected in the input stream. More...
class | hexadecimal_number_producer_with_digits_limit_t
| A producer for the case when a number in hexadecimal form is expected in the input stream. More...
class | hexdigit_producer_t
| A producer for the case when a hexadecimal digit is expected in the input stream. More...
struct | is_appropriate_transformer_result_type
| A metafunction that checks is Result_Type can be used as the result of transformation method. More...
struct | is_appropriate_transformer_result_type< expected_t< Result_Type, error_reason_t > >
struct | is_appropriate_transformer_result_type< expected_t< Result_Type, parse_error_t > >
struct | is_clause
struct | is_clause< T, meta::void_t< decltype(std::decay_t< T >::entity_type) > >
struct | is_consumer
struct | is_consumer< T, meta::void_t< decltype(T::entity_type) > >
struct | is_digit_predicate_t
| A predicate for cases where char to be expected to be a decimal digit. More...
struct | is_hexdigit_predicate_t
| A predicate for cases where char to be expected to be a hexadecimal digit. More...
struct | is_producer
struct | is_producer< T, meta::void_t< decltype(T::entity_type) > >
struct | is_space_predicate_t
| A preducate for symbol_producer_template that checks that a symbol is a space. More...
struct | is_transformer
struct | is_transformer< T, meta::void_t< decltype(T::entity_type) > >
struct | is_transformer_proxy
struct | is_transformer_proxy< T, meta::void_t< decltype(T::entity_type) > >
class | just_result_consumer_t
| A consumer for the case when a specific value should be used as the result instead of the value produced on the previous step. More...
class | just_value_transformer_t
| A transformer that skips incoming value and returns a value specified by a user. More...
class | maybe_clause_t
| A template for implementation of clause that checks and handles presence of optional entity in the input stream. More...
class | non_negative_decimal_number_producer_t
| A producer for the case when a non-negative decimal number is expected in the input stream. More...
class | non_negative_decimal_number_producer_with_digits_limit_t
| A producer for the case when a non-negative decimal number is expected in the input stream. More...
class | not_clause_t
| A template for implementation of clause that checks absence of some entity in the input stream. More...
struct | not_particular_symbol_predicate_t
| A predicate for cases where mismatch with a particular symbol is required. More...
struct | particular_symbol_predicate_t
| A predicate for cases where exact match of expected and actual symbols is required. More...
class | produce_t
| A template for producing a value of specific type of a sequence of entities from the input stream. More...
struct | producer_tag
| A special base class to be used with producers. More...
class | repeat_clause_t
| A template for handling repetition of clauses. More...
class | sequence_clause_t
| A template for implementation of clause that checks and handles presence of sequence of entities in the input stream. More...
class | source_t
| The class that implements "input stream". More...
struct | std_array_wrapper
| A special wrapper for std::array type to be used inside a producer during the parsing. More...
struct | symbol_from_range_predicate_t
| A predicate for cases where a symbol should belong to specified range. More...
class | symbol_from_range_producer_t
| A producer for the case when a symbol should belong to specified range. More...
class | symbol_producer_t
| A producer for the case when a particual character is expected in the input stream. More...
class | symbol_producer_template_t
| A template for producer of charachers that satisfy some predicate. More...
struct | to_container_consumer_t
| A template for a consumer that stories values into a container. More...
struct | to_lower_transformer_proxy_t
| A proxy for the creation of an appropriate to_lower_transformer. More...
struct | to_lower_transformer_t
struct | to_lower_transformer_t< char >
| An implementation of transformer that converts the content of the input character to lower case. More...
struct | to_lower_transformer_t< std::array< char, S > >
| An implementation of transformer that converts the content of the input std::array to lower case. More...
struct | to_lower_transformer_t< std::string >
| An implementation of transformer that converts the content of the input std::string to lower case. More...
class | top_level_clause_t
| A special class to be used as the top level clause in parser. More...
class | transformed_value_producer_t
| A template of producer that gets a value from another producer, transforms it and produces transformed value. More...
struct | transformed_value_producer_traits_checker
| A helper template for checking a possibility to connect a producer with a transformer. More...
struct | transformer_invoker
| A helper template for calling transformation function. More...
struct | transformer_invoker< expected_t< Result_Type, error_reason_t > >
struct | transformer_proxy_tag
| A special base class to be used with transformer-proxies. More...
struct | transformer_tag
| A special base class to be used with transformers. More...
struct | tuple_item_consumer_t
| A consumer that stores a result value at the specified index in the result tuple. More...

## Typedefs

template<typename... Entities>
using | tuple_of_entities_t = meta::rename_t< meta::transform_t< std::decay, meta::type_list< Entities... > >, std::tuple >
| A helper meta-function to create an actual type of tuple with clauses/producers. More...
template<typename Result_Type >
using | conversion_result_type_detector_t = typename conversion_result_type_detector< Result_Type >::type

## Enumerations

enum class | entity_type_t { producer , transformer , consumer , clause , transformer_proxy }
| A marker for distinguish different kind of entities in parser. More...

## Functions

RESTINIO_NODISCARD bool | operator== (const character_t &a, const character_t &b) noexcept
RESTINIO_NODISCARD bool | operator!= (const character_t &a, const character_t &b) noexcept
RESTINIO_NODISCARD constexpr bool | is_space (const char ch) noexcept
| If a character a space character? More...
RESTINIO_NODISCARD constexpr bool | is_digit (const char ch) noexcept
| Is a character a decimal digit? More...
RESTINIO_NODISCARD constexpr bool | is_hexdigit (const char ch) noexcept
| Is a character a hexadecimal digit? More...
template<typename P , typename T >
RESTINIO_NODISCARD std::enable_if_t< is_producer_v< P > &is_transformer_v< T >, transformed_value_producer_t< P, T > > | operator>> (P producer, T transformer)
| A special operator to connect a value producer with value transformer. More...
template<typename P , typename T , typename S = std::enable_if_t< is_producer_v<P> & is_transformer_proxy_v<T>, void >>
RESTINIO_NODISCARD auto | operator>> (P producer, T transformer_proxy)
| A special operator to connect a value producer with value transformer via transformer-proxy. More...
template<typename P , typename C >
RESTINIO_NODISCARD std::enable_if_t< is_producer_v< P > &&is_consumer_v< C >, consume_value_clause_t< P, C > > | operator>> (P producer, C consumer)
| A special operator to connect a value producer with a value consumer. More...
RESTINIO_NODISCARD optional_t< parse_error_t > | ensure_no_remaining_content (source_t &from)
| A special function to check that there is no more actual data in the input stream except whitespaces. More...
RESTINIO_NODISCARD string_view_t | remove_trailing_spaces (string_view_t from) noexcept
| Helper function for removal of trailing spaces from a string-view. More...
template<typename T , typename Value_Accumulator >
RESTINIO_NODISCARD expected_t< T, parse_error_t > | try_parse_digits_with_digits_limit (source_t &from, digits_to_consume_t digits_limit, Value_Accumulator acc) noexcept
| Helper function for parsing integers with respect to the number of digits to be consumed. More...
template<typename T , typename Value_Accumulator >
RESTINIO_NODISCARD expected_t< T, parse_error_t > | try_parse_hexdigits_with_digits_limit (source_t &from, digits_to_consume_t digits_limit, Value_Accumulator acc) noexcept
| Helper function for parsing integers in hexadecimal form. More...
template<typename P , typename F , typename C >
RESTINIO_NODISCARD std::enable_if_t< is_producer_v< P >, consume_value_clause_t< P, field_setter_consumer_t< F, C > > > | operator>> (P producer, F C::*member_ptr)
| A special operator to connect a value producer with field_setter_consumer. More...
template<typename It >
RESTINIO_NODISCARD expected_t< bool, parse_error_t > | try_parse_exact_fragment (source_t &from, It begin, It end)
template<typename It >
RESTINIO_NODISCARD expected_t< bool, parse_error_t > | try_parse_caseless_exact_fragment (source_t &from, It begin, It end)

## Variables

constexpr char | SP = ' '
| A constant for SPACE value. More...
constexpr char | HTAB = '\x09'
| A constant for Horizontal Tab value. More...
template<typename T >
constexpr bool | is_producer_v = is_producer<T>::value
| A meta-value to check whether T is a producer type. More...
template<typename T >
constexpr bool | is_transformer_v = is_transformer<T>::value
| A meta-value to check whether T is a transformer type. More...
template<typename T >
constexpr bool | is_transformer_proxy_v = is_transformer_proxy<T>::value
| A meta-value to check whether T is a transformer-proxy type. More...
template<typename T >
constexpr bool | is_consumer_v = is_consumer<T>::value
| A meta-value to check whether T is a consumer type. More...
template<typename T >
constexpr bool | is_clause_v = is_clause<T>::value
| A meta-value to check whether T is a consumer type. More...

## Typedef Documentation

## conversion_result_type_detector_t

template<typename Result_Type >

using restinio::easy_parser::impl::conversion_result_type_detector_t = typedef typename conversion_result_type_detector<Result_Type>::type

A helper for simplification of usage of conversion_result_type_detector<R>.

Since
  v.0.6.11

Definition at line 3242 of file easy_parser.hpp.

## tuple_of_entities_t

template<typename... Entities>

using restinio::easy_parser::impl::tuple_of_entities_t = typedef meta::rename_t< meta::transform_t< std::decay, meta::type_list<Entities...> >, std::tuple >

A helper meta-function to create an actual type of tuple with clauses/producers.

Usage example:

template< typename... Clauses >
auto
some_clause( Clauses && ...clauses ) {
using clause_type = impl::some_clause_t<
impl::tuple_of_entities_t<Clauses...> >;
return clause_type{ std::forward<Clauses>(clauses)... };
}
restinio::easy_parser::impl::tuple_of_entities_t
meta::rename_t< meta::transform_t< std::decay, meta::type_list< Entities... > >, std::tuple > tuple_of_entities_t
A helper meta-function to create an actual type of tuple with clauses/producers.
Definition: easy_parser.hpp:1458

The tuple_of_entities_t takes care about such cases as references and constness of parameters. For example:

auto c = symbol('c');
const auto b = symbol('b');
auto clause = some_clause(c, b);
restinio::easy_parser::impl::entity_type_t::clause
@ clause
Entity is a clause. It doesn't produces anything.
restinio::easy_parser::symbol
RESTINIO_NODISCARD auto symbol(char expected) noexcept
A factory function to create a clause that expects the speficied symbol, extracts it and then skips i...
Definition: easy_parser.hpp:4032

In that case `Clauses...` will be `symbol_clause_t&, const symbol_clause_t&`. And an attempt to make type `std::tuple<Clauses...>` will produce type `std::tuple<symbol_clause_t&, const symbol_clause_t&>`. But we need `std::tuple<symbol_clause_t, symbol_clause_t>`. This result will be obtained if `tuple_of_entities_t` is used instead of `std::tuple`.

Since
  v.0.6.6

Definition at line 1456 of file easy_parser.hpp.

## Enumeration Type Documentation

## entity_type_t

enum class restinio::easy_parser::impl::entity_type_t

strong

A marker for distinguish different kind of entities in parser.

Since
  v.0.6.1

Enumerator
producer | Entity is a producer of values.
transformer | Entity is a transformer of a value from one type to another.
consumer | Entity is a consumer of values. It requires a value on the input and doesn't produces anything.
clause | Entity is a clause. It doesn't produces anything.

transformer_proxy

Entity is a transformer-proxy. It can't be used directly, only for binding a producer and transformer together.

Since
  v.0.6.6.

Definition at line 900 of file easy_parser.hpp.

## Function Documentation

## ensure_no_remaining_content()

RESTINIO_NODISCARD optional_t< parse_error_t > restinio::easy_parser::impl::ensure_no_remaining_content | ( | source_t & | from | ) |

inline

A special function to check that there is no more actual data in the input stream except whitespaces.

Returns
  parse_error_t if some non-whitespace character is found in the input stream.

Since
  v.0.6.1

Definition at line 1566 of file easy_parser.hpp.

## is_digit()

RESTINIO_NODISCARD constexpr bool restinio::easy_parser::impl::is_digit | ( | const char | ch | ) |

inline constexpr noexcept

Is a character a decimal digit?

Since
  v.0.6.1

Definition at line 669 of file easy_parser.hpp.

## is_hexdigit()

RESTINIO_NODISCARD constexpr bool restinio::easy_parser::impl::is_hexdigit | ( | const char | ch | ) |

inline constexpr noexcept

Is a character a hexadecimal digit?

Since
  v.0.6.6

Definition at line 702 of file easy_parser.hpp.

## is_space()

RESTINIO_NODISCARD constexpr bool restinio::easy_parser::impl::is_space | ( | const char | ch | ) |

inline constexpr noexcept

If a character a space character?

Since
  v.0.6.1

Definition at line 635 of file easy_parser.hpp.

## operator!=()

RESTINIO_NODISCARD bool restinio::easy_parser::impl::operator!= | ( | const character_t & | a,
|  | const character_t & | b
| ) |  |

inline noexcept

Definition at line 607 of file easy_parser.hpp.

## operator==()

RESTINIO_NODISCARD bool restinio::easy_parser::impl::operator== | ( | const character_t & | a,
|  | const character_t & | b
| ) |  |

inline noexcept

Definition at line 600 of file easy_parser.hpp.

## operator>>() [1/4]

template<typename P , typename C >

RESTINIO_NODISCARD std::enable_if_t< is_producer_v< P > &&is_consumer_v< C >, consume_value_clause_t< P, C > > restinio::easy_parser::impl::operator>> | ( | P | producer,
|  | C | consumer
| ) |  |

A special operator to connect a value producer with a value consumer.

Since
  v.0.6.1

Definition at line 1513 of file easy_parser.hpp.

## operator>>() [2/4]

template<typename P , typename F , typename C >

RESTINIO_NODISCARD std::enable_if_t< is_producer_v< P >, consume_value_clause_t< P, field_setter_consumer_t< F, C > > > restinio::easy_parser::impl::operator>> | ( | P | producer,
|  | F C::* | member_ptr
| ) |  |

A special operator to connect a value producer with field_setter_consumer.

Since
  v.0.6.1

Definition at line 3002 of file easy_parser.hpp.

## operator>>() [3/4]

template<typename P , typename T >

RESTINIO_NODISCARD std::enable_if_t< is_producer_v< P > &is_transformer_v< T >, transformed_value_producer_t< P, T > > restinio::easy_parser::impl::operator>> | ( | P | producer,
|  | T | transformer
| ) |  |

A special operator to connect a value producer with value transformer.

Since
  v.0.6.1

Definition at line 1233 of file easy_parser.hpp.

## operator>>() [4/4]

template<typename P , typename T , typename S = std::enable_if_t< is_producer_v<P> & is_transformer_proxy_v<T>, void >>

RESTINIO_NODISCARD auto restinio::easy_parser::impl::operator>> | ( | P | producer,
|  | T | transformer_proxy
| ) |  |

A special operator to connect a value producer with value transformer via transformer-proxy.

Since
  v.0.6.6

Definition at line 1306 of file easy_parser.hpp.

## remove_trailing_spaces()

RESTINIO_NODISCARD string_view_t restinio::easy_parser::impl::remove_trailing_spaces | ( | string_view_t | from | ) |

inline noexcept

Helper function for removal of trailing spaces from a string-view.

Since
  v.0.6.7

Definition at line 1594 of file easy_parser.hpp.

## try_parse_caseless_exact_fragment()

template<typename It >

RESTINIO_NODISCARD expected_t< bool, parse_error_t > restinio::easy_parser::impl::try_parse_caseless_exact_fragment | ( | source_t & | from,
|  | It | begin,
|  | It | end
| ) |  |

Definition at line 3419 of file easy_parser.hpp.

## try_parse_digits_with_digits_limit()

template<typename T , typename Value_Accumulator >

RESTINIO_NODISCARD expected_t< T, parse_error_t > restinio::easy_parser::impl::try_parse_digits_with_digits_limit | ( | source_t & | from,
|  | digits_to_consume_t | digits_limit,
|  | Value_Accumulator | acc
| ) |  |

noexcept

Helper function for parsing integers with respect to the number of digits to be consumed.

Usage example:

// For the case of unsigned or positive signed integer:
auto r = try_parse_digits_with_digits_limit<unsigned int>(from,
expected_digits(4),
restinio::impl::overflow_controlled_integer_accumulator_t<unsigned int, 10>{});
// For the case of negative signed integer.
auto r = try_parse_digits_with_digits_limit<short>(from,
expected_digits(4),
restinio::impl::overflow_controlled_integer_accumulator_t<
short,
10,
restinio::impl::check_negative_extremum>{});
restinio::impl::overflow_controlled_integer_accumulator_t
Helper class for accumulating integer value during parsing it from string (with check for overflow).
Definition: overflow_controlled_integer_accumulator.hpp:136
restinio::easy_parser::expected_digits
RESTINIO_NODISCARD constexpr digits_to_consume_t expected_digits(digits_to_consume_t::underlying_int_t total) noexcept
Create a limit for number of digits to be extracted.
Definition: easy_parser.hpp:549
restinio::impl::check_negative_extremum
Definition: overflow_controlled_integer_accumulator.hpp:33

Since
  v.0.6.6

Definition at line 2437 of file easy_parser.hpp.

## try_parse_exact_fragment()

template<typename It >

RESTINIO_NODISCARD expected_t< bool, parse_error_t > restinio::easy_parser::impl::try_parse_exact_fragment | ( | source_t & | from,
|  | It | begin,
|  | It | end
| ) |  |

Definition at line 3313 of file easy_parser.hpp.

## try_parse_hexdigits_with_digits_limit()

template<typename T , typename Value_Accumulator >

RESTINIO_NODISCARD expected_t< T, parse_error_t > restinio::easy_parser::impl::try_parse_hexdigits_with_digits_limit | ( | source_t & | from,
|  | digits_to_consume_t | digits_limit,
|  | Value_Accumulator | acc
| ) |  |

noexcept

Helper function for parsing integers in hexadecimal form.

Usage example:

// For the case of unsigned or positive signed integer:
auto r = try_parse_hexdigits_with_digits_limit<unsigned int>(from,
expected_digits(4, 8),
restinio::impl::overflow_controlled_integer_accumulator_t<unsigned int, 16>{});

Since
  v.0.6.6

Definition at line 2501 of file easy_parser.hpp.

## Variable Documentation

## HTAB

constexpr char restinio::easy_parser::impl::HTAB = '\x09'

constexpr

A constant for Horizontal Tab value.

Since
  v.0.6.1

Definition at line 623 of file easy_parser.hpp.

## is_clause_v

template<typename T >

constexpr bool restinio::easy_parser::impl::is_clause_v = is_clause<T>::value

constexpr

A meta-value to check whether T is a consumer type.

Note
  The current implementation checks only the presence of T::entity_type of type entity_type_t and the value of T::entity_type. Presence of T::try_process is not checked.

Since
  v.0.6.1

Definition at line 1420 of file easy_parser.hpp.

## is_consumer_v

template<typename T >

constexpr bool restinio::easy_parser::impl::is_consumer_v = is_consumer<T>::value

constexpr

A meta-value to check whether T is a consumer type.

Note
  The current implementation checks only the presence of T::entity_type of type entity_type_t and the value of T::entity_type. Presence of T::consume is not checked.

Since
  v.0.6.1

Definition at line 1367 of file easy_parser.hpp.

## is_producer_v

template<typename T >

constexpr bool restinio::easy_parser::impl::is_producer_v = is_producer<T>::value

constexpr

A meta-value to check whether T is a producer type.

Note
  The current implementation checks only the presence of T::entity_type of type entity_type_t and the value of T::entity_type. Presence of T::result_type and T::try_parse is not checked.

Since
  v.0.6.1

Definition at line 970 of file easy_parser.hpp.

## is_transformer_proxy_v

template<typename T >

constexpr bool restinio::easy_parser::impl::is_transformer_proxy_v = is_transformer_proxy<T>::value

constexpr

A meta-value to check whether T is a transformer-proxy type.

Note
  The current implementation checks only the presence of T::entity_type of type entity_type_t and the value of T::entity_type.

Since
  v.0.6.6

Definition at line 1290 of file easy_parser.hpp.

## is_transformer_v

template<typename T >

constexpr bool restinio::easy_parser::impl::is_transformer_v = is_transformer<T>::value

constexpr

A meta-value to check whether T is a transformer type.

Note
  The current implementation checks only the presence of T::entity_type of type entity_type_t and the value of T::entity_type. Presence of T::result_type and T::transform is not checked.

Since
  v.0.6.1

Definition at line 1024 of file easy_parser.hpp.

## SP

constexpr char restinio::easy_parser::impl::SP = ' '

constexpr

A constant for SPACE value.

Since
  v.0.6.1

Definition at line 617 of file easy_parser.hpp.