|
#include <CVariant.h>

Classes | |
| union | variantData |
| Internal variant data storage. More... | |
Public Member Functions | |
| CVariant () | |
| Constructor. | |
| CVariant (int32_t value) | |
| Constructor. | |
| CVariant (uint32_t value) | |
| Constructor. | |
| CVariant (int64_t value) | |
| Constructor. | |
| CVariant (uint64_t value) | |
| Constructor. | |
| CVariant (float value) | |
| Constructor. | |
| CVariant (double value) | |
| Constructor. | |
| CVariant (const char *value) | |
| Constructor. | |
| CVariant (const std::string &v) | |
| Constructor. | |
| CVariant (CDateTime v) | |
| Constructor. | |
| CVariant (const void *value, uint32_t sz) | |
| Constructor. | |
| CVariant (const CBuffer &value) | |
| Constructor. | |
| CVariant (const CVariant &value) | |
| Constructor. | |
| virtual | ~CVariant () |
| Destructor. | |
| virtual void | setBool (bool value) |
| Assignment method. | |
| virtual void | setInteger (int32_t value) |
| Assignment method. | |
| virtual void | setInt64 (int64_t value) |
| Assignment method. | |
| virtual void | setFloat (double value) |
| Assignment method. | |
| virtual void | setMoney (double value) |
| Assignment method. | |
| virtual void | setString (const char *value, uint32_t maxlen=0) |
| Assignment method. | |
| virtual void | setString (const std::string &value) |
| Assignment method. | |
| void | setExternalString (const char *value, int length=-1) |
| Assignment method. | |
| void | setExternalString (const std::string &value) |
| Assignment method. | |
| virtual void | setText (const char *value) |
| Assignment method. | |
| virtual void | setText (const std::string &str) |
| Assignment method. | |
| virtual void | setExternalText (const char *value) |
| Assignment method. | |
| virtual void | setBuffer (const void *value, uint32_t sz) |
| Assignment method. | |
| virtual void | setBuffer (const CBuffer &value) |
| Assignment method. | |
| virtual void | setExternalBuffer (const void *value, uint32_t sz) |
| Assignment method. | |
| virtual void | setBuffer (const std::string &str) |
| Assignment method. | |
| virtual void | setDate (CDateTime value) |
| Assignment method. | |
| virtual void | setDateTime (CDateTime value) |
| Assignment method. | |
| virtual void | setImagePtr (const void *value) |
| Assignment method. | |
| virtual void | setImageNdx (uint32_t value) |
| Assignment method. | |
| virtual CVariant & | operator= (const CVariant &C) |
| Assignment operator. | |
| virtual CVariant & | operator= (int32_t value) |
| Assignment operator. | |
| virtual CVariant & | operator= (int64_t value) |
| Assignment operator. | |
| virtual CVariant & | operator= (uint32_t value) |
| Assignment operator. | |
| virtual CVariant & | operator= (uint64_t value) |
| Assignment operator. | |
| virtual CVariant & | operator= (int16_t value) |
| Assignment operator. | |
| virtual CVariant & | operator= (uint16_t value) |
| Assignment operator. | |
| virtual CVariant & | operator= (float value) |
| Assignment operator. | |
| virtual CVariant & | operator= (double value) |
| Assignment operator. | |
| virtual CVariant & | operator= (const char *value) |
| Assignment operator. | |
| virtual CVariant & | operator= (const std::string &value) |
| Assignment operator. | |
| virtual CVariant & | operator= (CDateTime value) |
| Assignment operator. | |
| virtual CVariant & | operator= (const void *value) |
| Assignment operator. | |
| virtual CVariant & | operator= (const CBuffer &value) |
| Assignment operator. | |
| virtual bool | getBool () const |
| Directly reads the internal data. | |
| virtual const int32_t & | getInteger () const |
| Directly reads the internal data. | |
| virtual const int64_t & | getInt64 () const |
| Directly reads the internal data. | |
| virtual const double & | getFloat () const |
| Directly reads the internal data. | |
| virtual const char * | getString () const |
| Directly reads the internal data. | |
| virtual const char * | getBuffer () const |
| Directly reads the internal data. | |
| virtual const char * | getText () const |
| Directly reads the internal data. | |
| virtual CDateTime | getDateTime () const |
| Directly reads the internal data. | |
| virtual CDateTime | getDate () const |
| Directly reads the internal data. | |
| virtual void * | getImagePtr () const |
| Directly reads the internal data. | |
| virtual uint32_t | getImageNdx () const |
| Directly reads the internal data. | |
| CVariantType | dataType () const |
| Returns the data type. | |
| uint32_t | dataSize () const |
| Returns the data size. | |
| uint32_t | bufferSize () const |
| Returns the allocated buffer size. | |
| void * | dataBuffer () const |
| Returns the internal buffer. | |
| operator bool () const throw (CException) | |
| Conversion operator. | |
| operator int32_t () const throw (CException) | |
| Conversion operator. | |
| operator uint32_t () const throw (CException) | |
| Conversion operator. | |
| operator int64_t () const throw (CException) | |
| Conversion operator. | |
| operator uint64_t () const throw (CException) | |
| Conversion operator. | |
| operator float () const throw (CException) | |
| Conversion operator. | |
| operator double () const throw (CException) | |
| Conversion operator. | |
| operator std::string () const throw (CException) | |
| Conversion operator. | |
| operator CDateTime () const throw (CException) | |
| Conversion operator. | |
| int32_t | asInteger () const throw (CException) |
| Conversion method. | |
| int64_t | asInt64 () const throw (CException) |
| Conversion method. | |
| bool | asBool () const throw (CException) |
| Conversion to bool. | |
| double | asFloat () const throw (CException) |
| Conversion to double. | |
| virtual std::string | asString () const throw (CException) |
| Conversion to string. | |
| CDateTime | asDate () const throw (CException) |
| Conversion method. | |
| CDateTime | asDateTime () const throw (CException) |
| Conversion method. | |
| void * | asImagePtr () const throw (CException) |
| Conversion method. | |
| void | setNull () |
| Sets the NULL state. | |
| bool | isNull () const |
| Null flag. | |
| void | load (const CXmlNode &node) |
| Loads the data from XML node. | |
| void | load (const CXmlNode *node) |
| Loads the data from XML node. | |
| void | save (CXmlNode &node) const |
| Saves the data into XML node. | |
| void | save (CXmlNode *node) const |
| Saves the data into XML node. | |
Static Public Member Functions | |
| static std::string | typeName (CVariantType type) |
| Returns a name for a particular variant type. | |
| static CVariantType | nameType (const char *name) |
| Returns a type for a particular variant type name. | |
Protected Member Functions | |
| void | setData (const CVariant &C) |
| Copies data from another CVariant. | |
| void | releaseBuffers () |
| Releases allocated buffer (if any). | |
| void | dataSize (uint32_t ds) |
| Sets the data size. | |
| void | dataType (uint32_t dt) |
| Sets the data type. | |
Protected Attributes | |
| union sptk::CVariant::variantData | m_data |
| Internal variant data storage. | |
| uint32_t | m_dataSize |
| Data size. | |
| uint16_t | m_dataType |
| Data type. | |
It's not too compact or too fast. It just allows to pass the data of different structure through the same parameter.
| bool sptk::CVariant::asBool | ( | ) | const throw (CException) |
Conversion to bool.
Converts variant string value with first char one of 'Y','y','T','t' to true, and one of 'N','n','F','f' to false. For the integer and float values, the value <=0 is false, and > 0 is true.
| CDateTime sptk::CVariant::asDate | ( | ) | const throw (CException) |
Conversion method.
Converts variant value to CDateTime. The time part of CDdatetime is empty.
| CDateTime sptk::CVariant::asDateTime | ( | ) | const throw (CException) |
Conversion method.
Converts variant value to CDateTime.
| double sptk::CVariant::asFloat | ( | ) | const throw (CException) |
Conversion to double.
Converts variant value to double.
| void* sptk::CVariant::asImagePtr | ( | ) | const throw (CException) |
Conversion method.
Simply returns the internal data pointer for string/text/blob types. For incompatible types throws an exception.
| int64_t sptk::CVariant::asInt64 | ( | ) | const throw (CException) |
Conversion method.
Converts variant value to double.
| int32_t sptk::CVariant::asInteger | ( | ) | const throw (CException) |
Conversion method.
Converts variant value to double.
| virtual std::string sptk::CVariant::asString | ( | ) | const throw (CException) [virtual] |
Conversion to string.
Converts variant value to string.
Reimplemented in sptk::CField.
Referenced by operator std::string().
| void sptk::CVariant::dataSize | ( | uint32_t | ds | ) | [inline, protected] |
Sets the data size.
If data size is 0, the NULL flag is set. Otherwise, the NULL flag is set to false.
| ds | uint32_t, data size (in bytes). |
References VAR_EXTERNAL_BUFFER, VAR_NULL, and VAR_TYPES.
| bool sptk::CVariant::isNull | ( | ) | const [inline] |
| void sptk::CVariant::load | ( | const CXmlNode * | node | ) | [inline] |
Loads the data from XML node.
| node | const CXmlNode*, XML node to load data from |
| void sptk::CVariant::load | ( | const CXmlNode & | node | ) |
| static CVariantType sptk::CVariant::nameType | ( | const char * | name | ) | [static] |
Returns a type for a particular variant type name.
| name | const char*, a variant type name |
| void sptk::CVariant::save | ( | CXmlNode * | node | ) | const [inline] |
Saves the data into XML node.
| node | CXmlNode*, XML node to save data into |
| void sptk::CVariant::save | ( | CXmlNode & | node | ) | const |
| void sptk::CVariant::setNull | ( | ) |
Sets the NULL state.
Useful for the database operations. Releases the memory allocated for string/text/blob types. Retains the data type. Sets the data to zero(s).
| static std::string sptk::CVariant::typeName | ( | CVariantType | type | ) | [static] |
Returns a name for a particular variant type.
| type | CVariantType, a variant type |
union sptk::CVariant::variantData sptk::CVariant::m_data [protected] |
Internal variant data storage.
Data storage union