Issue #77 All classes propertyindex methods use CPropertyIndexRef and QVariant

This commit is contained in:
Mat Sutcliffe
2020-11-01 20:05:34 +00:00
parent d9e3d1dccc
commit 0971c8ce68
190 changed files with 1298 additions and 1293 deletions

View File

@@ -160,27 +160,27 @@ namespace BlackMisc
return this->matchesLevel(l1, l2, l3);
}
CVariant CAircraftCategory::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
QVariant CAircraftCategory::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexName: return CVariant::fromValue(m_name);
case IndexDescription: return CVariant::fromValue(m_description);
case IndexAssignable: return CVariant::fromValue(m_assignable);
case IndexPath: return CVariant::fromValue(m_path);
case IndexLevelString: return CVariant::fromValue(this->getLevelString());
case IndexLevelStringAndName: return CVariant::fromValue(this->getLevelAndName());
case IndexLevelStringAndPath: return CVariant::fromValue(this->getLevelAndPath());
case IndexName: return QVariant::fromValue(m_name);
case IndexDescription: return QVariant::fromValue(m_description);
case IndexAssignable: return QVariant::fromValue(m_assignable);
case IndexPath: return QVariant::fromValue(m_path);
case IndexLevelString: return QVariant::fromValue(this->getLevelString());
case IndexLevelStringAndName: return QVariant::fromValue(this->getLevelAndName());
case IndexLevelStringAndPath: return QVariant::fromValue(this->getLevelAndPath());
default: return CValueObject::propertyByIndex(index);
}
}
void CAircraftCategory::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CAircraftCategory::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CAircraftCategory>(); return; }
if (index.isMyself()) { (*this) = variant.value<CAircraftCategory>(); return; }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
@@ -192,7 +192,7 @@ namespace BlackMisc
}
}
int CAircraftCategory::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftCategory &compareValue) const
int CAircraftCategory::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftCategory &compareValue) const
{
if (index.isMyself()) { return m_path.compare(compareValue.getPath(), Qt::CaseInsensitive); }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue);}

View File

@@ -129,13 +129,13 @@ namespace BlackMisc
void setAssignable(bool assignable) { m_assignable = assignable; }
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant);
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftCategory &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftCategory &compareValue) const;
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;

View File

@@ -653,37 +653,37 @@ namespace BlackMisc
matchesFamily(icaoIataOrFamily);
}
CVariant CAircraftIcaoCode::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
QVariant CAircraftIcaoCode::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexAircraftDesignator: return CVariant::fromValue(m_designator);
case IndexAircraftDesignator: return QVariant::fromValue(m_designator);
case IndexCategory: return m_category.propertyByIndex(index.copyFrontRemoved());
case IndexIataCode: return CVariant::fromValue(m_iataCode);
case IndexFamily: return CVariant::fromValue(m_family);
case IndexCombinedAircraftType: return CVariant::fromValue(m_combinedType);
case IndexModelDescription: return CVariant::fromValue(m_modelDescription);
case IndexModelIataDescription: return CVariant::fromValue(m_modelIataDescription);
case IndexModelSwiftDescription: return CVariant::fromValue(m_modelSwiftDescription);
case IndexCombinedDescription: return CVariant::fromValue(this->getCombinedModelDescription());
case IndexManufacturer: return CVariant::fromValue(m_manufacturer);
case IndexWtc: return CVariant::fromValue(m_wtc);
case IndexIsVtol: return CVariant::fromValue(this->isVtol());
case IndexIsLegacy: return CVariant::fromValue(m_legacy);
case IndexIsMilitary: return CVariant::fromValue(m_military);
case IndexIsRealworld: return CVariant::fromValue(m_realWorld);
case IndexRank: return CVariant::fromValue(m_rank);
case IndexDesignatorManufacturer: return CVariant::fromValue(this->getDesignatorManufacturer());
case IndexIataCode: return QVariant::fromValue(m_iataCode);
case IndexFamily: return QVariant::fromValue(m_family);
case IndexCombinedAircraftType: return QVariant::fromValue(m_combinedType);
case IndexModelDescription: return QVariant::fromValue(m_modelDescription);
case IndexModelIataDescription: return QVariant::fromValue(m_modelIataDescription);
case IndexModelSwiftDescription: return QVariant::fromValue(m_modelSwiftDescription);
case IndexCombinedDescription: return QVariant::fromValue(this->getCombinedModelDescription());
case IndexManufacturer: return QVariant::fromValue(m_manufacturer);
case IndexWtc: return QVariant::fromValue(m_wtc);
case IndexIsVtol: return QVariant::fromValue(this->isVtol());
case IndexIsLegacy: return QVariant::fromValue(m_legacy);
case IndexIsMilitary: return QVariant::fromValue(m_military);
case IndexIsRealworld: return QVariant::fromValue(m_realWorld);
case IndexRank: return QVariant::fromValue(m_rank);
case IndexDesignatorManufacturer: return QVariant::fromValue(this->getDesignatorManufacturer());
default: return CValueObject::propertyByIndex(index);
}
}
void CAircraftIcaoCode::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CAircraftIcaoCode::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CAircraftIcaoCode>(); return; }
if (index.isMyself()) { (*this) = variant.value<CAircraftIcaoCode>(); return; }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
@@ -705,7 +705,7 @@ namespace BlackMisc
}
}
int CAircraftIcaoCode::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftIcaoCode &compareValue) const
int CAircraftIcaoCode::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftIcaoCode &compareValue) const
{
if (index.isMyself()) { return m_designator.compare(compareValue.getDesignator(), Qt::CaseInsensitive); }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue);}

