MySQL 9.6.0
Source Code Documentation
mysql::sets::strconv Namespace Reference

Functions

template<mysql::sets::Is_discrete_set_traits Set_traits_t>
void interval_from_text (const Is_format auto &format, mysql::strconv::Parser &parser, mysql::sets::detail::Relaxed_interval< Set_traits_t > &out)
 Read an interval into the output Relaxed_interval, checking that the boundaries are in range, but not that they are in order. More...
 
template<mysql::sets::Is_boundary_container Boundary_container_t>
requires mysql::sets::Is_discrete_set_traits< typename Boundary_container_t::Set_traits_t>
void interval_from_text (const Is_format auto &format, mysql::strconv::Parser &parser, const std::pair< Boundary_container_t &, typename Boundary_container_t::Iterator_t & > &out)
 Read one interval in text format into an output container with a cursor. More...
 
template<mysql::sets::Is_boundary_container Boundary_container_t>
requires mysql::sets::Is_discrete_set_traits< typename Boundary_container_t::Set_traits_t>
void boundary_set_from_text (const Is_format auto &format, mysql::strconv::Parser &parser, Boundary_container_t &out)
 Parse from text format into a boundary container. More...
 
template<mysql::sets::Is_boundary_container Boundary_container_t>
requires mysql::sets::Is_discrete_metric_set_traits< typename Boundary_container_t::Set_traits_t>
void boundary_set_from_binary (const Is_format auto &format, mysql::strconv::Parser &parser, Boundary_container_t &out)
 Parse from binary format (with variable-length integers) into a boundary container. More...
 
template<mysql::sets::Is_boundary_container Boundary_container_t>
requires mysql::sets::Is_bounded_set_traits< typename Boundary_container_t::Set_traits_t>
void boundary_set_from_binary_fixint (const Is_format auto &format, mysql::strconv::Parser &parser, Boundary_container_t &out)
 Parse from binary format (with fixed-length integers) into a boundary container. More...
 
template<mysql::sets::Is_interval_container Interval_container_t>
void decode_interval_set (const Is_format auto &format, mysql::strconv::Parser &parser, Interval_container_t &out)
 Parse into an interval container, advance the position, and return the status. More...
 
template<mysql::sets::Is_discrete_set_traits Set_traits_t>
void interval_to_text (const Is_format auto &format, Is_string_target auto &target, const mysql::sets::Interval< Set_traits_t > &interval)
 Write an Interval in text format to the given Is_string_target. More...
 
template<mysql::sets::Is_boundary_set Boundary_set_t>
requires mysql::sets::Is_discrete_set_traits< typename Boundary_set_t::Set_traits_t>
void boundary_set_to_text (const Is_format auto &format, Is_string_target auto &target, const Boundary_set_t &boundary_set)
 Write a Boundary_set in text format to the given Is_string_target. More...
 
template<mysql::sets::Is_boundary_set Boundary_set_t>
requires mysql::sets::Is_discrete_metric_set_traits< typename Boundary_set_t::Set_traits_t>
void boundary_set_to_binary (const Is_format auto &format, Is_string_target auto &target, const Boundary_set_t &boundary_set)
 Write a boundary set in a space-efficient binary format that uses variable-length integers, delta-compression, and an optimization to sometimes omit the first value. More...
 
template<mysql::sets::Is_boundary_set Boundary_set_t>
requires mysql::sets::Is_bounded_set_traits< typename Boundary_set_t::Set_traits_t>
void boundary_set_to_binary_fixint (const Is_format auto &format, Is_string_target auto &target, const Boundary_set_t &boundary_set)
 Write boundary sets in binary format with fixed-width integers to the given Is_string_target. More...
 
void encode_interval_set (const Is_format auto &format, Is_string_target auto &target, const mysql::sets::Is_interval_set auto &interval_set)
 Write an interval set to the given Is_string_target. More...
 
void nested_set_to_text (const mysql::strconv::Is_nested_set_text_format auto &format, Is_string_target auto &target, const mysql::sets::Is_nested_set auto &nested_set)
 Write a nested set to the given Is_string_target. More...
 

Function Documentation

◆ boundary_set_from_binary()

template<mysql::sets::Is_boundary_container Boundary_container_t>
requires mysql::sets::Is_discrete_metric_set_traits< typename Boundary_container_t::Set_traits_t>
void mysql::sets::strconv::boundary_set_from_binary ( const Is_format auto &  format,
mysql::strconv::Parser parser,
Boundary_container_t &  out 
)

