Lightweight 0.20250627.0
|
#include <SqlNumeric.hpp>
Public Member Functions | |
constexpr | SqlNumeric (SqlNumeric &&) noexcept=default |
constexpr SqlNumeric & | operator= (SqlNumeric &&) noexcept=default |
constexpr | SqlNumeric (SqlNumeric const &) noexcept=default |
constexpr SqlNumeric & | operator= (SqlNumeric const &) noexcept=default |
constexpr | SqlNumeric (std::floating_point auto value) noexcept |
Constructs a numeric from a floating point value. | |
constexpr | SqlNumeric (SQL_NUMERIC_STRUCT const &value) noexcept |
Constructs a numeric from a SQL_NUMERIC_STRUCT. | |
LIGHTWEIGHT_FORCE_INLINE constexpr void | assign (std::floating_point auto value) noexcept |
Assigns a value to the numeric. | |
LIGHTWEIGHT_FORCE_INLINE constexpr SqlNumeric & | operator= (std::floating_point auto value) noexcept |
Assigns a floating point value to the numeric. | |
constexpr LIGHTWEIGHT_FORCE_INLINE auto | ToUnscaledValue () const noexcept |
Converts the numeric to an unscaled integer value. | |
constexpr LIGHTWEIGHT_FORCE_INLINE float | ToFloat () const noexcept |
Converts the numeric to a floating point value. | |
constexpr LIGHTWEIGHT_FORCE_INLINE double | ToDouble () const noexcept |
Converts the numeric to a double precision floating point value. | |
constexpr LIGHTWEIGHT_FORCE_INLINE long double | ToLongDouble () const noexcept |
Converts the numeric to a long double precision floating point value. | |
constexpr LIGHTWEIGHT_FORCE_INLINE | operator float () const noexcept |
Converts the numeric to a floating point value. | |
constexpr LIGHTWEIGHT_FORCE_INLINE | operator double () const noexcept |
Converts the numeric to a double precision floating point value. | |
constexpr LIGHTWEIGHT_FORCE_INLINE | operator long double () const noexcept |
Converts the numeric to a long double precision floating point value. | |
LIGHTWEIGHT_FORCE_INLINE std::string | ToString () const |
Converts the numeric to a string. | |
constexpr LIGHTWEIGHT_FORCE_INLINE std::weak_ordering | operator<=> (SqlNumeric const &other) const noexcept |
template<std::size_t OtherPrecision, std::size_t OtherScale> | |
constexpr LIGHTWEIGHT_FORCE_INLINE bool | operator== (SqlNumeric< OtherPrecision, OtherScale > const &other) const noexcept |
Public Attributes | |
SQL_NUMERIC_STRUCT | sqlValue {} |
The value is stored as a string to avoid floating point precision issues. | |
Static Public Attributes | |
static constexpr auto | ColumnType = SqlColumnTypeDefinitions::Decimal { .precision = ThePrecision, .scale = TheScale } |
static constexpr auto | Precision = ThePrecision |
Number of total digits. | |
static constexpr auto | Scale = TheScale |
Number of digits after the decimal point. | |
Represents a fixed-point number with a given precision and scale.
Precision is exactly the total number of digits in the number, including the digits after the decimal point.
Scale is the number of digits after the decimal point.
Definition at line 35 of file SqlNumeric.hpp.
|
inlineconstexprnoexcept |
Constructs a numeric from a floating point value.
Definition at line 59 of file SqlNumeric.hpp.
References SqlNumeric< ThePrecision, TheScale >::assign().
|
inlineexplicitconstexprnoexcept |
Constructs a numeric from a SQL_NUMERIC_STRUCT.
Definition at line 65 of file SqlNumeric.hpp.
|
inlineconstexprnoexcept |
Assigns a value to the numeric.
Definition at line 74 of file SqlNumeric.hpp.
References SqlNumeric< ThePrecision, TheScale >::Precision, SqlNumeric< ThePrecision, TheScale >::Scale, and SqlNumeric< ThePrecision, TheScale >::sqlValue.
Referenced by SqlNumeric< ThePrecision, TheScale >::operator=(), and SqlNumeric< ThePrecision, TheScale >::SqlNumeric().
|
inlineconstexprnoexcept |
Assigns a floating point value to the numeric.
Definition at line 91 of file SqlNumeric.hpp.
References SqlNumeric< ThePrecision, TheScale >::assign().
|
inlineconstexprnoexcept |
Converts the numeric to an unscaled integer value.
Definition at line 98 of file SqlNumeric.hpp.
References SqlNumeric< ThePrecision, TheScale >::sqlValue.
Referenced by SqlNumeric< ThePrecision, TheScale >::ToDouble(), SqlNumeric< ThePrecision, TheScale >::ToFloat(), and SqlNumeric< ThePrecision, TheScale >::ToLongDouble().
|
inlineconstexprnoexcept |
Converts the numeric to a floating point value.
Definition at line 109 of file SqlNumeric.hpp.
References SqlNumeric< ThePrecision, TheScale >::Scale, and SqlNumeric< ThePrecision, TheScale >::ToUnscaledValue().
Referenced by SqlNumeric< ThePrecision, TheScale >::operator float(), and SqlNumeric< ThePrecision, TheScale >::ToString().
|
inlineconstexprnoexcept |
Converts the numeric to a double precision floating point value.
Definition at line 115 of file SqlNumeric.hpp.
References SqlNumeric< ThePrecision, TheScale >::Scale, and SqlNumeric< ThePrecision, TheScale >::ToUnscaledValue().
Referenced by SqlNumeric< ThePrecision, TheScale >::operator double().
|
inlineconstexprnoexcept |
Converts the numeric to a long double precision floating point value.
Definition at line 121 of file SqlNumeric.hpp.
References SqlNumeric< ThePrecision, TheScale >::Scale, and SqlNumeric< ThePrecision, TheScale >::ToUnscaledValue().
Referenced by SqlNumeric< ThePrecision, TheScale >::operator long double().
|
inlineexplicitconstexprnoexcept |
Converts the numeric to a floating point value.
Definition at line 127 of file SqlNumeric.hpp.
References SqlNumeric< ThePrecision, TheScale >::ToFloat().
|
inlineexplicitconstexprnoexcept |
Converts the numeric to a double precision floating point value.
Definition at line 133 of file SqlNumeric.hpp.
References SqlNumeric< ThePrecision, TheScale >::ToDouble().
|
inlineexplicitconstexprnoexcept |
Converts the numeric to a long double precision floating point value.
Definition at line 139 of file SqlNumeric.hpp.
References SqlNumeric< ThePrecision, TheScale >::ToLongDouble().
|
inline |
Converts the numeric to a string.
Definition at line 145 of file SqlNumeric.hpp.
References SqlNumeric< ThePrecision, TheScale >::Scale, and SqlNumeric< ThePrecision, TheScale >::ToFloat().
|
inlineconstexprnoexcept |
Definition at line 150 of file SqlNumeric.hpp.
|
inlineconstexprnoexcept |
Definition at line 156 of file SqlNumeric.hpp.
|
staticconstexpr |
Definition at line 37 of file SqlNumeric.hpp.
|
staticconstexpr |
Number of total digits.
Definition at line 40 of file SqlNumeric.hpp.
Referenced by SqlNumeric< ThePrecision, TheScale >::assign().
|
staticconstexpr |
Number of digits after the decimal point.
Definition at line 43 of file SqlNumeric.hpp.
Referenced by SqlNumeric< ThePrecision, TheScale >::assign(), SqlNumeric< ThePrecision, TheScale >::ToDouble(), SqlNumeric< ThePrecision, TheScale >::ToFloat(), SqlNumeric< ThePrecision, TheScale >::ToLongDouble(), and SqlNumeric< ThePrecision, TheScale >::ToString().
SQL_NUMERIC_STRUCT SqlNumeric< ThePrecision, TheScale >::sqlValue {} |
The value is stored as a string to avoid floating point precision issues.
Definition at line 49 of file SqlNumeric.hpp.
Referenced by SqlNumeric< ThePrecision, TheScale >::assign(), and SqlNumeric< ThePrecision, TheScale >::ToUnscaledValue().