View File

@@ -293,13 +293,13 @@ namespace BlackMisc
bool matchesDesignatorIataOrFamily(const QString &icaoIataOrFamily) const;
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant);
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftIcaoCode &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftIcaoCode &compareValue) const;
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;

View File

@@ -97,29 +97,29 @@ namespace BlackMisc
return s;
}
CVariant CAircraftLights::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
QVariant CAircraftLights::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexIsNull: return CVariant::from(this->isNull());
case IndexBeacon: return CVariant::from(m_beaconOn);
case IndexLanding: return CVariant::from(m_landingOn);
case IndexLogo: return CVariant::from(m_logoOn);
case IndexNav: return CVariant::from(m_navOn);
case IndexStrobe: return CVariant::from(m_strobeOn);
case IndexTaxi: return CVariant::from(m_taxiOn);
case IndexRecognition: return CVariant::from(m_recognition);
case IndexCabin: return CVariant::from(m_cabin);
case IndexIsNull: return QVariant::fromValue(this->isNull());
case IndexBeacon: return QVariant::fromValue(m_beaconOn);
case IndexLanding: return QVariant::fromValue(m_landingOn);
case IndexLogo: return QVariant::fromValue(m_logoOn);
case IndexNav: return QVariant::fromValue(m_navOn);
case IndexStrobe: return QVariant::fromValue(m_strobeOn);
case IndexTaxi: return QVariant::fromValue(m_taxiOn);
case IndexRecognition: return QVariant::fromValue(m_recognition);
case IndexCabin: return QVariant::fromValue(m_cabin);
default: return CValueObject::propertyByIndex(index);
}
}
void CAircraftLights::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CAircraftLights::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CAircraftLights>(); return; }
if (index.isMyself()) { (*this) = variant.value<CAircraftLights>(); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
@@ -137,7 +137,7 @@ namespace BlackMisc
}
}
int CAircraftLights::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftLights &compareValue) const
int CAircraftLights::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftLights &compareValue) const
{
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)

View File

@@ -114,13 +114,13 @@ namespace BlackMisc
void guessLights(const CAircraftSituation &situation);
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! Compare by index
int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftLights &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftLights &compareValue) const;
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;

View File

@@ -239,34 +239,34 @@ namespace BlackMisc
return a;
}
CVariant CAircraftParts::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
QVariant CAircraftParts::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
if (ITimestampWithOffsetBased::canHandleIndex(index)) { return ITimestampWithOffsetBased::propertyByIndex(index); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexEngines: return CVariant::fromValue(m_engines);
case IndexEnginesAsString: return CVariant::fromValue(m_engines.toQString(true));
case IndexFlapsPercentage: return CVariant::fromValue(m_flapsPercentage);
case IndexGearDown: return CVariant::fromValue(m_gearDown);
case IndexEngines: return QVariant::fromValue(m_engines);
case IndexEnginesAsString: return QVariant::fromValue(m_engines.toQString(true));
case IndexFlapsPercentage: return QVariant::fromValue(m_flapsPercentage);
case IndexGearDown: return QVariant::fromValue(m_gearDown);
case IndexLights: return m_lights.propertyByIndex(index.copyFrontRemoved());
case IndexSpoilersOut: return CVariant::fromValue(m_spoilersOut);
case IndexIsOnGround: return CVariant::fromValue(m_isOnGround);
case IndexSpoilersOut: return QVariant::fromValue(m_spoilersOut);
case IndexIsOnGround: return QVariant::fromValue(m_isOnGround);
default: return CValueObject::propertyByIndex(index);
}
}
void CAircraftParts::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CAircraftParts::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CAircraftParts>(); return; }
if (index.isMyself()) { (*this) = variant.value<CAircraftParts>(); return; }
if (ITimestampWithOffsetBased::canHandleIndex(index)) { ITimestampWithOffsetBased::setPropertyByIndex(index, variant); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexEngines: m_engines = variant.to<decltype(m_engines)> (); break;
case IndexEngines: m_engines = variant.value<decltype(m_engines)> (); break;
case IndexFlapsPercentage: m_flapsPercentage = variant.toInt(); break;
case IndexGearDown: m_gearDown = variant.toBool(); break;
case IndexLights: m_lights.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
@@ -276,7 +276,7 @@ namespace BlackMisc
}
}
int CAircraftParts::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftParts &compareValue) const
int CAircraftParts::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftParts &compareValue) const
{
if (index.isMyself()) { return ITimestampWithOffsetBased::comparePropertyByIndex(CPropertyIndex(), compareValue); }
if (ITimestampWithOffsetBased::canHandleIndex(index)) { return ITimestampWithOffsetBased::comparePropertyByIndex(index, compareValue); }

View File

@@ -72,13 +72,13 @@ namespace BlackMisc
const CAircraftEngineList &engines, bool onGround, qint64 timestamp);
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftParts &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftParts &compareValue) const;
//! Get aircraft lights
CAircraftLights getLights() const { return m_lights; }

View File

