mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 18:55:38 +08:00
refs #345 First wave of value classes using the CValueObjectStdTuple CRTP class template.
This commit is contained in:
@@ -22,7 +22,7 @@ namespace BlackMisc
|
||||
/*!
|
||||
* Value object for ICAO classification
|
||||
*/
|
||||
class CAircraftIcao : public BlackMisc::CValueObject
|
||||
class CAircraftIcao : public CValueObjectStdTuple<CAircraftIcao>
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
@@ -62,12 +62,6 @@ namespace BlackMisc
|
||||
: m_aircraftDesignator(icao.trimmed().toUpper()), m_aircraftCombinedType(combinedType.trimmed().toUpper()), m_airlineDesignator(airline.trimmed().toUpper()),
|
||||
m_livery(livery.trimmed().toUpper()), m_aircraftColor(color.trimmed().toUpper()) {}
|
||||
|
||||
//! \copydoc CValueObject::toQVariant()
|
||||
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
|
||||
|
||||
//! \copydoc CValueObject::convertFromQVariant
|
||||
virtual void convertFromQVariant(const QVariant &variant) override { BlackMisc::setFromQVariant(this, variant); }
|
||||
|
||||
//! Get ICAO designator, e.g. "B737"
|
||||
const QString &getAircraftDesignator() const { return m_aircraftDesignator; }
|
||||
|
||||
@@ -132,36 +126,15 @@ namespace BlackMisc
|
||||
//! Set type
|
||||
void setAircraftCombinedType(const QString &type) { this->m_aircraftCombinedType = type.trimmed().toUpper(); }
|
||||
|
||||
//! Equal operator ==
|
||||
bool operator ==(const CAircraftIcao &other) const;
|
||||
|
||||
//! Matches wildcard icao object
|
||||
bool matchesWildcardIcao(const CAircraftIcao &otherIcao) const;
|
||||
|
||||
//! Unequal operator !=
|
||||
bool operator !=(const CAircraftIcao &other) const;
|
||||
|
||||
//! Value hash
|
||||
virtual uint getValueHash() const override;
|
||||
|
||||
//! \copydoc CValueObject::toJson
|
||||
virtual QJsonObject toJson() const override;
|
||||
|
||||
//! \copydoc CValueObject::convertFromJson
|
||||
virtual void convertFromJson(const QJsonObject &json) override;
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(variant, index)
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
//! JSON member names
|
||||
static const QStringList &jsonMembers();
|
||||
|
||||
//! Valid designator?
|
||||
static bool isValidDesignator(const QString &designator);
|
||||
|
||||
@@ -169,21 +142,6 @@ namespace BlackMisc
|
||||
//! \copydoc CValueObject::convertToQString
|
||||
virtual QString convertToQString(bool i18n = false) const override;
|
||||
|
||||
//! \copydoc CValueObject::getMetaTypeId
|
||||
virtual int getMetaTypeId() const override;
|
||||
|
||||
//! \copydoc CValueObject::isA
|
||||
virtual bool isA(int metaTypeId) const override;
|
||||
|
||||
//! \copydoc CValueObject::compareImpl
|
||||
virtual int compareImpl(const CValueObject &other) const override;
|
||||
|
||||
//! \copydoc CValueObject::marshallToDbus
|
||||
virtual void marshallToDbus(QDBusArgument &argument) const override;
|
||||
|
||||
//! \copydoc CValueObject::unmarshallFromDbus
|
||||
virtual void unmarshallFromDbus(const QDBusArgument &argument) override;
|
||||
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CAircraftIcao)
|
||||
QString m_aircraftDesignator; //!< "B737"
|
||||
|
||||
Reference in New Issue
Block a user