#include <Variant.h>
Public Member Functions | |
Variant () | |
Variant (bool value) | |
Variant (int32_t value) | |
Variant (int64_t value, unsigned scale=1) | |
Variant (double value) | |
Variant (const char *value) | |
Variant (const String &v) | |
Variant (const DateTime &v) | |
Variant (const uint8_t *value, size_t sz) | |
Variant (const Buffer &value) | |
Variant (const Variant &other)=default | |
Variant (Variant &&other) noexcept=default | |
~Variant () override | |
Variant & | operator= (const Variant &other) |
Variant & | operator= (Variant &&other) noexcept |
virtual Variant & | operator= (bool value) |
virtual Variant & | operator= (int32_t value) |
virtual Variant & | operator= (int64_t value) |
virtual Variant & | operator= (double value) |
virtual Variant & | operator= (const MoneyData &value) |
virtual Variant & | operator= (const char *value) |
virtual Variant & | operator= (const String &value) |
virtual Variant & | operator= (DateTime value) |
virtual Variant & | operator= (const uint8_t *value) |
virtual Variant & | operator= (const Buffer &value) |
virtual | operator bool () const |
virtual | operator int () const |
virtual | operator int64_t () const |
virtual | operator uint64_t () const |
virtual | operator double () const |
virtual | operator String () const |
virtual | operator DateTime () const |
virtual void | load (const std::shared_ptr< xdoc::Node > &element) |
void | save (const std::shared_ptr< xdoc::Node > &node) const |
Public Member Functions inherited from sptk::VariantAdaptors | |
VariantAdaptors ()=default | |
Default constructor. | |
VariantAdaptors (const VariantAdaptors &other)=default | |
Copy constructor. More... | |
VariantAdaptors (VariantAdaptors &&other) noexcept=default | |
Move constructor. More... | |
~VariantAdaptors () override=default | |
Default destructor. | |
virtual void | setBool (bool value) |
virtual void | setInteger (int32_t value) |
virtual void | setInt64 (int64_t value) |
virtual void | setFloat (double value) |
virtual void | setMoney (int64_t value, unsigned scale) |
virtual void | setString (const String &value) |
virtual void | setBuffer (const uint8_t *value, size_t valueSize, VariantDataType type=VariantDataType::VAR_BUFFER) |
virtual void | setExternalBuffer (uint8_t *value, size_t valueSize, VariantDataType type=VariantDataType::VAR_BUFFER) |
virtual void | setDateTime (DateTime value, bool dateOnly=false) |
virtual void | setImagePtr (const uint8_t *value) |
virtual void | setImageNdx (uint32_t value) |
virtual void | setMoney (const MoneyData &value) |
virtual void | setNull (VariantDataType vtype=VariantDataType::VAR_NONE) |
int | asInteger () const |
int64_t | asInt64 () const |
bool | asBool () const |
double | asFloat () const |
virtual String | asString () const |
DateTime | asDate () const |
DateTime | asDateTime () const |
const uint8_t * | asImagePtr () const |
Public Member Functions inherited from sptk::BaseVariant | |
BaseVariant ()=default | |
Default constructor. | |
BaseVariant (const BaseVariant &other)=default | |
Copy constructor. More... | |
BaseVariant (BaseVariant &&other) noexcept=default | |
Move constructor. More... | |
virtual | ~BaseVariant ()=default |
Destructor. | |
VariantDataType | dataType () const |
size_t | dataSize () const |
void | dataSize (size_t newDataSize) |
size_t | bufferSize () const |
bool | isNull () const |
template<typename T > | |
const T & | get () const |
Direct and fast const access to variant data. More... | |
template<typename T > | |
T & | get () |
Direct and fast access to variant data. More... | |
virtual const MoneyData & | getMoney () const |
virtual const char * | getString () const |
virtual const uint8_t * | getExternalBuffer () const |
virtual const char * | getText () const |
virtual const uint8_t * | getImagePtr () const |
virtual uint32_t | getImageNdx () const |
Additional Inherited Members | |
Static Public Member Functions inherited from sptk::BaseVariant | |
static String | typeName (VariantDataType type) |
static VariantDataType | nameType (const char *name) |
Protected Member Functions inherited from sptk::VariantAdaptors | |
void | setData (const BaseVariant &other) |
const char * | getBufferPtr () const |
Protected Member Functions inherited from sptk::BaseVariant | |
void | dataType (VariantType newDataType) |
void | dataType (VariantDataType newDataType) |
bool | isExternalBuffer () const |
virtual String | moneyDataToString () const |
Protected Attributes inherited from sptk::BaseVariant | |
VariantData | m_data |
Internal variant data storage. | |
Universal data storage.
Reasonably compact an fast class what allows storing data of different types. It also allows conversions to and from supported types.
sptk::Variant::Variant | ( | ) |
Constructor
sptk::Variant::Variant | ( | bool | value | ) |
Constructor
sptk::Variant::Variant | ( | int32_t | value | ) |
Constructor
sptk::Variant::Variant | ( | int64_t | value, |
unsigned | scale = 1 |
||
) |
Constructor
sptk::Variant::Variant | ( | double | value | ) |
Constructor
sptk::Variant::Variant | ( | const char * | value | ) |
Constructor
sptk::Variant::Variant | ( | const String & | v | ) |
Constructor
sptk::Variant::Variant | ( | const DateTime & | v | ) |
Constructor
sptk::Variant::Variant | ( | const uint8_t * | value, |
size_t | sz | ||
) |
|
explicitdefault |
Copy constructor
other | Other object |
|
defaultnoexcept |
Move constructor
other | Other object |
|
override |
Destructor
|
virtual |
Loads the data from XML node
element | XML node to load data from |
|
explicitvirtual |
Conversion operator
|
explicitvirtual |
Conversion operator
|
explicitvirtual |
Conversion operator
|
explicitvirtual |
Conversion operator
|
explicitvirtual |
Conversion operator
|
explicitvirtual |
Conversion operator
|
explicitvirtual |
Conversion operator
|
virtual |
Assignment operator
value | Value to assign |
Reimplemented in sptk::QueryParameter, and sptk::Field.
|
virtual |
Assignment operator
value | Value to assign |
Reimplemented in sptk::QueryParameter, and sptk::Field.
Assignment operator
value | Value to assign |
|
virtual |
Assignment operator
value | Value to assign |
Reimplemented in sptk::QueryParameter, and sptk::Field.
Assignment operator
other | Other object |
Assignment operator
value | Value to assign |
Reimplemented in sptk::QueryParameter, and sptk::Field.
|
virtual |
Assignment operator
value | Value to assign |
Reimplemented in sptk::QueryParameter, and sptk::Field.
|
virtual |
Assignment operator
value | Value to assign |
Reimplemented in sptk::QueryParameter, and sptk::Field.
|
virtual |
Assignment operator
value | Value to assign |
Reimplemented in sptk::QueryParameter, and sptk::Field.
Assignment operator
other | Other object |
void sptk::Variant::save | ( | const std::shared_ptr< xdoc::Node > & | node | ) | const |
Saves the data into XML node
node | XML node to save data into |