@@ -327,9 +327,9 @@ namespace BlackMisc
return false;
}
CVariant CAircraftSituation::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
QVariant CAircraftSituation::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
if (ITimestampWithOffsetBased::canHandleIndex(index)) { return ITimestampWithOffsetBased::propertyByIndex(index); }
if (ICoordinateGeodetic::canHandleIndex(index)) { return ICoordinateGeodetic::propertyByIndex(index); }
@@ -342,29 +342,29 @@ namespace BlackMisc
case IndexAltitude: return this->getAltitude().propertyByIndex(index.copyFrontRemoved());
case IndexHeading: return m_heading.propertyByIndex(index.copyFrontRemoved());
case IndexPitch: return m_pitch.propertyByIndex(index.copyFrontRemoved());
case IndexPBHInfo: return CVariant::fromValue(this->getPBHInfo());
case IndexPBHInfo: return QVariant::fromValue(this->getPBHInfo());
case IndexBank: return m_bank.propertyByIndex(index.copyFrontRemoved());
case IndexCG: return m_cg.propertyByIndex(index.copyFrontRemoved());
case IndexSceneryOffset: return m_sceneryOffset.propertyByIndex(index.copyFrontRemoved());
case IndexGroundSpeed: return m_groundSpeed.propertyByIndex(index.copyFrontRemoved());
case IndexGroundElevationPlane: return m_groundElevationPlane.propertyByIndex(index.copyFrontRemoved());
case IndexCallsign: return m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved());
case IndexIsOnGround: return CVariant::fromValue(m_onGround);
case IndexIsOnGroundString: return CVariant::fromValue(this->onGroundAsString());
case IndexOnGroundReliability: return CVariant::fromValue(m_onGroundDetails);
case IndexOnGroundReliabilityString: return CVariant::fromValue(this->getOnGroundDetailsAsString());
case IndexGroundElevationInfo: return CVariant::fromValue(this->getGroundElevationInfo());
case IndexGroundElevationInfoTransferred: return CVariant::fromValue(this->isGroundElevationInfoTransferred());
case IndexGroundElevationInfoString: return CVariant::fromValue(this->getGroundElevationInfoAsString());
case IndexGroundElevationPlusInfo: return CVariant::fromValue(this->getGroundElevationAndInfo());
case IndexCanLikelySkipNearGroundInterpolation: return CVariant::fromValue(this->canLikelySkipNearGroundInterpolation());
case IndexIsOnGround: return QVariant::fromValue(m_onGround);
case IndexIsOnGroundString: return QVariant::fromValue(this->onGroundAsString());
case IndexOnGroundReliability: return QVariant::fromValue(m_onGroundDetails);
case IndexOnGroundReliabilityString: return QVariant::fromValue(this->getOnGroundDetailsAsString());
case IndexGroundElevationInfo: return QVariant::fromValue(this->getGroundElevationInfo());
case IndexGroundElevationInfoTransferred: return QVariant::fromValue(this->isGroundElevationInfoTransferred());
case IndexGroundElevationInfoString: return QVariant::fromValue(this->getGroundElevationInfoAsString());
case IndexGroundElevationPlusInfo: return QVariant::fromValue(this->getGroundElevationAndInfo());
case IndexCanLikelySkipNearGroundInterpolation: return QVariant::fromValue(this->canLikelySkipNearGroundInterpolation());
default: return CValueObject::propertyByIndex(index);
}
}
void CAircraftSituation::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CAircraftSituation::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CAircraftSituation>(); return; }
if (index.isMyself()) { (*this) = variant.value<CAircraftSituation>(); return; }
if (ITimestampWithOffsetBased::canHandleIndex(index)) { ITimestampWithOffsetBased::setPropertyByIndex(index, variant); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
@@ -388,7 +388,7 @@ namespace BlackMisc
}
}
int CAircraftSituation::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftSituation &compareValue) const
int CAircraftSituation::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftSituation &compareValue) const
{
if (ITimestampWithOffsetBased::canHandleIndex(index)) { return ITimestampWithOffsetBased::comparePropertyByIndex(index, compareValue); }
if (ICoordinateGeodetic::canHandleIndex(index)) { return ICoordinateGeodetic::comparePropertyByIndex(index, compareValue); }

View File

@@ -155,13 +155,13 @@ namespace BlackMisc
QString convertToQString(bool i18n = false) const;
//! \copydoc Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! \copydoc Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftSituation &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftSituation &compareValue) const;
//! Get position
const Geo::CCoordinateGeodetic &getPosition() const { return m_position; }

View File

@@ -129,36 +129,36 @@ namespace BlackMisc
u" elv. " % m_elvMean.valueRoundedWithUnit(1) % u'/' % m_elvStdDev.valueRoundedWithUnit(1);
}
CVariant CAircraftSituationChange::propertyByIndex(const CPropertyIndex &index) const
QVariant CAircraftSituationChange::propertyByIndex(CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::fromValue(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
if (ITimestampWithOffsetBased::canHandleIndex(index)) { return ITimestampWithOffsetBased::propertyByIndex(index); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexCallsign: return m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved());
case IndexSituationsCount: return CVariant::fromValue(m_situationsCount);
case IndexConstAscending: return CVariant::fromValue(m_constAscending);
case IndexConstDescending: return CVariant::fromValue(m_constDescending);
case IndexConstNotOnGround: return CVariant::fromValue(m_constNotOnGround);
case IndexConstOnGround: return CVariant::fromValue(m_constOnGround);
case IndexIsNull: return CVariant::fromValue(this->isNull());
case IndexJustTakingOff: return CVariant::fromValue(m_justTakeoff);
case IndexJustTouchingDown: return CVariant::fromValue(m_justTouchdown);
case IndexRotatingUp: return CVariant::fromValue(m_rotateUp);
case IndexContainsPushBack: return CVariant::fromValue(m_containsPushBack);
case IndexAltitudeMean: return CVariant::fromValue(m_altMean);
case IndexAltitudeStdDev: return CVariant::fromValue(m_altStdDev);
case IndexElevationMean: return CVariant::fromValue(m_elvMean);
case IndexElevationStdDev: return CVariant::fromValue(m_elvStdDev);
case IndexSituationsCount: return QVariant::fromValue(m_situationsCount);
case IndexConstAscending: return QVariant::fromValue(m_constAscending);
case IndexConstDescending: return QVariant::fromValue(m_constDescending);
case IndexConstNotOnGround: return QVariant::fromValue(m_constNotOnGround);
case IndexConstOnGround: return QVariant::fromValue(m_constOnGround);
case IndexIsNull: return QVariant::fromValue(this->isNull());
case IndexJustTakingOff: return QVariant::fromValue(m_justTakeoff);
case IndexJustTouchingDown: return QVariant::fromValue(m_justTouchdown);
case IndexRotatingUp: return QVariant::fromValue(m_rotateUp);
case IndexContainsPushBack: return QVariant::fromValue(m_containsPushBack);
case IndexAltitudeMean: return QVariant::fromValue(m_altMean);
case IndexAltitudeStdDev: return QVariant::fromValue(m_altStdDev);
case IndexElevationMean: return QVariant::fromValue(m_elvMean);
case IndexElevationStdDev: return QVariant::fromValue(m_elvStdDev);
default: return CValueObject::propertyByIndex(index);
}
}
void CAircraftSituationChange::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CAircraftSituationChange::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CAircraftSituationChange>(); return; }
if (index.isMyself()) { (*this) = variant.value<CAircraftSituationChange>(); return; }
if (ITimestampWithOffsetBased::canHandleIndex(index)) { ITimestampWithOffsetBased::setPropertyByIndex(index, variant); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
@@ -184,7 +184,7 @@ namespace BlackMisc
}
}
int CAircraftSituationChange::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftSituationChange &compareValue) const
int CAircraftSituationChange::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftSituationChange &compareValue) const
{
if (index.isMyself()) { return ITimestampWithOffsetBased::comparePropertyByIndex(CPropertyIndex(), compareValue); }
if (ITimestampWithOffsetBased::canHandleIndex(index)) { return ITimestampWithOffsetBased::comparePropertyByIndex(index, compareValue); }

View File

@@ -161,13 +161,13 @@ namespace BlackMisc
QString convertToQString(bool i18n = false) const;
//! \copydoc Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! \copydoc Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftSituationChange &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftSituationChange &compareValue) const;
//! Calculate the standard deviiations
bool calculateStdDeviations(const CAircraftSituationList &situations, const PhysicalQuantities::CLength &cg);

View File

@@ -216,34 +216,34 @@ namespace BlackMisc
return s.trimmed();
}
CVariant CAirlineIcaoCode::propertyByIndex(const CPropertyIndex &index) const
QVariant CAirlineIcaoCode::propertyByIndex(CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexAirlineDesignator: return CVariant::fromValue(m_designator);
case IndexIataCode: return CVariant::fromValue(m_iataCode);
case IndexAirlineCountryIso: return CVariant::fromValue(this->getCountryIso());
case IndexAirlineDesignator: return QVariant::fromValue(m_designator);
case IndexIataCode: return QVariant::fromValue(m_iataCode);
case IndexAirlineCountryIso: return QVariant::fromValue(this->getCountryIso());
case IndexAirlineCountry: return m_country.propertyByIndex(index.copyFrontRemoved());
case IndexAirlineName: return CVariant::fromValue(m_name);
case IndexAirlineIconHTML: return CVariant::fromValue(this->getIconAsHTMLImage());
case IndexTelephonyDesignator: return CVariant::fromValue(m_telephonyDesignator);
case IndexIsVirtualAirline: return CVariant::fromValue(m_isVa);
case IndexIsOperating: return CVariant::fromValue(m_isOperating);
case IndexIsMilitary: return CVariant::fromValue(m_isMilitary);
case IndexDesignatorNameCountry: return CVariant::fromValue(this->getDesignatorNameCountry());
case IndexGroupDesignator: return CVariant::fromValue(this->getGroupDesignator());
case IndexGroupName: return CVariant::fromValue(this->getGroupName());
case IndexGroupId: return CVariant::fromValue(this->getGroupId());
case IndexAirlineName: return QVariant::fromValue(m_name);
case IndexAirlineIconHTML: return QVariant::fromValue(this->getIconAsHTMLImage());
case IndexTelephonyDesignator: return QVariant::fromValue(m_telephonyDesignator);
case IndexIsVirtualAirline: return QVariant::fromValue(m_isVa);
case IndexIsOperating: return QVariant::fromValue(m_isOperating);
case IndexIsMilitary: return QVariant::fromValue(m_isMilitary);
case IndexDesignatorNameCountry: return QVariant::fromValue(this->getDesignatorNameCountry());
case IndexGroupDesignator: return QVariant::fromValue(this->getGroupDesignator());
case IndexGroupName: return QVariant::fromValue(this->getGroupName());
case IndexGroupId: return QVariant::fromValue(this->getGroupId());
default: return CValueObject::propertyByIndex(index);
}
}
void CAirlineIcaoCode::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CAirlineIcaoCode::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CAirlineIcaoCode>(); return; }
if (index.isMyself()) { (*this) = variant.value<CAirlineIcaoCode>(); return; }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
@@ -256,14 +256,14 @@ namespace BlackMisc
case IndexIsVirtualAirline: this->setVirtualAirline(variant.toBool()); break;
case IndexIsOperating: this->setOperating(variant.toBool()); break;
case IndexIsMilitary: this->setMilitary(variant.toBool()); break;
case IndexGroupDesignator: this->setGroupDesignator(variant.toQString()); break;
case IndexGroupName: this->setGroupName(variant.toQString()); break;
case IndexGroupDesignator: this->setGroupDesignator(variant.toString()); break;
case IndexGroupName: this->setGroupName(variant.toString()); break;
case IndexGroupId: this->setGroupId(variant.toInt()); break;
default: CValueObject::setPropertyByIndex(index, variant); break;
}
}
int CAirlineIcaoCode::comparePropertyByIndex(const CPropertyIndex &index, const CAirlineIcaoCode &compareValue) const
int CAirlineIcaoCode::comparePropertyByIndex(CPropertyIndexRef index, const CAirlineIcaoCode &compareValue) const
{
if (index.isMyself()) { return m_designator.compare(compareValue.getDesignator(), Qt::CaseInsensitive); }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue);}

