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

Classes

class  Constructible_string_counter
 String_counter subclass that can be instantiated. More...
 
class  Constructible_string_writer
 String_writer subclass that can be instantiated. More...
 
class  Hex_to_int
 Return a conversion table with 256 elements, where elements for hex chars is the corresponding integer between 0 and 15, and other elements are -1. More...
 
struct  Is_checker_pred
 Class template parameterized by an object type, holding a member class template, which is a type predicate whose member constant value is true if Test is a checker for the object type. More...
 
struct  Is_format_pred
 Type predicate with a member constant value that is true if Test is a format. More...
 
struct  Is_repeat_pred
 Type predicate with a member constant value that is true if Test is Repeat. More...
 
class  Parse_position
 Base class for the current position of a string parser, holding both the parsed string and the position within the parsed string. More...
 
class  Parse_result
 Class holding the result from parsing a string, in the form of a status and a message. More...
 
class  Parse_result_internals
 Helper class that exports the internals from Parse_result. More...
 
class  Policy_fixed
 Base class for all Out_str_fixed* classes. More...
 
class  Policy_growable_ptr
 Base class for all Out_str_growable_ptr* classes. More...
 
class  Policy_growable_string
 Base class for Out_str_growable_string. More...
 
class  Repeat_base
 Common base class for the Repeat and Repeat_optional classes, providing functionality for representing the upper bound on the number of repetitions. More...
 
class  Representation_ptr_base
 Common CRTP base class for Representation_ptrptr and Representation_ptrsize. More...
 
class  Representation_ptrptr
 Represent a string as raw pointer to the beginning and raw pointer to the end. More...
 
class  Representation_ptrsize
 Represent a string as raw pointer to the beginning, and integer size. More...
 
class  Representation_string
 Represent a string as an object, typically std::string. More...
 
class  String_target_base
 Top of the hierarchy. More...
 
class  String_target_interface
 CRTP base class providing common helpers needed by String_writer and String_counter, namely, the function to resolve the format. More...
 

Concepts

concept  Is_compound_parse_options_tuple
 
concept  Can_invoke_decode_impl
 True if decode_impl can be invoked with the given format type and object type.
 
concept  Can_invoke_encode_impl
 True if encode_impl can be invoked with the given format type and object type.
 
concept  Has_default_format
 True if there is a default format type defined for <Format_t, Object_t>.
 
concept  Has_parent_format
 True if there is a parent format type defined for Format_t.
 
concept  Has_impl
 True if Func_t::call(Format_t, Object_t) is defined.
 
concept  Has_default_impl
 True if <Format_t, Object_t> has a default format and Func_t::call is defined for <Default_format_type<Format_t, Object_t>, Object_t>.
 

Typedefs

template<class String_tp >
using Out_str_fixed_string_alias = Policy_fixed< Representation_string< String_tp >, Null_terminated::yes >
 
template<class Size_tp >
using Out_str_fixed_ptrsize_z_alias = Policy_fixed< Representation_ptrsize< char *, Size_tp >, Null_terminated::yes >
 
template<class Size_tp >
using Out_str_fixed_ptrsize_nz_alias = Policy_fixed< Representation_ptrsize< char *, Size_tp >, Null_terminated::no >
 
template<class Char_tp >
using Out_str_fixed_ptrptr_z_alias = Policy_fixed< Representation_ptrptr< Char_tp * >, Null_terminated::yes >
 
template<class Char_tp >
using Out_str_fixed_ptrptr_nz_alias = Policy_fixed< Representation_ptrptr< Char_tp * >, Null_terminated::no >
 
template<class String_tp >
using Out_str_growable_string_alias = Policy_growable_string< Representation_string< String_tp > >
 
template<mysql::meta::Is_charlike Char_t, std::integral Size_tp>
using Out_str_growable_ptrsize_z_alias = Policy_growable_ptr< Char_t, Representation_ptrsize< Char_t *&, Size_tp >, Null_terminated::yes >
 
template<mysql::meta::Is_charlike Char_t, std::integral Size_tp>
using Out_str_growable_ptrsize_nz_alias = Policy_growable_ptr< Char_t, Representation_ptrsize< Char_t *&, Size_tp >, Null_terminated::no >
 
template<mysql::meta::Is_charlike Char_t>
using Out_str_growable_ptrptr_z_alias = Policy_growable_ptr< Char_t, Representation_ptrptr< Char_t *& >, Null_terminated::yes >
 
template<mysql::meta::Is_charlike Char_t>
using Out_str_growable_ptrptr_nz_alias = Policy_growable_ptr< Char_t, Representation_ptrptr< Char_t *& >, Null_terminated::no >
 
using Nop_t = decltype(nop)
 Type of nop. More...
 
