libpqxx
|
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) |
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.
using pqxx::enum_traits< ENUM >::underlying_traits = string_traits<underlying_type> |
using pqxx::enum_traits< ENUM >::underlying_type = typename std::underlying_type<ENUM>::type |
|
static |
References pqxx::from_string().
|
staticnoexcept |
|
static |
References pqxx::internal::throw_null_conversion().
|
static |
References pqxx::to_string().