View File

@@ -214,13 +214,13 @@ namespace BlackMisc
QString convertToQString(bool i18n = false) const;
//! \copydoc Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! \copydoc Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CAirlineIcaoCode &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CAirlineIcaoCode &compareValue) const;
//! Get icon resource path
QString getIconResourcePath() const;

View File

@@ -104,18 +104,18 @@ namespace BlackMisc
return airport;
}
CVariant CAirport::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
QVariant CAirport::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexIcao: return m_icao.propertyByIndex(index.copyFrontRemoved());
case IndexLocation: return CVariant(m_location);
case IndexDescriptiveName: return CVariant(m_descriptiveName);
case IndexLocation: return QVariant(m_location);
case IndexDescriptiveName: return QVariant(m_descriptiveName);
case IndexPosition: return m_position.propertyByIndex(index.copyFrontRemoved());
case IndexElevation: return this->getElevation().propertyByIndex(index.copyFrontRemoved());
case IndexOperating: return CVariant::from(this->isOperating());
case IndexOperating: return QVariant::fromValue(this->isOperating());
default:
return (ICoordinateWithRelativePosition::canHandleIndex(index)) ?
ICoordinateWithRelativePosition::propertyByIndex(index) :
@@ -123,9 +123,9 @@ namespace BlackMisc
}
}
void CAirport::setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant)
void CAirport::setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CAirport>(); return; }
if (index.isMyself()) { (*this) = variant.value<CAirport>(); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
@@ -133,10 +133,10 @@ namespace BlackMisc
m_icao.setPropertyByIndex(index.copyFrontRemoved(), variant);
break;
case IndexLocation:
this->setLocation(variant.toQString());
this->setLocation(variant.toString());
break;
case IndexDescriptiveName:
this->setDescriptiveName(variant.toQString());
this->setDescriptiveName(variant.toString());
break;
case IndexPosition:
m_position.setPropertyByIndex(index.copyFrontRemoved(), variant);
@@ -157,7 +157,7 @@ namespace BlackMisc
}
}
int CAirport::comparePropertyByIndex(const CPropertyIndex &index, const CAirport &compareValue) const
int CAirport::comparePropertyByIndex(CPropertyIndexRef index, const CAirport &compareValue) const
{
if (index.isMyself()) { return m_icao.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getIcao()); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();

View File

@@ -151,13 +151,13 @@ namespace BlackMisc
virtual std::array<double, 3> normalVectorDouble() const override { return this->getPosition().normalVectorDouble(); }
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant);
//! Compare by index
int comparePropertyByIndex(const CPropertyIndex &index, const CAirport &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CAirport &compareValue) const;
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;

