pqxx::enum_traits< ENUM > Struct Template Reference

Helper class for defining enum conversions. More...

`#include <strconv.hxx>`

## Public Types

using | underlying_type = typename std::underlying_type< ENUM >::type
using | underlying_traits = string_traits< underlying_type >

## Static Public Member Functions

static constexpr bool | has_null () noexcept
static ENUM | null ()
static void | from_string (const char Str[], ENUM &Obj)
static std::string | to_string (ENUM Obj)

## Detailed Description

### template<typename ENUM>
struct pqxx::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, e.g. if your enum has a "null" value built in.

## Member Typedef Documentation

## underlying_traits

template<typename ENUM >

using pqxx::enum_traits< ENUM >::underlying_traits = string_traits<underlying_type>

## underlying_type

template<typename ENUM >

using pqxx::enum_traits< ENUM >::underlying_type = typename std::underlying_type<ENUM>::type

## Member Function Documentation

## from_string()

template<typename ENUM >

static void pqxx::enum_traits< ENUM >::from_string | ( | const char | Str[],
|  | ENUM & | Obj
| ) |  |

static

## has_null()

template<typename ENUM >

static constexpr bool pqxx::enum_traits< ENUM >::has_null | ( |  | ) |

static constexpr noexcept

## null()

template<typename ENUM >

static ENUM pqxx::enum_traits< ENUM >::null | ( |  | ) |

static

References pqxx::internal::throw_null_conversion().

## to_string()

template<typename ENUM >

static std::string pqxx::enum_traits< ENUM >::to_string | ( | ENUM | Obj | ) |

static

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

- strconv.hxx