37#if FB_CPP_USE_BOOST_MULTIPRECISION != 0
38#include <boost/multiprecision/cpp_int.hpp>
39#include <boost/multiprecision/cpp_dec_float.hpp>
42#if FB_CPP_USE_BOOST_DECIMAL != 0
43#include <boost/decimal.hpp>
60 if constexpr (std::is_same_v<T, FB_I128>)
95#if FB_CPP_USE_BOOST_MULTIPRECISION != 0
107#if FB_CPP_USE_BOOST_MULTIPRECISION != 0
111 using BoostDecFloat16 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<16>>;
116 using BoostDecFloat34 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<34>>;
119#if FB_CPP_USE_BOOST_DECIMAL != 0
139 using Date = std::chrono::year_month_day;
144 using Time = std::chrono::hh_mm_ss<std::chrono::microseconds>;
151 bool operator==(
const Timestamp& o)
const noexcept
161 std::chrono::local_time<std::chrono::microseconds>
toLocalTime() const noexcept
163 return std::chrono::local_days{
date} +
time.to_duration();
171 const auto days = std::chrono::floor<std::chrono::days>(value);
172 const Date dateValue{days};
173 const auto timeOfDay = std::chrono::duration_cast<std::chrono::microseconds>(value - days);
194 bool operator==(
const TimeTz& o)
const noexcept
215 bool operator==(
const TimestampTz&)
const noexcept =
default;
253 bool operator==(
const OpaqueDate&)
const noexcept =
default;
266 bool operator==(
const OpaqueTime&)
const noexcept =
default;
281 return value.timestamp_date == o.
value.timestamp_date &&
value.timestamp_time == o.
value.timestamp_time;
313 return value.utc_timestamp.timestamp_date == o.
value.utc_timestamp.timestamp_date &&
314 value.utc_timestamp.timestamp_time == o.
value.utc_timestamp.timestamp_time &&
328 template <
typename T>
331 os << scaledNumber.
value <<
"e" << scaledNumber.
scale;
342struct std::formatter<
fbcpp::ScaledNumber<T>> : std::formatter<T>
347 constexpr auto parse(format_parse_context& ctx)
349 return std::formatter<T>::parse(ctx);
355 template <
typename FormatContext>
358 const auto valueEnd = std::formatter<T>::format(scaledNumber.
value, ctx);
359 return std::format_to(valueEnd,
"e{}", scaledNumber.
scale);
std::ostream & operator<<(std::ostream &os, const fbcpp::ScaledNumber< T > &scaledNumber)
Stream insertion helper that renders the scaled number as value followed by e and the scale.
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.
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.
FB_I128 OpaqueInt128
Opaque 128-bit integer exposed by the Firebird API.
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.
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.
Wrapper for Firebird date values.
ISC_DATE value
Raw Firebird date representation.
Wrapper for Firebird time-with-time-zone values.
ISC_TIME_TZ value
Raw Firebird time-with-time-zone representation.
Wrapper for Firebird time values.
ISC_TIME value
Raw Firebird time representation.
Wrapper for Firebird timestamp-with-time-zone values.
ISC_TIMESTAMP_TZ value
Raw Firebird timestamp-with-time-zone representation.
Wrapper for Firebird timestamp values.
ISC_TIMESTAMP value
Raw Firebird timestamp representation.
Represents a numeric value with an explicit decimal scale.
int scale
Decimal scale applied to value.
T value
Unscaled numeric value.
Local time bound to a time zone.
Time utcTime
UTC-normalised time-of-day.
std::string zone
Time zone identifier.
Timestamp bound to a time zone.
Timestamp utcTimestamp
UTC-normalised timestamp.
std::string zone
Time zone identifier.
Combined date and time with microsecond precision.
std::chrono::local_time< std::chrono::microseconds > toLocalTime() const noexcept
Converts to std::chrono::local_time<std::chrono::microseconds>.
Time time
Time-of-day component.
Date date
Calendar date component.
static Timestamp fromLocalTime(std::chrono::local_time< std::chrono::microseconds > value) noexcept
Builds a timestamp from a local-time value.