View File

@@ -55,19 +55,19 @@ namespace BlackMisc
return (containsChar(icaoCode, [](QChar c) { return c.isDigit(); }));
}
CVariant CAirportIcaoCode::propertyByIndex(const CPropertyIndex &index) const
QVariant CAirportIcaoCode::propertyByIndex(CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
return CValueObject::propertyByIndex(index);
}
void CAirportIcaoCode::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CAirportIcaoCode::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CAirportIcaoCode>(); return; }
if (index.isMyself()) { (*this) = variant.value<CAirportIcaoCode>(); return; }
CValueObject::setPropertyByIndex(index, variant);
}
int CAirportIcaoCode::comparePropertyByIndex(const CPropertyIndex &index, const CAirportIcaoCode &compareValue) const
int CAirportIcaoCode::comparePropertyByIndex(CPropertyIndexRef index, const CAirportIcaoCode &compareValue) const
{
Q_UNUSED(index);
return m_icaoCode.compare(compareValue.getIcaoCode(), Qt::CaseInsensitive);

View File

@@ -65,13 +65,13 @@ namespace BlackMisc
QString convertToQString(bool i18n = false) const;
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CAirportIcaoCode &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CAirportIcaoCode &compareValue) const;
//! Valid code lenght
static bool validCodeLength(int l, bool strict);

View File

