29#include <sptk5/Buffer.h>
30#include <sptk5/DateTime.h>
31#include <sptk5/Exception.h>
32#include <sptk5/VariantData.h>
33#include <sptk5/sptk.h>
125 return m_data.get<T>();
136 return m_data.get<T>();
157 [[nodiscard]]
virtual const char*
getText()
const;
185 return m_data.type().isExternalBuffer;
250 virtual void setMoney(int64_t value,
unsigned scale);
361 [[nodiscard]]
const char* getBufferPtr()
const;
519 virtual explicit operator bool()
const;
524 virtual explicit operator int()
const;
529 virtual explicit operator int64_t()
const;
534 virtual explicit operator uint64_t()
const;
539 virtual explicit operator double()
const;
544 virtual explicit operator String()
const;
555 virtual void load(
const std::shared_ptr<xdoc::Node>& element);
561 void save(
const std::shared_ptr<xdoc::Node>& node)
const;
virtual String moneyDataToString() const
virtual const char * getText() const
VariantDataType dataType() const
size_t bufferSize() const
T & get()
Direct and fast access to variant data.
Definition: Variant.h:134
bool isExternalBuffer() const
Definition: Variant.h:183
void dataType(VariantDataType newDataType)
virtual const uint8_t * getExternalBuffer() const
virtual const MoneyData & getMoney() const
static String typeName(VariantDataType type)
void dataSize(size_t newDataSize)
const T & get() const
Direct and fast const access to variant data.
Definition: Variant.h:123
BaseVariant(BaseVariant &&other) noexcept=default
Move constructor.
virtual const uint8_t * getImagePtr() const
static VariantDataType nameType(const char *name)
void dataType(VariantType newDataType)
virtual uint32_t getImageNdx() const
BaseVariant(const BaseVariant &other)=default
Copy constructor.
virtual ~BaseVariant()=default
Destructor.
VariantData m_data
Internal variant data storage.
Definition: Variant.h:194
BaseVariant()=default
Default constructor.
virtual const char * getString() const
Definition: DateTime.h:86
Definition: VariantData.h:73
Definition: Variant.h:203
const uint8_t * asImagePtr() const
virtual void setImagePtr(const uint8_t *value)
VariantAdaptors(VariantAdaptors &&other) noexcept=default
Move constructor.
void setData(const BaseVariant &other)
virtual void setBool(bool value)
virtual void setFloat(double value)
virtual void setMoney(const MoneyData &value)
virtual void setDateTime(DateTime value, bool dateOnly=false)
virtual void setBuffer(const uint8_t *value, size_t valueSize, VariantDataType type=VariantDataType::VAR_BUFFER)
virtual void setNull(VariantDataType vtype=VariantDataType::VAR_NONE)
virtual void setInt64(int64_t value)
virtual void setMoney(int64_t value, unsigned scale)
virtual void setImageNdx(uint32_t value)
virtual void setInteger(int32_t value)
VariantAdaptors()=default
Default constructor.
virtual String asString() const
virtual void setString(const String &value)
virtual void setExternalBuffer(uint8_t *value, size_t valueSize, VariantDataType type=VariantDataType::VAR_BUFFER)
DateTime asDateTime() const
VariantAdaptors(const VariantAdaptors &other)=default
Copy constructor.
~VariantAdaptors() override=default
Default destructor.
Definition: VariantData.h:112
Definition: Variant.h:372
virtual Variant & operator=(const MoneyData &value)
Variant(const Variant &other)=default
virtual Variant & operator=(double value)
virtual void load(const std::shared_ptr< xdoc::Node > &element)
Variant(const Buffer &value)
virtual Variant & operator=(int64_t value)
Variant & operator=(Variant &&other) noexcept
virtual Variant & operator=(int32_t value)
Variant(int64_t value, unsigned scale=1)
virtual Variant & operator=(const Buffer &value)
virtual Variant & operator=(bool value)
Variant & operator=(const Variant &other)
Variant(const char *value)
virtual Variant & operator=(DateTime value)
Variant(Variant &&other) noexcept=default
void save(const std::shared_ptr< xdoc::Node > &node) const
Variant(const uint8_t *value, size_t sz)
virtual Variant & operator=(const char *value)
Variant(const DateTime &v)
virtual Variant & operator=(const uint8_t *value)
virtual Variant & operator=(const String &value)
VariantDataType
Definition: VariantData.h:44
std::vector< Variant > VariantVector
Definition: Variant.h:567
@ VAR_BUFFER
Data pointer, corresponding to BLOBS in database.
Definition: VariantData.h:60