25#ifndef FBCPP_VARIANT_TYPE_TRAITS_H
26#define FBCPP_VARIANT_TYPE_TRAITS_H
31#include "StructBinding.h"
35#if FB_CPP_USE_BOOST_MULTIPRECISION != 0
36#include <boost/multiprecision/cpp_int.hpp>
37#include <boost/multiprecision/cpp_dec_float.hpp>
40#if FB_CPP_USE_BOOST_DECIMAL != 0
41#include <boost/decimal.hpp>
45namespace fbcpp::impl::reflection
51 struct IsSupportedVariantType : std::false_type
57 struct IsSupportedVariantType<bool> : std::true_type
61 struct IsSupportedVariantType<std::int16_t> : std::true_type
65 struct IsSupportedVariantType<std::int32_t> : std::true_type
69 struct IsSupportedVariantType<std::int64_t> : std::true_type
73 struct IsSupportedVariantType<float> : std::true_type
77 struct IsSupportedVariantType<double> : std::true_type
83 struct IsSupportedVariantType<
ScaledInt16> : std::true_type
87 struct IsSupportedVariantType<
ScaledInt32> : std::true_type
91 struct IsSupportedVariantType<
ScaledInt64> : std::true_type
97 struct IsSupportedVariantType<std::string> : std::true_type
103 struct IsSupportedVariantType<std::vector<std::byte>> : std::true_type
109 struct IsSupportedVariantType<
Date> : std::true_type
113 struct IsSupportedVariantType<
Time> : std::true_type
117 struct IsSupportedVariantType<Timestamp> : std::true_type
121 struct IsSupportedVariantType<TimeTz> : std::true_type
125 struct IsSupportedVariantType<TimestampTz> : std::true_type
131 struct IsSupportedVariantType<OpaqueDate> : std::true_type
135 struct IsSupportedVariantType<OpaqueTime> : std::true_type
139 struct IsSupportedVariantType<OpaqueTimestamp> : std::true_type
143 struct IsSupportedVariantType<OpaqueTimeTz> : std::true_type
147 struct IsSupportedVariantType<OpaqueTimestampTz> : std::true_type
153 struct IsSupportedVariantType<BlobId> : std::true_type
159 struct IsSupportedVariantType<ArrayId> : std::true_type
163#if FB_CPP_USE_BOOST_MULTIPRECISION != 0
166 struct IsSupportedVariantType<
BoostInt128> : std::true_type
183#if FB_CPP_USE_BOOST_DECIMAL != 0
215 struct IsSupportedVariantType<std::monostate> : std::true_type
219 template <
typename T>
220 inline constexpr bool isSupportedVariantTypeV = IsSupportedVariantType<T>::value;
225 template <
typename V, std::
size_t I = 0>
226 struct VariantAlternativesSupported : std::true_type
230 template <
typename V, std::
size_t I>
231 requires(I < std::variant_size_v<V>)
232 struct VariantAlternativesSupported<V, I>
234 using Alt = std::variant_alternative_t<I, V>;
235 static constexpr bool value = isSupportedVariantTypeV<Alt> && VariantAlternativesSupported<V, I + 1>::value;
238 template <
typename V>
239 inline constexpr bool variantAlternativesSupportedV = VariantAlternativesSupported<V>::value;
244namespace fbcpp::impl::reflection
262 struct IsOpaqueType<OpaqueDate> : std::true_type
267 struct IsOpaqueType<OpaqueTime> : std::true_type
272 struct IsOpaqueType<OpaqueTimestamp> : std::true_type
277 struct IsOpaqueType<OpaqueTimeTz> : std::true_type
282 struct IsOpaqueType<OpaqueTimestampTz> : std::true_type
287 struct IsOpaqueType<std::vector<std::byte>> : std::true_type
ScaledNumber< OpaqueInt128 > ScaledOpaqueInt128
Scaled Firebird opaque 128-bit integer.
ScaledNumber< std::int64_t > ScaledInt64
Signed 64-bit scaled number.
ScaledNumber< std::int32_t > ScaledInt32
Signed 32-bit scaled number.
boost::multiprecision::number< boost::multiprecision::cpp_dec_float< 34 > > BoostDecFloat34
34-digit decimal floating point using Boost.Multiprecision.
FB_DEC16 OpaqueDecFloat16
Opaque 16-digit decimal floating point exposed by the Firebird API.
ScaledNumber< std::int16_t > ScaledInt16
Signed 16-bit scaled number.
boost::multiprecision::number< boost::multiprecision::cpp_dec_float< 16 > > BoostDecFloat16
16-digit decimal floating point using Boost.Multiprecision.
boost::decimal::decimal128_t BoostDecimal128
34-digit decimal floating point using Boost.Decimal.
boost::decimal::decimal32_t BoostDecimal32
7-digit decimal floating point using Boost.Decimal.
std::chrono::year_month_day Date
Firebird SQL calendar date.
FB_DEC34 OpaqueDecFloat34
Opaque 34-digit decimal floating point exposed by the Firebird API.
boost::multiprecision::int128_t BoostInt128
128-bit integer using Boost.Multiprecision.
ScaledNumber< BoostInt128 > ScaledBoostInt128
Scaled 128-bit integer backed by Boost.Multiprecision.
boost::decimal::decimal64_t BoostDecimal64
16-digit decimal floating point using Boost.Decimal.
std::chrono::hh_mm_ss< std::chrono::microseconds > Time
Firebird SQL time-of-day with microsecond resolution.