@@ -119,7 +119,7 @@ namespace BlackMisc
}
}
int CAltitude::comparePropertyByIndex(const CPropertyIndex &index, const CAltitude &compareValue) const
int CAltitude::comparePropertyByIndex(CPropertyIndexRef index, const CAltitude &compareValue) const
{
if (index.isMyself()) { return this->compare(compareValue); }
return CLength::comparePropertyByIndex(index, compareValue);

View File

@@ -202,7 +202,7 @@ namespace BlackMisc
QString convertToQString(bool i18n = false) const;
//! \copydoc Mixin::Index::setPropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CAltitude &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CAltitude &compareValue) const;
//! Round to the nearest 100ft, like needed for China and Russia
//! \remark https://en.wikipedia.org/wiki/Flight_level

View File

@@ -366,28 +366,28 @@ namespace BlackMisc
return m_position.normalVectorDouble();
}
CVariant CAtcStation::propertyByIndex(const CPropertyIndex &index) const
QVariant CAtcStation::propertyByIndex(CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexBookedFrom: return CVariant::from(m_bookedFromUtc);
case IndexBookedUntil: return CVariant::from(m_bookedUntilUtc);
case IndexBookedFrom: return QVariant::fromValue(m_bookedFromUtc);
case IndexBookedUntil: return QVariant::fromValue(m_bookedUntilUtc);
case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved());
case IndexCallsignString: return this->getCallsignAsString();
case IndexCallsignStringCrossCopuled: return this->getCallsignAsStringCrossCoupled();
case IndexController: return m_controller.propertyByIndex(index.copyFrontRemoved());
case IndexFrequency: return m_frequency.propertyByIndex(index.copyFrontRemoved());
case IndexIsOnline: return CVariant::from(m_isOnline);
case IndexIsOnline: return QVariant::fromValue(m_isOnline);
case IndexLatitude: return this->latitude().propertyByIndex(index.copyFrontRemoved());
case IndexLongitude: return this->longitude().propertyByIndex(index.copyFrontRemoved());
case IndexPosition: return m_position.propertyByIndex(index.copyFrontRemoved());
case IndexRange: return m_range.propertyByIndex(index.copyFrontRemoved());
case IndexIsInRange: return CVariant::fromValue(isInRange());
case IndexIsInRange: return QVariant::fromValue(isInRange());
case IndexAtis: return m_atis.propertyByIndex(index.copyFrontRemoved());
case IndexMetar: return m_metar.propertyByIndex(index.copyFrontRemoved());
case IndexIsAfvCrossCoupled: return CVariant::from(m_isAfvCrossCoupled);
case IndexIsAfvCrossCoupled: return QVariant::fromValue(m_isAfvCrossCoupled);
default:
return (ICoordinateWithRelativePosition::canHandleIndex(index)) ?
ICoordinateWithRelativePosition::propertyByIndex(index) :
@@ -395,9 +395,9 @@ namespace BlackMisc
}
}
void CAtcStation::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CAtcStation::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CAtcStation>(); return; }
if (index.isMyself()) { (*this) = variant.value<CAtcStation>(); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
@@ -415,7 +415,7 @@ namespace BlackMisc
case IndexCallsignString:
case IndexCallsignStringCrossCopuled:
{
const QString cs = variant.toQString();
const QString cs = variant.toString();
*this = CAtcStation();
this->setAfvCrossCoupled(cs.startsWith('*'));
}
@@ -433,7 +433,7 @@ namespace BlackMisc
}
}
int CAtcStation::comparePropertyByIndex(const CPropertyIndex &index, const CAtcStation &compareValue) const
int CAtcStation::comparePropertyByIndex(CPropertyIndexRef index, const CAtcStation &compareValue) const
{
if (index.isMyself()) { return this->getCallsign().comparePropertyByIndex(CPropertyIndexRef::empty(), compareValue.getCallsign()); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();

View File

@@ -256,13 +256,13 @@ namespace BlackMisc
virtual std::array<double, 3> normalVectorDouble() const override;
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CAtcStation &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CAtcStation &compareValue) const;
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;

View File

@@ -311,36 +311,36 @@ namespace BlackMisc
return other == (*this);
}
CVariant CCallsign::propertyByIndex(const CPropertyIndex &index) const
QVariant CCallsign::propertyByIndex(CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexCallsignString: return CVariant(this->asString());
case IndexCallsignStringAsSet: return CVariant(this->getStringAsSet());
case IndexTelephonyDesignator: return CVariant(this->getTelephonyDesignator());
case IndexSuffix: return CVariant(this->getSuffix());
case IndexCallsignString: return QVariant(this->asString());
case IndexCallsignStringAsSet: return QVariant(this->getStringAsSet());
case IndexTelephonyDesignator: return QVariant(this->getTelephonyDesignator());
case IndexSuffix: return QVariant(this->getSuffix());
default: return CValueObject::propertyByIndex(index);
}
}
void CCallsign::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CCallsign::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CCallsign>(); return; }
if (index.isMyself()) { (*this) = variant.value<CCallsign>(); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexCallsignString: m_callsign = unifyCallsign(variant.toQString()); break;
case IndexCallsignStringAsSet: m_callsignAsSet = variant.toQString(); break;
case IndexTelephonyDesignator: m_telephonyDesignator = variant.toQString(); break;
case IndexCallsignString: m_callsign = unifyCallsign(variant.toString()); break;
case IndexCallsignStringAsSet: m_callsignAsSet = variant.toString(); break;
case IndexTelephonyDesignator: m_telephonyDesignator = variant.toString(); break;
default:
CValueObject::setPropertyByIndex(index, variant);
break;
}
}
int CCallsign::comparePropertyByIndex(const CPropertyIndex &index, const CCallsign &compareValue) const
int CCallsign::comparePropertyByIndex(CPropertyIndexRef index, const CCallsign &compareValue) const
{
if (index.isMyself()) { return m_callsign.compare(compareValue.m_callsign, Qt::CaseInsensitive); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();

View File

@@ -158,13 +158,13 @@ namespace BlackMisc
CIcons::IconIndex toIcon() const { return convertToIcon(*this).getIndex(); }
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CCallsign &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CCallsign &compareValue) const;
//! \copydoc BlackMisc::Mixin::String::toQString()
QString convertToQString(bool i18n = false) const;

View File

@@ -320,9 +320,9 @@ namespace BlackMisc
return CFlightPlan::concatPrefixIcaoSuffix(m_prefix, m_aircraftIcao.getDesignator(), m_equipmentSuffix);
}
CVariant CFlightPlan::propertyByIndex(const CPropertyIndex &index) const
QVariant CFlightPlan::propertyByIndex(CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
@@ -332,14 +332,14 @@ namespace BlackMisc
case IndexDestinationAirportIcao: return m_destinationAirportIcao.propertyByIndex(index.copyFrontRemoved());
case IndexOriginAirportIcao: return m_originAirportIcao.propertyByIndex(index.copyFrontRemoved());
case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved());
case IndexRemarks: return CVariant::from(m_remarks);
case IndexRemarks: return QVariant::fromValue(m_remarks);
default: return CValueObject::propertyByIndex(index);
}
}
void CFlightPlan::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CFlightPlan::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CFlightPlan>(); return; }
if (index.isMyself()) { (*this) = variant.value<CFlightPlan>(); return; }
if (ITimestampBased::canHandleIndex(index))
{
ITimestampBased::setPropertyByIndex(index, variant);
@@ -353,7 +353,7 @@ namespace BlackMisc
case IndexDestinationAirportIcao: m_destinationAirportIcao.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
case IndexOriginAirportIcao: m_originAirportIcao.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
case IndexCallsign: m_callsign.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
case IndexRemarks: this->setRemarks(variant.toQString()); break;
case IndexRemarks: this->setRemarks(variant.toString()); break;
default: CValueObject::setPropertyByIndex(index, variant); break;
}
}

