29#include <sptk5/sptk.h>
63 bool isExternalBuffer : 1;
93 explicit operator double()
const;
98 explicit operator int64_t()
const;
103 explicit operator int32_t()
const;
108 explicit operator bool()
const;
113 friend class Variant_SetMethods;
116 using Storage = std::variant<bool, int32_t, int64_t, double, const uint8_t*, const void*, DateTime, Buffer, MoneyData>;
134 : m_storage(std::move(other.m_storage))
135 , m_dataType(std::exchange(other.m_dataType, emptyType))
136 , m_dataSize(std::exchange(other.m_dataSize, 0))
161 return std::get<T>(m_storage);
171 return std::get<T>(m_storage);
186 m_dataType = dataType;
191 m_dataType.type = dataType;
194 void setNull(
bool isNull)
196 m_dataType.isNull = isNull;
199 VariantType type()
const
204 void size(
size_t dataSize)
206 m_dataSize = dataSize;
218 VariantType m_dataType {emptyType};
219 size_t m_dataSize {0};
Definition: VariantData.h:73
uint8_t scale
Scale.
Definition: VariantData.h:77
int64_t quantity
Integer value.
Definition: VariantData.h:76
MoneyData(int64_t quantity, uint8_t scale)
Definition: VariantData.h:84
static std::array< int64_t, 16 > dividers
Dividers that help formatting money data.
Definition: VariantData.h:75
Definition: VariantData.h:112
const T & get() const
Access to variant data.
Definition: VariantData.h:169
VariantData & operator=(VariantData &&other) noexcept=default
void set(const T &value)
Definition: VariantData.h:179
VariantData(VariantData &&other) noexcept
Definition: VariantData.h:133
T & get()
Access to variant data.
Definition: VariantData.h:159
VariantData & operator=(const VariantData &other)=default
VariantData(const VariantData &other)=default
VariantDataType
Definition: VariantData.h:44
@ VAR_MONEY
Special (integer quantity and scale) money.
@ VAR_TEXT
String pointer, corresponding to BLOBS in database.
@ VAR_DATE
DateTime (double)
@ VAR_FLOAT
Floating-point (double)
@ VAR_IMAGE_PTR
Image pointer.
@ VAR_IMAGE_NDX
Image index in object-specific table of image pointers.
@ VAR_STRING
String pointer.
@ VAR_DATE_TIME
DateTime (double)
@ VAR_BUFFER
Data pointer, corresponding to BLOBS in database.
Definition: VariantData.h:60