refs #207, renamed CValueMap to CIndexVariantMap.

* The map will be used with CSimulaorInfo to transfer a variable number of setting information about the flight simulator. It is being used, because it is already DBus and tupel compliant. The new name better fits its purpose.
* Add == operator for CIndexVariantMap (ambiguity error with tupels)
This commit is contained in:
Klaus Basan
2014-04-14 11:15:14 +02:00
parent 2b07012e4f
commit e474671ead
17 changed files with 121 additions and 152 deletions

View File

@@ -1,5 +1,5 @@
#include "valueobject.h"
#include "valuemap.h"
#include "indexvariantmap.h"
#include "blackmiscfreefunctions.h"
namespace BlackMisc
@@ -104,16 +104,16 @@ namespace BlackMisc
}
}
/*!
/*
* Variant map
*/
int CValueObject::apply(const BlackMisc::CValueMap &valueMap)
int CValueObject::apply(const BlackMisc::CIndexVariantMap &indexMap)
{
if (valueMap.isEmpty()) return 0;
if (indexMap.isEmpty()) return 0;
int c = 0;
QMap<int, QVariant>::const_iterator it;
const QMap<int, QVariant> &map = valueMap.map();
const QMap<int, QVariant> &map = indexMap.map();
for (it = map.begin(); it != map.end(); ++it)
{
this->setPropertyByIndex(it.value(), it.key());
@@ -124,11 +124,11 @@ namespace BlackMisc
/*
* Compare with value map
*/
bool operator==(const CValueMap &valueMap, const CValueObject &valueObject)
bool operator==(const CIndexVariantMap &indexMap, const CValueObject &valueObject)
{
if (valueMap.isEmpty()) return valueMap.isWildcard();
if (indexMap.isEmpty()) return indexMap.isWildcard();
QMap<int, QVariant>::const_iterator it;
const QMap<int, QVariant> &map = valueMap.map();
const QMap<int, QVariant> &map = indexMap.map();
for (it = map.begin(); it != map.end(); ++it)
{
// QVariant cannot be compared directly
@@ -140,25 +140,25 @@ namespace BlackMisc
}
/*
* Compare with value map
* Compare with map
*/
bool operator!=(const CValueMap &valueMap, const CValueObject &valueObject)
bool operator!=(const CIndexVariantMap &indexMap, const CValueObject &valueObject)
{
return !(valueMap == valueObject);
return !(indexMap == valueObject);
}
/*
* Compare with value map
* Compare with map
*/
bool operator==(const CValueObject &valueObject, const CValueMap &valueMap)
bool operator==(const CValueObject &valueObject, const CIndexVariantMap &valueMap)
{
return valueMap == valueObject;
}
/*
* Compare with value map
* Compare with map
*/
bool operator!=(const CValueObject &valueObject, const CValueMap &valueMap)
bool operator!=(const CValueObject &valueObject, const CIndexVariantMap &valueMap)
{
return !(valueMap == valueObject);
}