View File

@@ -372,10 +372,10 @@ namespace BlackMisc
QString getCombinedPrefixIcaoSuffix() const;
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! \copydoc BlackMisc::Mixin::Icon::toIcon
CIcons::IconIndex toIcon() const;

View File

@@ -58,35 +58,35 @@ namespace BlackMisc
}
}
CVariant CInformationMessage::propertyByIndex(const CPropertyIndex &index) const
QVariant CInformationMessage::propertyByIndex(CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexType: return CVariant::from(m_type);
case IndexMessage: return CVariant::from(m_message);
case IndexType: return QVariant::fromValue(m_type);
case IndexMessage: return QVariant::fromValue(m_message);
default: break;
}
return CValueObject::propertyByIndex(index);
}
void CInformationMessage::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CInformationMessage::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CInformationMessage>(); return; }
if (index.isMyself()) { (*this) = variant.value<CInformationMessage>(); return; }
if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexType: m_type = static_cast<InformationType>(variant.toInt()); break;
case IndexMessage: m_message = variant.toQString(); break;
case IndexMessage: m_message = variant.toString(); break;
default: break;
}
CValueObject::setPropertyByIndex(index, variant);
}
int CInformationMessage::comparePropertyByIndex(const CPropertyIndex &index, const CInformationMessage &compareValue) const
int CInformationMessage::comparePropertyByIndex(CPropertyIndexRef index, const CInformationMessage &compareValue) const
{
if (index.isMyself())
{

View File

@@ -99,13 +99,13 @@ namespace BlackMisc
bool isEmpty() const { return m_message.isEmpty(); }
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const CInformationMessage &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CInformationMessage &compareValue) const;
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;

View File

@@ -352,9 +352,9 @@ namespace BlackMisc
return temp;
}
CVariant CLivery::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
QVariant CLivery::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
@@ -362,31 +362,31 @@ namespace BlackMisc
case IndexAirlineIcaoCode: return m_airline.propertyByIndex(index.copyFrontRemoved());
case IndexColorFuselage: return m_colorFuselage.propertyByIndex(index.copyFrontRemoved());;
case IndexColorTail: return m_colorTail.propertyByIndex(index.copyFrontRemoved());
case IndexDescription: return CVariant::fromValue(m_description);
case IndexCombinedCode: return CVariant::fromValue(m_combinedCode);
case IndexIsMilitary: return CVariant::fromValue(m_military);
case IndexDescription: return QVariant::fromValue(m_description);
case IndexCombinedCode: return QVariant::fromValue(m_combinedCode);
case IndexIsMilitary: return QVariant::fromValue(m_military);
default: return CValueObject::propertyByIndex(index);
}
}
void CLivery::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CLivery::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CLivery>(); return; }
if (index.isMyself()) { (*this) = variant.value<CLivery>(); return; }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexDescription: m_description = variant.toQString(false); break;
case IndexDescription: m_description = variant.toString(); break;
case IndexAirlineIcaoCode: m_airline.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
case IndexColorFuselage: m_colorFuselage.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
case IndexColorTail: m_colorTail.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
case IndexCombinedCode: this->setCombinedCode(variant.toQString(false)); break;
case IndexCombinedCode: this->setCombinedCode(variant.toString()); break;
case IndexIsMilitary: this->setMilitary(variant.toBool()); break;
default: CValueObject::setPropertyByIndex(index, variant); break;
}
}
int CLivery::comparePropertyByIndex(const CPropertyIndex &index, const CLivery &compareValue) const
int CLivery::comparePropertyByIndex(CPropertyIndexRef index, const CLivery &compareValue) const
{
if (index.isMyself()) { return this->getCombinedCode().compare(compareValue.getCombinedCode()); }
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue);}

View File

@@ -138,13 +138,13 @@ namespace BlackMisc
bool matchesColors(const CRgbColor &fuselage, const CRgbColor &tail) const;
//! \copydoc Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! Compare for index
int comparePropertyByIndex(const CPropertyIndex &index, const CLivery &compareValue) const;
int comparePropertyByIndex(CPropertyIndexRef index, const CLivery &compareValue) const;
//! \copydoc Mixin::String::toQString
QString convertToQString(bool i18n = false) const;

View File