Parse from binary format (with variable-length integers) into a boundary container.

The Set traits must be discrete and metric (see Is_discrete_metric_set_traits).

The format is equal to that described for boundary_set_to_binary.

Parameters
formatFormat type tag used to read boundary values.
[in,out]parserreference to Parser.
[out]outDestination container.

◆ boundary_set_from_binary_fixint()

template<mysql::sets::Is_boundary_container Boundary_container_t>
requires mysql::sets::Is_bounded_set_traits< typename Boundary_container_t::Set_traits_t>
void mysql::sets::strconv::boundary_set_from_binary_fixint ( const Is_format auto &  format,
mysql::strconv::Parser parser,
Boundary_container_t &  out 
)

Parse from binary format (with fixed-length integers) into a boundary container.

The Set traits must be bounded (see Is_bounded_set_traits).

The format is equal to that described for boundary_set_to_binary.

Parameters
formatFormat type tag used to read boundary values.
[in,out]parserreference to Parser.
[out]outDestination container.

◆ boundary_set_from_text()

template<mysql::sets::Is_boundary_container Boundary_container_t>
requires mysql::sets::Is_discrete_set_traits< typename Boundary_container_t::Set_traits_t>
void mysql::sets::strconv::boundary_set_from_text ( const Is_format auto &  format,
mysql::strconv::Parser parser,
Boundary_container_t &  out 
)

Parse from text format into a boundary container.

The Set traits must be discrete (see Is_discrete_set_traits).

The format is "((<interval>)?<interval_separator>)*". See interval_from_text for the format of interval.

Parameters
formatFormat type tag used to read intervals into the container.
[in,out]parserreference to Parser.
[in,out]outDestination container.

◆ boundary_set_to_binary()

template<mysql::sets::Is_boundary_set Boundary_set_t>
requires mysql::sets::Is_discrete_metric_set_traits< typename Boundary_set_t::Set_traits_t>
void mysql::sets::strconv::boundary_set_to_binary ( const Is_format auto &  format,
Is_string_target auto &  target,
const Boundary_set_t &  boundary_set 
)

Write a boundary set in a space-efficient binary format that uses variable-length integers, delta-compression, and an optimization to sometimes omit the first value.

The Set traits must be discrete, metric (see Is_discrete_metric_set_traits).

The format has one integer for the sequence length, followed by a sequence where each element is the difference between adjacent boundaries, minus 1. Both the length and the boundaries are encoded according to format. Normally, the sequence contains all boundaries, but in the special case that the first boundary equals the minimum value, we omit it from the sequence. The decoder detects this case by observing that the sequence length is odd, in which case it assumes the start boundary of the first interval is the minimum value, and the exclusive_end is given by the first boundary stored explicitly.

If boundaries are integers and format is Binary_format, all numbers are stored in variable-length format, as specified by the serialization library. (We store differences rather than boundary values because that minimizes integer magnitudes, which saves space.)

Parameters
formatFormat tag used to write boundary values.
[out]targetString_writer or String_counter to write to.
boundary_setBoundary set to write.

◆ boundary_set_to_binary_fixint()

template<mysql::sets::Is_boundary_set Boundary_set_t>
requires mysql::sets::Is_bounded_set_traits< typename Boundary_set_t::Set_traits_t>
void mysql::sets::strconv::boundary_set_to_binary_fixint ( const Is_format auto &  format,
Is_string_target auto &  target,
const Boundary_set_t &  boundary_set 
)

Write boundary sets in binary format with fixed-width integers to the given Is_string_target.

The Set traits must be bounded (see Is_bounded_set_traits).

The format consists of one integer for the number of intervals (i.e., number of boundaries divided by 2), followed by the sequence of all boundaries. Both the number and the boundaries are encoded according to format.

If boundaries are integers and format is Format_binary_fixint, all numbers are 64-bit little-endian integers.

Parameters
formatFormat tag used to write boundary values.
[out]targetString_writer or String_counter to write to.
boundary_setBoundary set to write.

◆ boundary_set_to_text()

template<mysql::sets::Is_boundary_set Boundary_set_t>
requires mysql::sets::Is_discrete_set_traits< typename Boundary_set_t::Set_traits_t>
void mysql::sets::strconv::boundary_set_to_text ( const Is_format auto &  format,
Is_string_target auto &  target,
const Boundary_set_t &  boundary_set 
)

Write a Boundary_set in text format to the given Is_string_target.

The Set traits must be discrete (see Is_discrete_set_traits).

