MySQL 9.6.0
Source Code Documentation
resolve_format.h File Reference

Experimental API header. More...

#include <cassert>
#include <concepts>
#include <utility>
#include "mysql/strconv/formats/format.h"

Go to the source code of this file.

Namespaces

namespace  mysql
 
namespace  mysql::strconv
 
namespace  mysql::strconv::detail
 

Concepts

concept  mysql::strconv::detail::Has_default_format
 True if there is a default format type defined for <Format_t, Object_t>.
 
concept  mysql::strconv::detail::Has_parent_format
 True if there is a parent format type defined for Format_t.
 
concept  mysql::strconv::detail::Has_impl
 True if Func_t::call(Format_t, Object_t) is defined.
 
concept  mysql::strconv::detail::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>.
 

Macros

#define RESOLVE_FORMAT_ERROR_MESSAGE(TOFROM, PROTOTYPE_ARGS)
 

Typedefs

template<class Format_t , class Object_t >
using mysql::strconv::detail::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 mysql::strconv::detail::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  mysql::strconv::detail::Conversion_direction { mysql::strconv::detail::decode , mysql::strconv::detail::encode }
 

Functions

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)
 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 mysql::strconv::detail::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 mysql::strconv::detail::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 mysql::strconv::detail::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 mysql::strconv::detail::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...
 

Detailed Description

Experimental API header.

This defines the internal function detail::resolve_format, which is used to find the correct Format class to use for formatting or parsing.

Macro Definition Documentation

◆ RESOLVE_FORMAT_ERROR_MESSAGE

#define RESOLVE_FORMAT_ERROR_MESSAGE (   TOFROM,
  PROTOTYPE_ARGS 
)
Value:
"No `mysql::strconv::" TOFROM \
"_string_impl` for `Format_t` and " \
"`Object_t`, because " \
"(1) There is no direct implementation defined with the prototype " \
"`mysql::strconv::" TOFROM "_string_impl(const Format_t &, " PROTOTYPE_ARGS \
") (or there are more than one, ambiguously); and " \
"(2) there is no default format or no implementation for the " \
"default format, i.e., either " \
"`get_default_format(const Format_t &, const Object_t &)` " \
"is not defined or `mysql::strconv::" TOFROM \
"_string_impl(const /*default format*/ &, " PROTOTYPE_ARGS \
")` is not defined (or is defined more than once, ambiguously); and " \
"(3) there is no parent format or no implementation for the parent " \
"format, i.e., either `Format_t::parent()` is not defined or " \
"(1), (2), (3) fail also when replacing `Format_t` by " \
"`decltype(Format_t::parent())`. " \
"If you believe you have implemented the necessary functions, maybe " \
"there are mistakes in their prototypes; to debug this, double-check " \
"the namespace, `const` and `&` qualifiers, and/or try to invoke `" TOFROM \
"_string_impl` directly and check the compilation error."