template<class Format_t , class Object_t >
using Default_format_type = decltype(get_default_format(std::declval< Format_t >(), std::declval< Object_t >()))
 The type of the default format for <Format_t, Object_t>. More...
 
template<template< class, class > class Can_invoke_t, class Format_t , class Object_t >
using Resolved_format_type = decltype(do_resolve_format< Can_invoke_t >(std::declval< Format_t >(), std::declval< Object_t >()))
 The return type of do_resolve_format. More...
 

Enumerations

enum class  Parse_status : char {
  ok , ok_backtracked_from_parse_error , parse_error , fullmatch_error ,
  store_error
}
 The status after parsing an object from a string. More...
 
enum class  Hex_parse_case { lower , upper , flexible }
 Policy for using uppercase/lowercase when parsing hex. More...
 
enum class  Conversion_direction { decode , encode }
 

Functions

void encode_v0_v1 (const Gtid_binary_format &format, Is_string_target auto &string_target, const mysql::gtids::Is_gtid_set auto &gtid_set)
 
void encode_v2 (const Gtid_binary_format &format, Is_string_target auto &string_target, const mysql::gtids::Is_gtid_set auto &gtid_set)
 
void decode_v0_v1 (const Gtid_binary_format &format, Parser &parser, mysql::gtids::Is_gtid_set auto &gtid_set, std::size_t tsid_count)
 
void decode_v2 (const Gtid_binary_format &format, Parser &parser, mysql::gtids::Is_gtid_set auto &gtid_set, std::size_t tsid_count)
 
auto make_compound_parse_options ()
 Given any form of parse options; Format, Repeat, Checker, or Compound_parse_options; return a Compound_parse_options object. More...
 
template<Is_format Format_t>
auto make_compound_parse_options (const Format_t &format)
 
template<Is_repeat Repeat_t>
auto make_compound_parse_options (const Repeat_t &repeat)
 
template<Is_checker Checker_t>
auto make_compound_parse_options (const Checker_t &checker)
 
auto make_compound_parse_options (const Is_compound_parse_options auto &opt)
 
template<Is_out_str Out_str_t, class Producer_counter_t , class Producer_writer_t , std::invocable Oom_action_t>
requires Is_string_producer_pair<Producer_counter_t, Producer_writer_t>
mysql::utils::Return_status do_out_str_write (const Out_str_t &out_str, const Producer_counter_t &producer_counter, const Producer_writer_t &producer_writer, const Oom_action_t &oom_action)
 Common implementation for the two overloads of out_str_write(out_str, producer_counter, producer_writer, oom_action). More...
 
template<template< class, class > class Can_invoke_t, class Object_t , Is_format Format_t>
constexpr void do_resolve_format (const Format_t &format, const Object_t &object)
 Return the format to pass to the implementation function, given the format and object type passed by the user to the API. More...
 
template<template< class, class > class Can_invoke_t, class Object_t , Is_format Format_t>
requires Has_impl<Can_invoke_t, Format_t, Object_t>
constexpr Format_t do_resolve_format (const Format_t &format, const Object_t &object)
 
template<template< class, class > class Can_invoke_t, class Object_t , Is_format Format_t>
requires (!Has_impl<Can_invoke_t, Format_t, Object_t> && Has_default_impl<Can_invoke_t, Format_t, Object_t>)
constexpr auto do_resolve_format (const Format_t &format, const Object_t &object)
 
template<template< class, class > class Can_invoke_t, class Object_t , Is_format Format_t>
requires (!Has_impl<Can_invoke_t, Format_t, Object_t> && !Has_default_impl<Can_invoke_t, Format_t, Object_t> && Has_parent_format<Format_t>)
constexpr auto do_resolve_format (const Format_t &format, const Object_t &object)
 
template<Conversion_direction conversion_direction, template< class, class > class Can_invoke_t, class Object_t , Is_format Format_t>
constexpr auto resolve_format (const Format_t &format, const Object_t &object)
 Return the format to pass to the implementation function, given the format and object type passed by the user to the API. More...
 

Variables

template<class Tuple_t >
constexpr std::size_t Format_count
 The number of elements in a Compound_parse_options of Format type. More...
 
template<class Tuple_t >
constexpr std::size_t Repeat_count
 The number of elements in a Compound_parse_options of Repeat type. More...
 
template<class Tuple_t >
constexpr std::size_t Checker_count
 The number of element in a Compound_parse_options of Checker type. More...
 
auto nop = [] {}
 Lambda that takes no argument, does nothing, and returns void. More...
 
static constexpr std::array< unsigned char, 16 > int_to_hex_lower
 Conversion table with 16 elements, where element i is lowercase hex for i. More...
 
static constexpr std::array< unsigned char, 16 > int_to_hex_upper
 Conversion table with 16 elements, where element i is uppercase hex i. More...
 