The format is a sequence of intervals, formatted according to interval_to_text, where adjacent pairs of intervals are separated by format.interval_separator.

Parameters
formatFormat tag used to write intervals.
[out]targetString_writer or String_counter to write to.
boundary_setBoundary set to write.

◆ decode_interval_set()

template<mysql::sets::Is_interval_container Interval_container_t>
void mysql::sets::strconv::decode_interval_set ( const Is_format auto &  format,
mysql::strconv::Parser parser,
Interval_container_t &  out 
)

Parse into an interval container, advance the position, and return the status.

See above for details.

◆ encode_interval_set()

void mysql::sets::strconv::encode_interval_set ( const Is_format auto &  format,
Is_string_target auto &  target,
const mysql::sets::Is_interval_set auto &  interval_set 
)

Write an interval set to the given Is_string_target.

This delegates the work to the formatter for boundary sets.

Parameters
formatFormat tag used to write boundary sets.
[out]targetString_writer or String_counter to write to.
interval_setInterval set to write.

◆ interval_from_text() [1/2]

template<mysql::sets::Is_boundary_container Boundary_container_t>
requires mysql::sets::Is_discrete_set_traits< typename Boundary_container_t::Set_traits_t>
void mysql::sets::strconv::interval_from_text ( const Is_format auto &  format,
mysql::strconv::Parser parser,
const std::pair< Boundary_container_t &, typename Boundary_container_t::Iterator_t & > &  out 
)

Read one interval in text format into an output container with a cursor.

The Set traits must be discrete (see Is_discrete_set_traits).

The format is one of "start<boundary_separator>inclusive_end" or "start". Note that the text format, contrary to all other places, stores the inclusive end value. If the end value is omitted, the inclusive end is equal to start.

This function requires that the start boundary is in the range defined in Set_traits_t. If an (inclusive) end value is given, it also requires that the corresponding exclusive end is not less than the minimum value. If the start boundary is not less than the end boundary, the interval counts as valid and empty and will not be inserted in the output.

Parameters
formatFormat type tag used to read Relaxed_interval objects.
[in,out]parserreference to Parser.
[in,out]outPair where the first component is a reference to the destination container and the second component is a reference to a cursor to the suggested insertion position.

◆ interval_from_text() [2/2]

template<mysql::sets::Is_discrete_set_traits Set_traits_t>
void mysql::sets::strconv::interval_from_text ( const Is_format auto &  format,
mysql::strconv::Parser parser,
mysql::sets::detail::Relaxed_interval< Set_traits_t > &  out 
)

Read an interval into the output Relaxed_interval, checking that the boundaries are in range, but not that they are in order.

The Set traits must be discrete (see Is_discrete_set_traits).

The format is one of "start<boundary_separator>inclusive_end" or "start". Note that the text format, contrary to all other places, stores the inclusive end value. If the end value is omitted, the inclusive end is equal to start, i.e., a singleton interval.

This function requires that the start boundary is in the range defined in Set_traits_t. If an end value is given, it requires that that the exclusive endpoint is not less than the minimum inclusive value, and not greater than the maximum exclusive value. It does not require that the start boundary is smaller than the end boundary.

Parameters
formatFormat type tag used to read boundary values.
[in,out]parserreference to Parser.
[out]outDestination interval.

◆ interval_to_text()

template<mysql::sets::Is_discrete_set_traits Set_traits_t>
void mysql::sets::strconv::interval_to_text ( const Is_format auto &  format,
Is_string_target auto &  target,
const mysql::sets::Interval< Set_traits_t > &  interval 
)

Write an Interval in text format to the given Is_string_target.

The Set traits must be discrete (see Is_discrete_set_traits).

The format is "start" if the start is equal to the inclusive end, and "start<format.boundary_separator>inclusive_end" otherwise.

Parameters
formatFormat tag used to write boundary values.
[out]targetString_writer or String_counter to write to.
intervalInterval to write.

◆ nested_set_to_text()

void mysql::sets::strconv::nested_set_to_text ( const mysql::strconv::Is_nested_set_text_format auto &  format,
Is_string_target auto &  target,
const mysql::sets::Is_nested_set auto &  nested_set 
)

Write a nested set to the given Is_string_target.

This writes each key using the format format.m_nested_set_key_format, each mapped set using the format format.mnested_set_mapped_format, uses format.m_nested_set_key_mapped_separator to separate key and mapped set, and uses format.m_nested_set_item_separator to separate different pairs.

Parameters
formatFormat tag.
[out]targetString_writer or String_counter to write to.
nested_setNested set to write.