@@ -116,25 +116,25 @@ namespace BlackMisc
}
template <class AVIO>
CVariant CModulator<AVIO>::propertyByIndex(const CPropertyIndex &index) const
QVariant CModulator<AVIO>::propertyByIndex(CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*derived()); }
if (index.isMyself()) { return QVariant::fromValue(*derived()); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexActiveFrequency: return this->getFrequencyActive().propertyByIndex(index.copyFrontRemoved());
case IndexStandbyFrequency: return this->getFrequencyStandby().propertyByIndex(index.copyFrontRemoved());
case IndexEnabledTransmit: return CVariant::from(this->isTransmitEnabled());
case IndexEnabledReceive: return CVariant::from(this->isReceiveEnabled());
case IndexTransmitVolume: return CVariant::from(this->getVolumeTransmit());
case IndexReceiveVolume: return CVariant::from(this->getVolumeReceive());
case IndexEnabledTransmit: return QVariant::fromValue(this->isTransmitEnabled());
case IndexEnabledReceive: return QVariant::fromValue(this->isReceiveEnabled());
case IndexTransmitVolume: return QVariant::fromValue(this->getVolumeTransmit());
case IndexReceiveVolume: return QVariant::fromValue(this->getVolumeReceive());
default:
return CValueObject<CModulator<AVIO>>::propertyByIndex(index);
}
}
template <class AVIO>
void CModulator<AVIO>::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CModulator<AVIO>::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong index to base template"); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
@@ -153,7 +153,7 @@ namespace BlackMisc
}
template <class AVIO>
int CModulator<AVIO>::comparePropertyByIndex(const CPropertyIndex &index, const AVIO &compareValue) const
int CModulator<AVIO>::comparePropertyByIndex(CPropertyIndexRef index, const AVIO &compareValue) const
{
if (index.isMyself()) { return m_frequencyActive.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.m_frequencyActive); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();

View File

@@ -70,13 +70,13 @@ namespace BlackMisc
void setReceiveEnabled(bool enable);
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant);
//! Compare by property index
int comparePropertyByIndex(const BlackMisc::CPropertyIndex &index, const AVIO &compareValue) const;
int comparePropertyByIndex(BlackMisc::CPropertyIndexRef index, const AVIO &compareValue) const;
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;

View File

@@ -36,26 +36,26 @@ namespace BlackMisc
return url;
}
CVariant CSimBriefData::propertyByIndex(const CPropertyIndex &index) const
QVariant CSimBriefData::propertyByIndex(CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexUrl: return CVariant::from(m_url);
case IndexUsername: return CVariant::from(m_username);
case IndexUrl: return QVariant::fromValue(m_url);
case IndexUsername: return QVariant::fromValue(m_username);
default: return CValueObject::propertyByIndex(index);
}
}
void CSimBriefData::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CSimBriefData::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CSimBriefData>(); return; }
if (index.isMyself()) { (*this) = variant.value<CSimBriefData>(); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexUrl: m_url = variant.toQString(); break;
case IndexUsername: m_username = variant.toQString(); break;
case IndexUrl: m_url = variant.toString(); break;
case IndexUsername: m_username = variant.toString(); break;
default: CValueObject::setPropertyByIndex(index, variant); break;
}
}

View File

@@ -60,10 +60,10 @@ namespace BlackMisc
void setUrl(const QString &url) { m_url = url; }
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! \copydoc BlackMisc::Mixin::String::toQString()
QString convertToQString(bool i18n = false) const;

View File

@@ -221,33 +221,33 @@ namespace BlackMisc
return i;
}
CVariant CTransponder::propertyByIndex(const CPropertyIndex &index) const
QVariant CTransponder::propertyByIndex(CPropertyIndexRef index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (index.isMyself()) { return QVariant::fromValue(*this); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexMode: return CVariant::from(this->getTransponderMode());
case IndexModeAsString: return CVariant::from(this->getModeAsString());
case IndexTransponderCode: return CVariant::from(this->getTransponderCode());
case IndexTransponderCodeFormatted: return CVariant::from(this->getTransponderCodeFormatted());
case IndexTransponderCodeAndModeFormatted: return CVariant::from(this->getTransponderCodeAndModeFormatted());
case IndexMode: return QVariant::fromValue(this->getTransponderMode());
case IndexModeAsString: return QVariant::fromValue(this->getModeAsString());
case IndexTransponderCode: return QVariant::fromValue(this->getTransponderCode());
case IndexTransponderCodeFormatted: return QVariant::fromValue(this->getTransponderCodeFormatted());
case IndexTransponderCodeAndModeFormatted: return QVariant::fromValue(this->getTransponderCodeAndModeFormatted());
default: break;
}
Q_ASSERT_X(false, "CTransponder", "index unknown");
const QString m = QString("no property, index ").append(index.toQString());
return CVariant::fromValue(m);
return QVariant::fromValue(m);
}
void CTransponder::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
void CTransponder::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CTransponder>(); return; }
if (index.isMyself()) { (*this) = variant.value<CTransponder>(); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexMode: m_transponderMode = variant.toInt(); break;
case IndexModeAsString: this->setTransponderMode(modeFromString(variant.toQString())); break;
case IndexModeAsString: this->setTransponderMode(modeFromString(variant.toString())); break;
case IndexTransponderCode:
case IndexTransponderCodeFormatted:
if (variant.canConvert<int>())
@@ -256,7 +256,7 @@ namespace BlackMisc
}
else
{
this->setTransponderCode(variant.toQString());
this->setTransponderCode(variant.toString());
}
break;
case IndexTransponderCodeAndModeFormatted:

View File

@@ -135,10 +135,10 @@ namespace BlackMisc
void setIFR() { m_transponderCode = 2000; }
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const;
QVariant propertyByIndex(CPropertyIndexRef index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;