pqxx::internal::enum_traits< ENUM > Struct Template Reference

Helper class for defining enum conversions. More...

`#include <strconv.hxx>`

## Public Types

using | impl_type = std::underlying_type_t< ENUM >
using | impl_traits = string_traits< impl_type >

## Static Public Member Functions

static constexpr zview | to_buf (char *begin, char *end, ENUM const &value)
static constexpr char * | into_buf (char *begin, char *end, ENUM const &value)
static ENUM | from_string (std::string_view text)
static std::size_t | size_buffer (ENUM const &value) noexcept

## Static Public Attributes

static constexpr bool | converts_to_string {true}
static constexpr bool | converts_from_string {true}

## Detailed Description

template<typename ENUM>
struct pqxx::internal::enum_traits< ENUM >

Helper class for defining enum conversions.

The conversion will convert enum values to numeric strings, and vice versa.

To define a string conversion for an enum type, derive a `string_traits` specialisation for the enum from this struct.

There's usually an easier way though: the `PQXX_DECLARE_ENUM_CONVERSION` macro. Use `enum_traits` manually only if you need to customise your traits type in more detail.

## Member Typedef Documentation

## impl_traits

template<typename ENUM >

using pqxx::internal::enum_traits< ENUM >::impl_traits = string_traits<impl_type>

## impl_type

template<typename ENUM >

using pqxx::internal::enum_traits< ENUM >::impl_type = std::underlying_type_t<ENUM>

## Member Function Documentation

## from_string()

template<typename ENUM >

static ENUM pqxx::internal::enum_traits< ENUM >::from_string | ( | std::string_view | text | ) |

static

References pqxx::string_traits< TYPE >::from_string(), and pqxx::text.

## into_buf()

template<typename ENUM >

static constexpr char * pqxx::internal::enum_traits< ENUM >::into_buf | ( | char * | begin,
|  | char * | end,
|  | ENUM const & | value
| ) |  |

static constexpr

References pqxx::string_traits< TYPE >::into_buf().

## size_buffer()

template<typename ENUM >

static std::size_t pqxx::internal::enum_traits< ENUM >::size_buffer | ( | ENUM const & | value | ) |

static noexcept

References pqxx::string_traits< TYPE >::size_buffer().

## to_buf()

template<typename ENUM >

static constexpr zview pqxx::internal::enum_traits< ENUM >::to_buf | ( | char * | begin,
|  | char * | end,
|  | ENUM const & | value
| ) |  |

static constexpr

References pqxx::string_traits< TYPE >::to_buf().

## Member Data Documentation

## converts_from_string

template<typename ENUM >

constexpr bool pqxx::internal::enum_traits< ENUM >::converts_from_string {true}

static constexpr

## converts_to_string

template<typename ENUM >

constexpr bool pqxx::internal::enum_traits< ENUM >::converts_to_string {true}

static constexpr

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

- strconv.hxx