Typedef Documentation

◆ Default_format_type

template<class Format_t , class Object_t >
using mysql::strconv::detail::Default_format_type = typedef decltype(get_default_format( std::declval<Format_t>(), std::declval<Object_t>()))

The type of the default format for <Format_t, Object_t>.

◆ Nop_t

using mysql::strconv::detail::Nop_t = typedef decltype(nop)

Type of nop.

◆ Out_str_fixed_ptrptr_nz_alias

◆ Out_str_fixed_ptrptr_z_alias

◆ Out_str_fixed_ptrsize_nz_alias

◆ Out_str_fixed_ptrsize_z_alias

◆ Out_str_fixed_string_alias

◆ Out_str_growable_ptrptr_nz_alias

◆ Out_str_growable_ptrptr_z_alias

◆ Out_str_growable_ptrsize_nz_alias

◆ Out_str_growable_ptrsize_z_alias

◆ Out_str_growable_string_alias

◆ Resolved_format_type

template<template< class, class > class Can_invoke_t, class Format_t , class Object_t >
using mysql::strconv::detail::Resolved_format_type = typedef decltype(do_resolve_format<Can_invoke_t>( std::declval<Format_t>(), std::declval<Object_t>()))

The return type of do_resolve_format.

Enumeration Type Documentation

◆ Conversion_direction

Enumerator
decode 
encode 

◆ Hex_parse_case

Policy for using uppercase/lowercase when parsing hex.

Enumerator
lower 

Accept only lowercase.

upper 

Accept only uppercase.

flexible 

Accept lowercase or uppercase.

◆ Parse_status

enum class mysql::strconv::detail::Parse_status : char
strong

The status after parsing an object from a string.

Enumerator
ok 

The object could be successfully parsed.

ok_backtracked_from_parse_error 

There was previously a parse error; the parser has backtracked to a non-error status; the information about the parse error is still stored in the Parse_position object.

parse_error 

The object could not be successfully parsed because the string was wrong.

fullmatch_error 

An object was parsed successfully from a prefix of the string, but there were extra characters after the string.

store_error 

No parse error was found in the string, but an error occurred when storing into the output object - for example, out-of-memory.

Function Documentation

◆ decode_v0_v1()

void mysql::strconv::detail::decode_v0_v1 ( const Gtid_binary_format format,
Parser parser,
mysql::gtids::Is_gtid_set auto &  gtid_set,
std::size_t  tsid_count 
)

◆ decode_v2()

void mysql::strconv::detail::decode_v2 ( const Gtid_binary_format format,
Parser parser,
mysql::gtids::Is_gtid_set auto &  gtid_set,
std::size_t  tsid_count 
)

◆ do_out_str_write()

template<Is_out_str Out_str_t, class Producer_counter_t , class Producer_writer_t , std::invocable Oom_action_t>
requires Is_string_producer_pair<Producer_counter_t, Producer_writer_t>
mysql::utils::Return_status mysql::strconv::detail::do_out_str_write ( const Out_str_t &  out_str,
const Producer_counter_t &  producer_counter,
const Producer_writer_t &  producer_writer,
const Oom_action_t &  oom_action 
)

Common implementation for the two overloads of out_str_write(out_str, producer_counter, producer_writer, oom_action).

◆ do_resolve_format() [1/4]

template<template< class, class > class Can_invoke_t, class Object_t , Is_format Format_t>
constexpr void mysql::strconv::detail::do_resolve_format ( const Format_t &  format,
const Object_t &  object 
)
constexpr

Return the format to pass to the implementation function, given the format and object type passed by the user to the API.

The three overloads, together, have the effect of using the encode_impl with exactly the requested Format_t type if it exists; otherwise, use the encode_impl using exactly the default format if it exists; otherwise, recursively, perform the same checks for the parent format. Returns void if no implementation is found.

Template Parameters
Can_invoke_tTwo-argument type predicate. When instantiated with a format type and an object type, it should have the member value equal to true if there is an implementation of encode_impl/decode_implfor that combination of arguments.
Object_tType of object to check.
Format_tType of format to check.
Parameters
formatFormat to check.
objectObject to check.

return: If there is an implementation for Format_t, returns format. Otherwise, if there is an implementation for the default format, returns the default format. Otherwise, if there is a parent format, recursively checks that. If no format is found this way, the return type is void.

◆ do_resolve_format() [2/4]

template<template< class, class > class Can_invoke_t, class Object_t , Is_format Format_t>
requires Has_impl<Can_invoke_t, Format_t, Object_t>
constexpr Format_t mysql::strconv::detail::do_resolve_format ( const Format_t &  format,
const Object_t &  object 
)
constexpr

