1 #ifndef _KVI_KVS_VARIANT_H_
2 #define _KVI_KVS_VARIANT_H_
89 bool isReal()
const {
return m_type == Real; };
95 bool isInteger()
const {
return m_type == Integer; };
377 KviKvsVariant(
const QString & szString,
bool bEscape =
false);
488 void setString(
const QString & szString);
495 void setString(QString * pszString);
516 void setBoolean(
bool bBoolean);
536 void getTypeName(QString &
szBuffer)
const;
602 bool isEmpty()
const;
608 bool isEqualToNothing()
const;
635 bool asBoolean()
const;
649 void asString(QString &
szBuffer)
const;
656 void appendAsString(QString &
szBuffer)
const;
674 void castToInteger(
kvs_int_t & iVal)
const;
689 void convertToArray();
713 bool boolean()
const {
return m_pData ? m_pData->m_u.bBoolean :
false; };
766 void dump(
const char * pcPrefix)
const;
778 int compare(
const KviKvsVariant * pOther,
bool bPreferNumeric =
false)
const;
786 void serialize(QString & szResult);
793 static void serializeString(QString &
szBuffer);
822 static KviKvsVariant * unserializeBool(
const QChar ** ppAux,
bool bBool);
829 static KviKvsVariant * unserializeNull(
const QChar ** ppAux);
836 static KviKvsVariant * unserializeArray(
const QChar ** ppAux);
843 static KviKvsVariant * unserializeHash(
const QChar ** ppAux);
851 static void unserializeString(
const QChar ** ppAux, QString &
szBuffer);
858 static KviKvsVariant * unserializeString(
const QChar ** ppAux);
865 static KviKvsVariant * unserializeNumber(
const QChar ** ppAux);
873 static KviKvsVariant * unserializeReal(
const QChar ** ppAux, QString & szData);
881 static KviKvsVariant * unserializeInteger(
const QChar ** ppAux, QString & szData);
887 #endif // _KVI_KVS_VARIANT_H_
static int compareRealHash(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares a double floating point and a hash variant.
Definition: KviKvsVariant.cpp:134
static int compareIntArray(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares an integer and an array variant.
Definition: KviKvsVariant.cpp:81
Definition: KviKvsVariant.h:123
Definition: KviHeapObject.h:124
KviKvsVariantData::Type type()
Returns the type of the variant data.
Definition: KviKvsVariant.h:460
The class which holds the type of the variant data.
Definition: KviKvsVariant.h:114
Definition: KviKvsVariant.h:60
Holds the value of the variant data.
Definition: KviKvsVariant.h:138
bool isReal() const
Returns true if the number is a double floating point.
Definition: KviKvsVariant.h:89
This class defines a new data type which contains variant data.
Definition: KviKvsVariant.h:351
bool isNumeric() const
Returns true if the variant is numeric.
Definition: KviKvsVariant.h:560
#define KVIRC_API
Definition: kvi_settings.h:128
Definition: KviKvsVariant.h:130
const QString & string() const
Returns the string contained in the variant data.
Definition: KviKvsVariant.h:707
kvs_hobject_t hObject
Definition: KviKvsVariant.h:145
Definition: KviKvsVariant.h:167
bool isBoolean() const
Returns true if the variant is boolean.
Definition: KviKvsVariant.h:590
Definition: KviKvsVariant.h:169
static int compareArrayHash(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares an array and a hash variant.
Definition: KviKvsVariant.cpp:217
Type m_eType
Definition: KviKvsVariant.h:150
Definition: KviKvsVariant.h:129
kvs_int_t integer() const
Returns the integer contained in the variant data.
Definition: KviKvsVariant.h:695
DataType m_u
Definition: KviKvsVariant.h:76
bool boolean() const
Returns the boolean contained in the variant data.
Definition: KviKvsVariant.h:713
KviKvsVariantData * m_pData
Definition: KviKvsVariant.h:453
static int compareHObjectHash(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares an object handle and a hash variant.
Definition: KviKvsVariant.cpp:226
kvs_real_t real() const
Returns the double floating point contained in the variant data.
Definition: KviKvsVariant.h:701
kvs_int_t integer() const
Return the integer number if the number itself is an integer.
Definition: KviKvsVariant.h:107
unsigned int m_uRefs
Definition: KviKvsVariant.h:149
static int compareIntReal(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares an integer and a double floating point variant.
Definition: KviKvsVariant.cpp:58
static int compareBoolHObject(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares a boolean and an object handle variant.
Definition: KviKvsVariant.cpp:209
#define n
Definition: detector.cpp:78
bool isHObject() const
Returns true if the variant is a hObject.
Definition: KviKvsVariant.h:596
kvs_int_t iInt
Definition: KviKvsVariant.h:139
void operator=(const KviKvsVariant &variant)
Allows to create a variant using a carbon copy method.
Definition: KviKvsVariant.h:807
KviKvsArray * pArray
Definition: libkviserverdb.cpp:476
static int compareRealBool(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares a double floating point and a boolean variant.
Definition: KviKvsVariant.cpp:127
Type m_type
Definition: KviKvsVariant.h:75
KviKvsHash * hash() const
Returns the hash contained in the variant data.
Definition: KviKvsVariant.h:725
Handling of array data type in KVS.
static int compareRealHObject(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares a double floating point and an object handle variant.
Definition: KviKvsVariant.cpp:95
This class defines a new data type which contains hash data.
Definition: KviKvsHash.h:47
kvs_real_t * pReal
Definition: KviKvsVariant.h:140
bool isNothing() const
Returns true if the variant is empty.
Definition: KviKvsVariant.h:542
kvs_real_t real() const
Return the real number if the number itself is a double floating point.
Definition: KviKvsVariant.h:101
static int compareStringHObject(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares a string and an object handle variant.
Definition: KviKvsVariant.cpp:166
static int compareIntBool(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares an integer and a boolean variant.
Definition: KviKvsVariant.cpp:67
QString * pString
Definition: KviKvsVariant.h:141
bool isHash() const
Returns true if the variant is an hash.
Definition: KviKvsVariant.h:584
Definition: KviKvsVariant.h:126
Definition: KviKvsVariant.h:124
Type
Holds the type of the variant data.
Definition: KviKvsVariant.h:121
const QString Empty
A global empty string (note that this is ALSO NULL under Qt 3.x)
Definition: KviQString.cpp:49
Type type() const
Returns the type of the number.
Definition: KviKvsVariant.h:83
Type
Describes the type of number.
Definition: KviKvsVariant.h:58
bool isScalar() const
Returns true if the variant is a scalar.
Definition: KviKvsVariant.h:572
bool isReal() const
Returns true if the variant is a double floating point.
Definition: KviKvsVariant.h:554
Definition: KviKvsVariant.h:168
static int compareIntString(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares an integer and a string variant.
Definition: KviKvsVariant.cpp:33
DataType m_u
Definition: KviKvsVariant.h:151
static int compareIntHash(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares an integer and a hash variant.
Definition: KviKvsVariant.cpp:74
bool isString() const
Returns true if the variant is a string.
Definition: KviKvsVariant.h:566
static int compareStringHash(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares a string and a hash variant.
Definition: KviKvsVariant.cpp:148
double kvs_real_t
Definition: KviKvsTypes.h:35
kvs_int_t iInt
Definition: KviKvsVariant.h:70
KviKvsArray * array() const
Returns the array contained in the variant data.
Definition: KviKvsVariant.h:719
static int compareHObjectArray(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares an object handle and an array variant.
Definition: KviKvsVariant.cpp:233
bool bBoolean
Definition: KviKvsVariant.h:144
static int compareRealString(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares a double floating point and a string variant.
Definition: KviKvsVariant.cpp:102
Definition: KviKvsVariant.h:128
Definition: KviKvsVariant.h:127
Result
Holds the result of the comparison.
Definition: KviKvsVariant.h:165
static int compareRealArray(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares a double floating point and an array variant.
Definition: KviKvsVariant.cpp:141
KviKvsArray * pArray
Definition: KviKvsVariant.h:142
A class which maps every number.
Definition: KviKvsVariant.h:49
Definition: KviKvsVariant.h:125
kvs_real_t dReal
Definition: KviKvsVariant.h:71
This class defines a new data type which contains array data.
Definition: KviKvsArray.h:43
static int compareBoolString(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares a boolean and a string variant.
Definition: KviKvsVariant.cpp:185
void * kvs_hobject_t
Definition: KviKvsTypes.h:32
static int compareIntHObject(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares an integer and an object handle variant.
Definition: KviKvsVariant.cpp:88
bool isArray() const
Returns true if the variant is an array.
Definition: KviKvsVariant.h:578
char szBuffer[4096]
Definition: winamp.cpp:77
bool isInteger() const
Returns true if the variant is an integer.
Definition: KviKvsVariant.h:548
static int compareBoolArray(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares a boolean and an array variant.
Definition: KviKvsVariant.cpp:201
Handling of hash data type in KVS.
This file contains compile time settings.
A class for comparison between two variant data.
Definition: KviKvsVariant.h:158
static int compareStringArray(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares a string and an array variant.
Definition: KviKvsVariant.cpp:157
kvi_i64_t kvs_int_t
Definition: KviKvsTypes.h:33
static int compareBoolHash(const KviKvsVariant *pV1, const KviKvsVariant *pV2)
Compares a boolean and a hash variant.
Definition: KviKvsVariant.cpp:193
KviKvsHash * pHash
Definition: KviKvsVariant.h:143
Helper functions for the QString class.
This union holds an integer or a double floating point number.
Definition: KviKvsVariant.h:69
kvs_hobject_t hobject() const
Returns the object handle contained in the variant data.
Definition: KviKvsVariant.h:731
bool isInteger() const
Returns true if the number is an integer.
Definition: KviKvsVariant.h:95
Definition: KviKvsArrayCast.h:30