mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Issue #77 All classes propertyindex methods use CPropertyIndexRef and QVariant
This commit is contained in:
@@ -53,32 +53,32 @@ namespace BlackMisc
|
||||
return None;
|
||||
}
|
||||
|
||||
CVariant CCloudLayer::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
QVariant CCloudLayer::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexBase:
|
||||
return CVariant::fromValue(m_base);
|
||||
return QVariant::fromValue(m_base);
|
||||
case IndexTop:
|
||||
return CVariant::fromValue(m_top);
|
||||
return QVariant::fromValue(m_top);
|
||||
case IndexPrecipitationRate:
|
||||
return CVariant::fromValue(m_precipitationRate);
|
||||
return QVariant::fromValue(m_precipitationRate);
|
||||
case IndexPrecipitation:
|
||||
return CVariant::fromValue(m_precipitation);
|
||||
return QVariant::fromValue(m_precipitation);
|
||||
case IndexClouds:
|
||||
return CVariant::fromValue(m_clouds);
|
||||
return QVariant::fromValue(m_clouds);
|
||||
case IndexCoveragePercent:
|
||||
return CVariant::fromValue(m_coveragePercent);
|
||||
return QVariant::fromValue(m_coveragePercent);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CCloudLayer::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CCloudLayer::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CCloudLayer>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CCloudLayer>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -132,10 +132,10 @@ namespace BlackMisc
|
||||
int getCoveragePercent() const { return m_coveragePercent; }
|
||||
|
||||
//! \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::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -51,32 +51,32 @@ namespace BlackMisc
|
||||
setPressureAtMsl(other.getPressureAtMsl());
|
||||
}
|
||||
|
||||
CVariant CGridPoint::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
QVariant CGridPoint::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexIdentifier:
|
||||
return CVariant::fromValue(m_identifier);
|
||||
return QVariant::fromValue(m_identifier);
|
||||
case IndexPosition:
|
||||
return CVariant::fromValue(m_position);
|
||||
return QVariant::fromValue(m_position);
|
||||
case IndexCloudLayers:
|
||||
return CVariant::fromValue(m_cloudLayers);
|
||||
return QVariant::fromValue(m_cloudLayers);
|
||||
case IndexTemperatureLayers:
|
||||
return CVariant::fromValue(m_temperatureLayers);
|
||||
return QVariant::fromValue(m_temperatureLayers);
|
||||
case IndexWindLayers:
|
||||
return CVariant::fromValue(m_windLayers);
|
||||
return QVariant::fromValue(m_windLayers);
|
||||
case IndexPressureAtMsl:
|
||||
return CVariant::fromValue(m_pressureAtMsl);
|
||||
return QVariant::fromValue(m_pressureAtMsl);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CGridPoint::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CGridPoint::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CGridPoint>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CGridPoint>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -111,10 +111,10 @@ namespace BlackMisc
|
||||
const PhysicalQuantities::CPressure &getPressureAtMsl() const { return m_pressureAtMsl; }
|
||||
|
||||
//! \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::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -26,26 +26,26 @@ namespace BlackMisc
|
||||
m_intensity(intensity), m_descriptor(descriptor), m_weatherPhenomena(weatherPhenomena)
|
||||
{ }
|
||||
|
||||
CVariant CPresentWeather::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
QVariant CPresentWeather::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexIntensity:
|
||||
return CVariant::fromValue(m_intensity);
|
||||
return QVariant::fromValue(m_intensity);
|
||||
case IndexDescriptor:
|
||||
return CVariant::fromValue(m_descriptor);
|
||||
return QVariant::fromValue(m_descriptor);
|
||||
case IndexWeatherPhenomena:
|
||||
return CVariant::fromValue(m_weatherPhenomena);
|
||||
return QVariant::fromValue(m_weatherPhenomena);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CPresentWeather::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CPresentWeather::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CPresentWeather>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CPresentWeather>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -121,10 +121,10 @@ namespace BlackMisc
|
||||
int getWeatherPhenomena() const { return m_weatherPhenomena; }
|
||||
|
||||
//! \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::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -25,28 +25,28 @@ namespace BlackMisc
|
||||
m_level(level), m_temperature(value), m_dewPoint(dewPoint), m_relativeHumidity(relativeHumidity)
|
||||
{ }
|
||||
|
||||
CVariant CTemperatureLayer::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
QVariant CTemperatureLayer::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexLevel:
|
||||
return CVariant::fromValue(m_level);
|
||||
return QVariant::fromValue(m_level);
|
||||
case IndexTemperature:
|
||||
return CVariant::fromValue(m_temperature);
|
||||
return QVariant::fromValue(m_temperature);
|
||||
case IndexDewPoint:
|
||||
return CVariant::fromValue(m_dewPoint);
|
||||
return QVariant::fromValue(m_dewPoint);
|
||||
case IndexRelativeHumidity:
|
||||
return CVariant::fromValue(m_relativeHumidity);
|
||||
return QVariant::fromValue(m_relativeHumidity);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CTemperatureLayer::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CTemperatureLayer::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CTemperatureLayer>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CTemperatureLayer>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -77,10 +77,10 @@ namespace BlackMisc
|
||||
double getRelativeHumidity() const { return m_relativeHumidity; }
|
||||
|
||||
//! \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::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -24,26 +24,26 @@ namespace BlackMisc
|
||||
m_base(base), m_top(top), m_visibility(visibility)
|
||||
{ }
|
||||
|
||||
CVariant CVisibilityLayer::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
QVariant CVisibilityLayer::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexBase:
|
||||
return CVariant::fromValue(m_base);
|
||||
return QVariant::fromValue(m_base);
|
||||
case IndexTop:
|
||||
return CVariant::fromValue(m_top);
|
||||
return QVariant::fromValue(m_top);
|
||||
case IndexVisibility:
|
||||
return CVariant::fromValue(m_visibility);
|
||||
return QVariant::fromValue(m_visibility);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CVisibilityLayer::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CVisibilityLayer::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CVisibilityLayer>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CVisibilityLayer>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -68,10 +68,10 @@ namespace BlackMisc
|
||||
PhysicalQuantities::CLength getVisibility() const { return m_visibility; }
|
||||
|
||||
//! \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::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -28,23 +28,23 @@ namespace BlackMisc
|
||||
m_scenarioDescription(description)
|
||||
{ }
|
||||
|
||||
CVariant CWeatherScenario::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
QVariant CWeatherScenario::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 IndexScenarioIndex: return CVariant::fromValue(m_scenarioIndex);
|
||||
case IndexScenarioName: return CVariant::fromValue(m_scenarioName);
|
||||
case IndexScenarioDescription: return CVariant::fromValue(m_scenarioDescription);
|
||||
case IndexScenarioIndex: return QVariant::fromValue(m_scenarioIndex);
|
||||
case IndexScenarioName: return QVariant::fromValue(m_scenarioName);
|
||||
case IndexScenarioDescription: return QVariant::fromValue(m_scenarioDescription);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CWeatherScenario::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CWeatherScenario::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CWeatherScenario>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CWeatherScenario>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -74,10 +74,10 @@ namespace BlackMisc
|
||||
QString getDescription() const { return m_scenarioDescription; }
|
||||
|
||||
//! \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::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -23,30 +23,30 @@ namespace BlackMisc
|
||||
m_level(level), m_directionMain(direction), m_speed(speed), m_gustSpeed(gustSpeed)
|
||||
{ }
|
||||
|
||||
CVariant CWindLayer::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
QVariant CWindLayer::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexLevel:
|
||||
return CVariant::fromValue(m_level);
|
||||
return QVariant::fromValue(m_level);
|
||||
case IndexDirection:
|
||||
return CVariant::fromValue(m_directionMain);
|
||||
return QVariant::fromValue(m_directionMain);
|
||||
case IndexDirectionVariable:
|
||||
return CVariant::fromValue(m_directionVariable);
|
||||
return QVariant::fromValue(m_directionVariable);
|
||||
case IndexSpeed:
|
||||
return CVariant::fromValue(m_speed);
|
||||
return QVariant::fromValue(m_speed);
|
||||
case IndexGustSpeed:
|
||||
return CVariant::fromValue(m_gustSpeed);
|
||||
return QVariant::fromValue(m_gustSpeed);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CWindLayer::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CWindLayer::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CWindLayer>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CWindLayer>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -103,10 +103,10 @@ namespace BlackMisc
|
||||
PhysicalQuantities::CSpeed getGustSpeed() const { return m_gustSpeed; }
|
||||
|
||||
//! \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::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
Reference in New Issue
Block a user