mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-28 03:35:38 +08:00
refs #345 First wave of value classes using the CValueObjectStdTuple CRTP class template.
This commit is contained in:
@@ -20,7 +20,7 @@ namespace BlackMisc
|
||||
namespace Aviation
|
||||
{
|
||||
//! Value object encapsulating information of a callsign.
|
||||
class CAirportIcao : public BlackMisc::CValueObject
|
||||
class CAirportIcao : public CValueObjectStdTuple<CAirportIcao>
|
||||
{
|
||||
public:
|
||||
//! Default constructor.
|
||||
@@ -32,12 +32,6 @@ namespace BlackMisc
|
||||
//! Constructor, needed to disambiguate implicit conversion from string literal.
|
||||
CAirportIcao(const char *icaoCode) : m_icaoCode(CAirportIcao::unifyAirportCode(icaoCode)) {}
|
||||
|
||||
//! \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); }
|
||||
|
||||
//! Is empty?
|
||||
bool isEmpty() const { return this->m_icaoCode.isEmpty(); }
|
||||
|
||||
@@ -50,30 +44,6 @@ namespace BlackMisc
|
||||
//! Equals callsign string?
|
||||
bool equalsString(const QString &icaoCode) const;
|
||||
|
||||
//! Equal operator ==
|
||||
bool operator ==(const CAirportIcao &other) const;
|
||||
|
||||
//! Unequal operator !=
|
||||
bool operator !=(const CAirportIcao &other) const;
|
||||
|
||||
//! Less than operator < for sorting
|
||||
bool operator <(const CAirportIcao &other) const;
|
||||
|
||||
//! \copydoc CValueObject::getValueHash()
|
||||
virtual uint getValueHash() const override;
|
||||
|
||||
//! \copydoc CValueObject::toJson
|
||||
virtual QJsonObject toJson() const override;
|
||||
|
||||
//! \copydoc CValueObject::convertFromJson
|
||||
virtual void convertFromJson(const QJsonObject &json) override;
|
||||
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
//! Members
|
||||
static const QStringList &jsonMembers();
|
||||
|
||||
//! Unify code
|
||||
static QString unifyAirportCode(const QString &icaoCode);
|
||||
|
||||
@@ -84,21 +54,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(CAirportIcao)
|
||||
QString m_icaoCode;
|
||||
|
||||
Reference in New Issue
Block a user