◆ do_resolve_format() [3/4]

template<template< class, class > class Can_invoke_t, class Object_t , Is_format Format_t>
requires (!Has_impl<Can_invoke_t, Format_t, Object_t> && Has_default_impl<Can_invoke_t, Format_t, Object_t>)
constexpr auto mysql::strconv::detail::do_resolve_format ( const Format_t &  format,
const Object_t &  object 
)
constexpr

◆ do_resolve_format() [4/4]

template<template< class, class > class Can_invoke_t, class Object_t , Is_format Format_t>
requires (!Has_impl<Can_invoke_t, Format_t, Object_t> && !Has_default_impl<Can_invoke_t, Format_t, Object_t> && Has_parent_format<Format_t>)
constexpr auto mysql::strconv::detail::do_resolve_format ( const Format_t &  format,
const Object_t &  object 
)
constexpr

◆ encode_v0_v1()

void mysql::strconv::detail::encode_v0_v1 ( const Gtid_binary_format format,
Is_string_target auto &  string_target,
const mysql::gtids::Is_gtid_set auto &  gtid_set 
)

◆ encode_v2()

void mysql::strconv::detail::encode_v2 ( const Gtid_binary_format format,
Is_string_target auto &  string_target,
const mysql::gtids::Is_gtid_set auto &  gtid_set 
)

◆ make_compound_parse_options() [1/5]

auto mysql::strconv::detail::make_compound_parse_options ( )
inline

Given any form of parse options; Format, Repeat, Checker, or Compound_parse_options; return a Compound_parse_options object.

◆ make_compound_parse_options() [2/5]

template<Is_checker Checker_t>
auto mysql::strconv::detail::make_compound_parse_options ( const Checker_t &  checker)

◆ make_compound_parse_options() [3/5]

template<Is_format Format_t>
auto mysql::strconv::detail::make_compound_parse_options ( const Format_t &  format)

◆ make_compound_parse_options() [4/5]

auto mysql::strconv::detail::make_compound_parse_options ( const Is_compound_parse_options auto &  opt)

◆ make_compound_parse_options() [5/5]

template<Is_repeat Repeat_t>
auto mysql::strconv::detail::make_compound_parse_options ( const Repeat_t &  repeat)

◆ resolve_format()

template<Conversion_direction conversion_direction, template< class, class > class Can_invoke_t, class Object_t , Is_format Format_t>
constexpr auto mysql::strconv::detail::resolve_format ( const Format_t &  format,
const Object_t &  object 
)
constexpr

Return the format to pass to the implementation function, given the format and object type passed by the user to the API.

This checks for implementations for the format itself, its default format, and the parent format(s). Fails to compile if no implementation is found.

Template Parameters
Can_invoke_tTwo-argument type predicate. When instantiated with a format type and an object type, it should have the member value equal to true if there is an implementation of encode_impl/decode_implfor that combination of format/object arguments.
Object_tType of object to check.
Format_tType of format to check.
Parameters
formatFormat to check.
objectObject to check.
Returns
If there is an implementation for Format_t, returns format. Otherwise, if there is an implementation for the default format, returns the default format. Otherwise, if there is a parent format, recursively checks that. If no format is found this way, generates a compilation error.

Variable Documentation

◆ Checker_count

template<class Tuple_t >
constexpr std::size_t mysql::strconv::detail::Checker_count
constexpr
Initial value:
=
mysql::utils::Tuple_matching_element_type_count<Tuple_t, Is_checker_pred>

The number of element in a Compound_parse_options of Checker type.

◆ Format_count

template<class Tuple_t >
constexpr std::size_t mysql::strconv::detail::Format_count
constexpr
Initial value:
=
mysql::utils::Tuple_matching_element_type_count<Tuple_t, Is_format_pred>

The number of elements in a Compound_parse_options of Format type.

◆ int_to_hex_lower

constexpr std::array<unsigned char, 16> mysql::strconv::detail::int_to_hex_lower
inlinestaticconstexpr
Initial value:
{
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}

Conversion table with 16 elements, where element i is lowercase hex for i.

◆ int_to_hex_upper

constexpr std::array<unsigned char, 16> mysql::strconv::detail::int_to_hex_upper
inlinestaticconstexpr
Initial value:
{
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}

Conversion table with 16 elements, where element i is uppercase hex i.

◆ nop

auto mysql::strconv::detail::nop = [] {}
inline

Lambda that takes no argument, does nothing, and returns void.

◆ Repeat_count

template<class Tuple_t >
constexpr std::size_t mysql::strconv::detail::Repeat_count
constexpr
Initial value:
=
mysql::utils::Tuple_matching_element_type_count<Tuple_t, Is_repeat_pred>

The number of elements in a Compound_parse_options of Repeat type.